Version Description
26.09.2022
New: Added API for developers to handle consent management.
Tweak: Included the action scheduler library to avoid the buggy WooCommerce implementation of the action scheduler.
Tweak: Implemented a dynamic rate limiter that prevents possible timeouts if too many orders are being analysed in the payment gateway accuracy report.
Fix: Fixed the tag name for the product data.
Fix: Fix for the bug that caused multiple action scheduler entries.
Download this release
Release Info
Developer | alekv |
Plugin | Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more |
Version | 1.22.0 |
Comparing to | |
See all releases |
Code changes from version 1.21.0 to 1.22.0
- classes/admin/class-admin.php +151 -62
- classes/admin/class-debug-info.php +51 -5
- classes/admin/class-documentation.php +3 -0
- classes/admin/class-environment-check.php +4 -0
- classes/admin/class-order-columns.php +1 -0
- classes/admin/class-validations.php +21 -2
- classes/class-default-options.php +8 -6
- classes/pixels/class-pixel-manager.php +21 -10
- classes/pixels/google/class-google.php +26 -3
- classes/pixels/trait-product.php +1 -1
- js/admin/wpm-admin-freemius.p1.min.js +1 -1
- js/admin/wpm-admin-freemius.p1.min.js.map +1 -1
- js/public/wpm-public.p1.min.js +1 -1
- js/public/wpm-public.p1.min.js.br +0 -0
- js/public/wpm-public.p1.min.js.gz +0 -0
- js/public/wpm-public.p1.min.js.map +1 -1
- languages/woocommerce-google-adwords-conversion-tracking-tag.pot +227 -207
- readme.txt +12 -2
- vendor/composer/installed.json +43 -0
- vendor/composer/installed.php +11 -2
- vendor/woocommerce/action-scheduler/README.md +35 -0
- vendor/woocommerce/action-scheduler/action-scheduler.php +65 -0
- vendor/woocommerce/action-scheduler/changelog.txt +68 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionClaim.php +23 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionFactory.php +262 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_AdminView.php +244 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php +97 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_Compatibility.php +109 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_DataController.php +187 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_DateTime.php +79 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_Exception.php +11 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php +55 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_InvalidActionException.php +47 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_ListTable.php +657 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_LogEntry.php +67 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_NullLogEntry.php +11 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_OptionLock.php +49 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueCleaner.php +158 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php +216 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_Versions.php +62 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php +115 -0
- vendor/woocommerce/action-scheduler/classes/ActionScheduler_wcSystemStatus.php +166 -0
- vendor/woocommerce/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php +197 -0
- vendor/woocommerce/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php +188 -0
- vendor/woocommerce/action-scheduler/classes/WP_CLI/Migration_Command.php +148 -0
- vendor/woocommerce/action-scheduler/classes/WP_CLI/ProgressBar.php +119 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php +304 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php +766 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php +298 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php +102 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php +83 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schema.php +172 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Lock.php +62 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Logger.php +176 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php +450 -0
- vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php +152 -0
- vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_Action.php +96 -0
- vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_CanceledAction.php +23 -0
- vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_FinishedAction.php +16 -0
- vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_NullAction.php +16 -0
- vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_DBLogger.php +154 -0
- vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php +1006 -0
- vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php +426 -0
- vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php +240 -0
- vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php +1052 -0
classes/admin/class-admin.php
CHANGED
@@ -329,6 +329,14 @@ class Admin
|
|
329 |
'wpm_plugin_options_page',
|
330 |
$section_ids['settings_name']
|
331 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
// add the field for the Snapchat pixel
|
333 |
add_settings_field(
|
334 |
'wpm_plugin_snapchat_pixel_id',
|
@@ -448,6 +456,16 @@ class Admin
|
|
448 |
'wpm_plugin_options_page',
|
449 |
$section_ids['settings_name']
|
450 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
}
|
452 |
|
453 |
public function add_section_advanced_subsection_google( $section_ids )
|
@@ -586,7 +604,7 @@ class Admin
|
|
586 |
// add fields for the Borlabs Cookie support
|
587 |
add_settings_field(
|
588 |
'wpm_setting_borlabs_support',
|
589 |
-
esc_html__( 'Borlabs Cookie
|
590 |
[ $this, 'wpm_setting_html_borlabs_support' ],
|
591 |
'wpm_plugin_options_page',
|
592 |
$section_ids['settings_name']
|
@@ -596,7 +614,7 @@ class Admin
|
|
596 |
// add fields for the Cookiebot support
|
597 |
add_settings_field(
|
598 |
'wpm_setting_cookiebot_support',
|
599 |
-
esc_html__( 'Cookiebot
|
600 |
[ $this, 'wpm_setting_html_cookiebot_support' ],
|
601 |
'wpm_plugin_options_page',
|
602 |
$section_ids['settings_name']
|
@@ -606,7 +624,7 @@ class Admin
|
|
606 |
// add fields for the Complianz GDPR support
|
607 |
add_settings_field(
|
608 |
'wpm_setting_complianz_support',
|
609 |
-
esc_html__( 'Complianz GDPR
|
610 |
[ $this, 'wpm_setting_html_complianz_support' ],
|
611 |
'wpm_plugin_options_page',
|
612 |
$section_ids['settings_name']
|
@@ -616,7 +634,7 @@ class Admin
|
|
616 |
// add fields for the Cookie Notice by hu-manity.co support
|
617 |
add_settings_field(
|
618 |
'wpm_setting_cookie_notice_support',
|
619 |
-
esc_html__( 'Cookie Notice
|
620 |
[ $this, 'wpm_setting_html_cookie_notice_support' ],
|
621 |
'wpm_plugin_options_page',
|
622 |
$section_ids['settings_name']
|
@@ -626,7 +644,7 @@ class Admin
|
|
626 |
// add fields for the Cookie Script support
|
627 |
add_settings_field(
|
628 |
'wpm_setting_cookie_script_support',
|
629 |
-
esc_html__( 'Cookie Script
|
630 |
[ $this, 'wpm_setting_html_cookie_script_support' ],
|
631 |
'wpm_plugin_options_page',
|
632 |
$section_ids['settings_name']
|
@@ -636,7 +654,7 @@ class Admin
|
|
636 |
// add fields for the GDPR Cookie Compliance support
|
637 |
add_settings_field(
|
638 |
'wpm_setting_moove_gdpr_support',
|
639 |
-
esc_html__( 'GDPR Cookie Compliance
|
640 |
[ $this, 'wpm_setting_html_moove_gdpr_support' ],
|
641 |
'wpm_plugin_options_page',
|
642 |
$section_ids['settings_name']
|
@@ -646,7 +664,7 @@ class Admin
|
|
646 |
// add fields for the GDPR Cookie Consent support
|
647 |
add_settings_field(
|
648 |
'wpm_setting_cookie_law_info_support',
|
649 |
-
esc_html__( 'GDPR Cookie Consent
|
650 |
[ $this, 'wpm_setting_html_cookie_law_info_support' ],
|
651 |
'wpm_plugin_options_page',
|
652 |
$section_ids['settings_name']
|
@@ -1474,7 +1492,7 @@ class Admin
|
|
1474 |
?>'
|
1475 |
/>
|
1476 |
<?php
|
1477 |
-
$this->
|
1478 |
$this->get_documentation_html_by_key( 'google_analytics_universal_property' );
|
1479 |
echo '<br><br>' ;
|
1480 |
esc_html_e( 'The Google Analytics Universal property ID looks like this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1493,7 +1511,7 @@ class Admin
|
|
1493 |
?>'
|
1494 |
/>
|
1495 |
<?php
|
1496 |
-
$this->
|
1497 |
$this->get_documentation_html_by_key( 'google_analytics_4_id' );
|
1498 |
echo '<br><br>' ;
|
1499 |
esc_html_e( 'The Google Analytics 4 measurement ID looks like this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1512,7 +1530,7 @@ class Admin
|
|
1512 |
?>'
|
1513 |
/>
|
1514 |
<?php
|
1515 |
-
$this->
|
1516 |
$this->get_documentation_html_by_key( 'google_ads_conversion_id' );
|
1517 |
echo '<br><br>' ;
|
1518 |
esc_html_e( 'The conversion ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1531,7 +1549,7 @@ class Admin
|
|
1531 |
?>'
|
1532 |
/>
|
1533 |
<?php
|
1534 |
-
$this->
|
1535 |
$this->get_documentation_html_by_key( 'google_ads_conversion_label' );
|
1536 |
echo '<br><br>' ;
|
1537 |
esc_html_e( 'The purchase conversion label looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1557,7 +1575,7 @@ class Admin
|
|
1557 |
?>'
|
1558 |
/>
|
1559 |
<?php
|
1560 |
-
$this->
|
1561 |
// echo $this->get_documentation_html('/wgact/#/plugin-configuration?id=configure-the-plugin');
|
1562 |
$this->get_documentation_html_by_key( 'google_optimize_container_id' );
|
1563 |
echo '<br><br>' ;
|
@@ -1579,7 +1597,7 @@ class Admin
|
|
1579 |
?>'
|
1580 |
/>
|
1581 |
<?php
|
1582 |
-
$this->
|
1583 |
$this->get_documentation_html_by_key( 'facebook_pixel_id' );
|
1584 |
echo '<br><br>' ;
|
1585 |
esc_html_e( 'The Meta (Facebook) pixel ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1601,7 +1619,7 @@ class Admin
|
|
1601 |
?>
|
1602 |
/>
|
1603 |
<?php
|
1604 |
-
$this->
|
1605 |
$this->get_documentation_html_by_key( 'bing_uet_tag_id' );
|
1606 |
$this->html_pro_feature();
|
1607 |
echo '<br><br>' ;
|
@@ -1625,7 +1643,7 @@ class Admin
|
|
1625 |
?>
|
1626 |
/>
|
1627 |
<?php
|
1628 |
-
$this->
|
1629 |
// ($this->get_documentation_html_by_key('twitter_pixel_id'));
|
1630 |
$this->html_pro_feature();
|
1631 |
echo '<br><br>' ;
|
@@ -1649,7 +1667,7 @@ class Admin
|
|
1649 |
?>
|
1650 |
/>
|
1651 |
<?php
|
1652 |
-
$this->
|
1653 |
// ($this->get_documentation_html_by_key('pinterest_pixel_id'));
|
1654 |
$this->html_pro_feature();
|
1655 |
echo '<br><br>' ;
|
@@ -1657,6 +1675,32 @@ class Admin
|
|
1657 |
echo ' <i>1234567890123</i>' ;
|
1658 |
}
|
1659 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1660 |
public function wpm_option_html_snapchat_pixel_id()
|
1661 |
{
|
1662 |
?>
|
@@ -1673,7 +1717,7 @@ class Admin
|
|
1673 |
?>
|
1674 |
/>
|
1675 |
<?php
|
1676 |
-
$this->
|
1677 |
// ($this->get_documentation_html_by_key('snapchat_pixel_id'));
|
1678 |
$this->html_pro_feature();
|
1679 |
echo '<br><br>' ;
|
@@ -1698,7 +1742,7 @@ class Admin
|
|
1698 |
?>
|
1699 |
/>
|
1700 |
<?php
|
1701 |
-
$this->
|
1702 |
$this->get_documentation_html_by_key( 'tiktok_pixel_id' );
|
1703 |
$this->html_pro_feature();
|
1704 |
echo '<br><br>' ;
|
@@ -1714,7 +1758,7 @@ class Admin
|
|
1714 |
esc_html_e( $this->options['hotjar']['site_id'] );
|
1715 |
?>'/>
|
1716 |
<?php
|
1717 |
-
$this->
|
1718 |
$this->get_documentation_html_by_key( 'hotjar_site_id' );
|
1719 |
echo '<br><br>' ;
|
1720 |
esc_html_e( 'The Hotjar site ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1764,7 +1808,7 @@ class Admin
|
|
1764 |
echo checked( 2, $this->options['shop']['order_total_logic'], false ) ;
|
1765 |
?>
|
1766 |
<?php
|
1767 |
-
if ( !
|
1768 |
?>
|
1769 |
disabled
|
1770 |
<?php
|
@@ -1795,7 +1839,7 @@ class Admin
|
|
1795 |
?>
|
1796 |
<?php
|
1797 |
|
1798 |
-
if ( wpm_fs()->is__premium_only() && !
|
1799 |
?>
|
1800 |
</div>
|
1801 |
<div style="margin-top: 10px">
|
@@ -1878,7 +1922,7 @@ class Admin
|
|
1878 |
?>
|
1879 |
</label>
|
1880 |
<?php
|
1881 |
-
$this->
|
1882 |
?>
|
1883 |
<?php
|
1884 |
$this->get_documentation_html_by_key( 'google_consent_mode' );
|
@@ -1935,7 +1979,7 @@ class Admin
|
|
1935 |
public function wpm_info_html_google_analytics_eec()
|
1936 |
{
|
1937 |
esc_html_e( 'Google Analytics Enhanced E-Commerce is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1938 |
-
$this->
|
1939 |
$this->html_pro_feature();
|
1940 |
// $this->get_documentation_html_by_key('eec');
|
1941 |
}
|
@@ -1956,7 +2000,7 @@ class Admin
|
|
1956 |
?>
|
1957 |
/>
|
1958 |
<?php
|
1959 |
-
$this->
|
1960 |
$this->get_documentation_html_by_key( 'google_analytics_4_api_secret' );
|
1961 |
$this->html_pro_feature();
|
1962 |
echo '<br><br>' ;
|
@@ -1989,7 +2033,7 @@ class Admin
|
|
1989 |
?>
|
1990 |
</label>
|
1991 |
<?php
|
1992 |
-
$this->
|
1993 |
?>
|
1994 |
<?php
|
1995 |
// echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=pixel-manager-for-woocommerce-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
|
@@ -2027,7 +2071,7 @@ class Admin
|
|
2027 |
?>
|
2028 |
</label>
|
2029 |
<?php
|
2030 |
-
$this->
|
2031 |
$this->html_pro_feature();
|
2032 |
// echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=pixel-manager-for-woocommerce-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
|
2033 |
?>
|
@@ -2064,7 +2108,7 @@ class Admin
|
|
2064 |
?>
|
2065 |
</label>
|
2066 |
<?php
|
2067 |
-
$this->
|
2068 |
$this->html_pro_feature();
|
2069 |
$this->get_documentation_html_by_key( 'google_ads_enhanced_conversions' );
|
2070 |
?>
|
@@ -2094,7 +2138,7 @@ class Admin
|
|
2094 |
?>
|
2095 |
/>
|
2096 |
<?php
|
2097 |
-
$this->
|
2098 |
$this->get_documentation_html_by_key( 'google_ads_phone_conversion_number' );
|
2099 |
$this->html_pro_feature();
|
2100 |
echo '<br><br>' ;
|
@@ -2117,7 +2161,7 @@ class Admin
|
|
2117 |
?>
|
2118 |
/>
|
2119 |
<?php
|
2120 |
-
$this->
|
2121 |
$this->get_documentation_html_by_key( 'google_ads_phone_conversion_label' );
|
2122 |
$this->html_pro_feature();
|
2123 |
echo '<br><br>' ;
|
@@ -2127,49 +2171,49 @@ class Admin
|
|
2127 |
public function wpm_setting_html_borlabs_support()
|
2128 |
{
|
2129 |
esc_html_e( 'Borlabs Cookie detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2130 |
-
$this->
|
2131 |
$this->html_pro_feature();
|
2132 |
}
|
2133 |
|
2134 |
public function wpm_setting_html_cookiebot_support()
|
2135 |
{
|
2136 |
esc_html_e( 'Cookiebot detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2137 |
-
$this->
|
2138 |
$this->html_pro_feature();
|
2139 |
}
|
2140 |
|
2141 |
public function wpm_setting_html_complianz_support()
|
2142 |
{
|
2143 |
esc_html_e( 'Complianz GDPR detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2144 |
-
$this->
|
2145 |
$this->html_pro_feature();
|
2146 |
}
|
2147 |
|
2148 |
public function wpm_setting_html_cookie_notice_support()
|
2149 |
{
|
2150 |
esc_html_e( 'Cookie Notice (by hu-manity.co) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2151 |
-
$this->
|
2152 |
$this->html_pro_feature();
|
2153 |
}
|
2154 |
|
2155 |
public function wpm_setting_html_cookie_script_support()
|
2156 |
{
|
2157 |
esc_html_e( 'Cookie Script (by cookie-script.com) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2158 |
-
$this->
|
2159 |
$this->html_pro_feature();
|
2160 |
}
|
2161 |
|
2162 |
public function wpm_setting_html_moove_gdpr_support()
|
2163 |
{
|
2164 |
esc_html_e( 'GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2165 |
-
$this->
|
2166 |
$this->html_pro_feature();
|
2167 |
}
|
2168 |
|
2169 |
public function wpm_setting_html_cookie_law_info_support()
|
2170 |
{
|
2171 |
esc_html_e( 'GDPR Cookie Consent (by WebToffee) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2172 |
-
$this->
|
2173 |
$this->html_pro_feature();
|
2174 |
}
|
2175 |
|
@@ -2196,7 +2240,7 @@ class Admin
|
|
2196 |
?>
|
2197 |
</label>
|
2198 |
<?php
|
2199 |
-
$this->
|
2200 |
$this->get_documentation_html_by_key( 'explicit_consent_mode' );
|
2201 |
$this->html_pro_feature();
|
2202 |
echo '<p style="margin-top:10px">' ;
|
@@ -2218,7 +2262,7 @@ class Admin
|
|
2218 |
esc_html_e( $this->options['facebook']['capi']['token'] );
|
2219 |
?></textarea>
|
2220 |
<?php
|
2221 |
-
$this->
|
2222 |
$this->get_documentation_html_by_key( 'facebook_capi_token' );
|
2223 |
$this->html_pro_feature();
|
2224 |
|
@@ -2258,7 +2302,7 @@ class Admin
|
|
2258 |
?>
|
2259 |
</label>
|
2260 |
<?php
|
2261 |
-
$this->
|
2262 |
$this->get_documentation_html_by_key( 'facebook_capi_user_transparency_process_anonymous_hits' );
|
2263 |
$this->html_pro_feature();
|
2264 |
|
@@ -2294,7 +2338,7 @@ class Admin
|
|
2294 |
?>
|
2295 |
</label>
|
2296 |
<?php
|
2297 |
-
$this->
|
2298 |
$this->get_documentation_html_by_key( 'facebook_capi_user_transparency_send_additional_client_identifiers' );
|
2299 |
$this->html_pro_feature();
|
2300 |
|
@@ -2329,7 +2373,7 @@ class Admin
|
|
2329 |
?>
|
2330 |
</label>
|
2331 |
<?php
|
2332 |
-
$this->
|
2333 |
$this->get_documentation_html_by_key( 'facebook_microdata' );
|
2334 |
$this->html_pro_feature();
|
2335 |
|
@@ -2360,7 +2404,7 @@ class Admin
|
|
2360 |
?>
|
2361 |
</label>
|
2362 |
<?php
|
2363 |
-
$this->
|
2364 |
?>
|
2365 |
<br>
|
2366 |
<p>
|
@@ -2390,7 +2434,7 @@ class Admin
|
|
2390 |
?>
|
2391 |
</label>
|
2392 |
<?php
|
2393 |
-
$this->
|
2394 |
$this->get_documentation_html_by_key( 'maximum_compatibility_mode' );
|
2395 |
}
|
2396 |
|
@@ -2436,7 +2480,7 @@ class Admin
|
|
2436 |
public function wpm_info_html_acr()
|
2437 |
{
|
2438 |
esc_html_e( 'Automatic Conversion Recovery (ACR) is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2439 |
-
$this->
|
2440 |
$this->html_pro_feature();
|
2441 |
$this->get_documentation_html_by_key( 'acr' );
|
2442 |
}
|
@@ -2460,12 +2504,40 @@ class Admin
|
|
2460 |
?>
|
2461 |
</label>
|
2462 |
<?php
|
2463 |
-
$this->
|
2464 |
?>
|
2465 |
<?php
|
2466 |
$this->get_documentation_html_by_key( 'order_list_info' );
|
2467 |
}
|
2468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2469 |
private function get_order_duplication_prevention_text()
|
2470 |
{
|
2471 |
esc_html_e( 'Basic order duplication prevention is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -2501,7 +2573,7 @@ class Admin
|
|
2501 |
?>
|
2502 |
</label>
|
2503 |
<?php
|
2504 |
-
$this->
|
2505 |
?>
|
2506 |
<?php
|
2507 |
$this->get_documentation_html_by_key( 'google_ads_dynamic_remarketing' );
|
@@ -2545,7 +2617,7 @@ class Admin
|
|
2545 |
?>
|
2546 |
</label>
|
2547 |
<?php
|
2548 |
-
$this->
|
2549 |
?>
|
2550 |
<?php
|
2551 |
$this->get_documentation_html_by_key( 'variations_output' );
|
@@ -2688,7 +2760,7 @@ class Admin
|
|
2688 |
?>"
|
2689 |
/>
|
2690 |
<?php
|
2691 |
-
$this->
|
2692 |
?>
|
2693 |
<?php
|
2694 |
$this->get_documentation_html_by_key( 'aw_merchant_id' );
|
@@ -2845,20 +2917,6 @@ class Admin
|
|
2845 |
}
|
2846 |
|
2847 |
private function get_status_icon( $status, $requirements = true, $inactive_silent = false )
|
2848 |
-
{
|
2849 |
-
|
2850 |
-
if ( $status && $requirements ) {
|
2851 |
-
return $this->html_active();
|
2852 |
-
} elseif ( $status && !$requirements ) {
|
2853 |
-
return $this->html_partially_active();
|
2854 |
-
} elseif ( false == $inactive_silent ) {
|
2855 |
-
return $this->html_inactive();
|
2856 |
-
}
|
2857 |
-
|
2858 |
-
return '';
|
2859 |
-
}
|
2860 |
-
|
2861 |
-
private function get_status_icon_new( $status, $requirements = true, $inactive_silent = false )
|
2862 |
{
|
2863 |
|
2864 |
if ( $status && $requirements ) {
|
@@ -3030,6 +3088,37 @@ class Admin
|
|
3030 |
}
|
3031 |
|
3032 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3033 |
/**
|
3034 |
* Merging with the existing options and overwriting old values
|
3035 |
* since disabling a checkbox doesn't send a value,
|
329 |
'wpm_plugin_options_page',
|
330 |
$section_ids['settings_name']
|
331 |
);
|
332 |
+
// add the field for the Pinterest enhanced match
|
333 |
+
add_settings_field(
|
334 |
+
'wpm_plugin_pinterest_enhanced_match',
|
335 |
+
esc_html__( 'Pinterest Enhanced Match', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
336 |
+
[ $this, 'pmw_option_html_pinterest_enhanced_match' ],
|
337 |
+
'wpm_plugin_options_page',
|
338 |
+
$section_ids['settings_name']
|
339 |
+
);
|
340 |
// add the field for the Snapchat pixel
|
341 |
add_settings_field(
|
342 |
'wpm_plugin_snapchat_pixel_id',
|
456 |
'wpm_plugin_options_page',
|
457 |
$section_ids['settings_name']
|
458 |
);
|
459 |
+
if ( wpm_fs()->is__premium_only() || $this->options['general']['pro_version_demo'] ) {
|
460 |
+
// Add checkbox for the scroll tracker
|
461 |
+
add_settings_field(
|
462 |
+
'pmw_setting_scroll_tracker_thresholds',
|
463 |
+
esc_html__( 'Scroll Tracker', 'woocommerce-google-adwords-conversion-tracking-tag' ) . $this->html_beta(),
|
464 |
+
[ $this, 'pmw_info_html_scroll_tracker_thresholds' ],
|
465 |
+
'wpm_plugin_options_page',
|
466 |
+
$section_ids['settings_name']
|
467 |
+
);
|
468 |
+
}
|
469 |
}
|
470 |
|
471 |
public function add_section_advanced_subsection_google( $section_ids )
|
604 |
// add fields for the Borlabs Cookie support
|
605 |
add_settings_field(
|
606 |
'wpm_setting_borlabs_support',
|
607 |
+
esc_html__( 'Borlabs Cookie Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
608 |
[ $this, 'wpm_setting_html_borlabs_support' ],
|
609 |
'wpm_plugin_options_page',
|
610 |
$section_ids['settings_name']
|
614 |
// add fields for the Cookiebot support
|
615 |
add_settings_field(
|
616 |
'wpm_setting_cookiebot_support',
|
617 |
+
esc_html__( 'Cookiebot Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
618 |
[ $this, 'wpm_setting_html_cookiebot_support' ],
|
619 |
'wpm_plugin_options_page',
|
620 |
$section_ids['settings_name']
|
624 |
// add fields for the Complianz GDPR support
|
625 |
add_settings_field(
|
626 |
'wpm_setting_complianz_support',
|
627 |
+
esc_html__( 'Complianz GDPR Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
628 |
[ $this, 'wpm_setting_html_complianz_support' ],
|
629 |
'wpm_plugin_options_page',
|
630 |
$section_ids['settings_name']
|
634 |
// add fields for the Cookie Notice by hu-manity.co support
|
635 |
add_settings_field(
|
636 |
'wpm_setting_cookie_notice_support',
|
637 |
+
esc_html__( 'Cookie Notice Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
638 |
[ $this, 'wpm_setting_html_cookie_notice_support' ],
|
639 |
'wpm_plugin_options_page',
|
640 |
$section_ids['settings_name']
|
644 |
// add fields for the Cookie Script support
|
645 |
add_settings_field(
|
646 |
'wpm_setting_cookie_script_support',
|
647 |
+
esc_html__( 'Cookie Script Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
648 |
[ $this, 'wpm_setting_html_cookie_script_support' ],
|
649 |
'wpm_plugin_options_page',
|
650 |
$section_ids['settings_name']
|
654 |
// add fields for the GDPR Cookie Compliance support
|
655 |
add_settings_field(
|
656 |
'wpm_setting_moove_gdpr_support',
|
657 |
+
esc_html__( 'GDPR Cookie Compliance Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
658 |
[ $this, 'wpm_setting_html_moove_gdpr_support' ],
|
659 |
'wpm_plugin_options_page',
|
660 |
$section_ids['settings_name']
|
664 |
// add fields for the GDPR Cookie Consent support
|
665 |
add_settings_field(
|
666 |
'wpm_setting_cookie_law_info_support',
|
667 |
+
esc_html__( 'GDPR Cookie Consent Support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
668 |
[ $this, 'wpm_setting_html_cookie_law_info_support' ],
|
669 |
'wpm_plugin_options_page',
|
670 |
$section_ids['settings_name']
|
1492 |
?>'
|
1493 |
/>
|
1494 |
<?php
|
1495 |
+
$this->get_status_icon( $this->options['google']['analytics']['universal']['property_id'] );
|
1496 |
$this->get_documentation_html_by_key( 'google_analytics_universal_property' );
|
1497 |
echo '<br><br>' ;
|
1498 |
esc_html_e( 'The Google Analytics Universal property ID looks like this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1511 |
?>'
|
1512 |
/>
|
1513 |
<?php
|
1514 |
+
$this->get_status_icon( $this->options['google']['analytics']['ga4']['measurement_id'] );
|
1515 |
$this->get_documentation_html_by_key( 'google_analytics_4_id' );
|
1516 |
echo '<br><br>' ;
|
1517 |
esc_html_e( 'The Google Analytics 4 measurement ID looks like this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1530 |
?>'
|
1531 |
/>
|
1532 |
<?php
|
1533 |
+
$this->get_status_icon( $this->options['google']['ads']['conversion_id'] );
|
1534 |
$this->get_documentation_html_by_key( 'google_ads_conversion_id' );
|
1535 |
echo '<br><br>' ;
|
1536 |
esc_html_e( 'The conversion ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1549 |
?>'
|
1550 |
/>
|
1551 |
<?php
|
1552 |
+
$this->get_status_icon( $this->options['google']['ads']['conversion_label'], $this->options['google']['ads']['conversion_id'] );
|
1553 |
$this->get_documentation_html_by_key( 'google_ads_conversion_label' );
|
1554 |
echo '<br><br>' ;
|
1555 |
esc_html_e( 'The purchase conversion label looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1575 |
?>'
|
1576 |
/>
|
1577 |
<?php
|
1578 |
+
$this->get_status_icon( $this->options['google']['optimize']['container_id'] );
|
1579 |
// echo $this->get_documentation_html('/wgact/#/plugin-configuration?id=configure-the-plugin');
|
1580 |
$this->get_documentation_html_by_key( 'google_optimize_container_id' );
|
1581 |
echo '<br><br>' ;
|
1597 |
?>'
|
1598 |
/>
|
1599 |
<?php
|
1600 |
+
$this->get_status_icon( $this->options['facebook']['pixel_id'] );
|
1601 |
$this->get_documentation_html_by_key( 'facebook_pixel_id' );
|
1602 |
echo '<br><br>' ;
|
1603 |
esc_html_e( 'The Meta (Facebook) pixel ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1619 |
?>
|
1620 |
/>
|
1621 |
<?php
|
1622 |
+
$this->get_status_icon( $this->options['bing']['uet_tag_id'] );
|
1623 |
$this->get_documentation_html_by_key( 'bing_uet_tag_id' );
|
1624 |
$this->html_pro_feature();
|
1625 |
echo '<br><br>' ;
|
1643 |
?>
|
1644 |
/>
|
1645 |
<?php
|
1646 |
+
$this->get_status_icon( $this->options['twitter']['pixel_id'] );
|
1647 |
// ($this->get_documentation_html_by_key('twitter_pixel_id'));
|
1648 |
$this->html_pro_feature();
|
1649 |
echo '<br><br>' ;
|
1667 |
?>
|
1668 |
/>
|
1669 |
<?php
|
1670 |
+
$this->get_status_icon( $this->options['pinterest']['pixel_id'] );
|
1671 |
// ($this->get_documentation_html_by_key('pinterest_pixel_id'));
|
1672 |
$this->html_pro_feature();
|
1673 |
echo '<br><br>' ;
|
1675 |
echo ' <i>1234567890123</i>' ;
|
1676 |
}
|
1677 |
|
1678 |
+
public function pmw_option_html_pinterest_enhanced_match()
|
1679 |
+
{
|
1680 |
+
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
1681 |
+
// instead of not saving it and remove that array key entirely
|
1682 |
+
// https://stackoverflow.com/a/1992745/4688612
|
1683 |
+
?>
|
1684 |
+
<label>
|
1685 |
+
<input type='hidden' value='0' name='wgact_plugin_options[pinterest][enhanced_match]'>
|
1686 |
+
<input type='checkbox' id='wpm_plugin_pinterest_enhanced_match'
|
1687 |
+
name='wgact_plugin_options[pinterest][enhanced_match]'
|
1688 |
+
value='1' <?php
|
1689 |
+
checked( $this->options['pinterest']['enhanced_match'] );
|
1690 |
+
?> />
|
1691 |
+
|
1692 |
+
<?php
|
1693 |
+
esc_html_e( 'Enable Pinterest enhanced match', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1694 |
+
?>
|
1695 |
+
</label>
|
1696 |
+
<?php
|
1697 |
+
$this->get_status_icon( $this->options['pinterest']['enhanced_match'] );
|
1698 |
+
$this->html_beta_e();
|
1699 |
+
?>
|
1700 |
+
<?php
|
1701 |
+
// $this->get_documentation_html_by_key('pinterest_enhanced_match');
|
1702 |
+
}
|
1703 |
+
|
1704 |
public function wpm_option_html_snapchat_pixel_id()
|
1705 |
{
|
1706 |
?>
|
1717 |
?>
|
1718 |
/>
|
1719 |
<?php
|
1720 |
+
$this->get_status_icon( $this->options['snapchat']['pixel_id'] );
|
1721 |
// ($this->get_documentation_html_by_key('snapchat_pixel_id'));
|
1722 |
$this->html_pro_feature();
|
1723 |
echo '<br><br>' ;
|
1742 |
?>
|
1743 |
/>
|
1744 |
<?php
|
1745 |
+
$this->get_status_icon( $this->options['tiktok']['pixel_id'] );
|
1746 |
$this->get_documentation_html_by_key( 'tiktok_pixel_id' );
|
1747 |
$this->html_pro_feature();
|
1748 |
echo '<br><br>' ;
|
1758 |
esc_html_e( $this->options['hotjar']['site_id'] );
|
1759 |
?>'/>
|
1760 |
<?php
|
1761 |
+
$this->get_status_icon( $this->options['hotjar']['site_id'] );
|
1762 |
$this->get_documentation_html_by_key( 'hotjar_site_id' );
|
1763 |
echo '<br><br>' ;
|
1764 |
esc_html_e( 'The Hotjar site ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1808 |
echo checked( 2, $this->options['shop']['order_total_logic'], false ) ;
|
1809 |
?>
|
1810 |
<?php
|
1811 |
+
if ( !Environment_Check::get_instance()->is_a_cog_plugin_active() || !wpm_fs()->is__premium_only() ) {
|
1812 |
?>
|
1813 |
disabled
|
1814 |
<?php
|
1839 |
?>
|
1840 |
<?php
|
1841 |
|
1842 |
+
if ( wpm_fs()->is__premium_only() && !Environment_Check::get_instance()->is_a_cog_plugin_active() ) {
|
1843 |
?>
|
1844 |
</div>
|
1845 |
<div style="margin-top: 10px">
|
1922 |
?>
|
1923 |
</label>
|
1924 |
<?php
|
1925 |
+
$this->get_status_icon( $this->options['google']['consent_mode']['active'], true, true );
|
1926 |
?>
|
1927 |
<?php
|
1928 |
$this->get_documentation_html_by_key( 'google_consent_mode' );
|
1979 |
public function wpm_info_html_google_analytics_eec()
|
1980 |
{
|
1981 |
esc_html_e( 'Google Analytics Enhanced E-Commerce is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1982 |
+
$this->get_status_icon( wpm_fs()->is__premium_only() && $this->google->is_google_analytics_active() );
|
1983 |
$this->html_pro_feature();
|
1984 |
// $this->get_documentation_html_by_key('eec');
|
1985 |
}
|
2000 |
?>
|
2001 |
/>
|
2002 |
<?php
|
2003 |
+
$this->get_status_icon( $this->options['google']['analytics']['ga4']['api_secret'] );
|
2004 |
$this->get_documentation_html_by_key( 'google_analytics_4_api_secret' );
|
2005 |
$this->html_pro_feature();
|
2006 |
echo '<br><br>' ;
|
2033 |
?>
|
2034 |
</label>
|
2035 |
<?php
|
2036 |
+
$this->get_status_icon( $this->options['google']['analytics']['link_attribution'], $this->options['google']['analytics']['universal']['property_id'] || $this->options['google']['analytics']['ga4']['measurement_id'], true );
|
2037 |
?>
|
2038 |
<?php
|
2039 |
// echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=pixel-manager-for-woocommerce-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
|
2071 |
?>
|
2072 |
</label>
|
2073 |
<?php
|
2074 |
+
$this->get_status_icon( $this->options['google']['user_id'], $this->options['google']['analytics']['universal']['property_id'] || $this->options['google']['analytics']['ga4']['measurement_id'] || $this->google->is_google_ads_active(), true );
|
2075 |
$this->html_pro_feature();
|
2076 |
// echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=pixel-manager-for-woocommerce-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
|
2077 |
?>
|
2108 |
?>
|
2109 |
</label>
|
2110 |
<?php
|
2111 |
+
$this->get_status_icon( $this->options['google']['ads']['enhanced_conversions'], $this->google->is_google_ads_active(), false );
|
2112 |
$this->html_pro_feature();
|
2113 |
$this->get_documentation_html_by_key( 'google_ads_enhanced_conversions' );
|
2114 |
?>
|
2138 |
?>
|
2139 |
/>
|
2140 |
<?php
|
2141 |
+
$this->get_status_icon( $this->options['google']['ads']['phone_conversion_number'], $this->options['google']['ads']['phone_conversion_label'] && $this->options['google']['ads']['phone_conversion_number'] );
|
2142 |
$this->get_documentation_html_by_key( 'google_ads_phone_conversion_number' );
|
2143 |
$this->html_pro_feature();
|
2144 |
echo '<br><br>' ;
|
2161 |
?>
|
2162 |
/>
|
2163 |
<?php
|
2164 |
+
$this->get_status_icon( $this->options['google']['ads']['phone_conversion_label'], $this->options['google']['ads']['phone_conversion_label'] && $this->options['google']['ads']['phone_conversion_number'] );
|
2165 |
$this->get_documentation_html_by_key( 'google_ads_phone_conversion_label' );
|
2166 |
$this->html_pro_feature();
|
2167 |
echo '<br><br>' ;
|
2171 |
public function wpm_setting_html_borlabs_support()
|
2172 |
{
|
2173 |
esc_html_e( 'Borlabs Cookie detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2174 |
+
$this->get_status_icon( true, true, true );
|
2175 |
$this->html_pro_feature();
|
2176 |
}
|
2177 |
|
2178 |
public function wpm_setting_html_cookiebot_support()
|
2179 |
{
|
2180 |
esc_html_e( 'Cookiebot detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2181 |
+
$this->get_status_icon( true, true, true );
|
2182 |
$this->html_pro_feature();
|
2183 |
}
|
2184 |
|
2185 |
public function wpm_setting_html_complianz_support()
|
2186 |
{
|
2187 |
esc_html_e( 'Complianz GDPR detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2188 |
+
$this->get_status_icon( true, true, true );
|
2189 |
$this->html_pro_feature();
|
2190 |
}
|
2191 |
|
2192 |
public function wpm_setting_html_cookie_notice_support()
|
2193 |
{
|
2194 |
esc_html_e( 'Cookie Notice (by hu-manity.co) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2195 |
+
$this->get_status_icon( true, true, true );
|
2196 |
$this->html_pro_feature();
|
2197 |
}
|
2198 |
|
2199 |
public function wpm_setting_html_cookie_script_support()
|
2200 |
{
|
2201 |
esc_html_e( 'Cookie Script (by cookie-script.com) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2202 |
+
$this->get_status_icon( true, true, true );
|
2203 |
$this->html_pro_feature();
|
2204 |
}
|
2205 |
|
2206 |
public function wpm_setting_html_moove_gdpr_support()
|
2207 |
{
|
2208 |
esc_html_e( 'GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2209 |
+
$this->get_status_icon( true, true, true );
|
2210 |
$this->html_pro_feature();
|
2211 |
}
|
2212 |
|
2213 |
public function wpm_setting_html_cookie_law_info_support()
|
2214 |
{
|
2215 |
esc_html_e( 'GDPR Cookie Consent (by WebToffee) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2216 |
+
$this->get_status_icon( true, true, true );
|
2217 |
$this->html_pro_feature();
|
2218 |
}
|
2219 |
|
2240 |
?>
|
2241 |
</label>
|
2242 |
<?php
|
2243 |
+
$this->get_status_icon( $this->options['shop']['cookie_consent_mgmt']['explicit_consent'], true, true );
|
2244 |
$this->get_documentation_html_by_key( 'explicit_consent_mode' );
|
2245 |
$this->html_pro_feature();
|
2246 |
echo '<p style="margin-top:10px">' ;
|
2262 |
esc_html_e( $this->options['facebook']['capi']['token'] );
|
2263 |
?></textarea>
|
2264 |
<?php
|
2265 |
+
$this->get_status_icon( $this->options['facebook']['capi']['token'], $this->options['facebook']['pixel_id'] );
|
2266 |
$this->get_documentation_html_by_key( 'facebook_capi_token' );
|
2267 |
$this->html_pro_feature();
|
2268 |
|
2302 |
?>
|
2303 |
</label>
|
2304 |
<?php
|
2305 |
+
$this->get_status_icon( $this->options['facebook']['capi']['user_transparency']['process_anonymous_hits'], $this->options['facebook']['pixel_id'], true );
|
2306 |
$this->get_documentation_html_by_key( 'facebook_capi_user_transparency_process_anonymous_hits' );
|
2307 |
$this->html_pro_feature();
|
2308 |
|
2338 |
?>
|
2339 |
</label>
|
2340 |
<?php
|
2341 |
+
$this->get_status_icon( $this->options['facebook']['capi']['user_transparency']['send_additional_client_identifiers'], $this->options['facebook']['pixel_id'], true );
|
2342 |
$this->get_documentation_html_by_key( 'facebook_capi_user_transparency_send_additional_client_identifiers' );
|
2343 |
$this->html_pro_feature();
|
2344 |
|
2373 |
?>
|
2374 |
</label>
|
2375 |
<?php
|
2376 |
+
$this->get_status_icon( $this->options['facebook']['microdata'], $this->options['facebook']['pixel_id'], true );
|
2377 |
$this->get_documentation_html_by_key( 'facebook_microdata' );
|
2378 |
$this->html_pro_feature();
|
2379 |
|
2404 |
?>
|
2405 |
</label>
|
2406 |
<?php
|
2407 |
+
$this->get_status_icon( $this->options['shop']['order_deduplication'] );
|
2408 |
?>
|
2409 |
<br>
|
2410 |
<p>
|
2434 |
?>
|
2435 |
</label>
|
2436 |
<?php
|
2437 |
+
$this->get_status_icon( $this->options['general']['maximum_compatibility_mode'], true, true );
|
2438 |
$this->get_documentation_html_by_key( 'maximum_compatibility_mode' );
|
2439 |
}
|
2440 |
|
2480 |
public function wpm_info_html_acr()
|
2481 |
{
|
2482 |
esc_html_e( 'Automatic Conversion Recovery (ACR) is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2483 |
+
$this->get_status_icon( wpm_fs()->is__premium_only() );
|
2484 |
$this->html_pro_feature();
|
2485 |
$this->get_documentation_html_by_key( 'acr' );
|
2486 |
}
|
2504 |
?>
|
2505 |
</label>
|
2506 |
<?php
|
2507 |
+
$this->get_status_icon( $this->options['shop']['order_list_info'] );
|
2508 |
?>
|
2509 |
<?php
|
2510 |
$this->get_documentation_html_by_key( 'order_list_info' );
|
2511 |
}
|
2512 |
|
2513 |
+
public function pmw_info_html_scroll_tracker_thresholds()
|
2514 |
+
{
|
2515 |
+
?>
|
2516 |
+
<input id='pmw_setting_scroll_tracker_thresholds'
|
2517 |
+
name='wgact_plugin_options[general][scroll_tracker_thresholds]'
|
2518 |
+
size='40'
|
2519 |
+
type='text'
|
2520 |
+
value='<?php
|
2521 |
+
esc_html_e( implode( ',', $this->options['general']['scroll_tracker_thresholds'] ) );
|
2522 |
+
?>'
|
2523 |
+
/>
|
2524 |
+
<?php
|
2525 |
+
$this->get_status_icon( !empty($this->options['general']['scroll_tracker_thresholds']) );
|
2526 |
+
?>
|
2527 |
+
<?php
|
2528 |
+
$this->get_documentation_html_by_key( 'scroll_tracker_threshold' );
|
2529 |
+
?>
|
2530 |
+
<?php
|
2531 |
+
$this->html_pro_feature();
|
2532 |
+
?>
|
2533 |
+
<div style="margin-top: 10px">
|
2534 |
+
<?php
|
2535 |
+
esc_html_e( 'The Scroll Tracker thresholds. A comma separated list of scroll tracking thresholds in percent where the scroll tracker triggers its events.', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2536 |
+
?>
|
2537 |
+
</div>
|
2538 |
+
<?php
|
2539 |
+
}
|
2540 |
+
|
2541 |
private function get_order_duplication_prevention_text()
|
2542 |
{
|
2543 |
esc_html_e( 'Basic order duplication prevention is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2573 |
?>
|
2574 |
</label>
|
2575 |
<?php
|
2576 |
+
$this->get_status_icon( $this->options['google']['ads']['dynamic_remarketing'], $this->options['google']['ads']['conversion_id'] );
|
2577 |
?>
|
2578 |
<?php
|
2579 |
$this->get_documentation_html_by_key( 'google_ads_dynamic_remarketing' );
|
2617 |
?>
|
2618 |
</label>
|
2619 |
<?php
|
2620 |
+
$this->get_status_icon( $this->options['general']['variations_output'], $this->options['google']['ads']['dynamic_remarketing'], true );
|
2621 |
?>
|
2622 |
<?php
|
2623 |
$this->get_documentation_html_by_key( 'variations_output' );
|
2760 |
?>"
|
2761 |
/>
|
2762 |
<?php
|
2763 |
+
$this->get_status_icon( $this->options['google']['ads']['aw_merchant_id'] );
|
2764 |
?>
|
2765 |
<?php
|
2766 |
$this->get_documentation_html_by_key( 'aw_merchant_id' );
|
2917 |
}
|
2918 |
|
2919 |
private function get_status_icon( $status, $requirements = true, $inactive_silent = false )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2920 |
{
|
2921 |
|
2922 |
if ( $status && $requirements ) {
|
3088 |
}
|
3089 |
|
3090 |
}
|
3091 |
+
// Sanitize and validate scroll tracker thresholds
|
3092 |
+
|
3093 |
+
if ( isset( $input['general']['scroll_tracker_thresholds'] ) ) {
|
3094 |
+
$scroll_tracker_thresholds = $input['general']['scroll_tracker_thresholds'];
|
3095 |
+
// remove all spaces
|
3096 |
+
$scroll_tracker_thresholds = str_replace( ' ', '', $scroll_tracker_thresholds );
|
3097 |
+
// remove leading and trailing commas
|
3098 |
+
$scroll_tracker_thresholds = trim( $scroll_tracker_thresholds, ',' );
|
3099 |
+
// remove duplicate commas and replace with single comma
|
3100 |
+
$scroll_tracker_thresholds = preg_replace( '/,+/', ',', $scroll_tracker_thresholds );
|
3101 |
+
// remove quotes
|
3102 |
+
$scroll_tracker_thresholds = str_replace( '"', '', $scroll_tracker_thresholds );
|
3103 |
+
// remove single quotes
|
3104 |
+
$scroll_tracker_thresholds = str_replace( "'", '', $scroll_tracker_thresholds );
|
3105 |
+
|
3106 |
+
if ( !Validations::is_scroll_tracker_thresholds( $scroll_tracker_thresholds ) ) {
|
3107 |
+
$input['general']['scroll_tracker_thresholds'] = ( isset( $this->options['general']['scroll_tracker_thresholds'] ) ? $this->options['general']['scroll_tracker_thresholds'] : '' );
|
3108 |
+
add_settings_error( 'wgact_plugin_options', 'invalid-scroll-tracker-thresholds', esc_html__( 'You have entered the Scroll Tracker thresholds in the wrong format. It must be a list of comma separated percentages, like this "25,50,75,100"', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
|
3109 |
+
} else {
|
3110 |
+
// If $scroll_tracker_thresholds not empty string error log
|
3111 |
+
|
3112 |
+
if ( '' !== $scroll_tracker_thresholds ) {
|
3113 |
+
$input['general']['scroll_tracker_thresholds'] = explode( ',', $scroll_tracker_thresholds );
|
3114 |
+
} else {
|
3115 |
+
$input['general']['scroll_tracker_thresholds'] = [];
|
3116 |
+
}
|
3117 |
+
|
3118 |
+
}
|
3119 |
+
|
3120 |
+
}
|
3121 |
+
|
3122 |
/**
|
3123 |
* Merging with the existing options and overwriting old values
|
3124 |
* since disabling a checkbox doesn't send a value,
|
classes/admin/class-debug-info.php
CHANGED
@@ -172,17 +172,63 @@ class Debug_Info
|
|
172 |
{
|
173 |
// Start measuring time
|
174 |
$start_time = microtime( true );
|
|
|
|
|
|
|
|
|
175 |
$this->generate_pmw_tracked_payment_methods();
|
176 |
$this->generate_gateway_analysis_array();
|
177 |
-
$count_active_gateways = count( $this->get_enabled_payment_gateways() );
|
178 |
-
// We want to at least analyze the count of active gateways * 100, or at least all orders in the past 30 days, whichever is larger.
|
179 |
-
$amount_of_orders_to_analyze = max( $count_active_gateways * 100, $this->get_count_of_pmw_tracked_orders_for_one_month() );
|
180 |
-
// Limit $amount_of_orders_to_analyze to 6000 for testing purposes.
|
181 |
-
$amount_of_orders_to_analyze = min( $amount_of_orders_to_analyze, apply_filters( 'pmw_tracking_accuracy_analysis_max_order_amount', 6000 ) );
|
182 |
$this->generate_gateway_analysis_weighted_array( $amount_of_orders_to_analyze );
|
183 |
// End measuring time
|
184 |
$end_time = microtime( true );
|
185 |
set_transient( 'pmw_tracking_accuracy_analysis_time', $end_time - $start_time, MONTH_IN_SECONDS );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
|
188 |
public function get_gateway_analysis_for_debug_info()
|
172 |
{
|
173 |
// Start measuring time
|
174 |
$start_time = microtime( true );
|
175 |
+
$maximum_orders_to_analyze = $this->get_maximum_orders_to_analyze();
|
176 |
+
// We want to at least analyze the count of active gateways * 100, or at least all orders in the past 30 days, whichever is larger.
|
177 |
+
// And we don't want to exceed the maximum orders to analyze (default 6000).
|
178 |
+
$amount_of_orders_to_analyze = min( $maximum_orders_to_analyze, max( count( $this->get_enabled_payment_gateways() ) * 100, $this->get_count_of_pmw_tracked_orders_for_one_month() ) );
|
179 |
$this->generate_pmw_tracked_payment_methods();
|
180 |
$this->generate_gateway_analysis_array();
|
|
|
|
|
|
|
|
|
|
|
181 |
$this->generate_gateway_analysis_weighted_array( $amount_of_orders_to_analyze );
|
182 |
// End measuring time
|
183 |
$end_time = microtime( true );
|
184 |
set_transient( 'pmw_tracking_accuracy_analysis_time', $end_time - $start_time, MONTH_IN_SECONDS );
|
185 |
+
delete_transient( 'pmw_tracking_accuracy_analysis_running' );
|
186 |
+
}
|
187 |
+
|
188 |
+
// If the analysis runs into a timout we lower the amount of orders to analyze.
|
189 |
+
protected function get_maximum_orders_to_analyze()
|
190 |
+
{
|
191 |
+
|
192 |
+
if ( get_transient( 'pmw_tracking_accuracy_analysis_running' ) ) {
|
193 |
+
// If available means that last run failed or timed out.
|
194 |
+
$last_maximum_orders_to_analyze = ( get_transient( 'pmw_tracking_accuracy_analysis_max_orders' ) ? get_transient( 'pmw_tracking_accuracy_analysis_max_orders' ) : $this->get_default_maximum_orders_to_analyse() );
|
195 |
+
$maximum_orders_to_analyze = intval( $last_maximum_orders_to_analyze * 0.8 );
|
196 |
+
} else {
|
197 |
+
/**
|
198 |
+
* We are increasing the max amount with every run a little
|
199 |
+
* in order to counteract possible bailouts due to other reasons than timeouts,
|
200 |
+
* that otherwise would only lower the max amount with each error until
|
201 |
+
* the max amount reaches the minimum and stays at the minimum forever.
|
202 |
+
* */
|
203 |
+
|
204 |
+
if ( get_transient( 'pmw_tracking_accuracy_analysis_max_orders' ) ) {
|
205 |
+
$maximum_orders_to_analyze = min( intval( get_transient( 'pmw_tracking_accuracy_analysis_max_orders' ) * 1.01 ), $this->get_default_maximum_orders_to_analyse() );
|
206 |
+
} else {
|
207 |
+
// Default value
|
208 |
+
$maximum_orders_to_analyze = $this->get_default_maximum_orders_to_analyse();
|
209 |
+
}
|
210 |
+
|
211 |
+
}
|
212 |
+
|
213 |
+
$maximum_orders_to_analyze = min(
|
214 |
+
// Use the smaller of the two values. Either the user override or the calculated value.
|
215 |
+
apply_filters( 'pmw_tracking_accuracy_analysis_max_order_amount', $maximum_orders_to_analyze ),
|
216 |
+
$maximum_orders_to_analyze
|
217 |
+
);
|
218 |
+
set_transient( 'pmw_tracking_accuracy_analysis_running', true );
|
219 |
+
set_transient( 'pmw_tracking_accuracy_analysis_max_orders', $maximum_orders_to_analyze );
|
220 |
+
return $maximum_orders_to_analyze;
|
221 |
+
}
|
222 |
+
|
223 |
+
protected function get_default_maximum_orders_to_analyse()
|
224 |
+
{
|
225 |
+
/**
|
226 |
+
* Make the maximum orders to analyze dependent on the max_execution_time.
|
227 |
+
* The smaller it is the less maximum orders we want to analyze to avoid timeouts.
|
228 |
+
* And we want to analyze at least 300 orders.
|
229 |
+
* */
|
230 |
+
$max_execution_time = ( ini_get( 'max_execution_time' ) ? ini_get( 'max_execution_time' ) : 30 );
|
231 |
+
return max( $max_execution_time * 100, 300 );
|
232 |
}
|
233 |
|
234 |
public function get_gateway_analysis_for_debug_info()
|
classes/admin/class-documentation.php
CHANGED
@@ -170,6 +170,9 @@ class Documentation {
|
|
170 |
'order_profit_margin' => [
|
171 |
'default' => '/docs/wpm/plugin-configuration/general-settings#profit-margin',
|
172 |
'wcm' => '/document/pixel-manager-pro-for-woocommerce/'],
|
|
|
|
|
|
|
173 |
];
|
174 |
|
175 |
if (array_key_exists($key, $documentation_links)) {
|
170 |
'order_profit_margin' => [
|
171 |
'default' => '/docs/wpm/plugin-configuration/general-settings#profit-margin',
|
172 |
'wcm' => '/document/pixel-manager-pro-for-woocommerce/'],
|
173 |
+
'scroll_tracker_threshold' => [
|
174 |
+
'default' => '/docs/wpm/plugin-configuration/general-settings/#scroll-tracker',
|
175 |
+
'wcm' => '/document/pixel-manager-pro-for-woocommerce/'],
|
176 |
];
|
177 |
|
178 |
if (array_key_exists($key, $documentation_links)) {
|
classes/admin/class-environment-check.php
CHANGED
@@ -547,6 +547,10 @@ class Environment_Check {
|
|
547 |
return class_exists('Alg_WC_Cost_of_Goods') || is_plugin_active('cost-of-goods-for-woocommerce/cost-of-goods-for-woocommerce.php');
|
548 |
}
|
549 |
|
|
|
|
|
|
|
|
|
550 |
public function is_some_cmp_active() {
|
551 |
if (
|
552 |
$this->is_borlabs_cookie_active() ||
|
547 |
return class_exists('Alg_WC_Cost_of_Goods') || is_plugin_active('cost-of-goods-for-woocommerce/cost-of-goods-for-woocommerce.php');
|
548 |
}
|
549 |
|
550 |
+
public function is_a_cog_plugin_active() {
|
551 |
+
return $this->is_woocommerce_cog_active() || $this->is_cog_for_woocommerce_active();
|
552 |
+
}
|
553 |
+
|
554 |
public function is_some_cmp_active() {
|
555 |
if (
|
556 |
$this->is_borlabs_cookie_active() ||
|
classes/admin/class-order-columns.php
CHANGED
@@ -65,6 +65,7 @@ class Order_Columns {
|
|
65 |
'compare' => 'NOT EXISTS',
|
66 |
];
|
67 |
|
|
|
68 |
$query->query_vars['meta_query'][] = [
|
69 |
'key' => '_created_via',
|
70 |
'value' => 'checkout',
|
65 |
'compare' => 'NOT EXISTS',
|
66 |
];
|
67 |
|
68 |
+
// checkout, admin, subscription, Vipps Express Checkout
|
69 |
$query->query_vars['meta_query'][] = [
|
70 |
'key' => '_created_via',
|
71 |
'value' => 'checkout',
|
classes/admin/class-validations.php
CHANGED
@@ -34,6 +34,17 @@ class Validations {
|
|
34 |
return self::validate_with_regex($re, $string);
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
public static function is_facebook_capi_token( $string ) {
|
38 |
if (empty($string)) {
|
39 |
return true;
|
@@ -166,12 +177,20 @@ class Validations {
|
|
166 |
}
|
167 |
|
168 |
public static function validate_with_regex( $re, $string ) {
|
169 |
-
preg_match_all($re, $string, $matches, PREG_SET_ORDER, 0);
|
170 |
|
171 |
-
if
|
|
|
172 |
return true;
|
173 |
} else {
|
174 |
return false;
|
175 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
}
|
34 |
return self::validate_with_regex($re, $string);
|
35 |
}
|
36 |
|
37 |
+
public static function is_scroll_tracker_thresholds( $string ) {
|
38 |
+
if (empty($string)) {
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
|
42 |
+
// https://regex101.com/r/4haInV/1
|
43 |
+
$re = '/^([\d]|[\d][\d]|100)(,([\d]|[\d][\d]|100))*$/m';
|
44 |
+
|
45 |
+
return self::validate_with_regex($re, $string);
|
46 |
+
}
|
47 |
+
|
48 |
public static function is_facebook_capi_token( $string ) {
|
49 |
if (empty($string)) {
|
50 |
return true;
|
177 |
}
|
178 |
|
179 |
public static function validate_with_regex( $re, $string ) {
|
|
|
180 |
|
181 |
+
// validate if string matches the regex $re
|
182 |
+
if (preg_match($re, $string)) {
|
183 |
return true;
|
184 |
} else {
|
185 |
return false;
|
186 |
}
|
187 |
+
|
188 |
+
// preg_match_all($re, $string, $matches, PREG_SET_ORDER, 0);
|
189 |
+
//
|
190 |
+
// if (isset($matches[0])) {
|
191 |
+
// return true;
|
192 |
+
// } else {
|
193 |
+
// return false;
|
194 |
+
// }
|
195 |
}
|
196 |
}
|
classes/class-default-options.php
CHANGED
@@ -62,7 +62,8 @@ class Default_Options {
|
|
62 |
'pixel_id' => ''
|
63 |
],
|
64 |
'pinterest' => [
|
65 |
-
'pixel_id' => ''
|
|
|
66 |
],
|
67 |
'snapchat' => [
|
68 |
'pixel_id' => ''
|
@@ -74,18 +75,19 @@ class Default_Options {
|
|
74 |
'site_id' => ''
|
75 |
],
|
76 |
'shop' => [
|
77 |
-
'order_total_logic'
|
78 |
-
'cookie_consent_mgmt'
|
79 |
'explicit_consent' => false,
|
80 |
],
|
81 |
-
'order_deduplication'
|
82 |
-
'disable_tracking_for'
|
83 |
-
'order_list_info'
|
84 |
],
|
85 |
'general' => [
|
86 |
'variations_output' => true,
|
87 |
'maximum_compatibility_mode' => false,
|
88 |
'pro_version_demo' => false,
|
|
|
89 |
],
|
90 |
'db_version' => WPM_DB_VERSION,
|
91 |
];
|
62 |
'pixel_id' => ''
|
63 |
],
|
64 |
'pinterest' => [
|
65 |
+
'pixel_id' => '',
|
66 |
+
'enhanced_match' => false,
|
67 |
],
|
68 |
'snapchat' => [
|
69 |
'pixel_id' => ''
|
75 |
'site_id' => ''
|
76 |
],
|
77 |
'shop' => [
|
78 |
+
'order_total_logic' => 0,
|
79 |
+
'cookie_consent_mgmt' => [
|
80 |
'explicit_consent' => false,
|
81 |
],
|
82 |
+
'order_deduplication' => true,
|
83 |
+
'disable_tracking_for' => [],
|
84 |
+
'order_list_info' => true,
|
85 |
],
|
86 |
'general' => [
|
87 |
'variations_output' => true,
|
88 |
'maximum_compatibility_mode' => false,
|
89 |
'pro_version_demo' => false,
|
90 |
+
'scroll_tracker_thresholds' => [],
|
91 |
],
|
92 |
'db_version' => WPM_DB_VERSION,
|
93 |
];
|
classes/pixels/class-pixel-manager.php
CHANGED
@@ -129,7 +129,7 @@ class Pixel_Manager
|
|
129 |
);
|
130 |
add_filter(
|
131 |
'woocommerce_blocks_product_grid_item_html',
|
132 |
-
[ $this, '
|
133 |
10,
|
134 |
3
|
135 |
);
|
@@ -458,7 +458,7 @@ class Pixel_Manager
|
|
458 |
}
|
459 |
|
460 |
// product views generated by a gutenberg block instead of a shortcode
|
461 |
-
public function
|
462 |
{
|
463 |
return $html . $this->buffer_get_product_data_layer_script( $product );
|
464 |
}
|
@@ -640,19 +640,29 @@ class Pixel_Manager
|
|
640 |
|
641 |
protected function get_pinterest_pixel_data()
|
642 |
{
|
643 |
-
|
644 |
'pixel_id' => $this->options_obj->pinterest->pixel_id,
|
645 |
'dynamic_remarketing' => [
|
646 |
'id_type' => $this->get_dyn_r_id_type( 'pinterest' ),
|
647 |
],
|
648 |
-
'
|
|
|
|
|
|
|
|
|
649 |
'wooptpm_pinterest_enhanced_match',
|
650 |
-
[
|
651 |
'1.13.0',
|
652 |
'wpm_pinterest_enhanced_match'
|
653 |
-
)
|
654 |
-
|
655 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
}
|
657 |
|
658 |
protected function get_snapchat_pixel_data()
|
@@ -1191,8 +1201,9 @@ class Pixel_Manager
|
|
1191 |
private function get_general_data()
|
1192 |
{
|
1193 |
return [
|
1194 |
-
'variationsOutput'
|
1195 |
-
'userLoggedIn'
|
|
|
1196 |
];
|
1197 |
}
|
1198 |
|
129 |
);
|
130 |
add_filter(
|
131 |
'woocommerce_blocks_product_grid_item_html',
|
132 |
+
[ $this, 'wc_add_data_to_gutenberg_block' ],
|
133 |
10,
|
134 |
3
|
135 |
);
|
458 |
}
|
459 |
|
460 |
// product views generated by a gutenberg block instead of a shortcode
|
461 |
+
public function wc_add_data_to_gutenberg_block( $html, $data, $product )
|
462 |
{
|
463 |
return $html . $this->buffer_get_product_data_layer_script( $product );
|
464 |
}
|
640 |
|
641 |
protected function get_pinterest_pixel_data()
|
642 |
{
|
643 |
+
$data = [
|
644 |
'pixel_id' => $this->options_obj->pinterest->pixel_id,
|
645 |
'dynamic_remarketing' => [
|
646 |
'id_type' => $this->get_dyn_r_id_type( 'pinterest' ),
|
647 |
],
|
648 |
+
'enhanced_match_email' => $this->get_user_email(),
|
649 |
+
];
|
650 |
+
// Add Pinterest Conversion ID if available.
|
651 |
+
$enhanced_match = (bool) $this->options_obj->pinterest->enhanced_match;
|
652 |
+
$enhanced_match = apply_filters_deprecated(
|
653 |
'wooptpm_pinterest_enhanced_match',
|
654 |
+
[ $enhanced_match ],
|
655 |
'1.13.0',
|
656 |
'wpm_pinterest_enhanced_match'
|
657 |
+
);
|
658 |
+
$data['enhanced_match'] = apply_filters_deprecated(
|
659 |
+
'wpm_pinterest_enhanced_match',
|
660 |
+
[ $enhanced_match ],
|
661 |
+
'1.22.0',
|
662 |
+
null,
|
663 |
+
'There is now an option in the Pinterest settings to enable/disable enhanced match.'
|
664 |
+
);
|
665 |
+
return $data;
|
666 |
}
|
667 |
|
668 |
protected function get_snapchat_pixel_data()
|
1201 |
private function get_general_data()
|
1202 |
{
|
1203 |
return [
|
1204 |
+
'variationsOutput' => (bool) $this->options_obj->general->variations_output,
|
1205 |
+
'userLoggedIn' => is_user_logged_in(),
|
1206 |
+
'scrollTrackingThresholds' => $this->options_obj->general->scroll_tracker_thresholds,
|
1207 |
];
|
1208 |
}
|
1209 |
|
classes/pixels/google/class-google.php
CHANGED
@@ -290,6 +290,7 @@ class Google extends Pixel
|
|
290 |
}
|
291 |
|
292 |
// https://support.google.com/google-ads/answer/9888145
|
|
|
293 |
public function get_google_ads_enhanced_conversion_data( $order )
|
294 |
{
|
295 |
$customer_data = [];
|
@@ -301,15 +302,37 @@ class Google extends Pixel
|
|
301 |
}
|
302 |
|
303 |
if ( $this->is_shipping_address_set( $order ) ) {
|
304 |
-
$
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
} else {
|
307 |
-
$
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
return $customer_data;
|
311 |
}
|
312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
protected function get_billing_address_details( $order )
|
314 |
{
|
315 |
$customer_data = [];
|
290 |
}
|
291 |
|
292 |
// https://support.google.com/google-ads/answer/9888145
|
293 |
+
// Address (first name, last name, postal code, and country are required). You can optionally provide street address, city, and region as additional match keys.
|
294 |
public function get_google_ads_enhanced_conversion_data( $order )
|
295 |
{
|
296 |
$customer_data = [];
|
302 |
}
|
303 |
|
304 |
if ( $this->is_shipping_address_set( $order ) ) {
|
305 |
+
$billing_address = $this->get_billing_address_details( $order );
|
306 |
+
if ( $this->address_requirements_are_met( $billing_address ) ) {
|
307 |
+
$customer_data['address'][] = $billing_address;
|
308 |
+
}
|
309 |
+
$shipping_address = $this->get_shipping_address_details( $order );
|
310 |
+
if ( $this->address_requirements_are_met( $shipping_address ) ) {
|
311 |
+
$customer_data['address'][] = $shipping_address;
|
312 |
+
}
|
313 |
} else {
|
314 |
+
$billing_address = $this->get_billing_address_details( $order );
|
315 |
+
if ( $this->address_requirements_are_met( $billing_address ) ) {
|
316 |
+
$customer_data['address'] = $billing_address;
|
317 |
+
}
|
318 |
}
|
319 |
|
320 |
return $customer_data;
|
321 |
}
|
322 |
|
323 |
+
// Address (first name, last name, postal code, and country are required).
|
324 |
+
protected function address_requirements_are_met( $billing_address )
|
325 |
+
{
|
326 |
+
$required_keys = [
|
327 |
+
'first_name',
|
328 |
+
'last_name',
|
329 |
+
'postal_code',
|
330 |
+
'country'
|
331 |
+
];
|
332 |
+
// if $billing_address contains all keys in $required_keys return true, else false
|
333 |
+
return empty(array_diff( $required_keys, array_keys( $billing_address ) ));
|
334 |
+
}
|
335 |
+
|
336 |
protected function get_billing_address_details( $order )
|
337 |
{
|
338 |
$customer_data = [];
|
classes/pixels/trait-product.php
CHANGED
@@ -326,7 +326,7 @@ trait Trait_Product {
|
|
326 |
<?php
|
327 |
} else {
|
328 |
?>
|
329 |
-
<
|
330 |
<?php
|
331 |
}
|
332 |
|
326 |
<?php
|
327 |
} else {
|
328 |
?>
|
329 |
+
<input type="hidden" class="wpmProductId" data-id="<?php esc_html_e($product->get_id()); ?>">
|
330 |
<?php
|
331 |
}
|
332 |
|
js/admin/wpm-admin-freemius.p1.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(()=>{var t={4749:(t,r,e)=>{var n=e(2856),o=e(7406),i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not a function")}},1342:(t,r,e)=>{var n=e(1286),o=e(8810),i=e(7872).f,u=n("unscopables"),a=Array.prototype;null==a[u]&&i(a,u,{configurable:!0,value:o(null)}),t.exports=function(t){a[u][t]=!0}},448:(t,r,e)=>{var n=e(6873),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not an object")}},5071:(t,r,e)=>{var n=e(5185),o=e(873),i=e(918),u=function(t){return function(r,e,u){var a,c=n(r),f=i(c),s=o(u,f);if(t&&e!=e){for(;f>s;)if((a=c[s++])!=a)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===e)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},5248:(t,r,e)=>{var n=e(547),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},632:(t,r,e)=>{var n=e(3208),o=e(5313),i=e(8688),u=e(7872);t.exports=function(t,r,e){for(var a=o(r),c=u.f,f=i.f,s=0;s<a.length;s++){var p=a[s];n(t,p)||e&&n(e,p)||c(t,p,f(r,p))}}},2357:(t,r,e)=>{var n=e(414),o=e(7872),i=e(6730);t.exports=n?function(t,r,e){return o.f(t,r,i(1,e))}:function(t,r,e){return t[r]=e,t}},6730:t=>{t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},4279:(t,r,e)=>{var n=e(2856),o=e(7872),i=e(1998),u=e(7942);t.exports=function(t,r,e,a){a||(a={});var c=a.enumerable,f=void 0!==a.name?a.name:r;if(n(e)&&i(e,f,a),a.global)c?t[r]=e:u(r,e);else{try{a.unsafe?t[r]&&(c=!0):delete t[r]}catch(t){}c?t[r]=e:o.f(t,r,{value:e,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},7942:(t,r,e)=>{var n=e(5433),o=Object.defineProperty;t.exports=function(t,r){try{o(n,t,{value:r,configurable:!0,writable:!0})}catch(e){n[t]=r}return r}},414:(t,r,e)=>{var n=e(2933);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},2388:(t,r,e)=>{var n=e(5433),o=e(6873),i=n.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},5575:(t,r,e)=>{var n=e(1272);t.exports=n("navigator","userAgent")||""},5723:(t,r,e)=>{var n,o,i=e(5433),u=e(5575),a=i.process,c=i.Deno,f=a&&a.versions||c&&c.version,s=f&&f.v8;s&&(o=(n=s.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&u&&(!(n=u.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=u.match(/Chrome\/(\d+)/))&&(o=+n[1]),t.exports=o},5604:t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},4429:(t,r,e)=>{var n=e(5433),o=e(8688).f,i=e(2357),u=e(4279),a=e(7942),c=e(632),f=e(1476);t.exports=function(t,r){var e,s,p,l,v,b=t.target,y=t.global,d=t.stat;if(e=y?n:d?n[b]||a(b,{}):(n[b]||{}).prototype)for(s in r){if(l=r[s],p=t.dontCallGetSet?(v=o(e,s))&&v.value:e[s],!f(y?s:b+(d?".":"#")+s,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;c(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),u(e,s,l,t)}}},2933:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},3001:(t,r,e)=>{var n=e(2933);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},3573:(t,r,e)=>{var n=e(3001),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},4081:(t,r,e)=>{var n=e(414),o=e(3208),i=Function.prototype,u=n&&Object.getOwnPropertyDescriptor,a=o(i,"name"),c=a&&"something"===function(){}.name,f=a&&(!n||n&&u(i,"name").configurable);t.exports={EXISTS:a,PROPER:c,CONFIGURABLE:f}},547:(t,r,e)=>{var n=e(3001),o=Function.prototype,i=o.bind,u=o.call,a=n&&i.bind(u,u);t.exports=n?function(t){return t&&a(t)}:function(t){return t&&function(){return u.apply(t,arguments)}}},1272:(t,r,e)=>{var n=e(5433),o=e(2856),i=function(t){return o(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?i(n[t]):n[t]&&n[t][r]}},9345:(t,r,e)=>{var n=e(4749);t.exports=function(t,r){var e=t[r];return null==e?void 0:n(e)}},5433:(t,r,e)=>{var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e.g&&e.g)||function(){return this}()||Function("return this")()},3208:(t,r,e)=>{var n=e(547),o=e(4021),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,r){return i(o(t),r)}},7557:t=>{t.exports={}},6383:(t,r,e)=>{var n=e(1272);t.exports=n("document","documentElement")},5841:(t,r,e)=>{var n=e(414),o=e(2933),i=e(2388);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8946:(t,r,e)=>{var n=e(547),o=e(2933),i=e(5248),u=Object,a=n("".split);t.exports=o((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?a(t,""):u(t)}:u},2009:(t,r,e)=>{var n=e(547),o=e(2856),i=e(3479),u=n(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return u(t)}),t.exports=i.inspectSource},418:(t,r,e)=>{var n,o,i,u=e(3829),a=e(5433),c=e(547),f=e(6873),s=e(2357),p=e(3208),l=e(3479),v=e(8607),b=e(7557),y="Object already initialized",d=a.TypeError,g=a.WeakMap;if(u||l.state){var h=l.state||(l.state=new g),m=c(h.get),x=c(h.has),w=c(h.set);n=function(t,r){if(x(h,t))throw new d(y);return r.facade=t,w(h,t,r),r},o=function(t){return m(h,t)||{}},i=function(t){return x(h,t)}}else{var O=v("state");b[O]=!0,n=function(t,r){if(p(t,O))throw new d(y);return r.facade=t,s(t,O,r),r},o=function(t){return p(t,O)?t[O]:{}},i=function(t){return p(t,O)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(r){var e;if(!f(r)||(e=o(r)).type!==t)throw d("Incompatible receiver, "+t+" required");return e}}}},2856:t=>{t.exports=function(t){return"function"==typeof t}},1476:(t,r,e)=>{var n=e(2933),o=e(2856),i=/#|\.prototype\./,u=function(t,r){var e=c[a(t)];return e==s||e!=f&&(o(r)?n(r):!!r)},a=u.normalize=function(t){return String(t).replace(i,".").toLowerCase()},c=u.data={},f=u.NATIVE="N",s=u.POLYFILL="P";t.exports=u},6873:(t,r,e)=>{var n=e(2856);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},2390:t=>{t.exports=!1},9650:(t,r,e)=>{var n=e(1272),o=e(2856),i=e(7012),u=e(8951),a=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=n("Symbol");return o(r)&&i(r.prototype,a(t))}},918:(t,r,e)=>{var n=e(9262);t.exports=function(t){return n(t.length)}},1998:(t,r,e)=>{var n=e(2933),o=e(2856),i=e(3208),u=e(414),a=e(4081).CONFIGURABLE,c=e(2009),f=e(418),s=f.enforce,p=f.get,l=Object.defineProperty,v=u&&!n((function(){return 8!==l((function(){}),"length",{value:8}).length})),b=String(String).split("String"),y=t.exports=function(t,r,e){"Symbol("===String(r).slice(0,7)&&(r="["+String(r).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),e&&e.getter&&(r="get "+r),e&&e.setter&&(r="set "+r),(!i(t,"name")||a&&t.name!==r)&&(u?l(t,"name",{value:r,configurable:!0}):t.name=r),v&&e&&i(e,"arity")&&t.length!==e.arity&&l(t,"length",{value:e.arity});try{e&&i(e,"constructor")&&e.constructor?u&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=s(t);return i(n,"source")||(n.source=b.join("string"==typeof r?r:"")),t};Function.prototype.toString=y((function(){return o(this)&&p(this).source||c(this)}),"toString")},1190:t=>{var r=Math.ceil,e=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?e:r)(n)}},6634:(t,r,e)=>{var n=e(5723),o=e(2933);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},3829:(t,r,e)=>{var n=e(5433),o=e(2856),i=e(2009),u=n.WeakMap;t.exports=o(u)&&/native code/.test(i(u))},8810:(t,r,e)=>{var n,o=e(448),i=e(21),u=e(5604),a=e(7557),c=e(6383),f=e(2388),s=e(8607)("IE_PROTO"),p=function(){},l=function(t){return"<script>"+t+"<\/script>"},v=function(t){t.write(l("")),t.close();var r=t.parentWindow.Object;return t=null,r},b=function(){try{n=new ActiveXObject("htmlfile")}catch(t){}var t,r;b="undefined"!=typeof document?document.domain&&n?v(n):((r=f("iframe")).style.display="none",c.appendChild(r),r.src=String("javascript:"),(t=r.contentWindow.document).open(),t.write(l("document.F=Object")),t.close(),t.F):v(n);for(var e=u.length;e--;)delete b.prototype[u[e]];return b()};a[s]=!0,t.exports=Object.create||function(t,r){var e;return null!==t?(p.prototype=o(t),e=new p,p.prototype=null,e[s]=t):e=b(),void 0===r?e:i.f(e,r)}},21:(t,r,e)=>{var n=e(414),o=e(8272),i=e(7872),u=e(448),a=e(5185),c=e(8454);r.f=n&&!o?Object.defineProperties:function(t,r){u(t);for(var e,n=a(r),o=c(r),f=o.length,s=0;f>s;)i.f(t,e=o[s++],n[e]);return t}},7872:(t,r,e)=>{var n=e(414),o=e(5841),i=e(8272),u=e(448),a=e(29),c=TypeError,f=Object.defineProperty,s=Object.getOwnPropertyDescriptor;r.f=n?i?function(t,r,e){if(u(t),r=a(r),u(e),"function"==typeof t&&"prototype"===r&&"value"in e&&"writable"in e&&!e.writable){var n=s(t,r);n&&n.writable&&(t[r]=e.value,e={configurable:"configurable"in e?e.configurable:n.configurable,enumerable:"enumerable"in e?e.enumerable:n.enumerable,writable:!1})}return f(t,r,e)}:f:function(t,r,e){if(u(t),r=a(r),u(e),o)try{return f(t,r,e)}catch(t){}if("get"in e||"set"in e)throw c("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},8688:(t,r,e)=>{var n=e(414),o=e(3573),i=e(4017),u=e(6730),a=e(5185),c=e(29),f=e(3208),s=e(5841),p=Object.getOwnPropertyDescriptor;r.f=n?p:function(t,r){if(t=a(t),r=c(r),s)try{return p(t,r)}catch(t){}if(f(t,r))return u(!o(i.f,t,r),t[r])}},7839:(t,r,e)=>{var n=e(209),o=e(5604).concat("length","prototype");r.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},6824:(t,r)=>{r.f=Object.getOwnPropertySymbols},7012:(t,r,e)=>{var n=e(547);t.exports=n({}.isPrototypeOf)},209:(t,r,e)=>{var n=e(547),o=e(3208),i=e(5185),u=e(5071).indexOf,a=e(7557),c=n([].push);t.exports=function(t,r){var e,n=i(t),f=0,s=[];for(e in n)!o(a,e)&&o(n,e)&&c(s,e);for(;r.length>f;)o(n,e=r[f++])&&(~u(s,e)||c(s,e));return s}},8454:(t,r,e)=>{var n=e(209),o=e(5604);t.exports=Object.keys||function(t){return n(t,o)}},4017:(t,r)=>{"use strict";var e={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!e.call({1:2},1);r.f=o?function(t){var r=n(this,t);return!!r&&r.enumerable}:e},542:(t,r,e)=>{var n=e(3573),o=e(2856),i=e(6873),u=TypeError;t.exports=function(t,r){var e,a;if("string"===r&&o(e=t.toString)&&!i(a=n(e,t)))return a;if(o(e=t.valueOf)&&!i(a=n(e,t)))return a;if("string"!==r&&o(e=t.toString)&&!i(a=n(e,t)))return a;throw u("Can't convert object to primitive value")}},5313:(t,r,e)=>{var n=e(1272),o=e(547),i=e(7839),u=e(6824),a=e(448),c=o([].concat);t.exports=n("Reflect","ownKeys")||function(t){var r=i.f(a(t)),e=u.f;return e?c(r,e(t)):r}},4630:t=>{var r=TypeError;t.exports=function(t){if(null==t)throw r("Can't call method on "+t);return t}},8607:(t,r,e)=>{var n=e(3062),o=e(5834),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},3479:(t,r,e)=>{var n=e(5433),o=e(7942),i="__core-js_shared__",u=n[i]||o(i,{});t.exports=u},3062:(t,r,e)=>{var n=e(2390),o=e(3479);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.24.1",mode:n?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},873:(t,r,e)=>{var n=e(7219),o=Math.max,i=Math.min;t.exports=function(t,r){var e=n(t);return e<0?o(e+r,0):i(e,r)}},5185:(t,r,e)=>{var n=e(8946),o=e(4630);t.exports=function(t){return n(o(t))}},7219:(t,r,e)=>{var n=e(1190);t.exports=function(t){var r=+t;return r!=r||0===r?0:n(r)}},9262:(t,r,e)=>{var n=e(7219),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},4021:(t,r,e)=>{var n=e(4630),o=Object;t.exports=function(t){return o(n(t))}},9984:(t,r,e)=>{var n=e(3573),o=e(6873),i=e(9650),u=e(9345),a=e(542),c=e(1286),f=TypeError,s=c("toPrimitive");t.exports=function(t,r){if(!o(t)||i(t))return t;var e,c=u(t,s);if(c){if(void 0===r&&(r="default"),e=n(c,t,r),!o(e)||i(e))return e;throw f("Can't convert object to primitive value")}return void 0===r&&(r="number"),a(t,r)}},29:(t,r,e)=>{var n=e(9984),o=e(9650);t.exports=function(t){var r=n(t,"string");return o(r)?r:r+""}},7406:t=>{var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},5834:(t,r,e)=>{var n=e(547),o=0,i=Math.random(),u=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++o+i,36)}},8951:(t,r,e)=>{var n=e(6634);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8272:(t,r,e)=>{var n=e(414),o=e(2933);t.exports=n&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},1286:(t,r,e)=>{var n=e(5433),o=e(3062),i=e(3208),u=e(5834),a=e(6634),c=e(8951),f=o("wks"),s=n.Symbol,p=s&&s.for,l=c?s:s&&s.withoutSetter||u;t.exports=function(t){if(!i(f,t)||!a&&"string"!=typeof f[t]){var r="Symbol."+t;a&&i(s,t)?f[t]=s[t]:f[t]=c&&p?p(r):l(r)}return f[t]}},1431:(t,r,e)=>{"use strict";e.r(r);var n=e(4429),o=e(5071).includes,i=e(2933),u=e(1342);n({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),u("includes"),function(){try{new MutationObserver((function(t){t.forEach((function(t){"class"===t.attributeName&&jQuery(t.target).prop(t.attributeName).includes("disabled")&&jQuery(".fs-modal").find(".button-deactivate").removeClass("disabled")}))})).observe(jQuery(".fs-modal").find(".button-deactivate")[0],{attributes:!0})}catch(t){console.error(t)}}()}},r={};function e(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return t[n](i,i.exports,e),i.exports}e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e(1431)})();
|
2 |
//# sourceMappingURL=wpm-admin-freemius.p1.min.js.map
|
1 |
+
(()=>{var t={92:()=>{!function(){try{new MutationObserver((function(t){t.forEach((function(t){"class"===t.attributeName&&jQuery(t.target).prop(t.attributeName).includes("disabled")&&jQuery(".fs-modal").find(".button-deactivate").removeClass("disabled")}))})).observe(jQuery(".fs-modal").find(".button-deactivate")[0],{attributes:!0})}catch(t){console.error(t)}}()}},e={};!function r(a){var o=e[a];if(void 0!==o)return o.exports;var n=e[a]={exports:{}};return t[a](n,n.exports,r),n.exports}(92)})();
|
2 |
//# sourceMappingURL=wpm-admin-freemius.p1.min.js.map
|
js/admin/wpm-admin-freemius.p1.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"wpm-admin-freemius.p1.min.js","mappings":"4BAAA,IAAIA,EAAaC,EAAQ,MACrBC,EAAcD,EAAQ,MAEtBE,EAAaC,UAGjBC,EAAOC,QAAU,SAAUC,GACzB,GAAIP,EAAWO,GAAW,OAAOA,EACjC,MAAMJ,EAAWD,EAAYK,GAAY,qBAC1C,C,iBCTD,IAAIC,EAAkBP,EAAQ,MAC1BQ,EAASR,EAAQ,MACjBS,EAAiBT,EAAAA,MAAAA,EAEjBU,EAAcH,EAAgB,eAC9BI,EAAiBC,MAAMC,UAIQC,MAA/BH,EAAeD,IACjBD,EAAeE,EAAgBD,EAAa,CAC1CK,cAAc,EACdC,MAAOR,EAAO,QAKlBJ,EA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CA,EAAUC,SAAQ,SAAUC,GACI,UAA3BA,EAASC,eACSC,OAAOF,EAASvO,QAAQ0O,KAAKH,EAASC,eACxCnP,SAAS,aAC3BoP,OAAO,aAAaE,KAAK,sBAAsBC,YAAY,WAG7D,GACD,IAEQC,QAAQJ,OAAO,aAAaE,KAAK,sBAAsB,GAAI,CACnEG,YAAY,GAKb,CAFC,MAAO1N,GACR2N,QAAQ3N,MAAMA,EACd,CApBF,G,GCCI4N,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB/Q,IAAjBgR,EACH,OAAOA,EAAazR,QAGrB,IAAID,EAASuR,EAAyBE,GAAY,CAGjDxR,QAAS,CAAC,GAOX,OAHA0R,EAAoBF,GAAUzR,EAAQA,EAAOC,QAASuR,GAG/CxR,EAAOC,OACf,CCtBAuR,EAAoBI,EAAI,WACvB,GAA0B,iBAAf1K,WAAyB,OAAOA,WAC3C,IACC,OAAOG,MAAQ,IAAIpB,SAAS,cAAb,EAGhB,CAFE,MAAO4L,GACR,GAAsB,iBAAX1K,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCCxBqK,EAAoBM,EAAK7R,IACH,oBAAXkL,QAA0BA,OAAO4G,aAC1CjO,OAAOzD,eAAeJ,EAASkL,OAAO4G,YAAa,CAAEnR,MAAO,WAE7DkD,OAAOzD,eAAeJ,EAAS,aAAc,CAAEW,OAAO,GAAO,ECJ9DhB,EAAQ,K","sources":["webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/a-callable.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/add-to-unscopables.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/an-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/array-includes.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/classof-raw.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/copy-constructor-properties.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/create-non-enumerable-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/create-property-descriptor.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/define-built-in.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/define-global-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/descriptors.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/document-create-element.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/engine-user-agent.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/engine-v8-version.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/enum-bug-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/export.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/fails.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-bind-native.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-call.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-name.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-uncurry-this.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/get-built-in.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/get-method.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/global.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/has-own-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/hidden-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/html.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/ie8-dom-define.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/indexed-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/inspect-source.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/internal-state.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-callable.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-forced.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-pure.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-symbol.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/length-of-array-like.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/make-built-in.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/math-trunc.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/native-symbol.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/native-weak-map.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-create.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-define-properties.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-define-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-get-own-property-descriptor.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-get-own-property-names.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-get-own-property-symbols.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-is-prototype-of.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-keys-internal.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-property-is-enumerable.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/ordinary-to-primitive.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/own-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/require-object-coercible.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/shared-key.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/shared-store.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/shared.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-absolute-index.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-indexed-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-integer-or-infinity.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-length.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-primitive.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-property-key.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/try-to-string.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/uid.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/use-symbol-as-uid.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/v8-prototype-define-bug.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/well-known-symbol.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/modules/es.array.includes.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/admin/freemius-keep-deactivate-button-enabled.js","webpack://Pixel-Manager-for-WooCommerce/webpack/bootstrap","webpack://Pixel-Manager-for-WooCommerce/webpack/runtime/global","webpack://Pixel-Manager-for-WooCommerce/webpack/runtime/make namespace object","webpack://Pixel-Manager-for-WooCommerce/./src/js/admin/main-freemius.js"],"sourcesContent":["var isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw $TypeError(tryToString(argument) + ' is not a function');\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar create = require('../internals/object-create');\nvar defineProperty = require('../internals/object-define-property').f;\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] == undefined) {\n defineProperty(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: create(null)\n });\n}\n\n// add a key to Array.prototype[@@unscopables]\nmodule.exports = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n};\n","var isObject = require('../internals/is-object');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw $TypeError($String(argument) + ' is not an object');\n};\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(''.slice);\n\nmodule.exports = function (it) {\n return stringSlice(toString(it), 8, -1);\n};\n","var hasOwn = require('../internals/has-own-property');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source, exceptions) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n }\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var isCallable = require('../internals/is-callable');\nvar definePropertyModule = require('../internals/object-define-property');\nvar makeBuiltIn = require('../internals/make-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nmodule.exports = function (O, key, value, options) {\n if (!options) options = {};\n var simple = options.enumerable;\n var name = options.name !== undefined ? options.name : key;\n if (isCallable(value)) makeBuiltIn(value, name, options);\n if (options.global) {\n if (simple) O[key] = value;\n else defineGlobalProperty(key, value);\n } else {\n try {\n if (!options.unsafe) delete O[key];\n else if (O[key]) simple = true;\n } catch (error) { /* empty */ }\n if (simple) O[key] = value;\n else definePropertyModule.f(O, key, {\n value: value,\n enumerable: false,\n configurable: !options.nonConfigurable,\n writable: !options.nonWritable\n });\n } return O;\n};\n","var global = require('../internals/global');\n\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(global, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var fails = require('../internals/fails');\n\n// Detect IE8's incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('navigator', 'userAgent') || '';\n","var global = require('../internals/global');\nvar userAgent = require('../internals/engine-user-agent');\n\nvar process = global.process;\nvar Deno = global.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n // in old Chrome, versions of V8 isn't V8 = Chrome / 10\n // but their correct versions are not interesting for us\n version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || defineGlobalProperty(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty == typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n defineBuiltIn(target, key, sourceProperty, options);\n }\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es-x/no-function-prototype-bind -- safe\n var test = (function () { /* empty */ }).bind();\n // eslint-disable-next-line no-prototype-builtins -- safe\n return typeof test != 'function' || test.hasOwnProperty('prototype');\n});\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar call = Function.prototype.call;\n\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n return call.apply(call, arguments);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar bind = FunctionPrototype.bind;\nvar call = FunctionPrototype.call;\nvar uncurryThis = NATIVE_BIND && bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? function (fn) {\n return fn && uncurryThis(fn);\n} : function (fn) {\n return fn && function () {\n return call.apply(fn, arguments);\n };\n};\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (argument) {\n return isCallable(argument) ? argument : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];\n};\n","var aCallable = require('../internals/a-callable');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return func == null ? undefined : aCallable(func);\n};\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line es-x/no-global-this -- safe\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n // eslint-disable-next-line no-restricted-globals -- safe\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func -- fallback\n (function () { return this; })() || Function('return this')();\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es-x/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n","module.exports = {};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar $Object = Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !$Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split(it, '') : $Object(it);\n} : $Object;\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = global.TypeError;\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n var wmget = uncurryThis(store.get);\n var wmhas = uncurryThis(store.has);\n var wmset = uncurryThis(store.set);\n set = function (it, metadata) {\n if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n wmset(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget(store, it) || {};\n };\n has = function (it) {\n return wmhas(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\nmodule.exports = function (argument) {\n return typeof argument == 'function';\n};\n","var fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","var isCallable = require('../internals/is-callable');\n\nmodule.exports = function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n","module.exports = false;\n","var getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n var $Symbol = getBuiltIn('Symbol');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n","var toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n","var fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nvar CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {\n return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;\n});\n\nvar TEMPLATE = String(String).split('String');\n\nvar makeBuiltIn = module.exports = function (value, name, options) {\n if (String(name).slice(0, 7) === 'Symbol(') {\n name = '[' + String(name).replace(/^Symbol\\(([^)]*)\\)/, '$1') + ']';\n }\n if (options && options.getter) name = 'get ' + name;\n if (options && options.setter) name = 'set ' + name;\n if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {\n if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });\n else value.name = name;\n }\n if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {\n defineProperty(value, 'length', { value: options.arity });\n }\n try {\n if (options && hasOwn(options, 'constructor') && options.constructor) {\n if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });\n // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable\n } else if (value.prototype) value.prototype = undefined;\n } catch (error) { /* empty */ }\n var state = enforceInternalState(value);\n if (!hasOwn(state, 'source')) {\n state.source = TEMPLATE.join(typeof name == 'string' ? name : '');\n } return value;\n};\n\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n// eslint-disable-next-line no-extend-native -- required\nFunction.prototype.toString = makeBuiltIn(function toString() {\n return isCallable(this) && getInternalState(this).source || inspectSource(this);\n}, 'toString');\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es-x/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n","/* eslint-disable es-x/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/engine-v8-version');\nvar fails = require('../internals/fails');\n\n// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol();\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n return !String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));\n","/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != 'undefined'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es-x/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es-x/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es-x/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n","var call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw $TypeError(\"Can't convert object to primitive value\");\n};\n","var getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n","var $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw $TypeError(\"Can't call method on \" + it);\n return it;\n};\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","var global = require('../internals/global');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || defineGlobalProperty(SHARED, {});\n\nmodule.exports = store;\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.24.1',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n","var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","var trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n","var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return $Object(requireObjectCoercible(argument));\n};\n","var call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = 'default';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw $TypeError(\"Can't convert object to primitive value\");\n }\n if (pref === undefined) pref = 'number';\n return ordinaryToPrimitive(input, pref);\n};\n","var toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, 'string');\n return isSymbol(key) ? key : key + '';\n};\n","var $String = String;\n\nmodule.exports = function (argument) {\n try {\n return $String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.0.toString);\n\nmodule.exports = function (key) {\n return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n","/* eslint-disable es-x/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n && !Symbol.sham\n && typeof Symbol.iterator == 'symbol';\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n value: 42,\n writable: false\n }).prototype != 42;\n});\n","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar symbolFor = Symbol && Symbol['for'];\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {\n var description = 'Symbol.' + name;\n if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {\n WellKnownSymbolsStore[name] = Symbol[name];\n } else if (USE_SYMBOL_AS_UID && symbolFor) {\n WellKnownSymbolsStore[name] = symbolFor(description);\n } else {\n WellKnownSymbolsStore[name] = createWellKnownSymbol(description);\n }\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar fails = require('../internals/fails');\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// FF99+ bug\nvar BROKEN_ON_SPARSE = fails(function () {\n return !Array(1).includes();\n});\n\n// `Array.prototype.includes` method\n// https://tc39.es/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","(function () {\n\ttry {\n\n\t\tlet observer = new MutationObserver(function (mutations) {\n\t\t\tmutations.forEach(function (mutation) {\n\t\t\t\tif (mutation.attributeName === \"class\") {\n\t\t\t\t\tlet attributeValue = jQuery(mutation.target).prop(mutation.attributeName);\n\t\t\t\t\tif (attributeValue.includes('disabled')) {\n\t\t\t\t\t\tjQuery('.fs-modal').find('.button-deactivate').removeClass('disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tobserver.observe(jQuery('.fs-modal').find('.button-deactivate')[0], {\n\t\t\tattributes: true\n\t\t});\n\n\t} catch (error) {\n\t\tconsole.error(error);\n\t}\n})();\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nrequire(\"./freemius-keep-deactivate-button-enabled\")\n"],"names":["isCallable","require","tryToString","$TypeError","TypeError","module","exports","argument","wellKnownSymbol","create","defineProperty","UNSCOPABLES","ArrayPrototype","Array","prototype","undefined","configurable","value","key","isObject","$String","String","toIndexedObject","toAbsoluteIndex","lengthOfArrayLike","createMethod","IS_INCLUDES","$this","el","fromIndex","O","length","index","includes","indexOf","uncurryThis","toString","stringSlice","slice","it","hasOwn","ownKeys","getOwnPropertyDescriptorModule","definePropertyModule","target","source","exceptions","keys","f","getOwnPropertyDescriptor","i","DESCRIPTORS","createPropertyDescriptor","object","bitmap","enumerable","writable","makeBuiltIn","defineGlobalProperty","options","simple","name","global","unsafe","error","nonConfigurable","nonWritable","Object","fails","get","document","EXISTS","createElement","getBuiltIn","match","version","userAgent","process","Deno","versions","v8","split","createNonEnumerableProperty","defineBuiltIn","copyConstructorProperties","isForced","targetProperty","sourceProperty","descriptor","TARGET","GLOBAL","STATIC","stat","dontCallGetSet","forced","sham","exec","test","bind","hasOwnProperty","NATIVE_BIND","call","Function","apply","arguments","FunctionPrototype","getDescriptor","PROPER","CONFIGURABLE","fn","aFunction","namespace","method","aCallable","V","P","func","check","Math","globalThis","window","self","this","toObject","a","classof","$Object","propertyIsEnumerable","store","functionToString","inspectSource","set","has","NATIVE_WEAK_MAP","shared","sharedKey","hiddenKeys","OBJECT_ALREADY_INITIALIZED","WeakMap","state","wmget","wmhas","wmset","metadata","facade","STATE","enforce","getterFor","TYPE","type","replacement","feature","detection","data","normalize","POLYFILL","NATIVE","string","replace","toLowerCase","isPrototypeOf","USE_SYMBOL_AS_UID","$Symbol","toLength","obj","CONFIGURABLE_FUNCTION_NAME","InternalStateModule","enforceInternalState","getInternalState","CONFIGURABLE_LENGTH","TEMPLATE","getter","setter","arity","constructor","join","ceil","floor","trunc","x","n","V8_VERSION","getOwnPropertySymbols","symbol","Symbol","activeXDocument","anObject","definePropertiesModule","enumBugKeys","html","documentCreateElement","IE_PROTO","EmptyConstructor","scriptTag","content","LT","NullProtoObjectViaActiveX","write","close","temp","parentWindow","NullProtoObject","ActiveXObject","iframeDocument","iframe","domain","style","display","appendChild","src","contentWindow","open","F","Properties","result","V8_PROTOTYPE_DEFINE_BUG","objectKeys","defineProperties","props","IE8_DOM_DEFINE","toPropertyKey","$defineProperty","$getOwnPropertyDescriptor","Attributes","current","propertyIsEnumerableModule","internalObjectKeys","concat","getOwnPropertyNames","push","names","$propertyIsEnumerable","NASHORN_BUG","input","pref","val","valueOf","getOwnPropertyNamesModule","getOwnPropertySymbolsModule","uid","SHARED","IS_PURE","mode","copyright","license","toIntegerOrInfinity","max","min","integer","IndexedObject","requireObjectCoercible","number","isSymbol","getMethod","ordinaryToPrimitive","TO_PRIMITIVE","exoticToPrim","toPrimitive","id","postfix","random","NATIVE_SYMBOL","iterator","WellKnownSymbolsStore","symbolFor","createWellKnownSymbol","withoutSetter","description","$","$includes","addToUnscopables","proto","MutationObserver","mutations","forEach","mutation","attributeName","jQuery","prop","find","removeClass","observe","attributes","console","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","g","e","r","toStringTag"],"sourceRoot":""}
|
1 |
+
{"version":3,"file":"wpm-admin-freemius.p1.min.js","mappings":"sBAAA,WACC,IAEgB,IAAIA,kBAAiB,SAAUC,GAC7CA,EAAUC,SAAQ,SAAUC,GACI,UAA3BA,EAASC,eACSC,OAAOF,EAASG,QAAQC,KAAKJ,EAASC,eACxCI,SAAS,aAC3BH,OAAO,aAAaI,KAAK,sBAAsBC,YAAY,WAG7D,GACD,IAEQC,QAAQN,OAAO,aAAaI,KAAK,sBAAsB,GAAI,CACnEG,YAAY,GAKb,CAFC,MAAOC,GACRC,QAAQD,MAAMA,EACd,CApBF,G,GCCIE,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,CAAC,GAOX,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,OACf,CCrBAG,CAAQ,G","sources":["webpack://Pixel-Manager-for-WooCommerce/./src/js/admin/freemius-keep-deactivate-button-enabled.js","webpack://Pixel-Manager-for-WooCommerce/webpack/bootstrap","webpack://Pixel-Manager-for-WooCommerce/./src/js/admin/main-freemius.js"],"sourcesContent":["(function () {\n\ttry {\n\n\t\tlet observer = new MutationObserver(function (mutations) {\n\t\t\tmutations.forEach(function (mutation) {\n\t\t\t\tif (mutation.attributeName === \"class\") {\n\t\t\t\t\tlet attributeValue = jQuery(mutation.target).prop(mutation.attributeName);\n\t\t\t\t\tif (attributeValue.includes('disabled')) {\n\t\t\t\t\t\tjQuery('.fs-modal').find('.button-deactivate').removeClass('disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tobserver.observe(jQuery('.fs-modal').find('.button-deactivate')[0], {\n\t\t\tattributes: true\n\t\t});\n\n\t} catch (error) {\n\t\tconsole.error(error);\n\t}\n})();\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\nrequire(\"./freemius-keep-deactivate-button-enabled\")\n"],"names":["MutationObserver","mutations","forEach","mutation","attributeName","jQuery","target","prop","includes","find","removeClass","observe","attributes","error","console","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","require"],"sourceRoot":""}
|
js/public/wpm-public.p1.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(()=>{var __webpack_modules__={4749:(e,t,o)=>{var r=o(2856),a=o(7406),n=TypeError;e.exports=function(e){if(r(e))return e;throw n(a(e)+" is not a function")}},1342:(e,t,o)=>{var r=o(1286),a=o(8810),n=o(7872).f,i=r("unscopables"),l=Array.prototype;null==l[i]&&n(l,i,{configurable:!0,value:a(null)}),e.exports=function(e){l[i][e]=!0}},448:(e,t,o)=>{var r=o(6873),a=String,n=TypeError;e.exports=function(e){if(r(e))return e;throw n(a(e)+" is not an object")}},5071:(e,t,o)=>{var r=o(5185),a=o(873),n=o(918),i=function(e){return function(t,o,i){var l,s=r(t),d=n(s),c=a(i,d);if(e&&o!=o){for(;d>c;)if((l=s[c++])!=l)return!0}else for(;d>c;c++)if((e||c in s)&&s[c]===o)return e||c||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},5248:(e,t,o)=>{var r=o(547),a=r({}.toString),n=r("".slice);e.exports=function(e){return n(a(e),8,-1)}},632:(e,t,o)=>{var r=o(3208),a=o(5313),n=o(8688),i=o(7872);e.exports=function(e,t,o){for(var l=a(t),s=i.f,d=n.f,c=0;c<l.length;c++){var u=l[c];r(e,u)||o&&r(o,u)||s(e,u,d(t,u))}}},2357:(e,t,o)=>{var r=o(414),a=o(7872),n=o(6730);e.exports=r?function(e,t,o){return a.f(e,t,n(1,o))}:function(e,t,o){return e[t]=o,e}},6730:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4279:(e,t,o)=>{var r=o(2856),a=o(7872),n=o(1998),i=o(7942);e.exports=function(e,t,o,l){l||(l={});var s=l.enumerable,d=void 0!==l.name?l.name:t;if(r(o)&&n(o,d,l),l.global)s?e[t]=o:i(t,o);else{try{l.unsafe?e[t]&&(s=!0):delete e[t]}catch(e){}s?e[t]=o:a.f(e,t,{value:o,enumerable:!1,configurable:!l.nonConfigurable,writable:!l.nonWritable})}return e}},7942:(e,t,o)=>{var r=o(5433),a=Object.defineProperty;e.exports=function(e,t){try{a(r,e,{value:t,configurable:!0,writable:!0})}catch(o){r[e]=t}return t}},414:(e,t,o)=>{var r=o(2933);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},2388:(e,t,o)=>{var r=o(5433),a=o(6873),n=r.document,i=a(n)&&a(n.createElement);e.exports=function(e){return i?n.createElement(e):{}}},5575:(e,t,o)=>{var r=o(1272);e.exports=r("navigator","userAgent")||""},5723:(e,t,o)=>{var r,a,n=o(5433),i=o(5575),l=n.process,s=n.Deno,d=l&&l.versions||s&&s.version,c=d&&d.v8;c&&(a=(r=c.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!a&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(a=+r[1]),e.exports=a},5604:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},4429:(e,t,o)=>{var r=o(5433),a=o(8688).f,n=o(2357),i=o(4279),l=o(7942),s=o(632),d=o(1476);e.exports=function(e,t){var o,c,u,p,m,g=e.target,w=e.global,y=e.stat;if(o=w?r:y?r[g]||l(g,{}):(r[g]||{}).prototype)for(c in t){if(p=t[c],u=e.dontCallGetSet?(m=a(o,c))&&m.value:o[c],!d(w?c:g+(y?".":"#")+c,e.forced)&&void 0!==u){if(typeof p==typeof u)continue;s(p,u)}(e.sham||u&&u.sham)&&n(p,"sham",!0),i(o,c,p,e)}}},2933:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},3001:(e,t,o)=>{var r=o(2933);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},3573:(e,t,o)=>{var r=o(3001),a=Function.prototype.call;e.exports=r?a.bind(a):function(){return a.apply(a,arguments)}},4081:(e,t,o)=>{var r=o(414),a=o(3208),n=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,l=a(n,"name"),s=l&&"something"===function(){}.name,d=l&&(!r||r&&i(n,"name").configurable);e.exports={EXISTS:l,PROPER:s,CONFIGURABLE:d}},547:(e,t,o)=>{var r=o(3001),a=Function.prototype,n=a.bind,i=a.call,l=r&&n.bind(i,i);e.exports=r?function(e){return e&&l(e)}:function(e){return e&&function(){return i.apply(e,arguments)}}},1272:(e,t,o)=>{var r=o(5433),a=o(2856),n=function(e){return a(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?n(r[e]):r[e]&&r[e][t]}},9345:(e,t,o)=>{var r=o(4749);e.exports=function(e,t){var o=e[t];return null==o?void 0:r(o)}},5433:(e,t,o)=>{var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof o.g&&o.g)||function(){return this}()||Function("return this")()},3208:(e,t,o)=>{var r=o(547),a=o(4021),n=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return n(a(e),t)}},7557:e=>{e.exports={}},6383:(e,t,o)=>{var r=o(1272);e.exports=r("document","documentElement")},5841:(e,t,o)=>{var r=o(414),a=o(2933),n=o(2388);e.exports=!r&&!a((function(){return 7!=Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))},8946:(e,t,o)=>{var r=o(547),a=o(2933),n=o(5248),i=Object,l=r("".split);e.exports=a((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"==n(e)?l(e,""):i(e)}:i},2009:(e,t,o)=>{var r=o(547),a=o(2856),n=o(3479),i=r(Function.toString);a(n.inspectSource)||(n.inspectSource=function(e){return i(e)}),e.exports=n.inspectSource},418:(e,t,o)=>{var r,a,n,i=o(3829),l=o(5433),s=o(547),d=o(6873),c=o(2357),u=o(3208),p=o(3479),m=o(8607),g=o(7557),w="Object already initialized",y=l.TypeError,v=l.WeakMap;if(i||p.state){var f=p.state||(p.state=new v),_=s(f.get),h=s(f.has),L=s(f.set);r=function(e,t){if(h(f,e))throw new y(w);return t.facade=e,L(f,e,t),t},a=function(e){return _(f,e)||{}},n=function(e){return h(f,e)}}else{var b=m("state");g[b]=!0,r=function(e,t){if(u(e,b))throw new y(w);return t.facade=e,c(e,b,t),t},a=function(e){return u(e,b)?e[b]:{}},n=function(e){return u(e,b)}}e.exports={set:r,get:a,has:n,enforce:function(e){return n(e)?a(e):r(e,{})},getterFor:function(e){return function(t){var o;if(!d(t)||(o=a(t)).type!==e)throw y("Incompatible receiver, "+e+" required");return o}}}},2856:e=>{e.exports=function(e){return"function"==typeof e}},1476:(e,t,o)=>{var r=o(2933),a=o(2856),n=/#|\.prototype\./,i=function(e,t){var o=s[l(e)];return o==c||o!=d&&(a(t)?r(t):!!t)},l=i.normalize=function(e){return String(e).replace(n,".").toLowerCase()},s=i.data={},d=i.NATIVE="N",c=i.POLYFILL="P";e.exports=i},6873:(e,t,o)=>{var r=o(2856);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},2390:e=>{e.exports=!1},9650:(e,t,o)=>{var r=o(1272),a=o(2856),n=o(7012),i=o(8951),l=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return a(t)&&n(t.prototype,l(e))}},918:(e,t,o)=>{var r=o(9262);e.exports=function(e){return r(e.length)}},1998:(e,t,o)=>{var r=o(2933),a=o(2856),n=o(3208),i=o(414),l=o(4081).CONFIGURABLE,s=o(2009),d=o(418),c=d.enforce,u=d.get,p=Object.defineProperty,m=i&&!r((function(){return 8!==p((function(){}),"length",{value:8}).length})),g=String(String).split("String"),w=e.exports=function(e,t,o){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),o&&o.getter&&(t="get "+t),o&&o.setter&&(t="set "+t),(!n(e,"name")||l&&e.name!==t)&&(i?p(e,"name",{value:t,configurable:!0}):e.name=t),m&&o&&n(o,"arity")&&e.length!==o.arity&&p(e,"length",{value:o.arity});try{o&&n(o,"constructor")&&o.constructor?i&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=c(e);return n(r,"source")||(r.source=g.join("string"==typeof t?t:"")),e};Function.prototype.toString=w((function(){return a(this)&&u(this).source||s(this)}),"toString")},1190:e=>{var t=Math.ceil,o=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?o:t)(r)}},6634:(e,t,o)=>{var r=o(5723),a=o(2933);e.exports=!!Object.getOwnPropertySymbols&&!a((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},3829:(e,t,o)=>{var r=o(5433),a=o(2856),n=o(2009),i=r.WeakMap;e.exports=a(i)&&/native code/.test(n(i))},8810:(e,t,o)=>{var r,a=o(448),n=o(21),i=o(5604),l=o(7557),s=o(6383),d=o(2388),c=o(8607)("IE_PROTO"),u=function(){},p=function(e){return"<script>"+e+"<\/script>"},m=function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t},g=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t;g="undefined"!=typeof document?document.domain&&r?m(r):((t=d("iframe")).style.display="none",s.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F):m(r);for(var o=i.length;o--;)delete g.prototype[i[o]];return g()};l[c]=!0,e.exports=Object.create||function(e,t){var o;return null!==e?(u.prototype=a(e),o=new u,u.prototype=null,o[c]=e):o=g(),void 0===t?o:n.f(o,t)}},21:(e,t,o)=>{var r=o(414),a=o(8272),n=o(7872),i=o(448),l=o(5185),s=o(8454);t.f=r&&!a?Object.defineProperties:function(e,t){i(e);for(var o,r=l(t),a=s(t),d=a.length,c=0;d>c;)n.f(e,o=a[c++],r[o]);return e}},7872:(e,t,o)=>{var r=o(414),a=o(5841),n=o(8272),i=o(448),l=o(29),s=TypeError,d=Object.defineProperty,c=Object.getOwnPropertyDescriptor;t.f=r?n?function(e,t,o){if(i(e),t=l(t),i(o),"function"==typeof e&&"prototype"===t&&"value"in o&&"writable"in o&&!o.writable){var r=c(e,t);r&&r.writable&&(e[t]=o.value,o={configurable:"configurable"in o?o.configurable:r.configurable,enumerable:"enumerable"in o?o.enumerable:r.enumerable,writable:!1})}return d(e,t,o)}:d:function(e,t,o){if(i(e),t=l(t),i(o),a)try{return d(e,t,o)}catch(e){}if("get"in o||"set"in o)throw s("Accessors not supported");return"value"in o&&(e[t]=o.value),e}},8688:(e,t,o)=>{var r=o(414),a=o(3573),n=o(4017),i=o(6730),l=o(5185),s=o(29),d=o(3208),c=o(5841),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=l(e),t=s(t),c)try{return u(e,t)}catch(e){}if(d(e,t))return i(!a(n.f,e,t),e[t])}},7839:(e,t,o)=>{var r=o(209),a=o(5604).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,a)}},6824:(e,t)=>{t.f=Object.getOwnPropertySymbols},7012:(e,t,o)=>{var r=o(547);e.exports=r({}.isPrototypeOf)},209:(e,t,o)=>{var r=o(547),a=o(3208),n=o(5185),i=o(5071).indexOf,l=o(7557),s=r([].push);e.exports=function(e,t){var o,r=n(e),d=0,c=[];for(o in r)!a(l,o)&&a(r,o)&&s(c,o);for(;t.length>d;)a(r,o=t[d++])&&(~i(c,o)||s(c,o));return c}},8454:(e,t,o)=>{var r=o(209),a=o(5604);e.exports=Object.keys||function(e){return r(e,a)}},4017:(e,t)=>{"use strict";var o={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,a=r&&!o.call({1:2},1);t.f=a?function(e){var t=r(this,e);return!!t&&t.enumerable}:o},542:(e,t,o)=>{var r=o(3573),a=o(2856),n=o(6873),i=TypeError;e.exports=function(e,t){var o,l;if("string"===t&&a(o=e.toString)&&!n(l=r(o,e)))return l;if(a(o=e.valueOf)&&!n(l=r(o,e)))return l;if("string"!==t&&a(o=e.toString)&&!n(l=r(o,e)))return l;throw i("Can't convert object to primitive value")}},5313:(e,t,o)=>{var r=o(1272),a=o(547),n=o(7839),i=o(6824),l=o(448),s=a([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=n.f(l(e)),o=i.f;return o?s(t,o(e)):t}},4630:e=>{var t=TypeError;e.exports=function(e){if(null==e)throw t("Can't call method on "+e);return e}},8607:(e,t,o)=>{var r=o(3062),a=o(5834),n=r("keys");e.exports=function(e){return n[e]||(n[e]=a(e))}},3479:(e,t,o)=>{var r=o(5433),a=o(7942),n="__core-js_shared__",i=r[n]||a(n,{});e.exports=i},3062:(e,t,o)=>{var r=o(2390),a=o(3479);(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.24.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},873:(e,t,o)=>{var r=o(7219),a=Math.max,n=Math.min;e.exports=function(e,t){var o=r(e);return o<0?a(o+t,0):n(o,t)}},5185:(e,t,o)=>{var r=o(8946),a=o(4630);e.exports=function(e){return r(a(e))}},7219:(e,t,o)=>{var r=o(1190);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},9262:(e,t,o)=>{var r=o(7219),a=Math.min;e.exports=function(e){return e>0?a(r(e),9007199254740991):0}},4021:(e,t,o)=>{var r=o(4630),a=Object;e.exports=function(e){return a(r(e))}},9984:(e,t,o)=>{var r=o(3573),a=o(6873),n=o(9650),i=o(9345),l=o(542),s=o(1286),d=TypeError,c=s("toPrimitive");e.exports=function(e,t){if(!a(e)||n(e))return e;var o,s=i(e,c);if(s){if(void 0===t&&(t="default"),o=r(s,e,t),!a(o)||n(o))return o;throw d("Can't convert object to primitive value")}return void 0===t&&(t="number"),l(e,t)}},29:(e,t,o)=>{var r=o(9984),a=o(9650);e.exports=function(e){var t=r(e,"string");return a(t)?t:t+""}},7406:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},5834:(e,t,o)=>{var r=o(547),a=0,n=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++a+n,36)}},8951:(e,t,o)=>{var r=o(6634);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8272:(e,t,o)=>{var r=o(414),a=o(2933);e.exports=r&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},1286:(e,t,o)=>{var r=o(5433),a=o(3062),n=o(3208),i=o(5834),l=o(6634),s=o(8951),d=a("wks"),c=r.Symbol,u=c&&c.for,p=s?c:c&&c.withoutSetter||i;e.exports=function(e){if(!n(d,e)||!l&&"string"!=typeof d[e]){var t="Symbol."+e;l&&n(c,e)?d[e]=c[e]:d[e]=s&&u?u(t):p(t)}return d[e]}},3647:(e,t,o)=>{"use strict";o(3647);var r=o(4429),a=o(5071).includes,n=o(2933),i=o(1342);r({target:"Array",proto:!0,forced:n((function(){return!Array(1).includes()}))},{includes:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),i("includes")},164:()=>{jQuery(document).on("wpmLoadPixels",(()=>{var e,t,o,r,a,n;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.pixel_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(a=r.pixels)&&void 0!==a&&null!==(n=a.facebook)&&void 0!==n&&n.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmClientSideAddToCart",((e,t)=>{try{var o,r,a;if(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.facebook)||void 0===a||!a.loaded)return;fbq("track","AddToCart",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideBeginCheckout",((e,t)=>{try{var o,r,a;if(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.facebook)||void 0===a||!a.loaded)return;fbq("track","InitiateCheckout",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideAddToWishlist",((e,t)=>{try{var o,r,a;if(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.facebook)||void 0===a||!a.loaded)return;fbq("track","AddToWishlist",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideViewItem",((e,t)=>{try{var o,r,a;if(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.facebook)||void 0===a||!a.loaded)return;fbq("track","ViewContent",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideSearch",((e,t)=>{try{var o,r,a;if(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.facebook)||void 0===a||!a.loaded)return;fbq("track","Search",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(()=>{try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideOrderReceivedPage",((e,t)=>{try{var o,r,a;if(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.facebook)||void 0===a||!a.loaded)return;fbq("track","Purchase",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}}))},7746:()=>{!function(e,t,o){let r;e.loadFacebookPixel=()=>{try{wpmDataLayer.pixels.facebook.loaded=!0,t=window,o=document,r="script",t.fbq||(a=t.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},t._fbq||(t._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],(n=o.createElement(r)).async=!0,n.src="https://connect.facebook.net/en_US/fbevents.js",(i=o.getElementsByTagName(r)[0]).parentNode.insertBefore(n,i));let l={};e.isFbpSet()&&(l={...e.getUserIdentifiersForFb()}),fbq("init",wpmDataLayer.pixels.facebook.pixel_id,l),fbq("track","PageView")}catch(r){console.error(r)}var t,o,r,a,n,i},e.getUserIdentifiersForFb=()=>{var e,t,o,r,a,n,i,l,s,d,c,u,p,m,g,w,y,v,f,_,h,L,b,D,k,x,C,j,S,I,O,P,E,Q,T,F,A,V,R,q,M,G,N,W;let U={};return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.user)&&void 0!==t&&t.id&&(U.external_id=wpmDataLayer.user.id),null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.order)&&void 0!==r&&r.user_id&&(U.external_id=wpmDataLayer.order.user_id),null!==(a=wpmDataLayer)&&void 0!==a&&null!==(n=a.user)&&void 0!==n&&null!==(i=n.facebook)&&void 0!==i&&i.email&&(U.em=wpmDataLayer.user.facebook.email),null!==(l=wpmDataLayer)&&void 0!==l&&null!==(s=l.order)&&void 0!==s&&s.billing_email_hashed&&(U.em=wpmDataLayer.order.billing_email_hashed),null!==(d=wpmDataLayer)&&void 0!==d&&null!==(c=d.user)&&void 0!==c&&null!==(u=c.facebook)&&void 0!==u&&u.first_name&&(U.fn=wpmDataLayer.user.facebook.first_name),null!==(p=wpmDataLayer)&&void 0!==p&&null!==(m=p.order)&&void 0!==m&&m.billing_first_name&&(U.fn=wpmDataLayer.order.billing_first_name.toLowerCase()),null!==(g=wpmDataLayer)&&void 0!==g&&null!==(w=g.user)&&void 0!==w&&null!==(y=w.facebook)&&void 0!==y&&y.last_name&&(U.ln=wpmDataLayer.user.facebook.last_name),null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&f.billing_last_name&&(U.ln=wpmDataLayer.order.billing_last_name.toLowerCase()),null!==(_=wpmDataLayer)&&void 0!==_&&null!==(h=_.user)&&void 0!==h&&null!==(L=h.facebook)&&void 0!==L&&L.phone&&(U.ph=wpmDataLayer.user.facebook.phone),null!==(b=wpmDataLayer)&&void 0!==b&&null!==(D=b.order)&&void 0!==D&&D.billing_phone&&(U.ph=wpmDataLayer.order.billing_phone.replace("+","")),null!==(k=wpmDataLayer)&&void 0!==k&&null!==(x=k.user)&&void 0!==x&&null!==(C=x.facebook)&&void 0!==C&&C.city&&(U.ct=wpmDataLayer.user.facebook.city),null!==(j=wpmDataLayer)&&void 0!==j&&null!==(S=j.order)&&void 0!==S&&S.billing_city&&(U.ct=wpmDataLayer.order.billing_city.toLowerCase().replace(/ /g,"")),null!==(I=wpmDataLayer)&&void 0!==I&&null!==(O=I.user)&&void 0!==O&&null!==(P=O.facebook)&&void 0!==P&&P.state&&(U.st=wpmDataLayer.user.facebook.state),null!==(E=wpmDataLayer)&&void 0!==E&&null!==(Q=E.order)&&void 0!==Q&&Q.billing_state&&(U.st=wpmDataLayer.order.billing_state.toLowerCase().replace(/[a-zA-Z]{2}-/,"")),null!==(T=wpmDataLayer)&&void 0!==T&&null!==(F=T.user)&&void 0!==F&&null!==(A=F.facebook)&&void 0!==A&&A.postcode&&(U.zp=wpmDataLayer.user.facebook.postcode),null!==(V=wpmDataLayer)&&void 0!==V&&null!==(R=V.order)&&void 0!==R&&R.billing_postcode&&(U.zp=wpmDataLayer.order.billing_postcode),null!==(q=wpmDataLayer)&&void 0!==q&&null!==(M=q.user)&&void 0!==M&&null!==(G=M.facebook)&&void 0!==G&&G.country&&(U.country=wpmDataLayer.user.facebook.country),null!==(N=wpmDataLayer)&&void 0!==N&&null!==(W=N.order)&&void 0!==W&&W.billing_country&&(U.country=wpmDataLayer.order.billing_country.toLowerCase()),U},e.getFbRandomEventId=()=>(Math.random()+1).toString(36).substring(2),e.getFbUserData=()=>(r={...r,...e.getFbUserDataFromBrowser()},r),e.setFbUserData=()=>{r=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=()=>{var t,o;let r={};return e.getCookie("_fbp")&&e.isValidFbp(e.getCookie("_fbp"))&&(r.fbp=e.getCookie("_fbp")),e.getCookie("_fbc")&&e.isValidFbc(e.getCookie("_fbc"))&&(r.fbc=e.getCookie("_fbc")),null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.user)&&void 0!==o&&o.id&&(r.external_id=wpmDataLayer.user.id),navigator.userAgent&&(r.client_user_agent=navigator.userAgent),r},e.isFbpSet=()=>!!e.getCookie("_fbp"),e.isValidFbp=e=>new RegExp(/^fb\.[0-2]\.\d{13}\.\d{8,20}$/).test(e),e.isValidFbc=e=>new RegExp(/^fb\.[0-2]\.\d{13}\.[\da-zA-Z_-]{8,}/).test(e),e.fbGetProductDataForCapiEvent=e=>({content_type:"product",content_name:e.name,content_ids:[e.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]],value:parseFloat(e.quantity*e.price),currency:e.currency}),e.facebookContentIds=()=>{let e=[];for(const[r,a]of Object.entries(wpmDataLayer.order.items)){var t,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==a.variation_id?e.push(String(wpmDataLayer.products[a.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[a.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e},e.trackCustomFacebookEvent=function(t){let r=arguments.length>1&&arguments[1]!==o?arguments[1]:{};try{var a,n,i;if(null===(a=wpmDataLayer)||void 0===a||null===(n=a.pixels)||void 0===n||null===(i=n.facebook)||void 0===i||!i.loaded)return;let o=e.getFbRandomEventId();fbq("trackCustom",t,r,{eventID:o}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:t,event_id:o,user_data:e.getFbUserData(),event_source_url:window.location.href,custom_data:r})}catch(e){console.error(e)}},e.fbGetContentIdsFromCart=()=>{let e=[];for(const t in wpmDataLayer.cart)e.push(wpmDataLayer.products[t].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]);return e}}(window.wpm=window.wpm||{},jQuery)},5012:(e,t,o)=>{o(7746),o(164)},165:()=>{jQuery(document).on("wpmViewItemList",(function(e,t){try{var o,r,a,n,i,l,s,d,c,u,p,m,g;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.google)||void 0===a||null===(n=a.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(l=i.pixels)||void 0===l||null===(s=l.google)||void 0===s||null===(d=s.ads)||void 0===d||null===(c=d.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;let e={send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]};null!==(m=wpmDataLayer)&&void 0!==m&&null!==(g=m.user)&&void 0!==g&&g.id&&(e.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","view_item_list",e)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,r,a,n,i,l,s,d,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.google)||void 0===a||null===(n=a.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(l=i.pixels)||void 0===l||null===(s=l.google)||void 0===s||null===(d=s.ads)||void 0===d||null===(c=d.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let e={send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]};null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.user)&&void 0!==p&&p.id&&(e.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",e)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{var o,r,a,n,i,l,s,d,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.google)||void 0===a||null===(n=a.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(l=i.pixels)||void 0===l||null===(s=l.google)||void 0===s||null===(d=s.ads)||void 0===d||null===(c=d.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let e={send_to:wpm.getGoogleAdsConversionIdentifiers()};t&&(e.value=(t.quantity?t.quantity:1)*t.price,e.items=[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]),null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.user)&&void 0!==p&&p.id&&(e.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","view_item",e)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o,r,a,n,i,l,s,d,c;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(r=o.ads)||void 0===r?void 0:r.conversionIds))return;if(null===(a=wpmDataLayer)||void 0===a||null===(n=a.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(l=i.ads)||void 0===l||null===(s=l.dynamic_remarketing)||void 0===s||!s.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let m=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var u,p;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;m.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}let g={send_to:wpm.getGoogleAdsConversionIdentifiers(),items:m};null!==(d=wpmDataLayer)&&void 0!==d&&null!==(c=d.user)&&void 0!==c&&c.id&&(g.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","view_search_results",g)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,r,a,n,i,l,s,d,c;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(r=o.ads)||void 0===r?void 0:r.conversionIds))return;if(null===(a=wpmDataLayer)||void 0===a||null===(n=a.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(l=i.ads)||void 0===l||null===(s=l.dynamic_remarketing)||void 0===s||!s.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u={send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()};null!==(d=wpmDataLayer)&&void 0!==d&&null!==(c=d.user)&&void 0!==c&&c.id&&(u.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","purchase",u)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,o,r,a,n,i,l,s,d,c;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(r=o.ads)||void 0===r?void 0:r.conversionIds))return;if(null===(a=wpmDataLayer)||void 0===a||null===(n=a.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(l=i.ads)||void 0===l||null===(s=l.dynamic_remarketing)||void 0===s||!s.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u={send_to:wpm.getGoogleAdsConversionIdentifiers()};null!==(d=wpmDataLayer)&&void 0!==d&&null!==(c=d.user)&&void 0!==c&&c.id&&(u.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","login",u)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,r,a,n;if(jQuery.isEmptyObject(wpm.getGoogleAdsConversionIdentifiersWithLabel()))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},l={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.order)&&void 0!==t&&t.clv_order_value_filtered&&(i.customer_lifetime_value=wpmDataLayer.order.clv_order_value_filtered),null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.user)&&void 0!==r&&r.id&&(i.user_id=wpmDataLayer.user.id),null!==(a=wpmDataLayer)&&void 0!==a&&null!==(n=a.order)&&void 0!==n&&n.aw_merchant_id&&(l={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...l})}))}catch(e){console.error(e)}}))},9042:()=>{!function(e,t,o){e.getGoogleAdsConversionIdentifiersWithLabel=function(){var e,t,o,r;let a=[];if(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(r=o.ads)&&void 0!==r&&r.conversionIds)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))t&&a.push(e+"/"+t);return a},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,o]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[r,a]of Object.entries(wpmDataLayer.order.items)){var t,o;let r;r={quantity:a.quantity,price:a.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==a.variation_id?(r.id=String(wpmDataLayer.products[a.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(r)):(r.id=String(wpmDataLayer.products[a.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(r))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[r,a]of Object.entries(wpmDataLayer.order.items)){var t,o;let r;r={quantity:a.quantity,price:a.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==a.variation_id?(r.id=String(wpmDataLayer.products[a.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(r)):(r.id=String(wpmDataLayer.products[a.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(r))}return e}}(window.wpm=window.wpm||{},jQuery)},5190:(e,t,o)=>{o(9042),o(165)},3625:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,r,a,n,i,l,s,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(r=o.analytics)||void 0===r||null===(a=r.universal)||void 0===a||!a.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(l=i.google)&&void 0!==l&&null!==(s=l.analytics)&&void 0!==s&&null!==(d=s.universal)&&void 0!==d&&d.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},6019:()=>{!function(e,t,o){e.getGAUAOrderItems=function(){let t=[];for(const[a,n]of Object.entries(wpmDataLayer.order.items)){var o,r;let a;a={quantity:n.quantity,price:n.price,name:n.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[n.id].category.join("/")},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.general)&&void 0!==r&&r.variationsOutput&&0!==n.variation_id?(a.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.variant=wpmDataLayer.products[n.variation_id].variant_name,a.brand=wpmDataLayer.products[n.variation_id].brand):(a.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.brand=wpmDataLayer.products[n.id].brand),a=e.ga3AddListNameToProduct(a),t.push(a)}return t},e.ga3AddListNameToProduct=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null;return e.list_name=wpmDataLayer.shop.list_name,t&&(e.list_position=t),e}}(window.wpm=window.wpm||{},jQuery)},562:(e,t,o)=>{o(6019),o(3625)},7572:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,r,a,n,i,l,s,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(r=o.analytics)||void 0===r||null===(a=r.ga4)||void 0===a||!a.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(l=i.google)&&void 0!==l&&null!==(s=l.analytics)&&void 0!==s&&null!==(d=s.ga4)&&void 0!==d&&d.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},6228:()=>{!function(e,t,o){e.getGA4OrderItems=function(){let e=[];for(const[r,a]of Object.entries(wpmDataLayer.order.items)){var t,o;let r;r={quantity:a.quantity,price:a.price,item_name:a.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[a.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==a.variation_id?(r.item_id=String(wpmDataLayer.products[a.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.item_variant=wpmDataLayer.products[a.variation_id].variant_name,r.item_brand=wpmDataLayer.products[a.variation_id].brand):(r.item_id=String(wpmDataLayer.products[a.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.item_brand=wpmDataLayer.products[a.id].brand),e.push(r)}return e}}(window.wpm=window.wpm||{},jQuery)},8522:(e,t,o)=>{o(6228),o(7572)},6774:(e,t,o)=>{o(562),o(8522)},9294:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o?void 0:o.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},9860:(e,t,o)=>{"use strict";o.r(t),o(3647),function(e,t,o){e.googleConfigConditionsMet=function(t){var o,r,a,n;return!(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.google)||void 0===a||null===(n=a.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==o)||arguments[0],t=!(arguments.length>1&&arguments[1]!==o)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,o,r,a,n,i,l,s,d,c,u,p,m,g,w,y,v,f,_,h,L,b;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(r=o.ads)&&void 0!==r&&null!==(a=r.enhanced_conversions)&&void 0!==a&&a.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(l=i.google)&&void 0!==l&&null!==(s=l.ads)&&void 0!==s&&s.conversionIds&&null!==(d=wpmDataLayer)&&void 0!==d&&null!==(c=d.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(m=wpmDataLayer)&&void 0!==m&&null!==(g=m.pixels)&&void 0!==g&&null!==(w=g.google)&&void 0!==w&&null!==(y=w.ads)&&void 0!==y&&y.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.shop)&&void 0!==f&&f.page_type&&"order_received_page"===wpmDataLayer.shop.page_type&&null!==(_=wpmDataLayer)&&void 0!==_&&null!==(h=_.order)&&void 0!==h&&null!==(L=h.google)&&void 0!==L&&null!==(b=L.ads)&&void 0!==b&&b.enhanced_conversion_data&>ag("set","user_data",wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{var e,t,o,r,a;wpmDataLayer.pixels.google.analytics.ga4.state="loading";let n=wpmDataLayer.pixels.google.analytics.ga4.parameters;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(r=o.analytics)&&void 0!==r&&null!==(a=r.ga4)&&void 0!==a&&a.debug_mode&&(n.debug_mode=!0),gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,n),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,o,r,a,n,i,l,s,d,c,u,p,m;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(r=o.analytics)&&void 0!==r&&null!==(a=r.universal)&&void 0!==a&&a.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(l=i.google)&&void 0!==l&&null!==(s=l.analytics)&&void 0!==s&&null!==(d=s.ga4)&&void 0!==d&&d.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(m=p.ads)||void 0===m?void 0:m.conversionIds))},e.getGoogleGtagId=function(){var e,t,o,r,a,n,i,l,s,d;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(r=o.analytics)&&void 0!==r&&null!==(a=r.universal)&&void 0!==a&&a.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(l=i.google)&&void 0!==l&&null!==(s=l.analytics)&&void 0!==s&&null!==(d=s.ga4)&&void 0!==d&&d.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).then((function(t,o){try{var r,a,n,i,l,s,d,c,u,p,m,g,w,y,v,f,_,h,L,b,D,k;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(a=r.pixels)&&void 0!==a&&null!==(n=a.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var x,C,j,S;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(x=wpmDataLayer)&&void 0!==x&&null!==(C=x.pixels)&&void 0!==C&&null!==(j=C.google)&&void 0!==j&&null!==(S=j.consent_mode)&&void 0!==S&&S.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(l=wpmDataLayer)&&void 0!==l&&null!==(s=l.pixels)&&void 0!==s&&null!==(d=s.google)&&void 0!==d&&null!==(c=d.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(m=p.google)||void 0===m||null===(g=m.ads)||void 0===g?void 0:g.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(w=wpmDataLayer)&&void 0!==w&&null!==(y=w.pixels)&&void 0!==y&&null!==(v=y.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(b=L.google)&&void 0!==b&&null!==(D=b.analytics)&&void 0!==D&&null!==(k=D.ga4)&&void 0!==k&&k.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,o,r,a;return!(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(a=r.consent_mode)||void 0===a||!a.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var o,r,a;void 0===(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.google)||void 0===a?void 0:a.state)&&t();let n=0;!function o(){var r,a,i;return"ready"===(null===(r=wpmDataLayer)||void 0===r||null===(a=r.pixels)||void 0===a||null===(i=a.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(o,200))}()}))}}(window.wpm=window.wpm||{},jQuery)},1580:(e,t,o)=>{o(9860),o(9294)},8069:(e,t,o)=>{o(1580),o(5190),o(6774),o(3463)},1945:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,r,a,n,i,l;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(r=o.optimize)||void 0===r||!r.container_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(n=a.pixels)&&void 0!==n&&null!==(i=n.google)&&void 0!==i&&null!==(l=i.optimize)&&void 0!==l&&l.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},8962:()=>{!function(e,t,o){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery)},3463:(e,t,o)=>{o(8962),o(1945)},2300:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,r,a,n,i,l,s;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.hotjar)||void 0===o||!o.site_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(a=r.pixels)&&void 0!==a&&null!==(n=a.hotjar)&&void 0!==n&&n.loaded||!wpm.canIFire("analytics","hotjar")||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(l=i.pixels)&&void 0!==l&&null!==(s=l.hotjar)&&void 0!==s&&s.loaded||wpm.load_hotjar_pixel()}))},2376:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},o=t.getElementsByTagName("head")[0],(r=t.createElement("script")).async=1,r.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,o.appendChild(r)}catch(e){console.error(e)}var e,t,o,r}}(window.wpm=window.wpm||{},jQuery)},8787:(e,t,o)=>{o(2376),o(2300)},473:(e,t,o)=>{"use strict";o.r(t),o(3647),function(e,t,o){let r=()=>{let t=e.getCookie("cmplz_statistics"),o=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===o,visitorHasChosen:!0}},a=()=>{let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),o=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-performance")||e.getCookie("cookielawinfo-checkbox-publicite"),r=e.getCookie("CookieLawInfoConsent");return!(!t&&!o)&&{analytics:"yes"===t,ads:"yes"===o,visitorHasChosen:!!r}},n={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=()=>n,e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==o&&arguments[0],t=arguments.length>1&&arguments[1]!==o&&arguments[1];n.categories.analytics=e,n.categories.ads=t},e.updateConsentCookieValues=function(){let t,i=arguments.length>0&&arguments[0]!==o?arguments[0]:null,l=arguments.length>1&&arguments[1]!==o?arguments[1]:null,s=arguments.length>2&&arguments[2]!==o&&arguments[2];if(i||l)i&&(n.categories.analytics=!!i),l&&(n.categories.ads=!!l);else if(t=e.getCookie("CookieConsent"))t=decodeURI(t),n.categories.analytics=t.indexOf("statistics:true")>=0,n.categories.ads=t.indexOf("marketing:true")>=0,n.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(n.categories.analytics=!1,n.categories.ads=!1):2===t.categories.length?(n.categories.analytics=!0,n.categories.ads=!0):(n.categories.analytics=t.categories.indexOf("performance")>=0,n.categories.ads=t.categories.indexOf("targeting")>=0),n.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var d,c,u,p,m,g,w,y;t=decodeURI(t),t=JSON.parse(t),n.categories.analytics=!(null===(d=t)||void 0===d||null===(c=d.consents)||void 0===c||!c.statistics),n.categories.ads=!(null===(u=t)||void 0===u||null===(p=u.consents)||void 0===p||!p.marketing),n.visitorHasChosen=!0,n.pixels=[...(null===(m=t)||void 0===m||null===(g=m.consents)||void 0===g?void 0:g.statistics)||[],...(null===(w=t)||void 0===w||null===(y=w.consents)||void 0===y?void 0:y.marketing)||[]],n.mode="pixel"}else(t=r())?(n.categories.analytics=!0===t.analytics,n.categories.ads=!0===t.ads,n.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(n.categories.analytics=!0,n.categories.ads=!0,n.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),n.categories.analytics=!!t.categories[3],n.categories.ads=!!t.categories[4],n.visitorHasChosen=!0):(t=a())?(n.categories.analytics=!0===t.analytics,n.categories.ads=!0===t.ads,n.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),n.categories.analytics="1"===t.thirdparty,n.categories.ads="1"===t.advanced,n.visitorHasChosen=!0):(n.categories.analytics=!s,n.categories.ads=!s)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=()=>{n.categories={analytics:!1,ads:!1}},e.canIFire=(t,o)=>{let r;return"category"===n.mode?r=!!n.categories[t]:"pixel"===n.mode?(r=n.pixels.includes(o),!1===r&&"microsoft-ads"===o&&(r=n.pixels.includes("bing-ads"))):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),r=!1),!!r||(e.logPreventedPixelLoading(o,t),!1)},e.logPreventedPixelLoading=(e,t)=>{var o,r,a;null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.shop)&&void 0!==r&&null!==(a=r.cookie_consent_mgmt)&&void 0!==a&&a.explicit_consent?console.log('Pixel Manager for WooCommerce: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('Pixel Manager for WooCommerce: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((o=>{o.forEach((o=>{let{addedNodes:r}=o;[...r].forEach((o=>{t(o).data("wpm-cookie-category")&&(e.shouldScriptBeActive(o)?e.unblockScript(o):e.blockScript(o))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),document.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=e=>{var o,r,a,i;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||n.visitorHasChosen)&&("category"!==n.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>n.categories[e])))&&("pixel"!==n.mode||!n.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==n.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>n.pixels.includes(e))))&&(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(a=r.google)||void 0===a||null===(i=a.consent_mode)||void 0===i||!i.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let r=arguments.length>1&&arguments[1]!==o&&arguments[1];r&&t(e).remove();let a=t(e).data("wpm-src");a&&t(e).attr("src",a),e.type="text/javascript",r&&t(e).appendTo("head"),document.dispatchEvent(new Event("wpmPreLoadPixels"))},e.blockScript=function(e){let r=arguments.length>1&&arguments[1]!==o&&arguments[1];r&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",r&&t(e).appendTo("head")},e.unblockAllScripts=function(){document.dispatchEvent(new Event("wpmPreLoadPixels"))},e.unblockSelectedPixels=()=>{document.dispatchEvent(new Event("wpmPreLoadPixels"))},document.addEventListener("borlabs-cookie-consent-saved",(()=>{e.updateConsentCookieValues(),"pixel"===n.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(n.pixels.includes("google-analytics"),n.pixels.includes("google-ads"))):(e.unblockAllScripts(n.categories.analytics,n.categories.ads),e.updateGoogleConsentMode(n.categories.analytics,n.categories.ads))})),document.addEventListener("CookiebotOnAccept",(()=>{Cookiebot.consent.statistics&&(n.categories.analytics=!0),Cookiebot.consent.marketing&&(n.categories.ads=!0),e.unblockAllScripts(n.categories.analytics,n.categories.ads),e.updateGoogleConsentMode(n.categories.analytics,n.categories.ads)}),!1),document.addEventListener("CookieScriptAccept",(t=>{t.detail.categories.includes("performance")&&(n.categories.analytics=!0),t.detail.categories.includes("targeting")&&(n.categories.ads=!0),e.unblockAllScripts(n.categories.analytics,n.categories.ads),e.updateGoogleConsentMode(n.categories.analytics,n.categories.ads)})),document.addEventListener("CookieScriptAcceptAll",(()=>{e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),e.cmplzStatusChange=t=>{t.detail.categories.includes("statistics")&&e.updateConsentCookieValues(!0,null),t.detail.categories.includes("marketing")&&e.updateConsentCookieValues(null,!0),e.unblockAllScripts(n.categories.analytics,n.categories.ads),e.updateGoogleConsentMode(n.categories.analytics,n.categories.ads)},document.addEventListener("cmplzStatusChange",e.cmplzStatusChange),document.addEventListener("cmplz_status_change",e.cmplzStatusChange),document.addEventListener("setCookieNotice",(()=>{e.updateConsentCookieValues(),e.unblockAllScripts(n.categories.analytics,n.categories.ads),e.updateGoogleConsentMode(n.categories.analytics,n.categories.ads)})),e.huObserver=new MutationObserver((t=>{t.forEach((t=>{let{addedNodes:o}=t;[...o].forEach((t=>{"hu"===t.id&&document.querySelector(".hu-cookies-save").addEventListener("click",(()=>{e.updateConsentCookieValues(),e.unblockAllScripts(n.categories.analytics,n.categories.ads),e.updateGoogleConsentMode(n.categories.analytics,n.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.explicitConsentStateAlreadySet=()=>{if(n.explicitConsentStateAlreadySet)return!0;n.explicitConsentStateAlreadySet=!0}}(window.wpm=window.wpm||{},jQuery)},3299:(e,t,o)=>{"use strict";o.r(t),o(3647),jQuery(document).on("click",".remove_from_cart_button, .remove",(e=>{try{let t=new URL(jQuery(e.currentTarget).attr("href")),o=wpm.getProductIdByCartItemKeyUrl(t);wpm.removeProductFromCart(o)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(e=>{try{let t,o=1;"product"===wpmDataLayer.shop.page_type?(void 0!==jQuery(e.currentTarget).attr("href")&&jQuery(e.currentTarget).attr("href").includes("add-to-cart")&&(t=jQuery(e.currentTarget).data("product_id"),wpm.addProductToCart(t,o)),"simple"===wpmDataLayer.shop.product_type&&(o=Number(jQuery(".input-text.qty").val()),o||0===o||(o=1),t=jQuery(e.currentTarget).val(),wpm.addProductToCart(t,o)),["variable","variable-subscription"].indexOf(wpmDataLayer.shop.product_type)>=0&&(o=Number(jQuery(".input-text.qty").val()),o||0===o||(o=1),t=jQuery("[name='variation_id']").val(),wpm.addProductToCart(t,o)),"grouped"===wpmDataLayer.shop.product_type&&jQuery(".woocommerce-grouped-product-list-item").each(((e,r)=>{o=Number(jQuery(r).find(".input-text.qty").val()),o||0===o||(o=1);let a=jQuery(r).attr("class");t=wpm.getPostIdFromString(a),wpm.addProductToCart(t,o)})),"bundle"===wpmDataLayer.shop.product_type&&(o=Number(jQuery(".input-text.qty").val()),o||0===o||(o=1),t=jQuery("input[name=add-to-cart]").val(),wpm.addProductToCart(t,o))):(t=jQuery(e.currentTarget).data("product_id"),wpm.addProductToCart(t,o))}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(e=>{try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(e=>{try{let t=jQuery(e.currentTarget).nextAll(".wpmProductId:first").data("id");if(t){if(t=wpm.getIdBasedOndVariationsOutputSetting(t),!t)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[t]){let e=wpm.getProductDetailsFormattedForEvent(t);jQuery(document).trigger("wpmSelectContentGaUa",e),jQuery(document).trigger("wpmSelectItem",e)}}}catch(e){console.error(e)}})),jQuery(document).one("click init_checkout",[".checkout-button",".cart-checkout-button",".button.checkout",".xoo-wsc-ft-btn-checkout",".elementor-button--checkout"].join(","),(()=>{jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(e=>{wpm.isEmail(jQuery(e.currentTarget).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("wpmLoad",(e=>{jQuery(document).on("payment_method_selected",(()=>{!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0}))})),jQuery((()=>{jQuery("form.checkout").on("checkout_place_order_success",(()=>{!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)}))})),jQuery(document).on("click","[name='update_cart']",(e=>{try{jQuery(".cart_item").each(((e,t)=>{let o=new URL(jQuery(t).find(".product-remove").find("a").attr("href")),r=wpm.getProductIdByCartItemKeyUrl(o),a=jQuery(t).find(".qty").val();0===a?wpm.removeProductFromCart(r):a<wpmDataLayer.cart[r].quantity?wpm.removeProductFromCart(r,wpmDataLayer.cart[r].quantity-a):a>wpmDataLayer.cart[r].quantity&&wpm.addProductToCart(r,a-wpmDataLayer.cart[r].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery((function(){jQuery(".add_to_wishlist,.wl-add-to").on("click",(e=>{try{let t;if(jQuery(e.currentTarget).data("productid")?t=jQuery(e.currentTarget).data("productid"):jQuery(e.currentTarget).data("product-id")&&(t=jQuery(e.currentTarget).data("product-id")),!t)throw Error("Wasn't able to retrieve a productId");let o=wpm.getProductDetailsFormattedForEvent(t);jQuery(document).trigger("wpmAddToWishlist",o)}catch(e){console.error(e)}}))})),jQuery(document).on("updated_cart_totals",(()=>{jQuery(document).trigger("wpmViewCart")})),jQuery((()=>{jQuery(".single_variation_wrap").on("show_variation",((e,t)=>{try{let e=wpm.getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");wpm.triggerViewItemEventPrep(e)}catch(e){console.error(e)}}))})),jQuery(document).on("wpmLoad",(()=>{try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(document).on("wpmLoad",(()=>{wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(document).on("wpmLoad",(()=>{if(!wpm.getCookie("wpmReferrer")&&document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host&&wpm.setCookie("wpmReferrer",e)}})),jQuery(document).on("wpmLoad",(()=>{try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,o,r;if(jQuery(document).trigger("wpmLoadAlways"),null!==(t=wpmDataLayer)&&void 0!==t&&t.shop)if("product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id),"function"==typeof wpm.acrRemoveCookie&&wpm.acrRemoveCookie()):jQuery(document).trigger("wpmEverywhereElse");else jQuery(document).trigger("wpmEverywhereElse");null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.user)&&void 0!==r&&r.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(document).on("wpmLoad",(async()=>{window.sessionStorage&&window.sessionStorage.getItem("_pmw_endpoint_available")&&!JSON.parse(window.sessionStorage.getItem("_pmw_endpoint_available"))&&console.error("Pixel Manager for WooCommerce: REST endpoint is not available. Using admin-ajax.php instead.")})),jQuery(document).on("wpmPreLoadPixels",(()=>{var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(o=t.cookie_consent_mgmt)&&void 0!==o&&o.explicit_consent&&!wpm.explicitConsentStateAlreadySet()&&wpm.updateConsentCookieValues(null,null,!0),jQuery(document).trigger("wpmLoadPixels",{})})),jQuery(document).on("wpmAddToCart",((e,t)=>{var o,r,a;let n={event:"addToCart",product:t};null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(a=r.facebook)&&void 0!==a&&a.loaded&&(n.facebook={event_name:"AddToCart",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:wpm.fbGetProductDataForCapiEvent(t)}),jQuery(document).trigger("wpmClientSideAddToCart",n),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(n)})),jQuery(document).on("wpmBeginCheckout",(()=>{var e,t,o;let r={event:"beginCheckout"};var a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.facebook)&&void 0!==o&&o.loaded&&(r.facebook={event_name:"InitiateCheckout",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{}},null!==(a=wpmDataLayer)&&void 0!==a&&a.cart&&!jQuery.isEmptyObject(wpmDataLayer.cart)&&(r.facebook.custom_data={content_type:"product",content_ids:wpm.fbGetContentIdsFromCart(),value:wpm.getCartValue(),currency:wpmDataLayer.shop.currency})),jQuery(document).trigger("wpmClientSideBeginCheckout",r),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(r)})),jQuery(document).on("wpmAddToWishlist",((e,t)=>{var o,r,a;let n={event:"addToWishlist",product:t};null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(a=r.facebook)&&void 0!==a&&a.loaded&&(n.facebook={event_name:"AddToWishlist",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:wpm.fbGetProductDataForCapiEvent(t)}),jQuery(document).trigger("wpmClientSideAddToWishlist",n),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(n)})),jQuery(document).on("wpmViewItem",(function(e){var t,o,r;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n={event:"viewItem",product:a};null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.pixels)&&void 0!==o&&null!==(r=o.facebook)&&void 0!==r&&r.loaded&&(n.facebook={event_name:"ViewContent",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{}},a&&(n.facebook.custom_data=wpm.fbGetProductDataForCapiEvent(a))),jQuery(document).trigger("wpmClientSideViewItem",n),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(n)})),jQuery(document).on("wpmSearch",(()=>{var e,t,o;let r={event:"search"};null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.facebook)&&void 0!==o&&o.loaded&&(r.facebook={event_name:"Search",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{search_string:wpm.getSearchTermFromUrl()}}),jQuery(document).trigger("wpmClientSideSearch",r),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(r)})),jQuery(document).on("wpmOrderReceivedPage",(()=>{var e,t,o;let r={event:"orderReceived"};null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.facebook)&&void 0!==o&&o.loaded&&(r.facebook={event_name:"Purchase",event_id:wpmDataLayer.order.id,user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()}}),jQuery(document).trigger("wpmClientSideOrderReceivedPage",r)}))},9584:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__);var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3647);(function(wpm,$,undefined){const wpmDeduper={keyName:"_wpm_order_ids",cookieExpiresDays:365},wpmRestSettings={cookiePmwRestEndpointAvailable:"_pmw_endpoint_available",restEndpointPost:"pmw/v1/test/",restFails:0,restFailsThreshold:10};function checkCookie(){return""!==wpm.getCookie(wpmDeduper.keyName)}wpm.emailSelected=!1,wpm.paymentMethodSelected=!1,wpm.useRestEndpoint=()=>wpm.isSessionStorageAvailable()&&wpm.isRestEndpointAvailable()&&wpm.isBelowRestErrorThreshold(),wpm.isBelowRestErrorThreshold=()=>window.sessionStorage.getItem(wpmRestSettings.restFails)<=wpmRestSettings.restFailsThreshold,wpm.isRestEndpointAvailable=async()=>window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable)?JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable)):await wpm.testEndpoint(),wpm.isSessionStorageAvailable=()=>!!window.sessionStorage,wpm.testEndpoint=async function(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:wpm.root+wpmRestSettings.restEndpointPost,t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:wpmRestSettings.cookiePmwRestEndpointAvailable,o=await fetch(e,{method:"POST",mode:"cors",cache:"no-cache",keepalive:!0});return 200===o.status?(window.sessionStorage.setItem(t,JSON.stringify(!0)),!0):404===o.status||0===o.status?(window.sessionStorage.setItem(t,JSON.stringify(!1)),!1):void 0},wpm.isWpmRestEndpointAvailable=function(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:wpmRestSettings.cookiePmwRestEndpointAvailable;return!!wpm.getCookie(e)},wpm.writeOrderIdToStorage=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"thankyou_page";if(window.Storage)if(null===localStorage.getItem(wpmDeduper.keyName)){let t=[];t.push(e),window.localStorage.setItem(wpmDeduper.keyName,JSON.stringify(t))}else{let t=JSON.parse(localStorage.getItem(wpmDeduper.keyName));t.includes(e)||(t.push(e),window.localStorage.setItem(wpmDeduper.keyName,JSON.stringify(t)))}else{let t=new Date;t.setDate(t.getDate()+wpmDeduper.cookieExpiresDays);let o=[];checkCookie()&&(o=JSON.parse(wpm.getCookie(wpmDeduper.keyName))),o.includes(e)||(o.push(e),document.cookie=wpmDeduper.keyName+"="+JSON.stringify(o)+";expires="+t.toUTCString())}"function"==typeof wpm.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&wpm.storeOrderIdOnServer(e,t)},wpm.isOrderIdStored=e=>wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(wpmDeduper.keyName)&&JSON.parse(localStorage.getItem(wpmDeduper.keyName)).includes(e):!!checkCookie()&&JSON.parse(wpm.getCookie(wpmDeduper.keyName)).includes(e):(console.log("order duplication prevention: off"),!1),wpm.isEmail=e=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e),wpm.removeProductFromCart=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;try{if(!e)throw Error("Wasn't able to retrieve a productId");if(!(e=wpm.getIdBasedOndVariationsOutputSetting(e)))throw Error("Wasn't able to retrieve a productId");let o;if(o=null==t?wpmDataLayer.cart[e].quantity:t,wpmDataLayer.cart[e]){let r=wpm.getProductDetailsFormattedForEvent(e,o);jQuery(document).trigger("wpmRemoveFromCart",r),null==t||wpmDataLayer.cart[e].quantity===t?(delete wpmDataLayer.cart[e],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[e].quantity=wpmDataLayer.cart[e].quantity-o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},wpm.getIdBasedOndVariationsOutputSetting=e=>{try{var t,o;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},wpm.addProductToCart=(e,t)=>{try{var o;if(!e)throw Error("Wasn't able to retrieve a productId");if(!(e=wpm.getIdBasedOndVariationsOutputSetting(e)))throw Error("Wasn't able to retrieve a productId");if(null!==(o=wpmDataLayer)&&void 0!==o&&o.products[e]){var r;let o=wpm.getProductDetailsFormattedForEvent(e,t);jQuery(document).trigger("wpmAddToCart",o),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[e]?wpmDataLayer.cart[e].quantity=wpmDataLayer.cart[e].quantity+t:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[e]=wpm.getProductDetailsFormattedForEvent(e,t)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(e){console.error(e),wpm.getCartItemsFromBackend()}},wpm.getCartItems=()=>{sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?wpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):wpm.getCartItemsFromBackend()},wpm.getCartItemsFromBackend=()=>{try{fetch(wpm.ajax_url,{method:"POST",cache:"no-cache",body:new URLSearchParams({action:"pmw_get_cart_items"}),keepalive:!0}).then((e=>{if(e.ok)return e.json();throw Error("Error getting cart items from backend")})).then((e=>{if(!e.success)throw Error("Error getting cart items from backend");e.data.cart||(e.data.cart={}),wpm.saveCartObjectToDataLayer(e.data.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(e.data.cart))}))}catch(e){console.error(e)}},wpm.getProductsFromBackend=async e=>{var t;if(null!==(t=wpmDataLayer)&&void 0!==t&&t.products&&(e=e.filter((e=>!wpmDataLayer.products.hasOwnProperty(e)))),e&&0!==e.length){try{let t;if(t=await wpm.isRestEndpointAvailable()?await fetch(wpm.root+"pmw/v1/products/",{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}):await fetch(wpm.ajax_url,{method:"POST",cache:"no-cache",body:new URLSearchParams({action:"pmw_get_product_ids",productIds:e})}),t.ok){let e=await t.json();e.success&&(wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e.data))}else console.error("Error getting products from backend")}catch(e){console.error(e)}return!0}},wpm.saveCartObjectToDataLayer=e=>{wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},wpm.triggerViewItemEventPrep=async e=>{wpmDataLayer.products&&wpmDataLayer.products[e]||await wpm.getProductsFromBackend([e]),wpm.triggerViewItemEvent(e)},wpm.triggerViewItemEvent=e=>{let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)},wpm.triggerViewItemEventNoProduct=()=>{jQuery(document).trigger("wpmViewItem")},wpm.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null,o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null,r={step:e,checkout_option:t,value:o};jQuery(document).trigger("wpmFireCheckoutOption",r)},wpm.fireCheckoutProgress=e=>{let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},wpm.getPostIdFromString=e=>{try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},wpm.triggerViewItemList=e=>{if(!e)throw Error("Wasn't able to retrieve a productId");if(!(e=wpm.getIdBasedOndVariationsOutputSetting(e)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",wpm.getProductDataForViewItemEvent(e))},wpm.getProductDataForViewItemEvent=e=>{if(!e)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[e])return wpm.getProductDetailsFormattedForEvent(e)}catch(e){console.error(e)}},wpm.getMainProductIdFromProductPage=()=>{try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},wpm.viewItemListTriggerTestMode=e=>{jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},wpm.getSearchTermFromUrl=()=>{try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let ioTimeouts={},io;wpm.observerCallback=(e,t)=>{e.forEach((e=>{try{let o,r=jQuery(e.target).data("ioid");if(o=jQuery(e.target).next(".wpmProductId").length?jQuery(e.target).next(".wpmProductId").data("id"):jQuery(e.target).find(".wpmProductId").data("id"),!o)throw Error("wpmProductId element not found");e.isIntersecting?ioTimeouts[r]=setTimeout((()=>{wpm.triggerViewItemList(o),wpmDataLayer.viewItemListTrigger.testMode&&wpm.viewItemListTriggerTestMode(e.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&t.unobserve(e.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(ioTimeouts[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(e.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let ioid=0,allIoElementsToWatch,getAllElementsToWatch=()=>{allIoElementsToWatch=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0}))};wpm.startIntersectionObserverToWatch=()=>{try{wpm.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),io=new IntersectionObserver(wpm.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),getAllElementsToWatch(),allIoElementsToWatch.each(((e,t)=>{jQuery(t[0]).data("ioid",ioid++),io.observe(t[0])}))}catch(e){console.error(e)}},wpm.startProductsMutationObserverToWatch=()=>{try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&productsMutationObserver.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let productsMutationObserver=new MutationObserver((e=>{e.forEach((e=>{let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&hasWpmProductIdElement(this)&&(jQuery(this).data("ioid",ioid++),io.observe(this))}))}))})),hasWpmProductIdElement=e=>!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length);wpm.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"",o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;if(o){let r=new Date;r.setTime(r.getTime()+24*o*60*60*1e3);let a="expires="+r.toUTCString();document.cookie=e+"="+t+";"+a+";path=/"}else document.cookie=e+"="+t+";path=/"},wpm.getCookie=e=>{let t=e+"=",o=decodeURIComponent(document.cookie).split(";");for(let e=0;e<o.length;e++){let r=o[e];for(;" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf(t))return r.substring(t.length,r.length)}return""},wpm.deleteCookie=e=>{wpm.setCookie(e,"",-1)},wpm.getWpmSessionData=()=>{if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},wpm.setWpmSessionData=e=>{window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},wpm.storeOrderIdOnServer=async(e,t)=>{try{let o;o=await wpm.isRestEndpointAvailable()?await fetch(wpm.root+"pmw/v1/pixels-fired/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({order_id:e,source:t}),keepalive:!0,cache:"no-cache"}):await fetch(wpm.ajax_url,{method:"POST",body:new URLSearchParams({action:"pmw_purchase_pixels_fired",order_id:e,source:t}),keepalive:!0}),o.ok?console.log("wpm.storeOrderIdOnServer success"):console.error("wpm.storeOrderIdOnServer error")}catch(e){console.error(e)}},wpm.getProductIdByCartItemKeyUrl=e=>{let t,o=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[o].variation_id?wpmDataLayer.cartItemKeys[o].product_id:wpmDataLayer.cartItemKeys[o].variation_id,t},wpm.getAddToCartLinkProductIds=()=>jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get(),wpm.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1,o={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return o.isVariation&&(o.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),o},wpm.setReferrerToCookie=()=>{wpm.getCookie("wpmReferrer")||wpm.setCookie("wpmReferrer",document.referrer)},wpm.getReferrerFromCookie=()=>wpm.getCookie("wpmReferrer")?wpm.getCookie("wpmReferrer"):null,wpm.getClidFromBrowser=function(){let e,t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"gclid";return e={gclid:"_gcl_aw",dclid:"_gcl_dc"},wpm.getCookie(e[t])?wpm.getCookie(e[t]).match(/(GCL.[\d]*.)(.*)/)[2]:""},wpm.getUserAgent=()=>navigator.userAgent,wpm.getViewPort=()=>({width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}),wpm.version=()=>{console.log(wpmDataLayer.version)},wpm.loadScriptAndCacheIt=url=>fetch(url,{method:"GET",cache:"default",keepalive:!0}).then((e=>{if(e.ok)return e.text();throw new Error("Network response was not ok: "+url)})).then((script=>{eval(script)})).catch((e=>{console.error(e)})),wpm.getOrderItemPrice=e=>(e.total+e.total_tax)/e.quantity,wpm.hasLoginEventFired=()=>{let e=wpm.getWpmSessionData();return null==e?void 0:e.loginEventFired},wpm.setLoginEventFired=()=>{let e=wpm.getWpmSessionData();e.loginEventFired=!0,wpm.setWpmSessionData(e)},wpm.wpmDataLayerExists=()=>new Promise((e=>{!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()})),wpm.jQueryExists=()=>new Promise((e=>{!function t(){if("undefined"!=typeof jQuery)return e();setTimeout(t,100)}()})),wpm.pageLoaded=()=>new Promise((e=>{!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()})),wpm.pageReady=()=>new Promise((e=>{!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()})),wpm.isMiniCartActive=()=>{if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},wpm.doesWooCommerceCartExist=()=>document.cookie.includes("woocommerce_items_in_cart"),wpm.urlHasParameter=e=>new URLSearchParams(window.location.search).has(e),wpm.hashAsync=(e,t)=>crypto.subtle.digest(e,new TextEncoder("utf-8").encode(t)).then((e=>Array.prototype.map.call(new Uint8Array(e),(e=>("00"+e.toString(16)).slice(-2))).join(""))),wpm.getCartValue=()=>{var e;let t=0;if(null!==(e=wpmDataLayer)&&void 0!==e&&e.cart)for(const e in wpmDataLayer.cart){let o=wpmDataLayer.cart[e];t+=o.quantity*o.price}return t}})(window.wpm=window.wpm||{},jQuery)},3534:(e,t,o)=>{o(9584),o(473)},7207:()=>{wpm.wpmDataLayerExists().then((function(){console.log("Pixel Manager for WooCommerce: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),document.dispatchEvent(new Event("wpmPreLoadPixels"))})).then((function(){wpm.pageLoaded().then((function(){document.dispatchEvent(new Event("wpmLoad"))}))})),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))}))}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var o=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](o,o.exports,__webpack_require__),o.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__(3534),wpm.jQueryExists().then((function(){__webpack_require__(3299),__webpack_require__(8069),__webpack_require__(5012),__webpack_require__(8787),__webpack_require__(7207)}))})();
|
2 |
//# sourceMappingURL=wpm-public.p1.min.js.map
|
1 |
+
(()=>{var __webpack_modules__={164:()=>{jQuery(document).on("wpmLoadPixels",(()=>{var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.pixel_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.facebook)&&void 0!==i&&i.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmClientSideAddToCart",((e,t)=>{try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","AddToCart",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideBeginCheckout",((e,t)=>{try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","InitiateCheckout",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideAddToWishlist",((e,t)=>{try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","AddToWishlist",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideViewItem",((e,t)=>{try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","ViewContent",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideSearch",((e,t)=>{try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","Search",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(()=>{try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmClientSideOrderReceivedPage",((e,t)=>{try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","Purchase",t.facebook.custom_data,{eventID:t.facebook.event_id})}catch(e){console.error(e)}}))},1:()=>{!function(e,t,a){let o;e.loadFacebookPixel=()=>{try{wpmDataLayer.pixels.facebook.loaded=!0,t=window,a=document,o="script",t.fbq||(r=t.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},t._fbq||(t._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],(i=a.createElement(o)).async=!0,i.src="https://connect.facebook.net/en_US/fbevents.js",(n=a.getElementsByTagName(o)[0]).parentNode.insertBefore(i,n));let d={};e.isFbpSet()&&(d={...e.getUserIdentifiersForFb()}),fbq("init",wpmDataLayer.pixels.facebook.pixel_id,d),fbq("track","PageView")}catch(o){console.error(o)}var t,a,o,r,i,n},e.getUserIdentifiersForFb=()=>{var e,t,a,o,r,i,n,d,l,s,c,u,p,m,g,w,y,v,_,f,h,L,D,b,k,C,x,j,S,I,P,Q,E,O,T,A,F,V,R,G,q,M,N,W;let U={};return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.user)&&void 0!==t&&t.id&&(U.external_id=wpmDataLayer.user.id),null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.order)&&void 0!==o&&o.user_id&&(U.external_id=wpmDataLayer.order.user_id),null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.user)&&void 0!==i&&null!==(n=i.facebook)&&void 0!==n&&n.email&&(U.em=wpmDataLayer.user.facebook.email),null!==(d=wpmDataLayer)&&void 0!==d&&null!==(l=d.order)&&void 0!==l&&l.billing_email_hashed&&(U.em=wpmDataLayer.order.billing_email_hashed),null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.user)&&void 0!==c&&null!==(u=c.facebook)&&void 0!==u&&u.first_name&&(U.fn=wpmDataLayer.user.facebook.first_name),null!==(p=wpmDataLayer)&&void 0!==p&&null!==(m=p.order)&&void 0!==m&&m.billing_first_name&&(U.fn=wpmDataLayer.order.billing_first_name.toLowerCase()),null!==(g=wpmDataLayer)&&void 0!==g&&null!==(w=g.user)&&void 0!==w&&null!==(y=w.facebook)&&void 0!==y&&y.last_name&&(U.ln=wpmDataLayer.user.facebook.last_name),null!==(v=wpmDataLayer)&&void 0!==v&&null!==(_=v.order)&&void 0!==_&&_.billing_last_name&&(U.ln=wpmDataLayer.order.billing_last_name.toLowerCase()),null!==(f=wpmDataLayer)&&void 0!==f&&null!==(h=f.user)&&void 0!==h&&null!==(L=h.facebook)&&void 0!==L&&L.phone&&(U.ph=wpmDataLayer.user.facebook.phone),null!==(D=wpmDataLayer)&&void 0!==D&&null!==(b=D.order)&&void 0!==b&&b.billing_phone&&(U.ph=wpmDataLayer.order.billing_phone.replace("+","")),null!==(k=wpmDataLayer)&&void 0!==k&&null!==(C=k.user)&&void 0!==C&&null!==(x=C.facebook)&&void 0!==x&&x.city&&(U.ct=wpmDataLayer.user.facebook.city),null!==(j=wpmDataLayer)&&void 0!==j&&null!==(S=j.order)&&void 0!==S&&S.billing_city&&(U.ct=wpmDataLayer.order.billing_city.toLowerCase().replace(/ /g,"")),null!==(I=wpmDataLayer)&&void 0!==I&&null!==(P=I.user)&&void 0!==P&&null!==(Q=P.facebook)&&void 0!==Q&&Q.state&&(U.st=wpmDataLayer.user.facebook.state),null!==(E=wpmDataLayer)&&void 0!==E&&null!==(O=E.order)&&void 0!==O&&O.billing_state&&(U.st=wpmDataLayer.order.billing_state.toLowerCase().replace(/[a-zA-Z]{2}-/,"")),null!==(T=wpmDataLayer)&&void 0!==T&&null!==(A=T.user)&&void 0!==A&&null!==(F=A.facebook)&&void 0!==F&&F.postcode&&(U.zp=wpmDataLayer.user.facebook.postcode),null!==(V=wpmDataLayer)&&void 0!==V&&null!==(R=V.order)&&void 0!==R&&R.billing_postcode&&(U.zp=wpmDataLayer.order.billing_postcode),null!==(G=wpmDataLayer)&&void 0!==G&&null!==(q=G.user)&&void 0!==q&&null!==(M=q.facebook)&&void 0!==M&&M.country&&(U.country=wpmDataLayer.user.facebook.country),null!==(N=wpmDataLayer)&&void 0!==N&&null!==(W=N.order)&&void 0!==W&&W.billing_country&&(U.country=wpmDataLayer.order.billing_country.toLowerCase()),U},e.getFbRandomEventId=()=>(Math.random()+1).toString(36).substring(2),e.getFbUserData=()=>(o={...o,...e.getFbUserDataFromBrowser()},o),e.setFbUserData=()=>{o=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=()=>{var t,a;let o={};return e.getCookie("_fbp")&&e.isValidFbp(e.getCookie("_fbp"))&&(o.fbp=e.getCookie("_fbp")),e.getCookie("_fbc")&&e.isValidFbc(e.getCookie("_fbc"))&&(o.fbc=e.getCookie("_fbc")),null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.user)&&void 0!==a&&a.id&&(o.external_id=wpmDataLayer.user.id),navigator.userAgent&&(o.client_user_agent=navigator.userAgent),o},e.isFbpSet=()=>!!e.getCookie("_fbp"),e.isValidFbp=e=>new RegExp(/^fb\.[0-2]\.\d{13}\.\d{8,20}$/).test(e),e.isValidFbc=e=>new RegExp(/^fb\.[0-2]\.\d{13}\.[\da-zA-Z_-]{8,}/).test(e),e.fbGetProductDataForCapiEvent=e=>({content_type:"product",content_name:e.name,content_ids:[e.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]],value:parseFloat(e.quantity*e.price),currency:e.currency}),e.facebookContentIds=()=>{let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e},e.trackCustomFacebookEvent=function(t){let o=arguments.length>1&&arguments[1]!==a?arguments[1]:{};try{var r,i,n;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.facebook)||void 0===n||!n.loaded)return;let a=e.getFbRandomEventId();fbq("trackCustom",t,o,{eventID:a}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:t,event_id:a,user_data:e.getFbUserData(),event_source_url:window.location.href,custom_data:o})}catch(e){console.error(e)}},e.fbGetContentIdsFromCart=()=>{let e=[];for(const t in wpmDataLayer.cart)e.push(wpmDataLayer.products[t].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]);return e}}(window.wpm=window.wpm||{},jQuery)},12:(e,t,a)=>{a(1),a(164)},165:()=>{jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,d,l,s,c,u,p,m,g;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(d=n.pixels)||void 0===d||null===(l=d.google)||void 0===l||null===(s=l.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;let e={send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]};null!==(m=wpmDataLayer)&&void 0!==m&&null!==(g=m.user)&&void 0!==g&&g.id&&(e.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","view_item_list",e)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,d,l,s,c,u,p;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(d=n.pixels)||void 0===d||null===(l=d.google)||void 0===l||null===(s=l.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let e={send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]};null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.user)&&void 0!==p&&p.id&&(e.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",e)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{var a,o,r,i,n,d,l,s,c,u,p;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(d=n.pixels)||void 0===d||null===(l=d.google)||void 0===l||null===(s=l.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let e={send_to:wpm.getGoogleAdsConversionIdentifiers()};t&&(e.value=(t.quantity?t.quantity:1)*t.price,e.items=[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]),null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.user)&&void 0!==p&&p.id&&(e.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","view_item",e)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,d,l,s,c;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(d=n.ads)||void 0===d||null===(l=d.dynamic_remarketing)||void 0===l||!l.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let m=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var u,p;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;m.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}let g={send_to:wpm.getGoogleAdsConversionIdentifiers(),items:m};null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.user)&&void 0!==c&&c.id&&(g.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","view_search_results",g)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,d,l,s,c;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(d=n.ads)||void 0===d||null===(l=d.dynamic_remarketing)||void 0===l||!l.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u={send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()};null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.user)&&void 0!==c&&c.id&&(u.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","purchase",u)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,d,l,s,c;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(d=n.ads)||void 0===d||null===(l=d.dynamic_remarketing)||void 0===l||!l.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u={send_to:wpm.getGoogleAdsConversionIdentifiers()};null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.user)&&void 0!==c&&c.id&&(u.user_id=wpmDataLayer.user.id),wpm.gtagLoaded().then((function(){gtag("event","login",u)}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i;if(jQuery.isEmptyObject(wpm.getGoogleAdsConversionIdentifiersWithLabel()))return;if(!wpm.googleConfigConditionsMet("ads"))return;let n={},d={};n={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.order)&&void 0!==t&&t.clv_order_value_filtered&&(n.customer_lifetime_value=wpmDataLayer.order.clv_order_value_filtered),null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.user)&&void 0!==o&&o.id&&(n.user_id=wpmDataLayer.user.id),null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.order)&&void 0!==i&&i.aw_merchant_id&&(d={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...n,...d})}))}catch(e){console.error(e)}}))},42:()=>{!function(e,t,a){e.getGoogleAdsConversionIdentifiersWithLabel=function(){var e,t,a,o;let r=[];if(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.ads)&&void 0!==o&&o.conversionIds)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))t&&r.push(e+"/"+t);return r},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,a]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery)},190:(e,t,a)=>{a(42),a(165)},625:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,d,l,s;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.universal)||void 0===r||!r.property_id)return;if(null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(d=n.google)&&void 0!==d&&null!==(l=d.analytics)&&void 0!==l&&null!==(s=l.universal)&&void 0!==s&&s.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},19:()=>{!function(e,t,a){e.getGAUAOrderItems=function(){let t=[];for(const[r,i]of Object.entries(wpmDataLayer.order.items)){var a,o;let r;r={quantity:i.quantity,price:i.price,name:i.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[i.id].category.join("/")},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.general)&&void 0!==o&&o.variationsOutput&&0!==i.variation_id?(r.id=String(wpmDataLayer.products[i.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[i.variation_id].variant_name,r.brand=wpmDataLayer.products[i.variation_id].brand):(r.id=String(wpmDataLayer.products[i.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[i.id].brand),r=e.ga3AddListNameToProduct(r),t.push(r)}return t},e.ga3AddListNameToProduct=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:null;return e.list_name=wpmDataLayer.shop.list_name,t&&(e.list_position=t),e}}(window.wpm=window.wpm||{},jQuery)},562:(e,t,a)=>{a(19),a(625)},572:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,d,l,s;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.ga4)||void 0===r||!r.measurement_id)return;if(null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(d=n.google)&&void 0!==d&&null!==(l=d.analytics)&&void 0!==l&&null!==(s=l.ga4)&&void 0!==s&&s.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},228:()=>{!function(e,t,a){e.getGA4OrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_variant=wpmDataLayer.products[r.variation_id].variant_name,o.item_brand=wpmDataLayer.products[r.variation_id].brand):(o.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_brand=wpmDataLayer.products[r.id].brand),e.push(o)}return e}}(window.wpm=window.wpm||{},jQuery)},522:(e,t,a)=>{a(228),a(572)},774:(e,t,a)=>{a(562),a(522)},294:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a?void 0:a.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},860:()=>{!function(e,t,a){e.googleConfigConditionsMet=function(t){var a,o,r,i;return!(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.consent_mode)||void 0===i||!i.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==a)||arguments[0],t=!(arguments.length>1&&arguments[1]!==a)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,a,o,r,i,n,d,l,s,c,u,p,m,g,w,y,v,_,f,h,L,D;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.ads)&&void 0!==o&&null!==(r=o.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(d=n.google)&&void 0!==d&&null!==(l=d.ads)&&void 0!==l&&l.conversionIds&&null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(m=wpmDataLayer)&&void 0!==m&&null!==(g=m.pixels)&&void 0!==g&&null!==(w=g.google)&&void 0!==w&&null!==(y=w.ads)&&void 0!==y&&y.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),null!==(v=wpmDataLayer)&&void 0!==v&&null!==(_=v.shop)&&void 0!==_&&_.page_type&&"order_received_page"===wpmDataLayer.shop.page_type&&null!==(f=wpmDataLayer)&&void 0!==f&&null!==(h=f.order)&&void 0!==h&&null!==(L=h.google)&&void 0!==L&&null!==(D=L.ads)&&void 0!==D&&D.enhanced_conversion_data&>ag("set","user_data",wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{var e,t,a,o,r;wpmDataLayer.pixels.google.analytics.ga4.state="loading";let i=wpmDataLayer.pixels.google.analytics.ga4.parameters;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.ga4)&&void 0!==r&&r.debug_mode&&(i.debug_mode=!0),gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,i),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,a,o,r,i,n,d,l,s,c,u,p,m;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(d=n.google)&&void 0!==d&&null!==(l=d.analytics)&&void 0!==l&&null!==(s=l.ga4)&&void 0!==s&&s.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(m=p.ads)||void 0===m?void 0:m.conversionIds))},e.getGoogleGtagId=function(){var e,t,a,o,r,i,n,d,l,s;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(d=n.google)&&void 0!==d&&null!==(l=d.analytics)&&void 0!==l&&null!==(s=l.ga4)&&void 0!==s&&s.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).then((function(t,a){try{var o,r,i,n,d,l,s,c,u,p,m,g,w,y,v,_,f,h,L,D,b,k;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.google)&&void 0!==i&&null!==(n=i.consent_mode)&&void 0!==n&&n.active){var C,x,j,S;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(C=wpmDataLayer)&&void 0!==C&&null!==(x=C.pixels)&&void 0!==x&&null!==(j=x.google)&&void 0!==j&&null!==(S=j.consent_mode)&&void 0!==S&&S.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(d=wpmDataLayer)&&void 0!==d&&null!==(l=d.pixels)&&void 0!==l&&null!==(s=l.google)&&void 0!==s&&null!==(c=s.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(m=p.google)||void 0===m||null===(g=m.ads)||void 0===g?void 0:g.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(w=wpmDataLayer)&&void 0!==w&&null!==(y=w.pixels)&&void 0!==y&&null!==(v=y.google)&&void 0!==v&&null!==(_=v.analytics)&&void 0!==_&&null!==(f=_.universal)&&void 0!==f&&f.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(b=D.analytics)&&void 0!==b&&null!==(k=b.ga4)&&void 0!==k&&k.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,a,o,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var a,o,r;void 0===(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r?void 0:r.state)&&t();let i=0;!function a(){var o,r,n;return"ready"===(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(n=r.google)||void 0===n?void 0:n.state)?e():i>=5e3?t():(i+=200,void setTimeout(a,200))}()}))}}(window.wpm=window.wpm||{},jQuery)},580:(e,t,a)=>{a(860),a(294)},69:(e,t,a)=>{a(580),a(190),a(774),a(463)},945:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i,n,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.optimize)||void 0===o||!o.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.pixels)&&void 0!==i&&null!==(n=i.google)&&void 0!==n&&null!==(d=n.optimize)&&void 0!==d&&d.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},962:()=>{!function(e,t,a){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery)},463:(e,t,a)=>{a(962),a(945)},300:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i,n,d,l;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.hotjar)||void 0===a||!a.site_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.hotjar)&&void 0!==i&&i.loaded||!wpm.canIFire("analytics","hotjar")||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(d=n.pixels)&&void 0!==d&&null!==(l=d.hotjar)&&void 0!==l&&l.loaded||wpm.load_hotjar_pixel()}))},376:()=>{!function(e,t,a){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},a=t.getElementsByTagName("head")[0],(o=t.createElement("script")).async=1,o.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,a.appendChild(o)}catch(e){console.error(e)}var e,t,a,o}}(window.wpm=window.wpm||{},jQuery)},787:(e,t,a)=>{a(376),a(300)},473:()=>{!function(e,t,a){let o=()=>{let t=e.getCookie("cmplz_statistics"),a=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===a,visitorHasChosen:!0}},r=()=>{let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),a=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-performance")||e.getCookie("cookielawinfo-checkbox-publicite"),o=e.getCookie("CookieLawInfoConsent");return!(!t&&!a)&&{analytics:"yes"===t,ads:"yes"===a,visitorHasChosen:!!o}},i={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=()=>i,e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==a&&arguments[0],t=arguments.length>1&&arguments[1]!==a&&arguments[1];i.categories.analytics=e,i.categories.ads=t},e.updateConsentCookieValues=function(){let t,n=arguments.length>0&&arguments[0]!==a?arguments[0]:null,d=arguments.length>1&&arguments[1]!==a?arguments[1]:null,l=arguments.length>2&&arguments[2]!==a&&arguments[2];return i.categories.analytics=!l,i.categories.ads=!l,n||d?(n&&(i.categories.analytics=!!n),void(d&&(i.categories.ads=!!d))):(t=e.getCookie("pmw_cookie_consent"))?(t=JSON.parse(t),i.categories.analytics=!0===t.analytics,i.categories.ads=!0===t.ads,void(i.visitorHasChosen=!0)):(t=e.getCookie("CookieConsent"))?(t=decodeURI(t),i.categories.analytics=t.indexOf("statistics:true")>=0,i.categories.ads=t.indexOf("marketing:true")>=0,void(i.visitorHasChosen=!0)):(t=e.getCookie("CookieScriptConsent"))?(t=JSON.parse(t),"reject"===t.action?(i.categories.analytics=!1,i.categories.ads=!1):2===t.categories.length?(i.categories.analytics=!0,i.categories.ads=!0):(i.categories.analytics=t.categories.indexOf("performance")>=0,i.categories.ads=t.categories.indexOf("targeting")>=0),void(i.visitorHasChosen=!0)):(t=e.getCookie("borlabs-cookie"))?(t=decodeURI(t),t=JSON.parse(t),i.categories.analytics=!(null===(s=t)||void 0===s||null===(c=s.consents)||void 0===c||!c.statistics),i.categories.ads=!(null===(u=t)||void 0===u||null===(p=u.consents)||void 0===p||!p.marketing),i.visitorHasChosen=!0,i.pixels=[...(null===(m=t)||void 0===m||null===(g=m.consents)||void 0===g?void 0:g.statistics)||[],...(null===(w=t)||void 0===w||null===(y=w.consents)||void 0===y?void 0:y.marketing)||[]],void(i.mode="pixel")):(t=o())?(i.categories.analytics=!0===t.analytics,i.categories.ads=!0===t.ads,void(i.visitorHasChosen=t.visitorHasChosen)):(t=e.getCookie("cookie_notice_accepted"))?(i.categories.analytics=!0,i.categories.ads=!0,void(i.visitorHasChosen=!0)):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),i.categories.analytics=!!t.categories[3],i.categories.ads=!!t.categories[4],void(i.visitorHasChosen=!0)):(t=r())?(i.categories.analytics=!0===t.analytics,i.categories.ads=!0===t.ads,void(i.visitorHasChosen=!0===t.visitorHasChosen)):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),i.categories.analytics="1"===t.thirdparty,i.categories.ads="1"===t.advanced,void(i.visitorHasChosen=!0)):void 0;var s,c,u,p,m,g,w,y},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=()=>{i.categories={analytics:!1,ads:!1}},e.canIFire=(t,a)=>{let o;return"category"===i.mode?o=!!i.categories[t]:"pixel"===i.mode?(o=i.pixels.includes(a),!1===o&&"microsoft-ads"===a&&(o=i.pixels.includes("bing-ads"))):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),o=!1),!!o||(e.logPreventedPixelLoading(a,t),!1)},e.logPreventedPixelLoading=(e,t)=>{var a,o,r;null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.shop)&&void 0!==o&&null!==(r=o.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('Pixel Manager for WooCommerce: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (PMW is in explicit consent mode.)'):console.log('Pixel Manager for WooCommerce: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (PMW is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((a=>{a.forEach((a=>{let{addedNodes:o}=a;[...o].forEach((a=>{t(a).data("wpm-cookie-category")&&(e.shouldScriptBeActive(a)?e.unblockScript(a):e.blockScript(a))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),document.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=e=>{var a,o,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||i.visitorHasChosen)&&("category"!==i.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>i.categories[e])))&&("pixel"!==i.mode||!i.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==i.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>i.pixels.includes(e))))&&(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",o&&t(e).appendTo("head"),document.dispatchEvent(new Event("wpmPreLoadPixels"))},e.blockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",o&&t(e).appendTo("head")},e.unblockAllScripts=function(){let t=!(arguments.length>0&&arguments[0]!==a)||arguments[0],o=!(arguments.length>1&&arguments[1]!==a)||arguments[1];e.setConsentValueCategories(t,o),document.dispatchEvent(new Event("wpmPreLoadPixels"))},e.unblockSelectedPixels=()=>{document.dispatchEvent(new Event("wpmPreLoadPixels"))},document.addEventListener("borlabs-cookie-consent-saved",(()=>{e.updateConsentCookieValues(),"pixel"===i.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(i.pixels.includes("google-analytics"),i.pixels.includes("google-ads"))):(e.unblockAllScripts(i.categories.analytics,i.categories.ads),e.updateGoogleConsentMode(i.categories.analytics,i.categories.ads))})),document.addEventListener("CookiebotOnAccept",(()=>{Cookiebot.consent.statistics&&(i.categories.analytics=!0),Cookiebot.consent.marketing&&(i.categories.ads=!0),e.unblockAllScripts(i.categories.analytics,i.categories.ads),e.updateGoogleConsentMode(i.categories.analytics,i.categories.ads)}),!1),document.addEventListener("CookieScriptAccept",(t=>{t.detail.categories.includes("performance")&&(i.categories.analytics=!0),t.detail.categories.includes("targeting")&&(i.categories.ads=!0),e.unblockAllScripts(i.categories.analytics,i.categories.ads),e.updateGoogleConsentMode(i.categories.analytics,i.categories.ads)})),document.addEventListener("CookieScriptAcceptAll",(()=>{e.setConsentValueCategories(!0,!0),e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),e.cmplzStatusChange=t=>{t.detail.categories.includes("statistics")&&e.updateConsentCookieValues(!0,null),t.detail.categories.includes("marketing")&&e.updateConsentCookieValues(null,!0),e.unblockAllScripts(i.categories.analytics,i.categories.ads),e.updateGoogleConsentMode(i.categories.analytics,i.categories.ads)},document.addEventListener("cmplzStatusChange",e.cmplzStatusChange),document.addEventListener("cmplz_status_change",e.cmplzStatusChange),document.addEventListener("setCookieNotice",(()=>{e.updateConsentCookieValues(),e.unblockAllScripts(i.categories.analytics,i.categories.ads),e.updateGoogleConsentMode(i.categories.analytics,i.categories.ads)})),e.huObserver=new MutationObserver((t=>{t.forEach((t=>{let{addedNodes:a}=t;[...a].forEach((t=>{"hu"===t.id&&document.querySelector(".hu-cookies-save").addEventListener("click",(()=>{e.updateConsentCookieValues(),e.unblockAllScripts(i.categories.analytics,i.categories.ads),e.updateGoogleConsentMode(i.categories.analytics,i.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.explicitConsentStateAlreadySet=()=>{if(i.explicitConsentStateAlreadySet)return!0;i.explicitConsentStateAlreadySet=!0}}(window.wpm=window.wpm||{},jQuery),function(e,t,a){e.consentAcceptAll=function(){let t=arguments.length>0&&arguments[0]!==a?arguments[0]:365;e.consentSetCookie(!0,!0,t),wpm.unblockAllScripts(!0,!0),wpm.updateGoogleConsentMode(!0,!0)},e.consentAdjustSelectively=function(t,o){let r=arguments.length>2&&arguments[2]!==a?arguments[2]:365;e.consentSetCookie(t,o,r),wpm.unblockAllScripts(t,o),wpm.updateGoogleConsentMode(t,o)},e.consentRevokeAll=function(){let t=arguments.length>0&&arguments[0]!==a?arguments[0]:365;wpm.setConsentValueCategories(!1,!1),e.consentSetCookie(!1,!1,t),wpm.updateGoogleConsentMode(!1,!1)},e.consentSetCookie=function(e,t){let o=arguments.length>2&&arguments[2]!==a?arguments[2]:365;wpm.setCookie("pmw_cookie_consent",JSON.stringify({analytics:e,ads:t}),o)},jQuery(document).trigger("pmw_cookie_consent_management_loaded")}(window.pmw=window.pmw||{},jQuery)},299:()=>{jQuery(document).on("click",".remove_from_cart_button, .remove",(e=>{try{let t=new URL(jQuery(e.currentTarget).attr("href")),a=wpm.getProductIdByCartItemKeyUrl(t);wpm.removeProductFromCart(a)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(e=>{try{let t,a=1;"product"===wpmDataLayer.shop.page_type?(void 0!==jQuery(e.currentTarget).attr("href")&&jQuery(e.currentTarget).attr("href").includes("add-to-cart")&&(t=jQuery(e.currentTarget).data("product_id"),wpm.addProductToCart(t,a)),"simple"===wpmDataLayer.shop.product_type&&(a=Number(jQuery(".input-text.qty").val()),a||0===a||(a=1),t=jQuery(e.currentTarget).val(),wpm.addProductToCart(t,a)),["variable","variable-subscription"].indexOf(wpmDataLayer.shop.product_type)>=0&&(a=Number(jQuery(".input-text.qty").val()),a||0===a||(a=1),t=jQuery("[name='variation_id']").val(),wpm.addProductToCart(t,a)),"grouped"===wpmDataLayer.shop.product_type&&jQuery(".woocommerce-grouped-product-list-item").each(((e,o)=>{a=Number(jQuery(o).find(".input-text.qty").val()),a||0===a||(a=1);let r=jQuery(o).attr("class");t=wpm.getPostIdFromString(r),wpm.addProductToCart(t,a)})),"bundle"===wpmDataLayer.shop.product_type&&(a=Number(jQuery(".input-text.qty").val()),a||0===a||(a=1),t=jQuery("input[name=add-to-cart]").val(),wpm.addProductToCart(t,a))):(t=jQuery(e.currentTarget).data("product_id"),wpm.addProductToCart(t,a))}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(e=>{try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(e=>{try{let t=jQuery(e.currentTarget).nextAll(".wpmProductId:first").data("id");if(t){if(t=wpm.getIdBasedOndVariationsOutputSetting(t),!t)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[t]){let e=wpm.getProductDetailsFormattedForEvent(t);jQuery(document).trigger("wpmSelectContentGaUa",e),jQuery(document).trigger("wpmSelectItem",e)}}}catch(e){console.error(e)}})),jQuery(document).one("click init_checkout",[".checkout-button",".cart-checkout-button",".button.checkout",".xoo-wsc-ft-btn-checkout",".elementor-button--checkout"].join(","),(()=>{jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(e=>{wpm.isEmail(jQuery(e.currentTarget).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("wpmLoad",(e=>{jQuery(document).on("payment_method_selected",(()=>{!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0}))})),jQuery((()=>{jQuery("form.checkout").on("checkout_place_order_success",(()=>{!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)}))})),jQuery(document).on("click","[name='update_cart']",(e=>{try{jQuery(".cart_item").each(((e,t)=>{let a=new URL(jQuery(t).find(".product-remove").find("a").attr("href")),o=wpm.getProductIdByCartItemKeyUrl(a),r=jQuery(t).find(".qty").val();0===r?wpm.removeProductFromCart(o):r<wpmDataLayer.cart[o].quantity?wpm.removeProductFromCart(o,wpmDataLayer.cart[o].quantity-r):r>wpmDataLayer.cart[o].quantity&&wpm.addProductToCart(o,r-wpmDataLayer.cart[o].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery((function(){jQuery(".add_to_wishlist,.wl-add-to").on("click",(e=>{try{let t;if(jQuery(e.currentTarget).data("productid")?t=jQuery(e.currentTarget).data("productid"):jQuery(e.currentTarget).data("product-id")&&(t=jQuery(e.currentTarget).data("product-id")),!t)throw Error("Wasn't able to retrieve a productId");let a=wpm.getProductDetailsFormattedForEvent(t);jQuery(document).trigger("wpmAddToWishlist",a)}catch(e){console.error(e)}}))})),jQuery(document).on("updated_cart_totals",(()=>{jQuery(document).trigger("wpmViewCart")})),jQuery((()=>{jQuery(".single_variation_wrap").on("show_variation",((e,t)=>{try{let e=wpm.getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");wpm.triggerViewItemEventPrep(e)}catch(e){console.error(e)}}))})),jQuery(document).on("wpmLoad",(()=>{try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(document).on("wpmLoad",(()=>{wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(document).on("wpmLoad",(()=>{if(!wpm.getCookie("wpmReferrer")&&document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host&&wpm.setCookie("wpmReferrer",e)}})),jQuery(document).on("wpmLoad",(()=>{try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,a,o;if(jQuery(document).trigger("wpmLoadAlways"),null!==(t=wpmDataLayer)&&void 0!==t&&t.shop)if("product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id),"function"==typeof wpm.acrRemoveCookie&&wpm.acrRemoveCookie()):jQuery(document).trigger("wpmEverywhereElse");else jQuery(document).trigger("wpmEverywhereElse");null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.user)&&void 0!==o&&o.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(document).on("wpmLoad",(async()=>{window.sessionStorage&&window.sessionStorage.getItem("_pmw_endpoint_available")&&!JSON.parse(window.sessionStorage.getItem("_pmw_endpoint_available"))&&console.error("Pixel Manager for WooCommerce: REST endpoint is not available. Using admin-ajax.php instead.")})),jQuery(document).on("wpmPreLoadPixels",(()=>{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(a=t.cookie_consent_mgmt)&&void 0!==a&&a.explicit_consent&&!wpm.explicitConsentStateAlreadySet()&&wpm.updateConsentCookieValues(null,null,!0),jQuery(document).trigger("wpmLoadPixels",{})})),jQuery(document).on("wpmAddToCart",((e,t)=>{var a,o,r;let i={event:"addToCart",product:t};null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.pixels)&&void 0!==o&&null!==(r=o.facebook)&&void 0!==r&&r.loaded&&(i.facebook={event_name:"AddToCart",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:wpm.fbGetProductDataForCapiEvent(t)}),jQuery(document).trigger("wpmClientSideAddToCart",i),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(i)})),jQuery(document).on("wpmBeginCheckout",(()=>{var e,t,a;let o={event:"beginCheckout"};var r;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.loaded&&(o.facebook={event_name:"InitiateCheckout",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{}},null!==(r=wpmDataLayer)&&void 0!==r&&r.cart&&!jQuery.isEmptyObject(wpmDataLayer.cart)&&(o.facebook.custom_data={content_type:"product",content_ids:wpm.fbGetContentIdsFromCart(),value:wpm.getCartValue(),currency:wpmDataLayer.shop.currency})),jQuery(document).trigger("wpmClientSideBeginCheckout",o),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(o)})),jQuery(document).on("wpmAddToWishlist",((e,t)=>{var a,o,r;let i={event:"addToWishlist",product:t};null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.pixels)&&void 0!==o&&null!==(r=o.facebook)&&void 0!==r&&r.loaded&&(i.facebook={event_name:"AddToWishlist",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:wpm.fbGetProductDataForCapiEvent(t)}),jQuery(document).trigger("wpmClientSideAddToWishlist",i),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(i)})),jQuery(document).on("wpmViewItem",(function(e){var t,a,o;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i={event:"viewItem",product:r};null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.facebook)&&void 0!==o&&o.loaded&&(i.facebook={event_name:"ViewContent",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{}},r&&(i.facebook.custom_data=wpm.fbGetProductDataForCapiEvent(r))),jQuery(document).trigger("wpmClientSideViewItem",i),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(i)})),jQuery(document).on("wpmSearch",(()=>{var e,t,a;let o={event:"search"};null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.loaded&&(o.facebook={event_name:"Search",event_id:wpm.getFbRandomEventId(),user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{search_string:wpm.getSearchTermFromUrl()}}),jQuery(document).trigger("wpmClientSideSearch",o),"function"==typeof wpm.sendEventPayloadToServer&&wpm.sendEventPayloadToServer(o)})),jQuery(document).on("wpmOrderReceivedPage",(()=>{var e,t,a;let o={event:"orderReceived"};null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.loaded&&(o.facebook={event_name:"Purchase",event_id:wpmDataLayer.order.id,user_data:wpm.getFbUserData(),event_source_url:window.location.href,custom_data:{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()}}),jQuery(document).trigger("wpmClientSideOrderReceivedPage",o)}))},584:()=>{(function(wpm,$,undefined){const wpmDeduper={keyName:"_wpm_order_ids",cookieExpiresDays:365},wpmRestSettings={cookiePmwRestEndpointAvailable:"_pmw_endpoint_available",restEndpointPost:"pmw/v1/test/",restFails:0,restFailsThreshold:10};function checkCookie(){return""!==wpm.getCookie(wpmDeduper.keyName)}wpm.emailSelected=!1,wpm.paymentMethodSelected=!1,wpm.useRestEndpoint=()=>wpm.isSessionStorageAvailable()&&wpm.isRestEndpointAvailable()&&wpm.isBelowRestErrorThreshold(),wpm.isBelowRestErrorThreshold=()=>window.sessionStorage.getItem(wpmRestSettings.restFails)<=wpmRestSettings.restFailsThreshold,wpm.isRestEndpointAvailable=async()=>window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable)?JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable)):await wpm.testEndpoint(),wpm.isSessionStorageAvailable=()=>!!window.sessionStorage,wpm.testEndpoint=async function(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:wpm.root+wpmRestSettings.restEndpointPost,t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:wpmRestSettings.cookiePmwRestEndpointAvailable,a=await fetch(e,{method:"POST",mode:"cors",cache:"no-cache",keepalive:!0});return 200===a.status?(window.sessionStorage.setItem(t,JSON.stringify(!0)),!0):404===a.status||0===a.status?(window.sessionStorage.setItem(t,JSON.stringify(!1)),!1):void 0},wpm.isWpmRestEndpointAvailable=function(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:wpmRestSettings.cookiePmwRestEndpointAvailable;return!!wpm.getCookie(e)},wpm.writeOrderIdToStorage=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"thankyou_page";if(window.Storage)if(null===localStorage.getItem(wpmDeduper.keyName)){let t=[];t.push(e),window.localStorage.setItem(wpmDeduper.keyName,JSON.stringify(t))}else{let t=JSON.parse(localStorage.getItem(wpmDeduper.keyName));t.includes(e)||(t.push(e),window.localStorage.setItem(wpmDeduper.keyName,JSON.stringify(t)))}else{let t=new Date;t.setDate(t.getDate()+wpmDeduper.cookieExpiresDays);let a=[];checkCookie()&&(a=JSON.parse(wpm.getCookie(wpmDeduper.keyName))),a.includes(e)||(a.push(e),document.cookie=wpmDeduper.keyName+"="+JSON.stringify(a)+";expires="+t.toUTCString())}"function"==typeof wpm.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&wpm.storeOrderIdOnServer(e,t)},wpm.isOrderIdStored=e=>wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(wpmDeduper.keyName)&&JSON.parse(localStorage.getItem(wpmDeduper.keyName)).includes(e):!!checkCookie()&&JSON.parse(wpm.getCookie(wpmDeduper.keyName)).includes(e):(console.log("order duplication prevention: off"),!1),wpm.isEmail=e=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e),wpm.removeProductFromCart=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;try{if(!e)throw Error("Wasn't able to retrieve a productId");if(!(e=wpm.getIdBasedOndVariationsOutputSetting(e)))throw Error("Wasn't able to retrieve a productId");let a;if(a=null==t?wpmDataLayer.cart[e].quantity:t,wpmDataLayer.cart[e]){let o=wpm.getProductDetailsFormattedForEvent(e,a);jQuery(document).trigger("wpmRemoveFromCart",o),null==t||wpmDataLayer.cart[e].quantity===t?(delete wpmDataLayer.cart[e],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[e].quantity=wpmDataLayer.cart[e].quantity-a,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},wpm.getIdBasedOndVariationsOutputSetting=e=>{try{var t,a;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},wpm.addProductToCart=(e,t)=>{try{var a;if(!e)throw Error("Wasn't able to retrieve a productId");if(!(e=wpm.getIdBasedOndVariationsOutputSetting(e)))throw Error("Wasn't able to retrieve a productId");if(null!==(a=wpmDataLayer)&&void 0!==a&&a.products[e]){var o;let a=wpm.getProductDetailsFormattedForEvent(e,t);jQuery(document).trigger("wpmAddToCart",a),null!==(o=wpmDataLayer)&&void 0!==o&&o.cart[e]?wpmDataLayer.cart[e].quantity=wpmDataLayer.cart[e].quantity+t:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[e]=wpm.getProductDetailsFormattedForEvent(e,t)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(e){console.error(e),wpm.getCartItemsFromBackend()}},wpm.getCartItems=()=>{sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?wpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):wpm.getCartItemsFromBackend()},wpm.getCartItemsFromBackend=()=>{try{fetch(wpm.ajax_url,{method:"POST",cache:"no-cache",body:new URLSearchParams({action:"pmw_get_cart_items"}),keepalive:!0}).then((e=>{if(e.ok)return e.json();throw Error("Error getting cart items from backend")})).then((e=>{if(!e.success)throw Error("Error getting cart items from backend");e.data.cart||(e.data.cart={}),wpm.saveCartObjectToDataLayer(e.data.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(e.data.cart))}))}catch(e){console.error(e)}},wpm.getProductsFromBackend=async e=>{var t;if(null!==(t=wpmDataLayer)&&void 0!==t&&t.products&&(e=e.filter((e=>!wpmDataLayer.products.hasOwnProperty(e)))),e&&0!==e.length){try{let t;if(t=await wpm.isRestEndpointAvailable()?await fetch(wpm.root+"pmw/v1/products/",{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}):await fetch(wpm.ajax_url,{method:"POST",cache:"no-cache",body:new URLSearchParams({action:"pmw_get_product_ids",productIds:e})}),t.ok){let e=await t.json();e.success&&(wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e.data))}else console.error("Error getting products from backend")}catch(e){console.error(e)}return!0}},wpm.saveCartObjectToDataLayer=e=>{wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},wpm.triggerViewItemEventPrep=async e=>{wpmDataLayer.products&&wpmDataLayer.products[e]||await wpm.getProductsFromBackend([e]),wpm.triggerViewItemEvent(e)},wpm.triggerViewItemEvent=e=>{let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)},wpm.triggerViewItemEventNoProduct=()=>{jQuery(document).trigger("wpmViewItem")},wpm.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null,a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null,o={step:e,checkout_option:t,value:a};jQuery(document).trigger("wpmFireCheckoutOption",o)},wpm.fireCheckoutProgress=e=>{let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},wpm.getPostIdFromString=e=>{try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},wpm.triggerViewItemList=e=>{if(!e)throw Error("Wasn't able to retrieve a productId");if(!(e=wpm.getIdBasedOndVariationsOutputSetting(e)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",wpm.getProductDataForViewItemEvent(e))},wpm.getProductDataForViewItemEvent=e=>{if(!e)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[e])return wpm.getProductDetailsFormattedForEvent(e)}catch(e){console.error(e)}},wpm.getMainProductIdFromProductPage=()=>{try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},wpm.viewItemListTriggerTestMode=e=>{jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},wpm.getSearchTermFromUrl=()=>{try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let ioTimeouts={},io;wpm.observerCallback=(e,t)=>{e.forEach((e=>{try{let a,o=jQuery(e.target).data("ioid");if(a=jQuery(e.target).next(".wpmProductId").length?jQuery(e.target).next(".wpmProductId").data("id"):jQuery(e.target).find(".wpmProductId").data("id"),!a)throw Error("wpmProductId element not found");e.isIntersecting?ioTimeouts[o]=setTimeout((()=>{wpm.triggerViewItemList(a),wpmDataLayer.viewItemListTrigger.testMode&&wpm.viewItemListTriggerTestMode(e.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&t.unobserve(e.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(ioTimeouts[o]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(e.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let ioid=0,allIoElementsToWatch,getAllElementsToWatch=()=>{allIoElementsToWatch=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0}))};wpm.startIntersectionObserverToWatch=()=>{try{wpm.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),io=new IntersectionObserver(wpm.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),getAllElementsToWatch(),allIoElementsToWatch.each(((e,t)=>{jQuery(t[0]).data("ioid",ioid++),io.observe(t[0])}))}catch(e){console.error(e)}},wpm.startProductsMutationObserverToWatch=()=>{try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&productsMutationObserver.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let productsMutationObserver=new MutationObserver((e=>{e.forEach((e=>{let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&hasWpmProductIdElement(this)&&(jQuery(this).data("ioid",ioid++),io.observe(this))}))}))})),hasWpmProductIdElement=e=>!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length);wpm.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"",a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;if(a){let o=new Date;o.setTime(o.getTime()+24*a*60*60*1e3);let r="expires="+o.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},wpm.getCookie=e=>{let t=e+"=",a=decodeURIComponent(document.cookie).split(";");for(let e=0;e<a.length;e++){let o=a[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""},wpm.deleteCookie=e=>{wpm.setCookie(e,"",-1)},wpm.getWpmSessionData=()=>{if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},wpm.setWpmSessionData=e=>{window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},wpm.storeOrderIdOnServer=async(e,t)=>{try{let a;a=await wpm.isRestEndpointAvailable()?await fetch(wpm.root+"pmw/v1/pixels-fired/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({order_id:e,source:t}),keepalive:!0,cache:"no-cache"}):await fetch(wpm.ajax_url,{method:"POST",body:new URLSearchParams({action:"pmw_purchase_pixels_fired",order_id:e,source:t}),keepalive:!0}),a.ok?console.log("wpm.storeOrderIdOnServer success"):console.error("wpm.storeOrderIdOnServer error")}catch(e){console.error(e)}},wpm.getProductIdByCartItemKeyUrl=e=>{let t,a=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[a].variation_id?wpmDataLayer.cartItemKeys[a].product_id:wpmDataLayer.cartItemKeys[a].variation_id,t},wpm.getAddToCartLinkProductIds=()=>jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get(),wpm.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1,a={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return a.isVariation&&(a.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),a},wpm.setReferrerToCookie=()=>{wpm.getCookie("wpmReferrer")||wpm.setCookie("wpmReferrer",document.referrer)},wpm.getReferrerFromCookie=()=>wpm.getCookie("wpmReferrer")?wpm.getCookie("wpmReferrer"):null,wpm.getClidFromBrowser=function(){let e,t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"gclid";return e={gclid:"_gcl_aw",dclid:"_gcl_dc"},wpm.getCookie(e[t])?wpm.getCookie(e[t]).match(/(GCL.[\d]*.)(.*)/)[2]:""},wpm.getUserAgent=()=>navigator.userAgent,wpm.getViewPort=()=>({width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}),wpm.version=()=>{console.log(wpmDataLayer.version)},wpm.loadScriptAndCacheIt=url=>fetch(url,{method:"GET",cache:"default",keepalive:!0}).then((e=>{if(e.ok)return e.text();throw new Error("Network response was not ok: "+url)})).then((script=>{eval(script)})).catch((e=>{console.error(e)})),wpm.getOrderItemPrice=e=>(e.total+e.total_tax)/e.quantity,wpm.hasLoginEventFired=()=>{let e=wpm.getWpmSessionData();return null==e?void 0:e.loginEventFired},wpm.setLoginEventFired=()=>{let e=wpm.getWpmSessionData();e.loginEventFired=!0,wpm.setWpmSessionData(e)},wpm.wpmDataLayerExists=()=>new Promise((e=>{!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()})),wpm.jQueryExists=()=>new Promise((e=>{!function t(){if("undefined"!=typeof jQuery)return e();setTimeout(t,100)}()})),wpm.pageLoaded=()=>new Promise((e=>{!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()})),wpm.pageReady=()=>new Promise((e=>{!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()})),wpm.isMiniCartActive=()=>{if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},wpm.doesWooCommerceCartExist=()=>document.cookie.includes("woocommerce_items_in_cart"),wpm.urlHasParameter=e=>new URLSearchParams(window.location.search).has(e),wpm.hashAsync=(e,t)=>crypto.subtle.digest(e,new TextEncoder("utf-8").encode(t)).then((e=>Array.prototype.map.call(new Uint8Array(e),(e=>("00"+e.toString(16)).slice(-2))).join(""))),wpm.getCartValue=()=>{var e;let t=0;if(null!==(e=wpmDataLayer)&&void 0!==e&&e.cart)for(const e in wpmDataLayer.cart){let a=wpmDataLayer.cart[e];t+=a.quantity*a.price}return t}})(window.wpm=window.wpm||{},jQuery)},534:(e,t,a)=>{a(584),a(473)},207:()=>{wpm.wpmDataLayerExists().then((function(){console.log("Pixel Manager for WooCommerce: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),document.dispatchEvent(new Event("wpmPreLoadPixels"))})).then((function(){wpm.pageLoaded().then((function(){document.dispatchEvent(new Event("wpmLoad"))}))})),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))}))}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var a=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](a,a.exports,__webpack_require__),a.exports}var __webpack_exports__={};__webpack_require__(534),wpm.jQueryExists().then((function(){__webpack_require__(299),__webpack_require__(69),__webpack_require__(12),__webpack_require__(787),__webpack_require__(207)}))})();
|
2 |
//# sourceMappingURL=wpm-public.p1.min.js.map
|
js/public/wpm-public.p1.min.js.br
CHANGED
Binary file
|
js/public/wpm-public.p1.min.js.gz
CHANGED
Binary file
|
js/public/wpm-public.p1.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"wpm-public.p1.min.js","mappings":"8CAAA,IAAIA,EAAaC,EAAQ,MACrBC,EAAcD,EAAQ,MAEtBE,EAAaC,UAGjBC,EAAOC,QAAU,SAAUC,GACzB,GAAIP,EAAWO,GAAW,OAAOA,EACjC,MAAMJ,EAAWD,EAAYK,GAAY,qBAC1C,C,iBCTD,IAAIC,EAAkBP,EAAQ,MAC1BQ,EAASR,EAAQ,MACjBS,EAAiBT,EAAAA,MAAAA,EAEjBU,EAAcH,EAAgB,eAC9BI,EAAiBC,MAAMC,UAIQC,MAA/BH,EAAeD,IACjBD,EAAeE,EAAgBD,EAAa,CAC1CK,cAAc,EACdC,MAAOR,EAAO,QAKlBJ,EAAOC,QAAU,SAAUY,GACzBN,EAAeD,GAAaO,IAAO,CACpC,C,gBCnBD,IAAIC,EAAWlB,EAAQ,MAEnBmB,EAAUC,OACVlB,EAAaC,UAGjBC,EAAOC,QAAU,SAAUC,GACzB,GAAIY,EAASZ,GAAW,OAAOA,EAC/B,MAAMJ,EAAWiB,EAAQb,GAAY,oBACtC,C,iBCTD,IAAIe,EAAkBrB,EAAQ,MAC1BsB,EAAkBtB,EAAQ,KAC1BuB,EAAoBvB,EAAQ,KAG5BwB,EAAe,SAAUC,GAC3B,OAAO,SAAUC,EAAOC,EAAIC,GAC1B,IAGIZ,EAHAa,EAAIR,EAAgBK,GACpBI,EAASP,EAAkBM,GAC3BE,EAAQT,EAAgBM,EAAWE,GAIvC,GAAIL,GAAeE,GAAMA,GAAI,KAAOG,EAASC,GAG3C,IAFAf,EAAQa,EAAEE,OAEGf,EAAO,OAAO,OAEtB,KAAMc,EAASC,EAAOA,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AOG,MAAQ,IAAIpB,SAAS,cAAb,EAGhB,CAFE,MAAO8L,GACR,GAAsB,iBAAX5K,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCCxBkoB,oBAAoBjR,EAAKne,IACH,oBAAXkL,QAA0BA,OAAOukB,aAC1C5rB,OAAOzD,eAAeJ,EAASkL,OAAOukB,YAAa,CAAE9uB,MAAO,WAE7DkD,OAAOzD,eAAeJ,EAAS,aAAc,CAAEW,OAAO,GAAO,E,2BCD9DhB,oBAAQ,MAGRsR,IAAIgd,eAAerW,MAAK,WAEvBjY,oBAAQ,MAERA,oBAAQ,MACRA,oBAAQ,MACRA,oBAAQ,MAuBRA,oBAAQ,KACR,G","sources":["webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/a-callable.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/add-to-unscopables.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/an-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/array-includes.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/classof-raw.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/copy-constructor-properties.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/create-non-enumerable-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/create-property-descriptor.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/define-built-in.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/define-global-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/descriptors.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/document-create-element.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/engine-user-agent.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/engine-v8-version.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/enum-bug-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/export.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/fails.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-bind-native.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-call.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-name.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/function-uncurry-this.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/get-built-in.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/get-method.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/global.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/has-own-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/hidden-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/html.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/ie8-dom-define.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/indexed-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/inspect-source.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/internal-state.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-callable.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-forced.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-pure.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/is-symbol.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/length-of-array-like.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/make-built-in.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/math-trunc.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/native-symbol.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/native-weak-map.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-create.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-define-properties.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-define-property.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-get-own-property-descriptor.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-get-own-property-names.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-get-own-property-symbols.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-is-prototype-of.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-keys-internal.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/object-property-is-enumerable.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/ordinary-to-primitive.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/own-keys.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/require-object-coercible.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/shared-key.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/shared-store.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/shared.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-absolute-index.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-indexed-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-integer-or-infinity.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-length.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-object.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-primitive.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/to-property-key.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/try-to-string.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/uid.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/use-symbol-as-uid.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/v8-prototype-define-bug.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/internals/well-known-symbol.js","webpack://Pixel-Manager-for-WooCommerce/./node_modules/core-js/modules/es.array.includes.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/facebook/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/facebook/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/facebook/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/ads/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/ads/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/ads/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga3/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga3/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga3/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga4/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga4/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga4/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/base/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/base/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/base/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/optimize/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/optimize/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/optimize/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/hotjar/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/hotjar/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/hotjar/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/cookie_consent.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/functions_loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/init.js","webpack://Pixel-Manager-for-WooCommerce/webpack/bootstrap","webpack://Pixel-Manager-for-WooCommerce/webpack/runtime/global","webpack://Pixel-Manager-for-WooCommerce/webpack/runtime/make namespace object","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/main.js"],"sourcesContent":["var isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw $TypeError(tryToString(argument) + ' is not a function');\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar create = require('../internals/object-create');\nvar defineProperty = require('../internals/object-define-property').f;\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] == undefined) {\n defineProperty(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: create(null)\n });\n}\n\n// add a key to Array.prototype[@@unscopables]\nmodule.exports = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n};\n","var isObject = require('../internals/is-object');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw $TypeError($String(argument) + ' is not an object');\n};\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(''.slice);\n\nmodule.exports = function (it) {\n return stringSlice(toString(it), 8, -1);\n};\n","var hasOwn = require('../internals/has-own-property');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source, exceptions) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n }\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var isCallable = require('../internals/is-callable');\nvar definePropertyModule = require('../internals/object-define-property');\nvar makeBuiltIn = require('../internals/make-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nmodule.exports = function (O, key, value, options) {\n if (!options) options = {};\n var simple = options.enumerable;\n var name = options.name !== undefined ? options.name : key;\n if (isCallable(value)) makeBuiltIn(value, name, options);\n if (options.global) {\n if (simple) O[key] = value;\n else defineGlobalProperty(key, value);\n } else {\n try {\n if (!options.unsafe) delete O[key];\n else if (O[key]) simple = true;\n } catch (error) { /* empty */ }\n if (simple) O[key] = value;\n else definePropertyModule.f(O, key, {\n value: value,\n enumerable: false,\n configurable: !options.nonConfigurable,\n writable: !options.nonWritable\n });\n } return O;\n};\n","var global = require('../internals/global');\n\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(global, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var fails = require('../internals/fails');\n\n// Detect IE8's incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('navigator', 'userAgent') || '';\n","var global = require('../internals/global');\nvar userAgent = require('../internals/engine-user-agent');\n\nvar process = global.process;\nvar Deno = global.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n // in old Chrome, versions of V8 isn't V8 = Chrome / 10\n // but their correct versions are not interesting for us\n version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || defineGlobalProperty(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty == typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n defineBuiltIn(target, key, sourceProperty, options);\n }\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es-x/no-function-prototype-bind -- safe\n var test = (function () { /* empty */ }).bind();\n // eslint-disable-next-line no-prototype-builtins -- safe\n return typeof test != 'function' || test.hasOwnProperty('prototype');\n});\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar call = Function.prototype.call;\n\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n return call.apply(call, arguments);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar bind = FunctionPrototype.bind;\nvar call = FunctionPrototype.call;\nvar uncurryThis = NATIVE_BIND && bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? function (fn) {\n return fn && uncurryThis(fn);\n} : function (fn) {\n return fn && function () {\n return call.apply(fn, arguments);\n };\n};\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (argument) {\n return isCallable(argument) ? argument : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];\n};\n","var aCallable = require('../internals/a-callable');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return func == null ? undefined : aCallable(func);\n};\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line es-x/no-global-this -- safe\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n // eslint-disable-next-line no-restricted-globals -- safe\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func -- fallback\n (function () { return this; })() || Function('return this')();\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es-x/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n","module.exports = {};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar $Object = Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !$Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split(it, '') : $Object(it);\n} : $Object;\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = global.TypeError;\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n var wmget = uncurryThis(store.get);\n var wmhas = uncurryThis(store.has);\n var wmset = uncurryThis(store.set);\n set = function (it, metadata) {\n if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n wmset(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget(store, it) || {};\n };\n has = function (it) {\n return wmhas(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\nmodule.exports = function (argument) {\n return typeof argument == 'function';\n};\n","var fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","var isCallable = require('../internals/is-callable');\n\nmodule.exports = function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n","module.exports = false;\n","var getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n var $Symbol = getBuiltIn('Symbol');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n","var toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n","var fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nvar CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {\n return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;\n});\n\nvar TEMPLATE = String(String).split('String');\n\nvar makeBuiltIn = module.exports = function (value, name, options) {\n if (String(name).slice(0, 7) === 'Symbol(') {\n name = '[' + String(name).replace(/^Symbol\\(([^)]*)\\)/, '$1') + ']';\n }\n if (options && options.getter) name = 'get ' + name;\n if (options && options.setter) name = 'set ' + name;\n if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {\n if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });\n else value.name = name;\n }\n if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {\n defineProperty(value, 'length', { value: options.arity });\n }\n try {\n if (options && hasOwn(options, 'constructor') && options.constructor) {\n if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });\n // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable\n } else if (value.prototype) value.prototype = undefined;\n } catch (error) { /* empty */ }\n var state = enforceInternalState(value);\n if (!hasOwn(state, 'source')) {\n state.source = TEMPLATE.join(typeof name == 'string' ? name : '');\n } return value;\n};\n\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n// eslint-disable-next-line no-extend-native -- required\nFunction.prototype.toString = makeBuiltIn(function toString() {\n return isCallable(this) && getInternalState(this).source || inspectSource(this);\n}, 'toString');\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es-x/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n","/* eslint-disable es-x/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/engine-v8-version');\nvar fails = require('../internals/fails');\n\n// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol();\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n return !String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));\n","/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != 'undefined'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es-x/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es-x/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es-x/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n","var call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw $TypeError(\"Can't convert object to primitive value\");\n};\n","var getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n","var $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw $TypeError(\"Can't call method on \" + it);\n return it;\n};\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","var global = require('../internals/global');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || defineGlobalProperty(SHARED, {});\n\nmodule.exports = store;\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.24.1',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n","var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","var trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n","var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return $Object(requireObjectCoercible(argument));\n};\n","var call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = 'default';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw $TypeError(\"Can't convert object to primitive value\");\n }\n if (pref === undefined) pref = 'number';\n return ordinaryToPrimitive(input, pref);\n};\n","var toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, 'string');\n return isSymbol(key) ? key : key + '';\n};\n","var $String = String;\n\nmodule.exports = function (argument) {\n try {\n return $String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.0.toString);\n\nmodule.exports = function (key) {\n return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n","/* eslint-disable es-x/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n && !Symbol.sham\n && typeof Symbol.iterator == 'symbol';\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n value: 42,\n writable: false\n }).prototype != 42;\n});\n","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar symbolFor = Symbol && Symbol['for'];\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {\n var description = 'Symbol.' + name;\n if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {\n WellKnownSymbolsStore[name] = Symbol[name];\n } else if (USE_SYMBOL_AS_UID && symbolFor) {\n WellKnownSymbolsStore[name] = symbolFor(description);\n } else {\n WellKnownSymbolsStore[name] = createWellKnownSymbol(description);\n }\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar fails = require('../internals/fails');\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// FF99+ bug\nvar BROKEN_ON_SPARSE = fails(function () {\n return !Array(1).includes();\n});\n\n// `Array.prototype.includes` method\n// https://tc39.es/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","/**\n * All event listeners\n *\n * https://developers.facebook.com/docs/meta-pixel/reference\n * */\n\n// Load pixel event\njQuery(document).on(\"wpmLoadPixels\", () => {\n\n\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t}\n})\n\n// AddToCart event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideAddToCart\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"AddToCart\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// InitiateCheckout event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideBeginCheckout\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"InitiateCheckout\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// AddToWishlist event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideAddToWishlist\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"AddToWishlist\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// ViewContent event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideViewItem\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"ViewContent\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n\n// view search event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideSearch\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Search\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", () => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// view order received page event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideOrderReceivedPage\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n","/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fbUserData\n\n\twpm.loadFacebookPixel = () => {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tlet data = {}\n\n\t\t\t// Add user identifiers to data,\n\t\t\t// and only if fbp was set\n\t\t\tif (wpm.isFbpSet()) {\n\t\t\t\tdata = {...wpm.getUserIdentifiersForFb()}\n\t\t\t}\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id, data)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// https://developers.facebook.com/docs/meta-pixel/advanced/advanced-matching\n\twpm.getUserIdentifiersForFb = () => {\n\n\t\tlet data = {}\n\n\t\t// external ID\n\t\tif (wpmDataLayer?.user?.id) data.external_id = wpmDataLayer.user.id\n\t\tif (wpmDataLayer?.order?.user_id) data.external_id = wpmDataLayer.order.user_id\n\n\t\t// email\n\t\tif (wpmDataLayer?.user?.facebook?.email) data.em = wpmDataLayer.user.facebook.email\n\t\tif (wpmDataLayer?.order?.billing_email_hashed) data.em = wpmDataLayer.order.billing_email_hashed\n\n\t\t// first name\n\t\tif (wpmDataLayer?.user?.facebook?.first_name) data.fn = wpmDataLayer.user.facebook.first_name\n\t\tif (wpmDataLayer?.order?.billing_first_name) data.fn = wpmDataLayer.order.billing_first_name.toLowerCase()\n\n\t\t// last name\n\t\tif (wpmDataLayer?.user?.facebook?.last_name) data.ln = wpmDataLayer.user.facebook.last_name\n\t\tif (wpmDataLayer?.order?.billing_last_name) data.ln = wpmDataLayer.order.billing_last_name.toLowerCase()\n\n\t\t// phone\n\t\tif (wpmDataLayer?.user?.facebook?.phone) data.ph = wpmDataLayer.user.facebook.phone\n\t\tif (wpmDataLayer?.order?.billing_phone) data.ph = wpmDataLayer.order.billing_phone.replace(\"+\", \"\")\n\n\t\t// city\n\t\tif (wpmDataLayer?.user?.facebook?.city) data.ct = wpmDataLayer.user.facebook.city\n\t\tif (wpmDataLayer?.order?.billing_city) data.ct = wpmDataLayer.order.billing_city.toLowerCase().replace(/ /g, \"\")\n\n\t\t// state\n\t\tif (wpmDataLayer?.user?.facebook?.state) data.st = wpmDataLayer.user.facebook.state\n\t\tif (wpmDataLayer?.order?.billing_state) data.st = wpmDataLayer.order.billing_state.toLowerCase().replace(/[a-zA-Z]{2}-/, \"\")\n\n\t\t// postcode\n\t\tif (wpmDataLayer?.user?.facebook?.postcode) data.zp = wpmDataLayer.user.facebook.postcode\n\t\tif (wpmDataLayer?.order?.billing_postcode) data.zp = wpmDataLayer.order.billing_postcode\n\n\t\t// country\n\t\tif (wpmDataLayer?.user?.facebook?.country) data.country = wpmDataLayer.user.facebook.country\n\t\tif (wpmDataLayer?.order?.billing_country) data.country = wpmDataLayer.order.billing_country.toLowerCase()\n\n\t\treturn data\n\t}\n\n\twpm.getFbRandomEventId = () => (Math.random() + 1).toString(36).substring(2)\n\n\twpm.getFbUserData = () => {\n\n\t\t/**\n\t\t * We need to cache the FB user data for InitiateCheckout\n\t\t * where getting the user data from the browser is too slow\n\t\t * using wpm.getCookie().\n\t\t *\n\t\t * And we need the object merge because the ViewContent hit happens too fast\n\t\t * after adding a variation to the cart because the function to cache\n\t\t * the user data is too slow.\n\t\t *\n\t\t * But we can get the user_data using wpm.getCookie()\n\t\t * because we don't move away from the page and can wait for the browser\n\t\t * to get it.\n\t\t *\n\t\t * Also, the merge ensures that new data will be added to fbUserData if new\n\t\t * data is being added later, like user ID, or fbc.\n\t\t */\n\n\t\tfbUserData = {...fbUserData, ...wpm.getFbUserDataFromBrowser()}\n\n\t\treturn fbUserData\n\t}\n\n\twpm.setFbUserData = () => {\n\t\tfbUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = () => {\n\n\t\tlet\n\t\t\tdata = {}\n\n\t\tif (wpm.getCookie(\"_fbp\") && wpm.isValidFbp(wpm.getCookie(\"_fbp\"))) {\n\t\t\tdata.fbp = wpm.getCookie(\"_fbp\")\n\t\t}\n\n\t\tif (wpm.getCookie(\"_fbc\") && wpm.isValidFbc(wpm.getCookie(\"_fbc\"))) {\n\t\t\tdata.fbc = wpm.getCookie(\"_fbc\")\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.external_id = wpmDataLayer.user.id\n\t\t}\n\n\t\tif (navigator.userAgent) {\n\t\t\tdata.client_user_agent = navigator.userAgent\n\t\t}\n\n\t\treturn data\n\t}\n\n\twpm.isFbpSet = () => {\n\t\treturn !!wpm.getCookie(\"_fbp\")\n\t}\n\n\t// https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/\n\twpm.isValidFbp = fbp => {\n\n\t\tlet re = new RegExp(/^fb\\.[0-2]\\.\\d{13}\\.\\d{8,20}$/)\n\n\t\treturn re.test(fbp)\n\t}\n\n\t// https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/\n\twpm.isValidFbc = fbc => {\n\n\t\tlet re = new RegExp(/^fb\\.[0-2]\\.\\d{13}\\.[\\da-zA-Z_-]{8,}/)\n\n\t\treturn re.test(fbc)\n\t}\n\n\t// wpm.fbViewContent = (product = null) => {\n\t//\n\t// \ttry {\n\t// \t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\t//\n\t// \t\tlet eventId = wpm.getFbRandomEventId()\n\t//\n\t// \t\tlet data = {}\n\t//\n\t// \t\tif (product) {\n\t// \t\t\tdata.content_type = \"product\"\n\t// \t\t\tdata.content_name = product.name\n\t// \t\t\t// data.content_category = product.category\n\t// \t\t\tdata.content_ids = product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]\n\t// \t\t\tdata.currency = wpmDataLayer.shop.currency\n\t// \t\t\tdata.value = product.price\n\t// \t\t}\n\t//\n\t// \t\tfbq(\"track\", \"ViewContent\", data, {\n\t// \t\t\teventID: eventId,\n\t// \t\t})\n\t//\n\t// \t\tlet capiData = {\n\t// \t\t\tevent_name : \"ViewContent\",\n\t// \t\t\tevent_id : eventId,\n\t// \t\t\tuser_data : wpm.getFbUserData(),\n\t// \t\t\tevent_source_url: window.location.href,\n\t// \t\t}\n\t//\n\t// \t\tif (product) {\n\t// \t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\t// \t\t\tcapiData.custom_data = wpm.fbGetProductDataForCapiEvent(product)\n\t// \t\t}\n\t//\n\t// \t\tjQuery(document).trigger(\"wpmFbCapiEvent\", capiData)\n\t// \t} catch (e) {\n\t// \t\tconsole.error(e)\n\t// \t}\n\t// }\n\n\twpm.fbGetProductDataForCapiEvent = product => {\n\t\treturn {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : [\n\t\t\t\tproduct.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}\n\t}\n\n\twpm.facebookContentIds = () => {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n\twpm.trackCustomFacebookEvent = (eventName, customData = {}) => {\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getFbRandomEventId()\n\n\t\t\tfbq(\"trackCustom\", eventName, customData, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : eventName,\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t\tcustom_data : customData,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fbGetContentIdsFromCart = () => {\n\n\t\tlet content_ids = []\n\n\t\tfor(const key in wpmDataLayer.cart){\n\t\t\tcontent_ids.push(wpmDataLayer.products[key].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])\n\t\t}\n\t\t\n\t\treturn content_ids\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Facebook loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n\n","/**\n * Load Google Ads event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\titems : [{\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}],\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item_list\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\tvalue : product.quantity * product.price,\n\t\t\titems : [{\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tquantity : product.quantity,\n\t\t\t\tprice : product.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}],\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"add_to_cart\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", (event, product = null) => {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t}\n\n\t\tif (product) {\n\t\t\tdata.value = (product.quantity ? product.quantity : 1) * product.price\n\t\t\tdata.items = [{\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n\t\t\t\tprice : product.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}]\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t// value : 1 * product.price,\n\t\t\titems: products,\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", data)\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// conversion event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpm.getGoogleAdsConversionIdentifiersWithLabel())) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.clv_order_value_filtered) {\n\t\t\tdata_basic.customer_lifetime_value = wpmDataLayer.order.clv_order_value_filtered\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata_basic.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load Google Ads functions\n * */\n\n(function (wpm, $, undefined) {\n\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\n\t\tlet conversionIdentifiers = []\n\n\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds) {\n\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\tif (item) {\n\t\t\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google Ads\n */\n\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Google Universal Analytics (GA3) event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency: wpmDataLayer.order.currency,\n\t\t\t\tcategory: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItem = wpm.ga3AddListNameToProduct(orderItem)\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.ga3AddListNameToProduct = function (item_data, productPosition = null) {\n\n\t\t// if (wpm.ga3CanProductListBeSet(item_data.id)) {\n\t\t// \titem_data.listname = wpmDataLayer.shop.list_name\n\t\t//\n\t\t// \tif (productPosition) {\n\t\t// \t\titem_data.list_position = productPosition\n\t\t// \t}\n\t\t// }\n\n\t\titem_data.list_name = wpmDataLayer.shop.list_name\n\n\t\tif (productPosition) {\n\t\t\titem_data.list_position = productPosition\n\t\t}\n\n\t\treturn item_data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Google Universal Analytics (GA3) loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load GA4 event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load GA4 functions\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * GA4 loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Google Analytics loader\n */\n\nrequire(\"./ga3/loader\")\nrequire(\"./ga4/loader\")\n","/**\n * Load Google base event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\tif (wpm.canGoogleLoad()) {\n\t\t\twpm.loadGoogle()\n\t\t} else {\n\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t}\n\t}\n})\n","/**\n * Load Google base functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to set on the window object\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (wpmDataLayer?.shop?.page_type && \"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\t// window.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\n\t\t\t\tgtag(\"set\", \"user_data\", wpmDataLayer.order.google.ads.enhanced_conversion_data)\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tlet parameters = wpmDataLayer.pixels.google.analytics.ga4.parameters\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.debug_mode) {\n\t\t\t\tparameters.debug_mode = true\n\t\t\t}\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, parameters)\n\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.then(function (script, textStatus) {\n\n\t\t\t\t\ttry {\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google base\n */\n\n// Load base\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load Google\n */\n\n// Load base\nrequire(\"./base/loader\")\n\n//Load additional Google libraries\nrequire(\"./ads/loader\")\nrequire(\"./analytics/loader\")\nrequire(\"./optimize/loader\")\n\n\n","/**\n * Load Google Optimize event listeners\n */\n\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t}\n})\n","/**\n * Load Google Optimize functions\n */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .then(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google Optimize\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Hotjar event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t}\n})\n","/**\n * Load Hotjar functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Hotjar loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Consent Mode functions\n */\n\n(function (wpm, $, undefined) {\n\n\n\t/**\n\t * Handle Cookie Management Platforms\n\t */\n\n\tlet getComplianzCookies = () => {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = () => {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-performance\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = () => wpmConsentValues\n\n\twpm.setConsentValueCategories = (analytics = false, ads = false) => {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = (analytics = null, ads = null, explicitConsent = false) => {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\tlet cookie\n\n\t\tif (analytics || ads) {\n\n\t\t\tif (analytics) {\n\t\t\t\twpmConsentValues.categories.analytics = !!analytics\n\t\t\t}\n\t\t\tif (ads) {\n\t\t\t\twpmConsentValues.categories.ads = !!ads\n\t\t\t}\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieConsent\")) {\n\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = () => {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = (category, pixelName) => {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\n\t\t\t// If a user sets \"bing-ads\" in Borlabs Cookie instead of\n\t\t\t// \"microsoft-ads\" in the Borlabs settings, we need to check\n\t\t\t// for that too.\n\t\t\tif (false === canIFireMode && \"microsoft-ads\" === pixelName) {\n\t\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(\"bing-ads\")\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = (pixelName, category) => {\n\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"Pixel Manager for WooCommerce: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"Pixel Manager for WooCommerce: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\t// jQuery(document).on(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\tdocument.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = node => {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = (scriptNode, removeAttach = false) => {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\t// jQuery(document).trigger(\"wpmPreLoadPixels\")\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t}\n\n\twpm.blockScript = (scriptNode, removeAttach = false) => {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = (analytics = true, ads = true) => {\n\t\t// jQuery(document).trigger(\"wpmPreLoadPixels\")\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t}\n\n\twpm.unblockSelectedPixels = () => {\n\t\t// jQuery(document).trigger(\"wpmPreLoadPixels\")\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\t// jQuery(document).on(\"borlabs-cookie-consent-saved\", () => {\n\tdocument.addEventListener(\"borlabs-cookie-consent-saved\", () => {\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\t// jQuery(document).on(\"CookiebotOnAccept\", () => {\n\tdocument.addEventListener(\"CookiebotOnAccept\", () => {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\t// jQuery(document).on(\"CookieScriptAccept\", e => {\n\tdocument.addEventListener(\"CookieScriptAccept\", e => {\n\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\t// jQuery(document).on(\"CookieScriptAcceptAll\", () => {\n\tdocument.addEventListener(\"CookieScriptAcceptAll\", () => {\n\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t/**\n\t * Complianz Cookie\n\t *\n\t * If visitor accepts cookies in Complianz unblock the scripts\n\t */\n\n\twpm.cmplzStatusChange = (cmplzConsentData) => {\n\n\t\tif (cmplzConsentData.detail.categories.includes(\"statistics\")) wpm.updateConsentCookieValues(true, null)\n\t\tif (cmplzConsentData.detail.categories.includes(\"marketing\")) wpm.updateConsentCookieValues(null, true)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t}\n\n\t// jQuery(document).on(\"cmplzStatusChange\", wpm.cmplzStatusChange)\n\tdocument.addEventListener(\"cmplzStatusChange\", wpm.cmplzStatusChange)\n\t// jQuery(document).on(\"cmplz_status_change\", wpm.cmplzStatusChange)\n\tdocument.addEventListener(\"cmplz_status_change\", wpm.cmplzStatusChange)\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t// jQuery(document).on(\"setCookieNotice\", () => {\n\tdocument.addEventListener(\"setCookieNotice\", () => {\n\t\twpm.updateConsentCookieValues()\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(mutations => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\t// jQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t// jQuery(\".hu-cookies-save\") in pure JavaScript\n\t\t\t\t\t\tdocument.querySelector(\".hu-cookies-save\").addEventListener(\"click\", () => {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.explicitConsentStateAlreadySet = () => {\n\n\t\tif (wpmConsentValues.explicitConsentStateAlreadySet) {\n\t\t\treturn true\n\t\t} else {\n\t\t\twpmConsentValues.explicitConsentStateAlreadySet = true\n\t\t}\n\t}\n\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Register event listeners\n */\n\n// remove_from_cart event\n// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", (event) => {\n\n\ttry {\n\n\t\tlet url = new URL(jQuery(event.currentTarget).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", (event) => {\n\n\ttry {\n\n\t\tlet quantity = 1,\n\t\t\tproductId\n\n\t\t// Only process on product pages\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// First process related and upsell products\n\t\t\tif (typeof jQuery(event.currentTarget).attr(\"href\") !== \"undefined\" && jQuery(event.currentTarget).attr(\"href\").includes(\"add-to-cart\")) {\n\n\t\t\t\tproductId = jQuery(event.currentTarget).data(\"product_id\")\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t\t// If is simple product\n\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\tquantity = Number(jQuery(\".input-text.qty\").val())\n\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\tproductId = jQuery(event.currentTarget).val()\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t\t// If is variable product or variable-subscription\n\t\t\tif ([\"variable\", \"variable-subscription\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\n\t\t\t\tquantity = Number(jQuery(\".input-text.qty\").val())\n\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\tproductId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t\t// If is grouped product\n\t\t\tif (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each((index, element) => {\n\n\t\t\t\t\tquantity = Number(jQuery(element).find(\".input-text.qty\").val())\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\t\tlet classes = jQuery(element).attr(\"class\")\n\t\t\t\t\tproductId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// If is bundle product\n\t\t\tif (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\tquantity = Number(jQuery(\".input-text.qty\").val())\n\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\tproductId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tproductId = jQuery(event.currentTarget).data(\"product_id\")\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\n// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", (event) => {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", (event) => {\n\n\ttry {\n\n\t\t/**\n\t\t * On some pages the event fires multiple times, and on product pages\n\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t * but I don't know why. We don't even have to use this, since only a real\n\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t * events out later down in the code. I'll keep it that way because this is\n\t\t * the most compatible way across shops.\n\t\t *\n\t\t * e.stopPropagation();\n\t\t * */\n\n\t\tlet productId = jQuery(event.currentTarget).nextAll(\".wpmProductId:first\").data(\"id\")\n\n\t\t/**\n\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t * related products, which are found below.\n\t\t */\n\n\t\tif (productId) {\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\nlet checkoutButtonClasses = [\n\t\".checkout-button\",\n\t\".cart-checkout-button\",\n\t\".button.checkout\",\n\t\".xoo-wsc-ft-btn-checkout\", // https://xootix.com/side-cart-for-woocommerce/\n\t\".elementor-button--checkout\",\n]\n\n// https://wordpress.stackexchange.com/a/352171/68337\njQuery(document).one(\"click init_checkout\", checkoutButtonClasses.join(\",\"), () => {\n\t// console.log(\"begin_checkout\", new Date().getTime())\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\njQuery(document).on(\"input\", \"#billing_email\", (event) => {\n\n\tif (wpm.isEmail(jQuery(event.currentTarget).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\n// https://wordpress.stackexchange.com/a/352171/68337\njQuery(document).on(\"wpmLoad\", (event) => {\n\tjQuery(document).on(\"payment_method_selected\", () => {\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t}\n\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\twpm.paymentMethodSelected = true\n\t})\n})\n\n// track checkout option event: purchase click\n// jQuery(document).one(\"click\", \"#place_order\", () => {\n// https://stackoverflow.com/a/34112407/4688612\njQuery(() => {\n\tjQuery(\"form.checkout\").on(\"checkout_place_order_success\", () => {\n\n\t\tif (false === wpm.emailSelected) {\n\t\t\twpm.fireCheckoutProgress(2)\n\t\t}\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\t}\n\n\t\twpm.fireCheckoutProgress(4)\n\t})\n})\n\n// update cart event\n// jQuery(\"[name='update_cart']\").on('click', function (e) {\njQuery(document).on(\"click\", \"[name='update_cart']\", (event) => {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each((index, element) => {\n\n\t\t\tlet url = new URL(jQuery(element).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\tlet quantity = jQuery(element).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\njQuery(function () {\n\n\tjQuery(\".add_to_wishlist,.wl-add-to\").on(\"click\", event => {\n\n\t\ttry {\n\n\t\t\tlet productId\n\n\t\t\tif (jQuery(event.currentTarget).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\n\t\t\t\tproductId = jQuery(event.currentTarget).data(\"productid\")\n\t\t\t} else if (jQuery(event.currentTarget).data(\"product-id\")) { // for the YITH wishlist plugin\n\n\t\t\t\tproductId = jQuery(event.currentTarget).data(\"product-id\")\n\t\t\t}\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\n\t\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\njQuery(document).on(\"updated_cart_totals\", () => {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n/**\n * Called when the user selects all the required dropdowns / attributes\n *\n * Has to be hooked after document ready !\n *\n * https://stackoverflow.com/a/27849208/4688612\n * https://stackoverflow.com/a/65065335/4688612\n */\n\njQuery(() => {\n\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", (event, variation) => {\n\n\t\ttry {\n\t\t\tlet productId = wpm.getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\twpm.triggerViewItemEventPrep(productId)\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\n\n/**\n * Called on variable products when no selection has been done yet\n * or when the visitor deselects his choice.\n *\n * Has to be hooked after document ready !\n */\n\n// jQuery(function () {\n//\n// \tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n//\n// \t\ttry {\n// \t\t\tlet classes = jQuery(\"body\").attr(\"class\")\n// \t\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n//\n// \t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n//\n// \t\t\t/**\n// \t\t\t * If we have a variable product with no preset,\n// \t\t\t * and variations output is enabled,\n// \t\t\t * then we send a viewItem event with the first\n// \t\t\t * variation we find for the parent.\n// \t\t\t * If variations output is disabled,\n// \t\t\t * we just send the parent ID.\n// \t\t\t *\n// \t\t\t * And if Facebook microdata is active, use the\n// \t\t\t * microdata product ID.\n// \t\t\t */\n//\n// \t\t\tif (\n// \t\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n// \t\t\t\twpmDataLayer?.general?.variationsOutput\n// \t\t\t) {\n// \t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n// \t\t\t\t\tif (\"parentId\" in product) {\n//\n// \t\t\t\t\t\tproductId = product.id\n// \t\t\t\t\t\tbreak\n// \t\t\t\t\t}\n// \t\t\t\t}\n//\n// \t\t\t\tif (wpmDataLayer?.pixels?.facebook?.microdata_product_id) {\n// \t\t\t\t\tproductId = wpmDataLayer.pixels.facebook.microdata_product_id\n// \t\t\t\t}\n// \t\t\t}\n//\n// \t\t\t// console.log(\"hmm\")\n// \t\t\twpm.triggerViewItemEventPrep(productId)\n//\n// \t\t} catch (e) {\n// \t\t\tconsole.error(e)\n// \t\t}\n// \t})\n// })\n\n// jQuery(function () {\n//\n// \tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n// \t\tjQuery(document).trigger(\"wpmviewitem\")\n// \t})\n// })\n\n\n/**\n * Set up wpm events\n */\n\n// populate the wpmDataLayer with the cart items\njQuery(document).on(\"wpmLoad\", () => {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(document).on(\"wpmLoad\", () => {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(document).on(\"wpmLoad\", () => {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t}\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(document).on(\"wpmLoad\", () => {\n\t// document.addEventListener(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (wpmDataLayer?.shop) {\n\t\t\t\tif (\n\t\t\t\t\t\"product\" === wpmDataLayer.shop.page_type &&\n\t\t\t\t\t\"variable\" !== wpmDataLayer.shop.product_type &&\n\t\t\t\t\twpm.getMainProductIdFromProductPage()\n\t\t\t\t) {\n\t\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\t\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\t\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\t\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\t\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\t\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\t\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\t\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\t\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t\t\tif (typeof wpm.acrRemoveCookie === \"function\") wpm.acrRemoveCookie()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"wpmLoad\", async () => {\n\n\tif (\n\t\twindow.sessionStorage &&\n\t\twindow.sessionStorage.getItem(\"_pmw_endpoint_available\") &&\n\t\t!JSON.parse(window.sessionStorage.getItem(\"_pmw_endpoint_available\"))\n\t) {\n\t\tconsole.error(\"Pixel Manager for WooCommerce: REST endpoint is not available. Using admin-ajax.php instead.\")\n\t}\n})\n\n\n/**\n * Load all pixels\n */\njQuery(document).on(\"wpmPreLoadPixels\", () => {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent && !wpm.explicitConsentStateAlreadySet()) {\n\t\twpm.updateConsentCookieValues(null, null, true)\n\t}\n\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n\n\n/**\n * All ecommerce events\n */\n\njQuery(document).on(\"wpmAddToCart\", (event, product) => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent : \"addToCart\",\n\t\tproduct: product,\n\t}\n\n\t// If Facebook pixel is loaded, add Facebook server to server event data to the payload\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : wpm.fbGetProductDataForCapiEvent(product),\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideAddToCart\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmBeginCheckout\", () => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent: \"beginCheckout\",\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {},\n\t\t}\n\n\t\tif (wpmDataLayer?.cart && !jQuery.isEmptyObject(wpmDataLayer.cart)) {\n\t\t\tpayload.facebook.custom_data = {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_ids : wpm.fbGetContentIdsFromCart(),\n\t\t\t\tvalue : wpm.getCartValue(),\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideBeginCheckout\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmAddToWishlist\", (event, product) => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent : \"addToWishlist\",\n\t\tproduct: product,\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : wpm.fbGetProductDataForCapiEvent(product),\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideAddToWishlist\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmViewItem\", (event, product = null) => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent : \"viewItem\",\n\t\tproduct: product,\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"ViewContent\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {},\n\t\t}\n\n\t\tif (product) {\n\t\t\tpayload.facebook.custom_data = wpm.fbGetProductDataForCapiEvent(product)\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideViewItem\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmSearch\", () => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent: \"search\",\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {\n\t\t\t\tsearch_string: wpm.getSearchTermFromUrl(),\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideSearch\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmOrderReceivedPage\", () => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent: \"orderReceived\",\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"Purchase\",\n\t\t\tevent_id : wpmDataLayer.order.id,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideOrderReceivedPage\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// ! No server-to-server event is sent for this event because it is compiled and sent from the server directly\n})\n\n\n\n\n\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookiePmwRestEndpointAvailable: \"_pmw_endpoint_available\",\n\t\trestEndpointPost : \"pmw/v1/test/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = () => {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = () => window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\n\twpm.isRestEndpointAvailable = async () => {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable))\n\t\t} else {\n\t\t\treturn await wpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = () => !!window.sessionStorage\n\n\t// Test the endpoint by sending a POST request\n\twpm.testEndpoint = async (\n\t\turl = wpm.root + wpmRestSettings.restEndpointPost,\n\t\tcookieName = wpmRestSettings.cookiePmwRestEndpointAvailable,\n\t) => {\n\n\t\tlet response = await fetch(url, {\n\t\t\tmethod : \"POST\",\n\t\t\tmode : \"cors\",\n\t\t\tcache : \"no-cache\",\n\t\t\tkeepalive: true,\n\t\t})\n\n\t\tif (response.status === 200) {\n\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\treturn true\n\t\t} else if (response.status === 404) {\n\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\treturn false\n\t\t} else if (response.status === 0) {\n\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isWpmRestEndpointAvailable = (cookieName = wpmRestSettings.cookiePmwRestEndpointAvailable) => !!wpm.getCookie(cookieName)\n\n\twpm.writeOrderIdToStorage = (orderId, source = \"thankyou_page\", expireDays = 365) => {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId, source)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = orderId => {\n\n\t\tif (wpmDataLayer.orderDeduplication) {\n\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = email => {\n\n\t\t// https://emailregex.com/\n\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = (productId, quantityToRemove = null) => {\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\t\t}\n\t}\n\n\twpm.getIdBasedOndVariationsOutputSetting = productId => {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = (productId, quantity) => {\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = () => {\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = () => {\n\t\ttry {\n\n\t\t\t/**\n\t\t\t * Can't use a REST API endpoint, as the cart session will not be loaded if the\n\t\t\t * endpoint is called.\n\t\t\t *\n\t\t\t * https://wordpress.org/support/topic/wc-cart-is-null-in-custom-rest-api/#post-11442843\n\t\t\t */\n\n\t\t\t/**\n\t\t\t * Get the cart items from the backend the data object using fetch API\n\t\t\t * and log success or error messages\n\t\t\t * and url encoded data\n\t\t\t */\n\t\t\tfetch(wpm.ajax_url, {\n\t\t\t\tmethod : \"POST\",\n\t\t\t\tcache : \"no-cache\",\n\t\t\t\tbody : new URLSearchParams({action: \"pmw_get_cart_items\"}),\n\t\t\t\tkeepalive: true,\n\t\t\t})\n\t\t\t\t.then(response => {\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\treturn response.json()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow Error(\"Error getting cart items from backend\")\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.then(data => {\n\n\t\t\t\t\tif (data.success) {\n\n\t\t\t\t\t\tif (!data.data[\"cart\"]) data.data[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(data.data[\"cart\"])\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(data.data[\"cart\"]))\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow Error(\"Error getting cart items from backend\")\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// get productIds from the backend\n\twpm.getProductsFromBackend = async productIds => {\n\n\t\tif (wpmDataLayer?.products) {\n\t\t\t// reduce productIds by products already in the dataLayer\n\t\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\t\t}\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\n\t\t\tlet response\n\n\t\t\tif (await wpm.isRestEndpointAvailable()) {\n\t\t\t\tresponse = await fetch(wpm.root + \"pmw/v1/products/\", {\n\t\t\t\t\tmethod : \"POST\",\n\t\t\t\t\tcache : \"no-cache\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t},\n\t\t\t\t\tbody : JSON.stringify(productIds),\n\t\t\t\t})\n\t\t\t} else {\n\n\t\t\t\t// Get the product details from the backend the data object using fetch API\n\t\t\t\t// and log success or error messages\n\t\t\t\t// and url encoded data\n\t\t\t\tresponse = await fetch(wpm.ajax_url, {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tcache : \"no-cache\",\n\t\t\t\t\tbody : new URLSearchParams({\n\t\t\t\t\t\taction : \"pmw_get_product_ids\",\n\t\t\t\t\t\tproductIds: productIds,\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (response.ok) {\n\t\t\t\tlet responseData = await response.json()\n\t\t\t\tif (responseData.success) {\n\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, responseData.data)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconsole.error(\"Error getting products from backend\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\n\t\treturn true\n\t}\n\n\twpm.saveCartObjectToDataLayer = cartObject => {\n\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.triggerViewItemEventPrep = async productId => {\n\n\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\twpm.triggerViewItemEvent(productId)\n\t\t} else {\n\t\t\tawait wpm.getProductsFromBackend([productId])\n\t\t\twpm.triggerViewItemEvent(productId)\n\t\t}\n\t}\n\n\twpm.triggerViewItemEvent = productId => {\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t}\n\n\twpm.triggerViewItemEventNoProduct = () => {\n\t\tjQuery(document).trigger(\"wpmViewItem\")\n\t}\n\n\twpm.fireCheckoutOption = (step, checkout_option = null, value = null) => {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = step => {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = string => {\n\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = productId => {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = productId => {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getMainProductIdFromProductPage = () => {\n\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = target => {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = () => {\n\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = (entries, observer) => {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = () => {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = () => {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\tallIoElementsToWatch.each((i, elem) => {\n\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = () => {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(mutations => {\n\n\t\tmutations.forEach(mutation => {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = elem =>\n\t\t!!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\n\twpm.setCookie = (cookieName, cookieValue = \"\", expiryDays = null) => {\n\n\t\tif (expiryDays) {\n\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = cookieName => {\n\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\n\t\tfor (let i = 0; i < ca.length; i++) {\n\n\t\t\tlet c = ca[i]\n\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\n\t\treturn \"\"\n\t}\n\n\twpm.deleteCookie = cookieName => {\n\t\twpm.setCookie(cookieName, \"\", -1)\n\t}\n\n\twpm.getWpmSessionData = () => {\n\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = data => {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = async (orderId, source) => {\n\n\t\ttry {\n\n\t\t\tlet response\n\n\t\t\tif (await wpm.isRestEndpointAvailable()) {\n\n\t\t\t\tresponse = await fetch(wpm.root + \"pmw/v1/pixels-fired/\", {\n\t\t\t\t\tmethod : \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t},\n\t\t\t\t\tbody : JSON.stringify({\n\t\t\t\t\t\torder_id: orderId,\n\t\t\t\t\t\tsource: source\n\t\t\t\t\t}),\n\t\t\t\t\tkeepalive: true,\n\t\t\t\t\tcache\t: \"no-cache\",\n\t\t\t\t})\n\n\t\t\t} else {\n\t\t\t\t// save the state in the database\n\n\t\t\t\t// Send the data object with ajax request\n\t\t\t\t// and log success or error using fetch API and url encoded\n\t\t\t\tresponse = await fetch(wpm.ajax_url, {\n\t\t\t\t\tmethod : \"POST\",\n\t\t\t\t\tbody : new URLSearchParams({\n\t\t\t\t\t\taction : \"pmw_purchase_pixels_fired\",\n\t\t\t\t\t\torder_id: orderId,\n\t\t\t\t\t\tsource : source,\n\t\t\t\t\t}),\n\t\t\t\t\tkeepalive: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (response.ok) {\n\t\t\t\tconsole.log(\"wpm.storeOrderIdOnServer success\")\n\t\t\t} else {\n\t\t\t\tconsole.error(\"wpm.storeOrderIdOnServer error\")\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = url => {\n\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = () =>\n\t\tjQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\n\twpm.getProductDetailsFormattedForEvent = (productId, quantity = 1) => {\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = () => {\n\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = () => {\n\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = (clidId = \"gclid\") => {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = () => navigator.userAgent\n\n\twpm.getViewPort = () => ({\n\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t})\n\n\n\twpm.version = () => {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = url => {\n\n\t\t// Get and load the script using fetch API, if possible from cache, and return it without using eval\n\t\treturn fetch(url, {\n\t\t\tmethod : \"GET\",\n\t\t\tcache : \"default\",\n\t\t\tkeepalive: true,\n\t\t})\n\t\t\t.then(response => {\n\t\t\t\tif (response.ok) {\n\t\t\t\t\t// console.log(\"response\", response)\n\t\t\t\t\treturn response.text()\n\t\t\t\t\t// console.log(\"wpm.loadScriptAndCacheIt success: \" + url)\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Network response was not ok: \" + url)\n\t\t\t\t}\n\t\t\t})\n\t\t\t.then(script => {\n\t\t\t\t// Execute the script\n\t\t\t\t// console.error(\"executing script: \" + script)\n\t\t\t\teval(script)\n\t\t\t\t// console.log(\"executed script: \" + script)\n\t\t\t})\n\t\t\t.catch(e => {\n\t\t\t\tconsole.error(e)\n\t\t\t})\n\t}\n\n\twpm.getOrderItemPrice = orderItem => (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\n\twpm.hasLoginEventFired = () => {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = () => {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = () => new Promise(resolve => {\n\t\t(function waitForVar() {\n\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\tsetTimeout(waitForVar, 50)\n\t\t})()\n\t})\n\n\twpm.jQueryExists = () => new Promise(resolve => {\n\t\t(function waitForjQuery() {\n\t\t\tif (typeof jQuery !== \"undefined\") return resolve()\n\t\t\tsetTimeout(waitForjQuery, 100)\n\t\t})()\n\t})\n\n\twpm.pageLoaded = () => new Promise(resolve => {\n\t\t(function waitForVar() {\n\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\tsetTimeout(waitForVar, 50)\n\t\t})()\n\t})\n\n\twpm.pageReady = () => {\n\t\treturn new Promise(resolve => {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = () => {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = () => document.cookie.includes(\"woocommerce_items_in_cart\")\n\n\twpm.urlHasParameter = parameter => {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n\t// https://stackoverflow.com/a/60606893/4688612\n\twpm.hashAsync = (algo, str) => {\n\t\treturn crypto.subtle.digest(algo, new TextEncoder(\"utf-8\").encode(str)).then(buf => {\n\t\t\treturn Array.prototype.map.call(new Uint8Array(buf), x => ((\"00\" + x.toString(16)).slice(-2))).join(\"\")\n\t\t})\n\t}\n\n\twpm.getCartValue = () => {\n\n\t\tlet value = 0\n\n\t\tif (wpmDataLayer?.cart) {\n\n\t\t\tfor (const key in wpmDataLayer.cart) {\n\t\t\t\t// content_ids.push(wpmDataLayer.products[key].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])\n\n\t\t\t\tlet product = wpmDataLayer.cart[key]\n\n\t\t\t\tvalue += product.quantity * product.price\n\t\t\t}\n\t\t}\n\n\t\treturn value\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load all WPM functions\n *\n * Ignore event listeners. They need to be loaded after\n * we made sure that jQuery has been loaded.\n */\n\nrequire(\"./functions\")\nrequire(\"./cookie_consent\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// #endif\n","/**\n * After WPM is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\n\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"Pixel Manager for WooCommerce: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tdocument.dispatchEvent(new Event(\"wpmLoad\"))\n\t\t})\n\t})\n\n\n\n/**\n * Run when page is ready\n */\n\nwpm.pageReady().then(function () {\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n})\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm/functions_loader\")\n\n// Only load the event listeners after jQuery has been loaded for sure\nwpm.jQueryExists().then(function () {\n\n\trequire(\"./wpm/event_listeners\")\n\n\trequire(\"./google/loader\")\n\trequire(\"./facebook/loader\")\n\trequire(\"./hotjar/loader\")\n\n\t/**\n\t * Load all premium scripts\n\t */\n\n\t// #if process.env.TIER === 'premium'\n// \trequire(\"./wpm/event_listeners_premium\")\n// \trequire(\"./microsoft-ads/loader\")\n// \trequire(\"./pinterest/loader\")\n// \trequire(\"./snapchat/loader\")\n// \trequire(\"./tiktok/loader\")\n// \trequire(\"./twitter/loader\")\n\t// #endif\n\n\n\t/**\n\t * Initiate WPM.\n\t *\n\t * It makes sure that the script flow gets executed correctly,\n\t * no matter how JS \"optimizers\" shuffle the code.\n\t */\n\n\trequire(\"./wpm/init\")\n})\n\n"],"names":["isCallable","require","tryToString","$TypeError","TypeError","module","exports","argument","wellKnownSymbol","create","defineProperty","UNSCOPABLES","ArrayPrototype","Array","prototype","undefined","configurable","value","key","isObject","$String","String","toIndexedObject","toAbsoluteIndex","lengthOfArrayLike","createMethod","IS_INCLUDES","$this","el","fromIndex","O","length","index","includes","indexOf","uncurryThis","toString","stringSlice","slice","it","hasOwn","ownKeys","getOwnPropertyDescriptorModule","definePropertyModule","target","source","exceptions","keys","f","getOwnPropertyDescriptor","i","DESCRIPTORS","createPropertyDescriptor","object","bitmap","enumerable","writable","makeBuiltIn","defineGlobalProperty","options","simple","name","global","unsafe","error","nonConfigurable","nonWritable","Object","fails","get","document","EXISTS","createElement","getBuiltIn","match","version","userAgent","process","Deno","versions","v8","split","createNonEnumerableProperty","defineBuiltIn","copyConstructorProperties","isForced","targetProperty","sourceProperty","descriptor","TARGET","GLOBAL","STATIC","stat","dontCallGetSet","forced","sham","exec","test","bind","hasOwnProperty","NATIVE_BIND","call","Function","apply","arguments","FunctionPrototype","getDescriptor","PROPER","CONFIGURABLE","fn","aFunction","namespace","method","aCallable","V","P","func","check","Math","globalThis","window","self","this","toObject","a","classof","$Object","propertyIsEnumerable","store","functionToString","inspectSource","set","has","NATIVE_WEAK_MAP","shared","sharedKey","hiddenKeys","OBJECT_ALREADY_INITIALIZED","WeakMap","state","wmget","wmhas","wmset","metadata","facade","STATE","enforce","getterFor","TYPE","type","replacement","feature","detection","data","normalize","POLYFILL","NATIVE","string","replace","toLowerCase","isPrototypeOf","USE_SYMBOL_AS_UID","$Symbol","toLength","obj","CONFIGURABLE_FUNCTION_NAME","InternalStateModule","enforceInternalState","getInternalState","CONFIGURABLE_LENGTH","TEMPLATE","getter","setter","arity","constructor","join","ceil","floor","trunc","x","n","V8_VERSION","getOwnPropertySymbols","symbol","Symbol","activeXDocument","anObject","definePropertiesModule","enumBugKeys","html","documentCreateElement","IE_PROTO","EmptyConstructor","scriptTag","content","LT","NullProtoObjectViaActiveX","write","close","temp","parentWindow","NullProtoObject","ActiveXObject","iframeDocument","iframe","domain","style","display","appendChild","src","contentWindow","open","F","Properties","result","V8_PROTOTYPE_DEFINE_BUG","objectKeys","defineProperties","props","IE8_DOM_DEFINE","toPropertyKey","$defineProperty","$getOwnPropertyDescriptor","Attributes","current","propertyIsEnumerableModule","internalObjectKeys","concat","getOwnPropertyNames","push","names","$propertyIsEnumerable","NASHORN_BUG","input","pref","val","valueOf","getOwnPropertyNamesModule","getOwnPropertySymbolsModule","uid","SHARED","IS_PURE","mode","copyright","license","toIntegerOrInfinity","max","min","integer","IndexedObject","requireObjectCoercible","number","isSymbol","getMethod","ordinaryToPrimitive","TO_PRIMITIVE","exoticToPrim","toPrimitive","id","postfix","random","NATIVE_SYMBOL","iterator","WellKnownSymbolsStore","symbolFor","createWellKnownSymbol","withoutSetter","description","$","$includes","addToUnscopables","proto","jQuery","on","wpmDataLayer","pixels","facebook","pixel_id","loaded","wpm","canIFire","loadFacebookPixel","event","payload","fbq","custom_data","eventID","event_id","console","setFbUserData","fbUserData","b","e","callMethod","queue","_fbq","t","async","s","getElementsByTagName","parentNode","insertBefore","isFbpSet","getUserIdentifiersForFb","user","external_id","order","user_id","email","em","billing_email_hashed","first_name","billing_first_name","last_name","ln","billing_last_name","phone","ph","billing_phone","city","ct","billing_city","st","billing_state","postcode","zp","billing_postcode","country","billing_country","getFbRandomEventId","substring","getFbUserData","getFbUserDataFromBrowser","getCookie","isValidFbp","fbp","isValidFbc","fbc","navigator","client_user_agent","RegExp","fbGetProductDataForCapiEvent","product","content_type","content_name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","parseFloat","quantity","price","currency","facebookContentIds","prodIds","item","entries","items","general","variationsOutput","variation_id","products","trackCustomFacebookEvent","eventName","customData","eventId","trigger","event_name","user_data","event_source_url","location","href","fbGetContentIdsFromCart","cart","isEmptyObject","google","ads","conversionIds","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","send_to","getGoogleAdsConversionIdentifiers","google_business_vertical","gtagLoaded","then","gtag","value_filtered","getGoogleAdsDynamicRemarketingOrderItems","getGoogleAdsConversionIdentifiersWithLabel","data_basic","data_with_cart","transaction_id","new_customer","clv_order_value_filtered","customer_lifetime_value","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGoogleAdsRegularOrderItems","conversionIdentifiers","orderItems","orderItem","analytics","universal","property_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","category","variant","variant_name","brand","ga3AddListNameToProduct","item_data","productPosition","list_name","shop","list_position","ga4","measurement_id","getGA4OrderItems","item_name","item_category","item_id","item_variant","item_brand","canGoogleLoad","loadGoogle","logPreventedPixelLoading","consent_mode","active","getConsentValues","categories","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","enhanced_conversions","phone_conversion_label","phone_conversion_number","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","debug_mode","isGoogleActive","getGoogleGtagId","loadScriptAndCacheIt","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","Promise","resolve","reject","startTime","wait","setTimeout","optimize","container_id","load_google_optimize_pixel","hotjar","site_id","load_hotjar_pixel","h","o","hj","q","_hjSettings","hjid","hjsv","r","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","updateConsentCookieValues","cookie","explicitConsent","decodeURI","JSON","parse","action","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","log","scriptTagObserver","MutationObserver","mutations","forEach","addedNodes","node","shouldScriptBeActive","unblockScript","blockScript","observe","head","childList","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","remove","wpmSrc","attr","appendTo","dispatchEvent","Event","removeAttr","unblockAllScripts","unblockSelectedPixels","Cookiebot","consent","detail","cmplzStatusChange","cmplzConsentData","huObserver","querySelector","hu","documentElement","body","explicitConsentStateAlreadySet","url","URL","currentTarget","productId","getProductIdByCartItemKeyUrl","removeProductFromCart","addProductToCart","product_type","Number","each","find","classes","getPostIdFromString","one","closest","matches","nextAll","getIdBasedOndVariationsOutputSetting","Error","getProductDetailsFormattedForEvent","isEmail","fireCheckoutProgress","emailSelected","paymentMethodSelected","fireCheckoutOption","getCartItemsFromBackend","variation","triggerViewItemEventPrep","doesWooCommerceCartExist","getCartItems","productIds","getAddToCartLinkProductIds","getProductsFromBackend","referrer","referrerHostname","hostname","host","setCookie","wpmLoadFired","getMainProductIdFromProductPage","getProductDataForViewItemEvent","isOrderIdStored","writeOrderIdToStorage","acrRemoveCookie","hasLoginEventFired","setLoginEventFired","sessionStorage","getItem","sendEventPayloadToServer","getCartValue","search_string","getSearchTermFromUrl","wpmDeduper","keyName","cookieExpiresDays","wpmRestSettings","cookiePmwRestEndpointAvailable","restEndpointPost","restFails","restFailsThreshold","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","testEndpoint","root","cookieName","response","fetch","cache","keepalive","setItem","stringify","isWpmRestEndpointAvailable","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","toUTCString","storeOrderIdOnServer","orderDeduplication","quantityToRemove","isVariation","parentId","saveCartObjectToDataLayer","ajax_url","URLSearchParams","ok","json","success","filter","headers","responseData","assign","cartObject","triggerViewItemEvent","triggerViewItemEventNoProduct","step","checkout_option","triggerViewItemList","viewItemListTriggerTestMode","css","append","viewItemListTrigger","opacity","backgroundColor","search","ioTimeouts","io","observerCallback","observer","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","timeout","clearTimeout","ioid","allIoElementsToWatch","getAllElementsToWatch","map","elem","parent","hasClass","prev","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","startProductsMutationObserverToWatch","productsNode","parents","first","productsMutationObserver","attributes","characterData","mutation","newNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","c","charAt","deleteCookie","getWpmSessionData","setWpmSessionData","order_id","cartItemKey","cartItemKeys","position","parentId_dyn_r_ids","setReferrerToCookie","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","clientWidth","innerWidth","height","clientHeight","innerHeight","text","eval","catch","getOrderItemPrice","total","total_tax","loginEventFired","wpmDataLayerExists","waitForVar","jQueryExists","waitForjQuery","pageLoaded","readyState","pageReady","isMiniCartActive","parameter","hashAsync","algo","str","crypto","subtle","digest","TextEncoder","encode","buf","Uint8Array","pro","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","g","toStringTag"],"sourceRoot":""}
|
1 |
+
{"version":3,"file":"wpm-public.p1.min.js","mappings":"wCAOAA,OAAOC,UAAUC,GAAG,iBAAiB,KAAM,gBAE1B,QAAZ,EAAAC,oBAAA,mBAAcC,cAAd,mBAAsBC,gBAAtB,UAAgCC,UAAY,UAACH,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,OAAC,EAAgCE,QAC5EC,IAAIC,SAAS,MAAO,iBAAiBD,IAAIE,mBAC7C,IAKFV,OAAOC,UAAUC,GAAG,0BAA0B,CAACS,EAAOC,KAErD,IAAI,UACH,GAAI,UAACT,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,QAAC,EAAgCE,OAAQ,OAE7CM,IAAI,QAAS,YAAaD,EAAQP,SAASS,YAAa,CACvDC,QAASH,EAAQP,SAASW,UAI3B,CAFC,MAAOC,GACRC,QAAQD,MAAMA,EACd,KAKFjB,OAAOC,UAAUC,GAAG,8BAA8B,CAACS,EAAOC,KAEzD,IAAI,UACH,GAAI,U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d,IAAIod,sCACJ,GACF,G,GC5CG8E,yBAA2B,CAAC,EAGhC,SAASC,oBAAoBC,GAE5B,IAAIC,EAAeH,yBAAyBE,GAC5C,QAAqBvhB,IAAjBwhB,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,yBAAyBE,GAAY,CAGjDE,QAAS,CAAC,GAOX,OAHAE,oBAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,qBAG/CI,EAAOD,OACf,C,2BClBA3a,oBAAQ,KAGR3H,IAAI2gB,eAAenY,MAAK,WAEvBb,oBAAQ,KAERA,oBAAQ,IACRA,oBAAQ,IACRA,oBAAQ,KAuBRA,oBAAQ,IACR,G","sources":["webpack://Pixel-Manager-for-WooCommerce/./src/js/public/facebook/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/facebook/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/facebook/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/ads/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/ads/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/ads/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga3/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga3/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga3/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga4/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga4/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/ga4/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/analytics/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/base/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/base/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/base/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/optimize/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/optimize/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/google/optimize/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/hotjar/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/hotjar/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/hotjar/loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/cookie_consent.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/event_listeners.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/functions.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/functions_loader.js","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/wpm/init.js","webpack://Pixel-Manager-for-WooCommerce/webpack/bootstrap","webpack://Pixel-Manager-for-WooCommerce/./src/js/public/main.js"],"sourcesContent":["/**\n * All event listeners\n *\n * https://developers.facebook.com/docs/meta-pixel/reference\n * */\n\n// Load pixel event\njQuery(document).on(\"wpmLoadPixels\", () => {\n\n\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t}\n})\n\n// AddToCart event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideAddToCart\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"AddToCart\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// InitiateCheckout event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideBeginCheckout\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"InitiateCheckout\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// AddToWishlist event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideAddToWishlist\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"AddToWishlist\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// ViewContent event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideViewItem\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"ViewContent\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n\n// view search event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideSearch\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Search\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", () => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n\n// view order received page event\n// https://developers.facebook.com/docs/meta-pixel/reference\njQuery(document).on(\"wpmClientSideOrderReceivedPage\", (event, payload) => {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\", payload.facebook.custom_data, {\n\t\t\teventID: payload.facebook.event_id,\n\t\t})\n\t} catch (error) {\n\t\tconsole.error(error)\n\t}\n})\n","/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fbUserData\n\n\twpm.loadFacebookPixel = () => {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tlet data = {}\n\n\t\t\t// Add user identifiers to data,\n\t\t\t// and only if fbp was set\n\t\t\tif (wpm.isFbpSet()) {\n\t\t\t\tdata = {...wpm.getUserIdentifiersForFb()}\n\t\t\t}\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id, data)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// https://developers.facebook.com/docs/meta-pixel/advanced/advanced-matching\n\twpm.getUserIdentifiersForFb = () => {\n\n\t\tlet data = {}\n\n\t\t// external ID\n\t\tif (wpmDataLayer?.user?.id) data.external_id = wpmDataLayer.user.id\n\t\tif (wpmDataLayer?.order?.user_id) data.external_id = wpmDataLayer.order.user_id\n\n\t\t// email\n\t\tif (wpmDataLayer?.user?.facebook?.email) data.em = wpmDataLayer.user.facebook.email\n\t\tif (wpmDataLayer?.order?.billing_email_hashed) data.em = wpmDataLayer.order.billing_email_hashed\n\n\t\t// first name\n\t\tif (wpmDataLayer?.user?.facebook?.first_name) data.fn = wpmDataLayer.user.facebook.first_name\n\t\tif (wpmDataLayer?.order?.billing_first_name) data.fn = wpmDataLayer.order.billing_first_name.toLowerCase()\n\n\t\t// last name\n\t\tif (wpmDataLayer?.user?.facebook?.last_name) data.ln = wpmDataLayer.user.facebook.last_name\n\t\tif (wpmDataLayer?.order?.billing_last_name) data.ln = wpmDataLayer.order.billing_last_name.toLowerCase()\n\n\t\t// phone\n\t\tif (wpmDataLayer?.user?.facebook?.phone) data.ph = wpmDataLayer.user.facebook.phone\n\t\tif (wpmDataLayer?.order?.billing_phone) data.ph = wpmDataLayer.order.billing_phone.replace(\"+\", \"\")\n\n\t\t// city\n\t\tif (wpmDataLayer?.user?.facebook?.city) data.ct = wpmDataLayer.user.facebook.city\n\t\tif (wpmDataLayer?.order?.billing_city) data.ct = wpmDataLayer.order.billing_city.toLowerCase().replace(/ /g, \"\")\n\n\t\t// state\n\t\tif (wpmDataLayer?.user?.facebook?.state) data.st = wpmDataLayer.user.facebook.state\n\t\tif (wpmDataLayer?.order?.billing_state) data.st = wpmDataLayer.order.billing_state.toLowerCase().replace(/[a-zA-Z]{2}-/, \"\")\n\n\t\t// postcode\n\t\tif (wpmDataLayer?.user?.facebook?.postcode) data.zp = wpmDataLayer.user.facebook.postcode\n\t\tif (wpmDataLayer?.order?.billing_postcode) data.zp = wpmDataLayer.order.billing_postcode\n\n\t\t// country\n\t\tif (wpmDataLayer?.user?.facebook?.country) data.country = wpmDataLayer.user.facebook.country\n\t\tif (wpmDataLayer?.order?.billing_country) data.country = wpmDataLayer.order.billing_country.toLowerCase()\n\n\t\treturn data\n\t}\n\n\twpm.getFbRandomEventId = () => (Math.random() + 1).toString(36).substring(2)\n\n\twpm.getFbUserData = () => {\n\n\t\t/**\n\t\t * We need to cache the FB user data for InitiateCheckout\n\t\t * where getting the user data from the browser is too slow\n\t\t * using wpm.getCookie().\n\t\t *\n\t\t * And we need the object merge because the ViewContent hit happens too fast\n\t\t * after adding a variation to the cart because the function to cache\n\t\t * the user data is too slow.\n\t\t *\n\t\t * But we can get the user_data using wpm.getCookie()\n\t\t * because we don't move away from the page and can wait for the browser\n\t\t * to get it.\n\t\t *\n\t\t * Also, the merge ensures that new data will be added to fbUserData if new\n\t\t * data is being added later, like user ID, or fbc.\n\t\t */\n\n\t\tfbUserData = {...fbUserData, ...wpm.getFbUserDataFromBrowser()}\n\n\t\treturn fbUserData\n\t}\n\n\twpm.setFbUserData = () => {\n\t\tfbUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = () => {\n\n\t\tlet\n\t\t\tdata = {}\n\n\t\tif (wpm.getCookie(\"_fbp\") && wpm.isValidFbp(wpm.getCookie(\"_fbp\"))) {\n\t\t\tdata.fbp = wpm.getCookie(\"_fbp\")\n\t\t}\n\n\t\tif (wpm.getCookie(\"_fbc\") && wpm.isValidFbc(wpm.getCookie(\"_fbc\"))) {\n\t\t\tdata.fbc = wpm.getCookie(\"_fbc\")\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.external_id = wpmDataLayer.user.id\n\t\t}\n\n\t\tif (navigator.userAgent) {\n\t\t\tdata.client_user_agent = navigator.userAgent\n\t\t}\n\n\t\treturn data\n\t}\n\n\twpm.isFbpSet = () => {\n\t\treturn !!wpm.getCookie(\"_fbp\")\n\t}\n\n\t// https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/\n\twpm.isValidFbp = fbp => {\n\n\t\tlet re = new RegExp(/^fb\\.[0-2]\\.\\d{13}\\.\\d{8,20}$/)\n\n\t\treturn re.test(fbp)\n\t}\n\n\t// https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/\n\twpm.isValidFbc = fbc => {\n\n\t\tlet re = new RegExp(/^fb\\.[0-2]\\.\\d{13}\\.[\\da-zA-Z_-]{8,}/)\n\n\t\treturn re.test(fbc)\n\t}\n\n\t// wpm.fbViewContent = (product = null) => {\n\t//\n\t// \ttry {\n\t// \t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\t//\n\t// \t\tlet eventId = wpm.getFbRandomEventId()\n\t//\n\t// \t\tlet data = {}\n\t//\n\t// \t\tif (product) {\n\t// \t\t\tdata.content_type = \"product\"\n\t// \t\t\tdata.content_name = product.name\n\t// \t\t\t// data.content_category = product.category\n\t// \t\t\tdata.content_ids = product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]\n\t// \t\t\tdata.currency = wpmDataLayer.shop.currency\n\t// \t\t\tdata.value = product.price\n\t// \t\t}\n\t//\n\t// \t\tfbq(\"track\", \"ViewContent\", data, {\n\t// \t\t\teventID: eventId,\n\t// \t\t})\n\t//\n\t// \t\tlet capiData = {\n\t// \t\t\tevent_name : \"ViewContent\",\n\t// \t\t\tevent_id : eventId,\n\t// \t\t\tuser_data : wpm.getFbUserData(),\n\t// \t\t\tevent_source_url: window.location.href,\n\t// \t\t}\n\t//\n\t// \t\tif (product) {\n\t// \t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\t// \t\t\tcapiData.custom_data = wpm.fbGetProductDataForCapiEvent(product)\n\t// \t\t}\n\t//\n\t// \t\tjQuery(document).trigger(\"wpmFbCapiEvent\", capiData)\n\t// \t} catch (e) {\n\t// \t\tconsole.error(e)\n\t// \t}\n\t// }\n\n\twpm.fbGetProductDataForCapiEvent = product => {\n\t\treturn {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : [\n\t\t\t\tproduct.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}\n\t}\n\n\twpm.facebookContentIds = () => {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n\twpm.trackCustomFacebookEvent = (eventName, customData = {}) => {\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getFbRandomEventId()\n\n\t\t\tfbq(\"trackCustom\", eventName, customData, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : eventName,\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t\tcustom_data : customData,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fbGetContentIdsFromCart = () => {\n\n\t\tlet content_ids = []\n\n\t\tfor(const key in wpmDataLayer.cart){\n\t\t\tcontent_ids.push(wpmDataLayer.products[key].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])\n\t\t}\n\t\t\n\t\treturn content_ids\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Facebook loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n\n","/**\n * Load Google Ads event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\titems : [{\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}],\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item_list\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\tvalue : product.quantity * product.price,\n\t\t\titems : [{\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tquantity : product.quantity,\n\t\t\t\tprice : product.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}],\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"add_to_cart\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", (event, product = null) => {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t}\n\n\t\tif (product) {\n\t\t\tdata.value = (product.quantity ? product.quantity : 1) * product.price\n\t\t\tdata.items = [{\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n\t\t\t\tprice : product.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}]\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t// value : 1 * product.price,\n\t\t\titems: products,\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", data)\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data = {\n\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", data)\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// conversion event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (jQuery.isEmptyObject(wpm.getGoogleAdsConversionIdentifiersWithLabel())) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.clv_order_value_filtered) {\n\t\t\tdata_basic.customer_lifetime_value = wpmDataLayer.order.clv_order_value_filtered\n\t\t}\n\n\t\tif (wpmDataLayer?.user?.id) {\n\t\t\tdata_basic.user_id = wpmDataLayer.user.id\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load Google Ads functions\n * */\n\n(function (wpm, $, undefined) {\n\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\n\t\tlet conversionIdentifiers = []\n\n\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds) {\n\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\tif (item) {\n\t\t\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google Ads\n */\n\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Google Universal Analytics (GA3) event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency: wpmDataLayer.order.currency,\n\t\t\t\tcategory: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItem = wpm.ga3AddListNameToProduct(orderItem)\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.ga3AddListNameToProduct = function (item_data, productPosition = null) {\n\n\t\t// if (wpm.ga3CanProductListBeSet(item_data.id)) {\n\t\t// \titem_data.listname = wpmDataLayer.shop.list_name\n\t\t//\n\t\t// \tif (productPosition) {\n\t\t// \t\titem_data.list_position = productPosition\n\t\t// \t}\n\t\t// }\n\n\t\titem_data.list_name = wpmDataLayer.shop.list_name\n\n\t\tif (productPosition) {\n\t\t\titem_data.list_position = productPosition\n\t\t}\n\n\t\treturn item_data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Google Universal Analytics (GA3) loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load GA4 event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load GA4 functions\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * GA4 loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Google Analytics loader\n */\n\nrequire(\"./ga3/loader\")\nrequire(\"./ga4/loader\")\n","/**\n * Load Google base event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\tif (wpm.canGoogleLoad()) {\n\t\t\twpm.loadGoogle()\n\t\t} else {\n\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t}\n\t}\n})\n","/**\n * Load Google base functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to set on the window object\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (wpmDataLayer?.shop?.page_type && \"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\t// window.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\n\t\t\t\tgtag(\"set\", \"user_data\", wpmDataLayer.order.google.ads.enhanced_conversion_data)\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tlet parameters = wpmDataLayer.pixels.google.analytics.ga4.parameters\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.debug_mode) {\n\t\t\t\tparameters.debug_mode = true\n\t\t\t}\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, parameters)\n\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.then(function (script, textStatus) {\n\n\t\t\t\t\ttry {\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google base\n */\n\n// Load base\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load Google\n */\n\n// Load base\nrequire(\"./base/loader\")\n\n//Load additional Google libraries\nrequire(\"./ads/loader\")\nrequire(\"./analytics/loader\")\nrequire(\"./optimize/loader\")\n\n\n","/**\n * Load Google Optimize event listeners\n */\n\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t}\n})\n","/**\n * Load Google Optimize functions\n */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .then(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google Optimize\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Hotjar event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t}\n})\n","/**\n * Load Hotjar functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Hotjar loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Consent Mode functions\n */\n\n(function (wpm, $, undefined) {\n\n\n\t/**\n\t * Handle Cookie Management Platforms\n\t */\n\n\tlet getComplianzCookies = () => {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = () => {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-performance\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Initialize and set default values\n\t */\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\t// Return current consent values\n\twpm.getConsentValues = () => wpmConsentValues\n\n\twpm.setConsentValueCategories = (analytics = false, ads = false) => {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\t// Update the PMW consent values with values coming from a CMP\n\twpm.updateConsentCookieValues = (analytics = null, ads = null, explicitConsent = false) => {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\tlet cookie\n\n\t\t/**\n\t\t * Setup defaults\n\t\t */\n\n\t\t// consentValues.categories.analytics = true\n\t\t// consentValues.categories.ads = true\n\n\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\twpmConsentValues.categories.ads = !explicitConsent\n\n\n\t\tif (analytics || ads) {\n\n\t\t\tif (analytics) {\n\t\t\t\twpmConsentValues.categories.analytics = !!analytics\n\t\t\t}\n\n\t\t\tif (ads) {\n\t\t\t\twpmConsentValues.categories.ads = !!ads\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * PMW Cookie Consent\n\t\t *\n\t\t * Must be before every other CMP for the case that one of the included CMPs\n\t\t * decides to implement the PMW cookie consent API. In that case\n\t\t * the PMW consent cookie must take precedence.\n\t\t */\n\n\t\tif (cookie = wpm.getCookie(\"pmw_cookie_consent\")) {\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * Cookiebot\n\t\t * https://wordpress.org/plugins/cookiebot/\n\t\t */\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * Cookie Script\n\t\t * https://wordpress.org/plugins/cookie-script-com/\n\t\t */\n\n\t\tif (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * Borlabs Cookie\n\t\t * https://borlabs.io/borlabs-cookie/\n\t\t */\n\t\tif (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * Complianz Cookie\n\t\t * https://wordpress.org/plugins/complianz-gdpr/\n\t\t */\n\n\t\tif (cookie = getComplianzCookies()) {\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * Cookie Compliance (free version)\n\t\t * https://wordpress.org/plugins/cookie-notice/\n\t\t */\n\n\t\tif (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * Cookie Compliance (pro version)\n\t\t * https://wordpress.org/plugins/cookie-notice/\n\t\t */\n\n\t\tif (cookie = wpm.getCookie(\"hu-consent\")) {\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t * https://wordpress.org/plugins/cookie-law-info/\n\t\t */\n\n\t\tif (cookie = getCookieLawInfoCookies()) {\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t\treturn\n\t\t}\n\n\t\t/**\n\t\t * GDPR Cookie Compliance Plugin by Moove Agency\n\t\t * https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t *\n\t\t * TODO write documentation on how to set up the plugin in order for this to work properly\n\t\t */\n\n\t\tif (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\treturn\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = () => {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = (category, pixelName) => {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\n\t\t\t// If a user sets \"bing-ads\" in Borlabs Cookie instead of\n\t\t\t// \"microsoft-ads\" in the Borlabs settings, we need to check\n\t\t\t// for that too.\n\t\t\tif (false === canIFireMode && \"microsoft-ads\" === pixelName) {\n\t\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(\"bing-ads\")\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = (pixelName, category) => {\n\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"Pixel Manager for WooCommerce: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (PMW is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"Pixel Manager for WooCommerce: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (PMW is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\t// jQuery(document).on(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\tdocument.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = node => {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = (scriptNode, removeAttach = false) => {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\t// jQuery(document).trigger(\"wpmPreLoadPixels\")\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t}\n\n\twpm.blockScript = (scriptNode, removeAttach = false) => {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = (analytics = true, ads = true) => {\n\t\t// jQuery(document).trigger(\"wpmPreLoadPixels\")\n\t\twpm.setConsentValueCategories(analytics, ads)\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t}\n\n\twpm.unblockSelectedPixels = () => {\n\t\t// jQuery(document).trigger(\"wpmPreLoadPixels\")\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\t// jQuery(document).on(\"borlabs-cookie-consent-saved\", () => {\n\tdocument.addEventListener(\"borlabs-cookie-consent-saved\", () => {\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\t// jQuery(document).on(\"CookiebotOnAccept\", () => {\n\tdocument.addEventListener(\"CookiebotOnAccept\", () => {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\t// jQuery(document).on(\"CookieScriptAccept\", e => {\n\tdocument.addEventListener(\"CookieScriptAccept\", e => {\n\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\t// jQuery(document).on(\"CookieScriptAcceptAll\", () => {\n\tdocument.addEventListener(\"CookieScriptAcceptAll\", () => {\n\n\t\twpm.setConsentValueCategories(true, true)\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t/**\n\t * Complianz Cookie\n\t *\n\t * If visitor accepts cookies in Complianz unblock the scripts\n\t */\n\n\twpm.cmplzStatusChange = (cmplzConsentData) => {\n\n\t\tif (cmplzConsentData.detail.categories.includes(\"statistics\")) wpm.updateConsentCookieValues(true, null)\n\t\tif (cmplzConsentData.detail.categories.includes(\"marketing\")) wpm.updateConsentCookieValues(null, true)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t}\n\n\t// jQuery(document).on(\"cmplzStatusChange\", wpm.cmplzStatusChange)\n\tdocument.addEventListener(\"cmplzStatusChange\", wpm.cmplzStatusChange)\n\t// jQuery(document).on(\"cmplz_status_change\", wpm.cmplzStatusChange)\n\tdocument.addEventListener(\"cmplz_status_change\", wpm.cmplzStatusChange)\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t// jQuery(document).on(\"setCookieNotice\", () => {\n\tdocument.addEventListener(\"setCookieNotice\", () => {\n\t\twpm.updateConsentCookieValues()\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(mutations => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\t// jQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t// jQuery(\".hu-cookies-save\") in pure JavaScript\n\t\t\t\t\t\tdocument.querySelector(\".hu-cookies-save\").addEventListener(\"click\", () => {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.explicitConsentStateAlreadySet = () => {\n\n\t\tif (wpmConsentValues.explicitConsentStateAlreadySet) {\n\t\t\treturn true\n\t\t} else {\n\t\t\twpmConsentValues.explicitConsentStateAlreadySet = true\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function (pmw, $, undefined) {\n\n\t// Accept consent for all cookies\n\tpmw.consentAcceptAll = (duration = 365) => {\n\n\t\tpmw.consentSetCookie(true, true, duration)\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t}\n\n\t// Accept consent selectively\n\tpmw.consentAdjustSelectively = (analytics, ads, duration = 365) => {\n\n\t\tpmw.consentSetCookie(analytics, ads, duration)\n\t\twpm.unblockAllScripts(analytics, ads)\n\t\twpm.updateGoogleConsentMode(analytics, ads)\n\t}\n\n\t// Remove consent for all cookies\n\tpmw.consentRevokeAll = (duration = 365) => {\n\n\t\twpm.setConsentValueCategories(false, false)\n\t\tpmw.consentSetCookie(false, false, duration)\n\t\twpm.updateGoogleConsentMode(false, false)\n\t}\n\n\t// Set a cookie called pmw_cookie_consent with the value of pmw_cookie_consent\n\t// and set the default expiration date to 1 year from now\n\tpmw.consentSetCookie = (analytics, ads, duration = 365) => {\n\t\twpm.setCookie(\"pmw_cookie_consent\", JSON.stringify({analytics, ads}), duration)\n\t}\n\n\t// Trigger an event once the PMW consent management has been loaded\n\tjQuery(document).trigger(\"pmw_cookie_consent_management_loaded\")\n\n}(window.pmw = window.pmw || {}, jQuery))\n","/**\n * Register event listeners\n */\n\n// remove_from_cart event\n// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", (event) => {\n\n\ttry {\n\n\t\tlet url = new URL(jQuery(event.currentTarget).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", (event) => {\n\n\ttry {\n\n\t\tlet quantity = 1,\n\t\t\tproductId\n\n\t\t// Only process on product pages\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// First process related and upsell products\n\t\t\tif (typeof jQuery(event.currentTarget).attr(\"href\") !== \"undefined\" && jQuery(event.currentTarget).attr(\"href\").includes(\"add-to-cart\")) {\n\n\t\t\t\tproductId = jQuery(event.currentTarget).data(\"product_id\")\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t\t// If is simple product\n\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\tquantity = Number(jQuery(\".input-text.qty\").val())\n\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\tproductId = jQuery(event.currentTarget).val()\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t\t// If is variable product or variable-subscription\n\t\t\tif ([\"variable\", \"variable-subscription\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\n\t\t\t\tquantity = Number(jQuery(\".input-text.qty\").val())\n\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\tproductId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t\t// If is grouped product\n\t\t\tif (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each((index, element) => {\n\n\t\t\t\t\tquantity = Number(jQuery(element).find(\".input-text.qty\").val())\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\t\tlet classes = jQuery(element).attr(\"class\")\n\t\t\t\t\tproductId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// If is bundle product\n\t\t\tif (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\tquantity = Number(jQuery(\".input-text.qty\").val())\n\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\t\t\t\tproductId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tproductId = jQuery(event.currentTarget).data(\"product_id\")\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\n// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", (event) => {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", (event) => {\n\n\ttry {\n\n\t\t/**\n\t\t * On some pages the event fires multiple times, and on product pages\n\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t * but I don't know why. We don't even have to use this, since only a real\n\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t * events out later down in the code. I'll keep it that way because this is\n\t\t * the most compatible way across shops.\n\t\t *\n\t\t * e.stopPropagation();\n\t\t * */\n\n\t\tlet productId = jQuery(event.currentTarget).nextAll(\".wpmProductId:first\").data(\"id\")\n\n\t\t/**\n\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t * related products, which are found below.\n\t\t */\n\n\t\tif (productId) {\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\nlet checkoutButtonClasses = [\n\t\".checkout-button\",\n\t\".cart-checkout-button\",\n\t\".button.checkout\",\n\t\".xoo-wsc-ft-btn-checkout\", // https://xootix.com/side-cart-for-woocommerce/\n\t\".elementor-button--checkout\",\n]\n\n// https://wordpress.stackexchange.com/a/352171/68337\njQuery(document).one(\"click init_checkout\", checkoutButtonClasses.join(\",\"), () => {\n\t// console.log(\"begin_checkout\", new Date().getTime())\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\njQuery(document).on(\"input\", \"#billing_email\", (event) => {\n\n\tif (wpm.isEmail(jQuery(event.currentTarget).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\n// https://wordpress.stackexchange.com/a/352171/68337\njQuery(document).on(\"wpmLoad\", (event) => {\n\tjQuery(document).on(\"payment_method_selected\", () => {\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t}\n\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\twpm.paymentMethodSelected = true\n\t})\n})\n\n// track checkout option event: purchase click\n// jQuery(document).one(\"click\", \"#place_order\", () => {\n// https://stackoverflow.com/a/34112407/4688612\njQuery(() => {\n\tjQuery(\"form.checkout\").on(\"checkout_place_order_success\", () => {\n\n\t\tif (false === wpm.emailSelected) {\n\t\t\twpm.fireCheckoutProgress(2)\n\t\t}\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\t}\n\n\t\twpm.fireCheckoutProgress(4)\n\t})\n})\n\n// update cart event\n// jQuery(\"[name='update_cart']\").on('click', function (e) {\njQuery(document).on(\"click\", \"[name='update_cart']\", (event) => {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each((index, element) => {\n\n\t\t\tlet url = new URL(jQuery(element).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\tlet quantity = jQuery(element).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\njQuery(function () {\n\n\tjQuery(\".add_to_wishlist,.wl-add-to\").on(\"click\", event => {\n\n\t\ttry {\n\n\t\t\tlet productId\n\n\t\t\tif (jQuery(event.currentTarget).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\n\t\t\t\tproductId = jQuery(event.currentTarget).data(\"productid\")\n\t\t\t} else if (jQuery(event.currentTarget).data(\"product-id\")) { // for the YITH wishlist plugin\n\n\t\t\t\tproductId = jQuery(event.currentTarget).data(\"product-id\")\n\t\t\t}\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\n\t\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\njQuery(document).on(\"updated_cart_totals\", () => {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n/**\n * Called when the user selects all the required dropdowns / attributes\n *\n * Has to be hooked after document ready !\n *\n * https://stackoverflow.com/a/27849208/4688612\n * https://stackoverflow.com/a/65065335/4688612\n */\n\njQuery(() => {\n\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", (event, variation) => {\n\n\t\ttry {\n\t\t\tlet productId = wpm.getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\twpm.triggerViewItemEventPrep(productId)\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\n\n/**\n * Called on variable products when no selection has been done yet\n * or when the visitor deselects his choice.\n *\n * Has to be hooked after document ready !\n */\n\n// jQuery(function () {\n//\n// \tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n//\n// \t\ttry {\n// \t\t\tlet classes = jQuery(\"body\").attr(\"class\")\n// \t\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n//\n// \t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n//\n// \t\t\t/**\n// \t\t\t * If we have a variable product with no preset,\n// \t\t\t * and variations output is enabled,\n// \t\t\t * then we send a viewItem event with the first\n// \t\t\t * variation we find for the parent.\n// \t\t\t * If variations output is disabled,\n// \t\t\t * we just send the parent ID.\n// \t\t\t *\n// \t\t\t * And if Facebook microdata is active, use the\n// \t\t\t * microdata product ID.\n// \t\t\t */\n//\n// \t\t\tif (\n// \t\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n// \t\t\t\twpmDataLayer?.general?.variationsOutput\n// \t\t\t) {\n// \t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n// \t\t\t\t\tif (\"parentId\" in product) {\n//\n// \t\t\t\t\t\tproductId = product.id\n// \t\t\t\t\t\tbreak\n// \t\t\t\t\t}\n// \t\t\t\t}\n//\n// \t\t\t\tif (wpmDataLayer?.pixels?.facebook?.microdata_product_id) {\n// \t\t\t\t\tproductId = wpmDataLayer.pixels.facebook.microdata_product_id\n// \t\t\t\t}\n// \t\t\t}\n//\n// \t\t\t// console.log(\"hmm\")\n// \t\t\twpm.triggerViewItemEventPrep(productId)\n//\n// \t\t} catch (e) {\n// \t\t\tconsole.error(e)\n// \t\t}\n// \t})\n// })\n\n// jQuery(function () {\n//\n// \tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n// \t\tjQuery(document).trigger(\"wpmviewitem\")\n// \t})\n// })\n\n\n/**\n * Set up wpm events\n */\n\n// populate the wpmDataLayer with the cart items\njQuery(document).on(\"wpmLoad\", () => {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(document).on(\"wpmLoad\", () => {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(document).on(\"wpmLoad\", () => {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t}\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(document).on(\"wpmLoad\", () => {\n\t// document.addEventListener(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (wpmDataLayer?.shop) {\n\t\t\t\tif (\n\t\t\t\t\t\"product\" === wpmDataLayer.shop.page_type &&\n\t\t\t\t\t\"variable\" !== wpmDataLayer.shop.product_type &&\n\t\t\t\t\twpm.getMainProductIdFromProductPage()\n\t\t\t\t) {\n\t\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\t\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\t\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\t\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\t\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\t\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\t\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\t\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\t\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t\t\tif (typeof wpm.acrRemoveCookie === \"function\") wpm.acrRemoveCookie()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"wpmLoad\", async () => {\n\n\tif (\n\t\twindow.sessionStorage &&\n\t\twindow.sessionStorage.getItem(\"_pmw_endpoint_available\") &&\n\t\t!JSON.parse(window.sessionStorage.getItem(\"_pmw_endpoint_available\"))\n\t) {\n\t\tconsole.error(\"Pixel Manager for WooCommerce: REST endpoint is not available. Using admin-ajax.php instead.\")\n\t}\n})\n\n\n/**\n * Load all pixels\n */\njQuery(document).on(\"wpmPreLoadPixels\", () => {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent && !wpm.explicitConsentStateAlreadySet()) {\n\t\twpm.updateConsentCookieValues(null, null, true)\n\t}\n\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n\n\n/**\n * All ecommerce events\n */\n\njQuery(document).on(\"wpmAddToCart\", (event, product) => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent : \"addToCart\",\n\t\tproduct: product,\n\t}\n\n\t// If Facebook pixel is loaded, add Facebook server to server event data to the payload\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : wpm.fbGetProductDataForCapiEvent(product),\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideAddToCart\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmBeginCheckout\", () => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent: \"beginCheckout\",\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {},\n\t\t}\n\n\t\tif (wpmDataLayer?.cart && !jQuery.isEmptyObject(wpmDataLayer.cart)) {\n\t\t\tpayload.facebook.custom_data = {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_ids : wpm.fbGetContentIdsFromCart(),\n\t\t\t\tvalue : wpm.getCartValue(),\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideBeginCheckout\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmAddToWishlist\", (event, product) => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent : \"addToWishlist\",\n\t\tproduct: product,\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : wpm.fbGetProductDataForCapiEvent(product),\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideAddToWishlist\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmViewItem\", (event, product = null) => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent : \"viewItem\",\n\t\tproduct: product,\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"ViewContent\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {},\n\t\t}\n\n\t\tif (product) {\n\t\t\tpayload.facebook.custom_data = wpm.fbGetProductDataForCapiEvent(product)\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideViewItem\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmSearch\", () => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent: \"search\",\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : wpm.getFbRandomEventId(),\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {\n\t\t\t\tsearch_string: wpm.getSearchTermFromUrl(),\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideSearch\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// If function wpm.isServerToServerEnabled() exists, then run it\n\tif (typeof wpm.sendEventPayloadToServer === \"function\") {\n\t\twpm.sendEventPayloadToServer(payload)\n\t}\n})\n\njQuery(document).on(\"wpmOrderReceivedPage\", () => {\n\n\t/**\n\t * Prepare the payload\n\t */\n\n\tlet payload = {\n\t\tevent: \"orderReceived\",\n\t}\n\n\tif (wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tpayload.facebook = {\n\t\t\tevent_name : \"Purchase\",\n\t\t\tevent_id : wpmDataLayer.order.id,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t\tcustom_data : {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Process the client-to-server event\n\t */\n\n\tjQuery(document).trigger(\"wpmClientSideOrderReceivedPage\", payload)\n\n\t/**\n\t * Process the server-to-server event\n\t */\n\n\t// ! No server-to-server event is sent for this event because it is compiled and sent from the server directly\n})\n\n\n\n\n\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookiePmwRestEndpointAvailable: \"_pmw_endpoint_available\",\n\t\trestEndpointPost : \"pmw/v1/test/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = () => {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = () => window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\n\twpm.isRestEndpointAvailable = async () => {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookiePmwRestEndpointAvailable))\n\t\t} else {\n\t\t\treturn await wpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = () => !!window.sessionStorage\n\n\t// Test the endpoint by sending a POST request\n\twpm.testEndpoint = async (\n\t\turl = wpm.root + wpmRestSettings.restEndpointPost,\n\t\tcookieName = wpmRestSettings.cookiePmwRestEndpointAvailable,\n\t) => {\n\n\t\tlet response = await fetch(url, {\n\t\t\tmethod : \"POST\",\n\t\t\tmode : \"cors\",\n\t\t\tcache : \"no-cache\",\n\t\t\tkeepalive: true,\n\t\t})\n\n\t\tif (response.status === 200) {\n\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\treturn true\n\t\t} else if (response.status === 404) {\n\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\treturn false\n\t\t} else if (response.status === 0) {\n\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isWpmRestEndpointAvailable = (cookieName = wpmRestSettings.cookiePmwRestEndpointAvailable) => !!wpm.getCookie(cookieName)\n\n\twpm.writeOrderIdToStorage = (orderId, source = \"thankyou_page\", expireDays = 365) => {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId, source)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = orderId => {\n\n\t\tif (wpmDataLayer.orderDeduplication) {\n\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = email => {\n\n\t\t// https://emailregex.com/\n\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = (productId, quantityToRemove = null) => {\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\t\t}\n\t}\n\n\twpm.getIdBasedOndVariationsOutputSetting = productId => {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = (productId, quantity) => {\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = () => {\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = () => {\n\t\ttry {\n\n\t\t\t/**\n\t\t\t * Can't use a REST API endpoint, as the cart session will not be loaded if the\n\t\t\t * endpoint is called.\n\t\t\t *\n\t\t\t * https://wordpress.org/support/topic/wc-cart-is-null-in-custom-rest-api/#post-11442843\n\t\t\t */\n\n\t\t\t/**\n\t\t\t * Get the cart items from the backend the data object using fetch API\n\t\t\t * and log success or error messages\n\t\t\t * and url encoded data\n\t\t\t */\n\t\t\tfetch(wpm.ajax_url, {\n\t\t\t\tmethod : \"POST\",\n\t\t\t\tcache : \"no-cache\",\n\t\t\t\tbody : new URLSearchParams({action: \"pmw_get_cart_items\"}),\n\t\t\t\tkeepalive: true,\n\t\t\t})\n\t\t\t\t.then(response => {\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\treturn response.json()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow Error(\"Error getting cart items from backend\")\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.then(data => {\n\n\t\t\t\t\tif (data.success) {\n\n\t\t\t\t\t\tif (!data.data[\"cart\"]) data.data[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(data.data[\"cart\"])\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(data.data[\"cart\"]))\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow Error(\"Error getting cart items from backend\")\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// get productIds from the backend\n\twpm.getProductsFromBackend = async productIds => {\n\n\t\tif (wpmDataLayer?.products) {\n\t\t\t// reduce productIds by products already in the dataLayer\n\t\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\t\t}\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\n\t\t\tlet response\n\n\t\t\tif (await wpm.isRestEndpointAvailable()) {\n\t\t\t\tresponse = await fetch(wpm.root + \"pmw/v1/products/\", {\n\t\t\t\t\tmethod : \"POST\",\n\t\t\t\t\tcache : \"no-cache\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t},\n\t\t\t\t\tbody : JSON.stringify(productIds),\n\t\t\t\t})\n\t\t\t} else {\n\n\t\t\t\t// Get the product details from the backend the data object using fetch API\n\t\t\t\t// and log success or error messages\n\t\t\t\t// and url encoded data\n\t\t\t\tresponse = await fetch(wpm.ajax_url, {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tcache : \"no-cache\",\n\t\t\t\t\tbody : new URLSearchParams({\n\t\t\t\t\t\taction : \"pmw_get_product_ids\",\n\t\t\t\t\t\tproductIds: productIds,\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (response.ok) {\n\t\t\t\tlet responseData = await response.json()\n\t\t\t\tif (responseData.success) {\n\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, responseData.data)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconsole.error(\"Error getting products from backend\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\n\t\treturn true\n\t}\n\n\twpm.saveCartObjectToDataLayer = cartObject => {\n\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.triggerViewItemEventPrep = async productId => {\n\n\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\twpm.triggerViewItemEvent(productId)\n\t\t} else {\n\t\t\tawait wpm.getProductsFromBackend([productId])\n\t\t\twpm.triggerViewItemEvent(productId)\n\t\t}\n\t}\n\n\twpm.triggerViewItemEvent = productId => {\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t}\n\n\twpm.triggerViewItemEventNoProduct = () => {\n\t\tjQuery(document).trigger(\"wpmViewItem\")\n\t}\n\n\twpm.fireCheckoutOption = (step, checkout_option = null, value = null) => {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = step => {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = string => {\n\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = productId => {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = productId => {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getMainProductIdFromProductPage = () => {\n\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = target => {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = () => {\n\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = (entries, observer) => {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = () => {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = () => {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\tallIoElementsToWatch.each((i, elem) => {\n\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = () => {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(mutations => {\n\n\t\tmutations.forEach(mutation => {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = elem =>\n\t\t!!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\n\twpm.setCookie = (cookieName, cookieValue = \"\", expiryDays = null) => {\n\n\t\tif (expiryDays) {\n\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = cookieName => {\n\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\n\t\tfor (let i = 0; i < ca.length; i++) {\n\n\t\t\tlet c = ca[i]\n\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\n\t\treturn \"\"\n\t}\n\n\twpm.deleteCookie = cookieName => {\n\t\twpm.setCookie(cookieName, \"\", -1)\n\t}\n\n\twpm.getWpmSessionData = () => {\n\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = data => {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = async (orderId, source) => {\n\n\t\ttry {\n\n\t\t\tlet response\n\n\t\t\tif (await wpm.isRestEndpointAvailable()) {\n\n\t\t\t\tresponse = await fetch(wpm.root + \"pmw/v1/pixels-fired/\", {\n\t\t\t\t\tmethod : \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t},\n\t\t\t\t\tbody : JSON.stringify({\n\t\t\t\t\t\torder_id: orderId,\n\t\t\t\t\t\tsource: source\n\t\t\t\t\t}),\n\t\t\t\t\tkeepalive: true,\n\t\t\t\t\tcache\t: \"no-cache\",\n\t\t\t\t})\n\n\t\t\t} else {\n\t\t\t\t// save the state in the database\n\n\t\t\t\t// Send the data object with ajax request\n\t\t\t\t// and log success or error using fetch API and url encoded\n\t\t\t\tresponse = await fetch(wpm.ajax_url, {\n\t\t\t\t\tmethod : \"POST\",\n\t\t\t\t\tbody : new URLSearchParams({\n\t\t\t\t\t\taction : \"pmw_purchase_pixels_fired\",\n\t\t\t\t\t\torder_id: orderId,\n\t\t\t\t\t\tsource : source,\n\t\t\t\t\t}),\n\t\t\t\t\tkeepalive: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (response.ok) {\n\t\t\t\tconsole.log(\"wpm.storeOrderIdOnServer success\")\n\t\t\t} else {\n\t\t\t\tconsole.error(\"wpm.storeOrderIdOnServer error\")\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = url => {\n\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = () =>\n\t\tjQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\n\twpm.getProductDetailsFormattedForEvent = (productId, quantity = 1) => {\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = () => {\n\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = () => {\n\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = (clidId = \"gclid\") => {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = () => navigator.userAgent\n\n\twpm.getViewPort = () => ({\n\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t})\n\n\n\twpm.version = () => {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = url => {\n\n\t\t// Get and load the script using fetch API, if possible from cache, and return it without using eval\n\t\treturn fetch(url, {\n\t\t\tmethod : \"GET\",\n\t\t\tcache : \"default\",\n\t\t\tkeepalive: true,\n\t\t})\n\t\t\t.then(response => {\n\t\t\t\tif (response.ok) {\n\t\t\t\t\t// console.log(\"response\", response)\n\t\t\t\t\treturn response.text()\n\t\t\t\t\t// console.log(\"wpm.loadScriptAndCacheIt success: \" + url)\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Network response was not ok: \" + url)\n\t\t\t\t}\n\t\t\t})\n\t\t\t.then(script => {\n\t\t\t\t// Execute the script\n\t\t\t\t// console.error(\"executing script: \" + script)\n\t\t\t\teval(script)\n\t\t\t\t// console.log(\"executed script: \" + script)\n\t\t\t})\n\t\t\t.catch(e => {\n\t\t\t\tconsole.error(e)\n\t\t\t})\n\t}\n\n\twpm.getOrderItemPrice = orderItem => (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\n\twpm.hasLoginEventFired = () => {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = () => {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = () => new Promise(resolve => {\n\t\t(function waitForVar() {\n\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\tsetTimeout(waitForVar, 50)\n\t\t})()\n\t})\n\n\twpm.jQueryExists = () => new Promise(resolve => {\n\t\t(function waitForjQuery() {\n\t\t\tif (typeof jQuery !== \"undefined\") return resolve()\n\t\t\tsetTimeout(waitForjQuery, 100)\n\t\t})()\n\t})\n\n\twpm.pageLoaded = () => new Promise(resolve => {\n\t\t(function waitForVar() {\n\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\tsetTimeout(waitForVar, 50)\n\t\t})()\n\t})\n\n\twpm.pageReady = () => {\n\t\treturn new Promise(resolve => {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = () => {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = () => document.cookie.includes(\"woocommerce_items_in_cart\")\n\n\twpm.urlHasParameter = parameter => {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n\t// https://stackoverflow.com/a/60606893/4688612\n\twpm.hashAsync = (algo, str) => {\n\t\treturn crypto.subtle.digest(algo, new TextEncoder(\"utf-8\").encode(str)).then(buf => {\n\t\t\treturn Array.prototype.map.call(new Uint8Array(buf), x => ((\"00\" + x.toString(16)).slice(-2))).join(\"\")\n\t\t})\n\t}\n\n\twpm.getCartValue = () => {\n\n\t\tlet value = 0\n\n\t\tif (wpmDataLayer?.cart) {\n\n\t\t\tfor (const key in wpmDataLayer.cart) {\n\t\t\t\t// content_ids.push(wpmDataLayer.products[key].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])\n\n\t\t\t\tlet product = wpmDataLayer.cart[key]\n\n\t\t\t\tvalue += product.quantity * product.price\n\t\t\t}\n\t\t}\n\n\t\treturn value\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load all WPM functions\n *\n * Ignore event listeners. They need to be loaded after\n * we made sure that jQuery has been loaded.\n */\n\nrequire(\"./functions\")\nrequire(\"./cookie_consent\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// #endif\n","/**\n * After WPM is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\n\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"Pixel Manager for WooCommerce: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\n\t\tdocument.dispatchEvent(new Event(\"wpmPreLoadPixels\"))\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tdocument.dispatchEvent(new Event(\"wpmLoad\"))\n\t\t})\n\t})\n\n\n\n/**\n * Run when page is ready\n */\n\nwpm.pageReady().then(function () {\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n})\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm/functions_loader\")\n\n// Only load the event listeners after jQuery has been loaded for sure\nwpm.jQueryExists().then(function () {\n\n\trequire(\"./wpm/event_listeners\")\n\n\trequire(\"./google/loader\")\n\trequire(\"./facebook/loader\")\n\trequire(\"./hotjar/loader\")\n\n\t/**\n\t * Load all premium scripts\n\t */\n\n\t// #if process.env.TIER === 'premium'\n// \trequire(\"./wpm/event_listeners_premium\")\n// \trequire(\"./microsoft-ads/loader\")\n// \trequire(\"./pinterest/loader\")\n// \trequire(\"./snapchat/loader\")\n// \trequire(\"./tiktok/loader\")\n// \trequire(\"./twitter/loader\")\n\t// #endif\n\n\n\t/**\n\t * Initiate WPM.\n\t *\n\t * It makes sure that the script flow gets executed correctly,\n\t * no matter how JS \"optimizers\" shuffle the code.\n\t */\n\n\trequire(\"./wpm/init\")\n})\n\n"],"names":["jQuery","document","on","wpmDataLayer","pixels","facebook","pixel_id","loaded","wpm","canIFire","loadFacebookPixel","event","payload","fbq","custom_data","eventID","event_id","error","console","setFbUserData","$","undefined","fbUserData","f","window","b","e","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","data","isFbpSet","getUserIdentifiersForFb","user","id","external_id","order","user_id","email","em","billing_email_hashed","first_name","fn","billing_first_name","toLowerCase","last_name","ln","billing_last_name","phone","ph","billing_phone","replace","city","ct","billing_city","state","st","billing_state","postcode","zp","billing_postcode","country","billing_country","getFbRandomEventId","Math","random","toString","substring","getFbUserData","getFbUserDataFromBrowser","getCookie","isValidFbp","fbp","isValidFbc","fbc","navigator","userAgent","client_user_agent","RegExp","test","fbGetProductDataForCapiEvent","product","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","value","parseFloat","quantity","price","currency","facebookContentIds","prodIds","key","item","Object","entries","items","general","variationsOutput","variation_id","String","products","trackCustomFacebookEvent","eventName","customData","eventId","trigger","event_name","user_data","event_source_url","location","href","fbGetContentIdsFromCart","cart","require","isEmptyObject","google","ads","conversionIds","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","send_to","getGoogleAdsConversionIdentifiers","google_business_vertical","gtagLoaded","then","gtag","value_filtered","getGoogleAdsDynamicRemarketingOrderItems","getGoogleAdsConversionIdentifiersWithLabel","data_basic","data_with_cart","transaction_id","number","new_customer","clv_order_value_filtered","customer_lifetime_value","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGoogleAdsRegularOrderItems","conversionIdentifiers","orderItems","orderItem","analytics","universal","property_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","category","join","variant","variant_name","brand","ga3AddListNameToProduct","item_data","productPosition","list_name","shop","list_position","ga4","measurement_id","getGA4OrderItems","item_name","item_category","item_id","item_variant","item_brand","canGoogleLoad","loadGoogle","logPreventedPixelLoading","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","debug_mode","isGoogleActive","getGoogleGtagId","loadScriptAndCacheIt","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","Promise","resolve","reject","startTime","wait","setTimeout","optimize","container_id","load_google_optimize_pixel","hotjar","site_id","load_hotjar_pixel","h","o","hj","q","_hjSettings","hjid","hjsv","a","r","appendChild","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","updateConsentCookieValues","cookie","explicitConsent","JSON","parse","decodeURI","indexOf","action","length","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","log","scriptTagObserver","MutationObserver","mutations","forEach","addedNodes","node","shouldScriptBeActive","unblockScript","blockScript","observe","head","childList","subtree","addEventListener","disconnect","split","some","element","scriptNode","removeAttach","remove","wpmSrc","attr","appendTo","dispatchEvent","Event","removeAttr","unblockAllScripts","unblockSelectedPixels","Cookiebot","consent","detail","cmplzStatusChange","cmplzConsentData","huObserver","querySelector","hu","documentElement","body","explicitConsentStateAlreadySet","pmw","consentAcceptAll","duration","consentSetCookie","consentAdjustSelectively","consentRevokeAll","setCookie","stringify","url","URL","currentTarget","productId","getProductIdByCartItemKeyUrl","removeProductFromCart","addProductToCart","product_type","Number","val","each","index","find","classes","getPostIdFromString","one","target","closest","matches","match","nextAll","getIdBasedOndVariationsOutputSetting","Error","getProductDetailsFormattedForEvent","isEmail","fireCheckoutProgress","emailSelected","paymentMethodSelected","fireCheckoutOption","getCartItemsFromBackend","variation","triggerViewItemEventPrep","doesWooCommerceCartExist","getCartItems","productIds","getAddToCartLinkProductIds","getProductsFromBackend","referrer","referrerHostname","hostname","host","wpmLoadFired","getMainProductIdFromProductPage","getProductDataForViewItemEvent","isOrderIdStored","writeOrderIdToStorage","acrRemoveCookie","hasLoginEventFired","setLoginEventFired","sessionStorage","getItem","sendEventPayloadToServer","getCartValue","search_string","getSearchTermFromUrl","wpmDeduper","keyName","cookieExpiresDays","wpmRestSettings","cookiePmwRestEndpointAvailable","restEndpointPost","restFails","restFailsThreshold","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","testEndpoint","root","cookieName","response","fetch","method","cache","keepalive","setItem","isWpmRestEndpointAvailable","orderId","source","Storage","localStorage","ids","expiresDate","setDate","getDate","toUTCString","storeOrderIdOnServer","orderDeduplication","quantityToRemove","isVariation","parentId","saveCartObjectToDataLayer","ajax_url","URLSearchParams","ok","json","success","filter","hasOwnProperty","headers","responseData","assign","cartObject","triggerViewItemEvent","triggerViewItemEventNoProduct","step","checkout_option","string","triggerViewItemList","viewItemListTriggerTestMode","css","append","viewItemListTrigger","opacity","backgroundColor","search","get","ioTimeouts","io","observerCallback","observer","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","timeout","clearTimeout","ioid","allIoElementsToWatch","getAllElementsToWatch","map","i","elem","parent","hasClass","prev","this","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","characterData","mutation","newNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","c","charAt","deleteCookie","getWpmSessionData","setWpmSessionData","order_id","cartItemKey","cartItemKeys","position","parentId_dyn_r_ids","setReferrerToCookie","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","clientWidth","innerWidth","height","clientHeight","innerHeight","text","eval","catch","getOrderItemPrice","total","total_tax","loginEventFired","wpmDataLayerExists","waitForVar","jQueryExists","waitForjQuery","pageLoaded","readyState","pageReady","isMiniCartActive","parameter","hashAsync","algo","str","crypto","subtle","digest","TextEncoder","encode","buf","Array","prototype","call","Uint8Array","x","slice","pro","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__"],"sourceRoot":""}
|
languages/woocommerce-google-adwords-conversion-tracking-tag.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Pixel Manager for WooCommerce 1.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/src\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-09-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
|
@@ -36,8 +36,8 @@ msgstr ""
|
|
36 |
|
37 |
#: classes/admin/class-admin.php:278
|
38 |
#: classes/admin/class-admin.php:279
|
39 |
-
#: wgact.php:
|
40 |
-
#: wgact.php:
|
41 |
msgid "Pixel Manager"
|
42 |
msgstr ""
|
43 |
|
@@ -94,694 +94,714 @@ msgid "Pinterest pixel ID"
|
|
94 |
msgstr ""
|
95 |
|
96 |
#: classes/admin/class-admin.php:516
|
97 |
-
msgid "
|
98 |
msgstr ""
|
99 |
|
100 |
#: classes/admin/class-admin.php:528
|
|
|
|
|
|
|
|
|
101 |
msgid "TikTok pixel ID"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: classes/admin/class-admin.php:
|
105 |
msgid "Hotjar site ID"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: classes/admin/class-admin.php:
|
109 |
msgid "Advanced"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: classes/admin/class-admin.php:
|
113 |
msgid "Order Total Logic"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: classes/admin/class-admin.php:
|
117 |
msgid "Order Duplication Prevention"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: classes/admin/class-admin.php:
|
121 |
msgid "Maximum Compatibility Mode"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: classes/admin/class-admin.php:
|
125 |
msgid "Disable Tracking for User Roles"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: classes/admin/class-admin.php:
|
129 |
msgid "ACR"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: classes/admin/class-admin.php:
|
133 |
msgid "Order List Info"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: classes/admin/class-admin.php:
|
|
|
|
|
|
|
|
|
137 |
msgid "Conversion Cart Data"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: classes/admin/class-admin.php:
|
141 |
msgid "Enhanced E-Commerce"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: classes/admin/class-admin.php:
|
145 |
msgid "GA 4 API secret"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: classes/admin/class-admin.php:
|
149 |
msgid "Enhanced Link Attribution"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: classes/admin/class-admin.php:
|
153 |
msgid "Google User ID"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: classes/admin/class-admin.php:
|
157 |
msgid "Google Ads Enhanced Conversions"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: classes/admin/class-admin.php:
|
161 |
msgid "Google Ads Phone Conversion Number"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: classes/admin/class-admin.php:
|
165 |
msgid "Google Ads Phone Conversion Label"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: classes/admin/class-admin.php:
|
169 |
msgid "Cookie Consent Management"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: classes/admin/class-admin.php:
|
173 |
msgid "Google Consent Mode"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: classes/admin/class-admin.php:
|
177 |
msgid "Google Consent Regions"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: classes/admin/class-admin.php:
|
181 |
msgid "Explicit Consent Mode"
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: classes/admin/class-admin.php:
|
185 |
-
msgid "Borlabs Cookie
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: classes/admin/class-admin.php:
|
189 |
-
msgid "Cookiebot
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: classes/admin/class-admin.php:
|
193 |
-
msgid "Complianz GDPR
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: classes/admin/class-admin.php:
|
197 |
-
msgid "Cookie Notice
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: classes/admin/class-admin.php:
|
201 |
-
msgid "Cookie Script
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: classes/admin/class-admin.php:
|
205 |
-
msgid "GDPR Cookie Compliance
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: classes/admin/class-admin.php:
|
209 |
-
msgid "GDPR Cookie Consent
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: classes/admin/class-admin.php:
|
213 |
msgid "Meta (Facebook) CAPI: token"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: classes/admin/class-admin.php:
|
217 |
msgid "Meta (Facebook) CAPI: process anonymous hits"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: classes/admin/class-admin.php:
|
221 |
msgid "Meta (Facebook) CAPI: send additional visitor identifiers"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: classes/admin/class-admin.php:
|
225 |
msgid "Meta (Facebook) Microdata Tags for Catalogues"
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: classes/admin/class-admin.php:
|
229 |
-
#: classes/admin/class-admin.php:
|
230 |
-
#: classes/admin/class-admin.php:
|
231 |
msgid "Dynamic Remarketing"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: classes/admin/class-admin.php:
|
235 |
msgid "Product Identifier"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: classes/admin/class-admin.php:
|
239 |
msgid "Variations output"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: classes/admin/class-admin.php:
|
243 |
msgid "Google Business Vertical"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: classes/admin/class-admin.php:
|
247 |
-
#: classes/admin/class-admin.php:
|
248 |
msgid "Diagnostics"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: classes/admin/class-admin.php:
|
252 |
-
#: classes/admin/class-admin.php:
|
253 |
msgid "Support"
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: classes/admin/class-admin.php:
|
257 |
-
#: classes/admin/class-admin.php:
|
258 |
msgid "Author"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: classes/admin/class-admin.php:
|
262 |
msgid ""
|
263 |
"It looks like you are using some sort of ad or script blocker which is blocking the script and CSS files of this plugin.\n"
|
264 |
" In order for the plugin to work properly you need to disable the script blocker."
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: classes/admin/class-admin.php:
|
268 |
#: classes/admin/class-notifications.php:96
|
269 |
#: classes/admin/class-notifications.php:146
|
270 |
msgid "Learn more"
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: classes/admin/class-admin.php:
|
274 |
msgid "Profit Driven Marketing by SweetCode"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: classes/admin/class-admin.php:
|
278 |
msgid "Visit us here:"
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: classes/admin/class-admin.php:
|
282 |
msgid "Payment Gateway Tracking Accuracy Report"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: classes/admin/class-admin.php:
|
286 |
-
#: classes/admin/class-admin.php:
|
287 |
-
#: classes/admin/class-admin.php:
|
288 |
msgid "beta"
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: classes/admin/class-admin.php:
|
292 |
msgid "What's this? Follow this link to learn more"
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: classes/admin/class-admin.php:
|
296 |
msgid "Available payment gateways"
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: classes/admin/class-admin.php:
|
300 |
msgid "id"
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: classes/admin/class-admin.php:
|
304 |
msgid "method_title"
|
305 |
msgstr ""
|
306 |
|
307 |
-
#: classes/admin/class-admin.php:
|
308 |
msgid "class"
|
309 |
msgstr ""
|
310 |
|
311 |
-
#: classes/admin/class-admin.php:
|
312 |
msgid "Purchase confirmation page reached per gateway (active and inactive)"
|
313 |
msgstr ""
|
314 |
|
315 |
-
#: classes/admin/class-admin.php:
|
316 |
-
#: classes/admin/class-admin.php:
|
317 |
-
#: classes/admin/class-admin.php:
|
318 |
msgid "The analysis is being generated. Please check back in 5 minutes."
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: classes/admin/class-admin.php:
|
322 |
msgid "Purchase confirmation page reached per gateway (only active), weighted by frequency"
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: classes/admin/class-admin.php:
|
326 |
msgid "Automatic Conversion Recovery (ACR)"
|
327 |
msgstr ""
|
328 |
|
329 |
#. translators: The number and percentage of orders that were recovered by the Automatic Conversion Recovery (ACR).
|
330 |
-
#: classes/admin/class-admin.php:
|
331 |
msgid "ACR recovered %1$s (%2$s%%) out of %3$s missing conversions."
|
332 |
msgstr ""
|
333 |
|
334 |
-
#: classes/admin/class-admin.php:
|
335 |
msgid "This feature is only available in the pro version of the plugin. Follow the link to learn more about it:"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: classes/admin/class-admin.php:
|
339 |
msgid "Get the pro version of the Pixel Manager for WooCommerce over here"
|
340 |
msgstr ""
|
341 |
|
342 |
-
#: classes/admin/class-admin.php:
|
343 |
msgid "Go Pro"
|
344 |
msgstr ""
|
345 |
|
346 |
-
#: classes/admin/class-admin.php:
|
347 |
msgid "Contacting Support"
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: classes/admin/class-admin.php:
|
351 |
msgid "Debug Information"
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: classes/admin/class-admin.php:
|
355 |
msgid "copy to clipboard"
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: classes/admin/class-admin.php:
|
359 |
msgid "Export settings"
|
360 |
msgstr ""
|
361 |
|
362 |
-
#: classes/admin/class-admin.php:
|
363 |
msgid "Export to disk"
|
364 |
msgstr ""
|
365 |
|
366 |
-
#: classes/admin/class-admin.php:
|
367 |
msgid "Import settings"
|
368 |
msgstr ""
|
369 |
|
370 |
-
#: classes/admin/class-admin.php:
|
371 |
msgid "Settings imported successfully!"
|
372 |
msgstr ""
|
373 |
|
374 |
-
#: classes/admin/class-admin.php:
|
375 |
msgid "Reloading...(in 5 seconds)!"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: classes/admin/class-admin.php:
|
379 |
msgid "There was an error importing that file! Please try again."
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: classes/admin/class-admin.php:
|
383 |
msgid "Translations"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: classes/admin/class-admin.php:
|
387 |
msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: classes/admin/class-admin.php:
|
391 |
msgid "Post a support request in the WordPress support forum here: "
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: classes/admin/class-admin.php:
|
395 |
msgid "Support forum"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: classes/admin/class-admin.php:
|
399 |
msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#: classes/admin/class-admin.php:
|
403 |
msgid "Or send us an email to the following address: "
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: classes/admin/class-admin.php:
|
407 |
msgid "Send us your support request through the WooCommerce.com dashboard: "
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: classes/admin/class-admin.php:
|
411 |
msgid "More details about the developer of this plugin: "
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: classes/admin/class-admin.php:
|
415 |
msgid "Developer: SweetCode"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: classes/admin/class-admin.php:
|
419 |
msgid "Website: "
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: classes/admin/class-admin.php:
|
423 |
msgid "The Google Analytics Universal property ID looks like this:"
|
424 |
msgstr ""
|
425 |
|
426 |
-
#: classes/admin/class-admin.php:
|
427 |
msgid "The Google Analytics 4 measurement ID looks like this:"
|
428 |
msgstr ""
|
429 |
|
430 |
-
#: classes/admin/class-admin.php:
|
431 |
msgid "The conversion ID looks similar to this:"
|
432 |
msgstr ""
|
433 |
|
434 |
-
#: classes/admin/class-admin.php:
|
435 |
msgid "The purchase conversion label looks similar to this:"
|
436 |
msgstr ""
|
437 |
|
438 |
-
#: classes/admin/class-admin.php:
|
439 |
-
#: classes/admin/class-admin.php:
|
440 |
msgid "Requires an active Google Ads Conversion ID"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#: classes/admin/class-admin.php:
|
444 |
msgid "The Google Optimize container ID looks like this:"
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: classes/admin/class-admin.php:
|
448 |
-
#: classes/admin/class-admin.php:
|
449 |
msgid "or"
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: classes/admin/class-admin.php:
|
453 |
msgid "The Meta (Facebook) pixel ID looks similar to this:"
|
454 |
msgstr ""
|
455 |
|
456 |
-
#: classes/admin/class-admin.php:
|
457 |
msgid "The Microsoft Advertising UET tag ID looks similar to this:"
|
458 |
msgstr ""
|
459 |
|
460 |
-
#: classes/admin/class-admin.php:
|
461 |
msgid "The Twitter pixel ID looks similar to this:"
|
462 |
msgstr ""
|
463 |
|
464 |
-
#: classes/admin/class-admin.php:
|
465 |
msgid "The Pinterest pixel ID looks similar to this:"
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: classes/admin/class-admin.php:
|
|
|
|
|
|
|
|
|
469 |
msgid "The Snapchat pixel ID looks similar to this:"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: classes/admin/class-admin.php:
|
473 |
msgid "The TikTok pixel ID looks similar to this:"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: classes/admin/class-admin.php:
|
477 |
msgid "The Hotjar site ID looks similar to this:"
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: classes/admin/class-admin.php:
|
481 |
msgid "Order Subtotal: Doesn't include tax and shipping (default)"
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: classes/admin/class-admin.php:
|
485 |
msgid "Order Total: Includes tax and shipping"
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: classes/admin/class-admin.php:
|
489 |
msgid "Profit Margin: Only reports the profit margin. Excludes tax, shipping, and where possible, gateway fees."
|
490 |
msgstr ""
|
491 |
|
492 |
-
#: classes/admin/class-admin.php:
|
493 |
msgid "This is the order total amount reported back to the paid ads pixels (such as Google Ads, Facebook, etc.)"
|
494 |
msgstr ""
|
495 |
|
496 |
-
#: classes/admin/class-admin.php:
|
497 |
msgid "To use the Profit Margin setting you will need to install one of the following two Cost of Goods plugins:"
|
498 |
msgstr ""
|
499 |
|
500 |
-
#: classes/admin/class-admin.php:
|
501 |
-
#: classes/admin/class-admin.php:
|
502 |
msgid "open the documentation"
|
503 |
msgstr ""
|
504 |
|
505 |
-
#: classes/admin/class-admin.php:
|
506 |
msgid "Enable Google consent mode with standard settings"
|
507 |
msgstr ""
|
508 |
|
509 |
-
#: classes/admin/class-admin.php:
|
510 |
msgid "If no region is set, then the restrictions are enabled for all regions. If you specify one or more regions, then the restrictions only apply for the specified regions."
|
511 |
msgstr ""
|
512 |
|
513 |
-
#: classes/admin/class-admin.php:
|
514 |
msgid "Google Analytics Enhanced E-Commerce is "
|
515 |
msgstr ""
|
516 |
|
517 |
-
#: classes/admin/class-admin.php:
|
518 |
msgid "Google Analytics 4 activation required"
|
519 |
msgstr ""
|
520 |
|
521 |
-
#: classes/admin/class-admin.php:
|
522 |
msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: classes/admin/class-admin.php:
|
526 |
msgid "Enable Google Analytics enhanced link attribution"
|
527 |
msgstr ""
|
528 |
|
529 |
-
#: classes/admin/class-admin.php:
|
530 |
-
#: classes/admin/class-admin.php:
|
531 |
msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
|
532 |
msgstr ""
|
533 |
|
534 |
-
#: classes/admin/class-admin.php:
|
535 |
msgid "Enable Google user ID"
|
536 |
msgstr ""
|
537 |
|
538 |
-
#: classes/admin/class-admin.php:
|
539 |
msgid "Enable Google Ads Enhanced Conversions"
|
540 |
msgstr ""
|
541 |
|
542 |
-
#: classes/admin/class-admin.php:
|
543 |
msgid "You need to activate Google Ads"
|
544 |
msgstr ""
|
545 |
|
546 |
-
#: classes/admin/class-admin.php:
|
547 |
msgid "The Google Ads phone conversion number must be in the same format as on the website."
|
548 |
msgstr ""
|
549 |
|
550 |
-
#: classes/admin/class-admin.php:
|
551 |
msgid "Borlabs Cookie detected. Automatic support is:"
|
552 |
msgstr ""
|
553 |
|
554 |
-
#: classes/admin/class-admin.php:
|
555 |
msgid "Cookiebot detected. Automatic support is:"
|
556 |
msgstr ""
|
557 |
|
558 |
-
#: classes/admin/class-admin.php:
|
559 |
msgid "Complianz GDPR detected. Automatic support is:"
|
560 |
msgstr ""
|
561 |
|
562 |
-
#: classes/admin/class-admin.php:
|
563 |
msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
|
564 |
msgstr ""
|
565 |
|
566 |
-
#: classes/admin/class-admin.php:
|
567 |
msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
|
568 |
msgstr ""
|
569 |
|
570 |
-
#: classes/admin/class-admin.php:
|
571 |
msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
|
572 |
msgstr ""
|
573 |
|
574 |
-
#: classes/admin/class-admin.php:
|
575 |
msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
|
576 |
msgstr ""
|
577 |
|
578 |
-
#: classes/admin/class-admin.php:
|
579 |
msgid "Enable Explicit Consent Mode"
|
580 |
msgstr ""
|
581 |
|
582 |
-
#: classes/admin/class-admin.php:
|
583 |
msgid "Only activate the Explicit Consent Mode if you are also using a Cookie Management Platform (a cookie banner) that is compatible with this plugin. Find a list of compatible plugins in the documentation."
|
584 |
msgstr ""
|
585 |
|
586 |
-
#: classes/admin/class-admin.php:
|
587 |
-
#: classes/admin/class-admin.php:
|
588 |
-
#: classes/admin/class-admin.php:
|
589 |
-
#: classes/admin/class-admin.php:
|
590 |
msgid "You need to activate the Meta (Facebook) pixel"
|
591 |
msgstr ""
|
592 |
|
593 |
-
#: classes/admin/class-admin.php:
|
594 |
msgid "Send CAPI hits for anonymous visitors who likely have blocked the Meta (Facebook) pixel."
|
595 |
msgstr ""
|
596 |
|
597 |
-
#: classes/admin/class-admin.php:
|
598 |
msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
|
599 |
msgstr ""
|
600 |
|
601 |
-
#: classes/admin/class-admin.php:
|
602 |
msgid "Enable Meta (Facebook) product microdata output"
|
603 |
msgstr ""
|
604 |
|
605 |
-
#: classes/admin/class-admin.php:
|
606 |
msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
|
607 |
msgstr ""
|
608 |
|
609 |
-
#: classes/admin/class-admin.php:
|
610 |
msgid "Enable the maximum compatibility mode"
|
611 |
msgstr ""
|
612 |
|
613 |
-
#: classes/admin/class-admin.php:
|
614 |
msgid "Automatic Conversion Recovery (ACR) is "
|
615 |
msgstr ""
|
616 |
|
617 |
-
#: classes/admin/class-admin.php:
|
618 |
msgid "Display PMW related information on the order list page"
|
619 |
msgstr ""
|
620 |
|
621 |
-
#: classes/admin/class-admin.php:
|
|
|
|
|
|
|
|
|
622 |
msgid "Advanced order duplication prevention is "
|
623 |
msgstr ""
|
624 |
|
625 |
-
#: classes/admin/class-admin.php:
|
626 |
msgid "Basic order duplication prevention is "
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: classes/admin/class-admin.php:
|
630 |
msgid "Enable dynamic remarketing audience collection"
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: classes/admin/class-admin.php:
|
634 |
msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
|
635 |
msgstr ""
|
636 |
|
637 |
-
#: classes/admin/class-admin.php:
|
638 |
msgid "Enable variations output"
|
639 |
msgstr ""
|
640 |
|
641 |
-
#: classes/admin/class-admin.php:
|
642 |
msgid "In order for this to work you need to upload your product feed including product variations and the item_group_id. Disable it, if you choose only to upload the parent product for variable products."
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: classes/admin/class-admin.php:
|
646 |
msgid "Retail"
|
647 |
msgstr ""
|
648 |
|
649 |
-
#: classes/admin/class-admin.php:
|
650 |
msgid "Education"
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: classes/admin/class-admin.php:
|
654 |
msgid "Hotels and rentals"
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: classes/admin/class-admin.php:
|
658 |
msgid "Jobs"
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: classes/admin/class-admin.php:
|
662 |
msgid "Local deals"
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: classes/admin/class-admin.php:
|
666 |
msgid "Real estate"
|
667 |
msgstr ""
|
668 |
|
669 |
-
#: classes/admin/class-admin.php:
|
670 |
msgid "Custom"
|
671 |
msgstr ""
|
672 |
|
673 |
-
#: classes/admin/class-admin.php:
|
674 |
msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
|
675 |
msgstr ""
|
676 |
|
677 |
-
#: classes/admin/class-admin.php:
|
678 |
msgid "post ID (default)"
|
679 |
msgstr ""
|
680 |
|
681 |
-
#: classes/admin/class-admin.php:
|
682 |
msgid "SKU"
|
683 |
msgstr ""
|
684 |
|
685 |
-
#: classes/admin/class-admin.php:
|
686 |
msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
|
687 |
msgstr ""
|
688 |
|
689 |
-
#: classes/admin/class-admin.php:
|
690 |
msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: classes/admin/class-admin.php:
|
694 |
msgid "Choose a product identifier."
|
695 |
msgstr ""
|
696 |
|
697 |
-
#: classes/admin/class-admin.php:
|
698 |
msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: classes/admin/class-admin.php:
|
702 |
msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
|
703 |
msgstr ""
|
704 |
|
705 |
-
#: classes/admin/class-admin.php:
|
706 |
-
#: classes/admin/class-admin.php:
|
707 |
msgid "active"
|
708 |
msgstr ""
|
709 |
|
710 |
-
#: classes/admin/class-admin.php:
|
711 |
-
#: classes/admin/class-admin.php:
|
712 |
msgid "inactive"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: classes/admin/class-admin.php:
|
716 |
-
#: classes/admin/class-admin.php:
|
717 |
msgid "partially active"
|
718 |
msgstr ""
|
719 |
|
720 |
-
#: classes/admin/class-admin.php:
|
721 |
msgid "Pro Feature"
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: classes/admin/class-admin.php:
|
725 |
msgid "You have entered an invalid Google Analytics Universal property ID."
|
726 |
msgstr ""
|
727 |
|
728 |
-
#: classes/admin/class-admin.php:
|
729 |
msgid "You have entered an invalid Google Analytics 4 measurement ID."
|
730 |
msgstr ""
|
731 |
|
732 |
-
#: classes/admin/class-admin.php:
|
733 |
msgid "You have entered an invalid Google Analytics 4 API key."
|
734 |
msgstr ""
|
735 |
|
736 |
-
#: classes/admin/class-admin.php:
|
737 |
msgid "You have entered an invalid conversion ID. It only contains 8 to 10 digits."
|
738 |
msgstr ""
|
739 |
|
740 |
-
#: classes/admin/class-admin.php:
|
741 |
-
#: classes/admin/class-admin.php:
|
742 |
msgid "You have entered an invalid conversion label."
|
743 |
msgstr ""
|
744 |
|
745 |
-
#: classes/admin/class-admin.php:
|
746 |
msgid "You have entered an invalid merchant ID. It only contains 6 to 12 digits."
|
747 |
msgstr ""
|
748 |
|
749 |
-
#: classes/admin/class-admin.php:
|
750 |
msgid "You have entered an invalid Google Optimize container ID."
|
751 |
msgstr ""
|
752 |
|
753 |
-
#: classes/admin/class-admin.php:
|
754 |
msgid "You have entered an invalid Meta (Facebook) pixel ID. It only contains 14 to 16 digits."
|
755 |
msgstr ""
|
756 |
|
757 |
-
#: classes/admin/class-admin.php:
|
758 |
msgid "You have entered an invalid Meta (Facebook) CAPI token."
|
759 |
msgstr ""
|
760 |
|
761 |
-
#: classes/admin/class-admin.php:
|
762 |
msgid "You have entered an invalid Bing Ads UET tag ID. It only contains 7 to 9 digits."
|
763 |
msgstr ""
|
764 |
|
765 |
-
#: classes/admin/class-admin.php:
|
766 |
msgid "You have entered an invalid Twitter pixel ID. It only contains 5 to 7 lowercase letters and numbers."
|
767 |
msgstr ""
|
768 |
|
769 |
-
#: classes/admin/class-admin.php:
|
770 |
msgid "You have entered an invalid Pinterest pixel ID. It only contains 13 digits."
|
771 |
msgstr ""
|
772 |
|
773 |
-
#: classes/admin/class-admin.php:
|
774 |
msgid "You have entered an invalid Snapchat pixel ID."
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: classes/admin/class-admin.php:
|
778 |
msgid "You have entered an invalid TikTok pixel ID."
|
779 |
msgstr ""
|
780 |
|
781 |
-
#: classes/admin/class-admin.php:
|
782 |
msgid "You have entered an invalid Hotjar site ID. It only contains 6 to 9 digits."
|
783 |
msgstr ""
|
784 |
|
|
|
|
|
|
|
|
|
785 |
#. translators: %d: the amount of purchase conversions that have been measured
|
786 |
#: classes/admin/class-ask-for-rating.php:142
|
787 |
msgid "Hey, I noticed that you tracked more than %d purchase conversions with the Pixel Manager for WooCommerce plugin - that's awesome! Could you please do me a BIG favour and give it a 5-star rating on WordPress? It will help to spread the word and boost our motivation."
|
@@ -838,46 +858,46 @@ msgstr ""
|
|
838 |
msgid "Find more information about the the reason in our documentation: "
|
839 |
msgstr ""
|
840 |
|
841 |
-
#: classes/admin/class-order-columns.php:
|
842 |
msgid "PMW pixels not fired - 30d"
|
843 |
msgstr ""
|
844 |
|
845 |
-
#: classes/admin/class-order-columns.php:
|
846 |
msgid "PMW pixels fired"
|
847 |
msgstr ""
|
848 |
|
849 |
-
#: classes/admin/class-order-columns.php:
|
850 |
msgid "PMW monitored order"
|
851 |
msgstr ""
|
852 |
|
853 |
-
#: classes/admin/class-order-columns.php:
|
854 |
msgid "Not monitored by PMW"
|
855 |
msgstr ""
|
856 |
|
857 |
-
#: classes/admin/class-order-columns.php:
|
858 |
msgid "Order not tracked by PMW"
|
859 |
msgstr ""
|
860 |
|
861 |
-
#: classes/admin/class-order-columns.php:
|
862 |
msgid "This order was created by a shop manager. Only orders created by customers are analysed."
|
863 |
msgstr ""
|
864 |
|
865 |
-
#: classes/admin/class-order-columns.php:
|
866 |
msgid "Conversion pixels fired"
|
867 |
msgstr ""
|
868 |
|
869 |
-
#: classes/admin/class-order-columns.php:
|
870 |
msgid "Conversion pixels not fired yet"
|
871 |
msgstr ""
|
872 |
|
873 |
-
#: wgact.php:
|
874 |
msgid "Pixel Manager for WooCommerce error"
|
875 |
msgstr ""
|
876 |
|
877 |
-
#: wgact.php:
|
878 |
msgid "Your environment doesn't meet all the system requirements listed below."
|
879 |
msgstr ""
|
880 |
|
881 |
-
#: wgact.php:
|
882 |
msgid "The WooCommerce plugin needs to be activated"
|
883 |
msgstr ""
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Pixel Manager for WooCommerce 1.22.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/src\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-09-26T05:11:32+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
|
36 |
|
37 |
#: classes/admin/class-admin.php:278
|
38 |
#: classes/admin/class-admin.php:279
|
39 |
+
#: wgact.php:285
|
40 |
+
#: wgact.php:286
|
41 |
msgid "Pixel Manager"
|
42 |
msgstr ""
|
43 |
|
94 |
msgstr ""
|
95 |
|
96 |
#: classes/admin/class-admin.php:516
|
97 |
+
msgid "Pinterest Enhanced Match"
|
98 |
msgstr ""
|
99 |
|
100 |
#: classes/admin/class-admin.php:528
|
101 |
+
msgid "Snapchat pixel ID"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: classes/admin/class-admin.php:540
|
105 |
msgid "TikTok pixel ID"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: classes/admin/class-admin.php:553
|
109 |
msgid "Hotjar site ID"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: classes/admin/class-admin.php:565
|
113 |
msgid "Advanced"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: classes/admin/class-admin.php:616
|
117 |
msgid "Order Total Logic"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: classes/admin/class-admin.php:628
|
121 |
msgid "Order Duplication Prevention"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: classes/admin/class-admin.php:640
|
125 |
msgid "Maximum Compatibility Mode"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: classes/admin/class-admin.php:654
|
129 |
msgid "Disable Tracking for User Roles"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: classes/admin/class-admin.php:666
|
133 |
msgid "ACR"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: classes/admin/class-admin.php:679
|
137 |
msgid "Order List Info"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: classes/admin/class-admin.php:692
|
141 |
+
msgid "Scroll Tracker"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: classes/admin/class-admin.php:726
|
145 |
msgid "Conversion Cart Data"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: classes/admin/class-admin.php:739
|
149 |
msgid "Enhanced E-Commerce"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: classes/admin/class-admin.php:751
|
153 |
msgid "GA 4 API secret"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: classes/admin/class-admin.php:764
|
157 |
msgid "Enhanced Link Attribution"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: classes/admin/class-admin.php:777
|
161 |
msgid "Google User ID"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: classes/admin/class-admin.php:789
|
165 |
msgid "Google Ads Enhanced Conversions"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: classes/admin/class-admin.php:803
|
169 |
msgid "Google Ads Phone Conversion Number"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: classes/admin/class-admin.php:815
|
173 |
msgid "Google Ads Phone Conversion Label"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: classes/admin/class-admin.php:828
|
177 |
msgid "Cookie Consent Management"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: classes/admin/class-admin.php:851
|
181 |
msgid "Google Consent Mode"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: classes/admin/class-admin.php:863
|
185 |
msgid "Google Consent Regions"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: classes/admin/class-admin.php:875
|
189 |
msgid "Explicit Consent Mode"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: classes/admin/class-admin.php:888
|
193 |
+
msgid "Borlabs Cookie Support"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: classes/admin/class-admin.php:902
|
197 |
+
msgid "Cookiebot Support"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: classes/admin/class-admin.php:916
|
201 |
+
msgid "Complianz GDPR Support"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: classes/admin/class-admin.php:930
|
205 |
+
msgid "Cookie Notice Support"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: classes/admin/class-admin.php:944
|
209 |
+
msgid "Cookie Script Support"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: classes/admin/class-admin.php:958
|
213 |
+
msgid "GDPR Cookie Compliance Support"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: classes/admin/class-admin.php:972
|
217 |
+
msgid "GDPR Cookie Consent Support"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: classes/admin/class-admin.php:1005
|
221 |
msgid "Meta (Facebook) CAPI: token"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: classes/admin/class-admin.php:1017
|
225 |
msgid "Meta (Facebook) CAPI: process anonymous hits"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: classes/admin/class-admin.php:1029
|
229 |
msgid "Meta (Facebook) CAPI: send additional visitor identifiers"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: classes/admin/class-admin.php:1041
|
233 |
msgid "Meta (Facebook) Microdata Tags for Catalogues"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: classes/admin/class-admin.php:1053
|
237 |
+
#: classes/admin/class-admin.php:1066
|
238 |
+
#: classes/admin/class-admin.php:1077
|
239 |
msgid "Dynamic Remarketing"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: classes/admin/class-admin.php:1089
|
243 |
msgid "Product Identifier"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: classes/admin/class-admin.php:1101
|
247 |
msgid "Variations output"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: classes/admin/class-admin.php:1114
|
251 |
msgid "Google Business Vertical"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: classes/admin/class-admin.php:1127
|
255 |
+
#: classes/admin/class-admin.php:1136
|
256 |
msgid "Diagnostics"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: classes/admin/class-admin.php:1144
|
260 |
+
#: classes/admin/class-admin.php:1153
|
261 |
msgid "Support"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: classes/admin/class-admin.php:1161
|
265 |
+
#: classes/admin/class-admin.php:1171
|
266 |
msgid "Author"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: classes/admin/class-admin.php:1218
|
270 |
msgid ""
|
271 |
"It looks like you are using some sort of ad or script blocker which is blocking the script and CSS files of this plugin.\n"
|
272 |
" In order for the plugin to work properly you need to disable the script blocker."
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: classes/admin/class-admin.php:1225
|
276 |
#: classes/admin/class-notifications.php:96
|
277 |
#: classes/admin/class-notifications.php:146
|
278 |
msgid "Learn more"
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: classes/admin/class-admin.php:1269
|
282 |
msgid "Profit Driven Marketing by SweetCode"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: classes/admin/class-admin.php:1294
|
286 |
msgid "Visit us here:"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: classes/admin/class-admin.php:1340
|
290 |
msgid "Payment Gateway Tracking Accuracy Report"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: classes/admin/class-admin.php:1341
|
294 |
+
#: classes/admin/class-admin.php:2863
|
295 |
+
#: classes/admin/class-admin.php:2871
|
296 |
msgid "beta"
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: classes/admin/class-admin.php:1345
|
300 |
msgid "What's this? Follow this link to learn more"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: classes/admin/class-admin.php:1353
|
304 |
msgid "Available payment gateways"
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: classes/admin/class-admin.php:1360
|
308 |
msgid "id"
|
309 |
msgstr ""
|
310 |
|
311 |
+
#: classes/admin/class-admin.php:1361
|
312 |
msgid "method_title"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: classes/admin/class-admin.php:1362
|
316 |
msgid "class"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: classes/admin/class-admin.php:1380
|
320 |
msgid "Purchase confirmation page reached per gateway (active and inactive)"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: classes/admin/class-admin.php:1388
|
324 |
+
#: classes/admin/class-admin.php:1437
|
325 |
+
#: classes/admin/class-admin.php:1512
|
326 |
msgid "The analysis is being generated. Please check back in 5 minutes."
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: classes/admin/class-admin.php:1429
|
330 |
msgid "Purchase confirmation page reached per gateway (only active), weighted by frequency"
|
331 |
msgstr ""
|
332 |
|
333 |
+
#: classes/admin/class-admin.php:1500
|
334 |
msgid "Automatic Conversion Recovery (ACR)"
|
335 |
msgstr ""
|
336 |
|
337 |
#. translators: The number and percentage of orders that were recovered by the Automatic Conversion Recovery (ACR).
|
338 |
+
#: classes/admin/class-admin.php:1588
|
339 |
msgid "ACR recovered %1$s (%2$s%%) out of %3$s missing conversions."
|
340 |
msgstr ""
|
341 |
|
342 |
+
#: classes/admin/class-admin.php:1606
|
343 |
msgid "This feature is only available in the pro version of the plugin. Follow the link to learn more about it:"
|
344 |
msgstr ""
|
345 |
|
346 |
+
#: classes/admin/class-admin.php:1608
|
347 |
msgid "Get the pro version of the Pixel Manager for WooCommerce over here"
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: classes/admin/class-admin.php:1610
|
351 |
msgid "Go Pro"
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: classes/admin/class-admin.php:1639
|
355 |
msgid "Contacting Support"
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: classes/admin/class-admin.php:1661
|
359 |
msgid "Debug Information"
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: classes/admin/class-admin.php:1670
|
363 |
msgid "copy to clipboard"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: classes/admin/class-admin.php:1680
|
367 |
msgid "Export settings"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: classes/admin/class-admin.php:1692
|
371 |
msgid "Export to disk"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: classes/admin/class-admin.php:1701
|
375 |
msgid "Import settings"
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: classes/admin/class-admin.php:1706
|
379 |
msgid "Settings imported successfully!"
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: classes/admin/class-admin.php:1709
|
383 |
msgid "Reloading...(in 5 seconds)!"
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: classes/admin/class-admin.php:1715
|
387 |
msgid "There was an error importing that file! Please try again."
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: classes/admin/class-admin.php:1732
|
391 |
msgid "Translations"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: classes/admin/class-admin.php:1733
|
395 |
msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: classes/admin/class-admin.php:1751
|
399 |
msgid "Post a support request in the WordPress support forum here: "
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: classes/admin/class-admin.php:1754
|
403 |
msgid "Support forum"
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: classes/admin/class-admin.php:1758
|
407 |
msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: classes/admin/class-admin.php:1761
|
411 |
msgid "Or send us an email to the following address: "
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: classes/admin/class-admin.php:1777
|
415 |
msgid "Send us your support request through the WooCommerce.com dashboard: "
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: classes/admin/class-admin.php:1791
|
419 |
msgid "More details about the developer of this plugin: "
|
420 |
msgstr ""
|
421 |
|
422 |
+
#: classes/admin/class-admin.php:1794
|
423 |
msgid "Developer: SweetCode"
|
424 |
msgstr ""
|
425 |
|
426 |
+
#: classes/admin/class-admin.php:1796
|
427 |
msgid "Website: "
|
428 |
msgstr ""
|
429 |
|
430 |
+
#: classes/admin/class-admin.php:1819
|
431 |
msgid "The Google Analytics Universal property ID looks like this:"
|
432 |
msgstr ""
|
433 |
|
434 |
+
#: classes/admin/class-admin.php:1835
|
435 |
msgid "The Google Analytics 4 measurement ID looks like this:"
|
436 |
msgstr ""
|
437 |
|
438 |
+
#: classes/admin/class-admin.php:1851
|
439 |
msgid "The conversion ID looks similar to this:"
|
440 |
msgstr ""
|
441 |
|
442 |
+
#: classes/admin/class-admin.php:1867
|
443 |
msgid "The purchase conversion label looks similar to this:"
|
444 |
msgstr ""
|
445 |
|
446 |
+
#: classes/admin/class-admin.php:1871
|
447 |
+
#: classes/admin/class-admin.php:2685
|
448 |
msgid "Requires an active Google Ads Conversion ID"
|
449 |
msgstr ""
|
450 |
|
451 |
+
#: classes/admin/class-admin.php:1889
|
452 |
msgid "The Google Optimize container ID looks like this:"
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: classes/admin/class-admin.php:1891
|
456 |
+
#: classes/admin/class-admin.php:2086
|
457 |
msgid "or"
|
458 |
msgstr ""
|
459 |
|
460 |
+
#: classes/admin/class-admin.php:1907
|
461 |
msgid "The Meta (Facebook) pixel ID looks similar to this:"
|
462 |
msgstr ""
|
463 |
|
464 |
+
#: classes/admin/class-admin.php:1925
|
465 |
msgid "The Microsoft Advertising UET tag ID looks similar to this:"
|
466 |
msgstr ""
|
467 |
|
468 |
+
#: classes/admin/class-admin.php:1944
|
469 |
msgid "The Twitter pixel ID looks similar to this:"
|
470 |
msgstr ""
|
471 |
|
472 |
+
#: classes/admin/class-admin.php:1963
|
473 |
msgid "The Pinterest pixel ID looks similar to this:"
|
474 |
msgstr ""
|
475 |
|
476 |
+
#: classes/admin/class-admin.php:1979
|
477 |
+
msgid "Enable Pinterest enhanced match"
|
478 |
+
msgstr ""
|
479 |
+
|
480 |
+
#: classes/admin/class-admin.php:2005
|
481 |
msgid "The Snapchat pixel ID looks similar to this:"
|
482 |
msgstr ""
|
483 |
|
484 |
+
#: classes/admin/class-admin.php:2026
|
485 |
msgid "The TikTok pixel ID looks similar to this:"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: classes/admin/class-admin.php:2038
|
489 |
msgid "The Hotjar site ID looks similar to this:"
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: classes/admin/class-admin.php:2048
|
493 |
msgid "Order Subtotal: Doesn't include tax and shipping (default)"
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: classes/admin/class-admin.php:2056
|
497 |
msgid "Order Total: Includes tax and shipping"
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: classes/admin/class-admin.php:2070
|
501 |
msgid "Profit Margin: Only reports the profit margin. Excludes tax, shipping, and where possible, gateway fees."
|
502 |
msgstr ""
|
503 |
|
504 |
+
#: classes/admin/class-admin.php:2078
|
505 |
msgid "This is the order total amount reported back to the paid ads pixels (such as Google Ads, Facebook, etc.)"
|
506 |
msgstr ""
|
507 |
|
508 |
+
#: classes/admin/class-admin.php:2083
|
509 |
msgid "To use the Profit Margin setting you will need to install one of the following two Cost of Goods plugins:"
|
510 |
msgstr ""
|
511 |
|
512 |
+
#: classes/admin/class-admin.php:2110
|
513 |
+
#: classes/admin/class-admin.php:2120
|
514 |
msgid "open the documentation"
|
515 |
msgstr ""
|
516 |
|
517 |
+
#: classes/admin/class-admin.php:2140
|
518 |
msgid "Enable Google consent mode with standard settings"
|
519 |
msgstr ""
|
520 |
|
521 |
+
#: classes/admin/class-admin.php:2178
|
522 |
msgid "If no region is set, then the restrictions are enabled for all regions. If you specify one or more regions, then the restrictions only apply for the specified regions."
|
523 |
msgstr ""
|
524 |
|
525 |
+
#: classes/admin/class-admin.php:2186
|
526 |
msgid "Google Analytics Enhanced E-Commerce is "
|
527 |
msgstr ""
|
528 |
|
529 |
+
#: classes/admin/class-admin.php:2209
|
530 |
msgid "Google Analytics 4 activation required"
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: classes/admin/class-admin.php:2212
|
534 |
msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
|
535 |
msgstr ""
|
536 |
|
537 |
+
#: classes/admin/class-admin.php:2227
|
538 |
msgid "Enable Google Analytics enhanced link attribution"
|
539 |
msgstr ""
|
540 |
|
541 |
+
#: classes/admin/class-admin.php:2243
|
542 |
+
#: classes/admin/class-admin.php:2273
|
543 |
msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
|
544 |
msgstr ""
|
545 |
|
546 |
+
#: classes/admin/class-admin.php:2262
|
547 |
msgid "Enable Google user ID"
|
548 |
msgstr ""
|
549 |
|
550 |
+
#: classes/admin/class-admin.php:2292
|
551 |
msgid "Enable Google Ads Enhanced Conversions"
|
552 |
msgstr ""
|
553 |
|
554 |
+
#: classes/admin/class-admin.php:2303
|
555 |
msgid "You need to activate Google Ads"
|
556 |
msgstr ""
|
557 |
|
558 |
+
#: classes/admin/class-admin.php:2323
|
559 |
msgid "The Google Ads phone conversion number must be in the same format as on the website."
|
560 |
msgstr ""
|
561 |
|
562 |
+
#: classes/admin/class-admin.php:2345
|
563 |
msgid "Borlabs Cookie detected. Automatic support is:"
|
564 |
msgstr ""
|
565 |
|
566 |
+
#: classes/admin/class-admin.php:2351
|
567 |
msgid "Cookiebot detected. Automatic support is:"
|
568 |
msgstr ""
|
569 |
|
570 |
+
#: classes/admin/class-admin.php:2357
|
571 |
msgid "Complianz GDPR detected. Automatic support is:"
|
572 |
msgstr ""
|
573 |
|
574 |
+
#: classes/admin/class-admin.php:2363
|
575 |
msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
|
576 |
msgstr ""
|
577 |
|
578 |
+
#: classes/admin/class-admin.php:2369
|
579 |
msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
|
580 |
msgstr ""
|
581 |
|
582 |
+
#: classes/admin/class-admin.php:2375
|
583 |
msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
|
584 |
msgstr ""
|
585 |
|
586 |
+
#: classes/admin/class-admin.php:2381
|
587 |
msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
|
588 |
msgstr ""
|
589 |
|
590 |
+
#: classes/admin/class-admin.php:2400
|
591 |
msgid "Enable Explicit Consent Mode"
|
592 |
msgstr ""
|
593 |
|
594 |
+
#: classes/admin/class-admin.php:2409
|
595 |
msgid "Only activate the Explicit Consent Mode if you are also using a Cookie Management Platform (a cookie banner) that is compatible with this plugin. Find a list of compatible plugins in the documentation."
|
596 |
msgstr ""
|
597 |
|
598 |
+
#: classes/admin/class-admin.php:2428
|
599 |
+
#: classes/admin/class-admin.php:2461
|
600 |
+
#: classes/admin/class-admin.php:2490
|
601 |
+
#: classes/admin/class-admin.php:2518
|
602 |
msgid "You need to activate the Meta (Facebook) pixel"
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: classes/admin/class-admin.php:2452
|
606 |
msgid "Send CAPI hits for anonymous visitors who likely have blocked the Meta (Facebook) pixel."
|
607 |
msgstr ""
|
608 |
|
609 |
+
#: classes/admin/class-admin.php:2481
|
610 |
msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: classes/admin/class-admin.php:2509
|
614 |
msgid "Enable Meta (Facebook) product microdata output"
|
615 |
msgstr ""
|
616 |
|
617 |
+
#: classes/admin/class-admin.php:2545
|
618 |
msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: classes/admin/class-admin.php:2562
|
622 |
msgid "Enable the maximum compatibility mode"
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: classes/admin/class-admin.php:2597
|
626 |
msgid "Automatic Conversion Recovery (ACR) is "
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: classes/admin/class-admin.php:2615
|
630 |
msgid "Display PMW related information on the order list page"
|
631 |
msgstr ""
|
632 |
|
633 |
+
#: classes/admin/class-admin.php:2637
|
634 |
+
msgid "The Scroll Tracker thresholds. A comma separated list of scroll tracking thresholds in percent where the scroll tracker triggers its events."
|
635 |
+
msgstr ""
|
636 |
+
|
637 |
+
#: classes/admin/class-admin.php:2644
|
638 |
msgid "Advanced order duplication prevention is "
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: classes/admin/class-admin.php:2646
|
642 |
msgid "Basic order duplication prevention is "
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: classes/admin/class-admin.php:2670
|
646 |
msgid "Enable dynamic remarketing audience collection"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: classes/admin/class-admin.php:2691
|
650 |
msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: classes/admin/class-admin.php:2709
|
654 |
msgid "Enable variations output"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: classes/admin/class-admin.php:2720
|
658 |
msgid "In order for this to work you need to upload your product feed including product variations and the item_group_id. Disable it, if you choose only to upload the parent product for variable products."
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: classes/admin/class-admin.php:2735
|
662 |
msgid "Retail"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: classes/admin/class-admin.php:2745
|
666 |
msgid "Education"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: classes/admin/class-admin.php:2755
|
670 |
msgid "Hotels and rentals"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: classes/admin/class-admin.php:2765
|
674 |
msgid "Jobs"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: classes/admin/class-admin.php:2775
|
678 |
msgid "Local deals"
|
679 |
msgstr ""
|
680 |
|
681 |
+
#: classes/admin/class-admin.php:2785
|
682 |
msgid "Real estate"
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: classes/admin/class-admin.php:2795
|
686 |
msgid "Custom"
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: classes/admin/class-admin.php:2814
|
690 |
msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: classes/admin/class-admin.php:2823
|
694 |
msgid "post ID (default)"
|
695 |
msgstr ""
|
696 |
|
697 |
+
#: classes/admin/class-admin.php:2829
|
698 |
msgid "SKU"
|
699 |
msgstr ""
|
700 |
|
701 |
+
#: classes/admin/class-admin.php:2836
|
702 |
msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
|
703 |
msgstr ""
|
704 |
|
705 |
+
#: classes/admin/class-admin.php:2843
|
706 |
msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
|
707 |
msgstr ""
|
708 |
|
709 |
+
#: classes/admin/class-admin.php:2847
|
710 |
msgid "Choose a product identifier."
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: classes/admin/class-admin.php:2850
|
714 |
msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: classes/admin/class-admin.php:2854
|
718 |
msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: classes/admin/class-admin.php:2877
|
722 |
+
#: classes/admin/class-admin.php:2882
|
723 |
msgid "active"
|
724 |
msgstr ""
|
725 |
|
726 |
+
#: classes/admin/class-admin.php:2887
|
727 |
+
#: classes/admin/class-admin.php:2892
|
728 |
msgid "inactive"
|
729 |
msgstr ""
|
730 |
|
731 |
+
#: classes/admin/class-admin.php:2897
|
732 |
+
#: classes/admin/class-admin.php:2902
|
733 |
msgid "partially active"
|
734 |
msgstr ""
|
735 |
|
736 |
+
#: classes/admin/class-admin.php:2913
|
737 |
msgid "Pro Feature"
|
738 |
msgstr ""
|
739 |
|
740 |
+
#: classes/admin/class-admin.php:2945
|
741 |
msgid "You have entered an invalid Google Analytics Universal property ID."
|
742 |
msgstr ""
|
743 |
|
744 |
+
#: classes/admin/class-admin.php:2953
|
745 |
msgid "You have entered an invalid Google Analytics 4 measurement ID."
|
746 |
msgstr ""
|
747 |
|
748 |
+
#: classes/admin/class-admin.php:2961
|
749 |
msgid "You have entered an invalid Google Analytics 4 API key."
|
750 |
msgstr ""
|
751 |
|
752 |
+
#: classes/admin/class-admin.php:2969
|
753 |
msgid "You have entered an invalid conversion ID. It only contains 8 to 10 digits."
|
754 |
msgstr ""
|
755 |
|
756 |
+
#: classes/admin/class-admin.php:2977
|
757 |
+
#: classes/admin/class-admin.php:2985
|
758 |
msgid "You have entered an invalid conversion label."
|
759 |
msgstr ""
|
760 |
|
761 |
+
#: classes/admin/class-admin.php:2993
|
762 |
msgid "You have entered an invalid merchant ID. It only contains 6 to 12 digits."
|
763 |
msgstr ""
|
764 |
|
765 |
+
#: classes/admin/class-admin.php:3001
|
766 |
msgid "You have entered an invalid Google Optimize container ID."
|
767 |
msgstr ""
|
768 |
|
769 |
+
#: classes/admin/class-admin.php:3009
|
770 |
msgid "You have entered an invalid Meta (Facebook) pixel ID. It only contains 14 to 16 digits."
|
771 |
msgstr ""
|
772 |
|
773 |
+
#: classes/admin/class-admin.php:3017
|
774 |
msgid "You have entered an invalid Meta (Facebook) CAPI token."
|
775 |
msgstr ""
|
776 |
|
777 |
+
#: classes/admin/class-admin.php:3025
|
778 |
msgid "You have entered an invalid Bing Ads UET tag ID. It only contains 7 to 9 digits."
|
779 |
msgstr ""
|
780 |
|
781 |
+
#: classes/admin/class-admin.php:3033
|
782 |
msgid "You have entered an invalid Twitter pixel ID. It only contains 5 to 7 lowercase letters and numbers."
|
783 |
msgstr ""
|
784 |
|
785 |
+
#: classes/admin/class-admin.php:3041
|
786 |
msgid "You have entered an invalid Pinterest pixel ID. It only contains 13 digits."
|
787 |
msgstr ""
|
788 |
|
789 |
+
#: classes/admin/class-admin.php:3049
|
790 |
msgid "You have entered an invalid Snapchat pixel ID."
|
791 |
msgstr ""
|
792 |
|
793 |
+
#: classes/admin/class-admin.php:3057
|
794 |
msgid "You have entered an invalid TikTok pixel ID."
|
795 |
msgstr ""
|
796 |
|
797 |
+
#: classes/admin/class-admin.php:3065
|
798 |
msgid "You have entered an invalid Hotjar site ID. It only contains 6 to 9 digits."
|
799 |
msgstr ""
|
800 |
|
801 |
+
#: classes/admin/class-admin.php:3091
|
802 |
+
msgid "You have entered the Scroll Tracker thresholds in the wrong format. It must be a list of comma separated percentages, like this \"25,50,75,100\""
|
803 |
+
msgstr ""
|
804 |
+
|
805 |
#. translators: %d: the amount of purchase conversions that have been measured
|
806 |
#: classes/admin/class-ask-for-rating.php:142
|
807 |
msgid "Hey, I noticed that you tracked more than %d purchase conversions with the Pixel Manager for WooCommerce plugin - that's awesome! Could you please do me a BIG favour and give it a 5-star rating on WordPress? It will help to spread the word and boost our motivation."
|
858 |
msgid "Find more information about the the reason in our documentation: "
|
859 |
msgstr ""
|
860 |
|
861 |
+
#: classes/admin/class-order-columns.php:112
|
862 |
msgid "PMW pixels not fired - 30d"
|
863 |
msgstr ""
|
864 |
|
865 |
+
#: classes/admin/class-order-columns.php:154
|
866 |
msgid "PMW pixels fired"
|
867 |
msgstr ""
|
868 |
|
869 |
+
#: classes/admin/class-order-columns.php:168
|
870 |
msgid "PMW monitored order"
|
871 |
msgstr ""
|
872 |
|
873 |
+
#: classes/admin/class-order-columns.php:175
|
874 |
msgid "Not monitored by PMW"
|
875 |
msgstr ""
|
876 |
|
877 |
+
#: classes/admin/class-order-columns.php:188
|
878 |
msgid "Order not tracked by PMW"
|
879 |
msgstr ""
|
880 |
|
881 |
+
#: classes/admin/class-order-columns.php:196
|
882 |
msgid "This order was created by a shop manager. Only orders created by customers are analysed."
|
883 |
msgstr ""
|
884 |
|
885 |
+
#: classes/admin/class-order-columns.php:204
|
886 |
msgid "Conversion pixels fired"
|
887 |
msgstr ""
|
888 |
|
889 |
+
#: classes/admin/class-order-columns.php:212
|
890 |
msgid "Conversion pixels not fired yet"
|
891 |
msgstr ""
|
892 |
|
893 |
+
#: wgact.php:301
|
894 |
msgid "Pixel Manager for WooCommerce error"
|
895 |
msgstr ""
|
896 |
|
897 |
+
#: wgact.php:303
|
898 |
msgid "Your environment doesn't meet all the system requirements listed below."
|
899 |
msgstr ""
|
900 |
|
901 |
+
#: wgact.php:307
|
902 |
msgid "The WooCommerce plugin needs to be activated"
|
903 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, google analytics, google ads, facebook, conversion tracking,
|
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 7.3
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -28,7 +28,7 @@ The Pixel Managers advanced architecture has numerous advantages over other solu
|
|
28 |
|
29 |
While the setup is as simple as it can get, the pixel engine under the hood is very powerful. It tracks all e-commerce events and implements all advanced pixel features like Meta CAPI (Facebook CAPI) (Pro version), Google Analytics Enhanced E-Commerce, Google Shopping Cart Item Tracking, and much more. For advanced users, the plugin offers filters that allow them to tweak the output flexibly and fine-tune the behavior for each shop.
|
30 |
|
31 |
-
<strong>What makes the
|
32 |
|
33 |
The unparalleled and high tracking accuracy, the simple user interface, and constant innovation make Pixel Manager the best solution for e-commerce tracking.
|
34 |
|
@@ -211,6 +211,16 @@ You can send the link to the front page of your shop too if you think it would b
|
|
211 |
|
212 |
== Changelog ==
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
= 1.21.0 = 12.09.2022
|
215 |
|
216 |
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 7.3
|
7 |
+
Stable tag: 1.22.0
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
28 |
|
29 |
While the setup is as simple as it can get, the pixel engine under the hood is very powerful. It tracks all e-commerce events and implements all advanced pixel features like Meta CAPI (Facebook CAPI) (Pro version), Google Analytics Enhanced E-Commerce, Google Shopping Cart Item Tracking, and much more. For advanced users, the plugin offers filters that allow them to tweak the output flexibly and fine-tune the behavior for each shop.
|
30 |
|
31 |
+
<strong>What makes the Pixel Manager unique?</strong>
|
32 |
|
33 |
The unparalleled and high tracking accuracy, the simple user interface, and constant innovation make Pixel Manager the best solution for e-commerce tracking.
|
34 |
|
211 |
|
212 |
== Changelog ==
|
213 |
|
214 |
+
= 1.22.0 = 26.09.2022
|
215 |
+
|
216 |
+
|
217 |
+
* New: Added API for developers to handle consent management.
|
218 |
+
|
219 |
+
* Tweak: Included the action scheduler library to avoid the buggy WooCommerce implementation of the action scheduler.
|
220 |
+
* Tweak: Implemented a dynamic rate limiter that prevents possible timeouts if too many orders are being analysed in the payment gateway accuracy report.
|
221 |
+
* Fix: Fixed the <input> tag name for the product data.
|
222 |
+
* Fix: Fix for the bug that caused multiple action scheduler entries.
|
223 |
+
|
224 |
= 1.21.0 = 12.09.2022
|
225 |
|
226 |
|
vendor/composer/installed.json
CHANGED
@@ -370,6 +370,49 @@
|
|
370 |
}
|
371 |
],
|
372 |
"install-path": "../symfony/polyfill-mbstring"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
}
|
374 |
],
|
375 |
"dev": true,
|
370 |
}
|
371 |
],
|
372 |
"install-path": "../symfony/polyfill-mbstring"
|
373 |
+
},
|
374 |
+
{
|
375 |
+
"name": "woocommerce/action-scheduler",
|
376 |
+
"version": "3.5.2",
|
377 |
+
"version_normalized": "3.5.2.0",
|
378 |
+
"source": {
|
379 |
+
"type": "git",
|
380 |
+
"url": "https://github.com/woocommerce/action-scheduler.git",
|
381 |
+
"reference": "519cfa20db89eb85511cad08301d3fa33522ed8b"
|
382 |
+
},
|
383 |
+
"dist": {
|
384 |
+
"type": "zip",
|
385 |
+
"url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/519cfa20db89eb85511cad08301d3fa33522ed8b",
|
386 |
+
"reference": "519cfa20db89eb85511cad08301d3fa33522ed8b",
|
387 |
+
"shasum": ""
|
388 |
+
},
|
389 |
+
"require-dev": {
|
390 |
+
"phpunit/phpunit": "^7.5",
|
391 |
+
"woocommerce/woocommerce-sniffs": "0.1.0",
|
392 |
+
"wp-cli/wp-cli": "~2.5.0",
|
393 |
+
"yoast/phpunit-polyfills": "^1.0"
|
394 |
+
},
|
395 |
+
"time": "2022-09-16T15:31:00+00:00",
|
396 |
+
"type": "wordpress-plugin",
|
397 |
+
"extra": {
|
398 |
+
"scripts-description": {
|
399 |
+
"test": "Run unit tests",
|
400 |
+
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
|
401 |
+
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
|
402 |
+
}
|
403 |
+
},
|
404 |
+
"installation-source": "dist",
|
405 |
+
"notification-url": "https://packagist.org/downloads/",
|
406 |
+
"license": [
|
407 |
+
"GPL-3.0-or-later"
|
408 |
+
],
|
409 |
+
"description": "Action Scheduler for WordPress and WooCommerce",
|
410 |
+
"homepage": "https://actionscheduler.org/",
|
411 |
+
"support": {
|
412 |
+
"issues": "https://github.com/woocommerce/action-scheduler/issues",
|
413 |
+
"source": "https://github.com/woocommerce/action-scheduler/tree/3.5.2"
|
414 |
+
},
|
415 |
+
"install-path": "../woocommerce/action-scheduler"
|
416 |
}
|
417 |
],
|
418 |
"dev": true,
|
vendor/composer/installed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
'name' => 'sweetcode/pixel-manager-for-woocommerce',
|
4 |
'pretty_version' => 'dev-master',
|
5 |
'version' => 'dev-master',
|
6 |
-
'reference' => '
|
7 |
'type' => 'wordpress-plugin',
|
8 |
'install_path' => __DIR__ . '/../../',
|
9 |
'aliases' => array(),
|
@@ -49,7 +49,7 @@
|
|
49 |
'sweetcode/pixel-manager-for-woocommerce' => array(
|
50 |
'pretty_version' => 'dev-master',
|
51 |
'version' => 'dev-master',
|
52 |
-
'reference' => '
|
53 |
'type' => 'wordpress-plugin',
|
54 |
'install_path' => __DIR__ . '/../../',
|
55 |
'aliases' => array(),
|
@@ -73,5 +73,14 @@
|
|
73 |
'aliases' => array(),
|
74 |
'dev_requirement' => false,
|
75 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
),
|
77 |
);
|
3 |
'name' => 'sweetcode/pixel-manager-for-woocommerce',
|
4 |
'pretty_version' => 'dev-master',
|
5 |
'version' => 'dev-master',
|
6 |
+
'reference' => '8bfd1f74b484e1a4e0f09c9131e5ff31eba6466b',
|
7 |
'type' => 'wordpress-plugin',
|
8 |
'install_path' => __DIR__ . '/../../',
|
9 |
'aliases' => array(),
|
49 |
'sweetcode/pixel-manager-for-woocommerce' => array(
|
50 |
'pretty_version' => 'dev-master',
|
51 |
'version' => 'dev-master',
|
52 |
+
'reference' => '8bfd1f74b484e1a4e0f09c9131e5ff31eba6466b',
|
53 |
'type' => 'wordpress-plugin',
|
54 |
'install_path' => __DIR__ . '/../../',
|
55 |
'aliases' => array(),
|
73 |
'aliases' => array(),
|
74 |
'dev_requirement' => false,
|
75 |
),
|
76 |
+
'woocommerce/action-scheduler' => array(
|
77 |
+
'pretty_version' => '3.5.2',
|
78 |
+
'version' => '3.5.2.0',
|
79 |
+
'reference' => '519cfa20db89eb85511cad08301d3fa33522ed8b',
|
80 |
+
'type' => 'wordpress-plugin',
|
81 |
+
'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
|
82 |
+
'aliases' => array(),
|
83 |
+
'dev_requirement' => false,
|
84 |
+
),
|
85 |
),
|
86 |
);
|
vendor/woocommerce/action-scheduler/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Action Scheduler - Job Queue for WordPress [![Build Status](https://travis-ci.org/woocommerce/action-scheduler.png?branch=master)](https://travis-ci.org/woocommerce/action-scheduler) [![codecov](https://codecov.io/gh/woocommerce/action-scheduler/branch/master/graph/badge.svg)](https://codecov.io/gh/woocommerce/action-scheduler)
|
2 |
+
|
3 |
+
Action Scheduler is a scalable, traceable job queue for background processing large sets of actions in WordPress. It's specially designed to be distributed in WordPress plugins.
|
4 |
+
|
5 |
+
Action Scheduler works by triggering an action hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occassions.
|
6 |
+
|
7 |
+
Think of it like an extension to `do_action()` which adds the ability to delay and repeat a hook.
|
8 |
+
|
9 |
+
## Battle-Tested Background Processing
|
10 |
+
|
11 |
+
Every month, Action Scheduler processes millions of payments for [Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/), webhooks for [WooCommerce](https://wordpress.org/plugins/woocommerce/), as well as emails and other events for a range of other plugins.
|
12 |
+
|
13 |
+
It's been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, at a sustained rate of over 10,000 / hour without negatively impacting normal site operations.
|
14 |
+
|
15 |
+
This is all on infrastructure and WordPress sites outside the control of the plugin author.
|
16 |
+
|
17 |
+
If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help.
|
18 |
+
|
19 |
+
## Learn More
|
20 |
+
|
21 |
+
To learn more about how to Action Scheduler works, and how to use it in your plugin, check out the docs on [ActionScheduler.org](https://actionscheduler.org).
|
22 |
+
|
23 |
+
There you will find:
|
24 |
+
|
25 |
+
* [Usage guide](https://actionscheduler.org/usage/): instructions on installing and using Action Scheduler
|
26 |
+
* [WP CLI guide](https://actionscheduler.org/wp-cli/): instructions on running Action Scheduler at scale via WP CLI
|
27 |
+
* [API Reference](https://actionscheduler.org/api/): complete reference guide for all API functions
|
28 |
+
* [Administration Guide](https://actionscheduler.org/admin/): guide to managing scheduled actions via the administration screen
|
29 |
+
* [Guide to Background Processing at Scale](https://actionscheduler.org/perf/): instructions for running Action Scheduler at scale via the default WP Cron queue runner
|
30 |
+
|
31 |
+
## Credits
|
32 |
+
|
33 |
+
Action Scheduler is developed and maintained by [Automattic](http://automattic.com/) with significant early development completed by [Flightless](https://flightless.us/).
|
34 |
+
|
35 |
+
Collaboration is cool. We'd love to work with you to improve Action Scheduler. [Pull Requests](https://github.com/woocommerce/action-scheduler/pulls) welcome.
|
vendor/woocommerce/action-scheduler/action-scheduler.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Action Scheduler
|
4 |
+
* Plugin URI: https://actionscheduler.org
|
5 |
+
* Description: A robust scheduling library for use in WordPress plugins.
|
6 |
+
* Author: Automattic
|
7 |
+
* Author URI: https://automattic.com/
|
8 |
+
* Version: 3.5.2
|
9 |
+
* License: GPLv3
|
10 |
+
*
|
11 |
+
* Copyright 2019 Automattic, Inc. (https://automattic.com/contact/)
|
12 |
+
*
|
13 |
+
* This program is free software: you can redistribute it and/or modify
|
14 |
+
* it under the terms of the GNU General Public License as published by
|
15 |
+
* the Free Software Foundation, either version 3 of the License, or
|
16 |
+
* (at your option) any later version.
|
17 |
+
*
|
18 |
+
* This program is distributed in the hope that it will be useful,
|
19 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
* GNU General Public License for more details.
|
22 |
+
*
|
23 |
+
* You should have received a copy of the GNU General Public License
|
24 |
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
25 |
+
*
|
26 |
+
* @package ActionScheduler
|
27 |
+
*/
|
28 |
+
|
29 |
+
if ( ! function_exists( 'action_scheduler_register_3_dot_5_dot_2' ) && function_exists( 'add_action' ) ) {
|
30 |
+
|
31 |
+
if ( ! class_exists( 'ActionScheduler_Versions', false ) ) {
|
32 |
+
require_once __DIR__ . '/classes/ActionScheduler_Versions.php';
|
33 |
+
add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 );
|
34 |
+
}
|
35 |
+
|
36 |
+
add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_5_dot_2', 0, 0 );
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Registers this version of Action Scheduler.
|
40 |
+
*/
|
41 |
+
function action_scheduler_register_3_dot_5_dot_2() {
|
42 |
+
$versions = ActionScheduler_Versions::instance();
|
43 |
+
$versions->register( '3.5.2', 'action_scheduler_initialize_3_dot_5_dot_2' );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Initializes this version of Action Scheduler.
|
48 |
+
*/
|
49 |
+
function action_scheduler_initialize_3_dot_5_dot_2() {
|
50 |
+
// A final safety check is required even here, because historic versions of Action Scheduler
|
51 |
+
// followed a different pattern (in some unusual cases, we could reach this point and the
|
52 |
+
// ActionScheduler class is already defined—so we need to guard against that).
|
53 |
+
if ( ! class_exists( 'ActionScheduler', false ) ) {
|
54 |
+
require_once __DIR__ . '/classes/abstracts/ActionScheduler.php';
|
55 |
+
ActionScheduler::init( __FILE__ );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
// Support usage in themes - load this version if no plugin has loaded a version yet.
|
60 |
+
if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) {
|
61 |
+
action_scheduler_initialize_3_dot_5_dot_2();
|
62 |
+
do_action( 'action_scheduler_pre_theme_init' );
|
63 |
+
ActionScheduler_Versions::initialize_latest_version();
|
64 |
+
}
|
65 |
+
}
|
vendor/woocommerce/action-scheduler/changelog.txt
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*** Changelog ***
|
2 |
+
|
3 |
+
= 3.5.2 - 2022-09-16 =
|
4 |
+
* Fix - erroneous 3.5.1 release.
|
5 |
+
|
6 |
+
= 3.5.1 - 2022-09-13 =
|
7 |
+
* Maintenance on A/S docs.
|
8 |
+
* fix: PHP 8.2 deprecated notice.
|
9 |
+
|
10 |
+
= 3.5.0 - 2022-08-25 =
|
11 |
+
* Add - The active view link within the "Tools > Scheduled Actions" screen is now clickable.
|
12 |
+
* Add - A warning when there are past-due actions.
|
13 |
+
* Enhancement - Added the ability to schedule unique actions via an atomic operation.
|
14 |
+
* Enhancement - Improvements to cache invalidation when processing batches (when running on WordPress 6.0+).
|
15 |
+
* Enhancement - If a recurring action is found to be consistently failing, it will stop being rescheduled.
|
16 |
+
* Enhancement - Adds a new "Past Due" view to the scheduled actions list table.
|
17 |
+
|
18 |
+
= 3.4.2 - 2022-06-08 =
|
19 |
+
* Fix - Change the include for better linting.
|
20 |
+
* Fix - update: Added Action scheduler completed action hook.
|
21 |
+
|
22 |
+
= 3.4.1 - 2022-05-24 =
|
23 |
+
* Fix - Change the include for better linting.
|
24 |
+
* Fix - Fix the documented return type.
|
25 |
+
|
26 |
+
= 3.4.0 - 2021-10-29 =
|
27 |
+
* Enhancement - Number of items per page can now be set for the Scheduled Actions view (props @ovidiul). #771
|
28 |
+
* Fix - Do not lower the max_execution_time if it is already set to 0 (unlimited) (props @barryhughes). #755
|
29 |
+
* Fix - Avoid triggering autoloaders during the version resolution process (props @olegabr). #731 & #776
|
30 |
+
* Dev - ActionScheduler_wcSystemStatus PHPCS fixes (props @ovidiul). #761
|
31 |
+
* Dev - ActionScheduler_DBLogger.php PHPCS fixes (props @ovidiul). #768
|
32 |
+
* Dev - Fixed phpcs for ActionScheduler_Schedule_Deprecated (props @ovidiul). #762
|
33 |
+
* Dev - Improve actions table indicies (props @glagonikas). #774 & #777
|
34 |
+
* Dev - PHPCS fixes for ActionScheduler_DBStore.php (props @ovidiul). #769 & #778
|
35 |
+
* Dev - PHPCS Fixes for ActionScheduler_Abstract_ListTable (props @ovidiul). #763 & #779
|
36 |
+
* Dev - Adds new filter action_scheduler_claim_actions_order_by to allow tuning of the claim query (props @glagonikas). #773
|
37 |
+
* Dev - PHPCS fixes for ActionScheduler_WpPostStore class (props @ovidiul). #780
|
38 |
+
|
39 |
+
= 3.3.0 - 2021-09-15 =
|
40 |
+
* Enhancement - Adds as_has_scheduled_action() to provide a performant way to test for existing actions. #645
|
41 |
+
* Fix - Improves compatibility with environments where NO_ZERO_DATE is enabled. #519
|
42 |
+
* Fix - Adds safety checks to guard against errors when our database tables cannot be created. #645
|
43 |
+
* Dev - Now supports queries that use multiple statuses. #649
|
44 |
+
* Dev - Minimum requirements for WordPress and PHP bumped (to 5.2 and 5.6 respectively). #723
|
45 |
+
|
46 |
+
= 3.2.1 - 2021-06-21 =
|
47 |
+
* Fix - Add extra safety/account for different versions of AS and different loading patterns. #714
|
48 |
+
* Fix - Handle hidden columns (Tools → Scheduled Actions) | #600.
|
49 |
+
|
50 |
+
= 3.2.0 - 2021-06-03 =
|
51 |
+
* Fix - Add "no ordering" option to as_next_scheduled_action().
|
52 |
+
* Fix - Add secondary scheduled date checks when claiming actions (DBStore) | #634.
|
53 |
+
* Fix - Add secondary scheduled date checks when claiming actions (wpPostStore) | #634.
|
54 |
+
* Fix - Adds a new index to the action table, reducing the potential for deadlocks (props: @glagonikas).
|
55 |
+
* Fix - Fix unit tests infrastructure and adapt tests to PHP 8.
|
56 |
+
* Fix - Identify in-use data store.
|
57 |
+
* Fix - Improve test_migration_is_scheduled.
|
58 |
+
* Fix - PHP notice on list table.
|
59 |
+
* Fix - Speed up clean up and batch selects.
|
60 |
+
* Fix - Update pending dependencies.
|
61 |
+
* Fix - [PHP 8.0] Only pass action arg values through to do_action_ref_array().
|
62 |
+
* Fix - [PHP 8] Set the PHP version to 7.1 in composer.json for PHP 8 compatibility.
|
63 |
+
* Fix - add is_initialized() to docs.
|
64 |
+
* Fix - fix file permissions.
|
65 |
+
* Fix - fixes #664 by replacing __ with esc_html__.
|
66 |
+
|
67 |
+
= 3.1.6 - 2020-05-12 =
|
68 |
+
* Change log starts.
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionClaim.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_ActionClaim
|
5 |
+
*/
|
6 |
+
class ActionScheduler_ActionClaim {
|
7 |
+
private $id = '';
|
8 |
+
private $action_ids = array();
|
9 |
+
|
10 |
+
public function __construct( $id, array $action_ids ) {
|
11 |
+
$this->id = $id;
|
12 |
+
$this->action_ids = $action_ids;
|
13 |
+
}
|
14 |
+
|
15 |
+
public function get_id() {
|
16 |
+
return $this->id;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function get_actions() {
|
20 |
+
return $this->action_ids;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionFactory.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_ActionFactory
|
5 |
+
*/
|
6 |
+
class ActionScheduler_ActionFactory {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Return stored actions for given params.
|
10 |
+
*
|
11 |
+
* @param string $status The action's status in the data store.
|
12 |
+
* @param string $hook The hook to trigger when this action runs.
|
13 |
+
* @param array $args Args to pass to callbacks when the hook is triggered.
|
14 |
+
* @param ActionScheduler_Schedule $schedule The action's schedule.
|
15 |
+
* @param string $group A group to put the action in.
|
16 |
+
*
|
17 |
+
* @return ActionScheduler_Action An instance of the stored action.
|
18 |
+
*/
|
19 |
+
public function get_stored_action( $status, $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
|
20 |
+
|
21 |
+
switch ( $status ) {
|
22 |
+
case ActionScheduler_Store::STATUS_PENDING:
|
23 |
+
$action_class = 'ActionScheduler_Action';
|
24 |
+
break;
|
25 |
+
case ActionScheduler_Store::STATUS_CANCELED:
|
26 |
+
$action_class = 'ActionScheduler_CanceledAction';
|
27 |
+
if ( ! is_null( $schedule ) && ! is_a( $schedule, 'ActionScheduler_CanceledSchedule' ) && ! is_a( $schedule, 'ActionScheduler_NullSchedule' ) ) {
|
28 |
+
$schedule = new ActionScheduler_CanceledSchedule( $schedule->get_date() );
|
29 |
+
}
|
30 |
+
break;
|
31 |
+
default:
|
32 |
+
$action_class = 'ActionScheduler_FinishedAction';
|
33 |
+
break;
|
34 |
+
}
|
35 |
+
|
36 |
+
$action_class = apply_filters( 'action_scheduler_stored_action_class', $action_class, $status, $hook, $args, $schedule, $group );
|
37 |
+
|
38 |
+
$action = new $action_class( $hook, $args, $schedule, $group );
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Allow 3rd party code to change the instantiated action for a given hook, args, schedule and group.
|
42 |
+
*
|
43 |
+
* @param ActionScheduler_Action $action The instantiated action.
|
44 |
+
* @param string $hook The instantiated action's hook.
|
45 |
+
* @param array $args The instantiated action's args.
|
46 |
+
* @param ActionScheduler_Schedule $schedule The instantiated action's schedule.
|
47 |
+
* @param string $group The instantiated action's group.
|
48 |
+
*/
|
49 |
+
return apply_filters( 'action_scheduler_stored_action_instance', $action, $hook, $args, $schedule, $group );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Enqueue an action to run one time, as soon as possible (rather a specific scheduled time).
|
54 |
+
*
|
55 |
+
* This method creates a new action with the NULLSchedule. This schedule maps to a MySQL datetime string of
|
56 |
+
* 0000-00-00 00:00:00. This is done to create a psuedo "async action" type that is fully backward compatible.
|
57 |
+
* Existing queries to claim actions claim by date, meaning actions scheduled for 0000-00-00 00:00:00 will
|
58 |
+
* always be claimed prior to actions scheduled for a specific date. This makes sure that any async action is
|
59 |
+
* given priority in queue processing. This has the added advantage of making sure async actions can be
|
60 |
+
* claimed by both the existing WP Cron and WP CLI runners, as well as a new async request runner.
|
61 |
+
*
|
62 |
+
* @param string $hook The hook to trigger when this action runs.
|
63 |
+
* @param array $args Args to pass when the hook is triggered.
|
64 |
+
* @param string $group A group to put the action in.
|
65 |
+
*
|
66 |
+
* @return int The ID of the stored action.
|
67 |
+
*/
|
68 |
+
public function async( $hook, $args = array(), $group = '' ) {
|
69 |
+
return $this->async_unique( $hook, $args, $group, false );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Same as async, but also supports $unique param.
|
74 |
+
*
|
75 |
+
* @param string $hook The hook to trigger when this action runs.
|
76 |
+
* @param array $args Args to pass when the hook is triggered.
|
77 |
+
* @param string $group A group to put the action in.
|
78 |
+
* @param bool $unique Whether to ensure the action is unique.
|
79 |
+
*
|
80 |
+
* @return int The ID of the stored action.
|
81 |
+
*/
|
82 |
+
public function async_unique( $hook, $args = array(), $group = '', $unique = true ) {
|
83 |
+
$schedule = new ActionScheduler_NullSchedule();
|
84 |
+
$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
|
85 |
+
return $unique ? $this->store_unique_action( $action, $unique ) : $this->store( $action );
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Create single action.
|
90 |
+
*
|
91 |
+
* @param string $hook The hook to trigger when this action runs.
|
92 |
+
* @param array $args Args to pass when the hook is triggered.
|
93 |
+
* @param int $when Unix timestamp when the action will run.
|
94 |
+
* @param string $group A group to put the action in.
|
95 |
+
*
|
96 |
+
* @return int The ID of the stored action.
|
97 |
+
*/
|
98 |
+
public function single( $hook, $args = array(), $when = null, $group = '' ) {
|
99 |
+
return $this->single_unique( $hook, $args, $when, $group, false );
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Create single action only if there is no pending or running action with same name and params.
|
104 |
+
*
|
105 |
+
* @param string $hook The hook to trigger when this action runs.
|
106 |
+
* @param array $args Args to pass when the hook is triggered.
|
107 |
+
* @param int $when Unix timestamp when the action will run.
|
108 |
+
* @param string $group A group to put the action in.
|
109 |
+
* @param bool $unique Whether action scheduled should be unique.
|
110 |
+
*
|
111 |
+
* @return int The ID of the stored action.
|
112 |
+
*/
|
113 |
+
public function single_unique( $hook, $args = array(), $when = null, $group = '', $unique = true ) {
|
114 |
+
$date = as_get_datetime_object( $when );
|
115 |
+
$schedule = new ActionScheduler_SimpleSchedule( $date );
|
116 |
+
$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
|
117 |
+
return $unique ? $this->store_unique_action( $action ) : $this->store( $action );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Create the first instance of an action recurring on a given interval.
|
122 |
+
*
|
123 |
+
* @param string $hook The hook to trigger when this action runs.
|
124 |
+
* @param array $args Args to pass when the hook is triggered.
|
125 |
+
* @param int $first Unix timestamp for the first run.
|
126 |
+
* @param int $interval Seconds between runs.
|
127 |
+
* @param string $group A group to put the action in.
|
128 |
+
*
|
129 |
+
* @return int The ID of the stored action.
|
130 |
+
*/
|
131 |
+
public function recurring( $hook, $args = array(), $first = null, $interval = null, $group = '' ) {
|
132 |
+
return $this->recurring_unique( $hook, $args, $first, $interval, $group, false );
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Create the first instance of an action recurring on a given interval only if there is no pending or running action with same name and params.
|
137 |
+
*
|
138 |
+
* @param string $hook The hook to trigger when this action runs.
|
139 |
+
* @param array $args Args to pass when the hook is triggered.
|
140 |
+
* @param int $first Unix timestamp for the first run.
|
141 |
+
* @param int $interval Seconds between runs.
|
142 |
+
* @param string $group A group to put the action in.
|
143 |
+
* @param bool $unique Whether action scheduled should be unique.
|
144 |
+
*
|
145 |
+
* @return int The ID of the stored action.
|
146 |
+
*/
|
147 |
+
public function recurring_unique( $hook, $args = array(), $first = null, $interval = null, $group = '', $unique = true ) {
|
148 |
+
if ( empty( $interval ) ) {
|
149 |
+
return $this->single_unique( $hook, $unique, $args, $first, $group );
|
150 |
+
}
|
151 |
+
$date = as_get_datetime_object( $first );
|
152 |
+
$schedule = new ActionScheduler_IntervalSchedule( $date, $interval );
|
153 |
+
$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
|
154 |
+
return $unique ? $this->store_unique_action( $action ) : $this->store( $action );
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Create the first instance of an action recurring on a Cron schedule.
|
159 |
+
*
|
160 |
+
* @param string $hook The hook to trigger when this action runs.
|
161 |
+
* @param array $args Args to pass when the hook is triggered.
|
162 |
+
* @param int $base_timestamp The first instance of the action will be scheduled
|
163 |
+
* to run at a time calculated after this timestamp matching the cron
|
164 |
+
* expression. This can be used to delay the first instance of the action.
|
165 |
+
* @param int $schedule A cron definition string.
|
166 |
+
* @param string $group A group to put the action in.
|
167 |
+
*
|
168 |
+
* @return int The ID of the stored action.
|
169 |
+
*/
|
170 |
+
public function cron( $hook, $args = array(), $base_timestamp = null, $schedule = null, $group = '' ) {
|
171 |
+
return $this->cron_unique( $hook, $args, $base_timestamp, $schedule, $group, false );
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Create the first instance of an action recurring on a Cron schedule only if there is no pending or running action with same name and params.
|
177 |
+
*
|
178 |
+
* @param string $hook The hook to trigger when this action runs.
|
179 |
+
* @param array $args Args to pass when the hook is triggered.
|
180 |
+
* @param int $base_timestamp The first instance of the action will be scheduled
|
181 |
+
* to run at a time calculated after this timestamp matching the cron
|
182 |
+
* expression. This can be used to delay the first instance of the action.
|
183 |
+
* @param int $schedule A cron definition string.
|
184 |
+
* @param string $group A group to put the action in.
|
185 |
+
* @param bool $unique Whether action scheduled should be unique.
|
186 |
+
*
|
187 |
+
* @return int The ID of the stored action.
|
188 |
+
**/
|
189 |
+
public function cron_unique( $hook, $args = array(), $base_timestamp = null, $schedule = null, $group = '', $unique = true ) {
|
190 |
+
if ( empty( $schedule ) ) {
|
191 |
+
return $this->single_unique( $hook, $unique, $args, $base_timestamp, $group );
|
192 |
+
}
|
193 |
+
$date = as_get_datetime_object( $base_timestamp );
|
194 |
+
$cron = CronExpression::factory( $schedule );
|
195 |
+
$schedule = new ActionScheduler_CronSchedule( $date, $cron );
|
196 |
+
$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
|
197 |
+
return $unique ? $this->store_unique_action( $action ) : $this->store( $action );
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Create a successive instance of a recurring or cron action.
|
202 |
+
*
|
203 |
+
* Importantly, the action will be rescheduled to run based on the current date/time.
|
204 |
+
* That means when the action is scheduled to run in the past, the next scheduled date
|
205 |
+
* will be pushed forward. For example, if a recurring action set to run every hour
|
206 |
+
* was scheduled to run 5 seconds ago, it will be next scheduled for 1 hour in the
|
207 |
+
* future, which is 1 hour and 5 seconds from when it was last scheduled to run.
|
208 |
+
*
|
209 |
+
* Alternatively, if the action is scheduled to run in the future, and is run early,
|
210 |
+
* likely via manual intervention, then its schedule will change based on the time now.
|
211 |
+
* For example, if a recurring action set to run every day, and is run 12 hours early,
|
212 |
+
* it will run again in 24 hours, not 36 hours.
|
213 |
+
*
|
214 |
+
* This slippage is less of an issue with Cron actions, as the specific run time can
|
215 |
+
* be set for them to run, e.g. 1am each day. In those cases, and entire period would
|
216 |
+
* need to be missed before there was any change is scheduled, e.g. in the case of an
|
217 |
+
* action scheduled for 1am each day, the action would need to run an entire day late.
|
218 |
+
*
|
219 |
+
* @param ActionScheduler_Action $action The existing action.
|
220 |
+
*
|
221 |
+
* @return string The ID of the stored action
|
222 |
+
* @throws InvalidArgumentException If $action is not a recurring action.
|
223 |
+
*/
|
224 |
+
public function repeat( $action ) {
|
225 |
+
$schedule = $action->get_schedule();
|
226 |
+
$next = $schedule->get_next( as_get_datetime_object() );
|
227 |
+
|
228 |
+
if ( is_null( $next ) || ! $schedule->is_recurring() ) {
|
229 |
+
throw new InvalidArgumentException( __( 'Invalid action - must be a recurring action.', 'action-scheduler' ) );
|
230 |
+
}
|
231 |
+
|
232 |
+
$schedule_class = get_class( $schedule );
|
233 |
+
$new_schedule = new $schedule( $next, $schedule->get_recurrence(), $schedule->get_first_date() );
|
234 |
+
$new_action = new ActionScheduler_Action( $action->get_hook(), $action->get_args(), $new_schedule, $action->get_group() );
|
235 |
+
return $this->store( $new_action );
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Save action to database.
|
240 |
+
*
|
241 |
+
* @param ActionScheduler_Action $action Action object to save.
|
242 |
+
*
|
243 |
+
* @return int The ID of the stored action
|
244 |
+
*/
|
245 |
+
protected function store( ActionScheduler_Action $action ) {
|
246 |
+
$store = ActionScheduler_Store::instance();
|
247 |
+
return $store->save_action( $action );
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Store action if it's unique.
|
252 |
+
*
|
253 |
+
* @param ActionScheduler_Action $action Action object to store.
|
254 |
+
*
|
255 |
+
* @return int ID of the created action. Will be 0 if action was not created.
|
256 |
+
*/
|
257 |
+
protected function store_unique_action( ActionScheduler_Action $action ) {
|
258 |
+
$store = ActionScheduler_Store::instance();
|
259 |
+
return method_exists( $store, 'save_unique_action' ) ?
|
260 |
+
$store->save_unique_action( $action ) : $store->save_action( $action );
|
261 |
+
}
|
262 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_AdminView.php
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_AdminView
|
5 |
+
* @codeCoverageIgnore
|
6 |
+
*/
|
7 |
+
class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated {
|
8 |
+
|
9 |
+
private static $admin_view = NULL;
|
10 |
+
|
11 |
+
private static $screen_id = 'tools_page_action-scheduler';
|
12 |
+
|
13 |
+
/** @var ActionScheduler_ListTable */
|
14 |
+
protected $list_table;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return ActionScheduler_AdminView
|
18 |
+
* @codeCoverageIgnore
|
19 |
+
*/
|
20 |
+
public static function instance() {
|
21 |
+
|
22 |
+
if ( empty( self::$admin_view ) ) {
|
23 |
+
$class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');
|
24 |
+
self::$admin_view = new $class();
|
25 |
+
}
|
26 |
+
|
27 |
+
return self::$admin_view;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @codeCoverageIgnore
|
32 |
+
*/
|
33 |
+
public function init() {
|
34 |
+
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false == DOING_AJAX ) ) {
|
35 |
+
|
36 |
+
if ( class_exists( 'WooCommerce' ) ) {
|
37 |
+
add_action( 'woocommerce_admin_status_content_action-scheduler', array( $this, 'render_admin_ui' ) );
|
38 |
+
add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
|
39 |
+
add_filter( 'woocommerce_admin_status_tabs', array( $this, 'register_system_status_tab' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
add_action( 'admin_menu', array( $this, 'register_menu' ) );
|
43 |
+
add_action( 'admin_notices', array( $this, 'maybe_check_pastdue_actions' ) );
|
44 |
+
add_action( 'current_screen', array( $this, 'add_help_tabs' ) );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public function system_status_report() {
|
49 |
+
$table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
|
50 |
+
$table->render();
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Registers action-scheduler into WooCommerce > System status.
|
55 |
+
*
|
56 |
+
* @param array $tabs An associative array of tab key => label.
|
57 |
+
* @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs
|
58 |
+
*/
|
59 |
+
public function register_system_status_tab( array $tabs ) {
|
60 |
+
$tabs['action-scheduler'] = __( 'Scheduled Actions', 'action-scheduler' );
|
61 |
+
|
62 |
+
return $tabs;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Include Action Scheduler's administration under the Tools menu.
|
67 |
+
*
|
68 |
+
* A menu under the Tools menu is important for backward compatibility (as that's
|
69 |
+
* where it started), and also provides more convenient access than the WooCommerce
|
70 |
+
* System Status page, and for sites where WooCommerce isn't active.
|
71 |
+
*/
|
72 |
+
public function register_menu() {
|
73 |
+
$hook_suffix = add_submenu_page(
|
74 |
+
'tools.php',
|
75 |
+
__( 'Scheduled Actions', 'action-scheduler' ),
|
76 |
+
__( 'Scheduled Actions', 'action-scheduler' ),
|
77 |
+
'manage_options',
|
78 |
+
'action-scheduler',
|
79 |
+
array( $this, 'render_admin_ui' )
|
80 |
+
);
|
81 |
+
add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Triggers processing of any pending actions.
|
86 |
+
*/
|
87 |
+
public function process_admin_ui() {
|
88 |
+
$this->get_list_table();
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Renders the Admin UI
|
93 |
+
*/
|
94 |
+
public function render_admin_ui() {
|
95 |
+
$table = $this->get_list_table();
|
96 |
+
$table->display_page();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get the admin UI object and process any requested actions.
|
101 |
+
*
|
102 |
+
* @return ActionScheduler_ListTable
|
103 |
+
*/
|
104 |
+
protected function get_list_table() {
|
105 |
+
if ( null === $this->list_table ) {
|
106 |
+
$this->list_table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() );
|
107 |
+
$this->list_table->process_actions();
|
108 |
+
}
|
109 |
+
|
110 |
+
return $this->list_table;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Action: admin_notices
|
115 |
+
*
|
116 |
+
* Maybe check past-due actions, and print notice.
|
117 |
+
*
|
118 |
+
* @uses $this->check_pastdue_actions()
|
119 |
+
*/
|
120 |
+
public function maybe_check_pastdue_actions() {
|
121 |
+
|
122 |
+
# Filter to prevent checking actions (ex: inappropriate user).
|
123 |
+
if ( ! apply_filters( 'action_scheduler_check_pastdue_actions', current_user_can( 'manage_options' ) ) ) {
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
# Get last check transient.
|
128 |
+
$last_check = get_transient( 'action_scheduler_last_pastdue_actions_check' );
|
129 |
+
|
130 |
+
# If transient exists, we're within interval, so bail.
|
131 |
+
if ( ! empty( $last_check ) ) {
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
|
135 |
+
# Perform the check.
|
136 |
+
$this->check_pastdue_actions();
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Check past-due actions, and print notice.
|
141 |
+
*
|
142 |
+
* @todo update $link_url to "Past-due" filter when released (see issue #510, PR #511)
|
143 |
+
*/
|
144 |
+
protected function check_pastdue_actions() {
|
145 |
+
|
146 |
+
# Set thresholds.
|
147 |
+
$threshold_seconds = ( int ) apply_filters( 'action_scheduler_pastdue_actions_seconds', DAY_IN_SECONDS );
|
148 |
+
$threshhold_min = ( int ) apply_filters( 'action_scheduler_pastdue_actions_min', 1 );
|
149 |
+
|
150 |
+
# Allow third-parties to preempt the default check logic.
|
151 |
+
$check = apply_filters( 'action_scheduler_pastdue_actions_check_pre', null );
|
152 |
+
|
153 |
+
# Scheduled actions query arguments.
|
154 |
+
$query_args = array(
|
155 |
+
'date' => as_get_datetime_object( time() - $threshold_seconds ),
|
156 |
+
'status' => ActionScheduler_Store::STATUS_PENDING,
|
157 |
+
'per_page' => $threshhold_min,
|
158 |
+
);
|
159 |
+
|
160 |
+
# If no third-party preempted, run default check.
|
161 |
+
if ( is_null( $check ) ) {
|
162 |
+
$store = ActionScheduler_Store::instance();
|
163 |
+
$num_pastdue_actions = ( int ) $store->query_actions( $query_args, 'count' );
|
164 |
+
|
165 |
+
# Check if past-due actions count is greater than or equal to threshold.
|
166 |
+
$check = ( $num_pastdue_actions >= $threshhold_min );
|
167 |
+
$check = ( bool ) apply_filters( 'action_scheduler_pastdue_actions_check', $check, $num_pastdue_actions, $threshold_seconds, $threshhold_min );
|
168 |
+
}
|
169 |
+
|
170 |
+
# If check failed, set transient and abort.
|
171 |
+
if ( ! boolval( $check ) ) {
|
172 |
+
$interval = apply_filters( 'action_scheduler_pastdue_actions_check_interval', round( $threshold_seconds / 4 ), $threshold_seconds );
|
173 |
+
set_transient( 'action_scheduler_last_pastdue_actions_check', time(), $interval );
|
174 |
+
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
$actions_url = add_query_arg( array(
|
179 |
+
'page' => 'action-scheduler',
|
180 |
+
'status' => 'past-due',
|
181 |
+
'order' => 'asc',
|
182 |
+
), admin_url( 'tools.php' ) );
|
183 |
+
|
184 |
+
# Print notice.
|
185 |
+
echo '<div class="notice notice-warning"><p>';
|
186 |
+
printf(
|
187 |
+
_n(
|
188 |
+
// translators: 1) is the number of affected actions, 2) is a link to an admin screen.
|
189 |
+
'<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due action</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>',
|
190 |
+
'<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due actions</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>',
|
191 |
+
$num_pastdue_actions,
|
192 |
+
'action-scheduler'
|
193 |
+
),
|
194 |
+
$num_pastdue_actions,
|
195 |
+
esc_attr( esc_url( $actions_url ) )
|
196 |
+
);
|
197 |
+
echo '</p></div>';
|
198 |
+
|
199 |
+
# Facilitate third-parties to evaluate and print notices.
|
200 |
+
do_action( 'action_scheduler_pastdue_actions_extra_notices', $query_args );
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Provide more information about the screen and its data in the help tab.
|
205 |
+
*/
|
206 |
+
public function add_help_tabs() {
|
207 |
+
$screen = get_current_screen();
|
208 |
+
|
209 |
+
if ( ! $screen || self::$screen_id != $screen->id ) {
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
|
213 |
+
$as_version = ActionScheduler_Versions::instance()->latest_version();
|
214 |
+
$screen->add_help_tab(
|
215 |
+
array(
|
216 |
+
'id' => 'action_scheduler_about',
|
217 |
+
'title' => __( 'About', 'action-scheduler' ),
|
218 |
+
'content' =>
|
219 |
+
'<h2>' . sprintf( __( 'About Action Scheduler %s', 'action-scheduler' ), $as_version ) . '</h2>' .
|
220 |
+
'<p>' .
|
221 |
+
__( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'action-scheduler' ) .
|
222 |
+
'</p>',
|
223 |
+
)
|
224 |
+
);
|
225 |
+
|
226 |
+
$screen->add_help_tab(
|
227 |
+
array(
|
228 |
+
'id' => 'action_scheduler_columns',
|
229 |
+
'title' => __( 'Columns', 'action-scheduler' ),
|
230 |
+
'content' =>
|
231 |
+
'<h2>' . __( 'Scheduled Action Columns', 'action-scheduler' ) . '</h2>' .
|
232 |
+
'<ul>' .
|
233 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Hook', 'action-scheduler' ), __( 'Name of the action hook that will be triggered.', 'action-scheduler' ) ) .
|
234 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Status', 'action-scheduler' ), __( 'Action statuses are Pending, Complete, Canceled, Failed', 'action-scheduler' ) ) .
|
235 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Arguments', 'action-scheduler' ), __( 'Optional data array passed to the action hook.', 'action-scheduler' ) ) .
|
236 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Group', 'action-scheduler' ), __( 'Optional action group.', 'action-scheduler' ) ) .
|
237 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Recurrence', 'action-scheduler' ), __( 'The action\'s schedule frequency.', 'action-scheduler' ) ) .
|
238 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Scheduled', 'action-scheduler' ), __( 'The date/time the action is/was scheduled to run.', 'action-scheduler' ) ) .
|
239 |
+
sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Log', 'action-scheduler' ), __( 'Activity log for the action.', 'action-scheduler' ) ) .
|
240 |
+
'</ul>',
|
241 |
+
)
|
242 |
+
);
|
243 |
+
}
|
244 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ActionScheduler_AsyncRequest_QueueRunner
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* ActionScheduler_AsyncRequest_QueueRunner class.
|
10 |
+
*/
|
11 |
+
class ActionScheduler_AsyncRequest_QueueRunner extends WP_Async_Request {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Data store for querying actions
|
15 |
+
*
|
16 |
+
* @var ActionScheduler_Store
|
17 |
+
* @access protected
|
18 |
+
*/
|
19 |
+
protected $store;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Prefix for ajax hooks
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
* @access protected
|
26 |
+
*/
|
27 |
+
protected $prefix = 'as';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Action for ajax hooks
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
* @access protected
|
34 |
+
*/
|
35 |
+
protected $action = 'async_request_queue_runner';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Initiate new async request
|
39 |
+
*/
|
40 |
+
public function __construct( ActionScheduler_Store $store ) {
|
41 |
+
parent::__construct();
|
42 |
+
$this->store = $store;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Handle async requests
|
47 |
+
*
|
48 |
+
* Run a queue, and maybe dispatch another async request to run another queue
|
49 |
+
* if there are still pending actions after completing a queue in this request.
|
50 |
+
*/
|
51 |
+
protected function handle() {
|
52 |
+
do_action( 'action_scheduler_run_queue', 'Async Request' ); // run a queue in the same way as WP Cron, but declare the Async Request context
|
53 |
+
|
54 |
+
$sleep_seconds = $this->get_sleep_seconds();
|
55 |
+
|
56 |
+
if ( $sleep_seconds ) {
|
57 |
+
sleep( $sleep_seconds );
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->maybe_dispatch();
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* If the async request runner is needed and allowed to run, dispatch a request.
|
65 |
+
*/
|
66 |
+
public function maybe_dispatch() {
|
67 |
+
if ( ! $this->allow() ) {
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
$this->dispatch();
|
72 |
+
ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Only allow async requests when needed.
|
77 |
+
*
|
78 |
+
* Also allow 3rd party code to disable running actions via async requests.
|
79 |
+
*/
|
80 |
+
protected function allow() {
|
81 |
+
|
82 |
+
if ( ! has_action( 'action_scheduler_run_queue' ) || ActionScheduler::runner()->has_maximum_concurrent_batches() || ! $this->store->has_pending_actions_due() ) {
|
83 |
+
$allow = false;
|
84 |
+
} else {
|
85 |
+
$allow = true;
|
86 |
+
}
|
87 |
+
|
88 |
+
return apply_filters( 'action_scheduler_allow_async_request_runner', $allow );
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Chaining async requests can crash MySQL. A brief sleep call in PHP prevents that.
|
93 |
+
*/
|
94 |
+
protected function get_sleep_seconds() {
|
95 |
+
return apply_filters( 'action_scheduler_async_request_sleep_seconds', 5, $this );
|
96 |
+
}
|
97 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_Compatibility.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Compatibility
|
5 |
+
*/
|
6 |
+
class ActionScheduler_Compatibility {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Converts a shorthand byte value to an integer byte value.
|
10 |
+
*
|
11 |
+
* Wrapper for wp_convert_hr_to_bytes(), moved to load.php in WordPress 4.6 from media.php
|
12 |
+
*
|
13 |
+
* @link https://secure.php.net/manual/en/function.ini-get.php
|
14 |
+
* @link https://secure.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
|
15 |
+
*
|
16 |
+
* @param string $value A (PHP ini) byte value, either shorthand or ordinary.
|
17 |
+
* @return int An integer byte value.
|
18 |
+
*/
|
19 |
+
public static function convert_hr_to_bytes( $value ) {
|
20 |
+
if ( function_exists( 'wp_convert_hr_to_bytes' ) ) {
|
21 |
+
return wp_convert_hr_to_bytes( $value );
|
22 |
+
}
|
23 |
+
|
24 |
+
$value = strtolower( trim( $value ) );
|
25 |
+
$bytes = (int) $value;
|
26 |
+
|
27 |
+
if ( false !== strpos( $value, 'g' ) ) {
|
28 |
+
$bytes *= GB_IN_BYTES;
|
29 |
+
} elseif ( false !== strpos( $value, 'm' ) ) {
|
30 |
+
$bytes *= MB_IN_BYTES;
|
31 |
+
} elseif ( false !== strpos( $value, 'k' ) ) {
|
32 |
+
$bytes *= KB_IN_BYTES;
|
33 |
+
}
|
34 |
+
|
35 |
+
// Deal with large (float) values which run into the maximum integer size.
|
36 |
+
return min( $bytes, PHP_INT_MAX );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Attempts to raise the PHP memory limit for memory intensive processes.
|
41 |
+
*
|
42 |
+
* Only allows raising the existing limit and prevents lowering it.
|
43 |
+
*
|
44 |
+
* Wrapper for wp_raise_memory_limit(), added in WordPress v4.6.0
|
45 |
+
*
|
46 |
+
* @return bool|int|string The limit that was set or false on failure.
|
47 |
+
*/
|
48 |
+
public static function raise_memory_limit() {
|
49 |
+
if ( function_exists( 'wp_raise_memory_limit' ) ) {
|
50 |
+
return wp_raise_memory_limit( 'admin' );
|
51 |
+
}
|
52 |
+
|
53 |
+
$current_limit = @ini_get( 'memory_limit' );
|
54 |
+
$current_limit_int = self::convert_hr_to_bytes( $current_limit );
|
55 |
+
|
56 |
+
if ( -1 === $current_limit_int ) {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
$wp_max_limit = WP_MAX_MEMORY_LIMIT;
|
61 |
+
$wp_max_limit_int = self::convert_hr_to_bytes( $wp_max_limit );
|
62 |
+
$filtered_limit = apply_filters( 'admin_memory_limit', $wp_max_limit );
|
63 |
+
$filtered_limit_int = self::convert_hr_to_bytes( $filtered_limit );
|
64 |
+
|
65 |
+
if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) {
|
66 |
+
if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) {
|
67 |
+
return $filtered_limit;
|
68 |
+
} else {
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
} elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) {
|
72 |
+
if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) {
|
73 |
+
return $wp_max_limit;
|
74 |
+
} else {
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Attempts to raise the PHP timeout for time intensive processes.
|
83 |
+
*
|
84 |
+
* Only allows raising the existing limit and prevents lowering it. Wrapper for wc_set_time_limit(), when available.
|
85 |
+
*
|
86 |
+
* @param int $limit The time limit in seconds.
|
87 |
+
*/
|
88 |
+
public static function raise_time_limit( $limit = 0 ) {
|
89 |
+
$limit = (int) $limit;
|
90 |
+
$max_execution_time = (int) ini_get( 'max_execution_time' );
|
91 |
+
|
92 |
+
/*
|
93 |
+
* If the max execution time is already unlimited (zero), or if it exceeds or is equal to the proposed
|
94 |
+
* limit, there is no reason for us to make further changes (we never want to lower it).
|
95 |
+
*/
|
96 |
+
if (
|
97 |
+
0 === $max_execution_time
|
98 |
+
|| ( $max_execution_time >= $limit && $limit !== 0 )
|
99 |
+
) {
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( function_exists( 'wc_set_time_limit' ) ) {
|
104 |
+
wc_set_time_limit( $limit );
|
105 |
+
} elseif ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
|
106 |
+
@set_time_limit( $limit ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_DataController.php
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Action_Scheduler\Migration\Controller;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class ActionScheduler_DataController
|
7 |
+
*
|
8 |
+
* The main plugin/initialization class for the data stores.
|
9 |
+
*
|
10 |
+
* Responsible for hooking everything up with WordPress.
|
11 |
+
*
|
12 |
+
* @package Action_Scheduler
|
13 |
+
*
|
14 |
+
* @since 3.0.0
|
15 |
+
*/
|
16 |
+
class ActionScheduler_DataController {
|
17 |
+
/** Action data store class name. */
|
18 |
+
const DATASTORE_CLASS = 'ActionScheduler_DBStore';
|
19 |
+
|
20 |
+
/** Logger data store class name. */
|
21 |
+
const LOGGER_CLASS = 'ActionScheduler_DBLogger';
|
22 |
+
|
23 |
+
/** Migration status option name. */
|
24 |
+
const STATUS_FLAG = 'action_scheduler_migration_status';
|
25 |
+
|
26 |
+
/** Migration status option value. */
|
27 |
+
const STATUS_COMPLETE = 'complete';
|
28 |
+
|
29 |
+
/** Migration minimum required PHP version. */
|
30 |
+
const MIN_PHP_VERSION = '5.5';
|
31 |
+
|
32 |
+
/** @var ActionScheduler_DataController */
|
33 |
+
private static $instance;
|
34 |
+
|
35 |
+
/** @var int */
|
36 |
+
private static $sleep_time = 0;
|
37 |
+
|
38 |
+
/** @var int */
|
39 |
+
private static $free_ticks = 50;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get a flag indicating whether the migration environment dependencies are met.
|
43 |
+
*
|
44 |
+
* @return bool
|
45 |
+
*/
|
46 |
+
public static function dependencies_met() {
|
47 |
+
$php_support = version_compare( PHP_VERSION, self::MIN_PHP_VERSION, '>=' );
|
48 |
+
return $php_support && apply_filters( 'action_scheduler_migration_dependencies_met', true );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get a flag indicating whether the migration is complete.
|
53 |
+
*
|
54 |
+
* @return bool Whether the flag has been set marking the migration as complete
|
55 |
+
*/
|
56 |
+
public static function is_migration_complete() {
|
57 |
+
return get_option( self::STATUS_FLAG ) === self::STATUS_COMPLETE;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Mark the migration as complete.
|
62 |
+
*/
|
63 |
+
public static function mark_migration_complete() {
|
64 |
+
update_option( self::STATUS_FLAG, self::STATUS_COMPLETE );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Unmark migration when a plugin is de-activated. Will not work in case of silent activation, for example in an update.
|
69 |
+
* We do this to mitigate the bug of lost actions which happens if there was an AS 2.x to AS 3.x migration in the past, but that plugin is now
|
70 |
+
* deactivated and the site was running on AS 2.x again.
|
71 |
+
*/
|
72 |
+
public static function mark_migration_incomplete() {
|
73 |
+
delete_option( self::STATUS_FLAG );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Set the action store class name.
|
78 |
+
*
|
79 |
+
* @param string $class Classname of the store class.
|
80 |
+
*
|
81 |
+
* @return string
|
82 |
+
*/
|
83 |
+
public static function set_store_class( $class ) {
|
84 |
+
return self::DATASTORE_CLASS;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Set the action logger class name.
|
89 |
+
*
|
90 |
+
* @param string $class Classname of the logger class.
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
public static function set_logger_class( $class ) {
|
95 |
+
return self::LOGGER_CLASS;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Set the sleep time in seconds.
|
100 |
+
*
|
101 |
+
* @param integer $sleep_time The number of seconds to pause before resuming operation.
|
102 |
+
*/
|
103 |
+
public static function set_sleep_time( $sleep_time ) {
|
104 |
+
self::$sleep_time = (int) $sleep_time;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Set the tick count required for freeing memory.
|
109 |
+
*
|
110 |
+
* @param integer $free_ticks The number of ticks to free memory on.
|
111 |
+
*/
|
112 |
+
public static function set_free_ticks( $free_ticks ) {
|
113 |
+
self::$free_ticks = (int) $free_ticks;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Free memory if conditions are met.
|
118 |
+
*
|
119 |
+
* @param int $ticks Current tick count.
|
120 |
+
*/
|
121 |
+
public static function maybe_free_memory( $ticks ) {
|
122 |
+
if ( self::$free_ticks && 0 === $ticks % self::$free_ticks ) {
|
123 |
+
self::free_memory();
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Reduce memory footprint by clearing the database query and object caches.
|
129 |
+
*/
|
130 |
+
public static function free_memory() {
|
131 |
+
if ( 0 < self::$sleep_time ) {
|
132 |
+
/* translators: %d: amount of time */
|
133 |
+
\WP_CLI::warning( sprintf( _n( 'Stopped the insanity for %d second', 'Stopped the insanity for %d seconds', self::$sleep_time, 'action-scheduler' ), self::$sleep_time ) );
|
134 |
+
sleep( self::$sleep_time );
|
135 |
+
}
|
136 |
+
|
137 |
+
\WP_CLI::warning( __( 'Attempting to reduce used memory...', 'action-scheduler' ) );
|
138 |
+
|
139 |
+
/**
|
140 |
+
* @var $wpdb \wpdb
|
141 |
+
* @var $wp_object_cache \WP_Object_Cache
|
142 |
+
*/
|
143 |
+
global $wpdb, $wp_object_cache;
|
144 |
+
|
145 |
+
$wpdb->queries = array();
|
146 |
+
|
147 |
+
if ( ! is_a( $wp_object_cache, 'WP_Object_Cache' ) ) {
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
|
151 |
+
$wp_object_cache->group_ops = array();
|
152 |
+
$wp_object_cache->stats = array();
|
153 |
+
$wp_object_cache->memcache_debug = array();
|
154 |
+
$wp_object_cache->cache = array();
|
155 |
+
|
156 |
+
if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) {
|
157 |
+
call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Connect to table datastores if migration is complete.
|
163 |
+
* Otherwise, proceed with the migration if the dependencies have been met.
|
164 |
+
*/
|
165 |
+
public static function init() {
|
166 |
+
if ( self::is_migration_complete() ) {
|
167 |
+
add_filter( 'action_scheduler_store_class', array( 'ActionScheduler_DataController', 'set_store_class' ), 100 );
|
168 |
+
add_filter( 'action_scheduler_logger_class', array( 'ActionScheduler_DataController', 'set_logger_class' ), 100 );
|
169 |
+
add_action( 'deactivate_plugin', array( 'ActionScheduler_DataController', 'mark_migration_incomplete' ) );
|
170 |
+
} elseif ( self::dependencies_met() ) {
|
171 |
+
Controller::init();
|
172 |
+
}
|
173 |
+
|
174 |
+
add_action( 'action_scheduler/progress_tick', array( 'ActionScheduler_DataController', 'maybe_free_memory' ) );
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Singleton factory.
|
179 |
+
*/
|
180 |
+
public static function instance() {
|
181 |
+
if ( ! isset( self::$instance ) ) {
|
182 |
+
self::$instance = new static();
|
183 |
+
}
|
184 |
+
|
185 |
+
return self::$instance;
|
186 |
+
}
|
187 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_DateTime.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* ActionScheduler DateTime class.
|
5 |
+
*
|
6 |
+
* This is a custom extension to DateTime that
|
7 |
+
*/
|
8 |
+
class ActionScheduler_DateTime extends DateTime {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* UTC offset.
|
12 |
+
*
|
13 |
+
* Only used when a timezone is not set. When a timezone string is
|
14 |
+
* used, this will be set to 0.
|
15 |
+
*
|
16 |
+
* @var int
|
17 |
+
*/
|
18 |
+
protected $utcOffset = 0;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get the unix timestamp of the current object.
|
22 |
+
*
|
23 |
+
* Missing in PHP 5.2 so just here so it can be supported consistently.
|
24 |
+
*
|
25 |
+
* @return int
|
26 |
+
*/
|
27 |
+
#[\ReturnTypeWillChange]
|
28 |
+
public function getTimestamp() {
|
29 |
+
return method_exists( 'DateTime', 'getTimestamp' ) ? parent::getTimestamp() : $this->format( 'U' );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Set the UTC offset.
|
34 |
+
*
|
35 |
+
* This represents a fixed offset instead of a timezone setting.
|
36 |
+
*
|
37 |
+
* @param $offset
|
38 |
+
*/
|
39 |
+
public function setUtcOffset( $offset ) {
|
40 |
+
$this->utcOffset = intval( $offset );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns the timezone offset.
|
45 |
+
*
|
46 |
+
* @return int
|
47 |
+
* @link http://php.net/manual/en/datetime.getoffset.php
|
48 |
+
*/
|
49 |
+
#[\ReturnTypeWillChange]
|
50 |
+
public function getOffset() {
|
51 |
+
return $this->utcOffset ? $this->utcOffset : parent::getOffset();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Set the TimeZone associated with the DateTime
|
56 |
+
*
|
57 |
+
* @param DateTimeZone $timezone
|
58 |
+
*
|
59 |
+
* @return static
|
60 |
+
* @link http://php.net/manual/en/datetime.settimezone.php
|
61 |
+
*/
|
62 |
+
#[\ReturnTypeWillChange]
|
63 |
+
public function setTimezone( $timezone ) {
|
64 |
+
$this->utcOffset = 0;
|
65 |
+
parent::setTimezone( $timezone );
|
66 |
+
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get the timestamp with the WordPress timezone offset added or subtracted.
|
72 |
+
*
|
73 |
+
* @since 3.0.0
|
74 |
+
* @return int
|
75 |
+
*/
|
76 |
+
public function getOffsetTimestamp() {
|
77 |
+
return $this->getTimestamp() + $this->getOffset();
|
78 |
+
}
|
79 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_Exception.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* ActionScheduler Exception Interface.
|
5 |
+
*
|
6 |
+
* Facilitates catching Exceptions unique to Action Scheduler.
|
7 |
+
*
|
8 |
+
* @package ActionScheduler
|
9 |
+
* @since 2.1.0
|
10 |
+
*/
|
11 |
+
interface ActionScheduler_Exception {}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_FatalErrorMonitor
|
5 |
+
*/
|
6 |
+
class ActionScheduler_FatalErrorMonitor {
|
7 |
+
/** @var ActionScheduler_ActionClaim */
|
8 |
+
private $claim = NULL;
|
9 |
+
/** @var ActionScheduler_Store */
|
10 |
+
private $store = NULL;
|
11 |
+
private $action_id = 0;
|
12 |
+
|
13 |
+
public function __construct( ActionScheduler_Store $store ) {
|
14 |
+
$this->store = $store;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function attach( ActionScheduler_ActionClaim $claim ) {
|
18 |
+
$this->claim = $claim;
|
19 |
+
add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
|
20 |
+
add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 );
|
21 |
+
add_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0, 0 );
|
22 |
+
add_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0, 0 );
|
23 |
+
add_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0, 0 );
|
24 |
+
}
|
25 |
+
|
26 |
+
public function detach() {
|
27 |
+
$this->claim = NULL;
|
28 |
+
$this->untrack_action();
|
29 |
+
remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
|
30 |
+
remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 );
|
31 |
+
remove_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0 );
|
32 |
+
remove_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0 );
|
33 |
+
remove_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0 );
|
34 |
+
}
|
35 |
+
|
36 |
+
public function track_current_action( $action_id ) {
|
37 |
+
$this->action_id = $action_id;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function untrack_action() {
|
41 |
+
$this->action_id = 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function handle_unexpected_shutdown() {
|
45 |
+
if ( $error = error_get_last() ) {
|
46 |
+
if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) {
|
47 |
+
if ( !empty($this->action_id) ) {
|
48 |
+
$this->store->mark_failure( $this->action_id );
|
49 |
+
do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
$this->store->release_claim( $this->claim );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_InvalidActionException.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* InvalidAction Exception.
|
5 |
+
*
|
6 |
+
* Used for identifying actions that are invalid in some way.
|
7 |
+
*
|
8 |
+
* @package ActionScheduler
|
9 |
+
*/
|
10 |
+
class ActionScheduler_InvalidActionException extends \InvalidArgumentException implements ActionScheduler_Exception {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Create a new exception when the action's schedule cannot be fetched.
|
14 |
+
*
|
15 |
+
* @param string $action_id The action ID with bad args.
|
16 |
+
* @return static
|
17 |
+
*/
|
18 |
+
public static function from_schedule( $action_id, $schedule ) {
|
19 |
+
$message = sprintf(
|
20 |
+
/* translators: 1: action ID 2: schedule */
|
21 |
+
__( 'Action [%1$s] has an invalid schedule: %2$s', 'action-scheduler' ),
|
22 |
+
$action_id,
|
23 |
+
var_export( $schedule, true )
|
24 |
+
);
|
25 |
+
|
26 |
+
return new static( $message );
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Create a new exception when the action's args cannot be decoded to an array.
|
31 |
+
*
|
32 |
+
* @author Jeremy Pry
|
33 |
+
*
|
34 |
+
* @param string $action_id The action ID with bad args.
|
35 |
+
* @return static
|
36 |
+
*/
|
37 |
+
public static function from_decoding_args( $action_id, $args = array() ) {
|
38 |
+
$message = sprintf(
|
39 |
+
/* translators: 1: action ID 2: arguments */
|
40 |
+
__( 'Action [%1$s] has invalid arguments. It cannot be JSON decoded to an array. $args = %2$s', 'action-scheduler' ),
|
41 |
+
$action_id,
|
42 |
+
var_export( $args, true )
|
43 |
+
);
|
44 |
+
|
45 |
+
return new static( $message );
|
46 |
+
}
|
47 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_ListTable.php
ADDED
@@ -0,0 +1,657 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Implements the admin view of the actions.
|
5 |
+
* @codeCoverageIgnore
|
6 |
+
*/
|
7 |
+
class ActionScheduler_ListTable extends ActionScheduler_Abstract_ListTable {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* The package name.
|
11 |
+
*
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
protected $package = 'action-scheduler';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Columns to show (name => label).
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $columns = array();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Actions (name => label).
|
25 |
+
*
|
26 |
+
* @var array
|
27 |
+
*/
|
28 |
+
protected $row_actions = array();
|
29 |
+
|
30 |
+
/**
|
31 |
+
* The active data stores
|
32 |
+
*
|
33 |
+
* @var ActionScheduler_Store
|
34 |
+
*/
|
35 |
+
protected $store;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* A logger to use for getting action logs to display
|
39 |
+
*
|
40 |
+
* @var ActionScheduler_Logger
|
41 |
+
*/
|
42 |
+
protected $logger;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* A ActionScheduler_QueueRunner runner instance (or child class)
|
46 |
+
*
|
47 |
+
* @var ActionScheduler_QueueRunner
|
48 |
+
*/
|
49 |
+
protected $runner;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Bulk actions. The key of the array is the method name of the implementation:
|
53 |
+
*
|
54 |
+
* bulk_<key>(array $ids, string $sql_in).
|
55 |
+
*
|
56 |
+
* See the comments in the parent class for further details
|
57 |
+
*
|
58 |
+
* @var array
|
59 |
+
*/
|
60 |
+
protected $bulk_actions = array();
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Flag variable to render our notifications, if any, once.
|
64 |
+
*
|
65 |
+
* @var bool
|
66 |
+
*/
|
67 |
+
protected static $did_notification = false;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Array of seconds for common time periods, like week or month, alongside an internationalised string representation, i.e. "Day" or "Days"
|
71 |
+
*
|
72 |
+
* @var array
|
73 |
+
*/
|
74 |
+
private static $time_periods;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Sets the current data store object into `store->action` and initialises the object.
|
78 |
+
*
|
79 |
+
* @param ActionScheduler_Store $store
|
80 |
+
* @param ActionScheduler_Logger $logger
|
81 |
+
* @param ActionScheduler_QueueRunner $runner
|
82 |
+
*/
|
83 |
+
public function __construct( ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner ) {
|
84 |
+
|
85 |
+
$this->store = $store;
|
86 |
+
$this->logger = $logger;
|
87 |
+
$this->runner = $runner;
|
88 |
+
|
89 |
+
$this->table_header = __( 'Scheduled Actions', 'action-scheduler' );
|
90 |
+
|
91 |
+
$this->bulk_actions = array(
|
92 |
+
'delete' => __( 'Delete', 'action-scheduler' ),
|
93 |
+
);
|
94 |
+
|
95 |
+
$this->columns = array(
|
96 |
+
'hook' => __( 'Hook', 'action-scheduler' ),
|
97 |
+
'status' => __( 'Status', 'action-scheduler' ),
|
98 |
+
'args' => __( 'Arguments', 'action-scheduler' ),
|
99 |
+
'group' => __( 'Group', 'action-scheduler' ),
|
100 |
+
'recurrence' => __( 'Recurrence', 'action-scheduler' ),
|
101 |
+
'schedule' => __( 'Scheduled Date', 'action-scheduler' ),
|
102 |
+
'log_entries' => __( 'Log', 'action-scheduler' ),
|
103 |
+
);
|
104 |
+
|
105 |
+
$this->sort_by = array(
|
106 |
+
'schedule',
|
107 |
+
'hook',
|
108 |
+
'group',
|
109 |
+
);
|
110 |
+
|
111 |
+
$this->search_by = array(
|
112 |
+
'hook',
|
113 |
+
'args',
|
114 |
+
'claim_id',
|
115 |
+
);
|
116 |
+
|
117 |
+
$request_status = $this->get_request_status();
|
118 |
+
|
119 |
+
if ( empty( $request_status ) ) {
|
120 |
+
$this->sort_by[] = 'status';
|
121 |
+
} elseif ( in_array( $request_status, array( 'in-progress', 'failed' ) ) ) {
|
122 |
+
$this->columns += array( 'claim_id' => __( 'Claim ID', 'action-scheduler' ) );
|
123 |
+
$this->sort_by[] = 'claim_id';
|
124 |
+
}
|
125 |
+
|
126 |
+
$this->row_actions = array(
|
127 |
+
'hook' => array(
|
128 |
+
'run' => array(
|
129 |
+
'name' => __( 'Run', 'action-scheduler' ),
|
130 |
+
'desc' => __( 'Process the action now as if it were run as part of a queue', 'action-scheduler' ),
|
131 |
+
),
|
132 |
+
'cancel' => array(
|
133 |
+
'name' => __( 'Cancel', 'action-scheduler' ),
|
134 |
+
'desc' => __( 'Cancel the action now to avoid it being run in future', 'action-scheduler' ),
|
135 |
+
'class' => 'cancel trash',
|
136 |
+
),
|
137 |
+
),
|
138 |
+
);
|
139 |
+
|
140 |
+
self::$time_periods = array(
|
141 |
+
array(
|
142 |
+
'seconds' => YEAR_IN_SECONDS,
|
143 |
+
/* translators: %s: amount of time */
|
144 |
+
'names' => _n_noop( '%s year', '%s years', 'action-scheduler' ),
|
145 |
+
),
|
146 |
+
array(
|
147 |
+
'seconds' => MONTH_IN_SECONDS,
|
148 |
+
/* translators: %s: amount of time */
|
149 |
+
'names' => _n_noop( '%s month', '%s months', 'action-scheduler' ),
|
150 |
+
),
|
151 |
+
array(
|
152 |
+
'seconds' => WEEK_IN_SECONDS,
|
153 |
+
/* translators: %s: amount of time */
|
154 |
+
'names' => _n_noop( '%s week', '%s weeks', 'action-scheduler' ),
|
155 |
+
),
|
156 |
+
array(
|
157 |
+
'seconds' => DAY_IN_SECONDS,
|
158 |
+
/* translators: %s: amount of time */
|
159 |
+
'names' => _n_noop( '%s day', '%s days', 'action-scheduler' ),
|
160 |
+
),
|
161 |
+
array(
|
162 |
+
'seconds' => HOUR_IN_SECONDS,
|
163 |
+
/* translators: %s: amount of time */
|
164 |
+
'names' => _n_noop( '%s hour', '%s hours', 'action-scheduler' ),
|
165 |
+
),
|
166 |
+
array(
|
167 |
+
'seconds' => MINUTE_IN_SECONDS,
|
168 |
+
/* translators: %s: amount of time */
|
169 |
+
'names' => _n_noop( '%s minute', '%s minutes', 'action-scheduler' ),
|
170 |
+
),
|
171 |
+
array(
|
172 |
+
'seconds' => 1,
|
173 |
+
/* translators: %s: amount of time */
|
174 |
+
'names' => _n_noop( '%s second', '%s seconds', 'action-scheduler' ),
|
175 |
+
),
|
176 |
+
);
|
177 |
+
|
178 |
+
parent::__construct(
|
179 |
+
array(
|
180 |
+
'singular' => 'action-scheduler',
|
181 |
+
'plural' => 'action-scheduler',
|
182 |
+
'ajax' => false,
|
183 |
+
)
|
184 |
+
);
|
185 |
+
|
186 |
+
add_screen_option(
|
187 |
+
'per_page',
|
188 |
+
array(
|
189 |
+
'default' => $this->items_per_page,
|
190 |
+
)
|
191 |
+
);
|
192 |
+
|
193 |
+
add_filter( 'set_screen_option_' . $this->get_per_page_option_name(), array( $this, 'set_items_per_page_option' ), 10, 3 );
|
194 |
+
set_screen_options();
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Handles setting the items_per_page option for this screen.
|
199 |
+
*
|
200 |
+
* @param mixed $status Default false (to skip saving the current option).
|
201 |
+
* @param string $option Screen option name.
|
202 |
+
* @param int $value Screen option value.
|
203 |
+
* @return int
|
204 |
+
*/
|
205 |
+
public function set_items_per_page_option( $status, $option, $value ) {
|
206 |
+
return $value;
|
207 |
+
}
|
208 |
+
/**
|
209 |
+
* Convert an interval of seconds into a two part human friendly string.
|
210 |
+
*
|
211 |
+
* The WordPress human_time_diff() function only calculates the time difference to one degree, meaning
|
212 |
+
* even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step
|
213 |
+
* further to display two degrees of accuracy.
|
214 |
+
*
|
215 |
+
* Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/
|
216 |
+
*
|
217 |
+
* @param int $interval A interval in seconds.
|
218 |
+
* @param int $periods_to_include Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included.
|
219 |
+
* @return string A human friendly string representation of the interval.
|
220 |
+
*/
|
221 |
+
private static function human_interval( $interval, $periods_to_include = 2 ) {
|
222 |
+
|
223 |
+
if ( $interval <= 0 ) {
|
224 |
+
return __( 'Now!', 'action-scheduler' );
|
225 |
+
}
|
226 |
+
|
227 |
+
$output = '';
|
228 |
+
|
229 |
+
for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count( self::$time_periods ) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) {
|
230 |
+
|
231 |
+
$periods_in_interval = floor( $seconds_remaining / self::$time_periods[ $time_period_index ]['seconds'] );
|
232 |
+
|
233 |
+
if ( $periods_in_interval > 0 ) {
|
234 |
+
if ( ! empty( $output ) ) {
|
235 |
+
$output .= ' ';
|
236 |
+
}
|
237 |
+
$output .= sprintf( _n( self::$time_periods[ $time_period_index ]['names'][0], self::$time_periods[ $time_period_index ]['names'][1], $periods_in_interval, 'action-scheduler' ), $periods_in_interval );
|
238 |
+
$seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds'];
|
239 |
+
$periods_included++;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
return $output;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Returns the recurrence of an action or 'Non-repeating'. The output is human readable.
|
248 |
+
*
|
249 |
+
* @param ActionScheduler_Action $action
|
250 |
+
*
|
251 |
+
* @return string
|
252 |
+
*/
|
253 |
+
protected function get_recurrence( $action ) {
|
254 |
+
$schedule = $action->get_schedule();
|
255 |
+
if ( $schedule->is_recurring() ) {
|
256 |
+
$recurrence = $schedule->get_recurrence();
|
257 |
+
|
258 |
+
if ( is_numeric( $recurrence ) ) {
|
259 |
+
/* translators: %s: time interval */
|
260 |
+
return sprintf( __( 'Every %s', 'action-scheduler' ), self::human_interval( $recurrence ) );
|
261 |
+
} else {
|
262 |
+
return $recurrence;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
return __( 'Non-repeating', 'action-scheduler' );
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Serializes the argument of an action to render it in a human friendly format.
|
271 |
+
*
|
272 |
+
* @param array $row The array representation of the current row of the table
|
273 |
+
*
|
274 |
+
* @return string
|
275 |
+
*/
|
276 |
+
public function column_args( array $row ) {
|
277 |
+
if ( empty( $row['args'] ) ) {
|
278 |
+
return apply_filters( 'action_scheduler_list_table_column_args', '', $row );
|
279 |
+
}
|
280 |
+
|
281 |
+
$row_html = '<ul>';
|
282 |
+
foreach ( $row['args'] as $key => $value ) {
|
283 |
+
$row_html .= sprintf( '<li><code>%s => %s</code></li>', esc_html( var_export( $key, true ) ), esc_html( var_export( $value, true ) ) );
|
284 |
+
}
|
285 |
+
$row_html .= '</ul>';
|
286 |
+
|
287 |
+
return apply_filters( 'action_scheduler_list_table_column_args', $row_html, $row );
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.
|
292 |
+
*
|
293 |
+
* @param array $row Action array.
|
294 |
+
* @return string
|
295 |
+
*/
|
296 |
+
public function column_log_entries( array $row ) {
|
297 |
+
|
298 |
+
$log_entries_html = '<ol>';
|
299 |
+
|
300 |
+
$timezone = new DateTimezone( 'UTC' );
|
301 |
+
|
302 |
+
foreach ( $row['log_entries'] as $log_entry ) {
|
303 |
+
$log_entries_html .= $this->get_log_entry_html( $log_entry, $timezone );
|
304 |
+
}
|
305 |
+
|
306 |
+
$log_entries_html .= '</ol>';
|
307 |
+
|
308 |
+
return $log_entries_html;
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.
|
313 |
+
*
|
314 |
+
* @param ActionScheduler_LogEntry $log_entry
|
315 |
+
* @param DateTimezone $timezone
|
316 |
+
* @return string
|
317 |
+
*/
|
318 |
+
protected function get_log_entry_html( ActionScheduler_LogEntry $log_entry, DateTimezone $timezone ) {
|
319 |
+
$date = $log_entry->get_date();
|
320 |
+
$date->setTimezone( $timezone );
|
321 |
+
return sprintf( '<li><strong>%s</strong><br/>%s</li>', esc_html( $date->format( 'Y-m-d H:i:s O' ) ), esc_html( $log_entry->get_message() ) );
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Only display row actions for pending actions.
|
326 |
+
*
|
327 |
+
* @param array $row Row to render
|
328 |
+
* @param string $column_name Current row
|
329 |
+
*
|
330 |
+
* @return string
|
331 |
+
*/
|
332 |
+
protected function maybe_render_actions( $row, $column_name ) {
|
333 |
+
if ( 'pending' === strtolower( $row[ 'status_name' ] ) ) {
|
334 |
+
return parent::maybe_render_actions( $row, $column_name );
|
335 |
+
}
|
336 |
+
|
337 |
+
return '';
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Renders admin notifications
|
342 |
+
*
|
343 |
+
* Notifications:
|
344 |
+
* 1. When the maximum number of tasks are being executed simultaneously.
|
345 |
+
* 2. Notifications when a task is manually executed.
|
346 |
+
* 3. Tables are missing.
|
347 |
+
*/
|
348 |
+
public function display_admin_notices() {
|
349 |
+
global $wpdb;
|
350 |
+
|
351 |
+
if ( ( is_a( $this->store, 'ActionScheduler_HybridStore' ) || is_a( $this->store, 'ActionScheduler_DBStore' ) ) && apply_filters( 'action_scheduler_enable_recreate_data_store', true ) ) {
|
352 |
+
$table_list = array(
|
353 |
+
'actionscheduler_actions',
|
354 |
+
'actionscheduler_logs',
|
355 |
+
'actionscheduler_groups',
|
356 |
+
'actionscheduler_claims',
|
357 |
+
);
|
358 |
+
|
359 |
+
$found_tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}actionscheduler%'" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
360 |
+
foreach ( $table_list as $table_name ) {
|
361 |
+
if ( ! in_array( $wpdb->prefix . $table_name, $found_tables ) ) {
|
362 |
+
$this->admin_notices[] = array(
|
363 |
+
'class' => 'error',
|
364 |
+
'message' => __( 'It appears one or more database tables were missing. Attempting to re-create the missing table(s).' , 'action-scheduler' ),
|
365 |
+
);
|
366 |
+
$this->recreate_tables();
|
367 |
+
parent::display_admin_notices();
|
368 |
+
|
369 |
+
return;
|
370 |
+
}
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
if ( $this->runner->has_maximum_concurrent_batches() ) {
|
375 |
+
$claim_count = $this->store->get_claim_count();
|
376 |
+
$this->admin_notices[] = array(
|
377 |
+
'class' => 'updated',
|
378 |
+
'message' => sprintf(
|
379 |
+
/* translators: %s: amount of claims */
|
380 |
+
_n(
|
381 |
+
'Maximum simultaneous queues already in progress (%s queue). No additional queues will begin processing until the current queues are complete.',
|
382 |
+
'Maximum simultaneous queues already in progress (%s queues). No additional queues will begin processing until the current queues are complete.',
|
383 |
+
$claim_count,
|
384 |
+
'action-scheduler'
|
385 |
+
),
|
386 |
+
$claim_count
|
387 |
+
),
|
388 |
+
);
|
389 |
+
} elseif ( $this->store->has_pending_actions_due() ) {
|
390 |
+
|
391 |
+
$async_request_lock_expiration = ActionScheduler::lock()->get_expiration( 'async-request-runner' );
|
392 |
+
|
393 |
+
// No lock set or lock expired
|
394 |
+
if ( false === $async_request_lock_expiration || $async_request_lock_expiration < time() ) {
|
395 |
+
$in_progress_url = add_query_arg( 'status', 'in-progress', remove_query_arg( 'status' ) );
|
396 |
+
/* translators: %s: process URL */
|
397 |
+
$async_request_message = sprintf( __( 'A new queue has begun processing. <a href="%s">View actions in-progress »</a>', 'action-scheduler' ), esc_url( $in_progress_url ) );
|
398 |
+
} else {
|
399 |
+
/* translators: %d: seconds */
|
400 |
+
$async_request_message = sprintf( __( 'The next queue will begin processing in approximately %d seconds.', 'action-scheduler' ), $async_request_lock_expiration - time() );
|
401 |
+
}
|
402 |
+
|
403 |
+
$this->admin_notices[] = array(
|
404 |
+
'class' => 'notice notice-info',
|
405 |
+
'message' => $async_request_message,
|
406 |
+
);
|
407 |
+
}
|
408 |
+
|
409 |
+
$notification = get_transient( 'action_scheduler_admin_notice' );
|
410 |
+
|
411 |
+
if ( is_array( $notification ) ) {
|
412 |
+
delete_transient( 'action_scheduler_admin_notice' );
|
413 |
+
|
414 |
+
$action = $this->store->fetch_action( $notification['action_id'] );
|
415 |
+
$action_hook_html = '<strong><code>' . $action->get_hook() . '</code></strong>';
|
416 |
+
if ( 1 == $notification['success'] ) {
|
417 |
+
$class = 'updated';
|
418 |
+
switch ( $notification['row_action_type'] ) {
|
419 |
+
case 'run' :
|
420 |
+
/* translators: %s: action HTML */
|
421 |
+
$action_message_html = sprintf( __( 'Successfully executed action: %s', 'action-scheduler' ), $action_hook_html );
|
422 |
+
break;
|
423 |
+
case 'cancel' :
|
424 |
+
/* translators: %s: action HTML */
|
425 |
+
$action_message_html = sprintf( __( 'Successfully canceled action: %s', 'action-scheduler' ), $action_hook_html );
|
426 |
+
break;
|
427 |
+
default :
|
428 |
+
/* translators: %s: action HTML */
|
429 |
+
$action_message_html = sprintf( __( 'Successfully processed change for action: %s', 'action-scheduler' ), $action_hook_html );
|
430 |
+
break;
|
431 |
+
}
|
432 |
+
} else {
|
433 |
+
$class = 'error';
|
434 |
+
/* translators: 1: action HTML 2: action ID 3: error message */
|
435 |
+
$action_message_html = sprintf( __( 'Could not process change for action: "%1$s" (ID: %2$d). Error: %3$s', 'action-scheduler' ), $action_hook_html, esc_html( $notification['action_id'] ), esc_html( $notification['error_message'] ) );
|
436 |
+
}
|
437 |
+
|
438 |
+
$action_message_html = apply_filters( 'action_scheduler_admin_notice_html', $action_message_html, $action, $notification );
|
439 |
+
|
440 |
+
$this->admin_notices[] = array(
|
441 |
+
'class' => $class,
|
442 |
+
'message' => $action_message_html,
|
443 |
+
);
|
444 |
+
}
|
445 |
+
|
446 |
+
parent::display_admin_notices();
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Prints the scheduled date in a human friendly format.
|
451 |
+
*
|
452 |
+
* @param array $row The array representation of the current row of the table
|
453 |
+
*
|
454 |
+
* @return string
|
455 |
+
*/
|
456 |
+
public function column_schedule( $row ) {
|
457 |
+
return $this->get_schedule_display_string( $row['schedule'] );
|
458 |
+
}
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Get the scheduled date in a human friendly format.
|
462 |
+
*
|
463 |
+
* @param ActionScheduler_Schedule $schedule
|
464 |
+
* @return string
|
465 |
+
*/
|
466 |
+
protected function get_schedule_display_string( ActionScheduler_Schedule $schedule ) {
|
467 |
+
|
468 |
+
$schedule_display_string = '';
|
469 |
+
|
470 |
+
if ( is_a( $schedule, 'ActionScheduler_NullSchedule' ) ) {
|
471 |
+
return __( 'async', 'action-scheduler' );
|
472 |
+
}
|
473 |
+
|
474 |
+
if ( ! $schedule->get_date() ) {
|
475 |
+
return '0000-00-00 00:00:00';
|
476 |
+
}
|
477 |
+
|
478 |
+
$next_timestamp = $schedule->get_date()->getTimestamp();
|
479 |
+
|
480 |
+
$schedule_display_string .= $schedule->get_date()->format( 'Y-m-d H:i:s O' );
|
481 |
+
$schedule_display_string .= '<br/>';
|
482 |
+
|
483 |
+
if ( gmdate( 'U' ) > $next_timestamp ) {
|
484 |
+
/* translators: %s: date interval */
|
485 |
+
$schedule_display_string .= sprintf( __( ' (%s ago)', 'action-scheduler' ), self::human_interval( gmdate( 'U' ) - $next_timestamp ) );
|
486 |
+
} else {
|
487 |
+
/* translators: %s: date interval */
|
488 |
+
$schedule_display_string .= sprintf( __( ' (%s)', 'action-scheduler' ), self::human_interval( $next_timestamp - gmdate( 'U' ) ) );
|
489 |
+
}
|
490 |
+
|
491 |
+
return $schedule_display_string;
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Bulk delete
|
496 |
+
*
|
497 |
+
* Deletes actions based on their ID. This is the handler for the bulk delete. It assumes the data
|
498 |
+
* properly validated by the callee and it will delete the actions without any extra validation.
|
499 |
+
*
|
500 |
+
* @param array $ids
|
501 |
+
* @param string $ids_sql Inherited and unused
|
502 |
+
*/
|
503 |
+
protected function bulk_delete( array $ids, $ids_sql ) {
|
504 |
+
foreach ( $ids as $id ) {
|
505 |
+
$this->store->delete_action( $id );
|
506 |
+
}
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their
|
511 |
+
* parameters are valid.
|
512 |
+
*
|
513 |
+
* @param int $action_id
|
514 |
+
*/
|
515 |
+
protected function row_action_cancel( $action_id ) {
|
516 |
+
$this->process_row_action( $action_id, 'cancel' );
|
517 |
+
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their
|
521 |
+
* parameters are valid.
|
522 |
+
*
|
523 |
+
* @param int $action_id
|
524 |
+
*/
|
525 |
+
protected function row_action_run( $action_id ) {
|
526 |
+
$this->process_row_action( $action_id, 'run' );
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Force the data store schema updates.
|
531 |
+
*/
|
532 |
+
protected function recreate_tables() {
|
533 |
+
if ( is_a( $this->store, 'ActionScheduler_HybridStore' ) ) {
|
534 |
+
$store = $this->store;
|
535 |
+
} else {
|
536 |
+
$store = new ActionScheduler_HybridStore();
|
537 |
+
}
|
538 |
+
add_action( 'action_scheduler/created_table', array( $store, 'set_autoincrement' ), 10, 2 );
|
539 |
+
|
540 |
+
$store_schema = new ActionScheduler_StoreSchema();
|
541 |
+
$logger_schema = new ActionScheduler_LoggerSchema();
|
542 |
+
$store_schema->register_tables( true );
|
543 |
+
$logger_schema->register_tables( true );
|
544 |
+
|
545 |
+
remove_action( 'action_scheduler/created_table', array( $store, 'set_autoincrement' ), 10 );
|
546 |
+
}
|
547 |
+
/**
|
548 |
+
* Implements the logic behind processing an action once an action link is clicked on the list table.
|
549 |
+
*
|
550 |
+
* @param int $action_id
|
551 |
+
* @param string $row_action_type The type of action to perform on the action.
|
552 |
+
*/
|
553 |
+
protected function process_row_action( $action_id, $row_action_type ) {
|
554 |
+
try {
|
555 |
+
switch ( $row_action_type ) {
|
556 |
+
case 'run' :
|
557 |
+
$this->runner->process_action( $action_id, 'Admin List Table' );
|
558 |
+
break;
|
559 |
+
case 'cancel' :
|
560 |
+
$this->store->cancel_action( $action_id );
|
561 |
+
break;
|
562 |
+
}
|
563 |
+
$success = 1;
|
564 |
+
$error_message = '';
|
565 |
+
} catch ( Exception $e ) {
|
566 |
+
$success = 0;
|
567 |
+
$error_message = $e->getMessage();
|
568 |
+
}
|
569 |
+
|
570 |
+
set_transient( 'action_scheduler_admin_notice', compact( 'action_id', 'success', 'error_message', 'row_action_type' ), 30 );
|
571 |
+
}
|
572 |
+
|
573 |
+
/**
|
574 |
+
* {@inheritDoc}
|
575 |
+
*/
|
576 |
+
public function prepare_items() {
|
577 |
+
$this->prepare_column_headers();
|
578 |
+
|
579 |
+
$per_page = $this->get_items_per_page( $this->get_per_page_option_name(), $this->items_per_page );
|
580 |
+
|
581 |
+
$query = array(
|
582 |
+
'per_page' => $per_page,
|
583 |
+
'offset' => $this->get_items_offset(),
|
584 |
+
'status' => $this->get_request_status(),
|
585 |
+
'orderby' => $this->get_request_orderby(),
|
586 |
+
'order' => $this->get_request_order(),
|
587 |
+
'search' => $this->get_request_search_query(),
|
588 |
+
);
|
589 |
+
|
590 |
+
/**
|
591 |
+
* Change query arguments to query for past-due actions.
|
592 |
+
* Past-due actions have the 'pending' status and are in the past.
|
593 |
+
* This is needed because registering 'past-due' as a status is overkill.
|
594 |
+
*/
|
595 |
+
if ( 'past-due' === $this->get_request_status() ) {
|
596 |
+
$query['status'] = ActionScheduler_Store::STATUS_PENDING;
|
597 |
+
$query['date'] = as_get_datetime_object();
|
598 |
+
}
|
599 |
+
|
600 |
+
$this->items = array();
|
601 |
+
|
602 |
+
$total_items = $this->store->query_actions( $query, 'count' );
|
603 |
+
|
604 |
+
$status_labels = $this->store->get_status_labels();
|
605 |
+
|
606 |
+
foreach ( $this->store->query_actions( $query ) as $action_id ) {
|
607 |
+
try {
|
608 |
+
$action = $this->store->fetch_action( $action_id );
|
609 |
+
} catch ( Exception $e ) {
|
610 |
+
continue;
|
611 |
+
}
|
612 |
+
if ( is_a( $action, 'ActionScheduler_NullAction' ) ) {
|
613 |
+
continue;
|
614 |
+
}
|
615 |
+
$this->items[ $action_id ] = array(
|
616 |
+
'ID' => $action_id,
|
617 |
+
'hook' => $action->get_hook(),
|
618 |
+
'status_name' => $this->store->get_status( $action_id ),
|
619 |
+
'status' => $status_labels[ $this->store->get_status( $action_id ) ],
|
620 |
+
'args' => $action->get_args(),
|
621 |
+
'group' => $action->get_group(),
|
622 |
+
'log_entries' => $this->logger->get_logs( $action_id ),
|
623 |
+
'claim_id' => $this->store->get_claim_id( $action_id ),
|
624 |
+
'recurrence' => $this->get_recurrence( $action ),
|
625 |
+
'schedule' => $action->get_schedule(),
|
626 |
+
);
|
627 |
+
}
|
628 |
+
|
629 |
+
$this->set_pagination_args( array(
|
630 |
+
'total_items' => $total_items,
|
631 |
+
'per_page' => $per_page,
|
632 |
+
'total_pages' => ceil( $total_items / $per_page ),
|
633 |
+
) );
|
634 |
+
}
|
635 |
+
|
636 |
+
/**
|
637 |
+
* Prints the available statuses so the user can click to filter.
|
638 |
+
*/
|
639 |
+
protected function display_filter_by_status() {
|
640 |
+
$this->status_counts = $this->store->action_counts() + $this->store->extra_action_counts();
|
641 |
+
parent::display_filter_by_status();
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Get the text to display in the search box on the list table.
|
646 |
+
*/
|
647 |
+
protected function get_search_box_button_text() {
|
648 |
+
return __( 'Search hook, args and claim ID', 'action-scheduler' );
|
649 |
+
}
|
650 |
+
|
651 |
+
/**
|
652 |
+
* {@inheritDoc}
|
653 |
+
*/
|
654 |
+
protected function get_per_page_option_name() {
|
655 |
+
return str_replace( '-', '_', $this->screen->id ) . '_per_page';
|
656 |
+
}
|
657 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_LogEntry.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_LogEntry
|
5 |
+
*/
|
6 |
+
class ActionScheduler_LogEntry {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var int $action_id
|
10 |
+
*/
|
11 |
+
protected $action_id = '';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var string $message
|
15 |
+
*/
|
16 |
+
protected $message = '';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var Datetime $date
|
20 |
+
*/
|
21 |
+
protected $date;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Constructor
|
25 |
+
*
|
26 |
+
* @param mixed $action_id Action ID
|
27 |
+
* @param string $message Message
|
28 |
+
* @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is
|
29 |
+
* not provided a new Datetime object (with current time) will be created.
|
30 |
+
*/
|
31 |
+
public function __construct( $action_id, $message, $date = null ) {
|
32 |
+
|
33 |
+
/*
|
34 |
+
* ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type
|
35 |
+
* to ActionScheduler_LogEntry::__construct(), goodness knows why, and the Follow-up Emails plugin
|
36 |
+
* hard-codes loading its own version of ActionScheduler_wpCommentLogger with that out-dated method,
|
37 |
+
* goodness knows why, so we need to guard against that here instead of using a DateTime type declaration
|
38 |
+
* for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE.
|
39 |
+
*/
|
40 |
+
if ( null !== $date && ! is_a( $date, 'DateTime' ) ) {
|
41 |
+
_doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' );
|
42 |
+
$date = null;
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->action_id = $action_id;
|
46 |
+
$this->message = $message;
|
47 |
+
$this->date = $date ? $date : new Datetime;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Returns the date when this log entry was created
|
52 |
+
*
|
53 |
+
* @return Datetime
|
54 |
+
*/
|
55 |
+
public function get_date() {
|
56 |
+
return $this->date;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function get_action_id() {
|
60 |
+
return $this->action_id;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function get_message() {
|
64 |
+
return $this->message;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_NullLogEntry.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_NullLogEntry
|
5 |
+
*/
|
6 |
+
class ActionScheduler_NullLogEntry extends ActionScheduler_LogEntry {
|
7 |
+
public function __construct( $action_id = '', $message = '' ) {
|
8 |
+
// nothing to see here
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_OptionLock.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Provide a way to set simple transient locks to block behaviour
|
5 |
+
* for up-to a given duration.
|
6 |
+
*
|
7 |
+
* Class ActionScheduler_OptionLock
|
8 |
+
* @since 3.0.0
|
9 |
+
*/
|
10 |
+
class ActionScheduler_OptionLock extends ActionScheduler_Lock {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set a lock using options for a given amount of time (60 seconds by default).
|
14 |
+
*
|
15 |
+
* Using an autoloaded option avoids running database queries or other resource intensive tasks
|
16 |
+
* on frequently triggered hooks, like 'init' or 'shutdown'.
|
17 |
+
*
|
18 |
+
* For example, ActionScheduler_QueueRunner->maybe_dispatch_async_request() uses a lock to avoid
|
19 |
+
* calling ActionScheduler_QueueRunner->has_maximum_concurrent_batches() every time the 'shutdown',
|
20 |
+
* hook is triggered, because that method calls ActionScheduler_QueueRunner->store->get_claim_count()
|
21 |
+
* to find the current number of claims in the database.
|
22 |
+
*
|
23 |
+
* @param string $lock_type A string to identify different lock types.
|
24 |
+
* @bool True if lock value has changed, false if not or if set failed.
|
25 |
+
*/
|
26 |
+
public function set( $lock_type ) {
|
27 |
+
return update_option( $this->get_key( $lock_type ), time() + $this->get_duration( $lock_type ) );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* If a lock is set, return the timestamp it was set to expiry.
|
32 |
+
*
|
33 |
+
* @param string $lock_type A string to identify different lock types.
|
34 |
+
* @return bool|int False if no lock is set, otherwise the timestamp for when the lock is set to expire.
|
35 |
+
*/
|
36 |
+
public function get_expiration( $lock_type ) {
|
37 |
+
return get_option( $this->get_key( $lock_type ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get the key to use for storing the lock in the transient
|
42 |
+
*
|
43 |
+
* @param string $lock_type A string to identify different lock types.
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
protected function get_key( $lock_type ) {
|
47 |
+
return sprintf( 'action_scheduler_lock_%s', $lock_type );
|
48 |
+
}
|
49 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueCleaner.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_QueueCleaner
|
5 |
+
*/
|
6 |
+
class ActionScheduler_QueueCleaner {
|
7 |
+
|
8 |
+
/** @var int */
|
9 |
+
protected $batch_size;
|
10 |
+
|
11 |
+
/** @var ActionScheduler_Store */
|
12 |
+
private $store = null;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* 31 days in seconds.
|
16 |
+
*
|
17 |
+
* @var int
|
18 |
+
*/
|
19 |
+
private $month_in_seconds = 2678400;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* ActionScheduler_QueueCleaner constructor.
|
23 |
+
*
|
24 |
+
* @param ActionScheduler_Store $store The store instance.
|
25 |
+
* @param int $batch_size The batch size.
|
26 |
+
*/
|
27 |
+
public function __construct( ActionScheduler_Store $store = null, $batch_size = 20 ) {
|
28 |
+
$this->store = $store ? $store : ActionScheduler_Store::instance();
|
29 |
+
$this->batch_size = $batch_size;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function delete_old_actions() {
|
33 |
+
$lifespan = apply_filters( 'action_scheduler_retention_period', $this->month_in_seconds );
|
34 |
+
$cutoff = as_get_datetime_object($lifespan.' seconds ago');
|
35 |
+
|
36 |
+
$statuses_to_purge = array(
|
37 |
+
ActionScheduler_Store::STATUS_COMPLETE,
|
38 |
+
ActionScheduler_Store::STATUS_CANCELED,
|
39 |
+
);
|
40 |
+
|
41 |
+
foreach ( $statuses_to_purge as $status ) {
|
42 |
+
$actions_to_delete = $this->store->query_actions( array(
|
43 |
+
'status' => $status,
|
44 |
+
'modified' => $cutoff,
|
45 |
+
'modified_compare' => '<=',
|
46 |
+
'per_page' => $this->get_batch_size(),
|
47 |
+
'orderby' => 'none',
|
48 |
+
) );
|
49 |
+
|
50 |
+
foreach ( $actions_to_delete as $action_id ) {
|
51 |
+
try {
|
52 |
+
$this->store->delete_action( $action_id );
|
53 |
+
} catch ( Exception $e ) {
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Notify 3rd party code of exceptions when deleting a completed action older than the retention period
|
57 |
+
*
|
58 |
+
* This hook provides a way for 3rd party code to log or otherwise handle exceptions relating to their
|
59 |
+
* actions.
|
60 |
+
*
|
61 |
+
* @since 2.0.0
|
62 |
+
*
|
63 |
+
* @param int $action_id The scheduled actions ID in the data store
|
64 |
+
* @param Exception $e The exception thrown when attempting to delete the action from the data store
|
65 |
+
* @param int $lifespan The retention period, in seconds, for old actions
|
66 |
+
* @param int $count_of_actions_to_delete The number of old actions being deleted in this batch
|
67 |
+
*/
|
68 |
+
do_action( 'action_scheduler_failed_old_action_deletion', $action_id, $e, $lifespan, count( $actions_to_delete ) );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Unclaim pending actions that have not been run within a given time limit.
|
76 |
+
*
|
77 |
+
* When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed
|
78 |
+
* as a parameter is 10x the time limit used for queue processing.
|
79 |
+
*
|
80 |
+
* @param int $time_limit The number of seconds to allow a queue to run before unclaiming its pending actions. Default 300 (5 minutes).
|
81 |
+
*/
|
82 |
+
public function reset_timeouts( $time_limit = 300 ) {
|
83 |
+
$timeout = apply_filters( 'action_scheduler_timeout_period', $time_limit );
|
84 |
+
if ( $timeout < 0 ) {
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
$cutoff = as_get_datetime_object($timeout.' seconds ago');
|
88 |
+
$actions_to_reset = $this->store->query_actions( array(
|
89 |
+
'status' => ActionScheduler_Store::STATUS_PENDING,
|
90 |
+
'modified' => $cutoff,
|
91 |
+
'modified_compare' => '<=',
|
92 |
+
'claimed' => true,
|
93 |
+
'per_page' => $this->get_batch_size(),
|
94 |
+
'orderby' => 'none',
|
95 |
+
) );
|
96 |
+
|
97 |
+
foreach ( $actions_to_reset as $action_id ) {
|
98 |
+
$this->store->unclaim_action( $action_id );
|
99 |
+
do_action( 'action_scheduler_reset_action', $action_id );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Mark actions that have been running for more than a given time limit as failed, based on
|
105 |
+
* the assumption some uncatachable and unloggable fatal error occurred during processing.
|
106 |
+
*
|
107 |
+
* When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed
|
108 |
+
* as a parameter is 10x the time limit used for queue processing.
|
109 |
+
*
|
110 |
+
* @param int $time_limit The number of seconds to allow an action to run before it is considered to have failed. Default 300 (5 minutes).
|
111 |
+
*/
|
112 |
+
public function mark_failures( $time_limit = 300 ) {
|
113 |
+
$timeout = apply_filters( 'action_scheduler_failure_period', $time_limit );
|
114 |
+
if ( $timeout < 0 ) {
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
$cutoff = as_get_datetime_object($timeout.' seconds ago');
|
118 |
+
$actions_to_reset = $this->store->query_actions( array(
|
119 |
+
'status' => ActionScheduler_Store::STATUS_RUNNING,
|
120 |
+
'modified' => $cutoff,
|
121 |
+
'modified_compare' => '<=',
|
122 |
+
'per_page' => $this->get_batch_size(),
|
123 |
+
'orderby' => 'none',
|
124 |
+
) );
|
125 |
+
|
126 |
+
foreach ( $actions_to_reset as $action_id ) {
|
127 |
+
$this->store->mark_failure( $action_id );
|
128 |
+
do_action( 'action_scheduler_failed_action', $action_id, $timeout );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Do all of the cleaning actions.
|
134 |
+
*
|
135 |
+
* @param int $time_limit The number of seconds to use as the timeout and failure period. Default 300 (5 minutes).
|
136 |
+
* @author Jeremy Pry
|
137 |
+
*/
|
138 |
+
public function clean( $time_limit = 300 ) {
|
139 |
+
$this->delete_old_actions();
|
140 |
+
$this->reset_timeouts( $time_limit );
|
141 |
+
$this->mark_failures( $time_limit );
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Get the batch size for cleaning the queue.
|
146 |
+
*
|
147 |
+
* @author Jeremy Pry
|
148 |
+
* @return int
|
149 |
+
*/
|
150 |
+
protected function get_batch_size() {
|
151 |
+
/**
|
152 |
+
* Filter the batch size when cleaning the queue.
|
153 |
+
*
|
154 |
+
* @param int $batch_size The number of actions to clean in one batch.
|
155 |
+
*/
|
156 |
+
return absint( apply_filters( 'action_scheduler_cleanup_batch_size', $this->batch_size ) );
|
157 |
+
}
|
158 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_QueueRunner.php
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_QueueRunner
|
5 |
+
*/
|
6 |
+
class ActionScheduler_QueueRunner extends ActionScheduler_Abstract_QueueRunner {
|
7 |
+
const WP_CRON_HOOK = 'action_scheduler_run_queue';
|
8 |
+
|
9 |
+
const WP_CRON_SCHEDULE = 'every_minute';
|
10 |
+
|
11 |
+
/** @var ActionScheduler_AsyncRequest_QueueRunner */
|
12 |
+
protected $async_request;
|
13 |
+
|
14 |
+
/** @var ActionScheduler_QueueRunner */
|
15 |
+
private static $runner = null;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @return ActionScheduler_QueueRunner
|
19 |
+
* @codeCoverageIgnore
|
20 |
+
*/
|
21 |
+
public static function instance() {
|
22 |
+
if ( empty(self::$runner) ) {
|
23 |
+
$class = apply_filters('action_scheduler_queue_runner_class', 'ActionScheduler_QueueRunner');
|
24 |
+
self::$runner = new $class();
|
25 |
+
}
|
26 |
+
return self::$runner;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* ActionScheduler_QueueRunner constructor.
|
31 |
+
*
|
32 |
+
* @param ActionScheduler_Store $store
|
33 |
+
* @param ActionScheduler_FatalErrorMonitor $monitor
|
34 |
+
* @param ActionScheduler_QueueCleaner $cleaner
|
35 |
+
*/
|
36 |
+
public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null, ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) {
|
37 |
+
parent::__construct( $store, $monitor, $cleaner );
|
38 |
+
|
39 |
+
if ( is_null( $async_request ) ) {
|
40 |
+
$async_request = new ActionScheduler_AsyncRequest_QueueRunner( $this->store );
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->async_request = $async_request;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @codeCoverageIgnore
|
48 |
+
*/
|
49 |
+
public function init() {
|
50 |
+
|
51 |
+
add_filter( 'cron_schedules', array( self::instance(), 'add_wp_cron_schedule' ) );
|
52 |
+
|
53 |
+
// Check for and remove any WP Cron hook scheduled by Action Scheduler < 3.0.0, which didn't include the $context param
|
54 |
+
$next_timestamp = wp_next_scheduled( self::WP_CRON_HOOK );
|
55 |
+
if ( $next_timestamp ) {
|
56 |
+
wp_unschedule_event( $next_timestamp, self::WP_CRON_HOOK );
|
57 |
+
}
|
58 |
+
|
59 |
+
$cron_context = array( 'WP Cron' );
|
60 |
+
|
61 |
+
if ( ! wp_next_scheduled( self::WP_CRON_HOOK, $cron_context ) ) {
|
62 |
+
$schedule = apply_filters( 'action_scheduler_run_schedule', self::WP_CRON_SCHEDULE );
|
63 |
+
wp_schedule_event( time(), $schedule, self::WP_CRON_HOOK, $cron_context );
|
64 |
+
}
|
65 |
+
|
66 |
+
add_action( self::WP_CRON_HOOK, array( self::instance(), 'run' ) );
|
67 |
+
$this->hook_dispatch_async_request();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Hook check for dispatching an async request.
|
72 |
+
*/
|
73 |
+
public function hook_dispatch_async_request() {
|
74 |
+
add_action( 'shutdown', array( $this, 'maybe_dispatch_async_request' ) );
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Unhook check for dispatching an async request.
|
79 |
+
*/
|
80 |
+
public function unhook_dispatch_async_request() {
|
81 |
+
remove_action( 'shutdown', array( $this, 'maybe_dispatch_async_request' ) );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Check if we should dispatch an async request to process actions.
|
86 |
+
*
|
87 |
+
* This method is attached to 'shutdown', so is called frequently. To avoid slowing down
|
88 |
+
* the site, it mitigates the work performed in each request by:
|
89 |
+
* 1. checking if it's in the admin context and then
|
90 |
+
* 2. haven't run on the 'shutdown' hook within the lock time (60 seconds by default)
|
91 |
+
* 3. haven't exceeded the number of allowed batches.
|
92 |
+
*
|
93 |
+
* The order of these checks is important, because they run from a check on a value:
|
94 |
+
* 1. in memory - is_admin() maps to $GLOBALS or the WP_ADMIN constant
|
95 |
+
* 2. in memory - transients use autoloaded options by default
|
96 |
+
* 3. from a database query - has_maximum_concurrent_batches() run the query
|
97 |
+
* $this->store->get_claim_count() to find the current number of claims in the DB.
|
98 |
+
*
|
99 |
+
* If all of these conditions are met, then we request an async runner check whether it
|
100 |
+
* should dispatch a request to process pending actions.
|
101 |
+
*/
|
102 |
+
public function maybe_dispatch_async_request() {
|
103 |
+
if ( is_admin() && ! ActionScheduler::lock()->is_locked( 'async-request-runner' ) ) {
|
104 |
+
// Only start an async queue at most once every 60 seconds
|
105 |
+
ActionScheduler::lock()->set( 'async-request-runner' );
|
106 |
+
$this->async_request->maybe_dispatch();
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Process actions in the queue. Attached to self::WP_CRON_HOOK i.e. 'action_scheduler_run_queue'
|
112 |
+
*
|
113 |
+
* The $context param of this method defaults to 'WP Cron', because prior to Action Scheduler 3.0.0
|
114 |
+
* that was the only context in which this method was run, and the self::WP_CRON_HOOK hook had no context
|
115 |
+
* passed along with it. New code calling this method directly, or by triggering the self::WP_CRON_HOOK,
|
116 |
+
* should set a context as the first parameter. For an example of this, refer to the code seen in
|
117 |
+
* @see ActionScheduler_AsyncRequest_QueueRunner::handle()
|
118 |
+
*
|
119 |
+
* @param string $context Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron'
|
120 |
+
* Generally, this should be capitalised and not localised as it's a proper noun.
|
121 |
+
* @return int The number of actions processed.
|
122 |
+
*/
|
123 |
+
public function run( $context = 'WP Cron' ) {
|
124 |
+
ActionScheduler_Compatibility::raise_memory_limit();
|
125 |
+
ActionScheduler_Compatibility::raise_time_limit( $this->get_time_limit() );
|
126 |
+
do_action( 'action_scheduler_before_process_queue' );
|
127 |
+
$this->run_cleanup();
|
128 |
+
$processed_actions = 0;
|
129 |
+
if ( false === $this->has_maximum_concurrent_batches() ) {
|
130 |
+
$batch_size = apply_filters( 'action_scheduler_queue_runner_batch_size', 25 );
|
131 |
+
do {
|
132 |
+
$processed_actions_in_batch = $this->do_batch( $batch_size, $context );
|
133 |
+
$processed_actions += $processed_actions_in_batch;
|
134 |
+
} while ( $processed_actions_in_batch > 0 && ! $this->batch_limits_exceeded( $processed_actions ) ); // keep going until we run out of actions, time, or memory
|
135 |
+
}
|
136 |
+
|
137 |
+
do_action( 'action_scheduler_after_process_queue' );
|
138 |
+
return $processed_actions;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Process a batch of actions pending in the queue.
|
143 |
+
*
|
144 |
+
* Actions are processed by claiming a set of pending actions then processing each one until either the batch
|
145 |
+
* size is completed, or memory or time limits are reached, defined by @see $this->batch_limits_exceeded().
|
146 |
+
*
|
147 |
+
* @param int $size The maximum number of actions to process in the batch.
|
148 |
+
* @param string $context Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron'
|
149 |
+
* Generally, this should be capitalised and not localised as it's a proper noun.
|
150 |
+
* @return int The number of actions processed.
|
151 |
+
*/
|
152 |
+
protected function do_batch( $size = 100, $context = '' ) {
|
153 |
+
$claim = $this->store->stake_claim($size);
|
154 |
+
$this->monitor->attach($claim);
|
155 |
+
$processed_actions = 0;
|
156 |
+
|
157 |
+
foreach ( $claim->get_actions() as $action_id ) {
|
158 |
+
// bail if we lost the claim
|
159 |
+
if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $claim->get_id() ) ) ) {
|
160 |
+
break;
|
161 |
+
}
|
162 |
+
$this->process_action( $action_id, $context );
|
163 |
+
$processed_actions++;
|
164 |
+
|
165 |
+
if ( $this->batch_limits_exceeded( $processed_actions ) ) {
|
166 |
+
break;
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$this->store->release_claim($claim);
|
170 |
+
$this->monitor->detach();
|
171 |
+
$this->clear_caches();
|
172 |
+
return $processed_actions;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Flush the cache if possible (intended for use after a batch of actions has been processed).
|
177 |
+
*
|
178 |
+
* This is useful because running large batches can eat up memory and because invalid data can accrue in the
|
179 |
+
* runtime cache, which may lead to unexpected results.
|
180 |
+
*/
|
181 |
+
protected function clear_caches() {
|
182 |
+
/*
|
183 |
+
* Calling wp_cache_flush_runtime() lets us clear the runtime cache without invalidating the external object
|
184 |
+
* cache, so we will always prefer this when it is available (but it was only introduced in WordPress 6.0).
|
185 |
+
*/
|
186 |
+
if ( function_exists( 'wp_cache_flush_runtime' ) ) {
|
187 |
+
wp_cache_flush_runtime();
|
188 |
+
} elseif (
|
189 |
+
! wp_using_ext_object_cache()
|
190 |
+
/**
|
191 |
+
* When an external object cache is in use, and when wp_cache_flush_runtime() is not available, then
|
192 |
+
* normally the cache will not be flushed after processing a batch of actions (to avoid a performance
|
193 |
+
* penalty for other processes).
|
194 |
+
*
|
195 |
+
* This filter makes it possible to override this behavior and always flush the cache, even if an external
|
196 |
+
* object cache is in use.
|
197 |
+
*
|
198 |
+
* @since 1.0
|
199 |
+
*
|
200 |
+
* @param bool $flush_cache If the cache should be flushed.
|
201 |
+
*/
|
202 |
+
|| apply_filters( 'action_scheduler_queue_runner_flush_cache', false )
|
203 |
+
) {
|
204 |
+
wp_cache_flush();
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
public function add_wp_cron_schedule( $schedules ) {
|
209 |
+
$schedules['every_minute'] = array(
|
210 |
+
'interval' => 60, // in seconds
|
211 |
+
'display' => __( 'Every minute', 'action-scheduler' ),
|
212 |
+
);
|
213 |
+
|
214 |
+
return $schedules;
|
215 |
+
}
|
216 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_Versions.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Versions
|
5 |
+
*/
|
6 |
+
class ActionScheduler_Versions {
|
7 |
+
/**
|
8 |
+
* @var ActionScheduler_Versions
|
9 |
+
*/
|
10 |
+
private static $instance = NULL;
|
11 |
+
|
12 |
+
private $versions = array();
|
13 |
+
|
14 |
+
public function register( $version_string, $initialization_callback ) {
|
15 |
+
if ( isset($this->versions[$version_string]) ) {
|
16 |
+
return FALSE;
|
17 |
+
}
|
18 |
+
$this->versions[$version_string] = $initialization_callback;
|
19 |
+
return TRUE;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function get_versions() {
|
23 |
+
return $this->versions;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function latest_version() {
|
27 |
+
$keys = array_keys($this->versions);
|
28 |
+
if ( empty($keys) ) {
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
uasort( $keys, 'version_compare' );
|
32 |
+
return end($keys);
|
33 |
+
}
|
34 |
+
|
35 |
+
public function latest_version_callback() {
|
36 |
+
$latest = $this->latest_version();
|
37 |
+
if ( empty($latest) || !isset($this->versions[$latest]) ) {
|
38 |
+
return '__return_null';
|
39 |
+
}
|
40 |
+
return $this->versions[$latest];
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @return ActionScheduler_Versions
|
45 |
+
* @codeCoverageIgnore
|
46 |
+
*/
|
47 |
+
public static function instance() {
|
48 |
+
if ( empty(self::$instance) ) {
|
49 |
+
self::$instance = new self();
|
50 |
+
}
|
51 |
+
return self::$instance;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @codeCoverageIgnore
|
56 |
+
*/
|
57 |
+
public static function initialize_latest_version() {
|
58 |
+
$self = self::instance();
|
59 |
+
call_user_func($self->latest_version_callback());
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_WPCommentCleaner
|
5 |
+
*
|
6 |
+
* @since 3.0.0
|
7 |
+
*/
|
8 |
+
class ActionScheduler_WPCommentCleaner {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Post migration hook used to cleanup the WP comment table.
|
12 |
+
*
|
13 |
+
* @var string
|
14 |
+
*/
|
15 |
+
protected static $cleanup_hook = 'action_scheduler/cleanup_wp_comment_logs';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* An instance of the ActionScheduler_wpCommentLogger class to interact with the comments table.
|
19 |
+
*
|
20 |
+
* This instance should only be used as an interface. It should not be initialized.
|
21 |
+
*
|
22 |
+
* @var ActionScheduler_wpCommentLogger
|
23 |
+
*/
|
24 |
+
protected static $wp_comment_logger = null;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The key used to store the cached value of whether there are logs in the WP comment table.
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected static $has_logs_option_key = 'as_has_wp_comment_logs';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Initialize the class and attach callbacks.
|
35 |
+
*/
|
36 |
+
public static function init() {
|
37 |
+
if ( empty( self::$wp_comment_logger ) ) {
|
38 |
+
self::$wp_comment_logger = new ActionScheduler_wpCommentLogger();
|
39 |
+
}
|
40 |
+
|
41 |
+
add_action( self::$cleanup_hook, array( __CLASS__, 'delete_all_action_comments' ) );
|
42 |
+
|
43 |
+
// While there are orphaned logs left in the comments table, we need to attach the callbacks which filter comment counts.
|
44 |
+
add_action( 'pre_get_comments', array( self::$wp_comment_logger, 'filter_comment_queries' ), 10, 1 );
|
45 |
+
add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs
|
46 |
+
add_action( 'comment_feed_where', array( self::$wp_comment_logger, 'filter_comment_feed' ), 10, 2 );
|
47 |
+
|
48 |
+
// Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen
|
49 |
+
add_action( 'load-tools_page_action-scheduler', array( __CLASS__, 'register_admin_notice' ) );
|
50 |
+
add_action( 'load-woocommerce_page_wc-status', array( __CLASS__, 'register_admin_notice' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Determines if there are log entries in the wp comments table.
|
55 |
+
*
|
56 |
+
* Uses the flag set on migration completion set by @see self::maybe_schedule_cleanup().
|
57 |
+
*
|
58 |
+
* @return boolean Whether there are scheduled action comments in the comments table.
|
59 |
+
*/
|
60 |
+
public static function has_logs() {
|
61 |
+
return 'yes' === get_option( self::$has_logs_option_key );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Schedules the WP Post comment table cleanup to run in 6 months if it's not already scheduled.
|
66 |
+
* Attached to the migration complete hook 'action_scheduler/migration_complete'.
|
67 |
+
*/
|
68 |
+
public static function maybe_schedule_cleanup() {
|
69 |
+
if ( (bool) get_comments( array( 'type' => ActionScheduler_wpCommentLogger::TYPE, 'number' => 1, 'fields' => 'ids' ) ) ) {
|
70 |
+
update_option( self::$has_logs_option_key, 'yes' );
|
71 |
+
|
72 |
+
if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) {
|
73 |
+
as_schedule_single_action( gmdate( 'U' ) + ( 6 * MONTH_IN_SECONDS ), self::$cleanup_hook );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Delete all action comments from the WP Comments table.
|
80 |
+
*/
|
81 |
+
public static function delete_all_action_comments() {
|
82 |
+
global $wpdb;
|
83 |
+
$wpdb->delete( $wpdb->comments, array( 'comment_type' => ActionScheduler_wpCommentLogger::TYPE, 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT ) );
|
84 |
+
delete_option( self::$has_logs_option_key );
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Registers admin notices about the orphaned action logs.
|
89 |
+
*/
|
90 |
+
public static function register_admin_notice() {
|
91 |
+
add_action( 'admin_notices', array( __CLASS__, 'print_admin_notice' ) );
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Prints details about the orphaned action logs and includes information on where to learn more.
|
96 |
+
*/
|
97 |
+
public static function print_admin_notice() {
|
98 |
+
$next_cleanup_message = '';
|
99 |
+
$next_scheduled_cleanup_hook = as_next_scheduled_action( self::$cleanup_hook );
|
100 |
+
|
101 |
+
if ( $next_scheduled_cleanup_hook ) {
|
102 |
+
/* translators: %s: date interval */
|
103 |
+
$next_cleanup_message = sprintf( __( 'This data will be deleted in %s.', 'action-scheduler' ), human_time_diff( gmdate( 'U' ), $next_scheduled_cleanup_hook ) );
|
104 |
+
}
|
105 |
+
|
106 |
+
$notice = sprintf(
|
107 |
+
/* translators: 1: next cleanup message 2: github issue URL */
|
108 |
+
__( 'Action Scheduler has migrated data to custom tables; however, orphaned log entries exist in the WordPress Comments table. %1$s <a href="%2$s">Learn more »</a>', 'action-scheduler' ),
|
109 |
+
$next_cleanup_message,
|
110 |
+
'https://github.com/woocommerce/action-scheduler/issues/368'
|
111 |
+
);
|
112 |
+
|
113 |
+
echo '<div class="notice notice-warning"><p>' . wp_kses_post( $notice ) . '</p></div>';
|
114 |
+
}
|
115 |
+
}
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_wcSystemStatus.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_wcSystemStatus
|
5 |
+
*/
|
6 |
+
class ActionScheduler_wcSystemStatus {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* The active data stores
|
10 |
+
*
|
11 |
+
* @var ActionScheduler_Store
|
12 |
+
*/
|
13 |
+
protected $store;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor method for ActionScheduler_wcSystemStatus.
|
17 |
+
*
|
18 |
+
* @param ActionScheduler_Store $store Active store object.
|
19 |
+
*
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
public function __construct( $store ) {
|
23 |
+
$this->store = $store;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Display action data, including number of actions grouped by status and the oldest & newest action in each status.
|
28 |
+
*
|
29 |
+
* Helpful to identify issues, like a clogged queue.
|
30 |
+
*/
|
31 |
+
public function render() {
|
32 |
+
$action_counts = $this->store->action_counts();
|
33 |
+
$status_labels = $this->store->get_status_labels();
|
34 |
+
$oldest_and_newest = $this->get_oldest_and_newest( array_keys( $status_labels ) );
|
35 |
+
|
36 |
+
$this->get_template( $status_labels, $action_counts, $oldest_and_newest );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get oldest and newest scheduled dates for a given set of statuses.
|
41 |
+
*
|
42 |
+
* @param array $status_keys Set of statuses to find oldest & newest action for.
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
protected function get_oldest_and_newest( $status_keys ) {
|
46 |
+
|
47 |
+
$oldest_and_newest = array();
|
48 |
+
|
49 |
+
foreach ( $status_keys as $status ) {
|
50 |
+
$oldest_and_newest[ $status ] = array(
|
51 |
+
'oldest' => '–',
|
52 |
+
'newest' => '–',
|
53 |
+
);
|
54 |
+
|
55 |
+
if ( 'in-progress' === $status ) {
|
56 |
+
continue;
|
57 |
+
}
|
58 |
+
|
59 |
+
$oldest_and_newest[ $status ]['oldest'] = $this->get_action_status_date( $status, 'oldest' );
|
60 |
+
$oldest_and_newest[ $status ]['newest'] = $this->get_action_status_date( $status, 'newest' );
|
61 |
+
}
|
62 |
+
|
63 |
+
return $oldest_and_newest;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Get oldest or newest scheduled date for a given status.
|
68 |
+
*
|
69 |
+
* @param string $status Action status label/name string.
|
70 |
+
* @param string $date_type Oldest or Newest.
|
71 |
+
* @return DateTime
|
72 |
+
*/
|
73 |
+
protected function get_action_status_date( $status, $date_type = 'oldest' ) {
|
74 |
+
|
75 |
+
$order = 'oldest' === $date_type ? 'ASC' : 'DESC';
|
76 |
+
|
77 |
+
$action = $this->store->query_actions(
|
78 |
+
array(
|
79 |
+
'claimed' => false,
|
80 |
+
'status' => $status,
|
81 |
+
'per_page' => 1,
|
82 |
+
'order' => $order,
|
83 |
+
)
|
84 |
+
);
|
85 |
+
|
86 |
+
if ( ! empty( $action ) ) {
|
87 |
+
$date_object = $this->store->get_date( $action[0] );
|
88 |
+
$action_date = $date_object->format( 'Y-m-d H:i:s O' );
|
89 |
+
} else {
|
90 |
+
$action_date = '–';
|
91 |
+
}
|
92 |
+
|
93 |
+
return $action_date;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Get oldest or newest scheduled date for a given status.
|
98 |
+
*
|
99 |
+
* @param array $status_labels Set of statuses to find oldest & newest action for.
|
100 |
+
* @param array $action_counts Number of actions grouped by status.
|
101 |
+
* @param array $oldest_and_newest Date of the oldest and newest action with each status.
|
102 |
+
*/
|
103 |
+
protected function get_template( $status_labels, $action_counts, $oldest_and_newest ) {
|
104 |
+
$as_version = ActionScheduler_Versions::instance()->latest_version();
|
105 |
+
$as_datastore = get_class( ActionScheduler_Store::instance() );
|
106 |
+
?>
|
107 |
+
|
108 |
+
<table class="wc_status_table widefat" cellspacing="0">
|
109 |
+
<thead>
|
110 |
+
<tr>
|
111 |
+
<th colspan="5" data-export-label="Action Scheduler"><h2><?php esc_html_e( 'Action Scheduler', 'action-scheduler' ); ?><?php echo wc_help_tip( esc_html__( 'This section shows details of Action Scheduler.', 'action-scheduler' ) ); ?></h2></th>
|
112 |
+
</tr>
|
113 |
+
<tr>
|
114 |
+
<td colspan="2" data-export-label="Version"><?php esc_html_e( 'Version:', 'action-scheduler' ); ?></td>
|
115 |
+
<td colspan="3"><?php echo esc_html( $as_version ); ?></td>
|
116 |
+
</tr>
|
117 |
+
<tr>
|
118 |
+
<td colspan="2" data-export-label="Data store"><?php esc_html_e( 'Data store:', 'action-scheduler' ); ?></td>
|
119 |
+
<td colspan="3"><?php echo esc_html( $as_datastore ); ?></td>
|
120 |
+
</tr>
|
121 |
+
<tr>
|
122 |
+
<td><strong><?php esc_html_e( 'Action Status', 'action-scheduler' ); ?></strong></td>
|
123 |
+
<td class="help"> </td>
|
124 |
+
<td><strong><?php esc_html_e( 'Count', 'action-scheduler' ); ?></strong></td>
|
125 |
+
<td><strong><?php esc_html_e( 'Oldest Scheduled Date', 'action-scheduler' ); ?></strong></td>
|
126 |
+
<td><strong><?php esc_html_e( 'Newest Scheduled Date', 'action-scheduler' ); ?></strong></td>
|
127 |
+
</tr>
|
128 |
+
</thead>
|
129 |
+
<tbody>
|
130 |
+
<?php
|
131 |
+
foreach ( $action_counts as $status => $count ) {
|
132 |
+
// WC uses the 3rd column for export, so we need to display more data in that (hidden when viewed as part of the table) and add an empty 2nd column.
|
133 |
+
printf(
|
134 |
+
'<tr><td>%1$s</td><td> </td><td>%2$s<span style="display: none;">, Oldest: %3$s, Newest: %4$s</span></td><td>%3$s</td><td>%4$s</td></tr>',
|
135 |
+
esc_html( $status_labels[ $status ] ),
|
136 |
+
esc_html( number_format_i18n( $count ) ),
|
137 |
+
esc_html( $oldest_and_newest[ $status ]['oldest'] ),
|
138 |
+
esc_html( $oldest_and_newest[ $status ]['newest'] )
|
139 |
+
);
|
140 |
+
}
|
141 |
+
?>
|
142 |
+
</tbody>
|
143 |
+
</table>
|
144 |
+
|
145 |
+
<?php
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Is triggered when invoking inaccessible methods in an object context.
|
150 |
+
*
|
151 |
+
* @param string $name Name of method called.
|
152 |
+
* @param array $arguments Parameters to invoke the method with.
|
153 |
+
*
|
154 |
+
* @return mixed
|
155 |
+
* @link https://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods
|
156 |
+
*/
|
157 |
+
public function __call( $name, $arguments ) {
|
158 |
+
switch ( $name ) {
|
159 |
+
case 'print':
|
160 |
+
_deprecated_function( __CLASS__ . '::print()', '2.2.4', __CLASS__ . '::render()' );
|
161 |
+
return call_user_func_array( array( $this, 'render' ), $arguments );
|
162 |
+
}
|
163 |
+
|
164 |
+
return null;
|
165 |
+
}
|
166 |
+
}
|
vendor/woocommerce/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Action_Scheduler\WP_CLI\ProgressBar;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* WP CLI Queue runner.
|
7 |
+
*
|
8 |
+
* This class can only be called from within a WP CLI instance.
|
9 |
+
*/
|
10 |
+
class ActionScheduler_WPCLI_QueueRunner extends ActionScheduler_Abstract_QueueRunner {
|
11 |
+
|
12 |
+
/** @var array */
|
13 |
+
protected $actions;
|
14 |
+
|
15 |
+
/** @var ActionScheduler_ActionClaim */
|
16 |
+
protected $claim;
|
17 |
+
|
18 |
+
/** @var \cli\progress\Bar */
|
19 |
+
protected $progress_bar;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* ActionScheduler_WPCLI_QueueRunner constructor.
|
23 |
+
*
|
24 |
+
* @param ActionScheduler_Store $store
|
25 |
+
* @param ActionScheduler_FatalErrorMonitor $monitor
|
26 |
+
* @param ActionScheduler_QueueCleaner $cleaner
|
27 |
+
*
|
28 |
+
* @throws Exception When this is not run within WP CLI
|
29 |
+
*/
|
30 |
+
public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null ) {
|
31 |
+
if ( ! ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
32 |
+
/* translators: %s php class name */
|
33 |
+
throw new Exception( sprintf( __( 'The %s class can only be run within WP CLI.', 'action-scheduler' ), __CLASS__ ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
parent::__construct( $store, $monitor, $cleaner );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Set up the Queue before processing.
|
41 |
+
*
|
42 |
+
* @author Jeremy Pry
|
43 |
+
*
|
44 |
+
* @param int $batch_size The batch size to process.
|
45 |
+
* @param array $hooks The hooks being used to filter the actions claimed in this batch.
|
46 |
+
* @param string $group The group of actions to claim with this batch.
|
47 |
+
* @param bool $force Whether to force running even with too many concurrent processes.
|
48 |
+
*
|
49 |
+
* @return int The number of actions that will be run.
|
50 |
+
* @throws \WP_CLI\ExitException When there are too many concurrent batches.
|
51 |
+
*/
|
52 |
+
public function setup( $batch_size, $hooks = array(), $group = '', $force = false ) {
|
53 |
+
$this->run_cleanup();
|
54 |
+
$this->add_hooks();
|
55 |
+
|
56 |
+
// Check to make sure there aren't too many concurrent processes running.
|
57 |
+
if ( $this->has_maximum_concurrent_batches() ) {
|
58 |
+
if ( $force ) {
|
59 |
+
WP_CLI::warning( __( 'There are too many concurrent batches, but the run is forced to continue.', 'action-scheduler' ) );
|
60 |
+
} else {
|
61 |
+
WP_CLI::error( __( 'There are too many concurrent batches.', 'action-scheduler' ) );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
// Stake a claim and store it.
|
66 |
+
$this->claim = $this->store->stake_claim( $batch_size, null, $hooks, $group );
|
67 |
+
$this->monitor->attach( $this->claim );
|
68 |
+
$this->actions = $this->claim->get_actions();
|
69 |
+
|
70 |
+
return count( $this->actions );
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Add our hooks to the appropriate actions.
|
75 |
+
*
|
76 |
+
* @author Jeremy Pry
|
77 |
+
*/
|
78 |
+
protected function add_hooks() {
|
79 |
+
add_action( 'action_scheduler_before_execute', array( $this, 'before_execute' ) );
|
80 |
+
add_action( 'action_scheduler_after_execute', array( $this, 'after_execute' ), 10, 2 );
|
81 |
+
add_action( 'action_scheduler_failed_execution', array( $this, 'action_failed' ), 10, 2 );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Set up the WP CLI progress bar.
|
86 |
+
*
|
87 |
+
* @author Jeremy Pry
|
88 |
+
*/
|
89 |
+
protected function setup_progress_bar() {
|
90 |
+
$count = count( $this->actions );
|
91 |
+
$this->progress_bar = new ProgressBar(
|
92 |
+
/* translators: %d: amount of actions */
|
93 |
+
sprintf( _n( 'Running %d action', 'Running %d actions', $count, 'action-scheduler' ), number_format_i18n( $count ) ),
|
94 |
+
$count
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Process actions in the queue.
|
100 |
+
*
|
101 |
+
* @author Jeremy Pry
|
102 |
+
*
|
103 |
+
* @param string $context Optional runner context. Default 'WP CLI'.
|
104 |
+
*
|
105 |
+
* @return int The number of actions processed.
|
106 |
+
*/
|
107 |
+
public function run( $context = 'WP CLI' ) {
|
108 |
+
do_action( 'action_scheduler_before_process_queue' );
|
109 |
+
$this->setup_progress_bar();
|
110 |
+
foreach ( $this->actions as $action_id ) {
|
111 |
+
// Error if we lost the claim.
|
112 |
+
if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $this->claim->get_id() ) ) ) {
|
113 |
+
WP_CLI::warning( __( 'The claim has been lost. Aborting current batch.', 'action-scheduler' ) );
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
|
117 |
+
$this->process_action( $action_id, $context );
|
118 |
+
$this->progress_bar->tick();
|
119 |
+
}
|
120 |
+
|
121 |
+
$completed = $this->progress_bar->current();
|
122 |
+
$this->progress_bar->finish();
|
123 |
+
$this->store->release_claim( $this->claim );
|
124 |
+
do_action( 'action_scheduler_after_process_queue' );
|
125 |
+
|
126 |
+
return $completed;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Handle WP CLI message when the action is starting.
|
131 |
+
*
|
132 |
+
* @author Jeremy Pry
|
133 |
+
*
|
134 |
+
* @param $action_id
|
135 |
+
*/
|
136 |
+
public function before_execute( $action_id ) {
|
137 |
+
/* translators: %s refers to the action ID */
|
138 |
+
WP_CLI::log( sprintf( __( 'Started processing action %s', 'action-scheduler' ), $action_id ) );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Handle WP CLI message when the action has completed.
|
143 |
+
*
|
144 |
+
* @author Jeremy Pry
|
145 |
+
*
|
146 |
+
* @param int $action_id
|
147 |
+
* @param null|ActionScheduler_Action $action The instance of the action. Default to null for backward compatibility.
|
148 |
+
*/
|
149 |
+
public function after_execute( $action_id, $action = null ) {
|
150 |
+
// backward compatibility
|
151 |
+
if ( null === $action ) {
|
152 |
+
$action = $this->store->fetch_action( $action_id );
|
153 |
+
}
|
154 |
+
/* translators: 1: action ID 2: hook name */
|
155 |
+
WP_CLI::log( sprintf( __( 'Completed processing action %1$s with hook: %2$s', 'action-scheduler' ), $action_id, $action->get_hook() ) );
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Handle WP CLI message when the action has failed.
|
160 |
+
*
|
161 |
+
* @author Jeremy Pry
|
162 |
+
*
|
163 |
+
* @param int $action_id
|
164 |
+
* @param Exception $exception
|
165 |
+
* @throws \WP_CLI\ExitException With failure message.
|
166 |
+
*/
|
167 |
+
public function action_failed( $action_id, $exception ) {
|
168 |
+
WP_CLI::error(
|
169 |
+
/* translators: 1: action ID 2: exception message */
|
170 |
+
sprintf( __( 'Error processing action %1$s: %2$s', 'action-scheduler' ), $action_id, $exception->getMessage() ),
|
171 |
+
false
|
172 |
+
);
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Sleep and help avoid hitting memory limit
|
177 |
+
*
|
178 |
+
* @param int $sleep_time Amount of seconds to sleep
|
179 |
+
* @deprecated 3.0.0
|
180 |
+
*/
|
181 |
+
protected function stop_the_insanity( $sleep_time = 0 ) {
|
182 |
+
_deprecated_function( 'ActionScheduler_WPCLI_QueueRunner::stop_the_insanity', '3.0.0', 'ActionScheduler_DataController::free_memory' );
|
183 |
+
|
184 |
+
ActionScheduler_DataController::free_memory();
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Maybe trigger the stop_the_insanity() method to free up memory.
|
189 |
+
*/
|
190 |
+
protected function maybe_stop_the_insanity() {
|
191 |
+
// The value returned by progress_bar->current() might be padded. Remove padding, and convert to int.
|
192 |
+
$current_iteration = intval( trim( $this->progress_bar->current() ) );
|
193 |
+
if ( 0 === $current_iteration % 50 ) {
|
194 |
+
$this->stop_the_insanity();
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
vendor/woocommerce/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Commands for Action Scheduler.
|
5 |
+
*/
|
6 |
+
class ActionScheduler_WPCLI_Scheduler_command extends WP_CLI_Command {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Force tables schema creation for Action Scheduler
|
10 |
+
*
|
11 |
+
* ## OPTIONS
|
12 |
+
*
|
13 |
+
* @param array $args Positional arguments.
|
14 |
+
* @param array $assoc_args Keyed arguments.
|
15 |
+
*
|
16 |
+
* @subcommand fix-schema
|
17 |
+
*/
|
18 |
+
public function fix_schema( $args, $assoc_args ) {
|
19 |
+
$schema_classes = array( ActionScheduler_LoggerSchema::class, ActionScheduler_StoreSchema::class );
|
20 |
+
|
21 |
+
foreach ( $schema_classes as $classname ) {
|
22 |
+
if ( is_subclass_of( $classname, ActionScheduler_Abstract_Schema::class ) ) {
|
23 |
+
$obj = new $classname();
|
24 |
+
$obj->init();
|
25 |
+
$obj->register_tables( true );
|
26 |
+
|
27 |
+
WP_CLI::success(
|
28 |
+
sprintf(
|
29 |
+
/* translators: %s refers to the schema name*/
|
30 |
+
__( 'Registered schema for %s', 'action-scheduler' ),
|
31 |
+
$classname
|
32 |
+
)
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Run the Action Scheduler
|
40 |
+
*
|
41 |
+
* ## OPTIONS
|
42 |
+
*
|
43 |
+
* [--batch-size=<size>]
|
44 |
+
* : The maximum number of actions to run. Defaults to 100.
|
45 |
+
*
|
46 |
+
* [--batches=<size>]
|
47 |
+
* : Limit execution to a number of batches. Defaults to 0, meaning batches will continue being executed until all actions are complete.
|
48 |
+
*
|
49 |
+
* [--cleanup-batch-size=<size>]
|
50 |
+
* : The maximum number of actions to clean up. Defaults to the value of --batch-size.
|
51 |
+
*
|
52 |
+
* [--hooks=<hooks>]
|
53 |
+
* : Only run actions with the specified hook. Omitting this option runs actions with any hook. Define multiple hooks as a comma separated string (without spaces), e.g. `--hooks=hook_one,hook_two,hook_three`
|
54 |
+
*
|
55 |
+
* [--group=<group>]
|
56 |
+
* : Only run actions from the specified group. Omitting this option runs actions from all groups.
|
57 |
+
*
|
58 |
+
* [--free-memory-on=<count>]
|
59 |
+
* : The number of actions to process between freeing memory. 0 disables freeing memory. Default 50.
|
60 |
+
*
|
61 |
+
* [--pause=<seconds>]
|
62 |
+
* : The number of seconds to pause when freeing memory. Default no pause.
|
63 |
+
*
|
64 |
+
* [--force]
|
65 |
+
* : Whether to force execution despite the maximum number of concurrent processes being exceeded.
|
66 |
+
*
|
67 |
+
* @param array $args Positional arguments.
|
68 |
+
* @param array $assoc_args Keyed arguments.
|
69 |
+
* @throws \WP_CLI\ExitException When an error occurs.
|
70 |
+
*
|
71 |
+
* @subcommand run
|
72 |
+
*/
|
73 |
+
public function run( $args, $assoc_args ) {
|
74 |
+
// Handle passed arguments.
|
75 |
+
$batch = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'batch-size', 100 ) );
|
76 |
+
$batches = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'batches', 0 ) );
|
77 |
+
$clean = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'cleanup-batch-size', $batch ) );
|
78 |
+
$hooks = explode( ',', WP_CLI\Utils\get_flag_value( $assoc_args, 'hooks', '' ) );
|
79 |
+
$hooks = array_filter( array_map( 'trim', $hooks ) );
|
80 |
+
$group = \WP_CLI\Utils\get_flag_value( $assoc_args, 'group', '' );
|
81 |
+
$free_on = \WP_CLI\Utils\get_flag_value( $assoc_args, 'free-memory-on', 50 );
|
82 |
+
$sleep = \WP_CLI\Utils\get_flag_value( $assoc_args, 'pause', 0 );
|
83 |
+
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force', false );
|
84 |
+
|
85 |
+
ActionScheduler_DataController::set_free_ticks( $free_on );
|
86 |
+
ActionScheduler_DataController::set_sleep_time( $sleep );
|
87 |
+
|
88 |
+
$batches_completed = 0;
|
89 |
+
$actions_completed = 0;
|
90 |
+
$unlimited = $batches === 0;
|
91 |
+
|
92 |
+
try {
|
93 |
+
// Custom queue cleaner instance.
|
94 |
+
$cleaner = new ActionScheduler_QueueCleaner( null, $clean );
|
95 |
+
|
96 |
+
// Get the queue runner instance
|
97 |
+
$runner = new ActionScheduler_WPCLI_QueueRunner( null, null, $cleaner );
|
98 |
+
|
99 |
+
// Determine how many tasks will be run in the first batch.
|
100 |
+
$total = $runner->setup( $batch, $hooks, $group, $force );
|
101 |
+
|
102 |
+
// Run actions for as long as possible.
|
103 |
+
while ( $total > 0 ) {
|
104 |
+
$this->print_total_actions( $total );
|
105 |
+
$actions_completed += $runner->run();
|
106 |
+
$batches_completed++;
|
107 |
+
|
108 |
+
// Maybe set up tasks for the next batch.
|
109 |
+
$total = ( $unlimited || $batches_completed < $batches ) ? $runner->setup( $batch, $hooks, $group, $force ) : 0;
|
110 |
+
}
|
111 |
+
} catch ( Exception $e ) {
|
112 |
+
$this->print_error( $e );
|
113 |
+
}
|
114 |
+
|
115 |
+
$this->print_total_batches( $batches_completed );
|
116 |
+
$this->print_success( $actions_completed );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Print WP CLI message about how many actions are about to be processed.
|
121 |
+
*
|
122 |
+
* @author Jeremy Pry
|
123 |
+
*
|
124 |
+
* @param int $total
|
125 |
+
*/
|
126 |
+
protected function print_total_actions( $total ) {
|
127 |
+
WP_CLI::log(
|
128 |
+
sprintf(
|
129 |
+
/* translators: %d refers to how many scheduled taks were found to run */
|
130 |
+
_n( 'Found %d scheduled task', 'Found %d scheduled tasks', $total, 'action-scheduler' ),
|
131 |
+
number_format_i18n( $total )
|
132 |
+
)
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Print WP CLI message about how many batches of actions were processed.
|
138 |
+
*
|
139 |
+
* @author Jeremy Pry
|
140 |
+
*
|
141 |
+
* @param int $batches_completed
|
142 |
+
*/
|
143 |
+
protected function print_total_batches( $batches_completed ) {
|
144 |
+
WP_CLI::log(
|
145 |
+
sprintf(
|
146 |
+
/* translators: %d refers to the total number of batches executed */
|
147 |
+
_n( '%d batch executed.', '%d batches executed.', $batches_completed, 'action-scheduler' ),
|
148 |
+
number_format_i18n( $batches_completed )
|
149 |
+
)
|
150 |
+
);
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Convert an exception into a WP CLI error.
|
155 |
+
*
|
156 |
+
* @author Jeremy Pry
|
157 |
+
*
|
158 |
+
* @param Exception $e The error object.
|
159 |
+
*
|
160 |
+
* @throws \WP_CLI\ExitException
|
161 |
+
*/
|
162 |
+
protected function print_error( Exception $e ) {
|
163 |
+
WP_CLI::error(
|
164 |
+
sprintf(
|
165 |
+
/* translators: %s refers to the exception error message */
|
166 |
+
__( 'There was an error running the action scheduler: %s', 'action-scheduler' ),
|
167 |
+
$e->getMessage()
|
168 |
+
)
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Print a success message with the number of completed actions.
|
174 |
+
*
|
175 |
+
* @author Jeremy Pry
|
176 |
+
*
|
177 |
+
* @param int $actions_completed
|
178 |
+
*/
|
179 |
+
protected function print_success( $actions_completed ) {
|
180 |
+
WP_CLI::success(
|
181 |
+
sprintf(
|
182 |
+
/* translators: %d refers to the total number of taskes completed */
|
183 |
+
_n( '%d scheduled task completed.', '%d scheduled tasks completed.', $actions_completed, 'action-scheduler' ),
|
184 |
+
number_format_i18n( $actions_completed )
|
185 |
+
)
|
186 |
+
);
|
187 |
+
}
|
188 |
+
}
|
vendor/woocommerce/action-scheduler/classes/WP_CLI/Migration_Command.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
namespace Action_Scheduler\WP_CLI;
|
5 |
+
|
6 |
+
use Action_Scheduler\Migration\Config;
|
7 |
+
use Action_Scheduler\Migration\Runner;
|
8 |
+
use Action_Scheduler\Migration\Scheduler;
|
9 |
+
use Action_Scheduler\Migration\Controller;
|
10 |
+
use WP_CLI;
|
11 |
+
use WP_CLI_Command;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class Migration_Command
|
15 |
+
*
|
16 |
+
* @package Action_Scheduler\WP_CLI
|
17 |
+
*
|
18 |
+
* @since 3.0.0
|
19 |
+
*
|
20 |
+
* @codeCoverageIgnore
|
21 |
+
*/
|
22 |
+
class Migration_Command extends WP_CLI_Command {
|
23 |
+
|
24 |
+
/** @var int */
|
25 |
+
private $total_processed = 0;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Register the command with WP-CLI
|
29 |
+
*/
|
30 |
+
public function register() {
|
31 |
+
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
WP_CLI::add_command( 'action-scheduler migrate', [ $this, 'migrate' ], [
|
36 |
+
'shortdesc' => 'Migrates actions to the DB tables store',
|
37 |
+
'synopsis' => [
|
38 |
+
[
|
39 |
+
'type' => 'assoc',
|
40 |
+
'name' => 'batch-size',
|
41 |
+
'optional' => true,
|
42 |
+
'default' => 100,
|
43 |
+
'description' => 'The number of actions to process in each batch',
|
44 |
+
],
|
45 |
+
[
|
46 |
+
'type' => 'assoc',
|
47 |
+
'name' => 'free-memory-on',
|
48 |
+
'optional' => true,
|
49 |
+
'default' => 50,
|
50 |
+
'description' => 'The number of actions to process between freeing memory. 0 disables freeing memory',
|
51 |
+
],
|
52 |
+
[
|
53 |
+
'type' => 'assoc',
|
54 |
+
'name' => 'pause',
|
55 |
+
'optional' => true,
|
56 |
+
'default' => 0,
|
57 |
+
'description' => 'The number of seconds to pause when freeing memory',
|
58 |
+
],
|
59 |
+
[
|
60 |
+
'type' => 'flag',
|
61 |
+
'name' => 'dry-run',
|
62 |
+
'optional' => true,
|
63 |
+
'description' => 'Reports on the actions that would have been migrated, but does not change any data',
|
64 |
+
],
|
65 |
+
],
|
66 |
+
] );
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Process the data migration.
|
71 |
+
*
|
72 |
+
* @param array $positional_args Required for WP CLI. Not used in migration.
|
73 |
+
* @param array $assoc_args Optional arguments.
|
74 |
+
*
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function migrate( $positional_args, $assoc_args ) {
|
78 |
+
$this->init_logging();
|
79 |
+
|
80 |
+
$config = $this->get_migration_config( $assoc_args );
|
81 |
+
$runner = new Runner( $config );
|
82 |
+
$runner->init_destination();
|
83 |
+
|
84 |
+
$batch_size = isset( $assoc_args[ 'batch-size' ] ) ? (int) $assoc_args[ 'batch-size' ] : 100;
|
85 |
+
$free_on = isset( $assoc_args[ 'free-memory-on' ] ) ? (int) $assoc_args[ 'free-memory-on' ] : 50;
|
86 |
+
$sleep = isset( $assoc_args[ 'pause' ] ) ? (int) $assoc_args[ 'pause' ] : 0;
|
87 |
+
\ActionScheduler_DataController::set_free_ticks( $free_on );
|
88 |
+
\ActionScheduler_DataController::set_sleep_time( $sleep );
|
89 |
+
|
90 |
+
do {
|
91 |
+
$actions_processed = $runner->run( $batch_size );
|
92 |
+
$this->total_processed += $actions_processed;
|
93 |
+
} while ( $actions_processed > 0 );
|
94 |
+
|
95 |
+
if ( ! $config->get_dry_run() ) {
|
96 |
+
// let the scheduler know that there's nothing left to do
|
97 |
+
$scheduler = new Scheduler();
|
98 |
+
$scheduler->mark_complete();
|
99 |
+
}
|
100 |
+
|
101 |
+
WP_CLI::success( sprintf( '%s complete. %d actions processed.', $config->get_dry_run() ? 'Dry run' : 'Migration', $this->total_processed ) );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Build the config object used to create the Runner
|
106 |
+
*
|
107 |
+
* @param array $args Optional arguments.
|
108 |
+
*
|
109 |
+
* @return ActionScheduler\Migration\Config
|
110 |
+
*/
|
111 |
+
private function get_migration_config( $args ) {
|
112 |
+
$args = wp_parse_args( $args, [
|
113 |
+
'dry-run' => false,
|
114 |
+
] );
|
115 |
+
|
116 |
+
$config = Controller::instance()->get_migration_config_object();
|
117 |
+
$config->set_dry_run( ! empty( $args[ 'dry-run' ] ) );
|
118 |
+
|
119 |
+
return $config;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Hook command line logging into migration actions.
|
124 |
+
*/
|
125 |
+
private function init_logging() {
|
126 |
+
add_action( 'action_scheduler/migrate_action_dry_run', function ( $action_id ) {
|
127 |
+
WP_CLI::debug( sprintf( 'Dry-run: migrated action %d', $action_id ) );
|
128 |
+
}, 10, 1 );
|
129 |
+
add_action( 'action_scheduler/no_action_to_migrate', function ( $action_id ) {
|
130 |
+
WP_CLI::debug( sprintf( 'No action found to migrate for ID %d', $action_id ) );
|
131 |
+
}, 10, 1 );
|
132 |
+
add_action( 'action_scheduler/migrate_action_failed', function ( $action_id ) {
|
133 |
+
WP_CLI::warning( sprintf( 'Failed migrating action with ID %d', $action_id ) );
|
134 |
+
}, 10, 1 );
|
135 |
+
add_action( 'action_scheduler/migrate_action_incomplete', function ( $source_id, $destination_id ) {
|
136 |
+
WP_CLI::warning( sprintf( 'Unable to remove source action with ID %d after migrating to new ID %d', $source_id, $destination_id ) );
|
137 |
+
}, 10, 2 );
|
138 |
+
add_action( 'action_scheduler/migrated_action', function ( $source_id, $destination_id ) {
|
139 |
+
WP_CLI::debug( sprintf( 'Migrated source action with ID %d to new store with ID %d', $source_id, $destination_id ) );
|
140 |
+
}, 10, 2 );
|
141 |
+
add_action( 'action_scheduler/migration_batch_starting', function ( $batch ) {
|
142 |
+
WP_CLI::debug( 'Beginning migration of batch: ' . print_r( $batch, true ) );
|
143 |
+
}, 10, 1 );
|
144 |
+
add_action( 'action_scheduler/migration_batch_complete', function ( $batch ) {
|
145 |
+
WP_CLI::log( sprintf( 'Completed migration of %d actions', count( $batch ) ) );
|
146 |
+
}, 10, 1 );
|
147 |
+
}
|
148 |
+
}
|
vendor/woocommerce/action-scheduler/classes/WP_CLI/ProgressBar.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Action_Scheduler\WP_CLI;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* WP_CLI progress bar for Action Scheduler.
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class ProgressBar
|
11 |
+
*
|
12 |
+
* @package Action_Scheduler\WP_CLI
|
13 |
+
*
|
14 |
+
* @since 3.0.0
|
15 |
+
*
|
16 |
+
* @codeCoverageIgnore
|
17 |
+
*/
|
18 |
+
class ProgressBar {
|
19 |
+
|
20 |
+
/** @var integer */
|
21 |
+
protected $total_ticks;
|
22 |
+
|
23 |
+
/** @var integer */
|
24 |
+
protected $count;
|
25 |
+
|
26 |
+
/** @var integer */
|
27 |
+
protected $interval;
|
28 |
+
|
29 |
+
/** @var string */
|
30 |
+
protected $message;
|
31 |
+
|
32 |
+
/** @var \cli\progress\Bar */
|
33 |
+
protected $progress_bar;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* ProgressBar constructor.
|
37 |
+
*
|
38 |
+
* @param string $message Text to display before the progress bar.
|
39 |
+
* @param integer $count Total number of ticks to be performed.
|
40 |
+
* @param integer $interval Optional. The interval in milliseconds between updates. Default 100.
|
41 |
+
*
|
42 |
+
* @throws Exception When this is not run within WP CLI
|
43 |
+
*/
|
44 |
+
public function __construct( $message, $count, $interval = 100 ) {
|
45 |
+
if ( ! ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
46 |
+
/* translators: %s php class name */
|
47 |
+
throw new \Exception( sprintf( __( 'The %s class can only be run within WP CLI.', 'action-scheduler' ), __CLASS__ ) );
|
48 |
+
}
|
49 |
+
|
50 |
+
$this->total_ticks = 0;
|
51 |
+
$this->message = $message;
|
52 |
+
$this->count = $count;
|
53 |
+
$this->interval = $interval;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Increment the progress bar ticks.
|
58 |
+
*/
|
59 |
+
public function tick() {
|
60 |
+
if ( null === $this->progress_bar ) {
|
61 |
+
$this->setup_progress_bar();
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->progress_bar->tick();
|
65 |
+
$this->total_ticks++;
|
66 |
+
|
67 |
+
do_action( 'action_scheduler/progress_tick', $this->total_ticks );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get the progress bar tick count.
|
72 |
+
*
|
73 |
+
* @return int
|
74 |
+
*/
|
75 |
+
public function current() {
|
76 |
+
return $this->progress_bar ? $this->progress_bar->current() : 0;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Finish the current progress bar.
|
81 |
+
*/
|
82 |
+
public function finish() {
|
83 |
+
if ( null !== $this->progress_bar ) {
|
84 |
+
$this->progress_bar->finish();
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->progress_bar = null;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Set the message used when creating the progress bar.
|
92 |
+
*
|
93 |
+
* @param string $message The message to be used when the next progress bar is created.
|
94 |
+
*/
|
95 |
+
public function set_message( $message ) {
|
96 |
+
$this->message = $message;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Set the count for a new progress bar.
|
101 |
+
*
|
102 |
+
* @param integer $count The total number of ticks expected to complete.
|
103 |
+
*/
|
104 |
+
public function set_count( $count ) {
|
105 |
+
$this->count = $count;
|
106 |
+
$this->finish();
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Set up the progress bar.
|
111 |
+
*/
|
112 |
+
protected function setup_progress_bar() {
|
113 |
+
$this->progress_bar = \WP_CLI\Utils\make_progress_bar(
|
114 |
+
$this->message,
|
115 |
+
$this->count,
|
116 |
+
$this->interval
|
117 |
+
);
|
118 |
+
}
|
119 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php
ADDED
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Action_Scheduler\WP_CLI\Migration_Command;
|
4 |
+
use Action_Scheduler\Migration\Controller;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class ActionScheduler
|
8 |
+
* @codeCoverageIgnore
|
9 |
+
*/
|
10 |
+
abstract class ActionScheduler {
|
11 |
+
private static $plugin_file = '';
|
12 |
+
/** @var ActionScheduler_ActionFactory */
|
13 |
+
private static $factory = NULL;
|
14 |
+
/** @var bool */
|
15 |
+
private static $data_store_initialized = false;
|
16 |
+
|
17 |
+
public static function factory() {
|
18 |
+
if ( !isset(self::$factory) ) {
|
19 |
+
self::$factory = new ActionScheduler_ActionFactory();
|
20 |
+
}
|
21 |
+
return self::$factory;
|
22 |
+
}
|
23 |
+
|
24 |
+
public static function store() {
|
25 |
+
return ActionScheduler_Store::instance();
|
26 |
+
}
|
27 |
+
|
28 |
+
public static function lock() {
|
29 |
+
return ActionScheduler_Lock::instance();
|
30 |
+
}
|
31 |
+
|
32 |
+
public static function logger() {
|
33 |
+
return ActionScheduler_Logger::instance();
|
34 |
+
}
|
35 |
+
|
36 |
+
public static function runner() {
|
37 |
+
return ActionScheduler_QueueRunner::instance();
|
38 |
+
}
|
39 |
+
|
40 |
+
public static function admin_view() {
|
41 |
+
return ActionScheduler_AdminView::instance();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Get the absolute system path to the plugin directory, or a file therein
|
46 |
+
* @static
|
47 |
+
* @param string $path
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
public static function plugin_path( $path ) {
|
51 |
+
$base = dirname(self::$plugin_file);
|
52 |
+
if ( $path ) {
|
53 |
+
return trailingslashit($base).$path;
|
54 |
+
} else {
|
55 |
+
return untrailingslashit($base);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get the absolute URL to the plugin directory, or a file therein
|
61 |
+
* @static
|
62 |
+
* @param string $path
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public static function plugin_url( $path ) {
|
66 |
+
return plugins_url($path, self::$plugin_file);
|
67 |
+
}
|
68 |
+
|
69 |
+
public static function autoload( $class ) {
|
70 |
+
$d = DIRECTORY_SEPARATOR;
|
71 |
+
$classes_dir = self::plugin_path( 'classes' . $d );
|
72 |
+
$separator = strrpos( $class, '\\' );
|
73 |
+
if ( false !== $separator ) {
|
74 |
+
if ( 0 !== strpos( $class, 'Action_Scheduler' ) ) {
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
$class = substr( $class, $separator + 1 );
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( 'Deprecated' === substr( $class, -10 ) ) {
|
81 |
+
$dir = self::plugin_path( 'deprecated' . $d );
|
82 |
+
} elseif ( self::is_class_abstract( $class ) ) {
|
83 |
+
$dir = $classes_dir . 'abstracts' . $d;
|
84 |
+
} elseif ( self::is_class_migration( $class ) ) {
|
85 |
+
$dir = $classes_dir . 'migration' . $d;
|
86 |
+
} elseif ( 'Schedule' === substr( $class, -8 ) ) {
|
87 |
+
$dir = $classes_dir . 'schedules' . $d;
|
88 |
+
} elseif ( 'Action' === substr( $class, -6 ) ) {
|
89 |
+
$dir = $classes_dir . 'actions' . $d;
|
90 |
+
} elseif ( 'Schema' === substr( $class, -6 ) ) {
|
91 |
+
$dir = $classes_dir . 'schema' . $d;
|
92 |
+
} elseif ( strpos( $class, 'ActionScheduler' ) === 0 ) {
|
93 |
+
$segments = explode( '_', $class );
|
94 |
+
$type = isset( $segments[ 1 ] ) ? $segments[ 1 ] : '';
|
95 |
+
|
96 |
+
switch ( $type ) {
|
97 |
+
case 'WPCLI':
|
98 |
+
$dir = $classes_dir . 'WP_CLI' . $d;
|
99 |
+
break;
|
100 |
+
case 'DBLogger':
|
101 |
+
case 'DBStore':
|
102 |
+
case 'HybridStore':
|
103 |
+
case 'wpPostStore':
|
104 |
+
case 'wpCommentLogger':
|
105 |
+
$dir = $classes_dir . 'data-stores' . $d;
|
106 |
+
break;
|
107 |
+
default:
|
108 |
+
$dir = $classes_dir;
|
109 |
+
break;
|
110 |
+
}
|
111 |
+
} elseif ( self::is_class_cli( $class ) ) {
|
112 |
+
$dir = $classes_dir . 'WP_CLI' . $d;
|
113 |
+
} elseif ( strpos( $class, 'CronExpression' ) === 0 ) {
|
114 |
+
$dir = self::plugin_path( 'lib' . $d . 'cron-expression' . $d );
|
115 |
+
} elseif ( strpos( $class, 'WP_Async_Request' ) === 0 ) {
|
116 |
+
$dir = self::plugin_path( 'lib' . $d );
|
117 |
+
} else {
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( file_exists( $dir . "{$class}.php" ) ) {
|
122 |
+
include( $dir . "{$class}.php" );
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Initialize the plugin
|
129 |
+
*
|
130 |
+
* @static
|
131 |
+
* @param string $plugin_file
|
132 |
+
*/
|
133 |
+
public static function init( $plugin_file ) {
|
134 |
+
self::$plugin_file = $plugin_file;
|
135 |
+
spl_autoload_register( array( __CLASS__, 'autoload' ) );
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Fires in the early stages of Action Scheduler init hook.
|
139 |
+
*/
|
140 |
+
do_action( 'action_scheduler_pre_init' );
|
141 |
+
|
142 |
+
require_once( self::plugin_path( 'functions.php' ) );
|
143 |
+
ActionScheduler_DataController::init();
|
144 |
+
|
145 |
+
$store = self::store();
|
146 |
+
$logger = self::logger();
|
147 |
+
$runner = self::runner();
|
148 |
+
$admin_view = self::admin_view();
|
149 |
+
|
150 |
+
// Ensure initialization on plugin activation.
|
151 |
+
if ( ! did_action( 'init' ) ) {
|
152 |
+
add_action( 'init', array( $admin_view, 'init' ), 0, 0 ); // run before $store::init()
|
153 |
+
add_action( 'init', array( $store, 'init' ), 1, 0 );
|
154 |
+
add_action( 'init', array( $logger, 'init' ), 1, 0 );
|
155 |
+
add_action( 'init', array( $runner, 'init' ), 1, 0 );
|
156 |
+
} else {
|
157 |
+
$admin_view->init();
|
158 |
+
$store->init();
|
159 |
+
$logger->init();
|
160 |
+
$runner->init();
|
161 |
+
}
|
162 |
+
|
163 |
+
if ( apply_filters( 'action_scheduler_load_deprecated_functions', true ) ) {
|
164 |
+
require_once( self::plugin_path( 'deprecated/functions.php' ) );
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
168 |
+
WP_CLI::add_command( 'action-scheduler', 'ActionScheduler_WPCLI_Scheduler_command' );
|
169 |
+
if ( ! ActionScheduler_DataController::is_migration_complete() && Controller::instance()->allow_migration() ) {
|
170 |
+
$command = new Migration_Command();
|
171 |
+
$command->register();
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
self::$data_store_initialized = true;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Handle WP comment cleanup after migration.
|
179 |
+
*/
|
180 |
+
if ( is_a( $logger, 'ActionScheduler_DBLogger' ) && ActionScheduler_DataController::is_migration_complete() && ActionScheduler_WPCommentCleaner::has_logs() ) {
|
181 |
+
ActionScheduler_WPCommentCleaner::init();
|
182 |
+
}
|
183 |
+
|
184 |
+
add_action( 'action_scheduler/migration_complete', 'ActionScheduler_WPCommentCleaner::maybe_schedule_cleanup' );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Check whether the AS data store has been initialized.
|
189 |
+
*
|
190 |
+
* @param string $function_name The name of the function being called. Optional. Default `null`.
|
191 |
+
* @return bool
|
192 |
+
*/
|
193 |
+
public static function is_initialized( $function_name = null ) {
|
194 |
+
if ( ! self::$data_store_initialized && ! empty( $function_name ) ) {
|
195 |
+
$message = sprintf( __( '%s() was called before the Action Scheduler data store was initialized', 'action-scheduler' ), esc_attr( $function_name ) );
|
196 |
+
error_log( $message, E_WARNING );
|
197 |
+
}
|
198 |
+
|
199 |
+
return self::$data_store_initialized;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Determine if the class is one of our abstract classes.
|
204 |
+
*
|
205 |
+
* @since 3.0.0
|
206 |
+
*
|
207 |
+
* @param string $class The class name.
|
208 |
+
*
|
209 |
+
* @return bool
|
210 |
+
*/
|
211 |
+
protected static function is_class_abstract( $class ) {
|
212 |
+
static $abstracts = array(
|
213 |
+
'ActionScheduler' => true,
|
214 |
+
'ActionScheduler_Abstract_ListTable' => true,
|
215 |
+
'ActionScheduler_Abstract_QueueRunner' => true,
|
216 |
+
'ActionScheduler_Abstract_Schedule' => true,
|
217 |
+
'ActionScheduler_Abstract_RecurringSchedule' => true,
|
218 |
+
'ActionScheduler_Lock' => true,
|
219 |
+
'ActionScheduler_Logger' => true,
|
220 |
+
'ActionScheduler_Abstract_Schema' => true,
|
221 |
+
'ActionScheduler_Store' => true,
|
222 |
+
'ActionScheduler_TimezoneHelper' => true,
|
223 |
+
);
|
224 |
+
|
225 |
+
return isset( $abstracts[ $class ] ) && $abstracts[ $class ];
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Determine if the class is one of our migration classes.
|
230 |
+
*
|
231 |
+
* @since 3.0.0
|
232 |
+
*
|
233 |
+
* @param string $class The class name.
|
234 |
+
*
|
235 |
+
* @return bool
|
236 |
+
*/
|
237 |
+
protected static function is_class_migration( $class ) {
|
238 |
+
static $migration_segments = array(
|
239 |
+
'ActionMigrator' => true,
|
240 |
+
'BatchFetcher' => true,
|
241 |
+
'DBStoreMigrator' => true,
|
242 |
+
'DryRun' => true,
|
243 |
+
'LogMigrator' => true,
|
244 |
+
'Config' => true,
|
245 |
+
'Controller' => true,
|
246 |
+
'Runner' => true,
|
247 |
+
'Scheduler' => true,
|
248 |
+
);
|
249 |
+
|
250 |
+
$segments = explode( '_', $class );
|
251 |
+
$segment = isset( $segments[ 1 ] ) ? $segments[ 1 ] : $class;
|
252 |
+
|
253 |
+
return isset( $migration_segments[ $segment ] ) && $migration_segments[ $segment ];
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Determine if the class is one of our WP CLI classes.
|
258 |
+
*
|
259 |
+
* @since 3.0.0
|
260 |
+
*
|
261 |
+
* @param string $class The class name.
|
262 |
+
*
|
263 |
+
* @return bool
|
264 |
+
*/
|
265 |
+
protected static function is_class_cli( $class ) {
|
266 |
+
static $cli_segments = array(
|
267 |
+
'QueueRunner' => true,
|
268 |
+
'Command' => true,
|
269 |
+
'ProgressBar' => true,
|
270 |
+
);
|
271 |
+
|
272 |
+
$segments = explode( '_', $class );
|
273 |
+
$segment = isset( $segments[ 1 ] ) ? $segments[ 1 ] : $class;
|
274 |
+
|
275 |
+
return isset( $cli_segments[ $segment ] ) && $cli_segments[ $segment ];
|
276 |
+
}
|
277 |
+
|
278 |
+
final public function __clone() {
|
279 |
+
trigger_error("Singleton. No cloning allowed!", E_USER_ERROR);
|
280 |
+
}
|
281 |
+
|
282 |
+
final public function __wakeup() {
|
283 |
+
trigger_error("Singleton. No serialization allowed!", E_USER_ERROR);
|
284 |
+
}
|
285 |
+
|
286 |
+
final private function __construct() {}
|
287 |
+
|
288 |
+
/** Deprecated **/
|
289 |
+
|
290 |
+
public static function get_datetime_object( $when = null, $timezone = 'UTC' ) {
|
291 |
+
_deprecated_function( __METHOD__, '2.0', 'wcs_add_months()' );
|
292 |
+
return as_get_datetime_object( $when, $timezone );
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Issue deprecated warning if an Action Scheduler function is called in the shutdown hook.
|
297 |
+
*
|
298 |
+
* @param string $function_name The name of the function being called.
|
299 |
+
* @deprecated 3.1.6.
|
300 |
+
*/
|
301 |
+
public static function check_shutdown_hook( $function_name ) {
|
302 |
+
_deprecated_function( __FUNCTION__, '3.1.6' );
|
303 |
+
}
|
304 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php
ADDED
@@ -0,0 +1,766 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
4 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Action Scheduler Abstract List Table class
|
9 |
+
*
|
10 |
+
* This abstract class enhances WP_List_Table making it ready to use.
|
11 |
+
*
|
12 |
+
* By extending this class we can focus on describing how our table looks like,
|
13 |
+
* which columns needs to be shown, filter, ordered by and more and forget about the details.
|
14 |
+
*
|
15 |
+
* This class supports:
|
16 |
+
* - Bulk actions
|
17 |
+
* - Search
|
18 |
+
* - Sortable columns
|
19 |
+
* - Automatic translations of the columns
|
20 |
+
*
|
21 |
+
* @codeCoverageIgnore
|
22 |
+
* @since 2.0.0
|
23 |
+
*/
|
24 |
+
abstract class ActionScheduler_Abstract_ListTable extends WP_List_Table {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The table name
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $table_name;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Package name, used to get options from WP_List_Table::get_items_per_page.
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $package;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* How many items do we render per page?
|
42 |
+
*
|
43 |
+
* @var int
|
44 |
+
*/
|
45 |
+
protected $items_per_page = 10;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Enables search in this table listing. If this array
|
49 |
+
* is empty it means the listing is not searchable.
|
50 |
+
*
|
51 |
+
* @var array
|
52 |
+
*/
|
53 |
+
protected $search_by = array();
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Columns to show in the table listing. It is a key => value pair. The
|
57 |
+
* key must much the table column name and the value is the label, which is
|
58 |
+
* automatically translated.
|
59 |
+
*
|
60 |
+
* @var array
|
61 |
+
*/
|
62 |
+
protected $columns = array();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Defines the row-actions. It expects an array where the key
|
66 |
+
* is the column name and the value is an array of actions.
|
67 |
+
*
|
68 |
+
* The array of actions are key => value, where key is the method name
|
69 |
+
* (with the prefix row_action_<key>) and the value is the label
|
70 |
+
* and title.
|
71 |
+
*
|
72 |
+
* @var array
|
73 |
+
*/
|
74 |
+
protected $row_actions = array();
|
75 |
+
|
76 |
+
/**
|
77 |
+
* The Primary key of our table
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $ID = 'ID';
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Enables sorting, it expects an array
|
85 |
+
* of columns (the column names are the values)
|
86 |
+
*
|
87 |
+
* @var array
|
88 |
+
*/
|
89 |
+
protected $sort_by = array();
|
90 |
+
|
91 |
+
/**
|
92 |
+
* The default sort order
|
93 |
+
*
|
94 |
+
* @var string
|
95 |
+
*/
|
96 |
+
protected $filter_by = array();
|
97 |
+
|
98 |
+
/**
|
99 |
+
* The status name => count combinations for this table's items. Used to display status filters.
|
100 |
+
*
|
101 |
+
* @var array
|
102 |
+
*/
|
103 |
+
protected $status_counts = array();
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Notices to display when loading the table. Array of arrays of form array( 'class' => {updated|error}, 'message' => 'This is the notice text display.' ).
|
107 |
+
*
|
108 |
+
* @var array
|
109 |
+
*/
|
110 |
+
protected $admin_notices = array();
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Localised string displayed in the <h1> element above the able.
|
114 |
+
*
|
115 |
+
* @var string
|
116 |
+
*/
|
117 |
+
protected $table_header;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Enables bulk actions. It must be an array where the key is the action name
|
121 |
+
* and the value is the label (which is translated automatically). It is important
|
122 |
+
* to notice that it will check that the method exists (`bulk_$name`) and will throw
|
123 |
+
* an exception if it does not exists.
|
124 |
+
*
|
125 |
+
* This class will automatically check if the current request has a bulk action, will do the
|
126 |
+
* validations and afterwards will execute the bulk method, with two arguments. The first argument
|
127 |
+
* is the array with primary keys, the second argument is a string with a list of the primary keys,
|
128 |
+
* escaped and ready to use (with `IN`).
|
129 |
+
*
|
130 |
+
* @var array
|
131 |
+
*/
|
132 |
+
protected $bulk_actions = array();
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Makes translation easier, it basically just wraps
|
136 |
+
* `_x` with some default (the package name).
|
137 |
+
*
|
138 |
+
* @param string $text The new text to translate.
|
139 |
+
* @param string $context The context of the text.
|
140 |
+
* @return string|void The translated text.
|
141 |
+
*
|
142 |
+
* @deprecated 3.0.0 Use `_x()` instead.
|
143 |
+
*/
|
144 |
+
protected function translate( $text, $context = '' ) {
|
145 |
+
return $text;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Reads `$this->bulk_actions` and returns an array that WP_List_Table understands. It
|
150 |
+
* also validates that the bulk method handler exists. It throws an exception because
|
151 |
+
* this is a library meant for developers and missing a bulk method is a development-time error.
|
152 |
+
*
|
153 |
+
* @return array
|
154 |
+
*
|
155 |
+
* @throws RuntimeException Throws RuntimeException when the bulk action does not have a callback method.
|
156 |
+
*/
|
157 |
+
protected function get_bulk_actions() {
|
158 |
+
$actions = array();
|
159 |
+
|
160 |
+
foreach ( $this->bulk_actions as $action => $label ) {
|
161 |
+
if ( ! is_callable( array( $this, 'bulk_' . $action ) ) ) {
|
162 |
+
throw new RuntimeException( "The bulk action $action does not have a callback method" );
|
163 |
+
}
|
164 |
+
|
165 |
+
$actions[ $action ] = $label;
|
166 |
+
}
|
167 |
+
|
168 |
+
return $actions;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Checks if the current request has a bulk action. If that is the case it will validate and will
|
173 |
+
* execute the bulk method handler. Regardless if the action is valid or not it will redirect to
|
174 |
+
* the previous page removing the current arguments that makes this request a bulk action.
|
175 |
+
*/
|
176 |
+
protected function process_bulk_action() {
|
177 |
+
global $wpdb;
|
178 |
+
// Detect when a bulk action is being triggered.
|
179 |
+
$action = $this->current_action();
|
180 |
+
if ( ! $action ) {
|
181 |
+
return;
|
182 |
+
}
|
183 |
+
|
184 |
+
check_admin_referer( 'bulk-' . $this->_args['plural'] );
|
185 |
+
|
186 |
+
$method = 'bulk_' . $action;
|
187 |
+
if ( array_key_exists( $action, $this->bulk_actions ) && is_callable( array( $this, $method ) ) && ! empty( $_GET['ID'] ) && is_array( $_GET['ID'] ) ) {
|
188 |
+
$ids_sql = '(' . implode( ',', array_fill( 0, count( $_GET['ID'] ), '%s' ) ) . ')';
|
189 |
+
$id = array_map( 'absint', $_GET['ID'] );
|
190 |
+
$this->$method( $id, $wpdb->prepare( $ids_sql, $id ) ); //phpcs:ignore WordPress.DB.PreparedSQL
|
191 |
+
}
|
192 |
+
|
193 |
+
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
|
194 |
+
wp_safe_redirect(
|
195 |
+
remove_query_arg(
|
196 |
+
array( '_wp_http_referer', '_wpnonce', 'ID', 'action', 'action2' ),
|
197 |
+
esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) )
|
198 |
+
)
|
199 |
+
);
|
200 |
+
exit;
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Default code for deleting entries.
|
206 |
+
* validated already by process_bulk_action()
|
207 |
+
*
|
208 |
+
* @param array $ids ids of the items to delete.
|
209 |
+
* @param string $ids_sql the sql for the ids.
|
210 |
+
* @return void
|
211 |
+
*/
|
212 |
+
protected function bulk_delete( array $ids, $ids_sql ) {
|
213 |
+
$store = ActionScheduler::store();
|
214 |
+
foreach ( $ids as $action_id ) {
|
215 |
+
$store->delete( $action_id );
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Prepares the _column_headers property which is used by WP_Table_List at rendering.
|
221 |
+
* It merges the columns and the sortable columns.
|
222 |
+
*/
|
223 |
+
protected function prepare_column_headers() {
|
224 |
+
$this->_column_headers = array(
|
225 |
+
$this->get_columns(),
|
226 |
+
get_hidden_columns( $this->screen ),
|
227 |
+
$this->get_sortable_columns(),
|
228 |
+
);
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Reads $this->sort_by and returns the columns name in a format that WP_Table_List
|
233 |
+
* expects
|
234 |
+
*/
|
235 |
+
public function get_sortable_columns() {
|
236 |
+
$sort_by = array();
|
237 |
+
foreach ( $this->sort_by as $column ) {
|
238 |
+
$sort_by[ $column ] = array( $column, true );
|
239 |
+
}
|
240 |
+
return $sort_by;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Returns the columns names for rendering. It adds a checkbox for selecting everything
|
245 |
+
* as the first column
|
246 |
+
*/
|
247 |
+
public function get_columns() {
|
248 |
+
$columns = array_merge(
|
249 |
+
array( 'cb' => '<input type="checkbox" />' ),
|
250 |
+
$this->columns
|
251 |
+
);
|
252 |
+
|
253 |
+
return $columns;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Get prepared LIMIT clause for items query
|
258 |
+
*
|
259 |
+
* @global wpdb $wpdb
|
260 |
+
*
|
261 |
+
* @return string Prepared LIMIT clause for items query.
|
262 |
+
*/
|
263 |
+
protected function get_items_query_limit() {
|
264 |
+
global $wpdb;
|
265 |
+
|
266 |
+
$per_page = $this->get_items_per_page( $this->get_per_page_option_name(), $this->items_per_page );
|
267 |
+
return $wpdb->prepare( 'LIMIT %d', $per_page );
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Returns the number of items to offset/skip for this current view.
|
272 |
+
*
|
273 |
+
* @return int
|
274 |
+
*/
|
275 |
+
protected function get_items_offset() {
|
276 |
+
$per_page = $this->get_items_per_page( $this->get_per_page_option_name(), $this->items_per_page );
|
277 |
+
$current_page = $this->get_pagenum();
|
278 |
+
if ( 1 < $current_page ) {
|
279 |
+
$offset = $per_page * ( $current_page - 1 );
|
280 |
+
} else {
|
281 |
+
$offset = 0;
|
282 |
+
}
|
283 |
+
|
284 |
+
return $offset;
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Get prepared OFFSET clause for items query
|
289 |
+
*
|
290 |
+
* @global wpdb $wpdb
|
291 |
+
*
|
292 |
+
* @return string Prepared OFFSET clause for items query.
|
293 |
+
*/
|
294 |
+
protected function get_items_query_offset() {
|
295 |
+
global $wpdb;
|
296 |
+
|
297 |
+
return $wpdb->prepare( 'OFFSET %d', $this->get_items_offset() );
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Prepares the ORDER BY sql statement. It uses `$this->sort_by` to know which
|
302 |
+
* columns are sortable. This requests validates the orderby $_GET parameter is a valid
|
303 |
+
* column and sortable. It will also use order (ASC|DESC) using DESC by default.
|
304 |
+
*/
|
305 |
+
protected function get_items_query_order() {
|
306 |
+
if ( empty( $this->sort_by ) ) {
|
307 |
+
return '';
|
308 |
+
}
|
309 |
+
|
310 |
+
$orderby = esc_sql( $this->get_request_orderby() );
|
311 |
+
$order = esc_sql( $this->get_request_order() );
|
312 |
+
|
313 |
+
return "ORDER BY {$orderby} {$order}";
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Return the sortable column specified for this request to order the results by, if any.
|
318 |
+
*
|
319 |
+
* @return string
|
320 |
+
*/
|
321 |
+
protected function get_request_orderby() {
|
322 |
+
|
323 |
+
$valid_sortable_columns = array_values( $this->sort_by );
|
324 |
+
|
325 |
+
if ( ! empty( $_GET['orderby'] ) && in_array( $_GET['orderby'], $valid_sortable_columns, true ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
326 |
+
$orderby = sanitize_text_field( wp_unslash( $_GET['orderby'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
327 |
+
} else {
|
328 |
+
$orderby = $valid_sortable_columns[0];
|
329 |
+
}
|
330 |
+
|
331 |
+
return $orderby;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Return the sortable column order specified for this request.
|
336 |
+
*
|
337 |
+
* @return string
|
338 |
+
*/
|
339 |
+
protected function get_request_order() {
|
340 |
+
|
341 |
+
if ( ! empty( $_GET['order'] ) && 'desc' === strtolower( sanitize_text_field( wp_unslash( $_GET['order'] ) ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
342 |
+
$order = 'DESC';
|
343 |
+
} else {
|
344 |
+
$order = 'ASC';
|
345 |
+
}
|
346 |
+
|
347 |
+
return $order;
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Return the status filter for this request, if any.
|
352 |
+
*
|
353 |
+
* @return string
|
354 |
+
*/
|
355 |
+
protected function get_request_status() {
|
356 |
+
$status = ( ! empty( $_GET['status'] ) ) ? sanitize_text_field( wp_unslash( $_GET['status'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
357 |
+
return $status;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Return the search filter for this request, if any.
|
362 |
+
*
|
363 |
+
* @return string
|
364 |
+
*/
|
365 |
+
protected function get_request_search_query() {
|
366 |
+
$search_query = ( ! empty( $_GET['s'] ) ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
367 |
+
return $search_query;
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Process and return the columns name. This is meant for using with SQL, this means it
|
372 |
+
* always includes the primary key.
|
373 |
+
*
|
374 |
+
* @return array
|
375 |
+
*/
|
376 |
+
protected function get_table_columns() {
|
377 |
+
$columns = array_keys( $this->columns );
|
378 |
+
if ( ! in_array( $this->ID, $columns, true ) ) {
|
379 |
+
$columns[] = $this->ID;
|
380 |
+
}
|
381 |
+
|
382 |
+
return $columns;
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Check if the current request is doing a "full text" search. If that is the case
|
387 |
+
* prepares the SQL to search texts using LIKE.
|
388 |
+
*
|
389 |
+
* If the current request does not have any search or if this list table does not support
|
390 |
+
* that feature it will return an empty string.
|
391 |
+
*
|
392 |
+
* @return string
|
393 |
+
*/
|
394 |
+
protected function get_items_query_search() {
|
395 |
+
global $wpdb;
|
396 |
+
|
397 |
+
if ( empty( $_GET['s'] ) || empty( $this->search_by ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
398 |
+
return '';
|
399 |
+
}
|
400 |
+
|
401 |
+
$search_string = sanitize_text_field( wp_unslash( $_GET['s'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
402 |
+
|
403 |
+
$filter = array();
|
404 |
+
foreach ( $this->search_by as $column ) {
|
405 |
+
$wild = '%';
|
406 |
+
$sql_like = $wild . $wpdb->esc_like( $search_string ) . $wild;
|
407 |
+
$filter[] = $wpdb->prepare( '`' . $column . '` LIKE %s', $sql_like ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.DB.PreparedSQL.NotPrepared
|
408 |
+
}
|
409 |
+
return implode( ' OR ', $filter );
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Prepares the SQL to filter rows by the options defined at `$this->filter_by`. Before trusting
|
414 |
+
* any data sent by the user it validates that it is a valid option.
|
415 |
+
*/
|
416 |
+
protected function get_items_query_filters() {
|
417 |
+
global $wpdb;
|
418 |
+
|
419 |
+
if ( ! $this->filter_by || empty( $_GET['filter_by'] ) || ! is_array( $_GET['filter_by'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
420 |
+
return '';
|
421 |
+
}
|
422 |
+
|
423 |
+
$filter = array();
|
424 |
+
|
425 |
+
foreach ( $this->filter_by as $column => $options ) {
|
426 |
+
if ( empty( $_GET['filter_by'][ $column ] ) || empty( $options[ $_GET['filter_by'][ $column ] ] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
427 |
+
continue;
|
428 |
+
}
|
429 |
+
|
430 |
+
$filter[] = $wpdb->prepare( "`$column` = %s", sanitize_text_field( wp_unslash( $_GET['filter_by'][ $column ] ) ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
431 |
+
}
|
432 |
+
|
433 |
+
return implode( ' AND ', $filter );
|
434 |
+
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Prepares the data to feed WP_Table_List.
|
439 |
+
*
|
440 |
+
* This has the core for selecting, sorting and filting data. To keep the code simple
|
441 |
+
* its logic is split among many methods (get_items_query_*).
|
442 |
+
*
|
443 |
+
* Beside populating the items this function will also count all the records that matches
|
444 |
+
* the filtering criteria and will do fill the pagination variables.
|
445 |
+
*/
|
446 |
+
public function prepare_items() {
|
447 |
+
global $wpdb;
|
448 |
+
|
449 |
+
$this->process_bulk_action();
|
450 |
+
|
451 |
+
$this->process_row_actions();
|
452 |
+
|
453 |
+
if ( ! empty( $_REQUEST['_wp_http_referer'] && ! empty( $_SERVER['REQUEST_URI'] ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
454 |
+
// _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter
|
455 |
+
wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
|
456 |
+
exit;
|
457 |
+
}
|
458 |
+
|
459 |
+
$this->prepare_column_headers();
|
460 |
+
|
461 |
+
$limit = $this->get_items_query_limit();
|
462 |
+
$offset = $this->get_items_query_offset();
|
463 |
+
$order = $this->get_items_query_order();
|
464 |
+
$where = array_filter(
|
465 |
+
array(
|
466 |
+
$this->get_items_query_search(),
|
467 |
+
$this->get_items_query_filters(),
|
468 |
+
)
|
469 |
+
);
|
470 |
+
$columns = '`' . implode( '`, `', $this->get_table_columns() ) . '`';
|
471 |
+
|
472 |
+
if ( ! empty( $where ) ) {
|
473 |
+
$where = 'WHERE (' . implode( ') AND (', $where ) . ')';
|
474 |
+
} else {
|
475 |
+
$where = '';
|
476 |
+
}
|
477 |
+
|
478 |
+
$sql = "SELECT $columns FROM {$this->table_name} {$where} {$order} {$limit} {$offset}";
|
479 |
+
|
480 |
+
$this->set_items( $wpdb->get_results( $sql, ARRAY_A ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
481 |
+
|
482 |
+
$query_count = "SELECT COUNT({$this->ID}) FROM {$this->table_name} {$where}";
|
483 |
+
$total_items = $wpdb->get_var( $query_count ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
484 |
+
$per_page = $this->get_items_per_page( $this->get_per_page_option_name(), $this->items_per_page );
|
485 |
+
$this->set_pagination_args(
|
486 |
+
array(
|
487 |
+
'total_items' => $total_items,
|
488 |
+
'per_page' => $per_page,
|
489 |
+
'total_pages' => ceil( $total_items / $per_page ),
|
490 |
+
)
|
491 |
+
);
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Display the table.
|
496 |
+
*
|
497 |
+
* @param string $which The name of the table.
|
498 |
+
*/
|
499 |
+
public function extra_tablenav( $which ) {
|
500 |
+
if ( ! $this->filter_by || 'top' !== $which ) {
|
501 |
+
return;
|
502 |
+
}
|
503 |
+
|
504 |
+
echo '<div class="alignleft actions">';
|
505 |
+
|
506 |
+
foreach ( $this->filter_by as $id => $options ) {
|
507 |
+
$default = ! empty( $_GET['filter_by'][ $id ] ) ? sanitize_text_field( wp_unslash( $_GET['filter_by'][ $id ] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
508 |
+
if ( empty( $options[ $default ] ) ) {
|
509 |
+
$default = '';
|
510 |
+
}
|
511 |
+
|
512 |
+
echo '<select name="filter_by[' . esc_attr( $id ) . ']" class="first" id="filter-by-' . esc_attr( $id ) . '">';
|
513 |
+
|
514 |
+
foreach ( $options as $value => $label ) {
|
515 |
+
echo '<option value="' . esc_attr( $value ) . '" ' . esc_html( $value === $default ? 'selected' : '' ) . '>'
|
516 |
+
. esc_html( $label )
|
517 |
+
. '</option>';
|
518 |
+
}
|
519 |
+
|
520 |
+
echo '</select>';
|
521 |
+
}
|
522 |
+
|
523 |
+
submit_button( esc_html__( 'Filter', 'action-scheduler' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
524 |
+
echo '</div>';
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Set the data for displaying. It will attempt to unserialize (There is a chance that some columns
|
529 |
+
* are serialized). This can be override in child classes for futher data transformation.
|
530 |
+
*
|
531 |
+
* @param array $items Items array.
|
532 |
+
*/
|
533 |
+
protected function set_items( array $items ) {
|
534 |
+
$this->items = array();
|
535 |
+
foreach ( $items as $item ) {
|
536 |
+
$this->items[ $item[ $this->ID ] ] = array_map( 'maybe_unserialize', $item );
|
537 |
+
}
|
538 |
+
}
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Renders the checkbox for each row, this is the first column and it is named ID regardless
|
542 |
+
* of how the primary key is named (to keep the code simpler). The bulk actions will do the proper
|
543 |
+
* name transformation though using `$this->ID`.
|
544 |
+
*
|
545 |
+
* @param array $row The row to render.
|
546 |
+
*/
|
547 |
+
public function column_cb( $row ) {
|
548 |
+
return '<input name="ID[]" type="checkbox" value="' . esc_attr( $row[ $this->ID ] ) . '" />';
|
549 |
+
}
|
550 |
+
|
551 |
+
/**
|
552 |
+
* Renders the row-actions.
|
553 |
+
*
|
554 |
+
* This method renders the action menu, it reads the definition from the $row_actions property,
|
555 |
+
* and it checks that the row action method exists before rendering it.
|
556 |
+
*
|
557 |
+
* @param array $row Row to be rendered.
|
558 |
+
* @param string $column_name Column name.
|
559 |
+
* @return string
|
560 |
+
*/
|
561 |
+
protected function maybe_render_actions( $row, $column_name ) {
|
562 |
+
if ( empty( $this->row_actions[ $column_name ] ) ) {
|
563 |
+
return;
|
564 |
+
}
|
565 |
+
|
566 |
+
$row_id = $row[ $this->ID ];
|
567 |
+
|
568 |
+
$actions = '<div class="row-actions">';
|
569 |
+
$action_count = 0;
|
570 |
+
foreach ( $this->row_actions[ $column_name ] as $action_key => $action ) {
|
571 |
+
|
572 |
+
$action_count++;
|
573 |
+
|
574 |
+
if ( ! method_exists( $this, 'row_action_' . $action_key ) ) {
|
575 |
+
continue;
|
576 |
+
}
|
577 |
+
|
578 |
+
$action_link = ! empty( $action['link'] ) ? $action['link'] : add_query_arg(
|
579 |
+
array(
|
580 |
+
'row_action' => $action_key,
|
581 |
+
'row_id' => $row_id,
|
582 |
+
'nonce' => wp_create_nonce( $action_key . '::' . $row_id ),
|
583 |
+
)
|
584 |
+
);
|
585 |
+
$span_class = ! empty( $action['class'] ) ? $action['class'] : $action_key;
|
586 |
+
$separator = ( $action_count < count( $this->row_actions[ $column_name ] ) ) ? ' | ' : '';
|
587 |
+
|
588 |
+
$actions .= sprintf( '<span class="%s">', esc_attr( $span_class ) );
|
589 |
+
$actions .= sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', esc_url( $action_link ), esc_attr( $action['desc'] ), esc_html( $action['name'] ) );
|
590 |
+
$actions .= sprintf( '%s</span>', $separator );
|
591 |
+
}
|
592 |
+
$actions .= '</div>';
|
593 |
+
return $actions;
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Process the bulk actions.
|
598 |
+
*
|
599 |
+
* @return void
|
600 |
+
*/
|
601 |
+
protected function process_row_actions() {
|
602 |
+
$parameters = array( 'row_action', 'row_id', 'nonce' );
|
603 |
+
foreach ( $parameters as $parameter ) {
|
604 |
+
if ( empty( $_REQUEST[ $parameter ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
605 |
+
return;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
|
609 |
+
$action = sanitize_text_field( wp_unslash( $_REQUEST['row_action'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated
|
610 |
+
$row_id = sanitize_text_field( wp_unslash( $_REQUEST['row_id'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated
|
611 |
+
$nonce = sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated
|
612 |
+
$method = 'row_action_' . $action; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
613 |
+
|
614 |
+
if ( wp_verify_nonce( $nonce, $action . '::' . $row_id ) && method_exists( $this, $method ) ) {
|
615 |
+
$this->$method( sanitize_text_field( wp_unslash( $row_id ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
616 |
+
}
|
617 |
+
|
618 |
+
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
|
619 |
+
wp_safe_redirect(
|
620 |
+
remove_query_arg(
|
621 |
+
array( 'row_id', 'row_action', 'nonce' ),
|
622 |
+
esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) )
|
623 |
+
)
|
624 |
+
);
|
625 |
+
exit;
|
626 |
+
}
|
627 |
+
}
|
628 |
+
|
629 |
+
/**
|
630 |
+
* Default column formatting, it will escape everythig for security.
|
631 |
+
*
|
632 |
+
* @param array $item The item array.
|
633 |
+
* @param string $column_name Column name to display.
|
634 |
+
*
|
635 |
+
* @return string
|
636 |
+
*/
|
637 |
+
public function column_default( $item, $column_name ) {
|
638 |
+
$column_html = esc_html( $item[ $column_name ] );
|
639 |
+
$column_html .= $this->maybe_render_actions( $item, $column_name );
|
640 |
+
return $column_html;
|
641 |
+
}
|
642 |
+
|
643 |
+
/**
|
644 |
+
* Display the table heading and search query, if any
|
645 |
+
*/
|
646 |
+
protected function display_header() {
|
647 |
+
echo '<h1 class="wp-heading-inline">' . esc_attr( $this->table_header ) . '</h1>';
|
648 |
+
if ( $this->get_request_search_query() ) {
|
649 |
+
/* translators: %s: search query */
|
650 |
+
echo '<span class="subtitle">' . esc_attr( sprintf( __( 'Search results for "%s"', 'action-scheduler' ), $this->get_request_search_query() ) ) . '</span>';
|
651 |
+
}
|
652 |
+
echo '<hr class="wp-header-end">';
|
653 |
+
}
|
654 |
+
|
655 |
+
/**
|
656 |
+
* Display the table heading and search query, if any
|
657 |
+
*/
|
658 |
+
protected function display_admin_notices() {
|
659 |
+
foreach ( $this->admin_notices as $notice ) {
|
660 |
+
echo '<div id="message" class="' . esc_attr( $notice['class'] ) . '">';
|
661 |
+
echo ' <p>' . wp_kses_post( $notice['message'] ) . '</p>';
|
662 |
+
echo '</div>';
|
663 |
+
}
|
664 |
+
}
|
665 |
+
|
666 |
+
/**
|
667 |
+
* Prints the available statuses so the user can click to filter.
|
668 |
+
*/
|
669 |
+
protected function display_filter_by_status() {
|
670 |
+
|
671 |
+
$status_list_items = array();
|
672 |
+
$request_status = $this->get_request_status();
|
673 |
+
|
674 |
+
// Helper to set 'all' filter when not set on status counts passed in.
|
675 |
+
if ( ! isset( $this->status_counts['all'] ) ) {
|
676 |
+
$this->status_counts = array( 'all' => array_sum( $this->status_counts ) ) + $this->status_counts;
|
677 |
+
}
|
678 |
+
|
679 |
+
foreach ( $this->status_counts as $status_name => $count ) {
|
680 |
+
|
681 |
+
if ( 0 === $count ) {
|
682 |
+
continue;
|
683 |
+
}
|
684 |
+
|
685 |
+
if ( $status_name === $request_status || ( empty( $request_status ) && 'all' === $status_name ) ) {
|
686 |
+
$status_list_item = '<li class="%1$s"><a href="%2$s" class="current">%3$s</a> (%4$d)</li>';
|
687 |
+
} else {
|
688 |
+
$status_list_item = '<li class="%1$s"><a href="%2$s">%3$s</a> (%4$d)</li>';
|
689 |
+
}
|
690 |
+
|
691 |
+
$status_filter_url = ( 'all' === $status_name ) ? remove_query_arg( 'status' ) : add_query_arg( 'status', $status_name );
|
692 |
+
$status_filter_url = remove_query_arg( array( 'paged', 's' ), $status_filter_url );
|
693 |
+
$status_list_items[] = sprintf( $status_list_item, esc_attr( $status_name ), esc_url( $status_filter_url ), esc_html( ucfirst( $status_name ) ), absint( $count ) );
|
694 |
+
}
|
695 |
+
|
696 |
+
if ( $status_list_items ) {
|
697 |
+
echo '<ul class="subsubsub">';
|
698 |
+
echo implode( " | \n", $status_list_items ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
699 |
+
echo '</ul>';
|
700 |
+
}
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* Renders the table list, we override the original class to render the table inside a form
|
705 |
+
* and to render any needed HTML (like the search box). By doing so the callee of a function can simple
|
706 |
+
* forget about any extra HTML.
|
707 |
+
*/
|
708 |
+
protected function display_table() {
|
709 |
+
echo '<form id="' . esc_attr( $this->_args['plural'] ) . '-filter" method="get">';
|
710 |
+
foreach ( $_GET as $key => $value ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
711 |
+
if ( '_' === $key[0] || 'paged' === $key || 'ID' === $key ) {
|
712 |
+
continue;
|
713 |
+
}
|
714 |
+
echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value ) . '" />';
|
715 |
+
}
|
716 |
+
if ( ! empty( $this->search_by ) ) {
|
717 |
+
echo $this->search_box( $this->get_search_box_button_text(), 'plugin' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
718 |
+
}
|
719 |
+
parent::display();
|
720 |
+
echo '</form>';
|
721 |
+
}
|
722 |
+
|
723 |
+
/**
|
724 |
+
* Process any pending actions.
|
725 |
+
*/
|
726 |
+
public function process_actions() {
|
727 |
+
$this->process_bulk_action();
|
728 |
+
$this->process_row_actions();
|
729 |
+
|
730 |
+
if ( ! empty( $_REQUEST['_wp_http_referer'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
731 |
+
// _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter
|
732 |
+
wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
|
733 |
+
exit;
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Render the list table page, including header, notices, status filters and table.
|
739 |
+
*/
|
740 |
+
public function display_page() {
|
741 |
+
$this->prepare_items();
|
742 |
+
|
743 |
+
echo '<div class="wrap">';
|
744 |
+
$this->display_header();
|
745 |
+
$this->display_admin_notices();
|
746 |
+
$this->display_filter_by_status();
|
747 |
+
$this->display_table();
|
748 |
+
echo '</div>';
|
749 |
+
}
|
750 |
+
|
751 |
+
/**
|
752 |
+
* Get the text to display in the search box on the list table.
|
753 |
+
*/
|
754 |
+
protected function get_search_box_placeholder() {
|
755 |
+
return esc_html__( 'Search', 'action-scheduler' );
|
756 |
+
}
|
757 |
+
|
758 |
+
/**
|
759 |
+
* Gets the screen per_page option name.
|
760 |
+
*
|
761 |
+
* @return string
|
762 |
+
*/
|
763 |
+
protected function get_per_page_option_name() {
|
764 |
+
return $this->package . '_items_per_page';
|
765 |
+
}
|
766 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract class with common Queue Cleaner functionality.
|
5 |
+
*/
|
6 |
+
abstract class ActionScheduler_Abstract_QueueRunner extends ActionScheduler_Abstract_QueueRunner_Deprecated {
|
7 |
+
|
8 |
+
/** @var ActionScheduler_QueueCleaner */
|
9 |
+
protected $cleaner;
|
10 |
+
|
11 |
+
/** @var ActionScheduler_FatalErrorMonitor */
|
12 |
+
protected $monitor;
|
13 |
+
|
14 |
+
/** @var ActionScheduler_Store */
|
15 |
+
protected $store;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The created time.
|
19 |
+
*
|
20 |
+
* Represents when the queue runner was constructed and used when calculating how long a PHP request has been running.
|
21 |
+
* For this reason it should be as close as possible to the PHP request start time.
|
22 |
+
*
|
23 |
+
* @var int
|
24 |
+
*/
|
25 |
+
private $created_time;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* ActionScheduler_Abstract_QueueRunner constructor.
|
29 |
+
*
|
30 |
+
* @param ActionScheduler_Store $store
|
31 |
+
* @param ActionScheduler_FatalErrorMonitor $monitor
|
32 |
+
* @param ActionScheduler_QueueCleaner $cleaner
|
33 |
+
*/
|
34 |
+
public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null ) {
|
35 |
+
|
36 |
+
$this->created_time = microtime( true );
|
37 |
+
|
38 |
+
$this->store = $store ? $store : ActionScheduler_Store::instance();
|
39 |
+
$this->monitor = $monitor ? $monitor : new ActionScheduler_FatalErrorMonitor( $this->store );
|
40 |
+
$this->cleaner = $cleaner ? $cleaner : new ActionScheduler_QueueCleaner( $this->store );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Process an individual action.
|
45 |
+
*
|
46 |
+
* @param int $action_id The action ID to process.
|
47 |
+
* @param string $context Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron'
|
48 |
+
* Generally, this should be capitalised and not localised as it's a proper noun.
|
49 |
+
*/
|
50 |
+
public function process_action( $action_id, $context = '' ) {
|
51 |
+
try {
|
52 |
+
$valid_action = false;
|
53 |
+
do_action( 'action_scheduler_before_execute', $action_id, $context );
|
54 |
+
|
55 |
+
if ( ActionScheduler_Store::STATUS_PENDING !== $this->store->get_status( $action_id ) ) {
|
56 |
+
do_action( 'action_scheduler_execution_ignored', $action_id, $context );
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$valid_action = true;
|
61 |
+
do_action( 'action_scheduler_begin_execute', $action_id, $context );
|
62 |
+
|
63 |
+
$action = $this->store->fetch_action( $action_id );
|
64 |
+
$this->store->log_execution( $action_id );
|
65 |
+
$action->execute();
|
66 |
+
do_action( 'action_scheduler_after_execute', $action_id, $action, $context );
|
67 |
+
$this->store->mark_complete( $action_id );
|
68 |
+
} catch ( Exception $e ) {
|
69 |
+
if ( $valid_action ) {
|
70 |
+
$this->store->mark_failure( $action_id );
|
71 |
+
do_action( 'action_scheduler_failed_execution', $action_id, $e, $context );
|
72 |
+
} else {
|
73 |
+
do_action( 'action_scheduler_failed_validation', $action_id, $e, $context );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( isset( $action ) && is_a( $action, 'ActionScheduler_Action' ) && $action->get_schedule()->is_recurring() ) {
|
78 |
+
$this->schedule_next_instance( $action, $action_id );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Schedule the next instance of the action if necessary.
|
84 |
+
*
|
85 |
+
* @param ActionScheduler_Action $action
|
86 |
+
* @param int $action_id
|
87 |
+
*/
|
88 |
+
protected function schedule_next_instance( ActionScheduler_Action $action, $action_id ) {
|
89 |
+
// If a recurring action has been consistently failing, we may wish to stop rescheduling it.
|
90 |
+
if (
|
91 |
+
ActionScheduler_Store::STATUS_FAILED === $this->store->get_status( $action_id )
|
92 |
+
&& $this->recurring_action_is_consistently_failing( $action, $action_id )
|
93 |
+
) {
|
94 |
+
ActionScheduler_Logger::instance()->log(
|
95 |
+
$action_id,
|
96 |
+
__( 'This action appears to be consistently failing. A new instance will not be scheduled.', 'action-scheduler' )
|
97 |
+
);
|
98 |
+
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
|
102 |
+
try {
|
103 |
+
ActionScheduler::factory()->repeat( $action );
|
104 |
+
} catch ( Exception $e ) {
|
105 |
+
do_action( 'action_scheduler_failed_to_schedule_next_instance', $action_id, $e, $action );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Determine if the specified recurring action has been consistently failing.
|
111 |
+
*
|
112 |
+
* @param ActionScheduler_Action $action The recurring action to be rescheduled.
|
113 |
+
* @param int $action_id The ID of the recurring action.
|
114 |
+
*
|
115 |
+
* @return bool
|
116 |
+
*/
|
117 |
+
private function recurring_action_is_consistently_failing( ActionScheduler_Action $action, $action_id ) {
|
118 |
+
/**
|
119 |
+
* Controls the failure threshold for recurring actions.
|
120 |
+
*
|
121 |
+
* Before rescheduling a recurring action, we look at its status. If it failed, we then check if all of the most
|
122 |
+
* recent actions (upto the threshold set by this filter) sharing the same hook have also failed: if they have,
|
123 |
+
* that is considered consistent failure and a new instance of the action will not be scheduled.
|
124 |
+
*
|
125 |
+
* @param int $failure_threshold Number of actions of the same hook to examine for failure. Defaults to 5.
|
126 |
+
*/
|
127 |
+
$consistent_failure_threshold = (int) apply_filters( 'action_scheduler_recurring_action_failure_threshold', 5 );
|
128 |
+
|
129 |
+
// This query should find the earliest *failing* action (for the hook we are interested in) within our threshold.
|
130 |
+
$query_args = array(
|
131 |
+
'hook' => $action->get_hook(),
|
132 |
+
'status' => ActionScheduler_Store::STATUS_FAILED,
|
133 |
+
'date' => date_create( 'now', timezone_open( 'UTC' ) )->format( 'Y-m-d H:i:s' ),
|
134 |
+
'date_compare' => '<',
|
135 |
+
'per_page' => 1,
|
136 |
+
'offset' => $consistent_failure_threshold - 1
|
137 |
+
);
|
138 |
+
|
139 |
+
$first_failing_action_id = $this->store->query_actions( $query_args );
|
140 |
+
|
141 |
+
// If we didn't retrieve an action ID, then there haven't been enough failures for us to worry about.
|
142 |
+
if ( empty( $first_failing_action_id ) ) {
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
// Now let's fetch the first action (having the same hook) of *any status*ithin the same window.
|
147 |
+
unset( $query_args['status'] );
|
148 |
+
$first_action_id_with_the_same_hook = $this->store->query_actions( $query_args );
|
149 |
+
|
150 |
+
// If the IDs match, then actions for this hook must be consistently failing.
|
151 |
+
return $first_action_id_with_the_same_hook === $first_failing_action_id;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Run the queue cleaner.
|
156 |
+
*
|
157 |
+
* @author Jeremy Pry
|
158 |
+
*/
|
159 |
+
protected function run_cleanup() {
|
160 |
+
$this->cleaner->clean( 10 * $this->get_time_limit() );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Get the number of concurrent batches a runner allows.
|
165 |
+
*
|
166 |
+
* @return int
|
167 |
+
*/
|
168 |
+
public function get_allowed_concurrent_batches() {
|
169 |
+
return apply_filters( 'action_scheduler_queue_runner_concurrent_batches', 1 );
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Check if the number of allowed concurrent batches is met or exceeded.
|
174 |
+
*
|
175 |
+
* @return bool
|
176 |
+
*/
|
177 |
+
public function has_maximum_concurrent_batches() {
|
178 |
+
return $this->store->get_claim_count() >= $this->get_allowed_concurrent_batches();
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Get the maximum number of seconds a batch can run for.
|
183 |
+
*
|
184 |
+
* @return int The number of seconds.
|
185 |
+
*/
|
186 |
+
protected function get_time_limit() {
|
187 |
+
|
188 |
+
$time_limit = 30;
|
189 |
+
|
190 |
+
// Apply deprecated filter from deprecated get_maximum_execution_time() method
|
191 |
+
if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) {
|
192 |
+
_deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' );
|
193 |
+
$time_limit = apply_filters( 'action_scheduler_maximum_execution_time', $time_limit );
|
194 |
+
}
|
195 |
+
|
196 |
+
return absint( apply_filters( 'action_scheduler_queue_runner_time_limit', $time_limit ) );
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Get the number of seconds the process has been running.
|
201 |
+
*
|
202 |
+
* @return int The number of seconds.
|
203 |
+
*/
|
204 |
+
protected function get_execution_time() {
|
205 |
+
$execution_time = microtime( true ) - $this->created_time;
|
206 |
+
|
207 |
+
// Get the CPU time if the hosting environment uses it rather than wall-clock time to calculate a process's execution time.
|
208 |
+
if ( function_exists( 'getrusage' ) && apply_filters( 'action_scheduler_use_cpu_execution_time', defined( 'PANTHEON_ENVIRONMENT' ) ) ) {
|
209 |
+
$resource_usages = getrusage();
|
210 |
+
|
211 |
+
if ( isset( $resource_usages['ru_stime.tv_usec'], $resource_usages['ru_stime.tv_usec'] ) ) {
|
212 |
+
$execution_time = $resource_usages['ru_stime.tv_sec'] + ( $resource_usages['ru_stime.tv_usec'] / 1000000 );
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
return $execution_time;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Check if the host's max execution time is (likely) to be exceeded if processing more actions.
|
221 |
+
*
|
222 |
+
* @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action
|
223 |
+
* @return bool
|
224 |
+
*/
|
225 |
+
protected function time_likely_to_be_exceeded( $processed_actions ) {
|
226 |
+
|
227 |
+
$execution_time = $this->get_execution_time();
|
228 |
+
$max_execution_time = $this->get_time_limit();
|
229 |
+
$time_per_action = $execution_time / $processed_actions;
|
230 |
+
$estimated_time = $execution_time + ( $time_per_action * 3 );
|
231 |
+
$likely_to_be_exceeded = $estimated_time > $max_execution_time;
|
232 |
+
|
233 |
+
return apply_filters( 'action_scheduler_maximum_execution_time_likely_to_be_exceeded', $likely_to_be_exceeded, $this, $processed_actions, $execution_time, $max_execution_time );
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Get memory limit
|
238 |
+
*
|
239 |
+
* Based on WP_Background_Process::get_memory_limit()
|
240 |
+
*
|
241 |
+
* @return int
|
242 |
+
*/
|
243 |
+
protected function get_memory_limit() {
|
244 |
+
if ( function_exists( 'ini_get' ) ) {
|
245 |
+
$memory_limit = ini_get( 'memory_limit' );
|
246 |
+
} else {
|
247 |
+
$memory_limit = '128M'; // Sensible default, and minimum required by WooCommerce
|
248 |
+
}
|
249 |
+
|
250 |
+
if ( ! $memory_limit || -1 === $memory_limit || '-1' === $memory_limit ) {
|
251 |
+
// Unlimited, set to 32GB.
|
252 |
+
$memory_limit = '32G';
|
253 |
+
}
|
254 |
+
|
255 |
+
return ActionScheduler_Compatibility::convert_hr_to_bytes( $memory_limit );
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Memory exceeded
|
260 |
+
*
|
261 |
+
* Ensures the batch process never exceeds 90% of the maximum WordPress memory.
|
262 |
+
*
|
263 |
+
* Based on WP_Background_Process::memory_exceeded()
|
264 |
+
*
|
265 |
+
* @return bool
|
266 |
+
*/
|
267 |
+
protected function memory_exceeded() {
|
268 |
+
|
269 |
+
$memory_limit = $this->get_memory_limit() * 0.90;
|
270 |
+
$current_memory = memory_get_usage( true );
|
271 |
+
$memory_exceeded = $current_memory >= $memory_limit;
|
272 |
+
|
273 |
+
return apply_filters( 'action_scheduler_memory_exceeded', $memory_exceeded, $this );
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* See if the batch limits have been exceeded, which is when memory usage is almost at
|
278 |
+
* the maximum limit, or the time to process more actions will exceed the max time limit.
|
279 |
+
*
|
280 |
+
* Based on WC_Background_Process::batch_limits_exceeded()
|
281 |
+
*
|
282 |
+
* @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action
|
283 |
+
* @return bool
|
284 |
+
*/
|
285 |
+
protected function batch_limits_exceeded( $processed_actions ) {
|
286 |
+
return $this->memory_exceeded() || $this->time_likely_to_be_exceeded( $processed_actions );
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Process actions in the queue.
|
291 |
+
*
|
292 |
+
* @author Jeremy Pry
|
293 |
+
* @param string $context Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron'
|
294 |
+
* Generally, this should be capitalised and not localised as it's a proper noun.
|
295 |
+
* @return int The number of actions processed.
|
296 |
+
*/
|
297 |
+
abstract public function run( $context = '' );
|
298 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Abstract_RecurringSchedule
|
5 |
+
*/
|
6 |
+
abstract class ActionScheduler_Abstract_RecurringSchedule extends ActionScheduler_Abstract_Schedule {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* The date & time the first instance of this schedule was setup to run (which may not be this instance).
|
10 |
+
*
|
11 |
+
* Schedule objects are attached to an action object. Each schedule stores the run date for that
|
12 |
+
* object as the start date - @see $this->start - and logic to calculate the next run date after
|
13 |
+
* that - @see $this->calculate_next(). The $first_date property also keeps a record of when the very
|
14 |
+
* first instance of this chain of schedules ran.
|
15 |
+
*
|
16 |
+
* @var DateTime
|
17 |
+
*/
|
18 |
+
private $first_date = NULL;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Timestamp equivalent of @see $this->first_date
|
22 |
+
*
|
23 |
+
* @var int
|
24 |
+
*/
|
25 |
+
protected $first_timestamp = NULL;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* The recurrance between each time an action is run using this schedule.
|
29 |
+
* Used to calculate the start date & time. Can be a number of seconds, in the
|
30 |
+
* case of ActionScheduler_IntervalSchedule, or a cron expression, as in the
|
31 |
+
* case of ActionScheduler_CronSchedule. Or something else.
|
32 |
+
*
|
33 |
+
* @var mixed
|
34 |
+
*/
|
35 |
+
protected $recurrence;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @param DateTime $date The date & time to run the action.
|
39 |
+
* @param mixed $recurrence The data used to determine the schedule's recurrance.
|
40 |
+
* @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance.
|
41 |
+
*/
|
42 |
+
public function __construct( DateTime $date, $recurrence, DateTime $first = null ) {
|
43 |
+
parent::__construct( $date );
|
44 |
+
$this->first_date = empty( $first ) ? $date : $first;
|
45 |
+
$this->recurrence = $recurrence;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
public function is_recurring() {
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Get the date & time of the first schedule in this recurring series.
|
57 |
+
*
|
58 |
+
* @return DateTime|null
|
59 |
+
*/
|
60 |
+
public function get_first_date() {
|
61 |
+
return clone $this->first_date;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function get_recurrence() {
|
68 |
+
return $this->recurrence;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* For PHP 5.2 compat, since DateTime objects can't be serialized
|
73 |
+
* @return array
|
74 |
+
*/
|
75 |
+
public function __sleep() {
|
76 |
+
$sleep_params = parent::__sleep();
|
77 |
+
$this->first_timestamp = $this->first_date->getTimestamp();
|
78 |
+
return array_merge( $sleep_params, array(
|
79 |
+
'first_timestamp',
|
80 |
+
'recurrence'
|
81 |
+
) );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Unserialize recurring schedules serialized/stored prior to AS 3.0.0
|
86 |
+
*
|
87 |
+
* Prior to Action Scheduler 3.0.0, schedules used different property names to refer
|
88 |
+
* to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
|
89 |
+
* was the same as ActionScheduler_SimpleSchedule::timestamp. This was addressed in
|
90 |
+
* Action Scheduler 3.0.0, where properties and property names were aligned for better
|
91 |
+
* inheritance. To maintain backward compatibility with scheduled serialized and stored
|
92 |
+
* prior to 3.0, we need to correctly map the old property names.
|
93 |
+
*/
|
94 |
+
public function __wakeup() {
|
95 |
+
parent::__wakeup();
|
96 |
+
if ( $this->first_timestamp > 0 ) {
|
97 |
+
$this->first_date = as_get_datetime_object( $this->first_timestamp );
|
98 |
+
} else {
|
99 |
+
$this->first_date = $this->get_date();
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Abstract_Schedule
|
5 |
+
*/
|
6 |
+
abstract class ActionScheduler_Abstract_Schedule extends ActionScheduler_Schedule_Deprecated {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* The date & time the schedule is set to run.
|
10 |
+
*
|
11 |
+
* @var DateTime
|
12 |
+
*/
|
13 |
+
private $scheduled_date = NULL;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Timestamp equivalent of @see $this->scheduled_date
|
17 |
+
*
|
18 |
+
* @var int
|
19 |
+
*/
|
20 |
+
protected $scheduled_timestamp = NULL;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param DateTime $date The date & time to run the action.
|
24 |
+
*/
|
25 |
+
public function __construct( DateTime $date ) {
|
26 |
+
$this->scheduled_date = $date;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Check if a schedule should recur.
|
31 |
+
*
|
32 |
+
* @return bool
|
33 |
+
*/
|
34 |
+
abstract public function is_recurring();
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Calculate when the next instance of this schedule would run based on a given date & time.
|
38 |
+
*
|
39 |
+
* @param DateTime $after
|
40 |
+
* @return DateTime
|
41 |
+
*/
|
42 |
+
abstract protected function calculate_next( DateTime $after );
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Get the next date & time when this schedule should run after a given date & time.
|
46 |
+
*
|
47 |
+
* @param DateTime $after
|
48 |
+
* @return DateTime|null
|
49 |
+
*/
|
50 |
+
public function get_next( DateTime $after ) {
|
51 |
+
$after = clone $after;
|
52 |
+
if ( $after > $this->scheduled_date ) {
|
53 |
+
$after = $this->calculate_next( $after );
|
54 |
+
return $after;
|
55 |
+
}
|
56 |
+
return clone $this->scheduled_date;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get the date & time the schedule is set to run.
|
61 |
+
*
|
62 |
+
* @return DateTime|null
|
63 |
+
*/
|
64 |
+
public function get_date() {
|
65 |
+
return $this->scheduled_date;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* For PHP 5.2 compat, since DateTime objects can't be serialized
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function __sleep() {
|
73 |
+
$this->scheduled_timestamp = $this->scheduled_date->getTimestamp();
|
74 |
+
return array(
|
75 |
+
'scheduled_timestamp',
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
public function __wakeup() {
|
80 |
+
$this->scheduled_date = as_get_datetime_object( $this->scheduled_timestamp );
|
81 |
+
unset( $this->scheduled_timestamp );
|
82 |
+
}
|
83 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schema.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class ActionScheduler_Abstract_Schema
|
6 |
+
*
|
7 |
+
* @package Action_Scheduler
|
8 |
+
*
|
9 |
+
* @codeCoverageIgnore
|
10 |
+
*
|
11 |
+
* Utility class for creating/updating custom tables
|
12 |
+
*/
|
13 |
+
abstract class ActionScheduler_Abstract_Schema {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var int Increment this value in derived class to trigger a schema update.
|
17 |
+
*/
|
18 |
+
protected $schema_version = 1;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var string Schema version stored in database.
|
22 |
+
*/
|
23 |
+
protected $db_version;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var array Names of tables that will be registered by this class.
|
27 |
+
*/
|
28 |
+
protected $tables = [];
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Can optionally be used by concrete classes to carry out additional initialization work
|
32 |
+
* as needed.
|
33 |
+
*/
|
34 |
+
public function init() {}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Register tables with WordPress, and create them if needed.
|
38 |
+
*
|
39 |
+
* @param bool $force_update Optional. Default false. Use true to always run the schema update.
|
40 |
+
*
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function register_tables( $force_update = false ) {
|
44 |
+
global $wpdb;
|
45 |
+
|
46 |
+
// make WP aware of our tables
|
47 |
+
foreach ( $this->tables as $table ) {
|
48 |
+
$wpdb->tables[] = $table;
|
49 |
+
$name = $this->get_full_table_name( $table );
|
50 |
+
$wpdb->$table = $name;
|
51 |
+
}
|
52 |
+
|
53 |
+
// create the tables
|
54 |
+
if ( $this->schema_update_required() || $force_update ) {
|
55 |
+
foreach ( $this->tables as $table ) {
|
56 |
+
/**
|
57 |
+
* Allow custom processing before updating a table schema.
|
58 |
+
*
|
59 |
+
* @param string $table Name of table being updated.
|
60 |
+
* @param string $db_version Existing version of the table being updated.
|
61 |
+
*/
|
62 |
+
do_action( 'action_scheduler_before_schema_update', $table, $this->db_version );
|
63 |
+
$this->update_table( $table );
|
64 |
+
}
|
65 |
+
$this->mark_schema_update_complete();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param string $table The name of the table
|
71 |
+
*
|
72 |
+
* @return string The CREATE TABLE statement, suitable for passing to dbDelta
|
73 |
+
*/
|
74 |
+
abstract protected function get_table_definition( $table );
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Determine if the database schema is out of date
|
78 |
+
* by comparing the integer found in $this->schema_version
|
79 |
+
* with the option set in the WordPress options table
|
80 |
+
*
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
private function schema_update_required() {
|
84 |
+
$option_name = 'schema-' . static::class;
|
85 |
+
$this->db_version = get_option( $option_name, 0 );
|
86 |
+
|
87 |
+
// Check for schema option stored by the Action Scheduler Custom Tables plugin in case site has migrated from that plugin with an older schema
|
88 |
+
if ( 0 === $this->db_version ) {
|
89 |
+
|
90 |
+
$plugin_option_name = 'schema-';
|
91 |
+
|
92 |
+
switch ( static::class ) {
|
93 |
+
case 'ActionScheduler_StoreSchema' :
|
94 |
+
$plugin_option_name .= 'Action_Scheduler\Custom_Tables\DB_Store_Table_Maker';
|
95 |
+
break;
|
96 |
+
case 'ActionScheduler_LoggerSchema' :
|
97 |
+
$plugin_option_name .= 'Action_Scheduler\Custom_Tables\DB_Logger_Table_Maker';
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
|
101 |
+
$this->db_version = get_option( $plugin_option_name, 0 );
|
102 |
+
|
103 |
+
delete_option( $plugin_option_name );
|
104 |
+
}
|
105 |
+
|
106 |
+
return version_compare( $this->db_version, $this->schema_version, '<' );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Update the option in WordPress to indicate that
|
111 |
+
* our schema is now up to date
|
112 |
+
*
|
113 |
+
* @return void
|
114 |
+
*/
|
115 |
+
private function mark_schema_update_complete() {
|
116 |
+
$option_name = 'schema-' . static::class;
|
117 |
+
|
118 |
+
// work around race conditions and ensure that our option updates
|
119 |
+
$value_to_save = (string) $this->schema_version . '.0.' . time();
|
120 |
+
|
121 |
+
update_option( $option_name, $value_to_save );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Update the schema for the given table
|
126 |
+
*
|
127 |
+
* @param string $table The name of the table to update
|
128 |
+
*
|
129 |
+
* @return void
|
130 |
+
*/
|
131 |
+
private function update_table( $table ) {
|
132 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
133 |
+
$definition = $this->get_table_definition( $table );
|
134 |
+
if ( $definition ) {
|
135 |
+
$updated = dbDelta( $definition );
|
136 |
+
foreach ( $updated as $updated_table => $update_description ) {
|
137 |
+
if ( strpos( $update_description, 'Created table' ) === 0 ) {
|
138 |
+
do_action( 'action_scheduler/created_table', $updated_table, $table );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @param string $table
|
146 |
+
*
|
147 |
+
* @return string The full name of the table, including the
|
148 |
+
* table prefix for the current blog
|
149 |
+
*/
|
150 |
+
protected function get_full_table_name( $table ) {
|
151 |
+
return $GLOBALS[ 'wpdb' ]->prefix . $table;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Confirms that all of the tables registered by this schema class have been created.
|
156 |
+
*
|
157 |
+
* @return bool
|
158 |
+
*/
|
159 |
+
public function tables_exist() {
|
160 |
+
global $wpdb;
|
161 |
+
|
162 |
+
$existing_tables = $wpdb->get_col( 'SHOW TABLES' );
|
163 |
+
$expected_tables = array_map(
|
164 |
+
function ( $table_name ) use ( $wpdb ) {
|
165 |
+
return $wpdb->prefix . $table_name;
|
166 |
+
},
|
167 |
+
$this->tables
|
168 |
+
);
|
169 |
+
|
170 |
+
return count( array_intersect( $existing_tables, $expected_tables ) ) === count( $expected_tables );
|
171 |
+
}
|
172 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Lock.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract class for setting a basic lock to throttle some action.
|
5 |
+
*
|
6 |
+
* Class ActionScheduler_Lock
|
7 |
+
*/
|
8 |
+
abstract class ActionScheduler_Lock {
|
9 |
+
|
10 |
+
/** @var ActionScheduler_Lock */
|
11 |
+
private static $locker = NULL;
|
12 |
+
|
13 |
+
/** @var int */
|
14 |
+
protected static $lock_duration = MINUTE_IN_SECONDS;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Check if a lock is set for a given lock type.
|
18 |
+
*
|
19 |
+
* @param string $lock_type A string to identify different lock types.
|
20 |
+
* @return bool
|
21 |
+
*/
|
22 |
+
public function is_locked( $lock_type ) {
|
23 |
+
return ( $this->get_expiration( $lock_type ) >= time() );
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Set a lock.
|
28 |
+
*
|
29 |
+
* @param string $lock_type A string to identify different lock types.
|
30 |
+
* @return bool
|
31 |
+
*/
|
32 |
+
abstract public function set( $lock_type );
|
33 |
+
|
34 |
+
/**
|
35 |
+
* If a lock is set, return the timestamp it was set to expiry.
|
36 |
+
*
|
37 |
+
* @param string $lock_type A string to identify different lock types.
|
38 |
+
* @return bool|int False if no lock is set, otherwise the timestamp for when the lock is set to expire.
|
39 |
+
*/
|
40 |
+
abstract public function get_expiration( $lock_type );
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get the amount of time to set for a given lock. 60 seconds by default.
|
44 |
+
*
|
45 |
+
* @param string $lock_type A string to identify different lock types.
|
46 |
+
* @return int
|
47 |
+
*/
|
48 |
+
protected function get_duration( $lock_type ) {
|
49 |
+
return apply_filters( 'action_scheduler_lock_duration', self::$lock_duration, $lock_type );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return ActionScheduler_Lock
|
54 |
+
*/
|
55 |
+
public static function instance() {
|
56 |
+
if ( empty( self::$locker ) ) {
|
57 |
+
$class = apply_filters( 'action_scheduler_lock_class', 'ActionScheduler_OptionLock' );
|
58 |
+
self::$locker = new $class();
|
59 |
+
}
|
60 |
+
return self::$locker;
|
61 |
+
}
|
62 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Logger.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Logger
|
5 |
+
* @codeCoverageIgnore
|
6 |
+
*/
|
7 |
+
abstract class ActionScheduler_Logger {
|
8 |
+
private static $logger = NULL;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @return ActionScheduler_Logger
|
12 |
+
*/
|
13 |
+
public static function instance() {
|
14 |
+
if ( empty(self::$logger) ) {
|
15 |
+
$class = apply_filters('action_scheduler_logger_class', 'ActionScheduler_wpCommentLogger');
|
16 |
+
self::$logger = new $class();
|
17 |
+
}
|
18 |
+
return self::$logger;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string $action_id
|
23 |
+
* @param string $message
|
24 |
+
* @param DateTime $date
|
25 |
+
*
|
26 |
+
* @return string The log entry ID
|
27 |
+
*/
|
28 |
+
abstract public function log( $action_id, $message, DateTime $date = NULL );
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @param string $entry_id
|
32 |
+
*
|
33 |
+
* @return ActionScheduler_LogEntry
|
34 |
+
*/
|
35 |
+
abstract public function get_entry( $entry_id );
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @param string $action_id
|
39 |
+
*
|
40 |
+
* @return ActionScheduler_LogEntry[]
|
41 |
+
*/
|
42 |
+
abstract public function get_logs( $action_id );
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @codeCoverageIgnore
|
47 |
+
*/
|
48 |
+
public function init() {
|
49 |
+
$this->hook_stored_action();
|
50 |
+
add_action( 'action_scheduler_canceled_action', array( $this, 'log_canceled_action' ), 10, 1 );
|
51 |
+
add_action( 'action_scheduler_begin_execute', array( $this, 'log_started_action' ), 10, 2 );
|
52 |
+
add_action( 'action_scheduler_after_execute', array( $this, 'log_completed_action' ), 10, 3 );
|
53 |
+
add_action( 'action_scheduler_failed_execution', array( $this, 'log_failed_action' ), 10, 3 );
|
54 |
+
add_action( 'action_scheduler_failed_action', array( $this, 'log_timed_out_action' ), 10, 2 );
|
55 |
+
add_action( 'action_scheduler_unexpected_shutdown', array( $this, 'log_unexpected_shutdown' ), 10, 2 );
|
56 |
+
add_action( 'action_scheduler_reset_action', array( $this, 'log_reset_action' ), 10, 1 );
|
57 |
+
add_action( 'action_scheduler_execution_ignored', array( $this, 'log_ignored_action' ), 10, 2 );
|
58 |
+
add_action( 'action_scheduler_failed_fetch_action', array( $this, 'log_failed_fetch_action' ), 10, 2 );
|
59 |
+
add_action( 'action_scheduler_failed_to_schedule_next_instance', array( $this, 'log_failed_schedule_next_instance' ), 10, 2 );
|
60 |
+
add_action( 'action_scheduler_bulk_cancel_actions', array( $this, 'bulk_log_cancel_actions' ), 10, 1 );
|
61 |
+
}
|
62 |
+
|
63 |
+
public function hook_stored_action() {
|
64 |
+
add_action( 'action_scheduler_stored_action', array( $this, 'log_stored_action' ) );
|
65 |
+
}
|
66 |
+
|
67 |
+
public function unhook_stored_action() {
|
68 |
+
remove_action( 'action_scheduler_stored_action', array( $this, 'log_stored_action' ) );
|
69 |
+
}
|
70 |
+
|
71 |
+
public function log_stored_action( $action_id ) {
|
72 |
+
$this->log( $action_id, __( 'action created', 'action-scheduler' ) );
|
73 |
+
}
|
74 |
+
|
75 |
+
public function log_canceled_action( $action_id ) {
|
76 |
+
$this->log( $action_id, __( 'action canceled', 'action-scheduler' ) );
|
77 |
+
}
|
78 |
+
|
79 |
+
public function log_started_action( $action_id, $context = '' ) {
|
80 |
+
if ( ! empty( $context ) ) {
|
81 |
+
/* translators: %s: context */
|
82 |
+
$message = sprintf( __( 'action started via %s', 'action-scheduler' ), $context );
|
83 |
+
} else {
|
84 |
+
$message = __( 'action started', 'action-scheduler' );
|
85 |
+
}
|
86 |
+
$this->log( $action_id, $message );
|
87 |
+
}
|
88 |
+
|
89 |
+
public function log_completed_action( $action_id, $action = NULL, $context = '' ) {
|
90 |
+
if ( ! empty( $context ) ) {
|
91 |
+
/* translators: %s: context */
|
92 |
+
$message = sprintf( __( 'action complete via %s', 'action-scheduler' ), $context );
|
93 |
+
} else {
|
94 |
+
$message = __( 'action complete', 'action-scheduler' );
|
95 |
+
}
|
96 |
+
$this->log( $action_id, $message );
|
97 |
+
}
|
98 |
+
|
99 |
+
public function log_failed_action( $action_id, Exception $exception, $context = '' ) {
|
100 |
+
if ( ! empty( $context ) ) {
|
101 |
+
/* translators: 1: context 2: exception message */
|
102 |
+
$message = sprintf( __( 'action failed via %1$s: %2$s', 'action-scheduler' ), $context, $exception->getMessage() );
|
103 |
+
} else {
|
104 |
+
/* translators: %s: exception message */
|
105 |
+
$message = sprintf( __( 'action failed: %s', 'action-scheduler' ), $exception->getMessage() );
|
106 |
+
}
|
107 |
+
$this->log( $action_id, $message );
|
108 |
+
}
|
109 |
+
|
110 |
+
public function log_timed_out_action( $action_id, $timeout ) {
|
111 |
+
/* translators: %s: amount of time */
|
112 |
+
$this->log( $action_id, sprintf( __( 'action marked as failed after %s seconds. Unknown error occurred. Check server, PHP and database error logs to diagnose cause.', 'action-scheduler' ), $timeout ) );
|
113 |
+
}
|
114 |
+
|
115 |
+
public function log_unexpected_shutdown( $action_id, $error ) {
|
116 |
+
if ( ! empty( $error ) ) {
|
117 |
+
/* translators: 1: error message 2: filename 3: line */
|
118 |
+
$this->log( $action_id, sprintf( __( 'unexpected shutdown: PHP Fatal error %1$s in %2$s on line %3$s', 'action-scheduler' ), $error['message'], $error['file'], $error['line'] ) );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
public function log_reset_action( $action_id ) {
|
123 |
+
$this->log( $action_id, __( 'action reset', 'action-scheduler' ) );
|
124 |
+
}
|
125 |
+
|
126 |
+
public function log_ignored_action( $action_id, $context = '' ) {
|
127 |
+
if ( ! empty( $context ) ) {
|
128 |
+
/* translators: %s: context */
|
129 |
+
$message = sprintf( __( 'action ignored via %s', 'action-scheduler' ), $context );
|
130 |
+
} else {
|
131 |
+
$message = __( 'action ignored', 'action-scheduler' );
|
132 |
+
}
|
133 |
+
$this->log( $action_id, $message );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @param string $action_id
|
138 |
+
* @param Exception|NULL $exception The exception which occured when fetching the action. NULL by default for backward compatibility.
|
139 |
+
*
|
140 |
+
* @return ActionScheduler_LogEntry[]
|
141 |
+
*/
|
142 |
+
public function log_failed_fetch_action( $action_id, Exception $exception = NULL ) {
|
143 |
+
|
144 |
+
if ( ! is_null( $exception ) ) {
|
145 |
+
/* translators: %s: exception message */
|
146 |
+
$log_message = sprintf( __( 'There was a failure fetching this action: %s', 'action-scheduler' ), $exception->getMessage() );
|
147 |
+
} else {
|
148 |
+
$log_message = __( 'There was a failure fetching this action', 'action-scheduler' );
|
149 |
+
}
|
150 |
+
|
151 |
+
$this->log( $action_id, $log_message );
|
152 |
+
}
|
153 |
+
|
154 |
+
public function log_failed_schedule_next_instance( $action_id, Exception $exception ) {
|
155 |
+
/* translators: %s: exception message */
|
156 |
+
$this->log( $action_id, sprintf( __( 'There was a failure scheduling the next instance of this action: %s', 'action-scheduler' ), $exception->getMessage() ) );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Bulk add cancel action log entries.
|
161 |
+
*
|
162 |
+
* Implemented here for backward compatibility. Should be implemented in parent loggers
|
163 |
+
* for more performant bulk logging.
|
164 |
+
*
|
165 |
+
* @param array $action_ids List of action ID.
|
166 |
+
*/
|
167 |
+
public function bulk_log_cancel_actions( $action_ids ) {
|
168 |
+
if ( empty( $action_ids ) ) {
|
169 |
+
return;
|
170 |
+
}
|
171 |
+
|
172 |
+
foreach ( $action_ids as $action_id ) {
|
173 |
+
$this->log_canceled_action( $action_id );
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php
ADDED
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Store
|
5 |
+
* @codeCoverageIgnore
|
6 |
+
*/
|
7 |
+
abstract class ActionScheduler_Store extends ActionScheduler_Store_Deprecated {
|
8 |
+
const STATUS_COMPLETE = 'complete';
|
9 |
+
const STATUS_PENDING = 'pending';
|
10 |
+
const STATUS_RUNNING = 'in-progress';
|
11 |
+
const STATUS_FAILED = 'failed';
|
12 |
+
const STATUS_CANCELED = 'canceled';
|
13 |
+
const DEFAULT_CLASS = 'ActionScheduler_wpPostStore';
|
14 |
+
|
15 |
+
/** @var ActionScheduler_Store */
|
16 |
+
private static $store = NULL;
|
17 |
+
|
18 |
+
/** @var int */
|
19 |
+
protected static $max_args_length = 191;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param ActionScheduler_Action $action
|
23 |
+
* @param DateTime $scheduled_date Optional Date of the first instance
|
24 |
+
* to store. Otherwise uses the first date of the action's
|
25 |
+
* schedule.
|
26 |
+
*
|
27 |
+
* @return int The action ID
|
28 |
+
*/
|
29 |
+
abstract public function save_action( ActionScheduler_Action $action, DateTime $scheduled_date = NULL );
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param string $action_id
|
33 |
+
*
|
34 |
+
* @return ActionScheduler_Action
|
35 |
+
*/
|
36 |
+
abstract public function fetch_action( $action_id );
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Find an action.
|
40 |
+
*
|
41 |
+
* Note: the query ordering changes based on the passed 'status' value.
|
42 |
+
*
|
43 |
+
* @param string $hook Action hook.
|
44 |
+
* @param array $params Parameters of the action to find.
|
45 |
+
*
|
46 |
+
* @return string|null ID of the next action matching the criteria or NULL if not found.
|
47 |
+
*/
|
48 |
+
public function find_action( $hook, $params = array() ) {
|
49 |
+
$params = wp_parse_args(
|
50 |
+
$params,
|
51 |
+
array(
|
52 |
+
'args' => null,
|
53 |
+
'status' => self::STATUS_PENDING,
|
54 |
+
'group' => '',
|
55 |
+
)
|
56 |
+
);
|
57 |
+
|
58 |
+
// These params are fixed for this method.
|
59 |
+
$params['hook'] = $hook;
|
60 |
+
$params['orderby'] = 'date';
|
61 |
+
$params['per_page'] = 1;
|
62 |
+
|
63 |
+
if ( ! empty( $params['status'] ) ) {
|
64 |
+
if ( self::STATUS_PENDING === $params['status'] ) {
|
65 |
+
$params['order'] = 'ASC'; // Find the next action that matches.
|
66 |
+
} else {
|
67 |
+
$params['order'] = 'DESC'; // Find the most recent action that matches.
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
$results = $this->query_actions( $params );
|
72 |
+
|
73 |
+
return empty( $results ) ? null : $results[0];
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Query for action count or list of action IDs.
|
78 |
+
*
|
79 |
+
* @since 3.3.0 $query['status'] accepts array of statuses instead of a single status.
|
80 |
+
*
|
81 |
+
* @param array $query {
|
82 |
+
* Query filtering options.
|
83 |
+
*
|
84 |
+
* @type string $hook The name of the actions. Optional.
|
85 |
+
* @type string|array $status The status or statuses of the actions. Optional.
|
86 |
+
* @type array $args The args array of the actions. Optional.
|
87 |
+
* @type DateTime $date The scheduled date of the action. Used in UTC timezone. Optional.
|
88 |
+
* @type string $date_compare Operator for selecting by $date param. Accepted values are '!=', '>', '>=', '<', '<=', '='. Defaults to '<='.
|
89 |
+
* @type DateTime $modified The last modified date of the action. Used in UTC timezone. Optional.
|
90 |
+
* @type string $modified_compare Operator for comparing $modified param. Accepted values are '!=', '>', '>=', '<', '<=', '='. Defaults to '<='.
|
91 |
+
* @type string $group The group the action belongs to. Optional.
|
92 |
+
* @type bool|int $claimed TRUE to find claimed actions, FALSE to find unclaimed actions, an int to find a specific claim ID. Optional.
|
93 |
+
* @type int $per_page Number of results to return. Defaults to 5.
|
94 |
+
* @type int $offset The query pagination offset. Defaults to 0.
|
95 |
+
* @type int $orderby Accepted values are 'hook', 'group', 'modified', 'date' or 'none'. Defaults to 'date'.
|
96 |
+
* @type string $order Accepted values are 'ASC' or 'DESC'. Defaults to 'ASC'.
|
97 |
+
* }
|
98 |
+
* @param string $query_type Whether to select or count the results. Default, select.
|
99 |
+
*
|
100 |
+
* @return string|array|null The IDs of actions matching the query. Null on failure.
|
101 |
+
*/
|
102 |
+
abstract public function query_actions( $query = array(), $query_type = 'select' );
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Run query to get a single action ID.
|
106 |
+
*
|
107 |
+
* @since 3.3.0
|
108 |
+
*
|
109 |
+
* @see ActionScheduler_Store::query_actions for $query arg usage but 'per_page' and 'offset' can't be used.
|
110 |
+
*
|
111 |
+
* @param array $query Query parameters.
|
112 |
+
*
|
113 |
+
* @return int|null
|
114 |
+
*/
|
115 |
+
public function query_action( $query ) {
|
116 |
+
$query['per_page'] = 1;
|
117 |
+
$query['offset'] = 0;
|
118 |
+
$results = $this->query_actions( $query );
|
119 |
+
|
120 |
+
if ( empty( $results ) ) {
|
121 |
+
return null;
|
122 |
+
} else {
|
123 |
+
return (int) $results[0];
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Get a count of all actions in the store, grouped by status
|
129 |
+
*
|
130 |
+
* @return array
|
131 |
+
*/
|
132 |
+
abstract public function action_counts();
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Get additional action counts.
|
136 |
+
*
|
137 |
+
* - add past-due actions
|
138 |
+
*
|
139 |
+
* @return array
|
140 |
+
*/
|
141 |
+
public function extra_action_counts() {
|
142 |
+
$extra_actions = array();
|
143 |
+
|
144 |
+
$pastdue_action_counts = ( int ) $this->query_actions( array(
|
145 |
+
'status' => self::STATUS_PENDING,
|
146 |
+
'date' => as_get_datetime_object(),
|
147 |
+
), 'count' );
|
148 |
+
|
149 |
+
if ( $pastdue_action_counts ) {
|
150 |
+
$extra_actions['past-due'] = $pastdue_action_counts;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Allows 3rd party code to add extra action counts (used in filters in the list table).
|
155 |
+
*
|
156 |
+
* @since 3.5.0
|
157 |
+
* @param $extra_actions array Array with format action_count_identifier => action count.
|
158 |
+
*/
|
159 |
+
return apply_filters( 'action_scheduler_extra_action_counts', $extra_actions );
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @param string $action_id
|
164 |
+
*/
|
165 |
+
abstract public function cancel_action( $action_id );
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @param string $action_id
|
169 |
+
*/
|
170 |
+
abstract public function delete_action( $action_id );
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @param string $action_id
|
174 |
+
*
|
175 |
+
* @return DateTime The date the action is schedule to run, or the date that it ran.
|
176 |
+
*/
|
177 |
+
abstract public function get_date( $action_id );
|
178 |
+
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @param int $max_actions
|
182 |
+
* @param DateTime $before_date Claim only actions schedule before the given date. Defaults to now.
|
183 |
+
* @param array $hooks Claim only actions with a hook or hooks.
|
184 |
+
* @param string $group Claim only actions in the given group.
|
185 |
+
*
|
186 |
+
* @return ActionScheduler_ActionClaim
|
187 |
+
*/
|
188 |
+
abstract public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' );
|
189 |
+
|
190 |
+
/**
|
191 |
+
* @return int
|
192 |
+
*/
|
193 |
+
abstract public function get_claim_count();
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param ActionScheduler_ActionClaim $claim
|
197 |
+
*/
|
198 |
+
abstract public function release_claim( ActionScheduler_ActionClaim $claim );
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @param string $action_id
|
202 |
+
*/
|
203 |
+
abstract public function unclaim_action( $action_id );
|
204 |
+
|
205 |
+
/**
|
206 |
+
* @param string $action_id
|
207 |
+
*/
|
208 |
+
abstract public function mark_failure( $action_id );
|
209 |
+
|
210 |
+
/**
|
211 |
+
* @param string $action_id
|
212 |
+
*/
|
213 |
+
abstract public function log_execution( $action_id );
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @param string $action_id
|
217 |
+
*/
|
218 |
+
abstract public function mark_complete( $action_id );
|
219 |
+
|
220 |
+
/**
|
221 |
+
* @param string $action_id
|
222 |
+
*
|
223 |
+
* @return string
|
224 |
+
*/
|
225 |
+
abstract public function get_status( $action_id );
|
226 |
+
|
227 |
+
/**
|
228 |
+
* @param string $action_id
|
229 |
+
* @return mixed
|
230 |
+
*/
|
231 |
+
abstract public function get_claim_id( $action_id );
|
232 |
+
|
233 |
+
/**
|
234 |
+
* @param string $claim_id
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
abstract public function find_actions_by_claim_id( $claim_id );
|
238 |
+
|
239 |
+
/**
|
240 |
+
* @param string $comparison_operator
|
241 |
+
* @return string
|
242 |
+
*/
|
243 |
+
protected function validate_sql_comparator( $comparison_operator ) {
|
244 |
+
if ( in_array( $comparison_operator, array('!=', '>', '>=', '<', '<=', '=') ) ) {
|
245 |
+
return $comparison_operator;
|
246 |
+
}
|
247 |
+
return '=';
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Get the time MySQL formated date/time string for an action's (next) scheduled date.
|
252 |
+
*
|
253 |
+
* @param ActionScheduler_Action $action
|
254 |
+
* @param DateTime $scheduled_date (optional)
|
255 |
+
* @return string
|
256 |
+
*/
|
257 |
+
protected function get_scheduled_date_string( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) {
|
258 |
+
$next = null === $scheduled_date ? $action->get_schedule()->get_date() : $scheduled_date;
|
259 |
+
if ( ! $next ) {
|
260 |
+
return '0000-00-00 00:00:00';
|
261 |
+
}
|
262 |
+
$next->setTimezone( new DateTimeZone( 'UTC' ) );
|
263 |
+
|
264 |
+
return $next->format( 'Y-m-d H:i:s' );
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Get the time MySQL formated date/time string for an action's (next) scheduled date.
|
269 |
+
*
|
270 |
+
* @param ActionScheduler_Action $action
|
271 |
+
* @param DateTime $scheduled_date (optional)
|
272 |
+
* @return string
|
273 |
+
*/
|
274 |
+
protected function get_scheduled_date_string_local( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) {
|
275 |
+
$next = null === $scheduled_date ? $action->get_schedule()->get_date() : $scheduled_date;
|
276 |
+
if ( ! $next ) {
|
277 |
+
return '0000-00-00 00:00:00';
|
278 |
+
}
|
279 |
+
|
280 |
+
ActionScheduler_TimezoneHelper::set_local_timezone( $next );
|
281 |
+
return $next->format( 'Y-m-d H:i:s' );
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Validate that we could decode action arguments.
|
286 |
+
*
|
287 |
+
* @param mixed $args The decoded arguments.
|
288 |
+
* @param int $action_id The action ID.
|
289 |
+
*
|
290 |
+
* @throws ActionScheduler_InvalidActionException When the decoded arguments are invalid.
|
291 |
+
*/
|
292 |
+
protected function validate_args( $args, $action_id ) {
|
293 |
+
// Ensure we have an array of args.
|
294 |
+
if ( ! is_array( $args ) ) {
|
295 |
+
throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id );
|
296 |
+
}
|
297 |
+
|
298 |
+
// Validate JSON decoding if possible.
|
299 |
+
if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) {
|
300 |
+
throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id, $args );
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Validate a ActionScheduler_Schedule object.
|
306 |
+
*
|
307 |
+
* @param mixed $schedule The unserialized ActionScheduler_Schedule object.
|
308 |
+
* @param int $action_id The action ID.
|
309 |
+
*
|
310 |
+
* @throws ActionScheduler_InvalidActionException When the schedule is invalid.
|
311 |
+
*/
|
312 |
+
protected function validate_schedule( $schedule, $action_id ) {
|
313 |
+
if ( empty( $schedule ) || ! is_a( $schedule, 'ActionScheduler_Schedule' ) ) {
|
314 |
+
throw ActionScheduler_InvalidActionException::from_schedule( $action_id, $schedule );
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4.
|
320 |
+
*
|
321 |
+
* Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However,
|
322 |
+
* with custom tables, we use an indexed VARCHAR column instead.
|
323 |
+
*
|
324 |
+
* @param ActionScheduler_Action $action Action to be validated.
|
325 |
+
* @throws InvalidArgumentException When json encoded args is too long.
|
326 |
+
*/
|
327 |
+
protected function validate_action( ActionScheduler_Action $action ) {
|
328 |
+
if ( strlen( json_encode( $action->get_args() ) ) > static::$max_args_length ) {
|
329 |
+
throw new InvalidArgumentException( sprintf( __( 'ActionScheduler_Action::$args too long. To ensure the args column can be indexed, action args should not be more than %d characters when encoded as JSON.', 'action-scheduler' ), static::$max_args_length ) );
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Cancel pending actions by hook.
|
335 |
+
*
|
336 |
+
* @since 3.0.0
|
337 |
+
*
|
338 |
+
* @param string $hook Hook name.
|
339 |
+
*
|
340 |
+
* @return void
|
341 |
+
*/
|
342 |
+
public function cancel_actions_by_hook( $hook ) {
|
343 |
+
$action_ids = true;
|
344 |
+
while ( ! empty( $action_ids ) ) {
|
345 |
+
$action_ids = $this->query_actions(
|
346 |
+
array(
|
347 |
+
'hook' => $hook,
|
348 |
+
'status' => self::STATUS_PENDING,
|
349 |
+
'per_page' => 1000,
|
350 |
+
'orderby' => 'action_id',
|
351 |
+
)
|
352 |
+
);
|
353 |
+
|
354 |
+
$this->bulk_cancel_actions( $action_ids );
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Cancel pending actions by group.
|
360 |
+
*
|
361 |
+
* @since 3.0.0
|
362 |
+
*
|
363 |
+
* @param string $group Group slug.
|
364 |
+
*
|
365 |
+
* @return void
|
366 |
+
*/
|
367 |
+
public function cancel_actions_by_group( $group ) {
|
368 |
+
$action_ids = true;
|
369 |
+
while ( ! empty( $action_ids ) ) {
|
370 |
+
$action_ids = $this->query_actions(
|
371 |
+
array(
|
372 |
+
'group' => $group,
|
373 |
+
'status' => self::STATUS_PENDING,
|
374 |
+
'per_page' => 1000,
|
375 |
+
'orderby' => 'action_id',
|
376 |
+
)
|
377 |
+
);
|
378 |
+
|
379 |
+
$this->bulk_cancel_actions( $action_ids );
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Cancel a set of action IDs.
|
385 |
+
*
|
386 |
+
* @since 3.0.0
|
387 |
+
*
|
388 |
+
* @param array $action_ids List of action IDs.
|
389 |
+
*
|
390 |
+
* @return void
|
391 |
+
*/
|
392 |
+
private function bulk_cancel_actions( $action_ids ) {
|
393 |
+
foreach ( $action_ids as $action_id ) {
|
394 |
+
$this->cancel_action( $action_id );
|
395 |
+
}
|
396 |
+
|
397 |
+
do_action( 'action_scheduler_bulk_cancel_actions', $action_ids );
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* @return array
|
402 |
+
*/
|
403 |
+
public function get_status_labels() {
|
404 |
+
return array(
|
405 |
+
self::STATUS_COMPLETE => __( 'Complete', 'action-scheduler' ),
|
406 |
+
self::STATUS_PENDING => __( 'Pending', 'action-scheduler' ),
|
407 |
+
self::STATUS_RUNNING => __( 'In-progress', 'action-scheduler' ),
|
408 |
+
self::STATUS_FAILED => __( 'Failed', 'action-scheduler' ),
|
409 |
+
self::STATUS_CANCELED => __( 'Canceled', 'action-scheduler' ),
|
410 |
+
);
|
411 |
+
}
|
412 |
+
|
413 |
+
/**
|
414 |
+
* Check if there are any pending scheduled actions due to run.
|
415 |
+
*
|
416 |
+
* @param ActionScheduler_Action $action
|
417 |
+
* @param DateTime $scheduled_date (optional)
|
418 |
+
* @return string
|
419 |
+
*/
|
420 |
+
public function has_pending_actions_due() {
|
421 |
+
$pending_actions = $this->query_actions( array(
|
422 |
+
'date' => as_get_datetime_object(),
|
423 |
+
'status' => ActionScheduler_Store::STATUS_PENDING,
|
424 |
+
'orderby' => 'none',
|
425 |
+
) );
|
426 |
+
|
427 |
+
return ! empty( $pending_actions );
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Callable initialization function optionally overridden in derived classes.
|
432 |
+
*/
|
433 |
+
public function init() {}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Callable function to mark an action as migrated optionally overridden in derived classes.
|
437 |
+
*/
|
438 |
+
public function mark_migrated( $action_id ) {}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* @return ActionScheduler_Store
|
442 |
+
*/
|
443 |
+
public static function instance() {
|
444 |
+
if ( empty( self::$store ) ) {
|
445 |
+
$class = apply_filters( 'action_scheduler_store_class', self::DEFAULT_CLASS );
|
446 |
+
self::$store = new $class();
|
447 |
+
}
|
448 |
+
return self::$store;
|
449 |
+
}
|
450 |
+
}
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_TimezoneHelper
|
5 |
+
*/
|
6 |
+
abstract class ActionScheduler_TimezoneHelper {
|
7 |
+
private static $local_timezone = NULL;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Set a DateTime's timezone to the WordPress site's timezone, or a UTC offset
|
11 |
+
* if no timezone string is available.
|
12 |
+
*
|
13 |
+
* @since 2.1.0
|
14 |
+
*
|
15 |
+
* @param DateTime $date
|
16 |
+
* @return ActionScheduler_DateTime
|
17 |
+
*/
|
18 |
+
public static function set_local_timezone( DateTime $date ) {
|
19 |
+
|
20 |
+
// Accept a DateTime for easier backward compatibility, even though we require methods on ActionScheduler_DateTime
|
21 |
+
if ( ! is_a( $date, 'ActionScheduler_DateTime' ) ) {
|
22 |
+
$date = as_get_datetime_object( $date->format( 'U' ) );
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( get_option( 'timezone_string' ) ) {
|
26 |
+
$date->setTimezone( new DateTimeZone( self::get_local_timezone_string() ) );
|
27 |
+
} else {
|
28 |
+
$date->setUtcOffset( self::get_local_timezone_offset() );
|
29 |
+
}
|
30 |
+
|
31 |
+
return $date;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Helper to retrieve the timezone string for a site until a WP core method exists
|
36 |
+
* (see https://core.trac.wordpress.org/ticket/24730).
|
37 |
+
*
|
38 |
+
* Adapted from wc_timezone_string() and https://secure.php.net/manual/en/function.timezone-name-from-abbr.php#89155.
|
39 |
+
*
|
40 |
+
* If no timezone string is set, and its not possible to match the UTC offset set for the site to a timezone
|
41 |
+
* string, then an empty string will be returned, and the UTC offset should be used to set a DateTime's
|
42 |
+
* timezone.
|
43 |
+
*
|
44 |
+
* @since 2.1.0
|
45 |
+
* @return string PHP timezone string for the site or empty if no timezone string is available.
|
46 |
+
*/
|
47 |
+
protected static function get_local_timezone_string( $reset = false ) {
|
48 |
+
// If site timezone string exists, return it.
|
49 |
+
$timezone = get_option( 'timezone_string' );
|
50 |
+
if ( $timezone ) {
|
51 |
+
return $timezone;
|
52 |
+
}
|
53 |
+
|
54 |
+
// Get UTC offset, if it isn't set then return UTC.
|
55 |
+
$utc_offset = intval( get_option( 'gmt_offset', 0 ) );
|
56 |
+
if ( 0 === $utc_offset ) {
|
57 |
+
return 'UTC';
|
58 |
+
}
|
59 |
+
|
60 |
+
// Adjust UTC offset from hours to seconds.
|
61 |
+
$utc_offset *= 3600;
|
62 |
+
|
63 |
+
// Attempt to guess the timezone string from the UTC offset.
|
64 |
+
$timezone = timezone_name_from_abbr( '', $utc_offset );
|
65 |
+
if ( $timezone ) {
|
66 |
+
return $timezone;
|
67 |
+
}
|
68 |
+
|
69 |
+
// Last try, guess timezone string manually.
|
70 |
+
foreach ( timezone_abbreviations_list() as $abbr ) {
|
71 |
+
foreach ( $abbr as $city ) {
|
72 |
+
if ( (bool) date( 'I' ) === (bool) $city['dst'] && $city['timezone_id'] && intval( $city['offset'] ) === $utc_offset ) {
|
73 |
+
return $city['timezone_id'];
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
// No timezone string
|
79 |
+
return '';
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get timezone offset in seconds.
|
84 |
+
*
|
85 |
+
* @since 2.1.0
|
86 |
+
* @return float
|
87 |
+
*/
|
88 |
+
protected static function get_local_timezone_offset() {
|
89 |
+
$timezone = get_option( 'timezone_string' );
|
90 |
+
|
91 |
+
if ( $timezone ) {
|
92 |
+
$timezone_object = new DateTimeZone( $timezone );
|
93 |
+
return $timezone_object->getOffset( new DateTime( 'now' ) );
|
94 |
+
} else {
|
95 |
+
return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @deprecated 2.1.0
|
101 |
+
*/
|
102 |
+
public static function get_local_timezone( $reset = FALSE ) {
|
103 |
+
_deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' );
|
104 |
+
if ( $reset ) {
|
105 |
+
self::$local_timezone = NULL;
|
106 |
+
}
|
107 |
+
if ( !isset(self::$local_timezone) ) {
|
108 |
+
$tzstring = get_option('timezone_string');
|
109 |
+
|
110 |
+
if ( empty($tzstring) ) {
|
111 |
+
$gmt_offset = get_option('gmt_offset');
|
112 |
+
if ( $gmt_offset == 0 ) {
|
113 |
+
$tzstring = 'UTC';
|
114 |
+
} else {
|
115 |
+
$gmt_offset *= HOUR_IN_SECONDS;
|
116 |
+
$tzstring = timezone_name_from_abbr( '', $gmt_offset, 1 );
|
117 |
+
|
118 |
+
// If there's no timezone string, try again with no DST.
|
119 |
+
if ( false === $tzstring ) {
|
120 |
+
$tzstring = timezone_name_from_abbr( '', $gmt_offset, 0 );
|
121 |
+
}
|
122 |
+
|
123 |
+
// Try mapping to the first abbreviation we can find.
|
124 |
+
if ( false === $tzstring ) {
|
125 |
+
$is_dst = date( 'I' );
|
126 |
+
foreach ( timezone_abbreviations_list() as $abbr ) {
|
127 |
+
foreach ( $abbr as $city ) {
|
128 |
+
if ( $city['dst'] == $is_dst && $city['offset'] == $gmt_offset ) {
|
129 |
+
// If there's no valid timezone ID, keep looking.
|
130 |
+
if ( null === $city['timezone_id'] ) {
|
131 |
+
continue;
|
132 |
+
}
|
133 |
+
|
134 |
+
$tzstring = $city['timezone_id'];
|
135 |
+
break 2;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
// If we still have no valid string, then fall back to UTC.
|
142 |
+
if ( false === $tzstring ) {
|
143 |
+
$tzstring = 'UTC';
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
self::$local_timezone = new DateTimeZone($tzstring);
|
149 |
+
}
|
150 |
+
return self::$local_timezone;
|
151 |
+
}
|
152 |
+
}
|
vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_Action.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_Action
|
5 |
+
*/
|
6 |
+
class ActionScheduler_Action {
|
7 |
+
protected $hook = '';
|
8 |
+
protected $args = array();
|
9 |
+
/** @var ActionScheduler_Schedule */
|
10 |
+
protected $schedule = NULL;
|
11 |
+
protected $group = '';
|
12 |
+
|
13 |
+
public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
|
14 |
+
$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
|
15 |
+
$this->set_hook($hook);
|
16 |
+
$this->set_schedule($schedule);
|
17 |
+
$this->set_args($args);
|
18 |
+
$this->set_group($group);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Executes the action.
|
23 |
+
*
|
24 |
+
* If no callbacks are registered, an exception will be thrown and the action will not be
|
25 |
+
* fired. This is useful to help detect cases where the code responsible for setting up
|
26 |
+
* a scheduled action no longer exists.
|
27 |
+
*
|
28 |
+
* @throws Exception If no callbacks are registered for this action.
|
29 |
+
*/
|
30 |
+
public function execute() {
|
31 |
+
$hook = $this->get_hook();
|
32 |
+
|
33 |
+
if ( ! has_action( $hook ) ) {
|
34 |
+
throw new Exception(
|
35 |
+
sprintf(
|
36 |
+
/* translators: 1: action hook. */
|
37 |
+
__( 'Scheduled action for %1$s will not be executed as no callbacks are registered.', 'action-scheduler' ),
|
38 |
+
$hook
|
39 |
+
)
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
do_action_ref_array( $hook, array_values( $this->get_args() ) );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param string $hook
|
48 |
+
*/
|
49 |
+
protected function set_hook( $hook ) {
|
50 |
+
$this->hook = $hook;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function get_hook() {
|
54 |
+
return $this->hook;
|
55 |
+
}
|
56 |
+
|
57 |
+
protected function set_schedule( ActionScheduler_Schedule $schedule ) {
|
58 |
+
$this->schedule = $schedule;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @return ActionScheduler_Schedule
|
63 |
+
*/
|
64 |
+
public function get_schedule() {
|
65 |
+
return $this->schedule;
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function set_args( array $args ) {
|
69 |
+
$this->args = $args;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function get_args() {
|
73 |
+
return $this->args;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @param string $group
|
78 |
+
*/
|
79 |
+
protected function set_group( $group ) {
|
80 |
+
$this->group = $group;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function get_group() {
|
87 |
+
return $this->group;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return bool If the action has been finished
|
92 |
+
*/
|
93 |
+
public function is_finished() {
|
94 |
+
return FALSE;
|
95 |
+
}
|
96 |
+
}
|
vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_CanceledAction.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_CanceledAction
|
5 |
+
*
|
6 |
+
* Stored action which was canceled and therefore acts like a finished action but should always return a null schedule,
|
7 |
+
* regardless of schedule passed to its constructor.
|
8 |
+
*/
|
9 |
+
class ActionScheduler_CanceledAction extends ActionScheduler_FinishedAction {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param string $hook
|
13 |
+
* @param array $args
|
14 |
+
* @param ActionScheduler_Schedule $schedule
|
15 |
+
* @param string $group
|
16 |
+
*/
|
17 |
+
public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
|
18 |
+
parent::__construct( $hook, $args, $schedule, $group );
|
19 |
+
if ( is_null( $schedule ) ) {
|
20 |
+
$this->set_schedule( new ActionScheduler_NullSchedule() );
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_FinishedAction.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_FinishedAction
|
5 |
+
*/
|
6 |
+
class ActionScheduler_FinishedAction extends ActionScheduler_Action {
|
7 |
+
|
8 |
+
public function execute() {
|
9 |
+
// don't execute
|
10 |
+
}
|
11 |
+
|
12 |
+
public function is_finished() {
|
13 |
+
return TRUE;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_NullAction.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_NullAction
|
5 |
+
*/
|
6 |
+
class ActionScheduler_NullAction extends ActionScheduler_Action {
|
7 |
+
|
8 |
+
public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) {
|
9 |
+
$this->set_schedule( new ActionScheduler_NullSchedule() );
|
10 |
+
}
|
11 |
+
|
12 |
+
public function execute() {
|
13 |
+
// don't execute
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_DBLogger.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_DBLogger
|
5 |
+
*
|
6 |
+
* Action logs data table data store.
|
7 |
+
*
|
8 |
+
* @since 3.0.0
|
9 |
+
*/
|
10 |
+
class ActionScheduler_DBLogger extends ActionScheduler_Logger {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Add a record to an action log.
|
14 |
+
*
|
15 |
+
* @param int $action_id Action ID.
|
16 |
+
* @param string $message Message to be saved in the log entry.
|
17 |
+
* @param DateTime $date Timestamp of the log entry.
|
18 |
+
*
|
19 |
+
* @return int The log entry ID.
|
20 |
+
*/
|
21 |
+
public function log( $action_id, $message, DateTime $date = null ) {
|
22 |
+
if ( empty( $date ) ) {
|
23 |
+
$date = as_get_datetime_object();
|
24 |
+
} else {
|
25 |
+
$date = clone $date;
|
26 |
+
}
|
27 |
+
|
28 |
+
$date_gmt = $date->format( 'Y-m-d H:i:s' );
|
29 |
+
ActionScheduler_TimezoneHelper::set_local_timezone( $date );
|
30 |
+
$date_local = $date->format( 'Y-m-d H:i:s' );
|
31 |
+
|
32 |
+
/** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
33 |
+
global $wpdb;
|
34 |
+
$wpdb->insert(
|
35 |
+
$wpdb->actionscheduler_logs,
|
36 |
+
array(
|
37 |
+
'action_id' => $action_id,
|
38 |
+
'message' => $message,
|
39 |
+
'log_date_gmt' => $date_gmt,
|
40 |
+
'log_date_local' => $date_local,
|
41 |
+
),
|
42 |
+
array( '%d', '%s', '%s', '%s' )
|
43 |
+
);
|
44 |
+
|
45 |
+
return $wpdb->insert_id;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Retrieve an action log entry.
|
50 |
+
*
|
51 |
+
* @param int $entry_id Log entry ID.
|
52 |
+
*
|
53 |
+
* @return ActionScheduler_LogEntry
|
54 |
+
*/
|
55 |
+
public function get_entry( $entry_id ) {
|
56 |
+
/** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
57 |
+
global $wpdb;
|
58 |
+
$entry = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->actionscheduler_logs} WHERE log_id=%d", $entry_id ) );
|
59 |
+
|
60 |
+
return $this->create_entry_from_db_record( $entry );
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Create an action log entry from a database record.
|
65 |
+
*
|
66 |
+
* @param object $record Log entry database record object.
|
67 |
+
*
|
68 |
+
* @return ActionScheduler_LogEntry
|
69 |
+
*/
|
70 |
+
private function create_entry_from_db_record( $record ) {
|
71 |
+
if ( empty( $record ) ) {
|
72 |
+
return new ActionScheduler_NullLogEntry();
|
73 |
+
}
|
74 |
+
|
75 |
+
if ( is_null( $record->log_date_gmt ) ) {
|
76 |
+
$date = as_get_datetime_object( ActionScheduler_StoreSchema::DEFAULT_DATE );
|
77 |
+
} else {
|
78 |
+
$date = as_get_datetime_object( $record->log_date_gmt );
|
79 |
+
}
|
80 |
+
|
81 |
+
return new ActionScheduler_LogEntry( $record->action_id, $record->message, $date );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Retrieve the an action's log entries from the database.
|
86 |
+
*
|
87 |
+
* @param int $action_id Action ID.
|
88 |
+
*
|
89 |
+
* @return ActionScheduler_LogEntry[]
|
90 |
+
*/
|
91 |
+
public function get_logs( $action_id ) {
|
92 |
+
/** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
93 |
+
global $wpdb;
|
94 |
+
|
95 |
+
$records = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->actionscheduler_logs} WHERE action_id=%d", $action_id ) );
|
96 |
+
|
97 |
+
return array_map( array( $this, 'create_entry_from_db_record' ), $records );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Initialize the data store.
|
102 |
+
*
|
103 |
+
* @codeCoverageIgnore
|
104 |
+
*/
|
105 |
+
public function init() {
|
106 |
+
$table_maker = new ActionScheduler_LoggerSchema();
|
107 |
+
$table_maker->init();
|
108 |
+
$table_maker->register_tables();
|
109 |
+
|
110 |
+
parent::init();
|
111 |
+
|
112 |
+
add_action( 'action_scheduler_deleted_action', array( $this, 'clear_deleted_action_logs' ), 10, 1 );
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Delete the action logs for an action.
|
117 |
+
*
|
118 |
+
* @param int $action_id Action ID.
|
119 |
+
*/
|
120 |
+
public function clear_deleted_action_logs( $action_id ) {
|
121 |
+
/** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
122 |
+
global $wpdb;
|
123 |
+
$wpdb->delete( $wpdb->actionscheduler_logs, array( 'action_id' => $action_id ), array( '%d' ) );
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Bulk add cancel action log entries.
|
128 |
+
*
|
129 |
+
* @param array $action_ids List of action ID.
|
130 |
+
*/
|
131 |
+
public function bulk_log_cancel_actions( $action_ids ) {
|
132 |
+
if ( empty( $action_ids ) ) {
|
133 |
+
return;
|
134 |
+
}
|
135 |
+
|
136 |
+
/** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
137 |
+
global $wpdb;
|
138 |
+
$date = as_get_datetime_object();
|
139 |
+
$date_gmt = $date->format( 'Y-m-d H:i:s' );
|
140 |
+
ActionScheduler_TimezoneHelper::set_local_timezone( $date );
|
141 |
+
$date_local = $date->format( 'Y-m-d H:i:s' );
|
142 |
+
$message = __( 'action canceled', 'action-scheduler' );
|
143 |
+
$format = '(%d, ' . $wpdb->prepare( '%s, %s, %s', $message, $date_gmt, $date_local ) . ')';
|
144 |
+
$sql_query = "INSERT {$wpdb->actionscheduler_logs} (action_id, message, log_date_gmt, log_date_local) VALUES ";
|
145 |
+
$value_rows = array();
|
146 |
+
|
147 |
+
foreach ( $action_ids as $action_id ) {
|
148 |
+
$value_rows[] = $wpdb->prepare( $format, $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
149 |
+
}
|
150 |
+
$sql_query .= implode( ',', $value_rows );
|
151 |
+
|
152 |
+
$wpdb->query( $sql_query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
153 |
+
}
|
154 |
+
}
|
vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php
ADDED
@@ -0,0 +1,1006 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_DBStore
|
5 |
+
*
|
6 |
+
* Action data table data store.
|
7 |
+
*
|
8 |
+
* @since 3.0.0
|
9 |
+
*/
|
10 |
+
class ActionScheduler_DBStore extends ActionScheduler_Store {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Used to share information about the before_date property of claims internally.
|
14 |
+
*
|
15 |
+
* This is used in preference to passing the same information as a method param
|
16 |
+
* for backwards-compatibility reasons.
|
17 |
+
*
|
18 |
+
* @var DateTime|null
|
19 |
+
*/
|
20 |
+
private $claim_before_date = null;
|
21 |
+
|
22 |
+
/** @var int */
|
23 |
+
protected static $max_args_length = 8000;
|
24 |
+
|
25 |
+
/** @var int */
|
26 |
+
protected static $max_index_length = 191;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Initialize the data store
|
30 |
+
*
|
31 |
+
* @codeCoverageIgnore
|
32 |
+
*/
|
33 |
+
public function init() {
|
34 |
+
$table_maker = new ActionScheduler_StoreSchema();
|
35 |
+
$table_maker->init();
|
36 |
+
$table_maker->register_tables();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Save an action, checks if this is a unique action before actually saving.
|
41 |
+
*
|
42 |
+
* @param ActionScheduler_Action $action Action object.
|
43 |
+
* @param \DateTime $scheduled_date Optional schedule date. Default null.
|
44 |
+
*
|
45 |
+
* @return int Action ID.
|
46 |
+
* @throws RuntimeException Throws exception when saving the action fails.
|
47 |
+
*/
|
48 |
+
public function save_unique_action( ActionScheduler_Action $action, \DateTime $scheduled_date = null ) {
|
49 |
+
return $this->save_action_to_db( $action, $scheduled_date, true );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Save an action. Can save duplicate action as well, prefer using `save_unique_action` instead.
|
54 |
+
*
|
55 |
+
* @param ActionScheduler_Action $action Action object.
|
56 |
+
* @param \DateTime $scheduled_date Optional schedule date. Default null.
|
57 |
+
*
|
58 |
+
* @return int Action ID.
|
59 |
+
* @throws RuntimeException Throws exception when saving the action fails.
|
60 |
+
*/
|
61 |
+
public function save_action( ActionScheduler_Action $action, \DateTime $scheduled_date = null ) {
|
62 |
+
return $this->save_action_to_db( $action, $scheduled_date, false );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Save an action.
|
67 |
+
*
|
68 |
+
* @param ActionScheduler_Action $action Action object.
|
69 |
+
* @param ?DateTime $date Optional schedule date. Default null.
|
70 |
+
* @param bool $unique Whether the action should be unique.
|
71 |
+
*
|
72 |
+
* @return int Action ID.
|
73 |
+
* @throws RuntimeException Throws exception when saving the action fails.
|
74 |
+
*/
|
75 |
+
private function save_action_to_db( ActionScheduler_Action $action, DateTime $date = null, $unique = false ) {
|
76 |
+
global $wpdb;
|
77 |
+
|
78 |
+
try {
|
79 |
+
$this->validate_action( $action );
|
80 |
+
|
81 |
+
$data = array(
|
82 |
+
'hook' => $action->get_hook(),
|
83 |
+
'status' => ( $action->is_finished() ? self::STATUS_COMPLETE : self::STATUS_PENDING ),
|
84 |
+
'scheduled_date_gmt' => $this->get_scheduled_date_string( $action, $date ),
|
85 |
+
'scheduled_date_local' => $this->get_scheduled_date_string_local( $action, $date ),
|
86 |
+
'schedule' => serialize( $action->get_schedule() ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
|
87 |
+
'group_id' => $this->get_group_id( $action->get_group() ),
|
88 |
+
);
|
89 |
+
|
90 |
+
$args = wp_json_encode( $action->get_args() );
|
91 |
+
if ( strlen( $args ) <= static::$max_index_length ) {
|
92 |
+
$data['args'] = $args;
|
93 |
+
} else {
|
94 |
+
$data['args'] = $this->hash_args( $args );
|
95 |
+
$data['extended_args'] = $args;
|
96 |
+
}
|
97 |
+
|
98 |
+
$insert_sql = $this->build_insert_sql( $data, $unique );
|
99 |
+
|
100 |
+
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $insert_sql should be already prepared.
|
101 |
+
$wpdb->query( $insert_sql );
|
102 |
+
$action_id = $wpdb->insert_id;
|
103 |
+
|
104 |
+
if ( is_wp_error( $action_id ) ) {
|
105 |
+
throw new \RuntimeException( $action_id->get_error_message() );
|
106 |
+
} elseif ( empty( $action_id ) ) {
|
107 |
+
if ( $unique ) {
|
108 |
+
return 0;
|
109 |
+
}
|
110 |
+
throw new \RuntimeException( $wpdb->last_error ? $wpdb->last_error : __( 'Database error.', 'action-scheduler' ) );
|
111 |
+
}
|
112 |
+
|
113 |
+
do_action( 'action_scheduler_stored_action', $action_id );
|
114 |
+
|
115 |
+
return $action_id;
|
116 |
+
} catch ( \Exception $e ) {
|
117 |
+
/* translators: %s: error message */
|
118 |
+
throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'action-scheduler' ), $e->getMessage() ), 0 );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Helper function to build insert query.
|
124 |
+
*
|
125 |
+
* @param array $data Row data for action.
|
126 |
+
* @param bool $unique Whether the action should be unique.
|
127 |
+
*
|
128 |
+
* @return string Insert query.
|
129 |
+
*/
|
130 |
+
private function build_insert_sql( array $data, $unique ) {
|
131 |
+
global $wpdb;
|
132 |
+
$columns = array_keys( $data );
|
133 |
+
$values = array_values( $data );
|
134 |
+
$placeholders = array_map( array( $this, 'get_placeholder_for_column' ), $columns );
|
135 |
+
|
136 |
+
$table_name = ! empty( $wpdb->actionscheduler_actions ) ? $wpdb->actionscheduler_actions : $wpdb->prefix . 'actionscheduler_actions';
|
137 |
+
|
138 |
+
$column_sql = '`' . implode( '`, `', $columns ) . '`';
|
139 |
+
$placeholder_sql = implode( ', ', $placeholders );
|
140 |
+
$where_clause = $this->build_where_clause_for_insert( $data, $table_name, $unique );
|
141 |
+
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $column_sql and $where_clause are already prepared. $placeholder_sql is hardcoded.
|
142 |
+
$insert_query = $wpdb->prepare(
|
143 |
+
"
|
144 |
+
INSERT INTO $table_name ( $column_sql )
|
145 |
+
SELECT $placeholder_sql FROM DUAL
|
146 |
+
WHERE ( $where_clause ) IS NULL",
|
147 |
+
$values
|
148 |
+
);
|
149 |
+
// phpcs:enable
|
150 |
+
|
151 |
+
return $insert_query;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Helper method to build where clause for action insert statement.
|
156 |
+
*
|
157 |
+
* @param array $data Row data for action.
|
158 |
+
* @param string $table_name Action table name.
|
159 |
+
* @param bool $unique Where action should be unique.
|
160 |
+
*
|
161 |
+
* @return string Where clause to be used with insert.
|
162 |
+
*/
|
163 |
+
private function build_where_clause_for_insert( $data, $table_name, $unique ) {
|
164 |
+
global $wpdb;
|
165 |
+
|
166 |
+
if ( ! $unique ) {
|
167 |
+
return 'SELECT NULL FROM DUAL';
|
168 |
+
}
|
169 |
+
|
170 |
+
$pending_statuses = array(
|
171 |
+
ActionScheduler_Store::STATUS_PENDING,
|
172 |
+
ActionScheduler_Store::STATUS_RUNNING,
|
173 |
+
);
|
174 |
+
$pending_status_placeholders = implode( ', ', array_fill( 0, count( $pending_statuses ), '%s' ) );
|
175 |
+
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $pending_status_placeholders is hardcoded.
|
176 |
+
$where_clause = $wpdb->prepare(
|
177 |
+
"
|
178 |
+
SELECT action_id FROM $table_name
|
179 |
+
WHERE status IN ( $pending_status_placeholders )
|
180 |
+
AND hook = %s
|
181 |
+
AND `group_id` = %d
|
182 |
+
",
|
183 |
+
array_merge(
|
184 |
+
$pending_statuses,
|
185 |
+
array(
|
186 |
+
$data['hook'],
|
187 |
+
$data['group_id'],
|
188 |
+
)
|
189 |
+
)
|
190 |
+
);
|
191 |
+
// phpcs:enable
|
192 |
+
|
193 |
+
return "$where_clause" . ' LIMIT 1';
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Helper method to get $wpdb->prepare placeholder for a given column name.
|
198 |
+
*
|
199 |
+
* @param string $column_name Name of column in actions table.
|
200 |
+
*
|
201 |
+
* @return string Placeholder to use for given column.
|
202 |
+
*/
|
203 |
+
private function get_placeholder_for_column( $column_name ) {
|
204 |
+
$string_columns = array(
|
205 |
+
'hook',
|
206 |
+
'status',
|
207 |
+
'scheduled_date_gmt',
|
208 |
+
'scheduled_date_local',
|
209 |
+
'args',
|
210 |
+
'schedule',
|
211 |
+
'last_attempt_gmt',
|
212 |
+
'last_attempt_local',
|
213 |
+
'extended_args',
|
214 |
+
);
|
215 |
+
|
216 |
+
return in_array( $column_name, $string_columns ) ? '%s' : '%d';
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Generate a hash from json_encoded $args using MD5 as this isn't for security.
|
221 |
+
*
|
222 |
+
* @param string $args JSON encoded action args.
|
223 |
+
* @return string
|
224 |
+
*/
|
225 |
+
protected function hash_args( $args ) {
|
226 |
+
return md5( $args );
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Get action args query param value from action args.
|
231 |
+
*
|
232 |
+
* @param array $args Action args.
|
233 |
+
* @return string
|
234 |
+
*/
|
235 |
+
protected function get_args_for_query( $args ) {
|
236 |
+
$encoded = wp_json_encode( $args );
|
237 |
+
if ( strlen( $encoded ) <= static::$max_index_length ) {
|
238 |
+
return $encoded;
|
239 |
+
}
|
240 |
+
return $this->hash_args( $encoded );
|
241 |
+
}
|
242 |
+
/**
|
243 |
+
* Get a group's ID based on its name/slug.
|
244 |
+
*
|
245 |
+
* @param string $slug The string name of a group.
|
246 |
+
* @param bool $create_if_not_exists Whether to create the group if it does not already exist. Default, true - create the group.
|
247 |
+
*
|
248 |
+
* @return int The group's ID, if it exists or is created, or 0 if it does not exist and is not created.
|
249 |
+
*/
|
250 |
+
protected function get_group_id( $slug, $create_if_not_exists = true ) {
|
251 |
+
if ( empty( $slug ) ) {
|
252 |
+
return 0;
|
253 |
+
}
|
254 |
+
/** @var \wpdb $wpdb */
|
255 |
+
global $wpdb;
|
256 |
+
$group_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT group_id FROM {$wpdb->actionscheduler_groups} WHERE slug=%s", $slug ) );
|
257 |
+
if ( empty( $group_id ) && $create_if_not_exists ) {
|
258 |
+
$group_id = $this->create_group( $slug );
|
259 |
+
}
|
260 |
+
|
261 |
+
return $group_id;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Create an action group.
|
266 |
+
*
|
267 |
+
* @param string $slug Group slug.
|
268 |
+
*
|
269 |
+
* @return int Group ID.
|
270 |
+
*/
|
271 |
+
protected function create_group( $slug ) {
|
272 |
+
/** @var \wpdb $wpdb */
|
273 |
+
global $wpdb;
|
274 |
+
$wpdb->insert( $wpdb->actionscheduler_groups, array( 'slug' => $slug ) );
|
275 |
+
|
276 |
+
return (int) $wpdb->insert_id;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Retrieve an action.
|
281 |
+
*
|
282 |
+
* @param int $action_id Action ID.
|
283 |
+
*
|
284 |
+
* @return ActionScheduler_Action
|
285 |
+
*/
|
286 |
+
public function fetch_action( $action_id ) {
|
287 |
+
/** @var \wpdb $wpdb */
|
288 |
+
global $wpdb;
|
289 |
+
$data = $wpdb->get_row(
|
290 |
+
$wpdb->prepare(
|
291 |
+
"SELECT a.*, g.slug AS `group` FROM {$wpdb->actionscheduler_actions} a LEFT JOIN {$wpdb->actionscheduler_groups} g ON a.group_id=g.group_id WHERE a.action_id=%d",
|
292 |
+
$action_id
|
293 |
+
)
|
294 |
+
);
|
295 |
+
|
296 |
+
if ( empty( $data ) ) {
|
297 |
+
return $this->get_null_action();
|
298 |
+
}
|
299 |
+
|
300 |
+
if ( ! empty( $data->extended_args ) ) {
|
301 |
+
$data->args = $data->extended_args;
|
302 |
+
unset( $data->extended_args );
|
303 |
+
}
|
304 |
+
|
305 |
+
// Convert NULL dates to zero dates.
|
306 |
+
$date_fields = array(
|
307 |
+
'scheduled_date_gmt',
|
308 |
+
'scheduled_date_local',
|
309 |
+
'last_attempt_gmt',
|
310 |
+
'last_attempt_gmt',
|
311 |
+
);
|
312 |
+
foreach ( $date_fields as $date_field ) {
|
313 |
+
if ( is_null( $data->$date_field ) ) {
|
314 |
+
$data->$date_field = ActionScheduler_StoreSchema::DEFAULT_DATE;
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
try {
|
319 |
+
$action = $this->make_action_from_db_record( $data );
|
320 |
+
} catch ( ActionScheduler_InvalidActionException $exception ) {
|
321 |
+
do_action( 'action_scheduler_failed_fetch_action', $action_id, $exception );
|
322 |
+
return $this->get_null_action();
|
323 |
+
}
|
324 |
+
|
325 |
+
return $action;
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Create a null action.
|
330 |
+
*
|
331 |
+
* @return ActionScheduler_NullAction
|
332 |
+
*/
|
333 |
+
protected function get_null_action() {
|
334 |
+
return new ActionScheduler_NullAction();
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Create an action from a database record.
|
339 |
+
*
|
340 |
+
* @param object $data Action database record.
|
341 |
+
*
|
342 |
+
* @return ActionScheduler_Action|ActionScheduler_CanceledAction|ActionScheduler_FinishedAction
|
343 |
+
*/
|
344 |
+
protected function make_action_from_db_record( $data ) {
|
345 |
+
|
346 |
+
$hook = $data->hook;
|
347 |
+
$args = json_decode( $data->args, true );
|
348 |
+
$schedule = unserialize( $data->schedule ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize
|
349 |
+
|
350 |
+
$this->validate_args( $args, $data->action_id );
|
351 |
+
$this->validate_schedule( $schedule, $data->action_id );
|
352 |
+
|
353 |
+
if ( empty( $schedule ) ) {
|
354 |
+
$schedule = new ActionScheduler_NullSchedule();
|
355 |
+
}
|
356 |
+
$group = $data->group ? $data->group : '';
|
357 |
+
|
358 |
+
return ActionScheduler::factory()->get_stored_action( $data->status, $data->hook, $args, $schedule, $group );
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Returns the SQL statement to query (or count) actions.
|
363 |
+
*
|
364 |
+
* @since 3.3.0 $query['status'] accepts array of statuses instead of a single status.
|
365 |
+
*
|
366 |
+
* @param array $query Filtering options.
|
367 |
+
* @param string $select_or_count Whether the SQL should select and return the IDs or just the row count.
|
368 |
+
*
|
369 |
+
* @return string SQL statement already properly escaped.
|
370 |
+
* @throws InvalidArgumentException If the query is invalid.
|
371 |
+
*/
|
372 |
+
protected function get_query_actions_sql( array $query, $select_or_count = 'select' ) {
|
373 |
+
|
374 |
+
if ( ! in_array( $select_or_count, array( 'select', 'count' ), true ) ) {
|
375 |
+
throw new InvalidArgumentException( __( 'Invalid value for select or count parameter. Cannot query actions.', 'action-scheduler' ) );
|
376 |
+
}
|
377 |
+
|
378 |
+
$query = wp_parse_args(
|
379 |
+
$query,
|
380 |
+
array(
|
381 |
+
'hook' => '',
|
382 |
+
'args' => null,
|
383 |
+
'date' => null,
|
384 |
+
'date_compare' => '<=',
|
385 |
+
'modified' => null,
|
386 |
+
'modified_compare' => '<=',
|
387 |
+
'group' => '',
|
388 |
+
'status' => '',
|
389 |
+
'claimed' => null,
|
390 |
+
'per_page' => 5,
|
391 |
+
'offset' => 0,
|
392 |
+
'orderby' => 'date',
|
393 |
+
'order' => 'ASC',
|
394 |
+
)
|
395 |
+
);
|
396 |
+
|
397 |
+
/** @var \wpdb $wpdb */
|
398 |
+
global $wpdb;
|
399 |
+
$sql = ( 'count' === $select_or_count ) ? 'SELECT count(a.action_id)' : 'SELECT a.action_id';
|
400 |
+
$sql .= " FROM {$wpdb->actionscheduler_actions} a";
|
401 |
+
$sql_params = array();
|
402 |
+
|
403 |
+
if ( ! empty( $query['group'] ) || 'group' === $query['orderby'] ) {
|
404 |
+
$sql .= " LEFT JOIN {$wpdb->actionscheduler_groups} g ON g.group_id=a.group_id";
|
405 |
+
}
|
406 |
+
|
407 |
+
$sql .= ' WHERE 1=1';
|
408 |
+
|
409 |
+
if ( ! empty( $query['group'] ) ) {
|
410 |
+
$sql .= ' AND g.slug=%s';
|
411 |
+
$sql_params[] = $query['group'];
|
412 |
+
}
|
413 |
+
|
414 |
+
if ( $query['hook'] ) {
|
415 |
+
$sql .= ' AND a.hook=%s';
|
416 |
+
$sql_params[] = $query['hook'];
|
417 |
+
}
|
418 |
+
if ( ! is_null( $query['args'] ) ) {
|
419 |
+
$sql .= ' AND a.args=%s';
|
420 |
+
$sql_params[] = $this->get_args_for_query( $query['args'] );
|
421 |
+
}
|
422 |
+
|
423 |
+
if ( $query['status'] ) {
|
424 |
+
$statuses = (array) $query['status'];
|
425 |
+
$placeholders = array_fill( 0, count( $statuses ), '%s' );
|
426 |
+
$sql .= ' AND a.status IN (' . join( ', ', $placeholders ) . ')';
|
427 |
+
$sql_params = array_merge( $sql_params, array_values( $statuses ) );
|
428 |
+
}
|
429 |
+
|
430 |
+
if ( $query['date'] instanceof \DateTime ) {
|
431 |
+
$date = clone $query['date'];
|
432 |
+
$date->setTimezone( new \DateTimeZone( 'UTC' ) );
|
433 |
+
$date_string = $date->format( 'Y-m-d H:i:s' );
|
434 |
+
$comparator = $this->validate_sql_comparator( $query['date_compare'] );
|
435 |
+
$sql .= " AND a.scheduled_date_gmt $comparator %s";
|
436 |
+
$sql_params[] = $date_string;
|
437 |
+
}
|
438 |
+
|
439 |
+
if ( $query['modified'] instanceof \DateTime ) {
|
440 |
+
$modified = clone $query['modified'];
|
441 |
+
$modified->setTimezone( new \DateTimeZone( 'UTC' ) );
|
442 |
+
$date_string = $modified->format( 'Y-m-d H:i:s' );
|
443 |
+
$comparator = $this->validate_sql_comparator( $query['modified_compare'] );
|
444 |
+
$sql .= " AND a.last_attempt_gmt $comparator %s";
|
445 |
+
$sql_params[] = $date_string;
|
446 |
+
}
|
447 |
+
|
448 |
+
if ( true === $query['claimed'] ) {
|
449 |
+
$sql .= ' AND a.claim_id != 0';
|
450 |
+
} elseif ( false === $query['claimed'] ) {
|
451 |
+
$sql .= ' AND a.claim_id = 0';
|
452 |
+
} elseif ( ! is_null( $query['claimed'] ) ) {
|
453 |
+
$sql .= ' AND a.claim_id = %d';
|
454 |
+
$sql_params[] = $query['claimed'];
|
455 |
+
}
|
456 |
+
|
457 |
+
if ( ! empty( $query['search'] ) ) {
|
458 |
+
$sql .= ' AND (a.hook LIKE %s OR (a.extended_args IS NULL AND a.args LIKE %s) OR a.extended_args LIKE %s';
|
459 |
+
for ( $i = 0; $i < 3; $i++ ) {
|
460 |
+
$sql_params[] = sprintf( '%%%s%%', $query['search'] );
|
461 |
+
}
|
462 |
+
|
463 |
+
$search_claim_id = (int) $query['search'];
|
464 |
+
if ( $search_claim_id ) {
|
465 |
+
$sql .= ' OR a.claim_id = %d';
|
466 |
+
$sql_params[] = $search_claim_id;
|
467 |
+
}
|
468 |
+
|
469 |
+
$sql .= ')';
|
470 |
+
}
|
471 |
+
|
472 |
+
if ( 'select' === $select_or_count ) {
|
473 |
+
if ( 'ASC' === strtoupper( $query['order'] ) ) {
|
474 |
+
$order = 'ASC';
|
475 |
+
} else {
|
476 |
+
$order = 'DESC';
|
477 |
+
}
|
478 |
+
switch ( $query['orderby'] ) {
|
479 |
+
case 'hook':
|
480 |
+
$sql .= " ORDER BY a.hook $order";
|
481 |
+
break;
|
482 |
+
case 'group':
|
483 |
+
$sql .= " ORDER BY g.slug $order";
|
484 |
+
break;
|
485 |
+
case 'modified':
|
486 |
+
$sql .= " ORDER BY a.last_attempt_gmt $order";
|
487 |
+
break;
|
488 |
+
case 'none':
|
489 |
+
break;
|
490 |
+
case 'action_id':
|
491 |
+
$sql .= " ORDER BY a.action_id $order";
|
492 |
+
break;
|
493 |
+
case 'date':
|
494 |
+
default:
|
495 |
+
$sql .= " ORDER BY a.scheduled_date_gmt $order";
|
496 |
+
break;
|
497 |
+
}
|
498 |
+
|
499 |
+
if ( $query['per_page'] > 0 ) {
|
500 |
+
$sql .= ' LIMIT %d, %d';
|
501 |
+
$sql_params[] = $query['offset'];
|
502 |
+
$sql_params[] = $query['per_page'];
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
if ( ! empty( $sql_params ) ) {
|
507 |
+
$sql = $wpdb->prepare( $sql, $sql_params ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
508 |
+
}
|
509 |
+
|
510 |
+
return $sql;
|
511 |
+
}
|
512 |
+
|
513 |
+
/**
|
514 |
+
* Query for action count or list of action IDs.
|
515 |
+
*
|
516 |
+
* @since 3.3.0 $query['status'] accepts array of statuses instead of a single status.
|
517 |
+
*
|
518 |
+
* @see ActionScheduler_Store::query_actions for $query arg usage.
|
519 |
+
*
|
520 |
+
* @param array $query Query filtering options.
|
521 |
+
* @param string $query_type Whether to select or count the results. Defaults to select.
|
522 |
+
*
|
523 |
+
* @return string|array|null The IDs of actions matching the query. Null on failure.
|
524 |
+
*/
|
525 |
+
public function query_actions( $query = array(), $query_type = 'select' ) {
|
526 |
+
/** @var wpdb $wpdb */
|
527 |
+
global $wpdb;
|
528 |
+
|
529 |
+
$sql = $this->get_query_actions_sql( $query, $query_type );
|
530 |
+
|
531 |
+
return ( 'count' === $query_type ) ? $wpdb->get_var( $sql ) : $wpdb->get_col( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoSql, WordPress.DB.DirectDatabaseQuery.NoCaching
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Get a count of all actions in the store, grouped by status.
|
536 |
+
*
|
537 |
+
* @return array Set of 'status' => int $count pairs for statuses with 1 or more actions of that status.
|
538 |
+
*/
|
539 |
+
public function action_counts() {
|
540 |
+
global $wpdb;
|
541 |
+
|
542 |
+
$sql = "SELECT a.status, count(a.status) as 'count'";
|
543 |
+
$sql .= " FROM {$wpdb->actionscheduler_actions} a";
|
544 |
+
$sql .= ' GROUP BY a.status';
|
545 |
+
|
546 |
+
$actions_count_by_status = array();
|
547 |
+
$action_stati_and_labels = $this->get_status_labels();
|
548 |
+
|
549 |
+
foreach ( $wpdb->get_results( $sql ) as $action_data ) { // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
550 |
+
// Ignore any actions with invalid status.
|
551 |
+
if ( array_key_exists( $action_data->status, $action_stati_and_labels ) ) {
|
552 |
+
$actions_count_by_status[ $action_data->status ] = $action_data->count;
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
return $actions_count_by_status;
|
557 |
+
}
|
558 |
+
|
559 |
+
/**
|
560 |
+
* Cancel an action.
|
561 |
+
*
|
562 |
+
* @param int $action_id Action ID.
|
563 |
+
*
|
564 |
+
* @return void
|
565 |
+
* @throws \InvalidArgumentException If the action update failed.
|
566 |
+
*/
|
567 |
+
public function cancel_action( $action_id ) {
|
568 |
+
/** @var \wpdb $wpdb */
|
569 |
+
global $wpdb;
|
570 |
+
|
571 |
+
$updated = $wpdb->update(
|
572 |
+
$wpdb->actionscheduler_actions,
|
573 |
+
array( 'status' => self::STATUS_CANCELED ),
|
574 |
+
array( 'action_id' => $action_id ),
|
575 |
+
array( '%s' ),
|
576 |
+
array( '%d' )
|
577 |
+
);
|
578 |
+
if ( false === $updated ) {
|
579 |
+
/* translators: %s: action ID */
|
580 |
+
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) );
|
581 |
+
}
|
582 |
+
do_action( 'action_scheduler_canceled_action', $action_id );
|
583 |
+
}
|
584 |
+
|
585 |
+
/**
|
586 |
+
* Cancel pending actions by hook.
|
587 |
+
*
|
588 |
+
* @since 3.0.0
|
589 |
+
*
|
590 |
+
* @param string $hook Hook name.
|
591 |
+
*
|
592 |
+
* @return void
|
593 |
+
*/
|
594 |
+
public function cancel_actions_by_hook( $hook ) {
|
595 |
+
$this->bulk_cancel_actions( array( 'hook' => $hook ) );
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Cancel pending actions by group.
|
600 |
+
*
|
601 |
+
* @param string $group Group slug.
|
602 |
+
*
|
603 |
+
* @return void
|
604 |
+
*/
|
605 |
+
public function cancel_actions_by_group( $group ) {
|
606 |
+
$this->bulk_cancel_actions( array( 'group' => $group ) );
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* Bulk cancel actions.
|
611 |
+
*
|
612 |
+
* @since 3.0.0
|
613 |
+
*
|
614 |
+
* @param array $query_args Query parameters.
|
615 |
+
*/
|
616 |
+
protected function bulk_cancel_actions( $query_args ) {
|
617 |
+
/** @var \wpdb $wpdb */
|
618 |
+
global $wpdb;
|
619 |
+
|
620 |
+
if ( ! is_array( $query_args ) ) {
|
621 |
+
return;
|
622 |
+
}
|
623 |
+
|
624 |
+
// Don't cancel actions that are already canceled.
|
625 |
+
if ( isset( $query_args['status'] ) && self::STATUS_CANCELED === $query_args['status'] ) {
|
626 |
+
return;
|
627 |
+
}
|
628 |
+
|
629 |
+
$action_ids = true;
|
630 |
+
$query_args = wp_parse_args(
|
631 |
+
$query_args,
|
632 |
+
array(
|
633 |
+
'per_page' => 1000,
|
634 |
+
'status' => self::STATUS_PENDING,
|
635 |
+
'orderby' => 'action_id',
|
636 |
+
)
|
637 |
+
);
|
638 |
+
|
639 |
+
while ( $action_ids ) {
|
640 |
+
$action_ids = $this->query_actions( $query_args );
|
641 |
+
if ( empty( $action_ids ) ) {
|
642 |
+
break;
|
643 |
+
}
|
644 |
+
|
645 |
+
$format = array_fill( 0, count( $action_ids ), '%d' );
|
646 |
+
$query_in = '(' . implode( ',', $format ) . ')';
|
647 |
+
$parameters = $action_ids;
|
648 |
+
array_unshift( $parameters, self::STATUS_CANCELED );
|
649 |
+
|
650 |
+
$wpdb->query(
|
651 |
+
$wpdb->prepare(
|
652 |
+
"UPDATE {$wpdb->actionscheduler_actions} SET status = %s WHERE action_id IN {$query_in}", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
653 |
+
$parameters
|
654 |
+
)
|
655 |
+
);
|
656 |
+
|
657 |
+
do_action( 'action_scheduler_bulk_cancel_actions', $action_ids );
|
658 |
+
}
|
659 |
+
}
|
660 |
+
|
661 |
+
/**
|
662 |
+
* Delete an action.
|
663 |
+
*
|
664 |
+
* @param int $action_id Action ID.
|
665 |
+
* @throws \InvalidArgumentException If the action deletion failed.
|
666 |
+
*/
|
667 |
+
public function delete_action( $action_id ) {
|
668 |
+
/** @var \wpdb $wpdb */
|
669 |
+
global $wpdb;
|
670 |
+
$deleted = $wpdb->delete( $wpdb->actionscheduler_actions, array( 'action_id' => $action_id ), array( '%d' ) );
|
671 |
+
if ( empty( $deleted ) ) {
|
672 |
+
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) ); //phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
|
673 |
+
}
|
674 |
+
do_action( 'action_scheduler_deleted_action', $action_id );
|
675 |
+
}
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Get the schedule date for an action.
|
679 |
+
*
|
680 |
+
* @param string $action_id Action ID.
|
681 |
+
*
|
682 |
+
* @return \DateTime The local date the action is scheduled to run, or the date that it ran.
|
683 |
+
*/
|
684 |
+
public function get_date( $action_id ) {
|
685 |
+
$date = $this->get_date_gmt( $action_id );
|
686 |
+
ActionScheduler_TimezoneHelper::set_local_timezone( $date );
|
687 |
+
return $date;
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Get the GMT schedule date for an action.
|
692 |
+
*
|
693 |
+
* @param int $action_id Action ID.
|
694 |
+
*
|
695 |
+
* @throws \InvalidArgumentException If action cannot be identified.
|
696 |
+
* @return \DateTime The GMT date the action is scheduled to run, or the date that it ran.
|
697 |
+
*/
|
698 |
+
protected function get_date_gmt( $action_id ) {
|
699 |
+
/** @var \wpdb $wpdb */
|
700 |
+
global $wpdb;
|
701 |
+
$record = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d", $action_id ) );
|
702 |
+
if ( empty( $record ) ) {
|
703 |
+
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) ); //phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
|
704 |
+
}
|
705 |
+
if ( self::STATUS_PENDING === $record->status ) {
|
706 |
+
return as_get_datetime_object( $record->scheduled_date_gmt );
|
707 |
+
} else {
|
708 |
+
return as_get_datetime_object( $record->last_attempt_gmt );
|
709 |
+
}
|
710 |
+
}
|
711 |
+
|
712 |
+
/**
|
713 |
+
* Stake a claim on actions.
|
714 |
+
*
|
715 |
+
* @param int $max_actions Maximum number of action to include in claim.
|
716 |
+
* @param \DateTime $before_date Jobs must be schedule before this date. Defaults to now.
|
717 |
+
* @param array $hooks Hooks to filter for.
|
718 |
+
* @param string $group Group to filter for.
|
719 |
+
*
|
720 |
+
* @return ActionScheduler_ActionClaim
|
721 |
+
*/
|
722 |
+
public function stake_claim( $max_actions = 10, \DateTime $before_date = null, $hooks = array(), $group = '' ) {
|
723 |
+
$claim_id = $this->generate_claim_id();
|
724 |
+
|
725 |
+
$this->claim_before_date = $before_date;
|
726 |
+
$this->claim_actions( $claim_id, $max_actions, $before_date, $hooks, $group );
|
727 |
+
$action_ids = $this->find_actions_by_claim_id( $claim_id );
|
728 |
+
$this->claim_before_date = null;
|
729 |
+
|
730 |
+
return new ActionScheduler_ActionClaim( $claim_id, $action_ids );
|
731 |
+
}
|
732 |
+
|
733 |
+
/**
|
734 |
+
* Generate a new action claim.
|
735 |
+
*
|
736 |
+
* @return int Claim ID.
|
737 |
+
*/
|
738 |
+
protected function generate_claim_id() {
|
739 |
+
/** @var \wpdb $wpdb */
|
740 |
+
global $wpdb;
|
741 |
+
$now = as_get_datetime_object();
|
742 |
+
$wpdb->insert( $wpdb->actionscheduler_claims, array( 'date_created_gmt' => $now->format( 'Y-m-d H:i:s' ) ) );
|
743 |
+
|
744 |
+
return $wpdb->insert_id;
|
745 |
+
}
|
746 |
+
|
747 |
+
/**
|
748 |
+
* Mark actions claimed.
|
749 |
+
*
|
750 |
+
* @param string $claim_id Claim Id.
|
751 |
+
* @param int $limit Number of action to include in claim.
|
752 |
+
* @param \DateTime $before_date Should use UTC timezone.
|
753 |
+
* @param array $hooks Hooks to filter for.
|
754 |
+
* @param string $group Group to filter for.
|
755 |
+
*
|
756 |
+
* @return int The number of actions that were claimed.
|
757 |
+
* @throws \InvalidArgumentException Throws InvalidArgumentException if group doesn't exist.
|
758 |
+
* @throws \RuntimeException Throws RuntimeException if unable to claim action.
|
759 |
+
*/
|
760 |
+
protected function claim_actions( $claim_id, $limit, \DateTime $before_date = null, $hooks = array(), $group = '' ) {
|
761 |
+
/** @var \wpdb $wpdb */
|
762 |
+
global $wpdb;
|
763 |
+
|
764 |
+
$now = as_get_datetime_object();
|
765 |
+
$date = is_null( $before_date ) ? $now : clone $before_date;
|
766 |
+
|
767 |
+
// can't use $wpdb->update() because of the <= condition.
|
768 |
+
$update = "UPDATE {$wpdb->actionscheduler_actions} SET claim_id=%d, last_attempt_gmt=%s, last_attempt_local=%s";
|
769 |
+
$params = array(
|
770 |
+
$claim_id,
|
771 |
+
$now->format( 'Y-m-d H:i:s' ),
|
772 |
+
current_time( 'mysql' ),
|
773 |
+
);
|
774 |
+
|
775 |
+
$where = 'WHERE claim_id = 0 AND scheduled_date_gmt <= %s AND status=%s';
|
776 |
+
$params[] = $date->format( 'Y-m-d H:i:s' );
|
777 |
+
$params[] = self::STATUS_PENDING;
|
778 |
+
|
779 |
+
if ( ! empty( $hooks ) ) {
|
780 |
+
$placeholders = array_fill( 0, count( $hooks ), '%s' );
|
781 |
+
$where .= ' AND hook IN (' . join( ', ', $placeholders ) . ')';
|
782 |
+
$params = array_merge( $params, array_values( $hooks ) );
|
783 |
+
}
|
784 |
+
|
785 |
+
if ( ! empty( $group ) ) {
|
786 |
+
|
787 |
+
$group_id = $this->get_group_id( $group, false );
|
788 |
+
|
789 |
+
// throw exception if no matching group found, this matches ActionScheduler_wpPostStore's behaviour.
|
790 |
+
if ( empty( $group_id ) ) {
|
791 |
+
/* translators: %s: group name */
|
792 |
+
throw new InvalidArgumentException( sprintf( __( 'The group "%s" does not exist.', 'action-scheduler' ), $group ) );
|
793 |
+
}
|
794 |
+
|
795 |
+
$where .= ' AND group_id = %d';
|
796 |
+
$params[] = $group_id;
|
797 |
+
}
|
798 |
+
|
799 |
+
/**
|
800 |
+
* Sets the order-by clause used in the action claim query.
|
801 |
+
*
|
802 |
+
* @since 3.4.0
|
803 |
+
*
|
804 |
+
* @param string $order_by_sql
|
805 |
+
*/
|
806 |
+
$order = apply_filters( 'action_scheduler_claim_actions_order_by', 'ORDER BY attempts ASC, scheduled_date_gmt ASC, action_id ASC' );
|
807 |
+
$params[] = $limit;
|
808 |
+
|
809 |
+
$sql = $wpdb->prepare( "{$update} {$where} {$order} LIMIT %d", $params ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders
|
810 |
+
$rows_affected = $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
811 |
+
if ( false === $rows_affected ) {
|
812 |
+
throw new \RuntimeException( __( 'Unable to claim actions. Database error.', 'action-scheduler' ) );
|
813 |
+
}
|
814 |
+
|
815 |
+
return (int) $rows_affected;
|
816 |
+
}
|
817 |
+
|
818 |
+
/**
|
819 |
+
* Get the number of active claims.
|
820 |
+
*
|
821 |
+
* @return int
|
822 |
+
*/
|
823 |
+
public function get_claim_count() {
|
824 |
+
global $wpdb;
|
825 |
+
|
826 |
+
$sql = "SELECT COUNT(DISTINCT claim_id) FROM {$wpdb->actionscheduler_actions} WHERE claim_id != 0 AND status IN ( %s, %s)";
|
827 |
+
$sql = $wpdb->prepare( $sql, array( self::STATUS_PENDING, self::STATUS_RUNNING ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
828 |
+
|
829 |
+
return (int) $wpdb->get_var( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
830 |
+
}
|
831 |
+
|
832 |
+
/**
|
833 |
+
* Return an action's claim ID, as stored in the claim_id column.
|
834 |
+
*
|
835 |
+
* @param string $action_id Action ID.
|
836 |
+
* @return mixed
|
837 |
+
*/
|
838 |
+
public function get_claim_id( $action_id ) {
|
839 |
+
/** @var \wpdb $wpdb */
|
840 |
+
global $wpdb;
|
841 |
+
|
842 |
+
$sql = "SELECT claim_id FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d";
|
843 |
+
$sql = $wpdb->prepare( $sql, $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
844 |
+
|
845 |
+
return (int) $wpdb->get_var( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
846 |
+
}
|
847 |
+
|
848 |
+
/**
|
849 |
+
* Retrieve the action IDs of action in a claim.
|
850 |
+
*
|
851 |
+
* @param int $claim_id Claim ID.
|
852 |
+
* @return int[]
|
853 |
+
*/
|
854 |
+
public function find_actions_by_claim_id( $claim_id ) {
|
855 |
+
/** @var \wpdb $wpdb */
|
856 |
+
global $wpdb;
|
857 |
+
|
858 |
+
$action_ids = array();
|
859 |
+
$before_date = isset( $this->claim_before_date ) ? $this->claim_before_date : as_get_datetime_object();
|
860 |
+
$cut_off = $before_date->format( 'Y-m-d H:i:s' );
|
861 |
+
|
862 |
+
$sql = $wpdb->prepare(
|
863 |
+
"SELECT action_id, scheduled_date_gmt FROM {$wpdb->actionscheduler_actions} WHERE claim_id = %d",
|
864 |
+
$claim_id
|
865 |
+
);
|
866 |
+
|
867 |
+
// Verify that the scheduled date for each action is within the expected bounds (in some unusual
|
868 |
+
// cases, we cannot depend on MySQL to honor all of the WHERE conditions we specify).
|
869 |
+
foreach ( $wpdb->get_results( $sql ) as $claimed_action ) { // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
870 |
+
if ( $claimed_action->scheduled_date_gmt <= $cut_off ) {
|
871 |
+
$action_ids[] = absint( $claimed_action->action_id );
|
872 |
+
}
|
873 |
+
}
|
874 |
+
|
875 |
+
return $action_ids;
|
876 |
+
}
|
877 |
+
|
878 |
+
/**
|
879 |
+
* Release actions from a claim and delete the claim.
|
880 |
+
*
|
881 |
+
* @param ActionScheduler_ActionClaim $claim Claim object.
|
882 |
+
*/
|
883 |
+
public function release_claim( ActionScheduler_ActionClaim $claim ) {
|
884 |
+
/** @var \wpdb $wpdb */
|
885 |
+
global $wpdb;
|
886 |
+
$wpdb->update( $wpdb->actionscheduler_actions, array( 'claim_id' => 0 ), array( 'claim_id' => $claim->get_id() ), array( '%d' ), array( '%d' ) );
|
887 |
+
$wpdb->delete( $wpdb->actionscheduler_claims, array( 'claim_id' => $claim->get_id() ), array( '%d' ) );
|
888 |
+
}
|
889 |
+
|
890 |
+
/**
|
891 |
+
* Remove the claim from an action.
|
892 |
+
*
|
893 |
+
* @param int $action_id Action ID.
|
894 |
+
*
|
895 |
+
* @return void
|
896 |
+
*/
|
897 |
+
public function unclaim_action( $action_id ) {
|
898 |
+
/** @var \wpdb $wpdb */
|
899 |
+
global $wpdb;
|
900 |
+
$wpdb->update(
|
901 |
+
$wpdb->actionscheduler_actions,
|
902 |
+
array( 'claim_id' => 0 ),
|
903 |
+
array( 'action_id' => $action_id ),
|
904 |
+
array( '%s' ),
|
905 |
+
array( '%d' )
|
906 |
+
);
|
907 |
+
}
|
908 |
+
|
909 |
+
/**
|
910 |
+
* Mark an action as failed.
|
911 |
+
*
|
912 |
+
* @param int $action_id Action ID.
|
913 |
+
* @throws \InvalidArgumentException Throw an exception if action was not updated.
|
914 |
+
*/
|
915 |
+
public function mark_failure( $action_id ) {
|
916 |
+
/** @var \wpdb $wpdb */
|
917 |
+
global $wpdb;
|
918 |
+
$updated = $wpdb->update(
|
919 |
+
$wpdb->actionscheduler_actions,
|
920 |
+
array( 'status' => self::STATUS_FAILED ),
|
921 |
+
array( 'action_id' => $action_id ),
|
922 |
+
array( '%s' ),
|
923 |
+
array( '%d' )
|
924 |
+
);
|
925 |
+
if ( empty( $updated ) ) {
|
926 |
+
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) ); //phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
|
927 |
+
}
|
928 |
+
}
|
929 |
+
|
930 |
+
/**
|
931 |
+
* Add execution message to action log.
|
932 |
+
*
|
933 |
+
* @param int $action_id Action ID.
|
934 |
+
*
|
935 |
+
* @return void
|
936 |
+
*/
|
937 |
+
public function log_execution( $action_id ) {
|
938 |
+
/** @var \wpdb $wpdb */
|
939 |
+
global $wpdb;
|
940 |
+
|
941 |
+
$sql = "UPDATE {$wpdb->actionscheduler_actions} SET attempts = attempts+1, status=%s, last_attempt_gmt = %s, last_attempt_local = %s WHERE action_id = %d";
|
942 |
+
$sql = $wpdb->prepare( $sql, self::STATUS_RUNNING, current_time( 'mysql', true ), current_time( 'mysql' ), $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
943 |
+
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
944 |
+
}
|
945 |
+
|
946 |
+
/**
|
947 |
+
* Mark an action as complete.
|
948 |
+
*
|
949 |
+
* @param int $action_id Action ID.
|
950 |
+
*
|
951 |
+
* @return void
|
952 |
+
* @throws \InvalidArgumentException Throw an exception if action was not updated.
|
953 |
+
*/
|
954 |
+
public function mark_complete( $action_id ) {
|
955 |
+
/** @var \wpdb $wpdb */
|
956 |
+
global $wpdb;
|
957 |
+
$updated = $wpdb->update(
|
958 |
+
$wpdb->actionscheduler_actions,
|
959 |
+
array(
|
960 |
+
'status' => self::STATUS_COMPLETE,
|
961 |
+
'last_attempt_gmt' => current_time( 'mysql', true ),
|
962 |
+
'last_attempt_local' => current_time( 'mysql' ),
|
963 |
+
),
|
964 |
+
array( 'action_id' => $action_id ),
|
965 |
+
array( '%s' ),
|
966 |
+
array( '%d' )
|
967 |
+
);
|
968 |
+
if ( empty( $updated ) ) {
|
969 |
+
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) ); //phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
|
970 |
+
}
|
971 |
+
|
972 |
+
/**
|
973 |
+
* Fires after a scheduled action has been completed.
|
974 |
+
*
|
975 |
+
* @since 3.4.2
|
976 |
+
*
|
977 |
+
* @param int $action_id Action ID.
|
978 |
+
*/
|
979 |
+
do_action( 'action_scheduler_completed_action', $action_id );
|
980 |
+
}
|
981 |
+
|
982 |
+
/**
|
983 |
+
* Get an action's status.
|
984 |
+
*
|
985 |
+
* @param int $action_id Action ID.
|
986 |
+
*
|
987 |
+
* @return string
|
988 |
+
* @throws \InvalidArgumentException Throw an exception if not status was found for action_id.
|
989 |
+
* @throws \RuntimeException Throw an exception if action status could not be retrieved.
|
990 |
+
*/
|
991 |
+
public function get_status( $action_id ) {
|
992 |
+
/** @var \wpdb $wpdb */
|
993 |
+
global $wpdb;
|
994 |
+
$sql = "SELECT status FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d";
|
995 |
+
$sql = $wpdb->prepare( $sql, $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
996 |
+
$status = $wpdb->get_var( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
997 |
+
|
998 |
+
if ( null === $status ) {
|
999 |
+
throw new \InvalidArgumentException( __( 'Invalid action ID. No status found.', 'action-scheduler' ) );
|
1000 |
+
} elseif ( empty( $status ) ) {
|
1001 |
+
throw new \RuntimeException( __( 'Unknown status found for action.', 'action-scheduler' ) );
|
1002 |
+
} else {
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use ActionScheduler_Store as Store;
|
4 |
+
use Action_Scheduler\Migration\Runner;
|
5 |
+
use Action_Scheduler\Migration\Config;
|
6 |
+
use Action_Scheduler\Migration\Controller;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class ActionScheduler_HybridStore
|
10 |
+
*
|
11 |
+
* A wrapper around multiple stores that fetches data from both.
|
12 |
+
*
|
13 |
+
* @since 3.0.0
|
14 |
+
*/
|
15 |
+
class ActionScheduler_HybridStore extends Store {
|
16 |
+
const DEMARKATION_OPTION = 'action_scheduler_hybrid_store_demarkation';
|
17 |
+
|
18 |
+
private $primary_store;
|
19 |
+
private $secondary_store;
|
20 |
+
private $migration_runner;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var int The dividing line between IDs of actions created
|
24 |
+
* by the primary and secondary stores.
|
25 |
+
*
|
26 |
+
* Methods that accept an action ID will compare the ID against
|
27 |
+
* this to determine which store will contain that ID. In almost
|
28 |
+
* all cases, the ID should come from the primary store, but if
|
29 |
+
* client code is bypassing the API functions and fetching IDs
|
30 |
+
* from elsewhere, then there is a chance that an unmigrated ID
|
31 |
+
* might be requested.
|
32 |
+
*/
|
33 |
+
private $demarkation_id = 0;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* ActionScheduler_HybridStore constructor.
|
37 |
+
*
|
38 |
+
* @param Config $config Migration config object.
|
39 |
+
*/
|
40 |
+
public function __construct( Config $config = null ) {
|
41 |
+
$this->demarkation_id = (int) get_option( self::DEMARKATION_OPTION, 0 );
|
42 |
+
if ( empty( $config ) ) {
|
43 |
+
$config = Controller::instance()->get_migration_config_object();
|
44 |
+
}
|
45 |
+
$this->primary_store = $config->get_destination_store();
|
46 |
+
$this->secondary_store = $config->get_source_store();
|
47 |
+
$this->migration_runner = new Runner( $config );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Initialize the table data store tables.
|
52 |
+
*
|
53 |
+
* @codeCoverageIgnore
|
54 |
+
*/
|
55 |
+
public function init() {
|
56 |
+
add_action( 'action_scheduler/created_table', [ $this, 'set_autoincrement' ], 10, 2 );
|
57 |
+
$this->primary_store->init();
|
58 |
+
$this->secondary_store->init();
|
59 |
+
remove_action( 'action_scheduler/created_table', [ $this, 'set_autoincrement' ], 10 );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* When the actions table is created, set its autoincrement
|
64 |
+
* value to be one higher than the posts table to ensure that
|
65 |
+
* there are no ID collisions.
|
66 |
+
*
|
67 |
+
* @param string $table_name
|
68 |
+
* @param string $table_suffix
|
69 |
+
*
|
70 |
+
* @return void
|
71 |
+
* @codeCoverageIgnore
|
72 |
+
*/
|
73 |
+
public function set_autoincrement( $table_name, $table_suffix ) {
|
74 |
+
if ( ActionScheduler_StoreSchema::ACTIONS_TABLE === $table_suffix ) {
|
75 |
+
if ( empty( $this->demarkation_id ) ) {
|
76 |
+
$this->demarkation_id = $this->set_demarkation_id();
|
77 |
+
}
|
78 |
+
/** @var \wpdb $wpdb */
|
79 |
+
global $wpdb;
|
80 |
+
/**
|
81 |
+
* A default date of '0000-00-00 00:00:00' is invalid in MySQL 5.7 when configured with
|
82 |
+
* sql_mode including both STRICT_TRANS_TABLES and NO_ZERO_DATE.
|
83 |
+
*/
|
84 |
+
$default_date = new DateTime( 'tomorrow' );
|
85 |
+
$null_action = new ActionScheduler_NullAction();
|
86 |
+
$date_gmt = $this->get_scheduled_date_string( $null_action, $default_date );
|
87 |
+
$date_local = $this->get_scheduled_date_string_local( $null_action, $default_date );
|
88 |
+
|
89 |
+
$row_count = $wpdb->insert(
|
90 |
+
$wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE},
|
91 |
+
[
|
92 |
+
'action_id' => $this->demarkation_id,
|
93 |
+
'hook' => '',
|
94 |
+
'status' => '',
|
95 |
+
'scheduled_date_gmt' => $date_gmt,
|
96 |
+
'scheduled_date_local' => $date_local,
|
97 |
+
'last_attempt_gmt' => $date_gmt,
|
98 |
+
'last_attempt_local' => $date_local,
|
99 |
+
]
|
100 |
+
);
|
101 |
+
if ( $row_count > 0 ) {
|
102 |
+
$wpdb->delete(
|
103 |
+
$wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE},
|
104 |
+
[ 'action_id' => $this->demarkation_id ]
|
105 |
+
);
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Store the demarkation id in WP options.
|
112 |
+
*
|
113 |
+
* @param int $id The ID to set as the demarkation point between the two stores
|
114 |
+
* Leave null to use the next ID from the WP posts table.
|
115 |
+
*
|
116 |
+
* @return int The new ID.
|
117 |
+
*
|
118 |
+
* @codeCoverageIgnore
|
119 |
+
*/
|
120 |
+
private function set_demarkation_id( $id = null ) {
|
121 |
+
if ( empty( $id ) ) {
|
122 |
+
/** @var \wpdb $wpdb */
|
123 |
+
global $wpdb;
|
124 |
+
$id = (int) $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" );
|
125 |
+
$id ++;
|
126 |
+
}
|
127 |
+
update_option( self::DEMARKATION_OPTION, $id );
|
128 |
+
|
129 |
+
return $id;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Find the first matching action from the secondary store.
|
134 |
+
* If it exists, migrate it to the primary store immediately.
|
135 |
+
* After it migrates, the secondary store will logically contain
|
136 |
+
* the next matching action, so return the result thence.
|
137 |
+
*
|
138 |
+
* @param string $hook
|
139 |
+
* @param array $params
|
140 |
+
*
|
141 |
+
* @return string
|
142 |
+
*/
|
143 |
+
public function find_action( $hook, $params = [] ) {
|
144 |
+
$found_unmigrated_action = $this->secondary_store->find_action( $hook, $params );
|
145 |
+
if ( ! empty( $found_unmigrated_action ) ) {
|
146 |
+
$this->migrate( [ $found_unmigrated_action ] );
|
147 |
+
}
|
148 |
+
|
149 |
+
return $this->primary_store->find_action( $hook, $params );
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Find actions matching the query in the secondary source first.
|
154 |
+
* If any are found, migrate them immediately. Then the secondary
|
155 |
+
* store will contain the canonical results.
|
156 |
+
*
|
157 |
+
* @param array $query
|
158 |
+
* @param string $query_type Whether to select or count the results. Default, select.
|
159 |
+
*
|
160 |
+
* @return int[]
|
161 |
+
*/
|
162 |
+
public function query_actions( $query = [], $query_type = 'select' ) {
|
163 |
+
$found_unmigrated_actions = $this->secondary_store->query_actions( $query, 'select' );
|
164 |
+
if ( ! empty( $found_unmigrated_actions ) ) {
|
165 |
+
$this->migrate( $found_unmigrated_actions );
|
166 |
+
}
|
167 |
+
|
168 |
+
return $this->primary_store->query_actions( $query, $query_type );
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get a count of all actions in the store, grouped by status
|
173 |
+
*
|
174 |
+
* @return array Set of 'status' => int $count pairs for statuses with 1 or more actions of that status.
|
175 |
+
*/
|
176 |
+
public function action_counts() {
|
177 |
+
$unmigrated_actions_count = $this->secondary_store->action_counts();
|
178 |
+
$migrated_actions_count = $this->primary_store->action_counts();
|
179 |
+
$actions_count_by_status = array();
|
180 |
+
|
181 |
+
foreach ( $this->get_status_labels() as $status_key => $status_label ) {
|
182 |
+
|
183 |
+
$count = 0;
|
184 |
+
|
185 |
+
if ( isset( $unmigrated_actions_count[ $status_key ] ) ) {
|
186 |
+
$count += $unmigrated_actions_count[ $status_key ];
|
187 |
+
}
|
188 |
+
|
189 |
+
if ( isset( $migrated_actions_count[ $status_key ] ) ) {
|
190 |
+
$count += $migrated_actions_count[ $status_key ];
|
191 |
+
}
|
192 |
+
|
193 |
+
$actions_count_by_status[ $status_key ] = $count;
|
194 |
+
}
|
195 |
+
|
196 |
+
$actions_count_by_status = array_filter( $actions_count_by_status );
|
197 |
+
|
198 |
+
return $actions_count_by_status;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* If any actions would have been claimed by the secondary store,
|
203 |
+
* migrate them immediately, then ask the primary store for the
|
204 |
+
* canonical claim.
|
205 |
+
*
|
206 |
+
* @param int $max_actions
|
207 |
+
* @param DateTime|null $before_date
|
208 |
+
*
|
209 |
+
* @return ActionScheduler_ActionClaim
|
210 |
+
*/
|
211 |
+
public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) {
|
212 |
+
$claim = $this->secondary_store->stake_claim( $max_actions, $before_date, $hooks, $group );
|
213 |
+
|
214 |
+
$claimed_actions = $claim->get_actions();
|
215 |
+
if ( ! empty( $claimed_actions ) ) {
|
216 |
+
$this->migrate( $claimed_actions );
|
217 |
+
}
|
218 |
+
|
219 |
+
$this->secondary_store->release_claim( $claim );
|
220 |
+
|
221 |
+
return $this->primary_store->stake_claim( $max_actions, $before_date, $hooks, $group );
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Migrate a list of actions to the table data store.
|
226 |
+
*
|
227 |
+
* @param array $action_ids List of action IDs.
|
228 |
+
*/
|
229 |
+
private function migrate( $action_ids ) {
|
230 |
+
$this->migration_runner->migrate_actions( $action_ids );
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Save an action to the primary store.
|
235 |
+
*
|
236 |
+
* @param ActionScheduler_Action $action Action object to be saved.
|
237 |
+
* @param DateTime $date Optional. Schedule date. Default null.
|
238 |
+
*
|
239 |
+
* @return int The action ID
|
240 |
+
*/
|
241 |
+
public function save_action( ActionScheduler_Action $action, DateTime $date = null ) {
|
242 |
+
return $this->primary_store->save_action( $action, $date );
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Retrieve an existing action whether migrated or not.
|
247 |
+
*
|
248 |
+
* @param int $action_id Action ID.
|
249 |
+
*/
|
250 |
+
public function fetch_action( $action_id ) {
|
251 |
+
$store = $this->get_store_from_action_id( $action_id, true );
|
252 |
+
if ( $store ) {
|
253 |
+
return $store->fetch_action( $action_id );
|
254 |
+
} else {
|
255 |
+
return new ActionScheduler_NullAction();
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Cancel an existing action whether migrated or not.
|
261 |
+
*
|
262 |
+
* @param int $action_id Action ID.
|
263 |
+
*/
|
264 |
+
public function cancel_action( $action_id ) {
|
265 |
+
$store = $this->get_store_from_action_id( $action_id );
|
266 |
+
if ( $store ) {
|
267 |
+
$store->cancel_action( $action_id );
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Delete an existing action whether migrated or not.
|
273 |
+
*
|
274 |
+
* @param int $action_id Action ID.
|
275 |
+
*/
|
276 |
+
public function delete_action( $action_id ) {
|
277 |
+
$store = $this->get_store_from_action_id( $action_id );
|
278 |
+
if ( $store ) {
|
279 |
+
$store->delete_action( $action_id );
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Get the schedule date an existing action whether migrated or not.
|
285 |
+
*
|
286 |
+
* @param int $action_id Action ID.
|
287 |
+
*/
|
288 |
+
public function get_date( $action_id ) {
|
289 |
+
$store = $this->get_store_from_action_id( $action_id );
|
290 |
+
if ( $store ) {
|
291 |
+
return $store->get_date( $action_id );
|
292 |
+
} else {
|
293 |
+
return null;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Mark an existing action as failed whether migrated or not.
|
299 |
+
*
|
300 |
+
* @param int $action_id Action ID.
|
301 |
+
*/
|
302 |
+
public function mark_failure( $action_id ) {
|
303 |
+
$store = $this->get_store_from_action_id( $action_id );
|
304 |
+
if ( $store ) {
|
305 |
+
$store->mark_failure( $action_id );
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Log the execution of an existing action whether migrated or not.
|
311 |
+
*
|
312 |
+
* @param int $action_id Action ID.
|
313 |
+
*/
|
314 |
+
public function log_execution( $action_id ) {
|
315 |
+
$store = $this->get_store_from_action_id( $action_id );
|
316 |
+
if ( $store ) {
|
317 |
+
$store->log_execution( $action_id );
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Mark an existing action complete whether migrated or not.
|
323 |
+
*
|
324 |
+
* @param int $action_id Action ID.
|
325 |
+
*/
|
326 |
+
public function mark_complete( $action_id ) {
|
327 |
+
$store = $this->get_store_from_action_id( $action_id );
|
328 |
+
if ( $store ) {
|
329 |
+
$store->mark_complete( $action_id );
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Get an existing action status whether migrated or not.
|
335 |
+
*
|
336 |
+
* @param int $action_id Action ID.
|
337 |
+
*/
|
338 |
+
public function get_status( $action_id ) {
|
339 |
+
$store = $this->get_store_from_action_id( $action_id );
|
340 |
+
if ( $store ) {
|
341 |
+
return $store->get_status( $action_id );
|
342 |
+
}
|
343 |
+
return null;
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Return which store an action is stored in.
|
348 |
+
*
|
349 |
+
* @param int $action_id ID of the action.
|
350 |
+
* @param bool $primary_first Optional flag indicating search the primary store first.
|
351 |
+
* @return ActionScheduler_Store
|
352 |
+
*/
|
353 |
+
protected function get_store_from_action_id( $action_id, $primary_first = false ) {
|
354 |
+
if ( $primary_first ) {
|
355 |
+
$stores = [
|
356 |
+
$this->primary_store,
|
357 |
+
$this->secondary_store,
|
358 |
+
];
|
359 |
+
} elseif ( $action_id < $this->demarkation_id ) {
|
360 |
+
$stores = [
|
361 |
+
$this->secondary_store,
|
362 |
+
$this->primary_store,
|
363 |
+
];
|
364 |
+
} else {
|
365 |
+
$stores = [
|
366 |
+
$this->primary_store,
|
367 |
+
];
|
368 |
+
}
|
369 |
+
|
370 |
+
foreach ( $stores as $store ) {
|
371 |
+
$action = $store->fetch_action( $action_id );
|
372 |
+
if ( ! is_a( $action, 'ActionScheduler_NullAction' ) ) {
|
373 |
+
return $store;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
return null;
|
377 |
+
}
|
378 |
+
|
379 |
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
380 |
+
* All claim-related functions should operate solely
|
381 |
+
* on the primary store.
|
382 |
+
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Get the claim count from the table data store.
|
386 |
+
*/
|
387 |
+
public function get_claim_count() {
|
388 |
+
return $this->primary_store->get_claim_count();
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Retrieve the claim ID for an action from the table data store.
|
393 |
+
*
|
394 |
+
* @param int $action_id Action ID.
|
395 |
+
*/
|
396 |
+
public function get_claim_id( $action_id ) {
|
397 |
+
return $this->primary_store->get_claim_id( $action_id );
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* Release a claim in the table data store.
|
402 |
+
*
|
403 |
+
* @param ActionScheduler_ActionClaim $claim Claim object.
|
404 |
+
*/
|
405 |
+
public function release_claim( ActionScheduler_ActionClaim $claim ) {
|
406 |
+
$this->primary_store->release_claim( $claim );
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Release claims on an action in the table data store.
|
411 |
+
*
|
412 |
+
* @param int $action_id Action ID.
|
413 |
+
*/
|
414 |
+
public function unclaim_action( $action_id ) {
|
415 |
+
$this->primary_store->unclaim_action( $action_id );
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Retrieve a list of action IDs by claim.
|
420 |
+
*
|
421 |
+
* @param int $claim_id Claim ID.
|
422 |
+
*/
|
423 |
+
public function find_actions_by_claim_id( $claim_id ) {
|
424 |
+
return $this->primary_store->find_actions_by_claim_id( $claim_id );
|
425 |
+
}
|
426 |
+
}
|
vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_wpCommentLogger
|
5 |
+
*/
|
6 |
+
class ActionScheduler_wpCommentLogger extends ActionScheduler_Logger {
|
7 |
+
const AGENT = 'ActionScheduler';
|
8 |
+
const TYPE = 'action_log';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string $action_id
|
12 |
+
* @param string $message
|
13 |
+
* @param DateTime $date
|
14 |
+
*
|
15 |
+
* @return string The log entry ID
|
16 |
+
*/
|
17 |
+
public function log( $action_id, $message, DateTime $date = NULL ) {
|
18 |
+
if ( empty($date) ) {
|
19 |
+
$date = as_get_datetime_object();
|
20 |
+
} else {
|
21 |
+
$date = as_get_datetime_object( clone $date );
|
22 |
+
}
|
23 |
+
$comment_id = $this->create_wp_comment( $action_id, $message, $date );
|
24 |
+
return $comment_id;
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function create_wp_comment( $action_id, $message, DateTime $date ) {
|
28 |
+
|
29 |
+
$comment_date_gmt = $date->format('Y-m-d H:i:s');
|
30 |
+
ActionScheduler_TimezoneHelper::set_local_timezone( $date );
|
31 |
+
$comment_data = array(
|
32 |
+
'comment_post_ID' => $action_id,
|
33 |
+
'comment_date' => $date->format('Y-m-d H:i:s'),
|
34 |
+
'comment_date_gmt' => $comment_date_gmt,
|
35 |
+
'comment_author' => self::AGENT,
|
36 |
+
'comment_content' => $message,
|
37 |
+
'comment_agent' => self::AGENT,
|
38 |
+
'comment_type' => self::TYPE,
|
39 |
+
);
|
40 |
+
return wp_insert_comment($comment_data);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param string $entry_id
|
45 |
+
*
|
46 |
+
* @return ActionScheduler_LogEntry
|
47 |
+
*/
|
48 |
+
public function get_entry( $entry_id ) {
|
49 |
+
$comment = $this->get_comment( $entry_id );
|
50 |
+
if ( empty($comment) || $comment->comment_type != self::TYPE ) {
|
51 |
+
return new ActionScheduler_NullLogEntry();
|
52 |
+
}
|
53 |
+
|
54 |
+
$date = as_get_datetime_object( $comment->comment_date_gmt );
|
55 |
+
ActionScheduler_TimezoneHelper::set_local_timezone( $date );
|
56 |
+
return new ActionScheduler_LogEntry( $comment->comment_post_ID, $comment->comment_content, $date );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param string $action_id
|
61 |
+
*
|
62 |
+
* @return ActionScheduler_LogEntry[]
|
63 |
+
*/
|
64 |
+
public function get_logs( $action_id ) {
|
65 |
+
$status = 'all';
|
66 |
+
if ( get_post_status($action_id) == 'trash' ) {
|
67 |
+
$status = 'post-trashed';
|
68 |
+
}
|
69 |
+
$comments = get_comments(array(
|
70 |
+
'post_id' => $action_id,
|
71 |
+
'orderby' => 'comment_date_gmt',
|
72 |
+
'order' => 'ASC',
|
73 |
+
'type' => self::TYPE,
|
74 |
+
'status' => $status,
|
75 |
+
));
|
76 |
+
$logs = array();
|
77 |
+
foreach ( $comments as $c ) {
|
78 |
+
$entry = $this->get_entry( $c );
|
79 |
+
if ( !empty($entry) ) {
|
80 |
+
$logs[] = $entry;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
return $logs;
|
84 |
+
}
|
85 |
+
|
86 |
+
protected function get_comment( $comment_id ) {
|
87 |
+
return get_comment( $comment_id );
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @param WP_Comment_Query $query
|
94 |
+
*/
|
95 |
+
public function filter_comment_queries( $query ) {
|
96 |
+
foreach ( array('ID', 'parent', 'post_author', 'post_name', 'post_parent', 'type', 'post_type', 'post_id', 'post_ID') as $key ) {
|
97 |
+
if ( !empty($query->query_vars[$key]) ) {
|
98 |
+
return; // don't slow down queries that wouldn't include action_log comments anyway
|
99 |
+
}
|
100 |
+
}
|
101 |
+
$query->query_vars['action_log_filter'] = TRUE;
|
102 |
+
add_filter( 'comments_clauses', array( $this, 'filter_comment_query_clauses' ), 10, 2 );
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @param array $clauses
|
107 |
+
* @param WP_Comment_Query $query
|
108 |
+
*
|
109 |
+
* @return array
|
110 |
+
*/
|
111 |
+
public function filter_comment_query_clauses( $clauses, $query ) {
|
112 |
+
if ( !empty($query->query_vars['action_log_filter']) ) {
|
113 |
+
$clauses['where'] .= $this->get_where_clause();
|
114 |
+
}
|
115 |
+
return $clauses;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Make sure Action Scheduler logs are excluded from comment feeds, which use WP_Query, not
|
120 |
+
* the WP_Comment_Query class handled by @see self::filter_comment_queries().
|
121 |
+
*
|
122 |
+
* @param string $where
|
123 |
+
* @param WP_Query $query
|
124 |
+
*
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function filter_comment_feed( $where, $query ) {
|
128 |
+
if ( is_comment_feed() ) {
|
129 |
+
$where .= $this->get_where_clause();
|
130 |
+
}
|
131 |
+
return $where;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Return a SQL clause to exclude Action Scheduler comments.
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
protected function get_where_clause() {
|
140 |
+
global $wpdb;
|
141 |
+
return sprintf( " AND {$wpdb->comments}.comment_type != '%s'", self::TYPE );
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Remove action log entries from wp_count_comments()
|
146 |
+
*
|
147 |
+
* @param array $stats
|
148 |
+
* @param int $post_id
|
149 |
+
*
|
150 |
+
* @return object
|
151 |
+
*/
|
152 |
+
public function filter_comment_count( $stats, $post_id ) {
|
153 |
+
global $wpdb;
|
154 |
+
|
155 |
+
if ( 0 === $post_id ) {
|
156 |
+
$stats = $this->get_comment_count();
|
157 |
+
}
|
158 |
+
|
159 |
+
return $stats;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Retrieve the comment counts from our cache, or the database if the cached version isn't set.
|
164 |
+
*
|
165 |
+
* @return object
|
166 |
+
*/
|
167 |
+
protected function get_comment_count() {
|
168 |
+
global $wpdb;
|
169 |
+
|
170 |
+
$stats = get_transient( 'as_comment_count' );
|
171 |
+
|
172 |
+
if ( ! $stats ) {
|
173 |
+
$stats = array();
|
174 |
+
|
175 |
+
$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('order_note','action_log') GROUP BY comment_approved", ARRAY_A );
|
176 |
+
|
177 |
+
$total = 0;
|
178 |
+
$stats = array();
|
179 |
+
$approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' );
|
180 |
+
|
181 |
+
foreach ( (array) $count as $row ) {
|
182 |
+
// Don't count post-trashed toward totals
|
183 |
+
if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
|
184 |
+
$total += $row['num_comments'];
|
185 |
+
}
|
186 |
+
if ( isset( $approved[ $row['comment_approved'] ] ) ) {
|
187 |
+
$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$stats['total_comments'] = $total;
|
192 |
+
$stats['all'] = $total;
|
193 |
+
|
194 |
+
foreach ( $approved as $key ) {
|
195 |
+
if ( empty( $stats[ $key ] ) ) {
|
196 |
+
$stats[ $key ] = 0;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
$stats = (object) $stats;
|
201 |
+
set_transient( 'as_comment_count', $stats );
|
202 |
+
}
|
203 |
+
|
204 |
+
return $stats;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Delete comment count cache whenever there is new comment or the status of a comment changes. Cache
|
209 |
+
* will be regenerated next time ActionScheduler_wpCommentLogger::filter_comment_count() is called.
|
210 |
+
*/
|
211 |
+
public function delete_comment_count_cache() {
|
212 |
+
delete_transient( 'as_comment_count' );
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @codeCoverageIgnore
|
217 |
+
*/
|
218 |
+
public function init() {
|
219 |
+
add_action( 'action_scheduler_before_process_queue', array( $this, 'disable_comment_counting' ), 10, 0 );
|
220 |
+
add_action( 'action_scheduler_after_process_queue', array( $this, 'enable_comment_counting' ), 10, 0 );
|
221 |
+
|
222 |
+
parent::init();
|
223 |
+
|
224 |
+
add_action( 'pre_get_comments', array( $this, 'filter_comment_queries' ), 10, 1 );
|
225 |
+
add_action( 'wp_count_comments', array( $this, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs
|
226 |
+
add_action( 'comment_feed_where', array( $this, 'filter_comment_feed' ), 10, 2 );
|
227 |
+
|
228 |
+
// Delete comments count cache whenever there is a new comment or a comment status changes
|
229 |
+
add_action( 'wp_insert_comment', array( $this, 'delete_comment_count_cache' ) );
|
230 |
+
add_action( 'wp_set_comment_status', array( $this, 'delete_comment_count_cache' ) );
|
231 |
+
}
|
232 |
+
|
233 |
+
public function disable_comment_counting() {
|
234 |
+
wp_defer_comment_counting(true);
|
235 |
+
}
|
236 |
+
public function enable_comment_counting() {
|
237 |
+
wp_defer_comment_counting(false);
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php
ADDED
@@ -0,0 +1,1075 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class ActionScheduler_wpPostStore
|
5 |
+
*/
|
6 |
+
class ActionScheduler_wpPostStore extends ActionScheduler_Store {
|
7 |
+
const POST_TYPE = 'scheduled-action';
|
8 |
+
const GROUP_TAXONOMY = 'action-group';
|
9 |
+
const SCHEDULE_META_KEY = '_action_manager_schedule';
|
10 |
+
const DEPENDENCIES_MET = 'as-post-store-dependencies-met';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Used to share information about the before_date property of claims internally.
|
14 |
+
*
|
15 |
+
* This is used in preference to passing the same information as a method param
|
16 |
+
* for backwards-compatibility reasons.
|
17 |
+
*
|
18 |
+
* @var DateTime|null
|
19 |
+
*/
|
20 |
+
private $claim_before_date = null;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Local Timezone.
|
24 |
+
*
|
25 |
+
* @var DateTimeZone
|
26 |
+
*/
|
27 |
+
protected $local_timezone = null;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Save action.
|
31 |
+
*
|
32 |
+
* @param ActionScheduler_Action $action Scheduled Action.
|
33 |
+
* @param DateTime $scheduled_date Scheduled Date.
|
34 |
+
*
|
35 |
+
* @throws RuntimeException Throws an exception if the action could not be saved.
|
36 |
+
* @return int
|
37 |
+
*/
|
38 |
+
public function save_action( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {
|
39 |
+
try {
|
40 |
+
$this->validate_action( $action );
|
41 |
+
$post_array = $this->create_post_array( $action, $scheduled_date );
|
42 |
+
$post_id = $this->save_post_array( $post_array );
|
43 |
+
$this->save_post_schedule( $post_id, $action->get_schedule() );
|
44 |
+
$this->save_action_group( $post_id, $action->get_group() );
|
45 |
+
do_action( 'action_scheduler_stored_action', $post_id );
|
46 |
+
return $post_id;
|
47 |
+
} catch ( Exception $e ) {
|
48 |
+
/* translators: %s: action error message */
|
49 |
+
throw new RuntimeException( sprintf( __( 'Error saving action: %s', 'action-scheduler' ), $e->getMessage() ), 0 );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Create post array.
|
55 |
+
*
|
56 |
+
* @param ActionScheduler_Action $action Scheduled Action.
|
57 |
+
* @param DateTime $scheduled_date Scheduled Date.
|
58 |
+
*
|
59 |
+
* @return array Returns an array of post data.
|
60 |
+
*/
|
61 |
+
protected function create_post_array( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {
|
62 |
+
$post = array(
|
63 |
+
'post_type' => self::POST_TYPE,
|
64 |
+
'post_title' => $action->get_hook(),
|
65 |
+
'post_content' => wp_json_encode( $action->get_args() ),
|
66 |
+
'post_status' => ( $action->is_finished() ? 'publish' : 'pending' ),
|
67 |
+
'post_date_gmt' => $this->get_scheduled_date_string( $action, $scheduled_date ),
|
68 |
+
'post_date' => $this->get_scheduled_date_string_local( $action, $scheduled_date ),
|
69 |
+
);
|
70 |
+
return $post;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Save post array.
|
75 |
+
*
|
76 |
+
* @param array $post_array Post array.
|
77 |
+
* @return int Returns the post ID.
|
78 |
+
* @throws RuntimeException Throws an exception if the action could not be saved.
|
79 |
+
*/
|
80 |
+
protected function save_post_array( $post_array ) {
|
81 |
+
add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 );
|
82 |
+
add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 );
|
83 |
+
|
84 |
+
$has_kses = false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' );
|
85 |
+
|
86 |
+
if ( $has_kses ) {
|
87 |
+
// Prevent KSES from corrupting JSON in post_content.
|
88 |
+
kses_remove_filters();
|
89 |
+
}
|
90 |
+
|
91 |
+
$post_id = wp_insert_post( $post_array );
|
92 |
+
|
93 |
+
if ( $has_kses ) {
|
94 |
+
kses_init_filters();
|
95 |
+
}
|
96 |
+
|
97 |
+
remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 );
|
98 |
+
remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 );
|
99 |
+
|
100 |
+
if ( is_wp_error( $post_id ) || empty( $post_id ) ) {
|
101 |
+
throw new RuntimeException( __( 'Unable to save action.', 'action-scheduler' ) );
|
102 |
+
}
|
103 |
+
return $post_id;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Filter insert post data.
|
108 |
+
*
|
109 |
+
* @param array $postdata Post data to filter.
|
110 |
+
*
|
111 |
+
* @return array
|
112 |
+
*/
|
113 |
+
public function filter_insert_post_data( $postdata ) {
|
114 |
+
if ( self::POST_TYPE === $postdata['post_type'] ) {
|
115 |
+
$postdata['post_author'] = 0;
|
116 |
+
if ( 'future' === $postdata['post_status'] ) {
|
117 |
+
$postdata['post_status'] = 'publish';
|
118 |
+
}
|
119 |
+
}
|
120 |
+
return $postdata;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Create a (probably unique) post name for scheduled actions in a more performant manner than wp_unique_post_slug().
|
125 |
+
*
|
126 |
+
* When an action's post status is transitioned to something other than 'draft', 'pending' or 'auto-draft, like 'publish'
|
127 |
+
* or 'failed' or 'trash', WordPress will find a unique slug (stored in post_name column) using the wp_unique_post_slug()
|
128 |
+
* function. This is done to ensure URL uniqueness. The approach taken by wp_unique_post_slug() is to iterate over existing
|
129 |
+
* post_name values that match, and append a number 1 greater than the largest. This makes sense when manually creating a
|
130 |
+
* post from the Edit Post screen. It becomes a bottleneck when automatically processing thousands of actions, with a
|
131 |
+
* database containing thousands of related post_name values.
|
132 |
+
*
|
133 |
+
* WordPress 5.1 introduces the 'pre_wp_unique_post_slug' filter for plugins to address this issue.
|
134 |
+
*
|
135 |
+
* We can short-circuit WordPress's wp_unique_post_slug() approach using the 'pre_wp_unique_post_slug' filter. This
|
136 |
+
* method is available to be used as a callback on that filter. It provides a more scalable approach to generating a
|
137 |
+
* post_name/slug that is probably unique. Because Action Scheduler never actually uses the post_name field, or an
|
138 |
+
* action's slug, being probably unique is good enough.
|
139 |
+
*
|
140 |
+
* For more backstory on this issue, see:
|
141 |
+
* - https://github.com/woocommerce/action-scheduler/issues/44 and
|
142 |
+
* - https://core.trac.wordpress.org/ticket/21112
|
143 |
+
*
|
144 |
+
* @param string $override_slug Short-circuit return value.
|
145 |
+
* @param string $slug The desired slug (post_name).
|
146 |
+
* @param int $post_ID Post ID.
|
147 |
+
* @param string $post_status The post status.
|
148 |
+
* @param string $post_type Post type.
|
149 |
+
* @return string
|
150 |
+
*/
|
151 |
+
public function set_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) {
|
152 |
+
if ( self::POST_TYPE === $post_type ) {
|
153 |
+
$override_slug = uniqid( self::POST_TYPE . '-', true ) . '-' . wp_generate_password( 32, false );
|
154 |
+
}
|
155 |
+
return $override_slug;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Save post schedule.
|
160 |
+
*
|
161 |
+
* @param int $post_id Post ID of the scheduled action.
|
162 |
+
* @param string $schedule Schedule to save.
|
163 |
+
*
|
164 |
+
* @return void
|
165 |
+
*/
|
166 |
+
protected function save_post_schedule( $post_id, $schedule ) {
|
167 |
+
update_post_meta( $post_id, self::SCHEDULE_META_KEY, $schedule );
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Save action group.
|
172 |
+
*
|
173 |
+
* @param int $post_id Post ID.
|
174 |
+
* @param string $group Group to save.
|
175 |
+
* @return void
|
176 |
+
*/
|
177 |
+
protected function save_action_group( $post_id, $group ) {
|
178 |
+
if ( empty( $group ) ) {
|
179 |
+
wp_set_object_terms( $post_id, array(), self::GROUP_TAXONOMY, false );
|
180 |
+
} else {
|
181 |
+
wp_set_object_terms( $post_id, array( $group ), self::GROUP_TAXONOMY, false );
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Fetch actions.
|
187 |
+
*
|
188 |
+
* @param int $action_id Action ID.
|
189 |
+
* @return object
|
190 |
+
*/
|
191 |
+
public function fetch_action( $action_id ) {
|
192 |
+
$post = $this->get_post( $action_id );
|
193 |
+
if ( empty( $post ) || self::POST_TYPE !== $post->post_type ) {
|
194 |
+
return $this->get_null_action();
|
195 |
+
}
|
196 |
+
|
197 |
+
try {
|
198 |
+
$action = $this->make_action_from_post( $post );
|
199 |
+
} catch ( ActionScheduler_InvalidActionException $exception ) {
|
200 |
+
do_action( 'action_scheduler_failed_fetch_action', $post->ID, $exception );
|
201 |
+
return $this->get_null_action();
|
202 |
+
}
|
203 |
+
|
204 |
+
return $action;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Get post.
|
209 |
+
*
|
210 |
+
* @param string $action_id - Action ID.
|
211 |
+
* @return WP_Post|null
|
212 |
+
*/
|
213 |
+
protected function get_post( $action_id ) {
|
214 |
+
if ( empty( $action_id ) ) {
|
215 |
+
return null;
|
216 |
+
}
|
217 |
+
return get_post( $action_id );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Get NULL action.
|
222 |
+
*
|
223 |
+
* @return ActionScheduler_NullAction
|
224 |
+
*/
|
225 |
+
protected function get_null_action() {
|
226 |
+
return new ActionScheduler_NullAction();
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Make action from post.
|
231 |
+
*
|
232 |
+
* @param WP_Post $post Post object.
|
233 |
+
* @return WP_Post
|
234 |
+
*/
|
235 |
+
protected function make_action_from_post( $post ) {
|
236 |
+
$hook = $post->post_title;
|
237 |
+
|
238 |
+
$args = json_decode( $post->post_content, true );
|
239 |
+
$this->validate_args( $args, $post->ID );
|
240 |
+
|
241 |
+
$schedule = get_post_meta( $post->ID, self::SCHEDULE_META_KEY, true );
|
242 |
+
$this->validate_schedule( $schedule, $post->ID );
|
243 |
+
|
244 |
+
$group = wp_get_object_terms( $post->ID, self::GROUP_TAXONOMY, array( 'fields' => 'names' ) );
|
245 |
+
$group = empty( $group ) ? '' : reset( $group );
|
246 |
+
|
247 |
+
return ActionScheduler::factory()->get_stored_action( $this->get_action_status_by_post_status( $post->post_status ), $hook, $args, $schedule, $group );
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Get action status by post status.
|
252 |
+
*
|
253 |
+
* @param string $post_status Post status.
|
254 |
+
*
|
255 |
+
* @throws InvalidArgumentException Throw InvalidArgumentException if $post_status not in known status fields returned by $this->get_status_labels().
|
256 |
+
* @return string
|
257 |
+
*/
|
258 |
+
protected function get_action_status_by_post_status( $post_status ) {
|
259 |
+
|
260 |
+
switch ( $post_status ) {
|
261 |
+
case 'publish':
|
262 |
+
$action_status = self::STATUS_COMPLETE;
|
263 |
+
break;
|
264 |
+
case 'trash':
|
265 |
+
$action_status = self::STATUS_CANCELED;
|
266 |
+
break;
|
267 |
+
default:
|
268 |
+
if ( ! array_key_exists( $post_status, $this->get_status_labels() ) ) {
|
269 |
+
throw new InvalidArgumentException( sprintf( 'Invalid post status: "%s". No matching action status available.', $post_status ) );
|
270 |
+
}
|
271 |
+
$action_status = $post_status;
|
272 |
+
break;
|
273 |
+
}
|
274 |
+
|
275 |
+
return $action_status;
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Get post status by action status.
|
280 |
+
*
|
281 |
+
* @param string $action_status Action status.
|
282 |
+
*
|
283 |
+
* @throws InvalidArgumentException Throws InvalidArgumentException if $post_status not in known status fields returned by $this->get_status_labels().
|
284 |
+
* @return string
|
285 |
+
*/
|
286 |
+
protected function get_post_status_by_action_status( $action_status ) {
|
287 |
+
|
288 |
+
switch ( $action_status ) {
|
289 |
+
case self::STATUS_COMPLETE:
|
290 |
+
$post_status = 'publish';
|
291 |
+
break;
|
292 |
+
case self::STATUS_CANCELED:
|
293 |
+
$post_status = 'trash';
|
294 |
+
break;
|
295 |
+
default:
|
296 |
+
if ( ! array_key_exists( $action_status, $this->get_status_labels() ) ) {
|
297 |
+
throw new InvalidArgumentException( sprintf( 'Invalid action status: "%s".', $action_status ) );
|
298 |
+
}
|
299 |
+
$post_status = $action_status;
|
300 |
+
break;
|
301 |
+
}
|
302 |
+
|
303 |
+
return $post_status;
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Returns the SQL statement to query (or count) actions.
|
308 |
+
*
|
309 |
+
* @param array $query - Filtering options.
|
310 |
+
* @param string $select_or_count - Whether the SQL should select and return the IDs or just the row count.
|
311 |
+
*
|
312 |
+
* @throws InvalidArgumentException - Throw InvalidArgumentException if $select_or_count not count or select.
|
313 |
+
* @return string SQL statement. The returned SQL is already properly escaped.
|
314 |
+
*/
|
315 |
+
protected function get_query_actions_sql( array $query, $select_or_count = 'select' ) {
|
316 |
+
|
317 |
+
if ( ! in_array( $select_or_count, array( 'select', 'count' ), true ) ) {
|
318 |
+
throw new InvalidArgumentException( __( 'Invalid schedule. Cannot save action.', 'action-scheduler' ) );
|
319 |
+
}
|
320 |
+
|
321 |
+
$query = wp_parse_args(
|
322 |
+
$query,
|
323 |
+
array(
|
324 |
+
'hook' => '',
|
325 |
+
'args' => null,
|
326 |
+
'date' => null,
|
327 |
+
'date_compare' => '<=',
|
328 |
+
'modified' => null,
|
329 |
+
'modified_compare' => '<=',
|
330 |
+
'group' => '',
|
331 |
+
'status' => '',
|
332 |
+
'claimed' => null,
|
333 |
+
'per_page' => 5,
|
334 |
+
'offset' => 0,
|
335 |
+
'orderby' => 'date',
|
336 |
+
'order' => 'ASC',
|
337 |
+
'search' => '',
|
338 |
+
)
|
339 |
+
);
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Global wpdb object.
|
343 |
+
*
|
344 |
+
* @var wpdb $wpdb
|
345 |
+
*/
|
346 |
+
global $wpdb;
|
347 |
+
$sql = ( 'count' === $select_or_count ) ? 'SELECT count(p.ID)' : 'SELECT p.ID ';
|
348 |
+
$sql .= "FROM {$wpdb->posts} p";
|
349 |
+
$sql_params = array();
|
350 |
+
if ( empty( $query['group'] ) && 'group' === $query['orderby'] ) {
|
351 |
+
$sql .= " LEFT JOIN {$wpdb->term_relationships} tr ON tr.object_id=p.ID";
|
352 |
+
$sql .= " LEFT JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id=tt.term_taxonomy_id";
|
353 |
+
$sql .= " LEFT JOIN {$wpdb->terms} t ON tt.term_id=t.term_id";
|
354 |
+
} elseif ( ! empty( $query['group'] ) ) {
|
355 |
+
$sql .= " INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id=p.ID";
|
356 |
+
$sql .= " INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id=tt.term_taxonomy_id";
|
357 |
+
$sql .= " INNER JOIN {$wpdb->terms} t ON tt.term_id=t.term_id";
|
358 |
+
$sql .= ' AND t.slug=%s';
|
359 |
+
$sql_params[] = $query['group'];
|
360 |
+
}
|
361 |
+
$sql .= ' WHERE post_type=%s';
|
362 |
+
$sql_params[] = self::POST_TYPE;
|
363 |
+
if ( $query['hook'] ) {
|
364 |
+
$sql .= ' AND p.post_title=%s';
|
365 |
+
$sql_params[] = $query['hook'];
|
366 |
+
}
|
367 |
+
if ( ! is_null( $query['args'] ) ) {
|
368 |
+
$sql .= ' AND p.post_content=%s';
|
369 |
+
$sql_params[] = wp_json_encode( $query['args'] );
|
370 |
+
}
|
371 |
+
|
372 |
+
if ( $query['status'] ) {
|
373 |
+
$post_statuses = array_map( array( $this, 'get_post_status_by_action_status' ), (array) $query['status'] );
|
374 |
+
$placeholders = array_fill( 0, count( $post_statuses ), '%s' );
|
375 |
+
$sql .= ' AND p.post_status IN (' . join( ', ', $placeholders ) . ')';
|
376 |
+
$sql_params = array_merge( $sql_params, array_values( $post_statuses ) );
|
377 |
+
}
|
378 |
+
|
379 |
+
if ( $query['date'] instanceof DateTime ) {
|
380 |
+
$date = clone $query['date'];
|
381 |
+
$date->setTimezone( new DateTimeZone( 'UTC' ) );
|
382 |
+
$date_string = $date->format( 'Y-m-d H:i:s' );
|
383 |
+
$comparator = $this->validate_sql_comparator( $query['date_compare'] );
|
384 |
+
$sql .= " AND p.post_date_gmt $comparator %s";
|
385 |
+
$sql_params[] = $date_string;
|
386 |
+
}
|
387 |
+
|
388 |
+
if ( $query['modified'] instanceof DateTime ) {
|
389 |
+
$modified = clone $query['modified'];
|
390 |
+
$modified->setTimezone( new DateTimeZone( 'UTC' ) );
|
391 |
+
$date_string = $modified->format( 'Y-m-d H:i:s' );
|
392 |
+
$comparator = $this->validate_sql_comparator( $query['modified_compare'] );
|
393 |
+
$sql .= " AND p.post_modified_gmt $comparator %s";
|
394 |
+
$sql_params[] = $date_string;
|
395 |
+
}
|
396 |
+
|
397 |
+
if ( true === $query['claimed'] ) {
|
398 |
+
$sql .= " AND p.post_password != ''";
|
399 |
+
} elseif ( false === $query['claimed'] ) {
|
400 |
+
$sql .= " AND p.post_password = ''";
|
401 |
+
} elseif ( ! is_null( $query['claimed'] ) ) {
|
402 |
+
$sql .= ' AND p.post_password = %s';
|
403 |
+
$sql_params[] = $query['claimed'];
|
404 |
+
}
|
405 |
+
|
406 |
+
if ( ! empty( $query['search'] ) ) {
|
407 |
+
$sql .= ' AND (p.post_title LIKE %s OR p.post_content LIKE %s OR p.post_password LIKE %s)';
|
408 |
+
for ( $i = 0; $i < 3; $i++ ) {
|
409 |
+
$sql_params[] = sprintf( '%%%s%%', $query['search'] );
|
410 |
+
}
|
411 |
+
}
|
412 |
+
|
413 |
+
if ( 'select' === $select_or_count ) {
|
414 |
+
switch ( $query['orderby'] ) {
|
415 |
+
case 'hook':
|
416 |
+
$orderby = 'p.post_title';
|
417 |
+
break;
|
418 |
+
case 'group':
|
419 |
+
$orderby = 't.name';
|
420 |
+
break;
|
421 |
+
case 'status':
|
422 |
+
$orderby = 'p.post_status';
|
423 |
+
break;
|
424 |
+
case 'modified':
|
425 |
+
$orderby = 'p.post_modified';
|
426 |
+
break;
|
427 |
+
case 'claim_id':
|
428 |
+
$orderby = 'p.post_password';
|
429 |
+
break;
|
430 |
+
case 'schedule':
|
431 |
+
case 'date':
|
432 |
+
default:
|
433 |
+
$orderby = 'p.post_date_gmt';
|
434 |
+
break;
|
435 |
+
}
|
436 |
+
if ( 'ASC' === strtoupper( $query['order'] ) ) {
|
437 |
+
$order = 'ASC';
|
438 |
+
} else {
|
439 |
+
$order = 'DESC';
|
440 |
+
}
|
441 |
+
$sql .= " ORDER BY $orderby $order";
|
442 |
+
if ( $query['per_page'] > 0 ) {
|
443 |
+
$sql .= ' LIMIT %d, %d';
|
444 |
+
$sql_params[] = $query['offset'];
|
445 |
+
$sql_params[] = $query['per_page'];
|
446 |
+
}
|
447 |
+
}
|
448 |
+
|
449 |
+
return $wpdb->prepare( $sql, $sql_params ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Query for action count or list of action IDs.
|
454 |
+
*
|
455 |
+
* @since 3.3.0 $query['status'] accepts array of statuses instead of a single status.
|
456 |
+
*
|
457 |
+
* @see ActionScheduler_Store::query_actions for $query arg usage.
|
458 |
+
*
|
459 |
+
* @param array $query Query filtering options.
|
460 |
+
* @param string $query_type Whether to select or count the results. Defaults to select.
|
461 |
+
*
|
462 |
+
* @return string|array|null The IDs of actions matching the query. Null on failure.
|
463 |
+
*/
|
464 |
+
public function query_actions( $query = array(), $query_type = 'select' ) {
|
465 |
+
/**
|
466 |
+
* Global $wpdb object.
|
467 |
+
*
|
468 |
+
* @var wpdb $wpdb
|
469 |
+
*/
|
470 |
+
global $wpdb;
|
471 |
+
|
472 |
+
$sql = $this->get_query_actions_sql( $query, $query_type );
|
473 |
+
|
474 |
+
return ( 'count' === $query_type ) ? $wpdb->get_var( $sql ) : $wpdb->get_col( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Get a count of all actions in the store, grouped by status
|
479 |
+
*
|
480 |
+
* @return array
|
481 |
+
*/
|
482 |
+
public function action_counts() {
|
483 |
+
|
484 |
+
$action_counts_by_status = array();
|
485 |
+
$action_stati_and_labels = $this->get_status_labels();
|
486 |
+
$posts_count_by_status = (array) wp_count_posts( self::POST_TYPE, 'readable' );
|
487 |
+
|
488 |
+
foreach ( $posts_count_by_status as $post_status_name => $count ) {
|
489 |
+
|
490 |
+
try {
|
491 |
+
$action_status_name = $this->get_action_status_by_post_status( $post_status_name );
|
492 |
+
} catch ( Exception $e ) {
|
493 |
+
// Ignore any post statuses that aren't for actions.
|
494 |
+
continue;
|
495 |
+
}
|
496 |
+
if ( array_key_exists( $action_status_name, $action_stati_and_labels ) ) {
|
497 |
+
$action_counts_by_status[ $action_status_name ] = $count;
|
498 |
+
}
|
499 |
+
}
|
500 |
+
|
501 |
+
return $action_counts_by_status;
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Cancel action.
|
506 |
+
*
|
507 |
+
* @param int $action_id Action ID.
|
508 |
+
*
|
509 |
+
* @throws InvalidArgumentException If $action_id is not identified.
|
510 |
+
*/
|
511 |
+
public function cancel_action( $action_id ) {
|
512 |
+
$post = get_post( $action_id );
|
513 |
+
if ( empty( $post ) || ( self::POST_TYPE !== $post->post_type ) ) {
|
514 |
+
/* translators: %s is the action ID */
|
515 |
+
throw new InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) );
|
516 |
+
}
|
517 |
+
do_action( 'action_scheduler_canceled_action', $action_id );
|
518 |
+
add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 );
|
519 |
+
wp_trash_post( $action_id );
|
520 |
+
remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 );
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Delete action.
|
525 |
+
*
|
526 |
+
* @param int $action_id Action ID.
|
527 |
+
* @return void
|
528 |
+
* @throws InvalidArgumentException If action is not identified.
|
529 |
+
*/
|
530 |
+
public function delete_action( $action_id ) {
|
531 |
+
$post = get_post( $action_id );
|
532 |
+
if ( empty( $post ) || ( self::POST_TYPE !== $post->post_type ) ) {
|
533 |
+
/* translators: %s is the action ID */
|
534 |
+
throw new InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) );
|
535 |
+
}
|
536 |
+
do_action( 'action_scheduler_deleted_action', $action_id );
|
537 |
+
|
538 |
+
wp_delete_post( $action_id, true );
|
539 |
+
}
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Get date for claim id.
|
543 |
+
*
|
544 |
+
* @param int $action_id Action ID.
|
545 |
+
* @return ActionScheduler_DateTime The date the action is schedule to run, or the date that it ran.
|
546 |
+
*/
|
547 |
+
public function get_date( $action_id ) {
|
548 |
+
$next = $this->get_date_gmt( $action_id );
|
549 |
+
return ActionScheduler_TimezoneHelper::set_local_timezone( $next );
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Get Date GMT.
|
554 |
+
*
|
555 |
+
* @param int $action_id Action ID.
|
556 |
+
*
|
557 |
+
* @throws InvalidArgumentException If $action_id is not identified.
|
558 |
+
* @return ActionScheduler_DateTime The date the action is schedule to run, or the date that it ran.
|
559 |
+
*/
|
560 |
+
public function get_date_gmt( $action_id ) {
|
561 |
+
$post = get_post( $action_id );
|
562 |
+
if ( empty( $post ) || ( self::POST_TYPE !== $post->post_type ) ) {
|
563 |
+
/* translators: %s is the action ID */
|
564 |
+
throw new InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) );
|
565 |
+
}
|
566 |
+
if ( 'publish' === $post->post_status ) {
|
567 |
+
return as_get_datetime_object( $post->post_modified_gmt );
|
568 |
+
} else {
|
569 |
+
return as_get_datetime_object( $post->post_date_gmt );
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
/**
|
574 |
+
* Stake claim.
|
575 |
+
*
|
576 |
+
* @param int $max_actions Maximum number of actions.
|
577 |
+
* @param DateTime $before_date Jobs must be schedule before this date. Defaults to now.
|
578 |
+
* @param array $hooks Claim only actions with a hook or hooks.
|
579 |
+
* @param string $group Claim only actions in the given group.
|
580 |
+
*
|
581 |
+
* @return ActionScheduler_ActionClaim
|
582 |
+
* @throws RuntimeException When there is an error staking a claim.
|
583 |
+
* @throws InvalidArgumentException When the given group is not valid.
|
584 |
+
*/
|
585 |
+
public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) {
|
586 |
+
$this->claim_before_date = $before_date;
|
587 |
+
$claim_id = $this->generate_claim_id();
|
588 |
+
$this->claim_actions( $claim_id, $max_actions, $before_date, $hooks, $group );
|
589 |
+
$action_ids = $this->find_actions_by_claim_id( $claim_id );
|
590 |
+
$this->claim_before_date = null;
|
591 |
+
|
592 |
+
return new ActionScheduler_ActionClaim( $claim_id, $action_ids );
|
593 |
+
}
|
594 |
+
|
595 |
+
/**
|
596 |
+
* Get claim count.
|
597 |
+
*
|
598 |
+
* @return int
|
599 |
+
*/
|
600 |
+
public function get_claim_count() {
|
601 |
+
global $wpdb;
|
602 |
+
|
603 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
|
604 |
+
return $wpdb->get_var(
|
605 |
+
$wpdb->prepare(
|
606 |
+
"SELECT COUNT(DISTINCT post_password) FROM {$wpdb->posts} WHERE post_password != '' AND post_type = %s AND post_status IN ('in-progress','pending')",
|
607 |
+
array( self::POST_TYPE )
|
608 |
+
)
|
609 |
+
);
|
610 |
+
}
|
611 |
+
|
612 |
+
/**
|
613 |
+
* Generate claim id.
|
614 |
+
*
|
615 |
+
* @return string
|
616 |
+
*/
|
617 |
+
protected function generate_claim_id() {
|
618 |
+
$claim_id = md5( microtime( true ) . wp_rand( 0, 1000 ) );
|
619 |
+
return substr( $claim_id, 0, 20 ); // to fit in db field with 20 char limit.
|
620 |
+
}
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Claim actions.
|
624 |
+
*
|
625 |
+
* @param string $claim_id Claim ID.
|
626 |
+
* @param int $limit Limit.
|
627 |
+
* @param DateTime $before_date Should use UTC timezone.
|
628 |
+
* @param array $hooks Claim only actions with a hook or hooks.
|
629 |
+
* @param string $group Claim only actions in the given group.
|
630 |
+
*
|
631 |
+
* @return int The number of actions that were claimed.
|
632 |
+
* @throws RuntimeException When there is a database error.
|
633 |
+
*/
|
634 |
+
protected function claim_actions( $claim_id, $limit, DateTime $before_date = null, $hooks = array(), $group = '' ) {
|
635 |
+
// Set up initial variables.
|
636 |
+
$date = null === $before_date ? as_get_datetime_object() : clone $before_date;
|
637 |
+
$limit_ids = ! empty( $group );
|
638 |
+
$ids = $limit_ids ? $this->get_actions_by_group( $group, $limit, $date ) : array();
|
639 |
+
|
640 |
+
// If limiting by IDs and no posts found, then return early since we have nothing to update.
|
641 |
+
if ( $limit_ids && 0 === count( $ids ) ) {
|
642 |
+
return 0;
|
643 |
+
}
|
644 |
+
|
645 |
+
/**
|
646 |
+
* Global wpdb object.
|
647 |
+
*
|
648 |
+
* @var wpdb $wpdb
|
649 |
+
*/
|
650 |
+
global $wpdb;
|
651 |
+
|
652 |
+
/*
|
653 |
+
* Build up custom query to update the affected posts. Parameters are built as a separate array
|
654 |
+
* to make it easier to identify where they are in the query.
|
655 |
+
*
|
656 |
+
* We can't use $wpdb->update() here because of the "ID IN ..." clause.
|
657 |
+
*/
|
658 |
+
$update = "UPDATE {$wpdb->posts} SET post_password = %s, post_modified_gmt = %s, post_modified = %s";
|
659 |
+
$params = array(
|
660 |
+
$claim_id,
|
661 |
+
current_time( 'mysql', true ),
|
662 |
+
current_time( 'mysql' ),
|
663 |
+
);
|
664 |
+
|
665 |
+
// Build initial WHERE clause.
|
666 |
+
$where = "WHERE post_type = %s AND post_status = %s AND post_password = ''";
|
667 |
+
$params[] = self::POST_TYPE;
|
668 |
+
$params[] = ActionScheduler_Store::STATUS_PENDING;
|
669 |
+
|
670 |
+
if ( ! empty( $hooks ) ) {
|
671 |
+
$placeholders = array_fill( 0, count( $hooks ), '%s' );
|
672 |
+
$where .= ' AND post_title IN (' . join( ', ', $placeholders ) . ')';
|
673 |
+
$params = array_merge( $params, array_values( $hooks ) );
|
674 |
+
}
|
675 |
+
|
676 |
+
/*
|
677 |
+
* Add the IDs to the WHERE clause. IDs not escaped because they came directly from a prior DB query.
|
678 |
+
*
|
679 |
+
* If we're not limiting by IDs, then include the post_date_gmt clause.
|
680 |
+
*/
|
681 |
+
if ( $limit_ids ) {
|
682 |
+
$where .= ' AND ID IN (' . join( ',', $ids ) . ')';
|
683 |
+
} else {
|
684 |
+
$where .= ' AND post_date_gmt <= %s';
|
685 |
+
$params[] = $date->format( 'Y-m-d H:i:s' );
|
686 |
+
}
|
687 |
+
|
688 |
+
// Add the ORDER BY clause and,ms limit.
|
689 |
+
$order = 'ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT %d';
|
690 |
+
$params[] = $limit;
|
691 |
+
|
692 |
+
// Run the query and gather results.
|
693 |
+
$rows_affected = $wpdb->query( $wpdb->prepare( "{$update} {$where} {$order}", $params ) ); // phpcs:ignore // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
|
694 |
+
|
695 |
+
if ( false === $rows_affected ) {
|
696 |
+
throw new RuntimeException( __( 'Unable to claim actions. Database error.', 'action-scheduler' ) );
|
697 |
+
}
|
698 |
+
|
699 |
+
return (int) $rows_affected;
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Get IDs of actions within a certain group and up to a certain date/time.
|
704 |
+
*
|
705 |
+
* @param string $group The group to use in finding actions.
|
706 |
+
* @param int $limit The number of actions to retrieve.
|
707 |
+
* @param DateTime $date DateTime object representing cutoff time for actions. Actions retrieved will be
|
708 |
+
* up to and including this DateTime.
|
709 |
+
*
|
710 |
+
* @return array IDs of actions in the appropriate group and before the appropriate time.
|
711 |
+
* @throws InvalidArgumentException When the group does not exist.
|
712 |
+
*/
|
713 |
+
protected function get_actions_by_group( $group, $limit, DateTime $date ) {
|
714 |
+
// Ensure the group exists before continuing.
|
715 |
+
if ( ! term_exists( $group, self::GROUP_TAXONOMY ) ) {
|
716 |
+
/* translators: %s is the group name */
|
717 |
+
throw new InvalidArgumentException( sprintf( __( 'The group "%s" does not exist.', 'action-scheduler' ), $group ) );
|
718 |
+
}
|
719 |
+
|
720 |
+
// Set up a query for post IDs to use later.
|
721 |
+
$query = new WP_Query();
|
722 |
+
$query_args = array(
|
723 |
+
'fields' => 'ids',
|
724 |
+
'post_type' => self::POST_TYPE,
|
725 |
+
'post_status' => ActionScheduler_Store::STATUS_PENDING,
|
726 |
+
'has_password' => false,
|
727 |
+
'posts_per_page' => $limit * 3,
|
728 |
+
'suppress_filters' => true,
|
729 |
+
'no_found_rows' => true,
|
730 |
+
'orderby' => array(
|
731 |
+
'menu_order' => 'ASC',
|
732 |
+
'date' => 'ASC',
|
733 |
+
'ID' => 'ASC',
|
734 |
+
),
|
735 |
+
'date_query' => array(
|
736 |
+
'column' => 'post_date_gmt',
|
737 |
+
'before' => $date->format( 'Y-m-d H:i' ),
|
738 |
+
'inclusive' => true,
|
739 |
+
),
|
740 |
+
'tax_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery
|
741 |
+
array(
|
742 |
+
'taxonomy' => self::GROUP_TAXONOMY,
|
743 |
+
'field' => 'slug',
|
744 |
+
'terms' => $group,
|
745 |
+
'include_children' => false,
|
746 |
+
),
|
747 |
+
),
|
748 |
+
);
|
749 |
+
|
750 |
+
return $query->query( $query_args );
|
751 |
+
}
|
752 |
+
|
753 |
+
/**
|
754 |
+
* Find actions by claim ID.
|
755 |
+
*
|
756 |
+
* @param string $claim_id Claim ID.
|
757 |
+
* @return array
|
758 |
+
*/
|
759 |
+
public function find_actions_by_claim_id( $claim_id ) {
|
760 |
+
/**
|
761 |
+
* Global wpdb object.
|
762 |
+
*
|
763 |
+
* @var wpdb $wpdb
|
764 |
+
*/
|
765 |
+
global $wpdb;
|
766 |
+
|
767 |
+
$action_ids = array();
|
768 |
+
$before_date = isset( $this->claim_before_date ) ? $this->claim_before_date : as_get_datetime_object();
|
769 |
+
$cut_off = $before_date->format( 'Y-m-d H:i:s' );
|
770 |
+
|
771 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
772 |
+
$results = $wpdb->get_results(
|
773 |
+
$wpdb->prepare(
|
774 |
+
"SELECT ID, post_date_gmt FROM {$wpdb->posts} WHERE post_type = %s AND post_password = %s",
|
775 |
+
array(
|
776 |
+
self::POST_TYPE,
|
777 |
+
$claim_id,
|
778 |
+
)
|
779 |
+
)
|
780 |
+
);
|
781 |
+
|
782 |
+
// Verify that the scheduled date for each action is within the expected bounds (in some unusual
|
783 |
+
// cases, we cannot depend on MySQL to honor all of the WHERE conditions we specify).
|
784 |
+
foreach ( $results as $claimed_action ) {
|
785 |
+
if ( $claimed_action->post_date_gmt <= $cut_off ) {
|
786 |
+
$action_ids[] = absint( $claimed_action->ID );
|
787 |
+
}
|
788 |
+
}
|
789 |
+
|
790 |
+
return $action_ids;
|
791 |
+
}
|
792 |
+
|
793 |
+
/**
|
794 |
+
* Release claim.
|
795 |
+
*
|
796 |
+
* @param ActionScheduler_ActionClaim $claim Claim object to release.
|
797 |
+
* @return void
|
798 |
+
* @throws RuntimeException When the claim is not unlocked.
|
799 |
+
*/
|
800 |
+
public function release_claim( ActionScheduler_ActionClaim $claim ) {
|
801 |
+
$action_ids = $this->find_actions_by_claim_id( $claim->get_id() );
|
802 |
+
if ( empty( $action_ids ) ) {
|
803 |
+
return; // nothing to do.
|
804 |
+
}
|
805 |
+
$action_id_string = implode( ',', array_map( 'intval', $action_ids ) );
|
806 |
+
/**
|
807 |
+
* Global wpdb object.
|
808 |
+
*
|
809 |
+
* @var wpdb $wpdb
|
810 |
+
*/
|
811 |
+
global $wpdb;
|
812 |
+
|
813 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
814 |
+
$result = $wpdb->query(
|
815 |
+
$wpdb->prepare(
|
816 |
+
"UPDATE {$wpdb->posts} SET post_password = '' WHERE ID IN ($action_id_string) AND post_password = %s", //phpcs:ignore
|
817 |
+
array(
|
818 |
+
$claim->get_id(),
|
819 |
+
)
|
820 |
+
)
|
821 |
+
);
|
822 |
+
if ( false === $result ) {
|
823 |
+
/* translators: %s: claim ID */
|
824 |
+
throw new RuntimeException( sprintf( __( 'Unable to unlock claim %s. Database error.', 'action-scheduler' ), $claim->get_id() ) );
|
825 |
+
}
|
826 |
+
}
|
827 |
+
|
828 |
+
/**
|
829 |
+
* Unclaim action.
|
830 |
+
*
|
831 |
+
* @param string $action_id Action ID.
|
832 |
+
* @throws RuntimeException When unable to unlock claim on action ID.
|
833 |
+
*/
|
834 |
+
public function unclaim_action( $action_id ) {
|
835 |
+
/**
|
836 |
+
* Global wpdb object.
|
837 |
+
*
|
838 |
+
* @var wpdb $wpdb
|
839 |
+
*/
|
840 |
+
global $wpdb;
|
841 |
+
|
842 |
+
//phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
843 |
+
$result = $wpdb->query(
|
844 |
+
$wpdb->prepare(
|
845 |
+
"UPDATE {$wpdb->posts} SET post_password = '' WHERE ID = %d AND post_type = %s",
|
846 |
+
$action_id,
|
847 |
+
self::POST_TYPE
|
848 |
+
)
|
849 |
+
);
|
850 |
+
if ( false === $result ) {
|
851 |
+
/* translators: %s: action ID */
|
852 |
+
throw new RuntimeException( sprintf( __( 'Unable to unlock claim on action %s. Database error.', 'action-scheduler' ), $action_id ) );
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
/**
|
857 |
+
* Mark failure on action.
|
858 |
+
*
|
859 |
+
* @param int $action_id Action ID.
|
860 |
+
*
|
861 |
+
* @return void
|
862 |
+
* @throws RuntimeException When unable to mark failure on action ID.
|
863 |
+
*/
|
864 |
+
public function mark_failure( $action_id ) {
|
865 |
+
/**
|
866 |
+
* Global wpdb object.
|
867 |
+
*
|
868 |
+
* @var wpdb $wpdb
|
869 |
+
*/
|
870 |
+
global $wpdb;
|
871 |
+
|
872 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
873 |
+
$result = $wpdb->query(
|
874 |
+
$wpdb->prepare( "UPDATE {$wpdb->posts} SET post_status = %s WHERE ID = %d AND post_type = %s", self::STATUS_FAILED, $action_id, self::POST_TYPE )
|
875 |
+
);
|
876 |
+
if ( false === $result ) {
|
877 |
+
/* translators: %s: action ID */
|
878 |
+
throw new RuntimeException( sprintf( __( 'Unable to mark failure on action %s. Database error.', 'action-scheduler' ), $action_id ) );
|
879 |
+
}
|
880 |
+
}
|
881 |
+
|
882 |
+
/**
|
883 |
+
* Return an action's claim ID, as stored in the post password column
|
884 |
+
*
|
885 |
+
* @param int $action_id Action ID.
|
886 |
+
* @return mixed
|
887 |
+
*/
|
888 |
+
public function get_claim_id( $action_id ) {
|
889 |
+
return $this->get_post_column( $action_id, 'post_password' );
|
890 |
+
}
|
891 |
+
|
892 |
+
/**
|
893 |
+
* Return an action's status, as stored in the post status column
|
894 |
+
*
|
895 |
+
* @param int $action_id Action ID.
|
896 |
+
*
|
897 |
+
* @return mixed
|
898 |
+
* @throws InvalidArgumentException When the action ID is invalid.
|
899 |
+
*/
|
900 |
+
public function get_status( $action_id ) {
|
901 |
+
$status = $this->get_post_column( $action_id, 'post_status' );
|
902 |
+
|
903 |
+
if ( null === $status ) {
|
904 |
+
throw new InvalidArgumentException( __( 'Invalid action ID. No status found.', 'action-scheduler' ) );
|
905 |
+
}
|
906 |
+
|
907 |
+
return $this->get_action_status_by_post_status( $status );
|
908 |
+
}
|
909 |
+
|
910 |
+
/**
|
911 |
+
* Get post column
|
912 |
+
*
|
913 |
+
* @param string $action_id Action ID.
|
914 |
+
* @param string $column_name Column Name.
|
915 |
+
*
|
916 |
+
* @return string|null
|
917 |
+
*/
|
918 |
+
private function get_post_column( $action_id, $column_name ) {
|
919 |
+
/**
|
920 |
+
* Global wpdb object.
|
921 |
+
*
|
922 |
+
* @var wpdb $wpdb
|
923 |
+
*/
|
924 |
+
global $wpdb;
|
925 |
+
|
926 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
927 |
+
return $wpdb->get_var(
|
928 |
+
$wpdb->prepare(
|
929 |
+
"SELECT {$column_name} FROM {$wpdb->posts} WHERE ID=%d AND post_type=%s", // phpcs:ignore
|
930 |
+
$action_id,
|
931 |
+
self::POST_TYPE
|
932 |
+
)
|
933 |
+
);
|
934 |
+
}
|
935 |
+
|
936 |
+
/**
|
937 |
+
* Log Execution.
|
938 |
+
*
|
939 |
+
* @param string $action_id Action ID.
|
940 |
+
*/
|
941 |
+
public function log_execution( $action_id ) {
|
942 |
+
/**
|
943 |
+
* Global wpdb object.
|
944 |
+
*
|
945 |
+
* @var wpdb $wpdb
|
946 |
+
*/
|
947 |
+
global $wpdb;
|
948 |
+
|
949 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
950 |
+
$wpdb->query(
|
951 |
+
$wpdb->prepare(
|
952 |
+
"UPDATE {$wpdb->posts} SET menu_order = menu_order+1, post_status=%s, post_modified_gmt = %s, post_modified = %s WHERE ID = %d AND post_type = %s",
|
953 |
+
self::STATUS_RUNNING,
|
954 |
+
current_time( 'mysql', true ),
|
955 |
+
current_time( 'mysql' ),
|
956 |
+
$action_id,
|
957 |
+
self::POST_TYPE
|
958 |
+
)
|
959 |
+
);
|
960 |
+
}
|
961 |
+
|
962 |
+
/**
|
963 |
+
* Record that an action was completed.
|
964 |
+
*
|
965 |
+
* @param string $action_id ID of the completed action.
|
966 |
+
*
|
967 |
+
* @throws InvalidArgumentException When the action ID is invalid.
|
968 |
+
* @throws RuntimeException When there was an error executing the action.
|
969 |
+
*/
|
970 |
+
public function mark_complete( $action_id ) {
|
971 |
+
$post = get_post( $action_id );
|
972 |
+
if ( empty( $post ) || ( self::POST_TYPE !== $post->post_type ) ) {
|
973 |
+
/* translators: %s is the action ID */
|
974 |
+
throw new InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'action-scheduler' ), $action_id ) );
|
975 |
+
}
|
976 |
+
add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 );
|
977 |
+
add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 );
|
978 |
+
$result = wp_update_post(
|
979 |
+
array(
|
980 |
+
'ID' => $action_id,
|
981 |
+
'post_status' => 'publish',
|
982 |
+
),
|
983 |
+
true
|
984 |
+
);
|
985 |
+
remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 );
|
986 |
+
remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 );
|
987 |
+
if ( is_wp_error( $result ) ) {
|
988 |
+
throw new RuntimeException( $result->get_error_message() );
|
989 |
+
}
|
990 |
+
|
991 |
+
/**
|
992 |
+
* Fires after a scheduled action has been completed.
|
993 |
+
*
|
994 |
+
* @since 3.4.2
|
995 |
+
*
|
996 |
+
* @param int $action_id Action ID.
|
997 |
+
*/
|
998 |
+
do_action( 'action_scheduler_completed_action', $action_id );
|
999 |
+
}
|
1000 |
+
|
1001 |
+
/**
|
1002 |
+
* Mark action as migrated when there is an error deleting the action.
|
1003 |
+
*
|
1004 |
+
* @param int $action_id Action ID.
|
1005 |
+
*/
|
1006 |
+
public function mark_migrated( $action_id ) {
|
1007 |
+
wp_update_post(
|
1008 |
+
array(
|
1009 |
+
'ID' => $action_id,
|
1010 |
+
'post_status' => 'migrated',
|
1011 |
+
)
|
1012 |
+
);
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
/**
|
1016 |
+
* Determine whether the post store can be migrated.
|
1017 |
+
*
|
1018 |
+
* @param [type] $setting - Setting value.
|
1019 |
+
* @return bool
|
1020 |
+
*/
|
1021 |
+
public function migration_dependencies_met( $setting ) {
|
1022 |
+
global $wpdb;
|
1023 |
+
|
1024 |
+
$dependencies_met = get_transient( self::DEPENDENCIES_MET );
|
1025 |
+
if ( empty( $dependencies_met ) ) {
|
1026 |
+
$maximum_args_length = apply_filters( 'action_scheduler_maximum_args_length', 191 );
|
1027 |
+
$found_action = $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
1028 |
+
$wpdb->prepare(
|
1029 |
+
"SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND CHAR_LENGTH(post_content) > %d LIMIT 1",
|
1030 |
+
$maximum_args_length,
|
1031 |
+
self::POST_TYPE
|
1032 |
+
)
|
1033 |
+
);
|
1034 |
+
$dependencies_met = $found_action ? 'no' : 'yes';
|
1035 |
+
set_transient( self::DEPENDENCIES_MET, $dependencies_met, DAY_IN_SECONDS );
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
return 'yes' === $dependencies_met ? $setting : false;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
/**
|
1042 |
+
* InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4.
|
1043 |
+
*
|
1044 |
+
* Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However,
|
1045 |
+
* as we prepare to move to custom tables, and can use an indexed VARCHAR column instead, we want to warn
|
1046 |
+
* developers of this impending requirement.
|
1047 |
+
*
|
1048 |
+
* @param ActionScheduler_Action $action Action object.
|
1049 |
+
*/
|
1050 |
+
protected function validate_action( ActionScheduler_Action $action ) {
|
1051 |
+
try {
|
1052 |
+
pare
|