13986 Commits

Author SHA1 Message Date
Rostislav Wolny
eac9e586f8 Make sure the marketing optin's block category exists
This fixes a warning: The block "mailpoet/marketing-optin-block" is registered with an invalid category "woocommerce".
[MAILPOET-4030]
2021-12-23 08:58:32 +01:00
Rostislav Wolny
0f5391d01a Make sure the marketing optin block script loads in the footer
This fixes a warning comming fromm WooCommerce blocks:
Scripts that have a dependency on [wc-settings, wc-blocks-checkout] must be loaded in the footer, mailpoet-marketing-optin-block-editor-script was registered to load in the header, but has been switched to load in the footer instead.
[MAILPOET-4030]
2021-12-23 08:58:32 +01:00
John Oleksowicz
22e3686810 Restore default select2 search behavior
The select2 data format requires that all option objects include both an
 `id` and `text`. See https://select2.org/data-sources/formats

 By restoring these duplicate properties, we avoid having to write and
 maintain a custom matcher method, and we're protecting ourselves
 against any other unexpected behavior in the future resulting from
 these options not having the required `text` property.

[MAILPOET-3958]
2021-12-23 08:57:02 +01:00
John Oleksowicz
f193957096 Search based on beginning of words
Instead of the search results simply looking to see if a word contains
the term searched for, this makes it so the term has to match the
beginning of one of the words.

For example, let's say the options were:
- First name
- Confirmation time

Previously, a search for "n" would return both, because there is an n in
 the word Confirmation. With this change, only First name would match
 because the word name starts with n.

See the Jira ticket for discussion.

[MAILPOET-3958]
2021-12-23 08:57:02 +01:00
John Oleksowicz
b682eb6239 Fix search input not receiving focus bug
There is a bug with jQuery 3.6.0 and select2 4.1.0-rc.0, both the most
current versions of the packages, where select dropdown search inputs
don't receive focus when they're opened. See
https://github.com/select2/select2/issues/5993 for more details.

Unfortunately the 'select2:open' event doesn't include anything that
seems helpful to locate the input that was opened, which is why
I'm using document.querySelectorAll.

Another quirk is that select2 adds two elements to the DOM when our
select is opened: an input and a textarea, both with almost identical
attributes. The query could just as easily look for
`input.select2-search__field`, but it seems clearer to me that the
element with the aria-controls attribute is the appropriate one to
choose (to be clear, the irrelevant textarea doesn't have that).

This will likely be addressed in future releases of jQuery or select2
and the fix should be removed when it's no longer necessary.

[MAILPOET-3958]
2021-12-23 08:57:02 +01:00
John Oleksowicz
90711bbef0 Extract duplicated configuration object
[MAILPOET-3958]
2021-12-23 08:57:02 +01:00
John Oleksowicz
41bce234b7 Add custom matcher for filtering select2 optgroups
[MAILPOET-3958]
2021-12-23 08:57:02 +01:00
Rostislav Wolny
e51c2586f5 Update Woo Subcriptions segments filter data migration version
[MAILPOET-3956]
2021-12-23 08:50:27 +01:00
Rostislav Wolny
944e62f66e Change Woo Subscriptions segment action name
[MAILPOET-3956]
2021-12-23 08:50:27 +01:00
Rostislav Wolny
e971958297 Add migration for updating Woo Subscription segment data
[MAILPOET-3956]
2021-12-23 08:50:27 +01:00
Rostislav Wolny
8f78ad9939 Add all of and none of operators for Woo Subscription segment
[MAILPOET-3956]
2021-12-23 08:50:27 +01:00
Rostislav Wolny
651528c0b6 Add support for multiple any of for Woo subscriptions segment
[MAILPOET-3956]
2021-12-23 08:50:27 +01:00
wxa
c86443a08c Update tests
[MAILPOET-4007]
2021-12-23 08:48:36 +01:00
wxa
e53d746432 Add more comparisons for WooCommerce dynamic segments
[MAILPOET-4007]
2021-12-23 08:48:36 +01:00
Rostislav Wolny
6b92810281 Fix multiple purchased product conditions with all of
Non unique count parameter name was causing that when more conditions
used all of operand the count parameter was overrode in the final combined query.
[MAILPOET-4010]
2021-12-23 08:45:54 +01:00
John Oleksowicz
df119d18a0 Refactor duplicate segment name checks
This creates a single method we can rely on to check for the uniqueness
of a segment name and refactors places where we had duplicate code to
use the new method.

[MAILPOET-3998]
2021-12-22 09:36:56 +01:00
John Oleksowicz
c23d8cae53 Add unique name check to segments repository
[MAILPOET-3998]
2021-12-22 09:36:56 +01:00
Jan Lysý
0191bf6968 Use docker image with WP 5.8 and PHP 8.0
[MAILPOET-3967]
2021-12-21 11:08:22 +01:00
Pavel Dohnal
90d479fdc7 Add new operators to the segment validation
[MAILPOET-4008]
2021-12-20 12:40:25 +01:00
Pavel Dohnal
21fcc69b36 Use a better comparasion
[MAILPOET-4008]
2021-12-20 12:40:25 +01:00
Pavel Dohnal
65ef9b6572 More comparison options for custom field segment
[MAILPOET-4008]
2021-12-20 12:40:25 +01:00
Jan Lysý
3a22b57366 Remove unused import 2021-12-20 10:45:25 +01:00
Pavel Dohnal
e114bfcafb Fix none of query
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
7d85b23d50 Replace placeholder
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
638719e2b9 Replace not opened by opened none of
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
ddd627cea7 Enable multi select for opens
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
0dc772c37e Make sure the API response is always array
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
9c0b27644a Map newsletters array
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
c13727a02b Process multiple newsletters with operator NONE
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
57560bddaf Process multiple newsletters with operator ALL
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
b47842c461 Process multiple newsletters with operator ANY
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
00ed9ca920 Pass an array instead of multiple optional arguments
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
fc472396e0 Use a better assert function
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
9fc2b6fe08 Add more testing data
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
0b4614be1e Move clicked any link to a new class
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Pavel Dohnal
77872d4165 Add operator to opened frontend
[MAILPOET-3950]
2021-12-20 09:48:56 +01:00
Brezo Cordero
87a540b883 Move WC lookup tables schema to Database helper
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
18d3cc5441 Update acceptance test to use Array for country_code
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
de2b04b26e Add instanceof check on test
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
81ae05f4cf Add Select operator to "is in Country" filter
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
8292cd9fd3 Convert "is in Country" select to multiple select
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
9a9ab257c2 Map operator for "is in country" dynamic filter
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
67036f5d74 Add Any and None conditions to "is in country" segment
[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
06a4be4214 Use WC lookup tables for improved performance
This commit is part of a task to allow multiple values in "is in country" segment. This commit replaces the queries with the more performant ones written by @lysyjan. It also creates the lookup tables on the integration database and updates the test.

[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Brezo Cordero
b04cb41921 Make country always array
This commit is part of a task to allow multiple values in "is in country" segment. This commit first changes the string value $country to Array, adding a check for backwards compatibility and an integration test.

[MAILPOET-3952]
2021-12-20 09:29:41 +01:00
Oluwaseun Olorunsola
158d70dc7a Update DB version check
[MAILPOET-3953]
2021-12-20 09:26:13 +01:00
Oluwaseun Olorunsola
02fc0df655 Fixed count missing parameter suffix
[MAILPOET-3953]
2021-12-20 09:26:13 +01:00
Oluwaseun Olorunsola
831772506b Update DB version check
[MAILPOET-3953]
2021-12-20 09:26:13 +01:00
Oluwaseun Olorunsola
1d13f8009d Update DB version check
[MAILPOET-3953]
2021-12-20 09:26:13 +01:00
Oluwaseun Olorunsola
ffd62ee5e7 Removed old string
[MAILPOET-3953]
2021-12-20 09:26:13 +01:00