This is a better fix than the previous ones in JS, as it should cover all assets
that can use Lodash, and it reverts back to the WP Underscore instance.
[MAILPOET-5653]
This ensures that all methods imported from @wordpress/hooks write to the same
instance and thus "addFilter" used in one part of the code works with "applyFilters"
called in another place.
In the future, we should use DependencyExtractionWebpackPlugin to always access
the window.wp.hooks object rather than bundling @wordpress/hooks with our code.
[MAILPOET-5653]
This is only tangentially related to this ticket. I noticed during
testing that the filter segment tag was not showing up in listings for
standard newsletters that were drafts or scheduled. This is because
options weren't included in the response for standard newsletters.
MAILPOET-5512
If the user creates a segment specifically as a filter segment for an
email, we should redirect them to that email's send step after a
successful save.
MAILPOET-5512
A note on using context: we need to be able to save the draft of the
newsletter before redirecting users to the segment creation page,
otherwise they might unexpectedly lose their work. The link exists in
a field, so the alternative to using a context seemed to be passing this
function down as a prop, first to the Form and then to all of the
fields, whether they needed it or not. This seemed clunky at best, and
require changes to Form and Fields that get used many other places in
the plugin.
Using a context was the cleanest solution I could come up with for
avoiding those changes.
MAILPOET-5512
It's not a critical error if we aren't able to save this lookup data,
and we wouldn't want it to interfere with the sending of a newsletter,
but we should log it as an error for debugging purposes.
MAILPOET-5625
For ease of lookup, I changed the helper to return an array with keys
corresponding to the instanceId of the shipping methods. I couldn't see
anywhere else in the codebase where the keys would have mattered.
MAILPOET-5625
This method is intended to store the actual names of things that might
change or be deleted in the future, so we can include accurate
information when showing what the snapshot of the filter was at the time
.
MAILPOET-5625