Version Description
Download this release
Release Info
Developer | creativethemeshq |
Plugin | ![]() |
Version | 1.7.32 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.7.32
- blocksy-companion.php +100 -48
- framework/autoload.php +57 -27
- framework/cache-reset-manager.php +167 -0
- framework/cli.php +82 -0
- framework/dashboard.php +105 -1
- framework/edd/theme-updater-admin.php +449 -0
- framework/edd/theme-updater-class.php +165 -0
- framework/extensions-manager-api.php +33 -6
- framework/extensions-manager.php +331 -208
- framework/extensions/cookies-consent/config.php +2 -1
- framework/extensions/cookies-consent/customizer.php +66 -19
- framework/extensions/cookies-consent/extension.php +65 -18
- framework/extensions/cookies-consent/global.php +53 -31
- framework/extensions/cookies-consent/helpers.php +18 -15
- framework/extensions/cookies-consent/readme.php +17 -5
- framework/extensions/cookies-consent/static/bundle/main.css +3 -3
- framework/extensions/cookies-consent/static/bundle/main.js +3 -3
- framework/extensions/cookies-consent/static/bundle/sync.js +1 -1
- framework/extensions/cookies-consent/static/images/type-1.svg +16 -23
- framework/extensions/cookies-consent/static/images/type-2.svg +17 -29
- framework/extensions/cookies-consent/static/js/ct-events.js +270 -0
- framework/extensions/cookies-consent/static/js/helpers.js +7 -0
- framework/extensions/cookies-consent/static/js/lazy-load-helpers.js +20 -0
- framework/extensions/cookies-consent/static/js/main.js +3 -2
- framework/extensions/cookies-consent/static/js/sync.js +16 -5
- framework/extensions/cookies-consent/static/js/sync/helpers.js +145 -0
- framework/extensions/cookies-consent/static/js/variables.js +17 -7
- framework/extensions/cookies-consent/static/sass/main.scss +28 -29
- framework/extensions/mailchimp/admin-static/bundle/1.2c9ebf0a36c6c732fee6.js +14 -0
- framework/extensions/mailchimp/admin-static/bundle/2.976c8f43abfe584b1a9d.js +1 -0
- framework/extensions/mailchimp/admin-static/bundle/main.js +1 -1
- framework/extensions/mailchimp/admin-static/bundle/sync.js +1 -1
- framework/extensions/mailchimp/admin-static/js/ListPicker.js +1 -1
- framework/extensions/mailchimp/admin-static/js/ListPicker/Implementation.js +4 -2
- framework/extensions/mailchimp/admin-static/js/main.js +1 -0
- framework/extensions/mailchimp/admin-static/js/sync.js +56 -29
- framework/extensions/mailchimp/admin-static/js/variables.js +23 -10
- framework/extensions/mailchimp/config.php +1 -0
- framework/extensions/mailchimp/ct-mailchimp/options.php +26 -2
- framework/extensions/mailchimp/ct-mailchimp/view.php +30 -18
- framework/extensions/mailchimp/customizer.php +81 -45
- framework/extensions/mailchimp/dashboard-static/bundle/main.js +4 -10
- framework/extensions/mailchimp/dashboard-static/js/EditCredentials.js +72 -92
- framework/extensions/mailchimp/dashboard-static/js/ListPicker.js +15 -16
- framework/extensions/mailchimp/dashboard-static/js/Mailchimp.js +36 -7
- framework/extensions/mailchimp/dashboard-static/js/hooks/useActivationWithRequirements.js +10 -11
- framework/extensions/mailchimp/dashboard-static/js/main.js +1 -0
- framework/extensions/mailchimp/extension.php +54 -20
- framework/extensions/mailchimp/global.php +80 -42
- framework/extensions/mailchimp/helpers.php +51 -17
- framework/extensions/mailchimp/mailchimp-manager.php +37 -10
- framework/extensions/mailchimp/pre-boot.php +0 -1
- framework/extensions/mailchimp/readme.php +5 -11
- framework/extensions/mailchimp/static/bundle/main.css +3 -3
- framework/extensions/mailchimp/static/bundle/main.js +1 -0
- framework/extensions/mailchimp/static/js/main.js +82 -0
- framework/extensions/mailchimp/static/sass/main.scss +28 -18
- framework/extensions/mailchimp/static/sass/single-block.scss +42 -26
- framework/extensions/mailchimp/static/sass/widget.scss +21 -19
- framework/extensions/trending/config.php +6 -0
- framework/extensions/trending/customizer.php +193 -0
- framework/extensions/trending/extension.php +83 -0
- framework/extensions/trending/global.php +53 -0
- framework/extensions/trending/helpers.php +195 -0
- framework/extensions/trending/static/bundle/main.css +7 -0
- framework/extensions/trending/static/bundle/main.js +1 -0
- framework/extensions/trending/static/bundle/sync.js +1 -0
- framework/extensions/trending/static/js/main.js +17 -0
- framework/extensions/trending/static/js/sync.js +42 -0
- framework/extensions/trending/static/js/trending-block.js +139 -0
- framework/extensions/trending/static/sass/main.scss +0 -0
- framework/extensions/widgets/static/bundle/main.css +3 -3
- framework/extensions/widgets/static/sass/about-me.scss +67 -0
- framework/extensions/widgets/static/sass/contact-info.scss +19 -26
- framework/extensions/widgets/static/sass/facebook.scss +37 -0
- framework/extensions/widgets/static/sass/main.scss +4 -0
- framework/extensions/widgets/static/sass/posts.scss +118 -35
- framework/extensions/widgets/static/sass/quote.scss +39 -0
- framework/extensions/widgets/static/sass/social-icons.scss +23 -0
- framework/extensions/widgets/widgets/ct-about-me/helpers.php +18 -0
- framework/extensions/widgets/widgets/ct-about-me/options.php +235 -0
- framework/extensions/widgets/widgets/ct-about-me/view.php +139 -0
- framework/extensions/widgets/widgets/ct-about-me/widget.php +22 -0
- framework/extensions/widgets/widgets/ct-advertisement/view.php +9 -3
- framework/extensions/widgets/widgets/ct-advertisement/widget.php +1 -0
- framework/extensions/widgets/widgets/ct-contact-info/options.php +51 -17
- framework/extensions/widgets/widgets/ct-contact-info/view.php +10 -88
- framework/extensions/widgets/widgets/ct-contact-info/widget.php +1 -0
- framework/extensions/widgets/widgets/ct-facebook/options.php +52 -0
- framework/extensions/widgets/widgets/ct-facebook/view.php +61 -0
- framework/extensions/widgets/widgets/ct-facebook/widget.php +22 -0
- framework/extensions/widgets/widgets/ct-posts/options.php +272 -61
- framework/extensions/widgets/widgets/ct-posts/view.php +168 -67
- framework/extensions/widgets/widgets/ct-posts/widget.php +1 -0
- framework/extensions/widgets/widgets/ct-quote/options.php +55 -0
- framework/extensions/widgets/widgets/ct-quote/view.php +57 -0
- framework/extensions/widgets/widgets/ct-quote/widget.php +22 -0
- framework/extensions/widgets/widgets/ct-socials/options.php +8 -58
- framework/extensions/widgets/widgets/ct-socials/view.php +7 -9
- framework/extensions/widgets/widgets/ct-socials/widget.php +1 -0
- framework/extensions/woocommerce-extra/config.php +7 -0
- framework/extensions/woocommerce-extra/customizer.php +45 -0
- framework/extensions/woocommerce-extra/extension.php +100 -0
- framework/extensions/woocommerce-extra/floating-cart.php +92 -0
- framework/extensions/woocommerce-extra/global.php +70 -0
- framework/extensions/woocommerce-extra/helpers.php +281 -0
- framework/extensions/woocommerce-extra/readme.php +37 -0
- framework/extensions/woocommerce-extra/static/bundle/main.css +8 -0
- framework/extensions/woocommerce-extra/static/bundle/main.js +1 -0
- framework/extensions/woocommerce-extra/static/bundle/sync.js +1 -0
- framework/extensions/woocommerce-extra/static/js/floating-cart.js +94 -0
- framework/extensions/woocommerce-extra/static/js/helpers.js +15 -0
- framework/extensions/woocommerce-extra/static/js/main.js +217 -0
- framework/extensions/woocommerce-extra/static/js/sync.js +19 -0
- framework/extensions/woocommerce-extra/static/js/variables.js +28 -0
- framework/extensions/woocommerce-extra/static/sass/floating-bar/main.scss +156 -0
- framework/extensions/woocommerce-extra/static/sass/main.scss +3 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/main.scss +8 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/quick-view-button.scss +44 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/quick-view-card.scss +39 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/quick-view-gallery.scss +32 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/quick-view-loader.scss +10 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/quick-view-modal.scss +23 -0
- framework/extensions/woocommerce-extra/static/sass/quick-view/quick-view-summary.scss +63 -0
- framework/features/conditions-manager.php +455 -0
- framework/features/demo-install.php +340 -0
- framework/features/demo-install/child-theme.php +121 -0
- framework/features/demo-install/content-eraser.php +175 -0
- framework/features/demo-install/content-export.php +663 -0
- framework/features/demo-install/content-installer.php +416 -0
- framework/features/demo-install/fake-content-eraser.php +273 -0
- framework/features/demo-install/install-finish.php +189 -0
- framework/features/demo-install/options-export.php +106 -0
- framework/features/demo-install/options-import.php +319 -0
- framework/features/demo-install/parsers.php +701 -0
- framework/features/demo-install/plugins-uninstaller.php +44 -0
- framework/features/demo-install/required-plugins.php +85 -0
- framework/features/demo-install/widgets-export.php +67 -0
- framework/features/demo-install/widgets-import.php +277 -0
- framework/features/demo-install/wp-importer.php +1345 -0
- framework/features/dynamic-css.php +270 -0
- framework/features/google-analytics.php +63 -37
- framework/features/header.php +520 -0
- framework/features/header/account-modal.php +125 -0
- framework/features/header/header-options.php +177 -0
- framework/features/header/items/account/config.php +24 -0
- framework/features/header/items/account/dynamic-styles.php +277 -0
- framework/features/header/items/account/options.php +388 -0
- framework/features/header/items/account/sync.js +169 -0
- framework/features/header/items/account/view.php +101 -0
- framework/features/opengraph-meta-data.php +224 -0
- framework/helpers/blocksy-integration.php +177 -0
- framework/helpers/helpers.php +102 -0
- framework/theme-integration.php +228 -14
- framework/views/optin.php +6 -0
- framework/widgets-manager.php +40 -31
- freemius-pricing/178afa6030e76635dbe835e111d2c507.png +0 -0
- freemius-pricing/27b5a722a5553d9de0170325267fccec.png +0 -0
- freemius-pricing/4375c4a3ddc6f637c2ab9a2d7220f91e.png +0 -0
- freemius-pricing/5480ed23b199531a8cbc05924f26952b.png +0 -0
- freemius-pricing/b4f3b958f4a019862d81b15f3f8eee3a.svg +402 -0
- freemius-pricing/c03f665db27af43971565560adfba594.png +0 -0
- freemius-pricing/cb5fc4f6ec7ada72e986f6e7dde365bf.png +0 -0
- freemius-pricing/dd89563360f0272635c8f0ab7d7f1402.png +0 -0
- freemius-pricing/e366d70661d8ad2493bd6afbd779f125.png +0 -0
- freemius-pricing/f3aac72a8e63997d6bb888f816457e9b.png +0 -0
- freemius-pricing/f928f1be99776af83e8e6be4baf8ffe7.svg +227 -0
- freemius-pricing/fde48e4609a6ddc11d639fc2421f2afd.png +0 -0
- freemius-pricing/freemius-pricing.js +27 -0
blocksy-companion.php
CHANGED
@@ -3,65 +3,117 @@
|
|
3 |
/*
|
4 |
Plugin Name: Blocksy Companion
|
5 |
Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
|
6 |
-
Version: 1.
|
7 |
Author: CreativeThemes
|
8 |
Author URI: https://creativethemes.com
|
9 |
Text Domain: blc
|
10 |
Domain Path: /languages/
|
11 |
-
Network: true
|
12 |
License: GPLv2 or later
|
13 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
14 |
*/
|
15 |
|
16 |
-
if ( !
|
17 |
-
|
|
|
18 |
}
|
19 |
-
define( 'BLOCKSY__FILE__', __FILE__ );
|
20 |
-
define( 'BLOCKSY_PLUGIN_BASE', plugin_basename( BLOCKSY__FILE__ ) );
|
21 |
-
define( 'BLOCKSY_PATH', plugin_dir_path( BLOCKSY__FILE__ ) );
|
22 |
-
define( 'BLOCKSY_URL', plugin_dir_url( BLOCKSY__FILE__ ) );
|
23 |
|
24 |
-
add_action( 'plugins_loaded', 'blc_load_plugin_textdomain' );
|
25 |
|
26 |
-
if (
|
27 |
-
|
28 |
-
} elseif ( ! version_compare( get_bloginfo( 'version' ), '5.0', '>=' ) ) {
|
29 |
-
add_action( 'admin_notices', 'blc_fail_wp_version' );
|
30 |
} else {
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
/**
|
45 |
-
* Blocksy admin notice for minimum PHP version.
|
46 |
-
*
|
47 |
-
* Warning when the site doesn't have the minimum required PHP version.
|
48 |
-
*/
|
49 |
-
function blc_fail_php_version() {
|
50 |
-
/* translators: %s: PHP version */
|
51 |
-
$message = sprintf( esc_html__( 'Blocksy requires PHP version %s+, plugin is currently NOT RUNNING.', 'blc' ), '7.0' );
|
52 |
-
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
|
53 |
-
echo wp_kses_post( $html_message );
|
54 |
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Blocksy admin notice for minimum WordPress version.
|
58 |
-
*
|
59 |
-
* Warning when the site doesn't have the minimum required WordPress version.
|
60 |
-
*/
|
61 |
-
function blc_fail_wp_version() {
|
62 |
-
/* translators: %s: WordPress version */
|
63 |
-
$message = sprintf( esc_html__( 'Blocksy requires WordPress version %s+. Because you are using an earlier version, the plugin is currently NOT RUNNING.', 'blc' ), '5.0' );
|
64 |
-
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
|
65 |
-
echo wp_kses_post( $html_message );
|
66 |
-
}
|
67 |
-
|
3 |
/*
|
4 |
Plugin Name: Blocksy Companion
|
5 |
Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
|
6 |
+
Version: 1.7.32
|
7 |
Author: CreativeThemes
|
8 |
Author URI: https://creativethemes.com
|
9 |
Text Domain: blc
|
10 |
Domain Path: /languages/
|
|
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
*/
|
14 |
|
15 |
+
if ( !defined( 'ABSPATH' ) ) {
|
16 |
+
exit;
|
17 |
+
// Exit if accessed directly.
|
18 |
}
|
|
|
|
|
|
|
|
|
19 |
|
|
|
20 |
|
21 |
+
if ( function_exists( 'blc_fs' ) ) {
|
22 |
+
blc_fs()->set_basename( false, __FILE__ );
|
|
|
|
|
23 |
} else {
|
24 |
+
|
25 |
+
if ( !function_exists( 'blc_fs' ) ) {
|
26 |
+
global $blc_fs ;
|
27 |
+
|
28 |
+
if ( !isset( $blc_fs ) ) {
|
29 |
+
// Include Freemius SDK.
|
30 |
+
require_once dirname( __FILE__ ) . '/freemius/start.php';
|
31 |
+
$blc_fs = fs_dynamic_init( array(
|
32 |
+
'id' => '5115',
|
33 |
+
'slug' => 'blocksy-companion',
|
34 |
+
'premium_slug' => 'blocksy-companion-pro',
|
35 |
+
'type' => 'plugin',
|
36 |
+
'public_key' => 'pk_b00a5cbae90b2e948015a7d0710f5',
|
37 |
+
'premium_suffix' => 'PRO',
|
38 |
+
'is_premium' => false,
|
39 |
+
'has_addons' => false,
|
40 |
+
'has_paid_plans' => true,
|
41 |
+
'menu' => ( true ? [
|
42 |
+
'slug' => 'ct-dashboard',
|
43 |
+
'support' => false,
|
44 |
+
'contact' => false,
|
45 |
+
'pricing' => true,
|
46 |
+
'account' => true,
|
47 |
+
] : [
|
48 |
+
'support' => false,
|
49 |
+
'contact' => false,
|
50 |
+
'pricing' => false,
|
51 |
+
'account' => false,
|
52 |
+
] ),
|
53 |
+
'is_live' => true,
|
54 |
+
) );
|
55 |
+
function blc_fs()
|
56 |
+
{
|
57 |
+
global $blc_fs ;
|
58 |
+
return $blc_fs;
|
59 |
+
}
|
60 |
+
|
61 |
+
blc_fs();
|
62 |
+
do_action( 'blc_fs_loaded' );
|
63 |
+
blc_fs()->add_filter( 'freemius_pricing_js_path', function ( $d ) {
|
64 |
+
// return BLOCKSY_PATH . 'freemius-pricing/freemius-pricing.js';
|
65 |
+
// Only in DEV!!
|
66 |
+
return WP_CONTENT_DIR . '/plugins/blocksy-companion/freemius-pricing/freemius-pricing.js';
|
67 |
+
} );
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
define( 'BLOCKSY__FILE__', __FILE__ );
|
73 |
+
define( 'BLOCKSY_PLUGIN_BASE', plugin_basename( BLOCKSY__FILE__ ) );
|
74 |
+
define( 'BLOCKSY_PATH', plugin_dir_path( BLOCKSY__FILE__ ) );
|
75 |
+
define( 'BLOCKSY_URL', plugin_dir_url( BLOCKSY__FILE__ ) );
|
76 |
+
add_action( 'init', function () {
|
77 |
+
/**
|
78 |
+
* Load Blocksy textdomain.
|
79 |
+
*
|
80 |
+
* Load gettext translate for Blocksy text domain.
|
81 |
+
*/
|
82 |
+
load_plugin_textdomain( 'blc', false, dirname( BLOCKSY_PLUGIN_BASE ) . '/languages' );
|
83 |
+
} );
|
84 |
+
|
85 |
+
if ( !version_compare( PHP_VERSION, '7.0', '>=' ) ) {
|
86 |
+
add_action( 'admin_notices', 'blc_fail_php_version' );
|
87 |
+
} elseif ( !version_compare( get_bloginfo( 'version' ), '5.0', '>=' ) ) {
|
88 |
+
add_action( 'admin_notices', 'blc_fail_wp_version' );
|
89 |
+
} else {
|
90 |
+
require BLOCKSY_PATH . 'plugin.php';
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Blocksy admin notice for minimum PHP version.
|
95 |
+
*
|
96 |
+
* Warning when the site doesn't have the minimum required PHP version.
|
97 |
+
*/
|
98 |
+
function blc_fail_php_version()
|
99 |
+
{
|
100 |
+
/* translators: %s: PHP version */
|
101 |
+
$message = sprintf( esc_html__( 'Blocksy requires PHP version %s+, plugin is currently NOT RUNNING.', 'blc' ), '7.0' );
|
102 |
+
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
|
103 |
+
echo wp_kses_post( $html_message ) ;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Blocksy admin notice for minimum WordPress version.
|
108 |
+
*
|
109 |
+
* Warning when the site doesn't have the minimum required WordPress version.
|
110 |
+
*/
|
111 |
+
function blc_fail_wp_version()
|
112 |
+
{
|
113 |
+
/* translators: %s: WordPress version */
|
114 |
+
$message = sprintf( esc_html__( 'Blocksy requires WordPress version %s+. Because you are using an earlier version, the plugin is currently NOT RUNNING.', 'blc' ), '5.0' );
|
115 |
+
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
|
116 |
+
echo wp_kses_post( $html_message ) ;
|
117 |
+
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/autoload.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
namespace Blocksy;
|
4 |
|
5 |
-
if (
|
6 |
exit; // Exit if accessed directly.
|
7 |
}
|
8 |
|
@@ -14,25 +14,55 @@ class Autoloader {
|
|
14 |
/**
|
15 |
* Classes map.
|
16 |
*
|
17 |
-
* Maps
|
18 |
*
|
19 |
* @static
|
20 |
*
|
21 |
* @var array Classes used by blocksy.
|
22 |
*/
|
23 |
-
private static
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
/**
|
38 |
* Run autoloader.
|
@@ -42,7 +72,7 @@ class Autoloader {
|
|
42 |
* @static
|
43 |
*/
|
44 |
public static function run() {
|
45 |
-
spl_autoload_register(
|
46 |
}
|
47 |
|
48 |
/**
|
@@ -54,14 +84,14 @@ class Autoloader {
|
|
54 |
*
|
55 |
* @param string $relative_class_name Class name.
|
56 |
*/
|
57 |
-
private static function load_class(
|
58 |
-
if (
|
59 |
-
$filename = BLOCKSY_PATH . '/' . self
|
60 |
} else {
|
61 |
$filename = strtolower(
|
62 |
preg_replace(
|
63 |
-
[
|
64 |
-
[
|
65 |
$relative_class_name
|
66 |
)
|
67 |
);
|
@@ -69,7 +99,7 @@ class Autoloader {
|
|
69 |
$filename = BLOCKSY_PATH . $filename . '.php';
|
70 |
}
|
71 |
|
72 |
-
if (
|
73 |
require $filename;
|
74 |
}
|
75 |
}
|
@@ -83,26 +113,26 @@ class Autoloader {
|
|
83 |
*
|
84 |
* @param string $class Class name.
|
85 |
*/
|
86 |
-
private static function autoload(
|
87 |
if (
|
88 |
-
0 !== strpos(
|
89 |
&&
|
90 |
-
! isset(
|
91 |
) {
|
92 |
return;
|
93 |
}
|
94 |
|
95 |
-
$relative_class_name = preg_replace(
|
96 |
|
97 |
$final_class_name = __NAMESPACE__ . '\\' . $relative_class_name;
|
98 |
|
99 |
-
if (
|
100 |
$final_class_name = $relative_class_name;
|
101 |
$relative_class_name = '_' . $relative_class_name;
|
102 |
}
|
103 |
|
104 |
-
if (
|
105 |
-
self::load_class(
|
106 |
}
|
107 |
}
|
108 |
}
|
2 |
|
3 |
namespace Blocksy;
|
4 |
|
5 |
+
if (! defined('ABSPATH')) {
|
6 |
exit; // Exit if accessed directly.
|
7 |
}
|
8 |
|
14 |
/**
|
15 |
* Classes map.
|
16 |
*
|
17 |
+
* Maps Blocksy classes to file names.
|
18 |
*
|
19 |
* @static
|
20 |
*
|
21 |
* @var array Classes used by blocksy.
|
22 |
*/
|
23 |
+
private static function get_classes_map() {
|
24 |
+
return apply_filters('blocksy_autoloader_classes_map', [
|
25 |
+
'ExtensionsManager' => 'framework/extensions-manager.php',
|
26 |
+
'ExtensionsManagerApi' => 'framework/extensions-manager-api.php',
|
27 |
+
'Dashboard' => 'framework/dashboard.php',
|
28 |
+
'ThemeIntegration' => 'framework/theme-integration.php',
|
29 |
+
'CacheResetManager' => 'framework/cache-reset-manager.php',
|
30 |
|
31 |
+
'GoogleAnalytics' => 'framework/features/google-analytics.php',
|
32 |
+
'OpenGraphMetaData' => 'framework/features/opengraph-meta-data.php',
|
33 |
+
'HeaderAdditions' => 'framework/features/header.php',
|
34 |
+
'ConditionsManager' => 'framework/features/conditions-manager.php',
|
35 |
|
36 |
+
'Cli' => 'framework/cli.php',
|
37 |
+
|
38 |
+
'DynamicCss' => 'framework/features/dynamic-css.php',
|
39 |
+
'DemoInstall' => 'framework/features/demo-install.php',
|
40 |
+
'DemoInstallContentExport' => 'framework/features/demo-install/content-export.php',
|
41 |
+
'DemoInstallWidgetsExport' => 'framework/features/demo-install/widgets-export.php',
|
42 |
+
'DemoInstallOptionsExport' => 'framework/features/demo-install/options-export.php',
|
43 |
+
|
44 |
+
'DemoInstallChildThemeInstaller' => 'framework/features/demo-install/child-theme.php',
|
45 |
+
'DemoInstallPluginsInstaller' => 'framework/features/demo-install/required-plugins.php',
|
46 |
+
'DemoInstallPluginsUninstaller' => 'framework/features/demo-install/plugins-uninstaller.php',
|
47 |
+
'DemoInstallContentInstaller' => 'framework/features/demo-install/content-installer.php',
|
48 |
+
'DemoInstallOptionsInstaller' => 'framework/features/demo-install/options-import.php',
|
49 |
+
'DemoInstallWidgetsInstaller' => 'framework/features/demo-install/widgets-import.php',
|
50 |
+
'DemoInstallContentEraser' => 'framework/features/demo-install/content-eraser.php',
|
51 |
+
'DemoInstallFakeContentEraser' => 'framework/features/demo-install/fake-content-eraser.php',
|
52 |
+
'DemoInstallFinalActions' => 'framework/features/demo-install/install-finish.php',
|
53 |
+
'Premium' => 'framework/premium/pro.php',
|
54 |
+
|
55 |
+
/**
|
56 |
+
* No namespace
|
57 |
+
*/
|
58 |
+
'_BlocksyWidgetFactory' => 'framework/widgets-manager.php',
|
59 |
+
'_Blocksy_WP_Import' => 'framework/features/demo-install/wp-importer.php',
|
60 |
+
|
61 |
+
// TODO: remove when getting rid of EDD
|
62 |
+
'_EDD_SL_Plugin_Updater' => 'framework/edd/EDD_SL_Plugin_Updater.php',
|
63 |
+
'_EDD_Theme_Updater_Admin' => 'framework/edd/theme-updater-admin.php'
|
64 |
+
]);
|
65 |
+
}
|
66 |
|
67 |
/**
|
68 |
* Run autoloader.
|
72 |
* @static
|
73 |
*/
|
74 |
public static function run() {
|
75 |
+
spl_autoload_register([__CLASS__, 'autoload']);
|
76 |
}
|
77 |
|
78 |
/**
|
84 |
*
|
85 |
* @param string $relative_class_name Class name.
|
86 |
*/
|
87 |
+
private static function load_class($relative_class_name) {
|
88 |
+
if (isset( self::get_classes_map()[$relative_class_name])) {
|
89 |
+
$filename = BLOCKSY_PATH . '/' . self::get_classes_map()[$relative_class_name];
|
90 |
} else {
|
91 |
$filename = strtolower(
|
92 |
preg_replace(
|
93 |
+
['/([a-z])([A-Z])/', '/_/', '/\\\/'],
|
94 |
+
['$1-$2', '-', DIRECTORY_SEPARATOR],
|
95 |
$relative_class_name
|
96 |
)
|
97 |
);
|
99 |
$filename = BLOCKSY_PATH . $filename . '.php';
|
100 |
}
|
101 |
|
102 |
+
if (is_readable($filename)) {
|
103 |
require $filename;
|
104 |
}
|
105 |
}
|
113 |
*
|
114 |
* @param string $class Class name.
|
115 |
*/
|
116 |
+
private static function autoload($class) {
|
117 |
if (
|
118 |
+
0 !== strpos($class, __NAMESPACE__ . '\\')
|
119 |
&&
|
120 |
+
! isset(self::get_classes_map()['_' . $class])
|
121 |
) {
|
122 |
return;
|
123 |
}
|
124 |
|
125 |
+
$relative_class_name = preg_replace('/^' . __NAMESPACE__ . '\\\/', '', $class);
|
126 |
|
127 |
$final_class_name = __NAMESPACE__ . '\\' . $relative_class_name;
|
128 |
|
129 |
+
if (isset(self::get_classes_map()['_' . $relative_class_name])) {
|
130 |
$final_class_name = $relative_class_name;
|
131 |
$relative_class_name = '_' . $relative_class_name;
|
132 |
}
|
133 |
|
134 |
+
if (! class_exists($final_class_name)) {
|
135 |
+
self::load_class($relative_class_name);
|
136 |
}
|
137 |
}
|
138 |
}
|
framework/cache-reset-manager.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Blocksy;
|
4 |
+
|
5 |
+
class CacheResetManager {
|
6 |
+
public function __construct() {
|
7 |
+
add_action(
|
8 |
+
'upgrader_process_complete',
|
9 |
+
[$this, 'handle_update'],
|
10 |
+
10, 2
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
public function handle_update($upgrader, $options) {
|
15 |
+
if ($options['action'] !== 'update') {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
if ($options['type'] === 'theme') {
|
20 |
+
if (in_array('blocksy', $options['themes'])) {
|
21 |
+
$this->run_cache_purge();
|
22 |
+
do_action('blocksy:dynamic-css:regenere_css_files');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($options['type'] === 'plugin') {
|
27 |
+
$plugins = [];
|
28 |
+
|
29 |
+
if (isset($options['plugins']) && is_array($options['plugins'])) {
|
30 |
+
$plugins = $options['plugins'];
|
31 |
+
}
|
32 |
+
|
33 |
+
if (in_array(BLOCKSY_PLUGIN_BASE, $plugins)) {
|
34 |
+
$this->run_cache_purge();
|
35 |
+
do_action('blocksy:dynamic-css:regenere_css_files');
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function run_cache_purge() {
|
41 |
+
# Purge all W3 Total Cache
|
42 |
+
if (function_exists('w3tc_pgcache_flush')) {
|
43 |
+
w3tc_pgcache_flush();
|
44 |
+
}
|
45 |
+
|
46 |
+
if (function_exists('w3tc_flush_all')) {
|
47 |
+
w3tc_flush_all();
|
48 |
+
}
|
49 |
+
|
50 |
+
# Purge WP Super Cache
|
51 |
+
if (function_exists('wp_cache_clear_cache')) {
|
52 |
+
wp_cache_clear_cache();
|
53 |
+
}
|
54 |
+
|
55 |
+
if (isset($GLOBALS['wp_fastest_cache'])) {
|
56 |
+
if (method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')) {
|
57 |
+
$GLOBALS['wp_fastest_cache']->deleteCache();
|
58 |
+
$GLOBALS['wp_fastest_cache']->deleteCache(true);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
if (function_exists('cachify_flush_cache')) {
|
63 |
+
cachify_flush_cache();
|
64 |
+
}
|
65 |
+
|
66 |
+
if (class_exists("comet_cache")) {
|
67 |
+
\comet_cache::clear();
|
68 |
+
}
|
69 |
+
|
70 |
+
if (class_exists("zencache")) {
|
71 |
+
\zencache::clear();
|
72 |
+
}
|
73 |
+
|
74 |
+
if (class_exists('LiteSpeed_Cache_Tags')) {
|
75 |
+
\LiteSpeed_Cache_Tags::add_purge_tag('*');
|
76 |
+
}
|
77 |
+
|
78 |
+
if (function_exists('sg_cachepress_purge_cache')) {
|
79 |
+
sg_cachepress_purge_cache();
|
80 |
+
}
|
81 |
+
|
82 |
+
if (class_exists('LiteSpeed_Cache_Purge')) {
|
83 |
+
\LiteSpeed_Cache_Purge::purge_all('Clear Cache For Me');
|
84 |
+
}
|
85 |
+
|
86 |
+
if (class_exists('WP_Optimize') && defined('WPO_PLUGIN_MAIN_PATH')) {
|
87 |
+
if (! class_exists('WP_Optimize_Cache_Commands')) include_once(WPO_PLUGIN_MAIN_PATH . 'cache/class-cache-commands.php');
|
88 |
+
if (! class_exists('WP_Optimize_Minify_Commands')) include_once(WPO_PLUGIN_MAIN_PATH . 'minify/class-wp-optimize-minify-commands.php');
|
89 |
+
|
90 |
+
if (class_exists('WP_Optimize_Cache_Commands')) {
|
91 |
+
$wpoptimize_cache_commands = new \WP_Optimize_Cache_Commands();
|
92 |
+
$wpoptimize_cache_commands->purge_page_cache();
|
93 |
+
}
|
94 |
+
|
95 |
+
if (class_exists('WP_Optimize_Minify_Commands')) {
|
96 |
+
$wpoptimize_minify_commands = new \WP_Optimize_Minify_Commands();
|
97 |
+
$wpoptimize_minify_commands->purge_minify_cache();
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
if (
|
102 |
+
class_exists('WPaaS\Plugin')
|
103 |
+
&&
|
104 |
+
function_exists('fastvelocity_godaddy_request')
|
105 |
+
) {
|
106 |
+
fastvelocity_godaddy_request('BAN');
|
107 |
+
}
|
108 |
+
|
109 |
+
# Purge WP Engine
|
110 |
+
if (class_exists("WpeCommon")) {
|
111 |
+
if (method_exists('WpeCommon', 'purge_memcached')) {
|
112 |
+
\WpeCommon::purge_memcached();
|
113 |
+
}
|
114 |
+
|
115 |
+
if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
|
116 |
+
\WpeCommon::clear_maxcdn_cache();
|
117 |
+
}
|
118 |
+
|
119 |
+
if (method_exists('WpeCommon', 'purge_varnish_cache')) {
|
120 |
+
\WpeCommon::purge_varnish_cache();
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
if (function_exists('rocket_clean_domain')) {
|
125 |
+
rocket_clean_domain();
|
126 |
+
}
|
127 |
+
|
128 |
+
if (function_exists('wp_cache_clean_cache')) {
|
129 |
+
global $file_prefix;
|
130 |
+
wp_cache_clean_cache( $file_prefix, true );
|
131 |
+
}
|
132 |
+
|
133 |
+
if (class_exists('autoptimizeCache')) {
|
134 |
+
\autoptimizeCache::clearall();
|
135 |
+
}
|
136 |
+
|
137 |
+
if (function_exists('fvm_purge_all')) {
|
138 |
+
fvm_purge_all();
|
139 |
+
}
|
140 |
+
|
141 |
+
if (function_exists('fastvelocity_purge_others')) {
|
142 |
+
fastvelocity_purge_others();
|
143 |
+
}
|
144 |
+
|
145 |
+
# wordpress default cache
|
146 |
+
if (function_exists('wp_cache_flush')) {
|
147 |
+
wp_cache_flush();
|
148 |
+
}
|
149 |
+
|
150 |
+
# https://wordpress.org/plugins/hummingbird-performance/
|
151 |
+
do_action('wphb_clear_page_cache');
|
152 |
+
|
153 |
+
if (class_exists('Swift_Performance_Cache')) {
|
154 |
+
\Swift_Performance_Cache::clear_all_cache();
|
155 |
+
}
|
156 |
+
|
157 |
+
if (class_exists('\SiteGround_Optimizer\Supercacher\Supercacher')) {
|
158 |
+
\SiteGround_Optimizer\Supercacher\Supercacher::get_instance()->purge_everything();
|
159 |
+
do_action('siteground_delete_assets');
|
160 |
+
}
|
161 |
+
|
162 |
+
if (class_exists('ShortPixelAI')) {
|
163 |
+
\ShortPixelAI::clear_css_cache();
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
framework/cli.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Blocksy;
|
4 |
+
|
5 |
+
class Cli {
|
6 |
+
public function __construct() {
|
7 |
+
\WP_CLI::add_command('blocksy demo plugins', function ($args) {
|
8 |
+
$plugins = [
|
9 |
+
'coblocks',
|
10 |
+
'elementor',
|
11 |
+
'contact-form-7',
|
12 |
+
'woocommerce'
|
13 |
+
];
|
14 |
+
|
15 |
+
foreach ($plugins as $plugin) {
|
16 |
+
\WP_CLI::runcommand('plugin install ' . $plugin, [] );
|
17 |
+
\WP_CLI::runcommand('plugin activate ' . $plugin, [] );
|
18 |
+
}
|
19 |
+
});
|
20 |
+
|
21 |
+
\WP_CLI::add_command('blocksy demo options', function ($args) {
|
22 |
+
$options = new DemoInstallOptionsInstaller([
|
23 |
+
'has_streaming' => false,
|
24 |
+
'demo_name' => 'Main:elementor'
|
25 |
+
]);
|
26 |
+
|
27 |
+
$options->import();
|
28 |
+
});
|
29 |
+
|
30 |
+
\WP_CLI::add_command('blocksy widgets drop', function ($args) {
|
31 |
+
$sidebars_widgets = get_option('sidebars_widgets', array());
|
32 |
+
|
33 |
+
if (! isset($sidebars_widgets['wp_inactive_widgets'])) {
|
34 |
+
$sidebars_widgets['wp_inactive_widgets'] = [];
|
35 |
+
}
|
36 |
+
|
37 |
+
foreach ($sidebars_widgets as $sidebar_id => $widgets) {
|
38 |
+
if (! $widgets) continue;
|
39 |
+
if ($sidebar_id === 'wp_inactive_widgets') {
|
40 |
+
continue;
|
41 |
+
}
|
42 |
+
|
43 |
+
if ($sidebar_id === 'array_version') {
|
44 |
+
continue;
|
45 |
+
}
|
46 |
+
|
47 |
+
foreach ($widgets as $widget_id) {
|
48 |
+
$sidebars_widgets['wp_inactive_widgets'][] = $widget_id;
|
49 |
+
}
|
50 |
+
|
51 |
+
$sidebars_widgets[$sidebar_id] = [];
|
52 |
+
}
|
53 |
+
|
54 |
+
update_option('sidebars_widgets', $sidebars_widgets);
|
55 |
+
unset($sidebars_widgets['array_version']);
|
56 |
+
|
57 |
+
set_theme_mod('sidebars_widgets', [
|
58 |
+
'time' => time(),
|
59 |
+
'data' => $sidebars_widgets
|
60 |
+
]);
|
61 |
+
});
|
62 |
+
|
63 |
+
\WP_CLI::add_command('blocksy demo widgets', function ($args) {
|
64 |
+
$options = new DemoInstallWidgetsInstaller([
|
65 |
+
'has_streaming' => false,
|
66 |
+
'demo_name' => 'Blocksy News:elementor'
|
67 |
+
]);
|
68 |
+
|
69 |
+
$options->import();
|
70 |
+
});
|
71 |
+
|
72 |
+
\WP_CLI::add_command('blocksy demo content', function ($args) {
|
73 |
+
$options = new DemoInstallContentInstaller([
|
74 |
+
'has_streaming' => false,
|
75 |
+
'demo_name' => 'Main:elementor'
|
76 |
+
]);
|
77 |
+
|
78 |
+
$options->import();
|
79 |
+
});
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
framework/dashboard.php
CHANGED
@@ -9,6 +9,109 @@ class Dashboard {
|
|
9 |
[ $this, 'enqueue_static' ],
|
10 |
100
|
11 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
public function enqueue_static() {
|
@@ -19,6 +122,7 @@ class Dashboard {
|
|
19 |
|
20 |
$deps = apply_filters('blocksy-dashboard-scripts-dependencies', [
|
21 |
'wp-i18n',
|
|
|
22 |
'ct-options-scripts'
|
23 |
]);
|
24 |
|
@@ -27,7 +131,7 @@ class Dashboard {
|
|
27 |
BLOCKSY_URL . 'static/bundle/dashboard.js',
|
28 |
$deps,
|
29 |
$data['Version'],
|
30 |
-
|
31 |
);
|
32 |
|
33 |
wp_enqueue_style(
|
9 |
[ $this, 'enqueue_static' ],
|
10 |
100
|
11 |
);
|
12 |
+
|
13 |
+
add_action('admin_body_class', function ($class) {
|
14 |
+
if (blc_fs()->is_activation_mode()) {
|
15 |
+
$class .= ' blocksy-fs-optin-dashboard';
|
16 |
+
}
|
17 |
+
|
18 |
+
return $class;
|
19 |
+
});
|
20 |
+
|
21 |
+
blc_fs()->add_filter(
|
22 |
+
'connect-message_on-premium',
|
23 |
+
function ($text) {
|
24 |
+
if (strpos($text, '<br>') !== false) {
|
25 |
+
$exploded_message = explode('<br>', $text);
|
26 |
+
|
27 |
+
$text = '<span>' . $exploded_message[0] . '</span>' . $exploded_message[1];
|
28 |
+
}
|
29 |
+
|
30 |
+
return $text;
|
31 |
+
}
|
32 |
+
);
|
33 |
+
|
34 |
+
blc_fs()->add_filter(
|
35 |
+
'connect_message_on_update',
|
36 |
+
function (
|
37 |
+
$message,
|
38 |
+
$user_first_name,
|
39 |
+
$product_title,
|
40 |
+
$user_login,
|
41 |
+
$site_link,
|
42 |
+
$freemius_link
|
43 |
+
) {
|
44 |
+
$is_network_upgrade_mode = ( fs_is_network_admin() && blc_fs()->is_network_upgrade_mode() );
|
45 |
+
$slug = blc_fs()->get_slug();
|
46 |
+
$is_gdpr_required = \FS_GDPR_Manager::instance()->is_required();
|
47 |
+
$hey_x_text = esc_html( sprintf( fs_text_x_inline( 'Hey %s,', 'greeting', 'hey-x', $slug ), $user_first_name ) );
|
48 |
+
|
49 |
+
$default_optin_message = $is_gdpr_required ?
|
50 |
+
fs_text_inline( 'Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s. If you skip this, that\'s okay! %1$s will still work just fine.', 'connect-message_on-update', $slug ) :
|
51 |
+
fs_text_inline( 'Never miss an important update - opt in to our security & feature updates notifications, and non-sensitive diagnostic tracking with %4$s. If you skip this, that\'s okay! %1$s will still work just fine.', 'connect-message_on-update', $slug );
|
52 |
+
|
53 |
+
return (($is_network_upgrade_mode ?
|
54 |
+
'' :
|
55 |
+
/* translators: %s: name (e.g. Hey John,) */
|
56 |
+
'<span>' . $hey_x_text . '</span>'
|
57 |
+
) .
|
58 |
+
sprintf(
|
59 |
+
esc_html( $default_optin_message ),
|
60 |
+
'<b>' . esc_html( blc_fs()->get_plugin_name() ) . '</b>',
|
61 |
+
'<b>' . $user_login . '</b>',
|
62 |
+
$site_link,
|
63 |
+
$freemius_link
|
64 |
+
));
|
65 |
+
|
66 |
+
}, 10, 6
|
67 |
+
);
|
68 |
+
|
69 |
+
blc_fs()->add_action('connect/before', function () {
|
70 |
+
$path = dirname(__FILE__) . '/views/optin.php';
|
71 |
+
|
72 |
+
echo blc_call_fn(
|
73 |
+
['fn' => 'blocksy_render_view'],
|
74 |
+
$path,
|
75 |
+
[]
|
76 |
+
);
|
77 |
+
});
|
78 |
+
|
79 |
+
blc_fs()->add_action('connect/after', function () {
|
80 |
+
echo '</div>';
|
81 |
+
});
|
82 |
+
|
83 |
+
add_action(
|
84 |
+
'wp_ajax_blocksy_fs_connect_again',
|
85 |
+
function () {
|
86 |
+
if (! current_user_can('edit_theme_options')) {
|
87 |
+
wp_send_json_error();
|
88 |
+
}
|
89 |
+
|
90 |
+
blc_fs()->connect_again();
|
91 |
+
wp_send_json_success();
|
92 |
+
}
|
93 |
+
);
|
94 |
+
|
95 |
+
add_filter(
|
96 |
+
'blocksy_dashboard_localizations',
|
97 |
+
function ($d) {
|
98 |
+
$is_anonymous = blc_fs()->is_anonymous();
|
99 |
+
$connect_template = '';
|
100 |
+
|
101 |
+
if ($is_anonymous) {
|
102 |
+
ob_start();
|
103 |
+
blc_fs()->_connect_page_render();
|
104 |
+
$connect_template = ob_get_clean();
|
105 |
+
}
|
106 |
+
|
107 |
+
return array_merge([
|
108 |
+
'is_pro' => blc_fs()->is__premium_only(),
|
109 |
+
'is_anonymous' => $is_anonymous,
|
110 |
+
'connect_template' => $connect_template,
|
111 |
+
'has_beta_consent' => Plugin::instance()->user_wants_beta_updates()
|
112 |
+
], $d);
|
113 |
+
}
|
114 |
+
);
|
115 |
}
|
116 |
|
117 |
public function enqueue_static() {
|
122 |
|
123 |
$deps = apply_filters('blocksy-dashboard-scripts-dependencies', [
|
124 |
'wp-i18n',
|
125 |
+
'ct-events',
|
126 |
'ct-options-scripts'
|
127 |
]);
|
128 |
|
131 |
BLOCKSY_URL . 'static/bundle/dashboard.js',
|
132 |
$deps,
|
133 |
$data['Version'],
|
134 |
+
false
|
135 |
);
|
136 |
|
137 |
wp_enqueue_style(
|
framework/edd/theme-updater-admin.php
ADDED
@@ -0,0 +1,449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Theme updater admin page and functions.
|
4 |
+
*
|
5 |
+
* @package EDD Theme Updater
|
6 |
+
*/
|
7 |
+
|
8 |
+
class EDD_Theme_Updater_Admin {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Variables required for the theme updater
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
* @type string
|
15 |
+
*/
|
16 |
+
protected $remote_api_url = null;
|
17 |
+
protected $theme_slug = null;
|
18 |
+
protected $version = null;
|
19 |
+
protected $author = null;
|
20 |
+
protected $download_id = null;
|
21 |
+
protected $renew_url = null;
|
22 |
+
protected $strings = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Initialize the class.
|
26 |
+
*
|
27 |
+
* @since 1.0.0
|
28 |
+
*/
|
29 |
+
function __construct( $config = array(), $strings = array() ) {
|
30 |
+
|
31 |
+
$config = wp_parse_args( $config, array(
|
32 |
+
'remote_api_url' => 'http://easydigitaldownloads.com',
|
33 |
+
'theme_slug' => get_template(),
|
34 |
+
'item_name' => '',
|
35 |
+
'license' => '',
|
36 |
+
'version' => '',
|
37 |
+
'author' => '',
|
38 |
+
'download_id' => '',
|
39 |
+
'renew_url' => ''
|
40 |
+
) );
|
41 |
+
|
42 |
+
// Set config arguments
|
43 |
+
$this->remote_api_url = $config['remote_api_url'];
|
44 |
+
$this->item_name = $config['item_name'];
|
45 |
+
$this->theme_slug = sanitize_key( $config['theme_slug'] );
|
46 |
+
$this->version = $config['version'];
|
47 |
+
$this->author = $config['author'];
|
48 |
+
$this->download_id = $config['download_id'];
|
49 |
+
$this->renew_url = $config['renew_url'];
|
50 |
+
|
51 |
+
// Populate version fallback
|
52 |
+
if ( '' == $config['version'] ) {
|
53 |
+
$theme = wp_get_theme( $this->theme_slug );
|
54 |
+
$this->version = $theme->get( 'Version' );
|
55 |
+
}
|
56 |
+
|
57 |
+
// Strings passed in from the updater config
|
58 |
+
$this->strings = $strings;
|
59 |
+
|
60 |
+
add_action( 'admin_init', array( $this, 'updater' ) );
|
61 |
+
// add_action( 'admin_init', array( $this, 'register_option' ) );
|
62 |
+
// add_action( 'admin_init', array( $this, 'license_action' ) );
|
63 |
+
// add_action( 'admin_menu', array( $this, 'license_menu' ) );
|
64 |
+
// add_action( 'update_option_' . $this->theme_slug . '_license_key', array( $this, 'activate_license' ), 10, 2 );
|
65 |
+
add_filter( 'http_request_args', array( $this, 'disable_wporg_request' ), 5, 2 );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Creates the updater class.
|
70 |
+
*
|
71 |
+
* since 1.0.0
|
72 |
+
*/
|
73 |
+
function updater() {
|
74 |
+
|
75 |
+
/* If there is no valid license key status, don't allow updates. */
|
76 |
+
if ( get_option( $this->theme_slug . '_license_key_status', false) != 'valid' ) {
|
77 |
+
// return;
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( !class_exists( 'EDD_Theme_Updater' ) ) {
|
81 |
+
// Load our custom theme updater
|
82 |
+
include( dirname( __FILE__ ) . '/theme-updater-class.php' );
|
83 |
+
}
|
84 |
+
|
85 |
+
new EDD_Theme_Updater(
|
86 |
+
array(
|
87 |
+
'remote_api_url' => $this->remote_api_url,
|
88 |
+
'version' => $this->version,
|
89 |
+
// 'license' => trim( get_option( $this->theme_slug . '_license_key' ) ),
|
90 |
+
'license' => '123456',
|
91 |
+
'item_name' => $this->item_name,
|
92 |
+
'author' => $this->author
|
93 |
+
),
|
94 |
+
$this->strings
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Adds a menu item for the theme license under the appearance menu.
|
100 |
+
*
|
101 |
+
* since 1.0.0
|
102 |
+
*/
|
103 |
+
function license_menu() {
|
104 |
+
|
105 |
+
$strings = $this->strings;
|
106 |
+
|
107 |
+
add_theme_page(
|
108 |
+
$strings['theme-license'],
|
109 |
+
$strings['theme-license'],
|
110 |
+
'manage_options',
|
111 |
+
$this->theme_slug . '-license',
|
112 |
+
array( $this, 'license_page' )
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Outputs the markup used on the theme license page.
|
118 |
+
*
|
119 |
+
* since 1.0.0
|
120 |
+
*/
|
121 |
+
function license_page() {
|
122 |
+
|
123 |
+
$strings = $this->strings;
|
124 |
+
|
125 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
126 |
+
$status = get_option( $this->theme_slug . '_license_key_status', false );
|
127 |
+
|
128 |
+
// Checks license status to display under license key
|
129 |
+
if ( ! $license ) {
|
130 |
+
$message = $strings['enter-key'];
|
131 |
+
} else {
|
132 |
+
// delete_transient( $this->theme_slug . '_license_message' );
|
133 |
+
if ( ! get_transient( $this->theme_slug . '_license_message', false ) ) {
|
134 |
+
set_transient( $this->theme_slug . '_license_message', $this->check_license(), ( 60 * 60 * 24 ) );
|
135 |
+
}
|
136 |
+
$message = get_transient( $this->theme_slug . '_license_message' );
|
137 |
+
}
|
138 |
+
?>
|
139 |
+
<div class="wrap">
|
140 |
+
<h2><?php echo $strings['theme-license'] ?></h2>
|
141 |
+
<form method="post" action="options.php">
|
142 |
+
|
143 |
+
<?php settings_fields( $this->theme_slug . '-license' ); ?>
|
144 |
+
|
145 |
+
<table class="form-table">
|
146 |
+
<tbody>
|
147 |
+
|
148 |
+
<tr valign="top">
|
149 |
+
<th scope="row" valign="top">
|
150 |
+
<?php echo $strings['license-key']; ?>
|
151 |
+
</th>
|
152 |
+
<td>
|
153 |
+
<input id="<?php echo $this->theme_slug; ?>_license_key" name="<?php echo $this->theme_slug; ?>_license_key" type="text" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
|
154 |
+
<p class="description">
|
155 |
+
<?php echo $message; ?>
|
156 |
+
</p>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
|
160 |
+
<?php if ( $license ) { ?>
|
161 |
+
<tr valign="top">
|
162 |
+
<th scope="row" valign="top">
|
163 |
+
<?php echo $strings['license-action']; ?>
|
164 |
+
</th>
|
165 |
+
<td>
|
166 |
+
<?php
|
167 |
+
wp_nonce_field( $this->theme_slug . '_nonce', $this->theme_slug . '_nonce' );
|
168 |
+
if ( 'valid' == $status ) { ?>
|
169 |
+
<input type="submit" class="button-secondary" name="<?php echo $this->theme_slug; ?>_license_deactivate" value="<?php esc_attr_e( $strings['deactivate-license'] ); ?>"/>
|
170 |
+
<?php } else { ?>
|
171 |
+
<input type="submit" class="button-secondary" name="<?php echo $this->theme_slug; ?>_license_activate" value="<?php esc_attr_e( $strings['activate-license'] ); ?>"/>
|
172 |
+
<?php }
|
173 |
+
?>
|
174 |
+
</td>
|
175 |
+
</tr>
|
176 |
+
<?php } ?>
|
177 |
+
|
178 |
+
</tbody>
|
179 |
+
</table>
|
180 |
+
<?php submit_button(); ?>
|
181 |
+
</form>
|
182 |
+
<?php
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Registers the option used to store the license key in the options table.
|
187 |
+
*
|
188 |
+
* since 1.0.0
|
189 |
+
*/
|
190 |
+
function register_option() {
|
191 |
+
register_setting(
|
192 |
+
$this->theme_slug . '-license',
|
193 |
+
$this->theme_slug . '_license_key',
|
194 |
+
array( $this, 'sanitize_license' )
|
195 |
+
);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Sanitizes the license key.
|
200 |
+
*
|
201 |
+
* since 1.0.0
|
202 |
+
*
|
203 |
+
* @param string $new License key that was submitted.
|
204 |
+
* @return string $new Sanitized license key.
|
205 |
+
*/
|
206 |
+
function sanitize_license( $new ) {
|
207 |
+
|
208 |
+
$old = get_option( $this->theme_slug . '_license_key' );
|
209 |
+
|
210 |
+
if ( $old && $old != $new ) {
|
211 |
+
// New license has been entered, so must reactivate
|
212 |
+
delete_option( $this->theme_slug . '_license_key_status' );
|
213 |
+
delete_transient( $this->theme_slug . '_license_message' );
|
214 |
+
}
|
215 |
+
|
216 |
+
return $new;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Makes a call to the API.
|
221 |
+
*
|
222 |
+
* @since 1.0.0
|
223 |
+
*
|
224 |
+
* @param array $api_params to be used for wp_remote_get.
|
225 |
+
* @return array $response decoded JSON response.
|
226 |
+
*/
|
227 |
+
function get_api_response( $api_params ) {
|
228 |
+
|
229 |
+
// Call the custom API.
|
230 |
+
$response = wp_remote_get(
|
231 |
+
add_query_arg( $api_params, $this->remote_api_url ),
|
232 |
+
array( 'timeout' => 15, 'sslverify' => false )
|
233 |
+
);
|
234 |
+
|
235 |
+
// Make sure the response came back okay.
|
236 |
+
if ( is_wp_error( $response ) ) {
|
237 |
+
return false;
|
238 |
+
}
|
239 |
+
|
240 |
+
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
241 |
+
|
242 |
+
return $response;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Activates the license key.
|
247 |
+
*
|
248 |
+
* @since 1.0.0
|
249 |
+
*/
|
250 |
+
function activate_license() {
|
251 |
+
|
252 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
253 |
+
|
254 |
+
// Data to send in our API request.
|
255 |
+
$api_params = array(
|
256 |
+
'edd_action' => 'activate_license',
|
257 |
+
'license' => $license,
|
258 |
+
'item_name' => urlencode( $this->item_name )
|
259 |
+
);
|
260 |
+
|
261 |
+
$license_data = $this->get_api_response( $api_params );
|
262 |
+
|
263 |
+
// $response->license will be either "active" or "inactive"
|
264 |
+
if ( $license_data && isset( $license_data->license ) ) {
|
265 |
+
update_option( $this->theme_slug . '_license_key_status', $license_data->license );
|
266 |
+
delete_transient( $this->theme_slug . '_license_message' );
|
267 |
+
}
|
268 |
+
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Deactivates the license key.
|
273 |
+
*
|
274 |
+
* @since 1.0.0
|
275 |
+
*/
|
276 |
+
function deactivate_license() {
|
277 |
+
|
278 |
+
// Retrieve the license from the database.
|
279 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
280 |
+
|
281 |
+
// Data to send in our API request.
|
282 |
+
$api_params = array(
|
283 |
+
'edd_action' => 'deactivate_license',
|
284 |
+
'license' => $license,
|
285 |
+
'item_name' => urlencode( $this->item_name )
|
286 |
+
);
|
287 |
+
|
288 |
+
$license_data = $this->get_api_response( $api_params );
|
289 |
+
|
290 |
+
// $license_data->license will be either "deactivated" or "failed"
|
291 |
+
if ( $license_data && ( $license_data->license == 'deactivated' ) ) {
|
292 |
+
delete_option( $this->theme_slug . '_license_key_status' );
|
293 |
+
delete_transient( $this->theme_slug . '_license_message' );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Constructs a renewal link
|
299 |
+
*
|
300 |
+
* @since 1.0.0
|
301 |
+
*/
|
302 |
+
function get_renewal_link() {
|
303 |
+
|
304 |
+
// If a renewal link was passed in the config, use that
|
305 |
+
if ( '' != $this->renew_url ) {
|
306 |
+
return $this->renew_url;
|
307 |
+
}
|
308 |
+
|
309 |
+
// If download_id was passed in the config, a renewal link can be constructed
|
310 |
+
// $license_key = trim( get_option( $this->theme_slug . '_license_key', false ) );
|
311 |
+
$license_key = '123456';
|
312 |
+
|
313 |
+
if ( '' != $this->download_id && $license_key ) {
|
314 |
+
$url = esc_url( $this->remote_api_url );
|
315 |
+
$url .= '/checkout/?edd_license_key=' . $license_key . '&download_id=' . $this->download_id;
|
316 |
+
return $url;
|
317 |
+
}
|
318 |
+
|
319 |
+
// Otherwise return the remote_api_url
|
320 |
+
return $this->remote_api_url;
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Checks if a license action was submitted.
|
328 |
+
*
|
329 |
+
* @since 1.0.0
|
330 |
+
*/
|
331 |
+
function license_action() {
|
332 |
+
|
333 |
+
if ( isset( $_POST[ $this->theme_slug . '_license_activate' ] ) ) {
|
334 |
+
if ( check_admin_referer( $this->theme_slug . '_nonce', $this->theme_slug . '_nonce' ) ) {
|
335 |
+
$this->activate_license();
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
if ( isset( $_POST[$this->theme_slug . '_license_deactivate'] ) ) {
|
340 |
+
if ( check_admin_referer( $this->theme_slug . '_nonce', $this->theme_slug . '_nonce' ) ) {
|
341 |
+
$this->deactivate_license();
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Checks if license is valid and gets expire date.
|
349 |
+
*
|
350 |
+
* @since 1.0.0
|
351 |
+
*
|
352 |
+
* @return string $message License status message.
|
353 |
+
*/
|
354 |
+
function check_license() {
|
355 |
+
|
356 |
+
$license = trim( get_option( $this->theme_slug . '_license_key' ) );
|
357 |
+
$strings = $this->strings;
|
358 |
+
|
359 |
+
$api_params = array(
|
360 |
+
'edd_action' => 'check_license',
|
361 |
+
'license' => $license,
|
362 |
+
'item_name' => urlencode( $this->item_name )
|
363 |
+
);
|
364 |
+
|
365 |
+
$license_data = $this->get_api_response( $api_params );
|
366 |
+
|
367 |
+
// If response doesn't include license data, return
|
368 |
+
if ( !isset( $license_data->license ) ) {
|
369 |
+
$message = $strings['license-unknown'];
|
370 |
+
return $message;
|
371 |
+
}
|
372 |
+
|
373 |
+
// Get expire date
|
374 |
+
$expires = false;
|
375 |
+
if ( isset( $license_data->expires ) ) {
|
376 |
+
$expires = date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires ) );
|
377 |
+
$renew_link = '<a href="' . esc_url( $this->get_renewal_link() ) . '" target="_blank">' . $strings['renew'] . '</a>';
|
378 |
+
}
|
379 |
+
|
380 |
+
// Get site counts
|
381 |
+
$site_count = $license_data->site_count;
|
382 |
+
$license_limit = $license_data->license_limit;
|
383 |
+
|
384 |
+
// If unlimited
|
385 |
+
if ( 0 == $license_limit ) {
|
386 |
+
$license_limit = $strings['unlimited'];
|
387 |
+
}
|
388 |
+
|
389 |
+
if ( $license_data->license == 'valid' ) {
|
390 |
+
$message = $strings['license-key-is-active'] . ' ';
|
391 |
+
if ( $expires ) {
|
392 |
+
$message .= sprintf( $strings['expires%s'], $expires ) . ' ';
|
393 |
+
}
|
394 |
+
if ( $site_count && $license_limit ) {
|
395 |
+
$message .= sprintf( $strings['%1$s/%2$-sites'], $site_count, $license_limit );
|
396 |
+
}
|
397 |
+
} else if ( $license_data->license == 'expired' ) {
|
398 |
+
if ( $expires ) {
|
399 |
+
$message = sprintf( $strings['license-key-expired-%s'], $expires );
|
400 |
+
} else {
|
401 |
+
$message = $strings['license-key-expired'];
|
402 |
+
}
|
403 |
+
if ( $renew_link ) {
|
404 |
+
$message .= ' ' . $renew_link;
|
405 |
+
}
|
406 |
+
} else if ( $license_data->license == 'invalid' ) {
|
407 |
+
$message = $strings['license-keys-do-not-match'];
|
408 |
+
} else if ( $license_data->license == 'inactive' ) {
|
409 |
+
$message = $strings['license-is-inactive'];
|
410 |
+
} else if ( $license_data->license == 'disabled' ) {
|
411 |
+
$message = $strings['license-key-is-disabled'];
|
412 |
+
} else if ( $license_data->license == 'site_inactive' ) {
|
413 |
+
// Site is inactive
|
414 |
+
$message = $strings['site-is-inactive'];
|
415 |
+
} else {
|
416 |
+
$message = $strings['license-status-unknown'];
|
417 |
+
}
|
418 |
+
|
419 |
+
return $message;
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Disable requests to wp.org repository for this theme.
|
424 |
+
*
|
425 |
+
* @since 1.0.0
|
426 |
+
*/
|
427 |
+
function disable_wporg_request( $r, $url ) {
|
428 |
+
return $r;
|
429 |
+
|
430 |
+
// If it's not a theme update request, bail.
|
431 |
+
if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/1.1/' ) ) {
|
432 |
+
return $r;
|
433 |
+
}
|
434 |
+
|
435 |
+
// Decode the JSON response
|
436 |
+
$themes = json_decode( $r['body']['themes'] );
|
437 |
+
|
438 |
+
// Remove the active parent and child themes from the check
|
439 |
+
$parent = get_option( 'template' );
|
440 |
+
$child = get_option( 'stylesheet' );
|
441 |
+
unset( $themes->themes->$parent );
|
442 |
+
unset( $themes->themes->$child );
|
443 |
+
|
444 |
+
// Encode the updated JSON response
|
445 |
+
$r['body']['themes'] = json_encode( $themes );
|
446 |
+
|
447 |
+
return $r;
|
448 |
+
}
|
449 |
+
}
|
framework/edd/theme-updater-class.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Theme updater class.
|
4 |
+
*
|
5 |
+
* @package EDD Theme Updater
|
6 |
+
*/
|
7 |
+
|
8 |
+
class EDD_Theme_Updater {
|
9 |
+
|
10 |
+
private $remote_api_url;
|
11 |
+
private $request_data;
|
12 |
+
private $response_key;
|
13 |
+
private $theme_slug;
|
14 |
+
private $license_key;
|
15 |
+
private $version;
|
16 |
+
private $author;
|
17 |
+
protected $strings = null;
|
18 |
+
|
19 |
+
function __construct( $args = array(), $strings = array() ) {
|
20 |
+
|
21 |
+
$args = wp_parse_args( $args, array(
|
22 |
+
'remote_api_url' => 'http://easydigitaldownloads.com',
|
23 |
+
'request_data' => array(),
|
24 |
+
'theme_slug' => get_template(),
|
25 |
+
'item_name' => '',
|
26 |
+
'license' => '',
|
27 |
+
'version' => '',
|
28 |
+
'author' => ''
|
29 |
+
) );
|
30 |
+
extract( $args );
|
31 |
+
|
32 |
+
$this->license = $license;
|
33 |
+
$this->item_name = $item_name;
|
34 |
+
$this->version = $version;
|
35 |
+
$this->theme_slug = sanitize_key( $theme_slug );
|
36 |
+
$this->author = $author;
|
37 |
+
$this->remote_api_url = $remote_api_url;
|
38 |
+
$this->response_key = $this->theme_slug . '-update-response';
|
39 |
+
$this->strings = $strings;
|
40 |
+
|
41 |
+
add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
|
42 |
+
add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
|
43 |
+
add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
|
44 |
+
add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
|
45 |
+
add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
|
46 |
+
}
|
47 |
+
|
48 |
+
function load_themes_screen() {
|
49 |
+
add_thickbox();
|
50 |
+
add_action( 'admin_notices', array( &$this, 'update_nag' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
function update_nag() {
|
54 |
+
|
55 |
+
$strings = $this->strings;
|
56 |
+
|
57 |
+
$theme = wp_get_theme( $this->theme_slug );
|
58 |
+
|
59 |
+
$api_response = get_transient( $this->response_key );
|
60 |
+
|
61 |
+
if ( false === $api_response ) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$update_url = wp_nonce_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $this->theme_slug ), 'upgrade-theme_' . $this->theme_slug );
|
66 |
+
$update_onclick = ' onclick="if ( confirm(\'' . esc_js( $strings['update-notice'] ) . '\') ) {return true;}return false;"';
|
67 |
+
|
68 |
+
if ( version_compare( $this->version, $api_response->new_version, '<' ) ) {
|
69 |
+
|
70 |
+
echo '<div id="update-nag">';
|
71 |
+
printf(
|
72 |
+
$strings['update-available'],
|
73 |
+
$theme->get( 'Name' ),
|
74 |
+
$api_response->new_version,
|
75 |
+
'#TB_inline?width=640&inlineId=' . $this->theme_slug . '_changelog',
|
76 |
+
$theme->get( 'Name' ),
|
77 |
+
$update_url,
|
78 |
+
$update_onclick
|
79 |
+
);
|
80 |
+
echo '</div>';
|
81 |
+
echo '<div id="' . $this->theme_slug . '_' . 'changelog" style="display:none;">';
|
82 |
+
echo wpautop( $api_response->sections['changelog'] );
|
83 |
+
echo '</div>';
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
function theme_update_transient($value) {
|
88 |
+
$update_data = $this->check_for_update();
|
89 |
+
|
90 |
+
if ($update_data && ! isset($value->response[$this->theme_slug])) {
|
91 |
+
$value->response[$this->theme_slug] = @$update_data;
|
92 |
+
}
|
93 |
+
|
94 |
+
if (
|
95 |
+
$update_data
|
96 |
+
&&
|
97 |
+
isset($value->response[$this->theme_slug])
|
98 |
+
&&
|
99 |
+
isset($value->response[$this->theme_slug]['new_version'])
|
100 |
+
&&
|
101 |
+
version_compare(
|
102 |
+
$update_data['new_version'],
|
103 |
+
$value->response[$this->theme_slug]['new_version']
|
104 |
+
) > 0
|
105 |
+
) {
|
106 |
+
$value->response[$this->theme_slug] = $update_data;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $value;
|
110 |
+
}
|
111 |
+
|
112 |
+
function delete_theme_update_transient() {
|
113 |
+
delete_transient($this->response_key);
|
114 |
+
}
|
115 |
+
|
116 |
+
function check_for_update() {
|
117 |
+
$update_data = get_transient( $this->response_key );
|
118 |
+
|
119 |
+
if ( false === $update_data ) {
|
120 |
+
$failed = false;
|
121 |
+
|
122 |
+
$api_params = array(
|
123 |
+
'edd_action' => 'get_version',
|
124 |
+
'license' => $this->license,
|
125 |
+
'name' => $this->item_name,
|
126 |
+
'slug' => $this->theme_slug,
|
127 |
+
'author' => $this->author
|
128 |
+
);
|
129 |
+
|
130 |
+
$response = wp_remote_post( $this->remote_api_url, array( 'timeout' => 15, 'body' => $api_params ) );
|
131 |
+
|
132 |
+
// Make sure the response was successful
|
133 |
+
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
134 |
+
$failed = true;
|
135 |
+
}
|
136 |
+
|
137 |
+
$update_data = json_decode( wp_remote_retrieve_body( $response ) );
|
138 |
+
|
139 |
+
if ( ! is_object( $update_data ) ) {
|
140 |
+
$failed = true;
|
141 |
+
}
|
142 |
+
|
143 |
+
// If the response failed, try again in 30 minutes
|
144 |
+
if ( $failed ) {
|
145 |
+
$data = new stdClass;
|
146 |
+
$data->new_version = $this->version;
|
147 |
+
set_transient( $this->response_key, $data, strtotime( '+30 minutes' ) );
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
// If the status is 'ok', return the update arguments
|
152 |
+
if ( ! $failed ) {
|
153 |
+
$update_data->sections = maybe_unserialize( $update_data->sections );
|
154 |
+
set_transient( $this->response_key, $update_data, strtotime( '+12 hours' ) );
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
if ( version_compare( $this->version, $update_data->new_version, '>=' ) ) {
|
159 |
+
return false;
|
160 |
+
}
|
161 |
+
|
162 |
+
return (array) $update_data;
|
163 |
+
}
|
164 |
+
|
165 |
+
}
|
framework/extensions-manager-api.php
CHANGED
@@ -14,20 +14,47 @@ class ExtensionsManagerApi {
|
|
14 |
|
15 |
protected $ajax_actions = [
|
16 |
'blocksy_extensions_status',
|
17 |
-
|
18 |
'blocksy_extension_activate',
|
19 |
'blocksy_extension_deactivate',
|
20 |
];
|
21 |
|
22 |
public function blocksy_extensions_status() {
|
23 |
-
$this->check_capability(
|
24 |
$manager = Plugin::instance()->extensions;
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
public function blocksy_extension_activate() {
|
30 |
-
$this->check_capability(
|
31 |
$manager = Plugin::instance()->extensions;
|
32 |
|
33 |
$manager->activate_extension($this->get_extension_from_request());
|
@@ -36,7 +63,7 @@ class ExtensionsManagerApi {
|
|
36 |
}
|
37 |
|
38 |
public function blocksy_extension_deactivate() {
|
39 |
-
$this->check_capability(
|
40 |
$manager = Plugin::instance()->extensions;
|
41 |
|
42 |
$manager->deactivate_extension($this->get_extension_from_request());
|
@@ -59,7 +86,7 @@ class ExtensionsManagerApi {
|
|
59 |
wp_send_json_error();
|
60 |
}
|
61 |
|
62 |
-
return addslashes(
|
63 |
}
|
64 |
|
65 |
public function attach_ajax_actions() {
|
14 |
|
15 |
protected $ajax_actions = [
|
16 |
'blocksy_extensions_status',
|
|
|
17 |
'blocksy_extension_activate',
|
18 |
'blocksy_extension_deactivate',
|
19 |
];
|
20 |
|
21 |
public function blocksy_extensions_status() {
|
22 |
+
$this->check_capability('edit_theme_options');
|
23 |
$manager = Plugin::instance()->extensions;
|
24 |
|
25 |
+
$maybe_input = json_decode(file_get_contents('php://input'), true);
|
26 |
+
|
27 |
+
$data = $manager->get_extensions([
|
28 |
+
'forced_reread' => true
|
29 |
+
]);
|
30 |
+
|
31 |
+
if (
|
32 |
+
$maybe_input
|
33 |
+
&&
|
34 |
+
isset($maybe_input['extension'])
|
35 |
+
&&
|
36 |
+
isset($maybe_input['extAction'])
|
37 |
+
) {
|
38 |
+
$ext_preboot = $manager->get($maybe_input['extension'], [
|
39 |
+
'type' => 'preboot'
|
40 |
+
]);
|
41 |
+
|
42 |
+
if (method_exists(
|
43 |
+
$ext_preboot, 'ext_action'
|
44 |
+
)) {
|
45 |
+
$result = $ext_preboot->ext_action($maybe_input['extAction']);
|
46 |
+
|
47 |
+
if ($result) {
|
48 |
+
$data[$maybe_input['extension']]['data'] = $result;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
wp_send_json_success($data);
|
54 |
}
|
55 |
|
56 |
public function blocksy_extension_activate() {
|
57 |
+
$this->check_capability('edit_theme_options');
|
58 |
$manager = Plugin::instance()->extensions;
|
59 |
|
60 |
$manager->activate_extension($this->get_extension_from_request());
|
63 |
}
|
64 |
|
65 |
public function blocksy_extension_deactivate() {
|
66 |
+
$this->check_capability('edit_theme_options');
|
67 |
$manager = Plugin::instance()->extensions;
|
68 |
|
69 |
$manager->deactivate_extension($this->get_extension_from_request());
|
86 |
wp_send_json_error();
|
87 |
}
|
88 |
|
89 |
+
return addslashes($_POST['ext']);
|
90 |
}
|
91 |
|
92 |
public function attach_ajax_actions() {
|
framework/extensions-manager.php
CHANGED
@@ -2,211 +2,334 @@
|
|
2 |
|
3 |
namespace Blocksy;
|
4 |
|
5 |
-
class ExtensionsManager
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Blocksy;
|
4 |
|
5 |
+
class ExtensionsManager
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Collection of all the activated extensions.
|
9 |
+
*
|
10 |
+
* @var array The array of all the extension objects.
|
11 |
+
*/
|
12 |
+
private $extensions = array() ;
|
13 |
+
private function get_option_name()
|
14 |
+
{
|
15 |
+
return 'blocksy_active_extensions';
|
16 |
+
}
|
17 |
+
|
18 |
+
public function get( $id, $args = array() )
|
19 |
+
{
|
20 |
+
$args = wp_parse_args( $args, [
|
21 |
+
'type' => 'regular',
|
22 |
+
] );
|
23 |
+
if ( !isset( $this->extensions[$id] ) ) {
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
|
27 |
+
if ( $args['type'] === 'preboot' ) {
|
28 |
+
if ( !isset( $this->extensions[$id]['__object_preboot'] ) ) {
|
29 |
+
return null;
|
30 |
+
}
|
31 |
+
return $this->extensions[$id]['__object_preboot'];
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( !isset( $this->extensions[$id]['__object'] ) ) {
|
35 |
+
return null;
|
36 |
+
}
|
37 |
+
return $this->extensions[$id]['__object'];
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Collect all available extensions and activate the ones that have to be so.
|
42 |
+
*/
|
43 |
+
public function __construct()
|
44 |
+
{
|
45 |
+
$this->read_installed_extensions();
|
46 |
+
if ( $this->is_dashboard_page() ) {
|
47 |
+
$this->do_extensions_preboot();
|
48 |
+
}
|
49 |
+
foreach ( $this->get_activated_extensions() as $single_id ) {
|
50 |
+
$this->boot_activated_extension_for( $single_id );
|
51 |
+
}
|
52 |
+
add_action( 'activate_blocksy-companion/blocksy-companion.php', [ $this, 'handle_activation' ], 11 );
|
53 |
+
add_action( 'deactivate_blocksy-companion/blocksy-companion.php', [ $this, 'handle_deactivation' ], 11 );
|
54 |
+
}
|
55 |
+
|
56 |
+
public function handle_activation()
|
57 |
+
{
|
58 |
+
ob_start();
|
59 |
+
foreach ( $this->get_activated_extensions() as $id ) {
|
60 |
+
if ( method_exists( $this->get_class_name_for( $id ), "onActivation" ) ) {
|
61 |
+
call_user_func( [ $this->get_class_name_for( $id ), 'onActivation' ] );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
ob_get_clean();
|
65 |
+
}
|
66 |
+
|
67 |
+
public function handle_deactivation()
|
68 |
+
{
|
69 |
+
foreach ( $this->get_activated_extensions() as $id ) {
|
70 |
+
if ( method_exists( $this->get_class_name_for( $id ), "onDeactivation" ) ) {
|
71 |
+
call_user_func( [ $this->get_class_name_for( $id ), 'onDeactivation' ] );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
public function do_extensions_preboot()
|
77 |
+
{
|
78 |
+
foreach ( array_keys( $this->get_extensions() ) as $single_id ) {
|
79 |
+
$this->maybe_do_extension_preboot( $single_id );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
private function is_dashboard_page()
|
84 |
+
{
|
85 |
+
global $pagenow ;
|
86 |
+
$is_ct_settings = isset( $_GET['page'] ) && 'ct-dashboard' === $_GET['page'];
|
87 |
+
return $is_ct_settings;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function get_extensions( $args = array() )
|
91 |
+
{
|
92 |
+
$args = wp_parse_args( $args, [
|
93 |
+
'forced_reread' => false,
|
94 |
+
] );
|
95 |
+
|
96 |
+
if ( $args['forced_reread'] ) {
|
97 |
+
foreach ( $this->extensions as $id => $extension ) {
|
98 |
+
$this->extensions[$id]['config'] = $this->read_config_for( $extension['path'] );
|
99 |
+
$this->extensions[$id]['readme'] = $this->read_readme_for( $extension['path'] );
|
100 |
+
}
|
101 |
+
$this->register_fake_extensions();
|
102 |
+
}
|
103 |
+
|
104 |
+
return $this->extensions;
|
105 |
+
}
|
106 |
+
|
107 |
+
public function can( $capability = 'install_plugins' )
|
108 |
+
{
|
109 |
+
$user = wp_get_current_user();
|
110 |
+
// return array_intersect(['administrator'], $user->roles );
|
111 |
+
|
112 |
+
if ( is_multisite() ) {
|
113 |
+
// Only network admin can change files that affects the entire network.
|
114 |
+
$can = current_user_can_for_blog( get_current_blog_id(), $capability );
|
115 |
+
} else {
|
116 |
+
$can = current_user_can( $capability );
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( $can ) {
|
120 |
+
// Also you can use this method to get the capability.
|
121 |
+
$can = $capability;
|
122 |
+
}
|
123 |
+
return $can;
|
124 |
+
}
|
125 |
+
|
126 |
+
public function activate_extension( $id )
|
127 |
+
{
|
128 |
+
if ( !isset( $this->extensions[$id] ) ) {
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
if ( !$this->extensions[$id]['path'] ) {
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
$activated = $this->get_activated_extensions();
|
135 |
+
|
136 |
+
if ( !in_array( strtolower( $id ), $activated ) ) {
|
137 |
+
$path = $this->extensions[$id]['path'];
|
138 |
+
require_once $path . '/extension.php';
|
139 |
+
if ( method_exists( $this->get_class_name_for( $id ), "onActivation" ) ) {
|
140 |
+
call_user_func( [ $this->get_class_name_for( $id ), 'onActivation' ] );
|
141 |
+
}
|
142 |
+
$class = $this->get_class_name_for( $id );
|
143 |
+
// Init extension right away.
|
144 |
+
new $class();
|
145 |
+
}
|
146 |
+
|
147 |
+
$activated[] = strtolower( $id );
|
148 |
+
update_option( $this->get_option_name(), array_unique( $activated ) );
|
149 |
+
Plugin::instance()->dynamic_css->generate_css_files();
|
150 |
+
}
|
151 |
+
|
152 |
+
public function deactivate_extension( $id )
|
153 |
+
{
|
154 |
+
if ( !isset( $this->extensions[$id] ) ) {
|
155 |
+
return;
|
156 |
+
}
|
157 |
+
if ( !$this->extensions[$id]['path'] ) {
|
158 |
+
return;
|
159 |
+
}
|
160 |
+
$activated = $this->get_activated_extensions();
|
161 |
+
if ( in_array( strtolower( $id ), $activated ) ) {
|
162 |
+
if ( method_exists( $this->get_class_name_for( $id ), "onDeactivation" ) ) {
|
163 |
+
call_user_func( [ $this->get_class_name_for( $id ), 'onDeactivation' ] );
|
164 |
+
}
|
165 |
+
}
|
166 |
+
update_option( $this->get_option_name(), array_diff( $activated, [ $id ] ) );
|
167 |
+
Plugin::instance()->dynamic_css->generate_css_files();
|
168 |
+
}
|
169 |
+
|
170 |
+
private function read_installed_extensions()
|
171 |
+
{
|
172 |
+
$paths_to_look_for_extensions = apply_filters( 'blocksy_extensions_paths', [ BLOCKSY_PATH . 'framework/extensions' ] );
|
173 |
+
foreach ( $paths_to_look_for_extensions as $single_path ) {
|
174 |
+
$all_extensions = glob( $single_path . '/*', GLOB_ONLYDIR );
|
175 |
+
foreach ( $all_extensions as $single_extension ) {
|
176 |
+
$this->register_extension_for( $single_extension );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
$this->register_fake_extensions();
|
180 |
+
}
|
181 |
+
|
182 |
+
private function register_fake_extensions()
|
183 |
+
{
|
184 |
+
return;
|
185 |
+
$this->extensions['custom-fonts'] = [
|
186 |
+
'path' => null,
|
187 |
+
'__object' => null,
|
188 |
+
'config' => [
|
189 |
+
'name' => __( 'Custom Fonts', 'blc' ),
|
190 |
+
'description' => __( 'Upload unlimited number of custom fonts.', 'blc' ),
|
191 |
+
'pro' => true,
|
192 |
+
],
|
193 |
+
'readme' => '',
|
194 |
+
'data' => null,
|
195 |
+
];
|
196 |
+
$this->extensions['sidebars'] = [
|
197 |
+
'path' => null,
|
198 |
+
'__object' => null,
|
199 |
+
'config' => [
|
200 |
+
'name' => __( 'Sidebars', 'blc' ),
|
201 |
+
'description' => __( 'Create unlimited number of custom sidebars.', 'blc' ),
|
202 |
+
'pro' => true,
|
203 |
+
],
|
204 |
+
'readme' => '',
|
205 |
+
'data' => null,
|
206 |
+
];
|
207 |
+
$this->extensions['white-label'] = [
|
208 |
+
'path' => null,
|
209 |
+
'__object' => null,
|
210 |
+
'config' => [
|
211 |
+
'name' => __( 'White Label', 'blc' ),
|
212 |
+
'description' => __( 'Change theme/companion branding', 'blc' ),
|
213 |
+
'pro' => true,
|
214 |
+
],
|
215 |
+
'readme' => '',
|
216 |
+
'data' => null,
|
217 |
+
];
|
218 |
+
}
|
219 |
+
|
220 |
+
private function register_extension_for( $path )
|
221 |
+
{
|
222 |
+
$id = str_replace( '_', '-', basename( $path ) );
|
223 |
+
if ( isset( $this->extensions[$id] ) ) {
|
224 |
+
return;
|
225 |
+
}
|
226 |
+
$this->extensions[$id] = [
|
227 |
+
'path' => $path,
|
228 |
+
'__object' => null,
|
229 |
+
'config' => $this->read_config_for( $path ),
|
230 |
+
'readme' => $this->read_readme_for( $path ),
|
231 |
+
'data' => null,
|
232 |
+
];
|
233 |
+
}
|
234 |
+
|
235 |
+
private function maybe_do_extension_preboot( $id )
|
236 |
+
{
|
237 |
+
if ( !isset( $this->extensions[$id] ) ) {
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
if ( isset( $this->extensions[$id]['__object_preboot'] ) ) {
|
241 |
+
return;
|
242 |
+
}
|
243 |
+
$class_name = explode( '-', $id );
|
244 |
+
$class_name = array_map( 'ucfirst', $class_name );
|
245 |
+
$class_name = 'BlocksyExtension' . implode( '', $class_name ) . 'PreBoot';
|
246 |
+
$path = $this->extensions[$id]['path'];
|
247 |
+
if ( !file_exists( $path . '/pre-boot.php' ) ) {
|
248 |
+
return;
|
249 |
+
}
|
250 |
+
require_once $path . '/pre-boot.php';
|
251 |
+
$this->extensions[$id]['__object_preboot'] = new $class_name();
|
252 |
+
if ( method_exists( $this->extensions[$id]['__object_preboot'], 'ext_data' ) ) {
|
253 |
+
$this->extensions[$id]['data'] = $this->extensions[$id]['__object_preboot']->ext_data();
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
private function boot_activated_extension_for( $id )
|
258 |
+
{
|
259 |
+
if ( !isset( $this->extensions[$id] ) ) {
|
260 |
+
return false;
|
261 |
+
}
|
262 |
+
if ( !isset( $this->extensions[$id]['path'] ) ) {
|
263 |
+
return false;
|
264 |
+
}
|
265 |
+
if ( !$this->extensions[$id]['path'] ) {
|
266 |
+
return false;
|
267 |
+
}
|
268 |
+
if ( isset( $this->extensions[$id]['__object'] ) ) {
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
$class_name = explode( '-', $id );
|
272 |
+
$class_name = array_map( 'ucfirst', $class_name );
|
273 |
+
$class_name = 'BlocksyExtension' . implode( '', $class_name );
|
274 |
+
$path = $this->extensions[$id]['path'];
|
275 |
+
if ( !file_exists( $path . '/extension.php' ) ) {
|
276 |
+
return;
|
277 |
+
}
|
278 |
+
require_once $path . '/extension.php';
|
279 |
+
$this->extensions[$id]['__object'] = new $class_name();
|
280 |
+
}
|
281 |
+
|
282 |
+
private function get_class_name_for( $id )
|
283 |
+
{
|
284 |
+
$class_name = explode( '-', $id );
|
285 |
+
$class_name = array_map( 'ucfirst', $class_name );
|
286 |
+
return 'BlocksyExtension' . implode( '', $class_name );
|
287 |
+
}
|
288 |
+
|
289 |
+
private function read_readme_for( $path )
|
290 |
+
{
|
291 |
+
$readme = '';
|
292 |
+
ob_start();
|
293 |
+
if ( is_readable( $path . '/readme.php' ) ) {
|
294 |
+
require $path . '/readme.php';
|
295 |
+
}
|
296 |
+
$readme = ob_get_clean();
|
297 |
+
if ( empty(trim( $readme )) ) {
|
298 |
+
return null;
|
299 |
+
}
|
300 |
+
return trim( $readme );
|
301 |
+
}
|
302 |
+
|
303 |
+
private function read_config_for( $file_path )
|
304 |
+
{
|
305 |
+
$_extract_variables = [
|
306 |
+
'config' => [],
|
307 |
+
];
|
308 |
+
|
309 |
+
if ( is_readable( $file_path . '/config.php' ) ) {
|
310 |
+
require $file_path . '/config.php';
|
311 |
+
foreach ( $_extract_variables as $variable_name => $default_value ) {
|
312 |
+
if ( isset( ${$variable_name} ) ) {
|
313 |
+
$_extract_variables[$variable_name] = ${$variable_name};
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
$name = explode( '-', basename( $file_path ) );
|
319 |
+
$name = array_map( 'ucfirst', $name );
|
320 |
+
$name = implode( ' ', $name );
|
321 |
+
$_extract_variables['config'] = array_merge( [
|
322 |
+
'name' => $name,
|
323 |
+
'description' => '',
|
324 |
+
'pro' => false,
|
325 |
+
'hidden' => false,
|
326 |
+
], $_extract_variables['config'] );
|
327 |
+
return $_extract_variables['config'];
|
328 |
+
}
|
329 |
+
|
330 |
+
private function get_activated_extensions()
|
331 |
+
{
|
332 |
+
return get_option( $this->get_option_name(), [] );
|
333 |
+
}
|
334 |
+
|
335 |
+
}
|
framework/extensions/cookies-consent/config.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
$config = [
|
|
|
4 |
'description' => __('Enable this extension in order to comply with the GDPR regulations.', 'blc')
|
5 |
-
];
|
1 |
<?php
|
2 |
|
3 |
$config = [
|
4 |
+
'name' => __('Cookies Consent', 'blc'),
|
5 |
'description' => __('Enable this extension in order to comply with the GDPR regulations.', 'blc')
|
6 |
+
];
|
framework/extensions/cookies-consent/customizer.php
CHANGED
@@ -9,9 +9,13 @@ $options = [
|
|
9 |
'type' => 'ct-options',
|
10 |
'setting' => [ 'transport' => 'postMessage' ],
|
11 |
'inner-options' => [
|
|
|
|
|
|
|
|
|
12 |
|
13 |
blocksy_rand_md5() => [
|
14 |
-
'title' => __( 'General', '
|
15 |
'type' => 'tab',
|
16 |
'options' => [
|
17 |
|
@@ -19,18 +23,17 @@ $options = [
|
|
19 |
'label' => false,
|
20 |
'type' => 'ct-image-picker',
|
21 |
'value' => 'type-1',
|
22 |
-
'attr' => [ 'data-type' => 'background' ],
|
23 |
'setting' => [ 'transport' => 'postMessage' ],
|
24 |
'choices' => [
|
25 |
|
26 |
'type-1' => [
|
27 |
'src' => BLOCKSY_URL . 'framework/extensions/cookies-consent/static/images/type-1.svg',
|
28 |
-
'title' => __( 'Type 1', '
|
29 |
],
|
30 |
|
31 |
'type-2' => [
|
32 |
'src' => BLOCKSY_URL . 'framework/extensions/cookies-consent/static/images/type-2.svg',
|
33 |
-
'title' => __( 'Type 2', '
|
34 |
],
|
35 |
|
36 |
],
|
@@ -39,7 +42,7 @@ $options = [
|
|
39 |
'cookie_consent_period' => [
|
40 |
'label' => __('Cookie period', 'blc'),
|
41 |
'type' => 'ct-select',
|
42 |
-
'value' => '
|
43 |
'design' => 'inline',
|
44 |
'setting' => [ 'transport' => 'postMessage' ],
|
45 |
'choices' => blocksy_ordered_keys(
|
@@ -58,13 +61,18 @@ $options = [
|
|
58 |
),
|
59 |
],
|
60 |
|
61 |
-
|
62 |
'cookie_consent_content' => [
|
63 |
'label' => __( 'Content', 'blc' ),
|
64 |
-
'type' => '
|
65 |
-
'design' => 'block',
|
66 |
'value' => __('We use cookies to ensure that we give you the best experience on our website.', 'blc'),
|
|
|
67 |
'setting' => [ 'transport' => 'postMessage' ],
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
],
|
69 |
|
70 |
'cookie_consent_button_text' => [
|
@@ -79,32 +87,43 @@ $options = [
|
|
79 |
],
|
80 |
|
81 |
blocksy_rand_md5() => [
|
82 |
-
'title' => __( 'Design', '
|
83 |
'type' => 'tab',
|
84 |
'options' => [
|
85 |
|
86 |
'cookieContentColor' => [
|
87 |
-
'label' => __( '
|
88 |
'type' => 'ct-color-picker',
|
89 |
'design' => 'inline',
|
90 |
'setting' => [ 'transport' => 'postMessage' ],
|
91 |
|
92 |
'value' => [
|
93 |
'default' => [
|
94 |
-
'color' => '
|
|
|
|
|
|
|
|
|
95 |
],
|
96 |
],
|
97 |
|
98 |
'pickers' => [
|
99 |
[
|
100 |
-
'title' => __( 'Initial', '
|
101 |
'id' => 'default',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
],
|
103 |
],
|
104 |
],
|
105 |
|
106 |
'cookieButtonBackground' => [
|
107 |
-
'label' => __( 'Button Color', '
|
108 |
'type' => 'ct-color-picker',
|
109 |
'design' => 'inline',
|
110 |
'setting' => [ 'transport' => 'postMessage' ],
|
@@ -120,19 +139,19 @@ $options = [
|
|
120 |
|
121 |
'pickers' => [
|
122 |
[
|
123 |
-
'title' => __( 'Initial', '
|
124 |
'id' => 'default',
|
125 |
],
|
126 |
|
127 |
[
|
128 |
-
'title' => __( 'Hover', '
|
129 |
'id' => 'hover',
|
130 |
],
|
131 |
],
|
132 |
],
|
133 |
|
134 |
'cookieBackground' => [
|
135 |
-
'label' => __( 'Background Color', '
|
136 |
'type' => 'ct-color-picker',
|
137 |
'design' => 'inline',
|
138 |
'setting' => [ 'transport' => 'postMessage' ],
|
@@ -145,7 +164,7 @@ $options = [
|
|
145 |
|
146 |
'pickers' => [
|
147 |
[
|
148 |
-
'title' => __( 'Initial', '
|
149 |
'id' => 'default',
|
150 |
],
|
151 |
],
|
@@ -157,7 +176,7 @@ $options = [
|
|
157 |
'options' => [
|
158 |
|
159 |
'cookieMaxWidth' => [
|
160 |
-
'label' => __( 'Maximum Width', '
|
161 |
'type' => 'ct-slider',
|
162 |
'value' => 400,
|
163 |
'min' => 200,
|
@@ -171,7 +190,35 @@ $options = [
|
|
171 |
],
|
172 |
],
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
],
|
175 |
],
|
176 |
],
|
177 |
-
];
|
9 |
'type' => 'ct-options',
|
10 |
'setting' => [ 'transport' => 'postMessage' ],
|
11 |
'inner-options' => [
|
12 |
+
blocksy_rand_md5() => [
|
13 |
+
'type' => 'ct-title',
|
14 |
+
'label' => __( 'Cookies Notification', 'blocksy' ),
|
15 |
+
],
|
16 |
|
17 |
blocksy_rand_md5() => [
|
18 |
+
'title' => __( 'General', 'blc' ),
|
19 |
'type' => 'tab',
|
20 |
'options' => [
|
21 |
|
23 |
'label' => false,
|
24 |
'type' => 'ct-image-picker',
|
25 |
'value' => 'type-1',
|
|
|
26 |
'setting' => [ 'transport' => 'postMessage' ],
|
27 |
'choices' => [
|
28 |
|
29 |
'type-1' => [
|
30 |
'src' => BLOCKSY_URL . 'framework/extensions/cookies-consent/static/images/type-1.svg',
|
31 |
+
'title' => __( 'Type 1', 'blc' ),
|
32 |
],
|
33 |
|
34 |
'type-2' => [
|
35 |
'src' => BLOCKSY_URL . 'framework/extensions/cookies-consent/static/images/type-2.svg',
|
36 |
+
'title' => __( 'Type 2', 'blc' ),
|
37 |
],
|
38 |
|
39 |
],
|
42 |
'cookie_consent_period' => [
|
43 |
'label' => __('Cookie period', 'blc'),
|
44 |
'type' => 'ct-select',
|
45 |
+
'value' => 'forever',
|
46 |
'design' => 'inline',
|
47 |
'setting' => [ 'transport' => 'postMessage' ],
|
48 |
'choices' => blocksy_ordered_keys(
|
61 |
),
|
62 |
],
|
63 |
|
|
|
64 |
'cookie_consent_content' => [
|
65 |
'label' => __( 'Content', 'blc' ),
|
66 |
+
'type' => 'wp-editor',
|
|
|
67 |
'value' => __('We use cookies to ensure that we give you the best experience on our website.', 'blc'),
|
68 |
+
'disableRevertButton' => true,
|
69 |
'setting' => [ 'transport' => 'postMessage' ],
|
70 |
+
|
71 |
+
'quicktags' => false,
|
72 |
+
'mediaButtons' => false,
|
73 |
+
'tinymce' => [
|
74 |
+
'toolbar1' => 'bold,italic,link,alignleft,aligncenter,alignright,undo,redo',
|
75 |
+
],
|
76 |
],
|
77 |
|
78 |
'cookie_consent_button_text' => [
|
87 |
],
|
88 |
|
89 |
blocksy_rand_md5() => [
|
90 |
+
'title' => __( 'Design', 'blc' ),
|
91 |
'type' => 'tab',
|
92 |
'options' => [
|
93 |
|
94 |
'cookieContentColor' => [
|
95 |
+
'label' => __( 'Font Color', 'blc' ),
|
96 |
'type' => 'ct-color-picker',
|
97 |
'design' => 'inline',
|
98 |
'setting' => [ 'transport' => 'postMessage' ],
|
99 |
|
100 |
'value' => [
|
101 |
'default' => [
|
102 |
+
'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT'),
|
103 |
+
],
|
104 |
+
|
105 |
+
'hover' => [
|
106 |
+
'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT'),
|
107 |
],
|
108 |
],
|
109 |
|
110 |
'pickers' => [
|
111 |
[
|
112 |
+
'title' => __( 'Initial', 'blc' ),
|
113 |
'id' => 'default',
|
114 |
+
'inherit' => 'var(--color)'
|
115 |
+
],
|
116 |
+
|
117 |
+
[
|
118 |
+
'title' => __( 'Hover', 'blc' ),
|
119 |
+
'id' => 'hover',
|
120 |
+
'inherit' => 'var(--colorHover)'
|
121 |
],
|
122 |
],
|
123 |
],
|
124 |
|
125 |
'cookieButtonBackground' => [
|
126 |
+
'label' => __( 'Button Color', 'blc' ),
|
127 |
'type' => 'ct-color-picker',
|
128 |
'design' => 'inline',
|
129 |
'setting' => [ 'transport' => 'postMessage' ],
|
139 |
|
140 |
'pickers' => [
|
141 |
[
|
142 |
+
'title' => __( 'Initial', 'blc' ),
|
143 |
'id' => 'default',
|
144 |
],
|
145 |
|
146 |
[
|
147 |
+
'title' => __( 'Hover', 'blc' ),
|
148 |
'id' => 'hover',
|
149 |
],
|
150 |
],
|
151 |
],
|
152 |
|
153 |
'cookieBackground' => [
|
154 |
+
'label' => __( 'Background Color', 'blc' ),
|
155 |
'type' => 'ct-color-picker',
|
156 |
'design' => 'inline',
|
157 |
'setting' => [ 'transport' => 'postMessage' ],
|
164 |
|
165 |
'pickers' => [
|
166 |
[
|
167 |
+
'title' => __( 'Initial', 'blc' ),
|
168 |
'id' => 'default',
|
169 |
],
|
170 |
],
|
176 |
'options' => [
|
177 |
|
178 |
'cookieMaxWidth' => [
|
179 |
+
'label' => __( 'Maximum Width', 'blc' ),
|
180 |
'type' => 'ct-slider',
|
181 |
'value' => 400,
|
182 |
'min' => 200,
|
190 |
],
|
191 |
],
|
192 |
|
193 |
+
blocksy_rand_md5() => [
|
194 |
+
'type' => 'ct-title',
|
195 |
+
'label' => __( 'Forms Cookies Content', 'blocksy' ),
|
196 |
+
],
|
197 |
+
|
198 |
+
'forms_cookie_consent_content' => [
|
199 |
+
'label' => false,
|
200 |
+
'type' => 'wp-editor',
|
201 |
+
'value' => sprintf(
|
202 |
+
__('I accept the %sPrivacy Policy%s', 'blc'),
|
203 |
+
'<a href="/privacy-policy">',
|
204 |
+
'</a>'
|
205 |
+
),
|
206 |
+
'desc' => __( 'This text will appear under each comment form and subscribe form.', 'blc' ),
|
207 |
+
// 'attr' => [ 'data-height' => 'heading-label' ],
|
208 |
+
'disableRevertButton' => true,
|
209 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
210 |
+
|
211 |
+
'quicktags' => false,
|
212 |
+
'mediaButtons' => false,
|
213 |
+
'tinymce' => [
|
214 |
+
'toolbar1' => 'bold,italic,link,alignleft,aligncenter,alignright,undo,redo',
|
215 |
+
'forced_root_block' => '',
|
216 |
+
'force_br_newlines' => true,
|
217 |
+
'force_p_newlines' => false
|
218 |
+
],
|
219 |
+
],
|
220 |
+
|
221 |
],
|
222 |
],
|
223 |
],
|
224 |
+
];
|
framework/extensions/cookies-consent/extension.php
CHANGED
@@ -3,11 +3,63 @@
|
|
3 |
require_once dirname( __FILE__ ) . '/helpers.php';
|
4 |
|
5 |
class BlocksyExtensionCookiesConsent {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function should_display_notification() {
|
7 |
return !isset($_COOKIE['blocksy_cookies_consent_accepted']);
|
8 |
}
|
9 |
|
10 |
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
add_filter(
|
12 |
'blocksy_extensions_customizer_options',
|
13 |
[$this, 'add_options_panel']
|
@@ -25,7 +77,7 @@ class BlocksyExtensionCookiesConsent {
|
|
25 |
wp_enqueue_script(
|
26 |
'blocksy-cookies-consent-customizer-sync',
|
27 |
BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/sync.js',
|
28 |
-
[ 'customize-preview' ],
|
29 |
$data['Version'],
|
30 |
true
|
31 |
);
|
@@ -52,38 +104,33 @@ class BlocksyExtensionCookiesConsent {
|
|
52 |
wp_enqueue_style(
|
53 |
'blocksy-ext-cookies-consent-styles',
|
54 |
BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/main.css',
|
55 |
-
[],
|
56 |
$data['Version']
|
57 |
);
|
58 |
|
59 |
wp_enqueue_script(
|
60 |
'blocksy-ext-cookies-consent-scripts',
|
61 |
BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/main.js',
|
62 |
-
[],
|
63 |
$data['Version'],
|
64 |
true
|
65 |
);
|
66 |
});
|
67 |
|
68 |
-
add_action('blocksy:global-dynamic-css:enqueue', function (
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
dirname( __FILE__ ) . '/global.php',
|
74 |
-
[],
|
75 |
-
[
|
76 |
-
'css' => $css,
|
77 |
-
'tablet_css' => $tablet_css,
|
78 |
-
'mobile_css' => $mobile_css
|
79 |
-
]
|
80 |
-
);
|
81 |
-
|
82 |
}, 10, 3);
|
83 |
}
|
84 |
|
85 |
public function add_options_panel($options) {
|
86 |
-
$options['cookie_consent_ext'] =
|
|
|
|
|
|
|
|
|
87 |
dirname( __FILE__ ) . '/customizer.php',
|
88 |
[], false
|
89 |
);
|
3 |
require_once dirname( __FILE__ ) . '/helpers.php';
|
4 |
|
5 |
class BlocksyExtensionCookiesConsent {
|
6 |
+
public static function onActivation() {
|
7 |
+
do_action('wpsc_add_cookie', 'blocksy_cookies_consent_accepted');
|
8 |
+
|
9 |
+
if (function_exists('flush_rocket_htaccess')) {
|
10 |
+
add_filter('rocket_cache_dynamic_cookies', function ($cookies) {
|
11 |
+
$cookies[] = 'blocksy_cookies_consent_accepted';
|
12 |
+
return $cookies;
|
13 |
+
});
|
14 |
+
|
15 |
+
// Update the WP Rocket rules on the .htaccess file.
|
16 |
+
flush_rocket_htaccess();
|
17 |
+
// Regenerate the config file.
|
18 |
+
rocket_generate_config_file();
|
19 |
+
// Clear WP Rocket cache.
|
20 |
+
rocket_clean_domain();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
public static function onDeactivation() {
|
25 |
+
do_action('wpsc_delete_cookie', 'blocksy_cookies_consent_accepted');
|
26 |
+
|
27 |
+
if (function_exists('flush_rocket_htaccess')) {
|
28 |
+
add_filter('rocket_cache_dynamic_cookies', function ($cookies) {
|
29 |
+
return array_diff(
|
30 |
+
$cookies,
|
31 |
+
[ 'blocksy_cookies_consent_accepted' ]
|
32 |
+
);
|
33 |
+
}, 200);
|
34 |
+
|
35 |
+
// Update the WP Rocket rules on the .htaccess file.
|
36 |
+
flush_rocket_htaccess();
|
37 |
+
// Regenerate the config file.
|
38 |
+
rocket_generate_config_file();
|
39 |
+
// Clear WP Rocket cache.
|
40 |
+
rocket_clean_domain();
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
public static function should_display_notification() {
|
45 |
return !isset($_COOKIE['blocksy_cookies_consent_accepted']);
|
46 |
}
|
47 |
|
48 |
public function __construct() {
|
49 |
+
add_action('blocksy:footer:after', function () {
|
50 |
+
echo blocksy_ext_cookies_consent_output();
|
51 |
+
});
|
52 |
+
|
53 |
+
add_filter('rocket_cache_dynamic_cookies', function ($cookies) {
|
54 |
+
$cookies[] = 'blocksy_cookies_consent_accepted';
|
55 |
+
return $cookies;
|
56 |
+
});
|
57 |
+
|
58 |
+
add_filter('blocksy-async-scripts-handles', function ($d) {
|
59 |
+
$d[] = 'blocksy-ext-cookies-consent-scripts';
|
60 |
+
return $d;
|
61 |
+
});
|
62 |
+
|
63 |
add_filter(
|
64 |
'blocksy_extensions_customizer_options',
|
65 |
[$this, 'add_options_panel']
|
77 |
wp_enqueue_script(
|
78 |
'blocksy-cookies-consent-customizer-sync',
|
79 |
BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/sync.js',
|
80 |
+
[ 'ct-events', 'customize-preview' ],
|
81 |
$data['Version'],
|
82 |
true
|
83 |
);
|
104 |
wp_enqueue_style(
|
105 |
'blocksy-ext-cookies-consent-styles',
|
106 |
BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/main.css',
|
107 |
+
['ct-main-styles'],
|
108 |
$data['Version']
|
109 |
);
|
110 |
|
111 |
wp_enqueue_script(
|
112 |
'blocksy-ext-cookies-consent-scripts',
|
113 |
BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/main.js',
|
114 |
+
['ct-events'],
|
115 |
$data['Version'],
|
116 |
true
|
117 |
);
|
118 |
});
|
119 |
|
120 |
+
add_action('blocksy:global-dynamic-css:enqueue', function ($args) {
|
121 |
+
blocksy_theme_get_dynamic_styles(array_merge([
|
122 |
+
'path' => dirname( __FILE__ ) . '/global.php',
|
123 |
+
'chunk' => 'global'
|
124 |
+
], $args));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}, 10, 3);
|
126 |
}
|
127 |
|
128 |
public function add_options_panel($options) {
|
129 |
+
$options['cookie_consent_ext'] = blc_call_fn(
|
130 |
+
[
|
131 |
+
'fn' => 'blocksy_get_options',
|
132 |
+
'default' => 'array'
|
133 |
+
],
|
134 |
dirname( __FILE__ ) . '/customizer.php',
|
135 |
[], false
|
136 |
);
|
framework/extensions/cookies-consent/global.php
CHANGED
@@ -1,44 +1,66 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
//
|
4 |
-
|
5 |
-
'cookieContentColor',
|
6 |
-
|
7 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
'default' => [ 'color' => 'var(--paletteColor1)' ],
|
18 |
'hover' => [ 'color' => 'var(--paletteColor2)' ],
|
19 |
-
]
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
|
27 |
-
$css->put(
|
28 |
-
'.cookie-notification',
|
29 |
-
"--buttonHoverColor: {$cookieButtonBackground['hover']}"
|
30 |
-
);
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
|
|
37 |
$css->put(
|
38 |
-
'
|
39 |
-
|
40 |
);
|
41 |
|
42 |
-
$cookieMaxWidth = get_theme_mod( 'cookieMaxWidth', 400 );
|
43 |
-
$css->put( ':root', '--cookieMaxWidth: ' . $cookieMaxWidth . 'px' );
|
44 |
-
|
1 |
<?php
|
2 |
|
3 |
+
// Content color
|
4 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
5 |
+
'value' => get_theme_mod('cookieContentColor'),
|
6 |
+
'default' => [
|
7 |
+
'default' => [ 'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT') ],
|
8 |
+
'hover' => [ 'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT') ],
|
9 |
+
],
|
10 |
+
'css' => $css,
|
11 |
+
'variables' => [
|
12 |
+
'default' => [
|
13 |
+
'selector' => '.cookie-notification',
|
14 |
+
'variable' => 'color'
|
15 |
+
],
|
16 |
|
17 |
+
'hover' => [
|
18 |
+
'selector' => '.cookie-notification',
|
19 |
+
'variable' => 'colorHover'
|
20 |
+
],
|
21 |
+
],
|
22 |
+
]);
|
23 |
|
24 |
+
// Button color
|
25 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
26 |
+
'value' => get_theme_mod('cookieButtonBackground'),
|
27 |
+
'default' => [
|
28 |
'default' => [ 'color' => 'var(--paletteColor1)' ],
|
29 |
'hover' => [ 'color' => 'var(--paletteColor2)' ],
|
30 |
+
],
|
31 |
+
'css' => $css,
|
32 |
+
'variables' => [
|
33 |
+
'default' => [
|
34 |
+
'selector' => '.cookie-notification',
|
35 |
+
'variable' => 'buttonInitialColor'
|
36 |
+
],
|
37 |
|
38 |
+
'hover' => [
|
39 |
+
'selector' => '.cookie-notification',
|
40 |
+
'variable' => 'buttonHoverColor'
|
41 |
+
]
|
42 |
+
],
|
43 |
+
]);
|
44 |
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
// Background color
|
47 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
48 |
+
'value' => get_theme_mod('cookieBackground'),
|
49 |
+
'default' => [
|
50 |
+
'default' => [ 'color' => '#ffffff' ],
|
51 |
+
],
|
52 |
+
'css' => $css,
|
53 |
+
'variables' => [
|
54 |
+
'default' => [
|
55 |
+
'selector' => '.cookie-notification',
|
56 |
+
'variable' => 'backgroundColor'
|
57 |
+
],
|
58 |
+
],
|
59 |
+
]);
|
60 |
|
61 |
+
$cookieMaxWidth = get_theme_mod( 'cookieMaxWidth', 400 );
|
62 |
$css->put(
|
63 |
+
'.cookie-notification',
|
64 |
+
'--maxWidth: ' . $cookieMaxWidth . 'px'
|
65 |
);
|
66 |
|
|
|
|
|
|
framework/extensions/cookies-consent/helpers.php
CHANGED
@@ -29,7 +29,7 @@ function blocksy_ext_cookies_consent_output($forced = false) {
|
|
29 |
);
|
30 |
|
31 |
$button_text = get_theme_mod('cookie_consent_button_text', __('Accept', 'blc'));
|
32 |
-
$period = get_theme_mod('cookie_consent_period', '
|
33 |
$type = get_theme_mod('cookie_consent_type', 'type-1');
|
34 |
|
35 |
$class = 'container';
|
@@ -43,15 +43,14 @@ function blocksy_ext_cookies_consent_output($forced = false) {
|
|
43 |
?>
|
44 |
|
45 |
|
46 |
-
<div class="cookie-notification ct-fade-in-start" data-period="<?php
|
47 |
-
|
48 |
-
<div class="<?php esc_attr_e($class) ?>">
|
49 |
|
|
|
50 |
<?php if (!empty($content)) { ?>
|
51 |
-
<
|
52 |
<?php } ?>
|
53 |
|
54 |
-
<button class="ct-accept"><?php echo esc_html($button_text) ?></button>
|
55 |
|
56 |
<?php if ($type === 'type-1' || is_customize_preview()) { ?>
|
57 |
<button class="ct-close">×</button>
|
@@ -64,23 +63,27 @@ function blocksy_ext_cookies_consent_output($forced = false) {
|
|
64 |
return ob_get_clean();
|
65 |
}
|
66 |
|
67 |
-
function blocksy_ext_cookies_checkbox() {
|
68 |
ob_start();
|
69 |
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
72 |
sprintf(
|
73 |
-
'
|
74 |
-
|
|
|
75 |
)
|
76 |
);
|
77 |
|
78 |
?>
|
79 |
|
80 |
-
<
|
81 |
-
<input id="gdprconfirm" name="gdprconfirm" type="checkbox" required
|
82 |
-
|
83 |
-
</div>
|
84 |
|
85 |
<?php
|
86 |
|
29 |
);
|
30 |
|
31 |
$button_text = get_theme_mod('cookie_consent_button_text', __('Accept', 'blc'));
|
32 |
+
$period = get_theme_mod('cookie_consent_period', 'forever');
|
33 |
$type = get_theme_mod('cookie_consent_type', 'type-1');
|
34 |
|
35 |
$class = 'container';
|
43 |
?>
|
44 |
|
45 |
|
46 |
+
<div class="cookie-notification ct-fade-in-start" data-period="<?php echo esc_attr($period) ?>" data-type="<?php echo esc_attr($type) ?>">
|
|
|
|
|
47 |
|
48 |
+
<div class="<?php echo esc_attr($class) ?>">
|
49 |
<?php if (!empty($content)) { ?>
|
50 |
+
<div class="ct-cookies-content"><?php echo wp_kses_post($content) ?></div>
|
51 |
<?php } ?>
|
52 |
|
53 |
+
<button type="submit" class="ct-button ct-accept"><?php echo esc_html($button_text) ?></button>
|
54 |
|
55 |
<?php if ($type === 'type-1' || is_customize_preview()) { ?>
|
56 |
<button class="ct-close">×</button>
|
63 |
return ob_get_clean();
|
64 |
}
|
65 |
|
66 |
+
function blocksy_ext_cookies_checkbox($prefix = '') {
|
67 |
ob_start();
|
68 |
|
69 |
+
if (! empty($prefix)) {
|
70 |
+
$prefix = '_' . $prefix;
|
71 |
+
}
|
72 |
+
|
73 |
+
$message = get_theme_mod(
|
74 |
+
'forms_cookie_consent_content',
|
75 |
sprintf(
|
76 |
+
__('I accept the %sPrivacy Policy%s', 'blc'),
|
77 |
+
'<a href="/privacy-policy">',
|
78 |
+
'</a>'
|
79 |
)
|
80 |
);
|
81 |
|
82 |
?>
|
83 |
|
84 |
+
<p class="gdpr-confirm-policy">
|
85 |
+
<input id="gdprconfirm<?php echo $prefix ?>" name="gdprconfirm" type="checkbox" required /><label for="gdprconfirm<?php echo $prefix ?>"><?php echo $message ?></label>
|
86 |
+
</p>
|
|
|
87 |
|
88 |
<?php
|
89 |
|
framework/extensions/cookies-consent/readme.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
-
<
|
2 |
|
3 |
<p>
|
4 |
<?php echo __('After installing and activating the Cookies Consent extension you will be able to configure it from this location:', 'blc') ?>
|
5 |
</p>
|
6 |
|
7 |
-
<ul>
|
8 |
<li>
|
9 |
-
<
|
10 |
-
<?php echo __('Customizer', 'blc') ?>
|
11 |
-
</b>
|
12 |
<i>
|
13 |
<?php
|
14 |
echo sprintf(
|
@@ -23,4 +21,18 @@
|
|
23 |
</li>
|
24 |
</ul>
|
25 |
|
|
|
|
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php echo __('Instructions', 'blc'); ?></h2>
|
2 |
|
3 |
<p>
|
4 |
<?php echo __('After installing and activating the Cookies Consent extension you will be able to configure it from this location:', 'blc') ?>
|
5 |
</p>
|
6 |
|
7 |
+
<ul class="ct-modal-list">
|
8 |
<li>
|
9 |
+
<h4><?php echo __('Customizer', 'blc') ?></h4>
|
|
|
|
|
10 |
<i>
|
11 |
<?php
|
12 |
echo sprintf(
|
21 |
</li>
|
22 |
</ul>
|
23 |
|
24 |
+
<div class="extension-notice">
|
25 |
+
<h4><?php echo __('Known problems with caching plugins', 'blc'); ?></h4>
|
26 |
|
27 |
+
<p>
|
28 |
+
<?php
|
29 |
+
echo sprintf(
|
30 |
+
__('Please read %s to find out more information.', 'blc'),
|
31 |
+
sprintf(
|
32 |
+
'<a href="https://creativethemes.com/blocksy/docs/extensions/cookies-consent/#cache/">%s</a>',
|
33 |
+
__('this article', 'blc')
|
34 |
+
)
|
35 |
+
);
|
36 |
+
?>
|
37 |
+
</p>
|
38 |
+
</div>
|
framework/extensions/cookies-consent/static/bundle/main.css
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/**
|
2 |
-
* - v1.
|
3 |
*
|
4 |
-
* Copyright (c)
|
5 |
* Licensed GPLv2+
|
6 |
*/
|
7 |
|
8 |
-
.cookie-notification{position:fixed;left:0;bottom:0;z-index:999999;color:var(--
|
1 |
/**
|
2 |
+
* - v1.7.32
|
3 |
*
|
4 |
+
* Copyright (c) 2020
|
5 |
* Licensed GPLv2+
|
6 |
*/
|
7 |
|
8 |
+
.cookie-notification{position:fixed;left:0;bottom:0;z-index:999999;color:var(--color)}.cookie-notification a:hover{color:var(--colorHover)}@media (max-width: 479.98px){.cookie-notification>div{flex-direction:column}}@media (max-width: 689.98px){.cookie-notification{right:0}.cookie-notification>div{display:flex;align-items:center;padding-top:15px;padding-bottom:15px}}@media (max-width: 689.98px){.cookie-notification[data-type='type-1']{background:var(--backgroundColor)}}@media (min-width: 690px){.cookie-notification[data-type='type-1']{padding:0 25px 25px 25px}.cookie-notification[data-type='type-1'] .ct-cookies-content{margin-bottom:15px;max-width:90%}}.cookie-notification[data-type='type-1'] .container{position:relative}@media (max-width: 689.98px){.cookie-notification[data-type='type-1'] .container{width:88%;margin:0 auto}}@media (min-width: 690px){.cookie-notification[data-type='type-1'] .container{background:var(--backgroundColor);box-shadow:0px 5px 30px -5px rgba(34,56,101,0.15);padding:25px 40px 25px 25px;border-radius:3px;max-width:var(--maxWidth)}}.cookie-notification[data-type='type-2']{right:0;background:var(--backgroundColor)}@media (min-width: 690px){.cookie-notification[data-type='type-2']{padding:15px 0}.cookie-notification[data-type='type-2'] .ct-container{display:flex;align-items:center;justify-content:center}.cookie-notification[data-type='type-2'] .ct-accept{margin-left:25px}}.cookie-notification[data-type='type-2'] .ct-close{display:none}.cookie-notification .ct-cookies-content{line-height:1.4}.cookie-notification .ct-cookies-content a{text-decoration:underline;color:var(--colorHover)}@media (max-width: 479.98px){.cookie-notification .ct-cookies-content{text-align:center;margin-bottom:15px}}@media (max-width: 689.98px){.cookie-notification .ct-cookies-content{font-size:13px}}@media (min-width: 690px){.cookie-notification .ct-cookies-content{font-size:14px}}.cookie-notification .ct-accept{--buttonFontSize: 13px;--buttonMinHeight: 35px;--padding: 0 20px;--buttonShadow: none;--buttonTransform: none}@media (max-width: 479.98px){.cookie-notification .ct-accept{width:100%}}@media (min-width: 480px) and (max-width: 689.98px){.cookie-notification .ct-accept{margin-left:20px}}.cookie-notification .ct-close{display:flex;align-items:center;justify-content:center;width:45px;height:45px;position:absolute;top:0;right:0;opacity:0.5;color:inherit;cursor:pointer;background:transparent}.cookie-notification .ct-close:hover{opacity:1}@media (max-width: 689.98px){.cookie-notification .ct-close{display:none}}.cookie-notification.ct-fade-in-start,.cookie-notification.ct-fade-in-end,.cookie-notification.ct-fade-start,.cookie-notification.ct-fade-end{transition:all 0.3s ease}.cookie-notification.ct-fade-in-start{opacity:0;transform:translate3d(0, 15px, 0)}.cookie-notification.ct-fade-end{opacity:0;transform:translate3d(0, 15px, 0)}
|
framework/extensions/cookies-consent/static/bundle/main.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
!function(e){var t={};function n(
|
2 |
/*!
|
3 |
-
* JavaScript Cookie v2.2.
|
4 |
* https://github.com/js-cookie/js-cookie
|
5 |
*
|
6 |
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
7 |
* Released under the MIT license
|
8 |
-
*/!function(i){if(void 0===(
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=ctEvents},function(e,t,n){var r,o;
|
2 |
/*!
|
3 |
+
* JavaScript Cookie v2.2.1
|
4 |
* https://github.com/js-cookie/js-cookie
|
5 |
*
|
6 |
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
7 |
* Released under the MIT license
|
8 |
+
*/!function(i){if(void 0===(o="function"==typeof(r=i)?r.call(t,n,t,e):r)||(e.exports=o),!0,e.exports=i(),!!0){var c=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=c,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var c=JSON.stringify(n);/^[\{\[]/.test(c)&&(n=c)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in i)i[u]&&(a+="; "+u,!0!==i[u]&&(a+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+a}}function c(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],c=0;c<i.length;c++){var a=i[c].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var f=t(a[0]);if(u=(r.read||r)(u,f)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(o[f]=u,e===f)break}catch(e){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return c(e,!1)},o.getJSON=function(e){return c(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))}))},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(1),c=n.n(i);function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f,s=function(){var e=document.querySelector(".cookie-notification");e&&(requestAnimationFrame((function(){e.classList.remove("ct-fade-in-start"),e.classList.add("ct-fade-in-end"),d(e,(function(){e.classList.remove("ct-fade-in-end")}))})),a(e.querySelectorAll("button")).map((function(t){t.addEventListener("click",(function(n){if(n.preventDefault(),t.classList.contains("ct-accept")){c.a.set("blocksy_cookies_consent_accepted","true",{expires:new Date(1*new Date+{onehour:36e5,oneday:864e5,oneweek:6048e5,onemonth:26784e5,threemonths:80352e5,sixmonths:160704e5,oneyear:31536e6,forever:864e9}[t.closest("[data-period]").dataset.period])})}e.classList.add("ct-fade-start"),requestAnimationFrame((function(){e.classList.remove("ct-fade-start"),e.classList.add("ct-fade-end"),d(e,(function(){e.parentNode.removeChild(e)}))}))}))})))};function d(e,t){setTimeout((function(){t()}),300)}f=function(){s(),o.a.on("blocksy:cookies:init",(function(){s()}))},/comp|inter|loaded/.test(document.readyState)?f():document.addEventListener("DOMContentLoaded",f,!1)}]);
|
framework/extensions/cookies-consent/static/bundle/sync.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r,o=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r=document.querySelector("#"+{desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"}[n]),o=r.innerText,i=e.selector||":root",c=new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?{[\\s\\S]*?}","gm"),l=o.match(c);l&&(r.innerText=o.replace(c,l[0].indexOf("--"+e.variable+":")>-1?l[0].replace(new RegExp("--"+e.variable+":[\\s\\S]*?;","gm"),"CT_CSS_SKIP_RULE"===t?"":"--"+e.variable+": "+t+";"):l[0].replace(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?{","gm"),i+" {"+("CT_CSS_SKIP_RULE"===t?"":"--"+e.variable+": "+t+";"))))},i=function(e,t){return[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e.selector?document.querySelectorAll(e.selector):[document.documentElement])).map(function(n){if(!e.responsive){var r=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:e.extractValue?e.extractValue(t):t;return"border"===(e.type||"")&&(r="none"===t.style?"none":t.width+"px "+t.style+" "+t.color.color),void o(e,""+r+(e.unit||""))}t=function(e){return e.desktop?e:{desktop:e,tablet:e,mobile:e}}(t),t=e.extractValue?e.extractValue(t):t,e.respect_visibility&&(wp.customize(e.respect_visibility)().mobile||(t.mobile="0"+(e.unit?"":"px")),wp.customize(e.respect_visibility)().tablet||(t.tablet="0"+(e.unit?"":"px")),wp.customize(e.respect_visibility)().desktop||(t.desktop="0"+(e.unit?"":"px"))),e.respect_stacking&&(wp.customize(e.respect_stacking)().mobile&&(t.mobile=2*parseInt(t.mobile,10)+(e.unit?"":"px")),wp.customize(e.respect_stacking)().tablet&&(t.tablet=2*parseInt(t.tablet,10)+(e.unit?"":"px"))),e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),o(e,""+t.desktop+(e.unit||""),"desktop"),o(e,""+t.tablet+(e.unit||""),"tablet"),o(e,""+t.mobile+(e.unit||""),"mobile")})};r={cookieContentColor:{variable:"cookieContentColor",type:"color"},cookieBackground:{variable:"cookieBackground",type:"color"},cookieButtonBackground:[{selector:".cookie-notification",variable:"buttonInitialColor",type:"color:default"},{selector:".cookie-notification",variable:"buttonHoverColor",type:"color:hover"}],cookieMaxWidth:{variable:"cookieMaxWidth",unit:"px"}},wp.customize.bind("change",function(e){return r[e.id]&&(Array.isArray(r[e.id])?r[e.id]:[r[e.id]]).map(function(t){return i(t,e())})});var c=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var c,l=e[Symbol.iterator]();!(r=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};var a=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";n||((t=document.createElement("div")).innerHTML=document.querySelector(".ct-customizer-preview-cache-container").value,n=t);var o=n.querySelector(".ct-customizer-preview-cache [data-"+r+'="'+e+'"]').innerHTML,i=document.createElement("div");return i.innerHTML=o,i},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},should_insert:!0},e);var t=document.querySelector(e.parent_selector);if([].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(document.querySelectorAll(e.parent_selector+" "+e.selector))).map(function(e){return e.parentNode.removeChild(e)}),e.should_insert){for(var n=a(e.fragment_id);n.firstElementChild;)if(e.beforeInsert(n.firstElementChild),"append"===e.strategy&&t.appendChild(n.firstElementChild),"firstChild"===e.strategy&&t.insertBefore(n.firstElementChild,t.firstElementChild),e.strategy.indexOf("maybeBefore")>-1){var r=e.strategy.split(":"),o=c(r,2),i=(o[0],o[1]);t.querySelector(i)?t.insertBefore(n.firstElementChild,t.querySelector(i)):t.appendChild(n.firstElementChild)}e.whenInserted()}},s=function(){var e=function(e){if(!document.querySelector(".cookie-notification"))return u({fragment_id:"blocksy-cookies-consent-section",selector:".cookie-notification",parent_selector:"#main-container"}),!0}(),t=document.querySelector(".cookie-notification");if(t){t.querySelector("p").innerHTML=wp.customize("cookie_consent_content")(),t.querySelector("button.ct-accept").innerHTML=wp.customize("cookie_consent_button_text")();var n=wp.customize("cookie_consent_type")();t.dataset.type=n,t.firstElementChild.classList.remove("ct-container","container"),t.firstElementChild.classList.add("type-1"===n?"container":"ct-container"),e&&setTimeout(function(){return window.ctEvents.trigger("blocksy:cookies:init")})}};wp.customize("cookie_consent_content",function(e){return e.bind(function(e){s()})}),wp.customize("cookie_consent_button_text",function(e){return e.bind(function(e){return s()})}),wp.customize("cookie_consent_type",function(e){return e.bind(function(e){return s()})})}]);
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=ctEvents},function(e,t,n){"use strict";n.r(t);var r,o=function(e){if([e.top,e.right,e.bottom,e.left].reduce((function(e,t){return!!e&&!("auto"!==t&&t&&t.toString().match(/\d/g))}),!0))return"CT_CSS_SKIP_RULE";var t=["auto"!==e.top&&e.top.toString().match(/\d/g)?e.top:0,"auto"!==e.right&&e.right.toString().match(/\d/g)?e.right:0,"auto"!==e.bottom&&e.bottom.toString().match(/\d/g)?e.bottom:0,"auto"!==e.left&&e.left.toString().match(/\d/g)?e.left:0];return t[0]===t[1]&&t[0]===t[2]&&t[0]===t[3]?t[0]:t[0]===t[2]&&t[1]===t[3]?"".concat(t[0]," ").concat(t[3]):t.join(" ")},c=function(e,t){var n=t.forcedOutput,r=void 0!==n&&n;if("CT_CSS_SKIP_RULE"===e)return"CT_CSS_SKIP_RULE";if("none"===e)return"none";if(!e.enable)return r?"none":"CT_CSS_SKIP_RULE";if(0===parseFloat(e.blur)&&0===parseFloat(e.spread)&&0===parseFloat(e.v_offset)&&0===parseFloat(e.h_offset))return r?"none":"CT_CSS_SKIP_RULE";var o=[];return e.inset&&o.push("inset"),o.push("".concat(e.h_offset,"px")),o.push("".concat(e.v_offset,"px")),0!==parseFloat(e.blur)&&(o.push("".concat(e.blur,"px")),0!==parseFloat(e.spread)&&o.push("".concat(e.spread,"px"))),0===parseFloat(e.blur)&&0!==parseFloat(e.spread)&&(o.push("".concat(e.blur,"px")),o.push("".concat(e.spread,"px"))),o.push(e.color.color),o.join(" ")},i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r={desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"},o=document.querySelector("style#".concat(r[n])),c=o.innerText,i="".concat(e["".concat(n,"_selector_prefix")]?"".concat(e["".concat(n,"_selector_prefix")]," "):"").concat(e.selector||":root"),a=null,l=c.match(a);0===c.trim().indexOf(i)?(a=new RegExp("".concat(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(a)):(a=new RegExp("\\}\\s*?".concat(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(a)),l||(0===(c="".concat(c," ").concat(i," { }")).trim().indexOf(i)?(a=new RegExp("".concat(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(a)):(a=new RegExp("\\}\\s*?".concat(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(a))),o.innerText=c.replace(a,l[0].indexOf("--".concat(e.variable,":"))>-1?l[0].replace(new RegExp("--".concat(e.variable,":[\\s\\S]*?;"),"gm"),t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";")):l[0].replace(new RegExp("".concat(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{"),"gm"),"".concat(i," {").concat(t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";"))))},a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:t;"border"===(e.type||"")&&(r="none"===t.style?"none":"".concat(t.width,"px ").concat(t.style," ").concat(t.color.color)),"spacing"===(e.type||"")&&(r=o(t)),"box-shadow"===(e.type||"")&&(r=c(t,e)),i(e,"".concat(r).concat(e.unit||"").concat(e.important?" !important":""),n)},l=function(e,t){var n=t;t=e.extractValue?e.extractValue(t):t,e.whenDone&&e.whenDone(t,n),t=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&Object.keys(e).indexOf("desktop")>-1?t?e:e.desktop:t?{desktop:e,tablet:e,mobile:e}:e}(t,!!e.responsive),e.responsive?(e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),a(e,t.desktop,"desktop"),a(e,t.tablet,"tablet"),a(e,t.mobile,"mobile")):a(e,t)};r={cookieContentColor:[{selector:".cookie-notification",variable:"color",type:"color:default"},{selector:".cookie-notification",variable:"colorHover",type:"color:hover"}],cookieBackground:{selector:".cookie-notification",variable:"backgroundColor",type:"color"},cookieButtonBackground:[{selector:".cookie-notification",variable:"buttonInitialColor",type:"color:default"},{selector:".cookie-notification",variable:"buttonHoverColor",type:"color:hover"}],cookieMaxWidth:{selector:".cookie-notification",variable:"maxWidth",unit:"px"}},wp.customize.bind("change",(function(e){return r[e.id]&&(Array.isArray(r[e.id])?r[e.id]:[r[e.id]]).map((function(t){return l(t,e())}))}));var u=n(0),s=n.n(u);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(){var e=document.createElement("div");return e.innerHTML=document.querySelector(".ct-customizer-preview-cache-container").value,e},g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";if(t||(t=h()),t.querySelector(".ct-customizer-preview-cache [data-".concat(n,'="').concat(e,'"]'))){var r=t.querySelector(".ct-customizer-preview-cache [data-".concat(n,'="').concat(e,'"]')).innerHTML,o=document.createElement("div");return o.innerHTML=r,o}},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=y({fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},should_insert:!0},e);var t=document.querySelector(e.parent_selector);if(p(document.querySelectorAll("".concat(e.parent_selector," ").concat(e.selector))).map((function(e){return e.parentNode.removeChild(e)})),e.should_insert){var n=g(e.fragment_id);if(n){for(;n.firstElementChild;)if(e.beforeInsert(n.firstElementChild),"append"===e.strategy&&t.appendChild(n.firstElementChild),"firstChild"===e.strategy&&t.insertBefore(n.firstElementChild,t.firstElementChild),e.strategy.indexOf("maybeBefore")>-1){var r=e.strategy.split(":"),o=f(r,2),c=(o[0],o[1]);t.querySelector(c)?t.insertBefore(n.firstElementChild,t.querySelector(c)):t.appendChild(n.firstElementChild)}e.whenInserted()}}};function _(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var O=function(){var e=function(e){if(!document.querySelector(".cookie-notification"))return S({fragment_id:"blocksy-cookies-consent-section",selector:".cookie-notification",parent_selector:"#main-container"}),!0}(),t=document.querySelector(".cookie-notification");if(t){t.querySelector(".ct-cookies-content")&&(t.querySelector(".ct-cookies-content").innerHTML=wp.customize("cookie_consent_content")()),t.querySelector("button.ct-accept").innerHTML=wp.customize("cookie_consent_button_text")();var n=wp.customize("cookie_consent_type")();t.dataset.type=n,t.firstElementChild.classList.remove("ct-container","container"),t.firstElementChild.classList.add("type-1"===n?"container":"ct-container"),e&&setTimeout((function(){return s.a.trigger("blocksy:cookies:init")}))}};wp.customize("cookie_consent_content",(function(e){return e.bind((function(e){O()}))})),wp.customize("cookie_consent_button_text",(function(e){return e.bind((function(e){return O()}))})),wp.customize("cookie_consent_type",(function(e){return e.bind((function(e){return O()}))})),wp.customize("forms_cookie_consent_content",(function(e){return e.bind((function(e){return _(document.querySelectorAll(".gdpr-confirm-policy label")).map((function(t){return t.innerHTML=e}))}))}))}]);
|
framework/extensions/cookies-consent/static/images/type-1.svg
CHANGED
@@ -1,41 +1,34 @@
|
|
1 |
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!-- Generator: Adobe Illustrator 23.0.
|
3 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
viewBox="0 0 100 70" style="enable-background:new 0 0 100 70;" xml:space="preserve">
|
5 |
<style type="text/css">
|
6 |
.st0{fill:#FFFFFF;}
|
7 |
.st1{fill:#EDEFF0;}
|
8 |
-
.st2{fill:#
|
9 |
-
.st3{fill:#
|
10 |
-
.st4{fill:#
|
11 |
</style>
|
12 |
<path class="st0" d="M13,73.5c-1.4,0-2.5-1.1-2.5-2.5V13c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5v58c0,1.4-1.1,2.5-2.5,2.5
|
13 |
H13z"/>
|
14 |
-
<path class="st1" d="M11,
|
15 |
-
<path class="st2" d="
|
16 |
-
<path class="st3" d="M87,11c1.1,0,2,0.9,2,2v58c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V13c0-1.1,0.9-2,2-2H87 M87,10H13
|
17 |
c-1.7,0-3,1.3-3,3v58c0,1.7,1.3,3,3,3h74c1.6,0,3-1.3,3-3V13C90,11.3,88.6,10,87,10z"/>
|
18 |
-
<path class="
|
19 |
-
|
20 |
-
c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S63.8,22.5,63.5,22.5z M22.4,20.5c0.5-0.9,1.4-1.4,2.4-1.4
|
27 |
-
c0.7,0,1.3,0.3,1.8,0.7c-0.1,0-0.3,0-0.4,0.1c-0.4,0.2-0.5,0.8,0,1.1c0.3,0.2,0.4,0.6,0.4,0.9s-0.7,1.5-0.7,1.5l-0.6-2.2V21
|
28 |
-
c0-0.1,0-0.1,0.1-0.2l0.1-0.1h0.3v-0.2H24v0.2h0.1c0.1,0,0.1,0.1,0.2,0.1c0.1,0.1,0.1,0.3,0.2,0.5l0.2,0.8l-0.5,1.2L23.6,21
|
29 |
-
c0,0,0-0.2,0.1-0.2l0.1-0.1v-0.2C23.8,20.5,22.4,20.5,22.4,20.5z M22.7,20.9c0,0-0.1-0.2-0.3-0.2h-0.1c-0.1,0.3-0.2,0.7-0.2,1.1
|
30 |
-
c0,1.1,0.7,2.1,1.7,2.5L22.7,20.9z M27.2,20.5c0.1,0.2,0,0.5-0.1,0.9c-0.3,0.9-0.9,2.4-1.2,3c1-0.4,1.6-1.4,1.6-2.5
|
31 |
-
C27.6,21.4,27.4,20.9,27.2,20.5 M24.9,22.8l-0.7,1.7c0.2,0,0.4,0.1,0.6,0.1s0.5,0,0.7-0.1L24.9,22.8z"/>
|
32 |
<g>
|
33 |
-
<path class="
|
34 |
C49.2,65.4,48.8,65.9,48.2,65.9z"/>
|
35 |
<path class="st0" d="M35.9,53.3h-17c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h17c0.3,0,0.5,0.2,0.5,0.5S36.2,53.3,35.9,53.3z"/>
|
36 |
<path class="st0" d="M24.7,56.3h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S25,56.3,24.7,56.3z"/>
|
37 |
<path class="st0" d="M35.9,56.3h-9.2c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h9.2c0.3,0,0.5,0.2,0.5,0.5S36.2,56.3,35.9,56.3z"/>
|
38 |
-
<path class="st0" d="M27.8,63.2h-7.3c-1.1,0-2.1-0.9-2.1-2.
|
39 |
C29.9,62.3,28.9,63.2,27.8,63.2z"/>
|
40 |
<path class="st0" d="M43.7,53.3h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S44,53.3,43.7,53.3z"/>
|
41 |
<path class="st0" d="M38.7,49.9H19.4c-0.6,0-1-0.5-1-1l0,0c0-0.6,0.5-1,1-1h19.2c0.6,0,1,0.5,1,1l0,0
|
1 |
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
viewBox="0 0 100 70" style="enable-background:new 0 0 100 70;" xml:space="preserve">
|
5 |
<style type="text/css">
|
6 |
.st0{fill:#FFFFFF;}
|
7 |
.st1{fill:#EDEFF0;}
|
8 |
+
.st2{fill:#565D66;}
|
9 |
+
.st3{fill:#4F5459;}
|
10 |
+
.st4{fill:#6E747A;}
|
11 |
</style>
|
12 |
<path class="st0" d="M13,73.5c-1.4,0-2.5-1.1-2.5-2.5V13c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5v58c0,1.4-1.1,2.5-2.5,2.5
|
13 |
H13z"/>
|
14 |
+
<path class="st1" d="M11,11h78v14H11V11z"/>
|
15 |
+
<path class="st2" d="M87,11c1.1,0,2,0.9,2,2v58c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V13c0-1.1,0.9-2,2-2H87 M87,10H13
|
|
|
16 |
c-1.7,0-3,1.3-3,3v58c0,1.7,1.3,3,3,3h74c1.6,0,3-1.3,3-3V13C90,11.3,88.6,10,87,10z"/>
|
17 |
+
<path class="st3" d="M77.5,18.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S77.8,18.5,77.5,18.5z
|
18 |
+
M70.5,18.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S70.8,18.5,70.5,18.5z M63.5,18.5h-4
|
19 |
+
c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S63.8,18.5,63.5,18.5z M22.4,16.5c0.5-0.9,1.4-1.4,2.4-1.4
|
20 |
+
c0.7,0,1.3,0.3,1.8,0.7c-0.1,0-0.3,0-0.4,0.1c-0.4,0.2-0.5,0.8,0,1.1c0.3,0.2,0.4,0.6,0.4,0.9s-0.7,1.5-0.7,1.5l-0.6-2.2V17
|
21 |
+
c0-0.1,0-0.1,0.1-0.2l0.1-0.1h0.3v-0.2H24v0.2h0.1c0.1,0,0.1,0.1,0.2,0.1c0.1,0.1,0.1,0.3,0.2,0.5l0.2,0.8l-0.5,1.2L23.6,17
|
22 |
+
c0,0,0-0.2,0.1-0.2l0.1-0.1v-0.2C23.8,16.5,22.4,16.5,22.4,16.5z M22.7,16.9c0,0-0.1-0.2-0.3-0.2h-0.1c-0.1,0.3-0.2,0.7-0.2,1.1
|
23 |
+
c0,1.1,0.7,2.1,1.7,2.5L22.7,16.9z M27.2,16.5c0.1,0.2,0,0.5-0.1,0.9c-0.3,0.9-0.9,2.4-1.2,3c1-0.4,1.6-1.4,1.6-2.5
|
24 |
+
C27.6,17.4,27.4,16.9,27.2,16.5 M24.9,18.8l-0.7,1.7c0.2,0,0.4,0.1,0.6,0.1s0.5,0,0.7-0.1L24.9,18.8z"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<g>
|
26 |
+
<path class="st4" d="M48.2,65.9H16.6c-0.5,0-1-0.5-1-1V45.7c0-0.6,0.5-1,1-1h31.6c0.5,0,1,0.4,1,1v19.1
|
27 |
C49.2,65.4,48.8,65.9,48.2,65.9z"/>
|
28 |
<path class="st0" d="M35.9,53.3h-17c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h17c0.3,0,0.5,0.2,0.5,0.5S36.2,53.3,35.9,53.3z"/>
|
29 |
<path class="st0" d="M24.7,56.3h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S25,56.3,24.7,56.3z"/>
|
30 |
<path class="st0" d="M35.9,56.3h-9.2c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h9.2c0.3,0,0.5,0.2,0.5,0.5S36.2,56.3,35.9,56.3z"/>
|
31 |
+
<path class="st0" d="M27.8,63.2h-7.3c-1.1,0-2.1-0.9-2.1-2.1l0,0c0-1.1,0.9-2.1,2.1-2.1h7.3c1.1,0,2.1,0.9,2.1,2.1l0,0
|
32 |
C29.9,62.3,28.9,63.2,27.8,63.2z"/>
|
33 |
<path class="st0" d="M43.7,53.3h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S44,53.3,43.7,53.3z"/>
|
34 |
<path class="st0" d="M38.7,49.9H19.4c-0.6,0-1-0.5-1-1l0,0c0-0.6,0.5-1,1-1h19.2c0.6,0,1,0.5,1,1l0,0
|
framework/extensions/cookies-consent/static/images/type-2.svg
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!-- Generator: Adobe Illustrator 23.0.
|
3 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
viewBox="0 0 100 70" style="enable-background:new 0 0 100 70;" xml:space="preserve">
|
5 |
<style type="text/css">
|
@@ -12,35 +12,23 @@
|
|
12 |
<path class="st0" d="M13,73.5c-1.4,0-2.5-1.1-2.5-2.5V13c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5v58c0,1.4-1.1,2.5-2.5,2.5
|
13 |
H13z"/>
|
14 |
<g>
|
15 |
-
<rect x="10.4" y="
|
16 |
-
<path class="st0" d="M32.3,
|
17 |
-
|
18 |
-
<path class="st0" d="
|
19 |
-
|
20 |
-
<path class="st0" d="
|
21 |
-
|
22 |
-
<path class="st0" d="M84.2,67.1h-7.3c-1.1,0-2.1-0.9-2.1-2.1v0c0-1.1,0.9-2.1,2.1-2.1h7.3c1.1,0,2.1,0.9,2.1,2.1v0
|
23 |
-
C86.3,66.2,85.4,67.1,84.2,67.1z"/>
|
24 |
-
<path class="st0" d="M40.1,67.5h-5.8c-0.3,0-0.5-0.2-0.5-0.5c0-0.3,0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5
|
25 |
-
C40.6,67.3,40.4,67.5,40.1,67.5z"/>
|
26 |
-
<path class="st0" d="M35.1,64H15.9c-0.6,0-1-0.5-1-1l0,0c0-0.6,0.5-1,1-1h19.2c0.6,0,1,0.5,1,1l0,0C36.1,63.6,35.7,64,35.1,64z"/>
|
27 |
</g>
|
28 |
-
<path class="st2" d="M11,
|
29 |
-
<path class="st1" d="M89.5,15h-79v-2c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5V15z"/>
|
30 |
<path class="st3" d="M87,11c1.1,0,2,0.9,2,2v58c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V13c0-1.1,0.9-2,2-2H87 M87,10H13
|
31 |
c-1.7,0-3,1.3-3,3v58c0,1.7,1.3,3,3,3h74c1.6,0,3-1.3,3-3V13C90,11.3,88.6,10,87,10z"/>
|
32 |
-
<path class="
|
33 |
-
|
34 |
-
c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S63.8,22.5,63.5,22.5z M22.4,20.5c0.5-0.9,1.4-1.4,2.4-1.4
|
41 |
-
c0.7,0,1.3,0.3,1.8,0.7c-0.1,0-0.3,0-0.4,0.1c-0.4,0.2-0.5,0.8,0,1.1c0.3,0.2,0.4,0.6,0.4,0.9s-0.7,1.5-0.7,1.5l-0.6-2.2V21
|
42 |
-
c0-0.1,0-0.1,0.1-0.2l0.1-0.1h0.3v-0.2H24v0.2h0.1c0.1,0,0.1,0.1,0.2,0.1c0.1,0.1,0.1,0.3,0.2,0.5l0.2,0.8l-0.5,1.2L23.6,21
|
43 |
-
c0,0,0-0.2,0.1-0.2l0.1-0.1v-0.2C23.8,20.5,22.4,20.5,22.4,20.5z M22.7,20.9c0,0-0.1-0.2-0.3-0.2h-0.1c-0.1,0.3-0.2,0.7-0.2,1.1
|
44 |
-
c0,1.1,0.7,2.1,1.7,2.5L22.7,20.9z M27.2,20.5c0.1,0.2,0,0.5-0.1,0.9c-0.3,0.9-0.9,2.4-1.2,3c1-0.4,1.6-1.4,1.6-2.5
|
45 |
-
C27.6,21.4,27.4,20.9,27.2,20.5 M24.9,22.8l-0.7,1.7c0.2,0,0.4,0.1,0.6,0.1s0.5,0,0.7-0.1L24.9,22.8z"/>
|
46 |
</svg>
|
1 |
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
viewBox="0 0 100 70" style="enable-background:new 0 0 100 70;" xml:space="preserve">
|
5 |
<style type="text/css">
|
12 |
<path class="st0" d="M13,73.5c-1.4,0-2.5-1.1-2.5-2.5V13c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5v58c0,1.4-1.1,2.5-2.5,2.5
|
13 |
H13z"/>
|
14 |
<g>
|
15 |
+
<rect x="10.4" y="57.2" class="st1" width="79.1" height="13"/>
|
16 |
+
<path class="st0" d="M32.3,66.5h-17c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h17c0.3,0,0.5,0.2,0.5,0.5S32.6,66.5,32.3,66.5z"/>
|
17 |
+
<path class="st0" d="M43.9,66.5h-9.2c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h9.2c0.3,0,0.5,0.2,0.5,0.5S44.2,66.5,43.9,66.5z"/>
|
18 |
+
<path class="st0" d="M84.2,66.1h-7.3c-1.1,0-2.1-0.9-2.1-2.1l0,0c0-1.1,0.9-2.1,2.1-2.1h7.3c1.1,0,2.1,0.9,2.1,2.1l0,0
|
19 |
+
C86.3,65.2,85.4,66.1,84.2,66.1z"/>
|
20 |
+
<path class="st0" d="M51.9,66.5h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S52.2,66.5,51.9,66.5z"/>
|
21 |
+
<path class="st0" d="M35.1,63H15.9c-0.6,0-1-0.5-1-1l0,0c0-0.6,0.5-1,1-1h19.2c0.6,0,1,0.5,1,1l0,0C36.1,62.6,35.7,63,35.1,63z"/>
|
|
|
|
|
|
|
|
|
|
|
22 |
</g>
|
23 |
+
<path class="st2" d="M11,11h78v14H11V11z"/>
|
|
|
24 |
<path class="st3" d="M87,11c1.1,0,2,0.9,2,2v58c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V13c0-1.1,0.9-2,2-2H87 M87,10H13
|
25 |
c-1.7,0-3,1.3-3,3v58c0,1.7,1.3,3,3,3h74c1.6,0,3-1.3,3-3V13C90,11.3,88.6,10,87,10z"/>
|
26 |
+
<path class="st4" d="M77.5,18.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S77.8,18.5,77.5,18.5z
|
27 |
+
M70.5,18.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S70.8,18.5,70.5,18.5z M63.5,18.5h-4
|
28 |
+
c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S63.8,18.5,63.5,18.5z M22.4,16.5c0.5-0.9,1.4-1.4,2.4-1.4
|
29 |
+
c0.7,0,1.3,0.3,1.8,0.7c-0.1,0-0.3,0-0.4,0.1c-0.4,0.2-0.5,0.8,0,1.1c0.3,0.2,0.4,0.6,0.4,0.9s-0.7,1.5-0.7,1.5l-0.6-2.2V17
|
30 |
+
c0-0.1,0-0.1,0.1-0.2l0.1-0.1h0.3v-0.2H24v0.2h0.1c0.1,0,0.1,0.1,0.2,0.1c0.1,0.1,0.1,0.3,0.2,0.5l0.2,0.8l-0.5,1.2L23.6,17
|
31 |
+
c0,0,0-0.2,0.1-0.2l0.1-0.1v-0.2C23.8,16.5,22.4,16.5,22.4,16.5z M22.7,16.9c0,0-0.1-0.2-0.3-0.2h-0.1c-0.1,0.3-0.2,0.7-0.2,1.1
|
32 |
+
c0,1.1,0.7,2.1,1.7,2.5L22.7,16.9z M27.2,16.5c0.1,0.2,0,0.5-0.1,0.9c-0.3,0.9-0.9,2.4-1.2,3c1-0.4,1.6-1.4,1.6-2.5
|
33 |
+
C27.6,17.4,27.4,16.9,27.2,16.5 M24.9,18.8l-0.7,1.7c0.2,0,0.4,0.1,0.6,0.1s0.5,0,0.7-0.1L24.9,18.8z"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</svg>
|
framework/extensions/cookies-consent/static/js/ct-events.js
ADDED
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Listen and trigger custom events to communicate between javascript components
|
3 |
+
*/
|
4 |
+
window.ctEvents =
|
5 |
+
window.ctEvents ||
|
6 |
+
new (function () {
|
7 |
+
var _events = {}
|
8 |
+
var currentIndentation = 1
|
9 |
+
var debug = false
|
10 |
+
|
11 |
+
this.countAll = function (topic) {
|
12 |
+
return _events[topic]
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Make log helper public
|
17 |
+
*
|
18 |
+
* @param {String} [message]
|
19 |
+
* @param {Object} [data]
|
20 |
+
*/
|
21 |
+
this.log = log
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Enable/Disable Debug
|
25 |
+
* @param {Boolean} enabled
|
26 |
+
*/
|
27 |
+
this.debug = function (enabled) {
|
28 |
+
debug = Boolean(enabled)
|
29 |
+
|
30 |
+
return this
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Add event listener
|
35 |
+
*
|
36 |
+
* @param event {String | Object}
|
37 |
+
* Can be a:
|
38 |
+
* - single event: 'event1'
|
39 |
+
* - space separated event list: 'event1 event2 event2'
|
40 |
+
* - an object: {event1: function () {}, event2: function () {}}
|
41 |
+
*
|
42 |
+
* @param callback {Function}
|
43 |
+
*/
|
44 |
+
this.on = function (topicStringOrObject, listener) {
|
45 |
+
objectMap(
|
46 |
+
splitTopicStringOrObject(topicStringOrObject, listener),
|
47 |
+
function (eventName, listener) {
|
48 |
+
;(_events[eventName] || (_events[eventName] = [])).push(
|
49 |
+
listener
|
50 |
+
)
|
51 |
+
|
52 |
+
debug && log('✚ ' + eventName)
|
53 |
+
}
|
54 |
+
)
|
55 |
+
|
56 |
+
return this
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Same as .on(), but callback will executed only once
|
61 |
+
*/
|
62 |
+
this.one = function (topicStringOrObject, listener) {
|
63 |
+
objectMap(
|
64 |
+
splitTopicStringOrObject(topicStringOrObject, listener),
|
65 |
+
function (eventName, listener) {
|
66 |
+
;(_events[eventName] || (_events[eventName] = [])).push(
|
67 |
+
once(listener)
|
68 |
+
)
|
69 |
+
|
70 |
+
debug && log('✚ [' + eventName + ']')
|
71 |
+
}
|
72 |
+
)
|
73 |
+
|
74 |
+
return this
|
75 |
+
|
76 |
+
// https://github.com/jashkenas/underscore/blob/8fc7032295d60aff3620ef85d4aa6549a55688a0/underscore.js#L946
|
77 |
+
function once(func) {
|
78 |
+
var memo
|
79 |
+
|
80 |
+
var times = 2
|
81 |
+
|
82 |
+
return function () {
|
83 |
+
if (--times > 0) {
|
84 |
+
memo = func.apply(this, arguments)
|
85 |
+
}
|
86 |
+
|
87 |
+
if (times <= 1) func = null
|
88 |
+
|
89 |
+
return memo
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* In order to remove one single listener you should give as an argument
|
96 |
+
* the same callback function. If you want to remove *all* listeners from
|
97 |
+
* a particular event you should not pass the second argument.
|
98 |
+
*
|
99 |
+
* @param topicStringOrObject {String | Object}
|
100 |
+
* @param listener {Function | false}
|
101 |
+
*/
|
102 |
+
this.off = function (topicStringOrObject, listener) {
|
103 |
+
objectMap(
|
104 |
+
splitTopicStringOrObject(topicStringOrObject, listener),
|
105 |
+
function (eventName, listener) {
|
106 |
+
if (_events[eventName]) {
|
107 |
+
if (listener) {
|
108 |
+
_events[eventName].splice(
|
109 |
+
_events[eventName].indexOf(listener) >>> 0,
|
110 |
+
1
|
111 |
+
)
|
112 |
+
} else {
|
113 |
+
_events[eventName] = []
|
114 |
+
}
|
115 |
+
|
116 |
+
debug && log('✖ ' + eventName)
|
117 |
+
}
|
118 |
+
}
|
119 |
+
)
|
120 |
+
|
121 |
+
return this
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Trigger an event. In case you provide multiple events via space-separated
|
126 |
+
* string or an object of events it will execute listeners for each event
|
127 |
+
* separatedly. You can use the "all" event to trigger all events.
|
128 |
+
*
|
129 |
+
* @param topicStringOrObject {String | Object}
|
130 |
+
* @param data {Object}
|
131 |
+
*/
|
132 |
+
this.trigger = function (eventName, data) {
|
133 |
+
objectMap(splitTopicStringOrObject(eventName), function (
|
134 |
+
eventName
|
135 |
+
) {
|
136 |
+
log('╭─ ' + eventName, data)
|
137 |
+
|
138 |
+
changeIndentation(+1)
|
139 |
+
|
140 |
+
try {
|
141 |
+
// TODO: REFACTOR THAT!!!!!!!!!
|
142 |
+
// Maybe this is an occasion for using 'all' event???
|
143 |
+
if (eventName === 'fw:options:init') {
|
144 |
+
fw.options.startListeningToEvents(
|
145 |
+
data.$elements || document.body
|
146 |
+
)
|
147 |
+
}
|
148 |
+
|
149 |
+
;(_events[eventName] || []).map(dispatchSingleEvent)
|
150 |
+
;(_events['all'] || []).map(dispatchSingleEvent)
|
151 |
+
} catch (e) {
|
152 |
+
console.log(
|
153 |
+
'%c [Events] Exception raised.',
|
154 |
+
'color: red; font-weight: bold;'
|
155 |
+
)
|
156 |
+
|
157 |
+
if (typeof console !== 'undefined') {
|
158 |
+
console.error(e)
|
159 |
+
} else {
|
160 |
+
throw e
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
changeIndentation(-1)
|
165 |
+
|
166 |
+
log('╰─ ' + eventName, data)
|
167 |
+
|
168 |
+
function dispatchSingleEvent(listenerDescriptor) {
|
169 |
+
if (!listenerDescriptor) return
|
170 |
+
|
171 |
+
listenerDescriptor.call(window, data)
|
172 |
+
}
|
173 |
+
})
|
174 |
+
|
175 |
+
return this
|
176 |
+
|
177 |
+
function changeIndentation(increment) {
|
178 |
+
if (typeof increment != 'undefined') {
|
179 |
+
currentIndentation += increment > 0 ? +1 : -1
|
180 |
+
}
|
181 |
+
|
182 |
+
if (currentIndentation < 0) {
|
183 |
+
currentIndentation = 0
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Check if an event has listeners
|
190 |
+
* @param {String} [event]
|
191 |
+
* @return {Boolean}
|
192 |
+
*/
|
193 |
+
this.hasListeners = function (eventName) {
|
194 |
+
if (!_events) {
|
195 |
+
return false
|
196 |
+
}
|
197 |
+
|
198 |
+
return (_events[eventName] || []).length > 0
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Probably split string into general purpose object representation for
|
203 |
+
* event names and listeners. This function leaves objects un-modified.
|
204 |
+
*
|
205 |
+
* @param topicStringOrObject {String | Object}
|
206 |
+
* @param listener {Function | false}
|
207 |
+
*
|
208 |
+
* @returns {Object} {
|
209 |
+
* eventname: listener,
|
210 |
+
* otherevent: listener
|
211 |
+
* }
|
212 |
+
*/
|
213 |
+
function splitTopicStringOrObject(topicStringOrObject, listener) {
|
214 |
+
if (typeof topicStringOrObject !== 'string') {
|
215 |
+
return topicStringOrObject
|
216 |
+
}
|
217 |
+
|
218 |
+
var arrayOfEvents = topicStringOrObject
|
219 |
+
.replace(/\s\s+/g, ' ')
|
220 |
+
.trim()
|
221 |
+
.split(' ')
|
222 |
+
|
223 |
+
var len = arrayOfEvents.length
|
224 |
+
|
225 |
+
var listenerDescriptor = Object.create(null)
|
226 |
+
|
227 |
+
for (var i = 0; i < len; i++) {
|
228 |
+
listenerDescriptor[arrayOfEvents[i]] = listener
|
229 |
+
}
|
230 |
+
|
231 |
+
return listenerDescriptor
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* returns a new object with the predicate applied to each value
|
236 |
+
* objectMap({a: 3, b: 5, c: 9}, (key, value) => value + 1); // {a: 4, b: 6, c: 10}
|
237 |
+
* objectMap({a: 3, b: 5, c: 9}, (key, value) => key); // {a: 'a', b: 'b', c: 'c'}
|
238 |
+
* objectMap({a: 3, b: 5, c: 9}, (key, value) => key + value); // {a: 'a3', b: 'b5', c: 'c9'}
|
239 |
+
*
|
240 |
+
* https://github.com/angus-c/just/tree/master/packages/object-map
|
241 |
+
*/
|
242 |
+
function objectMap(obj, predicate) {
|
243 |
+
var result = {}
|
244 |
+
var keys = Object.keys(obj)
|
245 |
+
var len = keys.length
|
246 |
+
|
247 |
+
for (var i = 0; i < len; i++) {
|
248 |
+
var key = keys[i]
|
249 |
+
result[key] = predicate(key, obj[key])
|
250 |
+
}
|
251 |
+
|
252 |
+
return result
|
253 |
+
}
|
254 |
+
|
255 |
+
function log(message, data) {
|
256 |
+
if (!debug) {
|
257 |
+
return
|
258 |
+
}
|
259 |
+
|
260 |
+
if (typeof data != 'undefined') {
|
261 |
+
console.log('[Event] ' + getIndentation() + message, '─', data)
|
262 |
+
} else {
|
263 |
+
console.log('[Event] ' + getIndentation() + message)
|
264 |
+
}
|
265 |
+
|
266 |
+
function getIndentation() {
|
267 |
+
return new Array(currentIndentation).join('│ ')
|
268 |
+
}
|
269 |
+
}
|
270 |
+
})()
|
framework/extensions/cookies-consent/static/js/helpers.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const onDocumentLoaded = cb => {
|
2 |
+
if (/comp|inter|loaded/.test(document.readyState)) {
|
3 |
+
cb()
|
4 |
+
} else {
|
5 |
+
document.addEventListener('DOMContentLoaded', cb, false)
|
6 |
+
}
|
7 |
+
}
|
framework/extensions/cookies-consent/static/js/lazy-load-helpers.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const markImagesAsLoaded = el =>
|
2 |
+
[...el.querySelectorAll('.ct-image-container.ct-lazy')].map(el => {
|
3 |
+
if (el.querySelector('img')) {
|
4 |
+
el.querySelector('img').setAttribute(
|
5 |
+
'src',
|
6 |
+
el.querySelector('img').dataset.ctLazy
|
7 |
+
)
|
8 |
+
|
9 |
+
if (el.querySelector('img').dataset.ctLazySet) {
|
10 |
+
el.querySelector('img').setAttribute(
|
11 |
+
'srcset',
|
12 |
+
el.querySelector('img').dataset.ctLazySet
|
13 |
+
)
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
el.classList.remove('ct-lazy')
|
18 |
+
el.classList.add('ct-lazy-loaded')
|
19 |
+
})
|
20 |
+
|
framework/extensions/cookies-consent/static/js/main.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import ctEvents from 'ct-events'
|
2 |
import cookie from 'js-cookie'
|
|
|
3 |
|
4 |
const initCookies = () => {
|
5 |
const notification = document.querySelector('.cookie-notification')
|
@@ -52,10 +53,10 @@ const initCookies = () => {
|
|
52 |
})
|
53 |
}
|
54 |
|
55 |
-
|
56 |
initCookies()
|
57 |
|
58 |
-
|
59 |
initCookies()
|
60 |
})
|
61 |
})
|
1 |
import ctEvents from 'ct-events'
|
2 |
import cookie from 'js-cookie'
|
3 |
+
import { onDocumentLoaded } from './helpers'
|
4 |
|
5 |
const initCookies = () => {
|
6 |
const notification = document.querySelector('.cookie-notification')
|
53 |
})
|
54 |
}
|
55 |
|
56 |
+
onDocumentLoaded(() => {
|
57 |
initCookies()
|
58 |
|
59 |
+
ctEvents.on('blocksy:cookies:init', () => {
|
60 |
initCookies()
|
61 |
})
|
62 |
})
|
framework/extensions/cookies-consent/static/js/sync.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import './variables'
|
|
|
2 |
|
3 |
-
import { renderWithStrategy } from '
|
4 |
|
5 |
const maybeAnimateCookiesConsent = cb => {
|
6 |
if (document.querySelector('.cookie-notification')) return
|
@@ -23,9 +24,11 @@ const render = () => {
|
|
23 |
return
|
24 |
}
|
25 |
|
26 |
-
notification.querySelector('
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
|
30 |
notification.querySelector('button.ct-accept').innerHTML = wp.customize(
|
31 |
'cookie_consent_button_text'
|
@@ -41,7 +44,7 @@ const render = () => {
|
|
41 |
)
|
42 |
|
43 |
if (didInsert) {
|
44 |
-
setTimeout(() =>
|
45 |
}
|
46 |
}
|
47 |
|
@@ -52,3 +55,11 @@ wp.customize('cookie_consent_content', val =>
|
|
52 |
)
|
53 |
wp.customize('cookie_consent_button_text', val => val.bind(to => render()))
|
54 |
wp.customize('cookie_consent_type', val => val.bind(to => render()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import './variables'
|
2 |
+
import ctEvents from 'ct-events'
|
3 |
|
4 |
+
import { renderWithStrategy } from './sync/helpers'
|
5 |
|
6 |
const maybeAnimateCookiesConsent = cb => {
|
7 |
if (document.querySelector('.cookie-notification')) return
|
24 |
return
|
25 |
}
|
26 |
|
27 |
+
if (notification.querySelector('.ct-cookies-content')) {
|
28 |
+
notification.querySelector(
|
29 |
+
'.ct-cookies-content'
|
30 |
+
).innerHTML = wp.customize('cookie_consent_content')()
|
31 |
+
}
|
32 |
|
33 |
notification.querySelector('button.ct-accept').innerHTML = wp.customize(
|
34 |
'cookie_consent_button_text'
|
44 |
)
|
45 |
|
46 |
if (didInsert) {
|
47 |
+
setTimeout(() => ctEvents.trigger('blocksy:cookies:init'))
|
48 |
}
|
49 |
}
|
50 |
|
55 |
)
|
56 |
wp.customize('cookie_consent_button_text', val => val.bind(to => render()))
|
57 |
wp.customize('cookie_consent_type', val => val.bind(to => render()))
|
58 |
+
|
59 |
+
wp.customize('forms_cookie_consent_content', val =>
|
60 |
+
val.bind(to =>
|
61 |
+
[...document.querySelectorAll('.gdpr-confirm-policy label')].map(
|
62 |
+
el => (el.innerHTML = to)
|
63 |
+
)
|
64 |
+
)
|
65 |
+
)
|
framework/extensions/cookies-consent/static/js/sync/helpers.js
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const getCache = () => {
|
2 |
+
const div = document.createElement('div')
|
3 |
+
|
4 |
+
div.innerHTML = document.querySelector(
|
5 |
+
'.ct-customizer-preview-cache-container'
|
6 |
+
).value
|
7 |
+
|
8 |
+
return div
|
9 |
+
}
|
10 |
+
|
11 |
+
export const getFreshHtmlFor = (id, cache = null, attr = 'id') => {
|
12 |
+
if (!cache) {
|
13 |
+
cache = getCache()
|
14 |
+
}
|
15 |
+
|
16 |
+
if (
|
17 |
+
!cache.querySelector(
|
18 |
+
`.ct-customizer-preview-cache [data-${attr}="${id}"]`
|
19 |
+
)
|
20 |
+
) {
|
21 |
+
return
|
22 |
+
}
|
23 |
+
|
24 |
+
const newHtml = cache.querySelector(
|
25 |
+
`.ct-customizer-preview-cache [data-${attr}="${id}"]`
|
26 |
+
).innerHTML
|
27 |
+
|
28 |
+
const e = document.createElement('div')
|
29 |
+
e.innerHTML = newHtml
|
30 |
+
|
31 |
+
return e
|
32 |
+
}
|
33 |
+
|
34 |
+
export const renderWithStrategy = (args = {}) => {
|
35 |
+
args = {
|
36 |
+
fragment_id: null,
|
37 |
+
|
38 |
+
selector: null,
|
39 |
+
parent_selector: null,
|
40 |
+
|
41 |
+
// append | firstChild | maybeBefore:selector
|
42 |
+
strategy: 'append',
|
43 |
+
whenInserted: () => {},
|
44 |
+
beforeInsert: el => {},
|
45 |
+
|
46 |
+
should_insert: true,
|
47 |
+
|
48 |
+
...args
|
49 |
+
}
|
50 |
+
|
51 |
+
const parent = document.querySelector(args.parent_selector)
|
52 |
+
;[
|
53 |
+
...document.querySelectorAll(`${args.parent_selector} ${args.selector}`)
|
54 |
+
].map(el => el.parentNode.removeChild(el))
|
55 |
+
|
56 |
+
if (!args.should_insert) return
|
57 |
+
|
58 |
+
const el = getFreshHtmlFor(args.fragment_id)
|
59 |
+
|
60 |
+
if (!el) {
|
61 |
+
return
|
62 |
+
}
|
63 |
+
|
64 |
+
while (el.firstElementChild) {
|
65 |
+
args.beforeInsert(el.firstElementChild)
|
66 |
+
|
67 |
+
if (args.strategy === 'append') {
|
68 |
+
parent.appendChild(el.firstElementChild)
|
69 |
+
}
|
70 |
+
|
71 |
+
if (args.strategy === 'firstChild') {
|
72 |
+
parent.insertBefore(el.firstElementChild, parent.firstElementChild)
|
73 |
+
}
|
74 |
+
|
75 |
+
if (args.strategy.indexOf('maybeBefore') > -1) {
|
76 |
+
const [_, selector] = args.strategy.split(':')
|
77 |
+
|
78 |
+
if (parent.querySelector(selector)) {
|
79 |
+
parent.insertBefore(
|
80 |
+
el.firstElementChild,
|
81 |
+
parent.querySelector(selector)
|
82 |
+
)
|
83 |
+
} else {
|
84 |
+
parent.appendChild(el.firstElementChild)
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
args.whenInserted()
|
90 |
+
}
|
91 |
+
|
92 |
+
export const checkAndReplace = (args = {}) => {
|
93 |
+
args = {
|
94 |
+
id: null,
|
95 |
+
|
96 |
+
fragment_id: null,
|
97 |
+
|
98 |
+
selector: null,
|
99 |
+
parent_selector: null,
|
100 |
+
|
101 |
+
// append | firstChild | maybeBefore:selector
|
102 |
+
strategy: 'append',
|
103 |
+
whenInserted: () => {},
|
104 |
+
beforeInsert: el => {},
|
105 |
+
watch: [],
|
106 |
+
|
107 |
+
...args
|
108 |
+
}
|
109 |
+
|
110 |
+
const render = () => {
|
111 |
+
const to = wp.customize(args.id)()
|
112 |
+
|
113 |
+
renderWithStrategy({
|
114 |
+
...args,
|
115 |
+
should_insert: to === 'yes'
|
116 |
+
})
|
117 |
+
}
|
118 |
+
|
119 |
+
wp.customize(args.id, val => val.bind(to => render()))
|
120 |
+
args.watch.map(opt => wp.customize(opt, val => val.bind(() => render())))
|
121 |
+
}
|
122 |
+
|
123 |
+
export const responsiveClassesFor = (id, el) => {
|
124 |
+
el.classList.remove('ct-hidden-sm', 'ct-hidden-md', 'ct-hidden-lg')
|
125 |
+
|
126 |
+
if (!wp.customize(id)) return
|
127 |
+
|
128 |
+
const data = wp.customize(id)() || {
|
129 |
+
mobile: false,
|
130 |
+
tablet: true,
|
131 |
+
desktop: true
|
132 |
+
}
|
133 |
+
|
134 |
+
if (!data.mobile) {
|
135 |
+
el.classList.add('ct-hidden-sm')
|
136 |
+
}
|
137 |
+
|
138 |
+
if (!data.tablet) {
|
139 |
+
el.classList.add('ct-hidden-md')
|
140 |
+
}
|
141 |
+
|
142 |
+
if (!data.desktop) {
|
143 |
+
el.classList.add('ct-hidden-lg')
|
144 |
+
}
|
145 |
+
}
|
framework/extensions/cookies-consent/static/js/variables.js
CHANGED
@@ -1,14 +1,23 @@
|
|
1 |
import { handleVariablesFor } from 'customizer-sync-helpers'
|
2 |
|
3 |
handleVariablesFor({
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
cookieBackground: {
|
11 |
-
|
|
|
12 |
type: 'color'
|
13 |
},
|
14 |
|
@@ -27,7 +36,8 @@ handleVariablesFor({
|
|
27 |
],
|
28 |
|
29 |
cookieMaxWidth: {
|
30 |
-
|
|
|
31 |
unit: 'px'
|
32 |
}
|
33 |
})
|
1 |
import { handleVariablesFor } from 'customizer-sync-helpers'
|
2 |
|
3 |
handleVariablesFor({
|
4 |
+
cookieContentColor: [
|
5 |
+
{
|
6 |
+
selector: '.cookie-notification',
|
7 |
+
variable: 'color',
|
8 |
+
type: 'color:default'
|
9 |
+
},
|
10 |
+
|
11 |
+
{
|
12 |
+
selector: '.cookie-notification',
|
13 |
+
variable: 'colorHover',
|
14 |
+
type: 'color:hover'
|
15 |
+
}
|
16 |
+
],
|
17 |
|
18 |
cookieBackground: {
|
19 |
+
selector: '.cookie-notification',
|
20 |
+
variable: 'backgroundColor',
|
21 |
type: 'color'
|
22 |
},
|
23 |
|
36 |
],
|
37 |
|
38 |
cookieMaxWidth: {
|
39 |
+
selector: '.cookie-notification',
|
40 |
+
variable: 'maxWidth',
|
41 |
unit: 'px'
|
42 |
}
|
43 |
})
|
framework/extensions/cookies-consent/static/sass/main.scss
CHANGED
@@ -5,7 +5,11 @@
|
|
5 |
left: 0;
|
6 |
bottom: 0;
|
7 |
z-index: 999999;
|
8 |
-
color: var(--
|
|
|
|
|
|
|
|
|
9 |
|
10 |
@include media-breakpoint-down (xs) {
|
11 |
> div {
|
@@ -24,16 +28,17 @@
|
|
24 |
}
|
25 |
}
|
26 |
|
|
|
27 |
// type 1
|
28 |
&[data-type='type-1'] {
|
29 |
@include media-breakpoint-down (sm) {
|
30 |
-
background: var(--
|
31 |
}
|
32 |
|
33 |
@include media-breakpoint-up (md) {
|
34 |
padding: 0 25px 25px 25px;
|
35 |
|
36 |
-
|
37 |
margin-bottom: 15px;
|
38 |
max-width: 90%;
|
39 |
}
|
@@ -48,19 +53,20 @@
|
|
48 |
}
|
49 |
|
50 |
@include media-breakpoint-up (md) {
|
51 |
-
background: var(--
|
52 |
-
box-shadow: 0px
|
53 |
padding: 25px 40px 25px 25px;
|
54 |
border-radius: 3px;
|
55 |
-
max-width: var(--
|
56 |
}
|
57 |
}
|
58 |
}
|
59 |
|
|
|
60 |
// type 2
|
61 |
&[data-type='type-2'] {
|
62 |
right: 0;
|
63 |
-
background: var(--
|
64 |
|
65 |
@include media-breakpoint-up (md) {
|
66 |
padding: 15px 0;
|
@@ -81,10 +87,15 @@
|
|
81 |
}
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
|
86 |
line-height: 1.4;
|
87 |
|
|
|
|
|
|
|
|
|
|
|
88 |
@include media-breakpoint-down (xs) {
|
89 |
text-align: center;
|
90 |
margin-bottom: 15px;
|
@@ -100,15 +111,11 @@
|
|
100 |
}
|
101 |
|
102 |
.ct-accept {
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
padding: 20px,
|
109 |
-
shadow: false,
|
110 |
-
translate: false
|
111 |
-
));
|
112 |
|
113 |
@include media-breakpoint-down (xs) {
|
114 |
width: 100%;
|
@@ -120,26 +127,18 @@
|
|
120 |
}
|
121 |
|
122 |
.ct-close {
|
123 |
-
position: absolute;
|
124 |
-
top: 0;
|
125 |
-
right: 0;
|
126 |
-
border: 0;
|
127 |
display: flex;
|
128 |
align-items: center;
|
129 |
justify-content: center;
|
130 |
width: 45px;
|
131 |
height: 45px;
|
132 |
-
|
|
|
|
|
133 |
opacity: 0.5;
|
134 |
color: inherit;
|
135 |
cursor: pointer;
|
136 |
-
appearance: none;
|
137 |
background: transparent;
|
138 |
-
transition: opacity 0.2s ease;
|
139 |
-
|
140 |
-
&:focus {
|
141 |
-
outline: none;
|
142 |
-
}
|
143 |
|
144 |
&:hover {
|
145 |
opacity: 1;
|
5 |
left: 0;
|
6 |
bottom: 0;
|
7 |
z-index: 999999;
|
8 |
+
color: var(--color);
|
9 |
+
|
10 |
+
a:hover {
|
11 |
+
color: var(--colorHover);
|
12 |
+
}
|
13 |
|
14 |
@include media-breakpoint-down (xs) {
|
15 |
> div {
|
28 |
}
|
29 |
}
|
30 |
|
31 |
+
|
32 |
// type 1
|
33 |
&[data-type='type-1'] {
|
34 |
@include media-breakpoint-down (sm) {
|
35 |
+
background: var(--backgroundColor);
|
36 |
}
|
37 |
|
38 |
@include media-breakpoint-up (md) {
|
39 |
padding: 0 25px 25px 25px;
|
40 |
|
41 |
+
.ct-cookies-content {
|
42 |
margin-bottom: 15px;
|
43 |
max-width: 90%;
|
44 |
}
|
53 |
}
|
54 |
|
55 |
@include media-breakpoint-up (md) {
|
56 |
+
background: var(--backgroundColor);
|
57 |
+
box-shadow: 0px 5px 30px -5px rgba(34, 56, 101, 0.15);
|
58 |
padding: 25px 40px 25px 25px;
|
59 |
border-radius: 3px;
|
60 |
+
max-width: var(--maxWidth);
|
61 |
}
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
|
66 |
// type 2
|
67 |
&[data-type='type-2'] {
|
68 |
right: 0;
|
69 |
+
background: var(--backgroundColor);
|
70 |
|
71 |
@include media-breakpoint-up (md) {
|
72 |
padding: 15px 0;
|
87 |
}
|
88 |
}
|
89 |
|
90 |
+
|
91 |
+
.ct-cookies-content {
|
92 |
line-height: 1.4;
|
93 |
|
94 |
+
a {
|
95 |
+
text-decoration: underline;
|
96 |
+
color: var(--colorHover);
|
97 |
+
}
|
98 |
+
|
99 |
@include media-breakpoint-down (xs) {
|
100 |
text-align: center;
|
101 |
margin-bottom: 15px;
|
111 |
}
|
112 |
|
113 |
.ct-accept {
|
114 |
+
--buttonFontSize: 13px;
|
115 |
+
--buttonMinHeight: 35px;
|
116 |
+
--padding: 0 20px;
|
117 |
+
--buttonShadow: none;
|
118 |
+
--buttonTransform: none;
|
|
|
|
|
|
|
|
|
119 |
|
120 |
@include media-breakpoint-down (xs) {
|
121 |
width: 100%;
|
127 |
}
|
128 |
|
129 |
.ct-close {
|
|
|
|
|
|
|
|
|
130 |
display: flex;
|
131 |
align-items: center;
|
132 |
justify-content: center;
|
133 |
width: 45px;
|
134 |
height: 45px;
|
135 |
+
position: absolute;
|
136 |
+
top: 0;
|
137 |
+
right: 0;
|
138 |
opacity: 0.5;
|
139 |
color: inherit;
|
140 |
cursor: pointer;
|
|
|
141 |
background: transparent;
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
&:hover {
|
144 |
opacity: 1;
|
framework/extensions/mailchimp/admin-static/bundle/1.2c9ebf0a36c6c732fee6.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(window.blocksyMailchimpExtJsonp=window.blocksyMailchimpExtJsonp||[]).push([[1],[,,,,,,function(e,t,n){var o;
|
2 |
+
/*!
|
3 |
+
Copyright (c) 2017 Jed Watson.
|
4 |
+
Licensed under the MIT License (MIT), see
|
5 |
+
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)&&o.length){var s=r.apply(null,o);s&&e.push(s)}else if("object"===i)for(var u in o)n.call(o,u)&&o[u]&&e.push(u)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t,n){e.exports=n(8)()},function(e,t,n){"use strict";var o=n(9);function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,i,s){if(s!==o){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";e.exports=n(11)},function(e,t,n){"use strict";
|
7 |
+
/** @license React v16.13.1
|
8 |
+
* react-is.production.min.js
|
9 |
+
*
|
10 |
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
11 |
+
*
|
12 |
+
* This source code is licensed under the MIT license found in the
|
13 |
+
* LICENSE file in the root directory of this source tree.
|
14 |
+
*/var o="function"==typeof Symbol&&Symbol.for,r=o?Symbol.for("react.element"):60103,i=o?Symbol.for("react.portal"):60106,s=o?Symbol.for("react.fragment"):60107,u=o?Symbol.for("react.strict_mode"):60108,a=o?Symbol.for("react.profiler"):60114,l=o?Symbol.for("react.provider"):60109,p=o?Symbol.for("react.context"):60110,d=o?Symbol.for("react.async_mode"):60111,c=o?Symbol.for("react.concurrent_mode"):60111,h=o?Symbol.for("react.forward_ref"):60112,f=o?Symbol.for("react.suspense"):60113,g=o?Symbol.for("react.suspense_list"):60120,m=o?Symbol.for("react.memo"):60115,v=o?Symbol.for("react.lazy"):60116,y=o?Symbol.for("react.block"):60121,I=o?Symbol.for("react.fundamental"):60117,S=o?Symbol.for("react.responder"):60118,b=o?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case d:case c:case s:case a:case u:case f:return e;default:switch(e=e&&e.$$typeof){case p:case h:case v:case m:case l:return e;default:return t}}case i:return t}}}function x(e){return w(e)===c}t.AsyncMode=d,t.ConcurrentMode=c,t.ContextConsumer=p,t.ContextProvider=l,t.Element=r,t.ForwardRef=h,t.Fragment=s,t.Lazy=v,t.Memo=m,t.Portal=i,t.Profiler=a,t.StrictMode=u,t.Suspense=f,t.isAsyncMode=function(e){return x(e)||w(e)===d},t.isConcurrentMode=x,t.isContextConsumer=function(e){return w(e)===p},t.isContextProvider=function(e){return w(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===h},t.isFragment=function(e){return w(e)===s},t.isLazy=function(e){return w(e)===v},t.isMemo=function(e){return w(e)===m},t.isPortal=function(e){return w(e)===i},t.isProfiler=function(e){return w(e)===a},t.isStrictMode=function(e){return w(e)===u},t.isSuspense=function(e){return w(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===c||e===a||e===u||e===f||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===v||e.$$typeof===m||e.$$typeof===l||e.$$typeof===p||e.$$typeof===h||e.$$typeof===I||e.$$typeof===S||e.$$typeof===b||e.$$typeof===y)},t.typeOf=w},function(e,t,n){"use strict";function o(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var s=n(7),u=n.n(s),a=n(1);n(10);function l(e){return null!=e&&"object"==typeof e&&1===e.nodeType}function p(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function d(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return p(n.overflowY,t)||p(n.overflowX,t)||function(e){var t=function(e){return e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView.frameElement:null}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function c(e,t,n,o,r,i,s,u){return i<e&&s>t||i>e&&s<t?0:i<=e&&u<=n||s>=t&&u>=n?i-e-o:s>t&&u<n||i<e&&u>n?s-t+r:0}var h=0;function f(e){return"function"==typeof e?e:g}function g(){}function m(e,t){null!==e&&function(e,t){var n=t.scrollMode,o=t.block,r=t.inline,i=t.boundary,s=t.skipOverflowHiddenElements,u="function"==typeof i?i:function(e){return e!==i};if(!l(e))throw new TypeError("Invalid target");for(var a=document.scrollingElement||document.documentElement,p=[],h=e;l(h)&&u(h);){if((h=h.parentNode)===a){p.push(h);break}h===document.body&&d(h)&&!d(document.documentElement)||d(h,s)&&p.push(h)}for(var f=window.visualViewport?visualViewport.width:innerWidth,g=window.visualViewport?visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),I=y.height,S=y.width,b=y.top,w=y.right,x=y.bottom,C=y.left,H="start"===o||"nearest"===o?b:"end"===o?x:b+I/2,O="center"===r?C+S/2:"end"===r?w:C,E=[],P=0;P<p.length;P++){var M=p[P],D=M.getBoundingClientRect(),T=D.height,k=D.width,R=D.top,A=D.right,V=D.bottom,K=D.left;if("if-needed"===n&&b>=0&&C>=0&&x<=g&&w<=f&&b>=R&&x<=V&&C>=K&&w<=A)return E;var _=getComputedStyle(M),L=parseInt(_.borderLeftWidth,10),$=parseInt(_.borderTopWidth,10),B=parseInt(_.borderRightWidth,10),j=parseInt(_.borderBottomWidth,10),W=0,U=0,N="offsetWidth"in M?M.offsetWidth-M.clientWidth-L-B:0,F="offsetHeight"in M?M.offsetHeight-M.clientHeight-$-j:0;if(a===M)W="start"===o?H:"end"===o?H-g:"nearest"===o?c(v,v+g,g,$,j,v+H,v+H+I,I):H-g/2,U="start"===r?O:"center"===r?O-f/2:"end"===r?O-f:c(m,m+f,f,L,B,m+O,m+O+S,S),W=Math.max(0,W+v),U=Math.max(0,U+m);else{W="start"===o?H-R-$:"end"===o?H-V+j+F:"nearest"===o?c(R,V,T,$,j+F,H,H+I,I):H-(R+T/2)+F/2,U="start"===r?O-K-L:"center"===r?O-(K+k/2)+N/2:"end"===r?O-A+B+N:c(K,A,k,L,B+N,O,O+S,S);var z=M.scrollLeft,Y=M.scrollTop;H+=Y-(W=Math.max(0,Math.min(Y+W,M.scrollHeight-T+F))),O+=z-(U=Math.max(0,Math.min(z+U,M.scrollWidth-k+N)))}E.push({el:M,top:W,left:U})}return E}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,o=e.left;t.scrollTop=n,t.scrollLeft=o}))}function v(e,t){return e===t||e.contains&&e.contains(t)}function y(e,t){var n;function o(){n&&clearTimeout(n)}function r(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];o(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return r.cancel=o,r}function I(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return t.some((function(t){return t&&t.apply(void 0,[e].concat(o)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function S(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function b(e){var t=e.isOpen,n=e.selectedItem,o=e.resultCount,r=e.previousResultCount,i=e.itemToString;return t?o?o!==r?o+" result"+(1===o?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":n?i(n):""}function w(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function x(e){return"string"==typeof e.type}function C(e){return e.props}var H=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function O(e){void 0===e&&(e={});var t={};return H.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function E(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function P(e,t,n){var o=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:o+1);var r=t+e;return r<0?r=o:r>o&&(r=0),r}var M=y((function(){T().textContent=""}),500);function D(e,t){var n=T(t);e&&(n.textContent=e,M())}function T(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var k=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),R=function(){var e=function(e){var t,n;function s(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+String(h++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var o=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==o})),e()}),t);n.timeoutIds.push(o)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=O(t),n.internalSetState(r({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,o){t=O(t),n.internalSetState(r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),o)},n.selectItemAtIndex=function(e,t,o){var r=n.items[e];null!=r&&n.selectItem(r,t,o)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var o,i,s={},u="function"==typeof e;return!u&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,r({},n.getStateAndHelpers(),{},e)),n.setState((function(t){t=n.getState(t);var a=u?e(t):e;a=n.props.stateReducer(t,a),o=a.hasOwnProperty("selectedItem");var l={},p={};return o&&a.selectedItem!==t.selectedItem&&(i=a.selectedItem),a.type=a.type||0,Object.keys(a).forEach((function(e){t[e]!==a[e]&&(s[e]=a[e]),"type"!==e&&(p[e]=a[e],n.isControlledProp(e)||(l[e]=a[e]))})),u&&a.hasOwnProperty("inputValue")&&n.props.onInputValueChange(a.inputValue,r({},n.getStateAndHelpers(),{},a)),l}),(function(){f(t)(),Object.keys(s).length>1&&n.props.onStateChange(s,n.getStateAndHelpers()),o&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==i&&n.props.onChange(i,n.getStateAndHelpers()),n.props.onUserAction(s,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,s=void 0===e?{}:e,u=s.refKey,a=void 0===u?"ref":u,l=s.ref,p=o(s,["refKey","ref"]),d=(void 0===t?{}:t).suppressRefError,c=void 0!==d&&d;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=c;var h=n.getState().isOpen;return r(((i={})[a]=S(l,n.rootRef),i.role="combobox",i["aria-expanded"]=h,i["aria-haspopup"]="listbox",i["aria-owns"]=h?n.menuId:null,i["aria-labelledby"]=n.labelId,i),p)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();e>0&&t.setHighlightedIndex(P(1,t.getState().highlightedIndex,e),{type:4})}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();e>0&&t.setHighlightedIndex(P(-1,t.getState().highlightedIndex,e),{type:4})}))},Enter:function(e){var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;if(n&&null!=o){e.preventDefault();var r=this.items[o],i=this.getItemNodeFromIndex(o);if(null==r||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape:function(e){e.preventDefault(),this.reset({type:5,selectedItem:null,inputValue:""})}},n.buttonKeyDownHandlers=r({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=r({},n.keyDownHandlers,{Home:function(e){this.highlightFirstOrLastIndex(e,!0,{type:7})},End:function(e){this.highlightFirstOrLastIndex(e,!1,{type:8})}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick,s=(t.onPress,t.onKeyDown),u=t.onKeyUp,a=t.onBlur,l=o(t,["onClick","onPress","onKeyDown","onKeyUp","onBlur"]),p=n.getState().isOpen,d={onClick:I(i,n.buttonHandleClick),onKeyDown:I(s,n.buttonHandleKeyDown),onKeyUp:I(u,n.buttonHandleKeyUp),onBlur:I(a,n.buttonHandleBlur)};return r({type:"button",role:"button","aria-label":p?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l.disabled?{}:d,{},l)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=E(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(i(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return r({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,s=t.onBlur,u=t.onChange,a=t.onInput,l=(t.onChangeText,o(t,["onKeyDown","onBlur","onChange","onInput","onChangeText"])),p={};var d,c=n.getState(),h=c.inputValue,f=c.isOpen,g=c.highlightedIndex;l.disabled||((d={}).onChange=I(u,a,n.inputHandleChange),d.onKeyDown=I(i,n.inputHandleKeyDown),d.onBlur=I(s,n.inputHandleBlur),p=d);return r({"aria-autocomplete":"list","aria-activedescendant":f&&"number"==typeof g&&g>=0?n.getItemId(g):null,"aria-controls":f?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:h,id:n.inputId},p,{},l)},n.inputHandleKeyDown=function(e){var t=E(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(i(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,s=void 0===e?{}:e,u=s.refKey,a=void 0===u?"ref":u,l=s.ref,p=o(s,["refKey","ref"]),d=(void 0===t?{}:t).suppressRefError,c=void 0!==d&&d;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=c,r(((i={})[a]=S(l,n.menuRef),i.role="listbox",i["aria-labelledby"]=p&&p["aria-label"]?null:n.labelId,i.id=n.menuId,i),p)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,s=i.onMouseMove,u=i.onMouseDown,a=i.onClick,l=(i.onPress,i.index),p=i.item,d=void 0===p?void 0:p,c=o(i,["onMouseMove","onMouseDown","onClick","onPress","index","item"]);void 0===l?(n.items.push(d),l=n.items.indexOf(d)):n.items[l]=d;var h=a,f=((t={onMouseMove:I(s,(function(){l!==n.getState().highlightedIndex&&(n.setHighlightedIndex(l,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:I(u,(function(e){e.preventDefault()}))}).onClick=I(h,(function(){n.selectItemAtIndex(l,{type:9})})),t),g=c.disabled?{onMouseDown:f.onMouseDown}:f;return r({id:n.getItemId(l),role:"option","aria-selected":n.getState().highlightedIndex===l},g,{},c)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=O(e),n.internalSetState((function(t){var o=t.selectedItem;return r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(o)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=O(e),n.internalSetState((function(t){var o=t.isOpen;return r({isOpen:!o},o&&{highlightedIndex:n.props.defaultHighlightedIndex},{},e)}),(function(){var o=n.getState(),r=o.isOpen,i=o.highlightedIndex;r&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),f(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=y((function(){var e=n.getState(),t=n.items[e.highlightedIndex],o=n.getItemCount(),i=n.props.getA11yStatusMessage(r({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:o,highlightedItem:t},e));n.previousResultCount=o,D(i,n.props.environment.document)}),200);var s=n.props,u=s.defaultHighlightedIndex,a=s.initialHighlightedIndex,l=void 0===a?u:a,p=s.defaultIsOpen,d=s.initialIsOpen,c=void 0===d?p:d,g=s.initialInputValue,m=void 0===g?"":g,v=s.initialSelectedItem,b=void 0===v?null:v,w=n.getState({highlightedIndex:l,isOpen:c,inputValue:m,selectedItem:b});return null!=w.selectedItem&&void 0===n.props.initialInputValue&&(w.inputValue=n.props.itemToString(w.selectedItem)),n.state=w,n}n=e,(t=s).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var u=s.prototype;return u.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},u.getState=function(e){var t=this;return void 0===e&&(e=this.state),Object.keys(e).reduce((function(n,o){return n[o]=t.isControlledProp(o)?t.props[o]:e[o],n}),{})},u.isControlledProp=function(e){return void 0!==this.props[e]},u.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},u.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},u.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},u.moveHighlightedIndex=function(e,t){var n=this.getItemCount();if(n>0){var o=P(e,this.getState().highlightedIndex,n);this.setHighlightedIndex(o,t)}},u.highlightFirstOrLastIndex=function(e,t,n){var o=this.getItemCount()-1;o<0||!this.getState().isOpen||(e.preventDefault(),this.setHighlightedIndex(t?0:o,n))},u.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,r=e.isOpen,i=this.props.itemToString,s=this.id,u=this.getRootProps,a=this.getToggleButtonProps,l=this.getLabelProps,p=this.getMenuProps,d=this.getInputProps,c=this.getItemProps,h=this.openMenu,f=this.closeMenu,g=this.toggleMenu,m=this.selectItem,v=this.selectItemAtIndex,y=this.selectHighlightedItem,I=this.setHighlightedIndex,S=this.clearSelection,b=this.clearItems;return{getRootProps:u,getToggleButtonProps:a,getLabelProps:l,getMenuProps:p,getInputProps:d,getItemProps:c,reset:this.reset,openMenu:h,closeMenu:f,toggleMenu:g,selectItem:m,selectItemAtIndex:v,selectHighlightedItem:y,setHighlightedIndex:I,clearSelection:S,clearItems:b,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:s,highlightedIndex:t,inputValue:n,isOpen:r,selectedItem:o}},u.componentDidMount=function(){var e=this;var t=function(t,n){void 0===n&&(n=!0);var o=e.props.environment.document;return[e._rootNode,e._menuNode].some((function(e){return e&&(v(e,t)||n&&v(e,o.activeElement))}))},n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1,!t(n.target)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},i=function(){e.isTouchMove=!0},s=function(n){var o=t(n.target,!1);e.isTouchMove||o||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",n),u.addEventListener("mouseup",o),u.addEventListener("touchstart",r),u.addEventListener("touchmove",i),u.addEventListener("touchend",s),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",n),u.removeEventListener("mouseup",o),u.removeEventListener("touchstart",r),u.removeEventListener("touchmove",i),u.removeEventListener("touchend",s)}},u.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,o=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==o},u.componentDidUpdate=function(e,t){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},u.componentWillUnmount=function(){this.cleanup()},u.render=function(){var e=w(this.props.children,g);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=w(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:x(t)?Object(a.cloneElement)(t,this.getRootProps(C(t))):void 0:null},s}(a.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:b,itemToString:function(e){return null==e?"":String(e)},onStateChange:g,onInputValueChange:g,onUserAction:g,onChange:g,onSelect:g,onOuterClick:g,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:m},e.stateChangeTypes=k,e}();u.a.array.isRequired,u.a.func,u.a.func,u.a.func,u.a.bool,u.a.number,u.a.number,u.a.number,u.a.bool,u.a.bool,u.a.bool,u.a.any,u.a.any,u.a.any,u.a.string,u.a.string,u.a.string,u.a.func,u.a.string,u.a.func,u.a.func,u.a.func,u.a.func,u.a.func,u.a.shape({addEventListener:u.a.func,removeEventListener:u.a.func,document:u.a.shape({getElementById:u.a.func,activeElement:u.a.any,body:u.a.any})});"undefined"==typeof window||window;t.a=R}]]);
|
framework/extensions/mailchimp/admin-static/bundle/2.976c8f43abfe584b1a9d.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(window.blocksyMailchimpExtJsonp=window.blocksyMailchimpExtJsonp||[]).push([[2],{13:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n(12),c=n(2),i=n(6),o=n.n(i);function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t,n,r,a,c,i){try{var o=e[c](i),u=o.value}catch(e){return void n(e)}o.done?t(u):Promise.resolve(u).then(r,a)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,a=!1,c=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,c=e}finally{try{r||null==o.return||o.return()}finally{if(a)throw c}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var d=null;t.default=function(e){var t=e.value,n=e.onChange,i=s(Object(r.useState)(d||[]),2),f=i[0],p=i[1],m=s(Object(r.useState)(!d),2),b=m[0],v=m[1],h=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,n,r,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(!(a.length>0&&void 0!==a[0])||a[0])&&v(!0),(t=new FormData).append("action","blocksy_ext_mailchimp_get_actual_lists"),e.prev=4,e.next=7,fetch(ajaxurl,{method:"POST",body:t});case 7:if(200!==(n=e.sent).status){e.next=18;break}return e.next=11,n.json();case 11:if(!(r=e.sent).success){e.next=18;break}if("api_key_invalid"===r.data.result){e.next=18;break}return v(!1),p(r.data.result),d=r.data.result,e.abrupt("return");case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(4);case 22:v(!1);case 23:case"end":return e.stop()}}),e,null,[[4,20]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var c=e.apply(t,n);function i(e){l(c,r,a,i,o,"next",e)}function o(e){l(c,r,a,i,o,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return Object(r.useEffect)((function(){h(!d)}),[]),0===f.length?Object(r.createElement)("div",{className:"ct-select-input"},Object(r.createElement)("input",{disabled:!0,placeholder:b?Object(c.__)("Loading...","blc"):Object(c.__)("Invalid API Key...","blc")})):Object(r.createElement)(a.a,{selectedItem:t||f[0].id,onChange:function(e){return n(e)},itemToString:function(e){return e?(f.find((function(t){return t.id===e}))||{}).name:""}},(function(e){var t=e.getInputProps,n=e.getItemProps,a=(e.getLabelProps,e.getMenuProps),i=e.isOpen,l=(e.inputValue,e.highlightedIndex),s=e.selectedItem,d=e.openMenu;return Object(r.createElement)("div",{className:"ct-select-input"},Object(r.createElement)("input",u({},t({onFocus:function(){return d()},onClick:function(){return d()}}),{placeholder:Object(c.__)("Select list...","blc"),readOnly:!0})),i&&Object(r.createElement)("div",a({className:"ct-select-dropdown"}),f.map((function(e,t){return Object(r.createElement)("div",n({key:e.id,index:t,item:e.id,className:o()("ct-select-dropdown-item",{active:l===t,selected:s===e.id})}),e.name)}))))}))}}}]);
|
framework/extensions/mailchimp/admin-static/bundle/main.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(t){for(var n,o,
|
1 |
+
!function(e){function t(t){for(var n,o,c=t[0],i=t[1],u=0,l=[];u<c.length;u++)o=c[u],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&l.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(a&&a(t);l.length;)l.shift()()}var n={},r={0:0};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var c=new Promise((function(t,o){n=r[e]=[t,o]}));t.push(n[2]=c);var i,u=document.createElement("script");u.charset="utf-8",u.timeout=120,o.nc&&u.setAttribute("nonce",o.nc),u.src=function(e){return o.p+""+e+"."+{1:"2c9ebf0a36c6c732fee6",2:"976c8f43abfe584b1a9d"}[e]+".js"}(e);var a=new Error;i=function(t){u.onerror=u.onload=null,clearTimeout(l);var n=r[e];if(0!==n){if(n){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,n[1](a)}r[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:u})}),12e4);u.onerror=u.onload=i,document.head.appendChild(u)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.blocksyMailchimpExtJsonp=window.blocksyMailchimpExtJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var u=0;u<c.length;u++)t(c[u]);var a=i;o(o.s=5)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=ctEvents},function(e,t,n){n.p=blocksy_ext_mailchimp_localization.public_url},function(e,t,n){"use strict";n.r(t);n(4);var r=n(0),o=n(2),c=n(1),i=Object(c.lazy)((function(){return Promise.all([n.e(1),n.e(2)]).then(n.bind(null,13))})),u=function(e){return Object(r.createElement)("div",null,Object(r.createElement)(c.Suspense,{fallback:Object(r.createElement)("div",{className:"ct-select-input"},Object(r.createElement)("input",{disabled:!0,placeholder:Object(o.__)("Loading...","blc")}))},Object(r.createElement)(i,e)))},a=n(3),l=n.n(a);document.addEventListener("DOMContentLoaded",(function(){return l.a.on("blocksy:options:register",(function(e){e["blocksy-mailchimp"]=u}))}))}]);
|
framework/extensions/mailchimp/admin-static/bundle/sync.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],i=!0,n=!1,o=void 0;try{for(var l,c=e[Symbol.iterator]();!(i=(l=c.next()).done)&&(r.push(l.value),!t||r.length!==t);i=!0);}catch(e){n=!0,o=e}finally{try{!i&&c.return&&c.return()}finally{if(n)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e};var o,l=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";r||((t=document.createElement("div")).innerHTML=document.querySelector(".ct-customizer-preview-cache-container").value,r=t);var n=r.querySelector(".ct-customizer-preview-cache [data-"+i+'="'+e+'"]').innerHTML,o=document.createElement("div");return o.innerHTML=n,o},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=n({fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},should_insert:!0},e);var t=document.querySelector(e.parent_selector);if([].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(document.querySelectorAll(e.parent_selector+" "+e.selector))).map(function(e){return e.parentNode.removeChild(e)}),e.should_insert){for(var r=l(e.fragment_id);r.firstElementChild;)if(e.beforeInsert(r.firstElementChild),"append"===e.strategy&&t.appendChild(r.firstElementChild),"firstChild"===e.strategy&&t.insertBefore(r.firstElementChild,t.firstElementChild),e.strategy.indexOf("maybeBefore")>-1){var o=e.strategy.split(":"),c=i(o,2),a=(c[0],c[1]);t.querySelector(a)?t.insertBefore(r.firstElementChild,t.querySelector(a)):t.appendChild(r.firstElementChild)}e.whenInserted()}},a=function(e,t){if(t.classList.remove("ct-hidden-sm","ct-hidden-md","ct-hidden-lg"),wp.customize(e)){var r=wp.customize(e)()||{mobile:!1,tablet:!0,desktop:!0};r.mobile||t.classList.add("ct-hidden-sm"),r.tablet||t.classList.add("ct-hidden-md"),r.desktop||t.classList.add("ct-hidden-lg")}},u=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",i=document.querySelector("#"+{desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"}[r]),n=i.innerText,o=e.selector||":root",l=new RegExp(o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?{[\\s\\S]*?}","gm"),c=n.match(l);c&&(i.innerText=n.replace(l,c[0].indexOf("--"+e.variable+":")>-1?c[0].replace(new RegExp("--"+e.variable+":[\\s\\S]*?;","gm"),"CT_CSS_SKIP_RULE"===t?"":"--"+e.variable+": "+t+";"):c[0].replace(new RegExp(o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?{","gm"),o+" {"+("CT_CSS_SKIP_RULE"===t?"":"--"+e.variable+": "+t+";"))))},s=function(e,t){return[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(e.selector?document.querySelectorAll(e.selector):[document.documentElement])).map(function(r){if(!e.responsive){var i=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:e.extractValue?e.extractValue(t):t;return"border"===(e.type||"")&&(i="none"===t.style?"none":t.width+"px "+t.style+" "+t.color.color),void u(e,""+i+(e.unit||""))}t=function(e){return e.desktop?e:{desktop:e,tablet:e,mobile:e}}(t),t=e.extractValue?e.extractValue(t):t,e.respect_visibility&&(wp.customize(e.respect_visibility)().mobile||(t.mobile="0"+(e.unit?"":"px")),wp.customize(e.respect_visibility)().tablet||(t.tablet="0"+(e.unit?"":"px")),wp.customize(e.respect_visibility)().desktop||(t.desktop="0"+(e.unit?"":"px"))),e.respect_stacking&&(wp.customize(e.respect_stacking)().mobile&&(t.mobile=2*parseInt(t.mobile,10)+(e.unit?"":"px")),wp.customize(e.respect_stacking)().tablet&&(t.tablet=2*parseInt(t.tablet,10)+(e.unit?"":"px"))),e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),u(e,""+t.desktop+(e.unit||""),"desktop"),u(e,""+t.tablet+(e.unit||""),"tablet"),u(e,""+t.mobile+(e.unit||""),"mobile")})};o={mailchimpContent:{variable:"mailchimpContent",type:"color"},mailchimpButton:[{selector:".ct-mailchimp-block",variable:"buttonInitialColor",type:"color:default"},{selector:".ct-mailchimp-block",variable:"buttonHoverColor",type:"color:hover"}],mailchimpBackground:{variable:"mailchimpBackground",type:"color"},mailchimpShadow:{variable:"mailchimpShadow",type:"color"},mailchimpSpacing:{variable:"mailchimpSpacing",responsive:!0,unit:""}},wp.customize.bind("change",function(e){return o[e.id]&&(Array.isArray(o[e.id])?o[e.id]:[o[e.id]]).map(function(t){return s(t,e())})}),wp.customize("mailchimp_subscribe_visibility",function(e){return e.bind(function(e){var t=document.querySelector(".ct-mailchimp-block");a("mailchimp_subscribe_visibility",t)})}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=n({id:null,fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},watch:[]},e);var t=function(){var t=wp.customize(e.id)();c(n({},e,{should_insert:"yes"===t}))};wp.customize(e.id,function(e){return e.bind(function(e){return t()})}),e.watch.map(function(e){return wp.customize(e,function(e){return e.bind(function(){return t()})})})}({id:"mailchimp_single_post_enabled",strategy:"append",parent_selector:".content-area article",selector:".ct-mailchimp-block",fragment_id:"blocksy-mailchimp-subscribe",watch:["has_mailchimp_name","mailchimp_button_text","mailchimp_title","mailchimp_text"],whenInserted:function(){var e=document.querySelector(".ct-mailchimp-block");a("mailchimp_subscribe_visibility",e),"yes"!==wp.customize("has_mailchimp_name")()&&e.querySelector('[name="FNAME"]').parentNode.removeChild(e.querySelector('[name="FNAME"]')),e.querySelector("button").innerHTML=wp.customize("mailchimp_button_text")(),e.querySelector("h4").innerHTML=wp.customize("mailchimp_title")(),e.querySelector(".ct-mailchimp-description").innerHTML=wp.customize("mailchimp_text")()}})}]);
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=e[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||i(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.r(t);var u,p=function(){var e=document.createElement("div");return e.innerHTML=document.querySelector(".ct-customizer-preview-cache-container").value,e},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";if(t||(t=p()),t.querySelector(".ct-customizer-preview-cache [data-".concat(n,'="').concat(e,'"]'))){var r=t.querySelector(".ct-customizer-preview-cache [data-".concat(n,'="').concat(e,'"]')).innerHTML,o=document.createElement("div");return o.innerHTML=r,o}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},should_insert:!0},e);var t=document.querySelector(e.parent_selector);if(o(document.querySelectorAll("".concat(e.parent_selector," ").concat(e.selector))).map((function(e){return e.parentNode.removeChild(e)})),e.should_insert){var n=m(e.fragment_id);if(n){for(;n.firstElementChild;)if(e.beforeInsert(n.firstElementChild),"append"===e.strategy&&t.appendChild(n.firstElementChild),"firstChild"===e.strategy&&t.insertBefore(n.firstElementChild,t.firstElementChild),e.strategy.indexOf("maybeBefore")>-1){var i=e.strategy.split(":"),c=r(i,2),a=(c[0],c[1]);t.querySelector(a)?t.insertBefore(n.firstElementChild,t.querySelector(a)):t.appendChild(n.firstElementChild)}e.whenInserted()}}},f=function(e,t){if(t.classList.remove("ct-hidden-sm","ct-hidden-md","ct-hidden-lg"),wp.customize(e)){var n=wp.customize(e)()||{mobile:!1,tablet:!0,desktop:!0};n.mobile||t.classList.add("ct-hidden-sm"),n.tablet||t.classList.add("ct-hidden-md"),n.desktop||t.classList.add("ct-hidden-lg")}},b=function(e){if([e.top,e.right,e.bottom,e.left].reduce((function(e,t){return!!e&&!("auto"!==t&&t&&t.toString().match(/\d/g))}),!0))return"CT_CSS_SKIP_RULE";var t=["auto"!==e.top&&e.top.toString().match(/\d/g)?e.top:0,"auto"!==e.right&&e.right.toString().match(/\d/g)?e.right:0,"auto"!==e.bottom&&e.bottom.toString().match(/\d/g)?e.bottom:0,"auto"!==e.left&&e.left.toString().match(/\d/g)?e.left:0];return t[0]===t[1]&&t[0]===t[2]&&t[0]===t[3]?t[0]:t[0]===t[2]&&t[1]===t[3]?"".concat(t[0]," ").concat(t[3]):t.join(" ")},h=function(e,t){var n=t.forcedOutput,r=void 0!==n&&n;if("CT_CSS_SKIP_RULE"===e)return"CT_CSS_SKIP_RULE";if("none"===e)return"none";if(!e.enable)return r?"none":"CT_CSS_SKIP_RULE";if(0===parseFloat(e.blur)&&0===parseFloat(e.spread)&&0===parseFloat(e.v_offset)&&0===parseFloat(e.h_offset))return r?"none":"CT_CSS_SKIP_RULE";var o=[];return e.inset&&o.push("inset"),o.push("".concat(e.h_offset,"px")),o.push("".concat(e.v_offset,"px")),0!==parseFloat(e.blur)&&(o.push("".concat(e.blur,"px")),0!==parseFloat(e.spread)&&o.push("".concat(e.spread,"px"))),0===parseFloat(e.blur)&&0!==parseFloat(e.spread)&&(o.push("".concat(e.blur,"px")),o.push("".concat(e.spread,"px"))),o.push(e.color.color),o.join(" ")},y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r={desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"},o=document.querySelector("style#".concat(r[n])),i=o.innerText,c="".concat(e["".concat(n,"_selector_prefix")]?"".concat(e["".concat(n,"_selector_prefix")]," "):"").concat(e.selector||":root"),a=null,l=i.match(a);0===i.trim().indexOf(c)?(a=new RegExp("".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a)):(a=new RegExp("\\}\\s*?".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a)),l||(0===(i="".concat(i," ").concat(c," { }")).trim().indexOf(c)?(a=new RegExp("".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a)):(a=new RegExp("\\}\\s*?".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=i.match(a))),o.innerText=i.replace(a,l[0].indexOf("--".concat(e.variable,":"))>-1?l[0].replace(new RegExp("--".concat(e.variable,":[\\s\\S]*?;"),"gm"),t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";")):l[0].replace(new RegExp("".concat(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{"),"gm"),"".concat(c," {").concat(t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";"))))},v=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:t;"border"===(e.type||"")&&(r="none"===t.style?"none":"".concat(t.width,"px ").concat(t.style," ").concat(t.color.color)),"spacing"===(e.type||"")&&(r=b(t)),"box-shadow"===(e.type||"")&&(r=h(t,e)),y(e,"".concat(r).concat(e.unit||"").concat(e.important?" !important":""),n)},g=function(e,t){var n=t;t=e.extractValue?e.extractValue(t):t,e.whenDone&&e.whenDone(t,n),t=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&Object.keys(e).indexOf("desktop")>-1?t?e:e.desktop:t?{desktop:e,tablet:e,mobile:e}:e}(t,!!e.responsive),e.responsive?(e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),v(e,t.desktop,"desktop"),v(e,t.tablet,"tablet"),v(e,t.mobile,"mobile")):v(e,t)};u={mailchimpContent:[{selector:".ct-mailchimp-block",variable:"color",type:"color:default"},{selector:".ct-mailchimp-block",variable:"linkHoverColor",type:"color:hover"}],mailchimpButton:[{selector:".ct-mailchimp-block",variable:"buttonInitialColor",type:"color:default"},{selector:".ct-mailchimp-block",variable:"buttonHoverColor",type:"color:hover"}],mailchimpBackground:{selector:".ct-mailchimp-block",variable:"mailchimpBackground",type:"color"},mailchimpShadow:{selector:".ct-mailchimp-block",type:"box-shadow",variable:"box-shadow",responsive:!0},mailchimpSpacing:{selector:".ct-mailchimp-block",variable:"padding",responsive:!0,unit:""}},wp.customize.bind("change",(function(e){return u[e.id]&&(Array.isArray(u[e.id])?u[e.id]:[u[e.id]]).map((function(t){return g(t,e())}))})),wp.customize("mailchimp_subscribe_visibility",(function(e){return e.bind((function(e){var t=document.querySelector(".ct-mailchimp-block");f("mailchimp_subscribe_visibility",t)}))})),(document.body.classList.contains("single")||document.body.classList.contains("page"))&&function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({id:null,fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},watch:[]},e);var t=function(){var t=wp.customize(e.id)();d(l(l({},e),{},{should_insert:"yes"===t}))};wp.customize(e.id,(function(e){return e.bind((function(e){return t()}))})),e.watch.map((function(e){return wp.customize(e,(function(e){return e.bind((function(){return t()}))}))}))}({id:"mailchimp_single_post_enabled",strategy:"append",parent_selector:".content-area article",selector:".ct-mailchimp-block",fragment_id:"blocksy-mailchimp-subscribe",watch:["has_mailchimp_name","mailchimp_button_text","mailchimp_title","mailchimp_text","mailchimp_name_label","mailchimp_mail_label"],whenInserted:function(){if(document.body.classList.contains("single")||document.body.classList.contains("page")){var e=document.querySelector(".ct-mailchimp-block");f("mailchimp_subscribe_visibility",e),"yes"!==wp.customize("has_mailchimp_name")()?e.querySelector('[name="FNAME"]').remove():e.querySelector('[name="FNAME"]').setAttribute("placeholder","".concat(wp.customize("mailchimp_name_label")())),e.querySelector('[name="EMAIL"]').setAttribute("placeholder","".concat(wp.customize("mailchimp_mail_label")()," *")),e.querySelector("button").innerHTML=wp.customize("mailchimp_button_text")(),e.querySelector("h4").innerHTML=wp.customize("mailchimp_title")(),e.querySelector(".ct-mailchimp-description").innerHTML=wp.customize("mailchimp_text")()}}})}]);
|
framework/extensions/mailchimp/admin-static/js/ListPicker.js
CHANGED
@@ -11,7 +11,7 @@ const ListPicker = props => (
|
|
11 |
<Suspense
|
12 |
fallback={
|
13 |
<div className="ct-select-input">
|
14 |
-
<input disabled placeholder={__('Loading...')} />
|
15 |
</div>
|
16 |
}>
|
17 |
<ListPickerImplementation {...props} />
|
11 |
<Suspense
|
12 |
fallback={
|
13 |
<div className="ct-select-input">
|
14 |
+
<input disabled placeholder={__('Loading...', 'blc')} />
|
15 |
</div>
|
16 |
}>
|
17 |
<ListPickerImplementation {...props} />
|
framework/extensions/mailchimp/admin-static/js/ListPicker/Implementation.js
CHANGED
@@ -55,7 +55,9 @@ const ListPickerImplementation = ({ value, onChange }) => {
|
|
55 |
<input
|
56 |
disabled
|
57 |
placeholder={
|
58 |
-
isLoadingLists
|
|
|
|
|
59 |
}
|
60 |
/>
|
61 |
</div>
|
@@ -83,7 +85,7 @@ const ListPickerImplementation = ({ value, onChange }) => {
|
|
83 |
onFocus: () => openMenu(),
|
84 |
onClick: () => openMenu()
|
85 |
})}
|
86 |
-
placeholder={__('Select list...')}
|
87 |
readOnly
|
88 |
/>
|
89 |
|
55 |
<input
|
56 |
disabled
|
57 |
placeholder={
|
58 |
+
isLoadingLists
|
59 |
+
? __('Loading...', 'blc')
|
60 |
+
: __('Invalid API Key...', 'blc')
|
61 |
}
|
62 |
/>
|
63 |
</div>
|
85 |
onFocus: () => openMenu(),
|
86 |
onClick: () => openMenu()
|
87 |
})}
|
88 |
+
placeholder={__('Select list...', 'blc')}
|
89 |
readOnly
|
90 |
/>
|
91 |
|
framework/extensions/mailchimp/admin-static/js/main.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import './public-path'
|
2 |
import { createElement, Fragment, Component } from '@wordpress/element'
|
3 |
import ListPicker from './ListPicker'
|
|
|
4 |
|
5 |
document.addEventListener('DOMContentLoaded', () =>
|
6 |
ctEvents.on('blocksy:options:register', opts => {
|
1 |
import './public-path'
|
2 |
import { createElement, Fragment, Component } from '@wordpress/element'
|
3 |
import ListPicker from './ListPicker'
|
4 |
+
import ctEvents from 'ct-events'
|
5 |
|
6 |
document.addEventListener('DOMContentLoaded', () =>
|
7 |
ctEvents.on('blocksy:options:register', opts => {
|
framework/extensions/mailchimp/admin-static/js/sync.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import {
|
2 |
checkAndReplace,
|
3 |
responsiveClassesFor
|
4 |
-
} from '../../../
|
5 |
|
6 |
import './variables'
|
7 |
|
@@ -12,40 +12,67 @@ wp.customize('mailchimp_subscribe_visibility', val =>
|
|
12 |
})
|
13 |
)
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
if (wp.customize('has_mailchimp_name')() !== 'yes') {
|
36 |
block
|
37 |
-
.querySelector('[name="
|
38 |
-
.
|
39 |
-
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
-
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
})
|
|
1 |
import {
|
2 |
checkAndReplace,
|
3 |
responsiveClassesFor
|
4 |
+
} from '../../../cookies-consent/static/js/sync/helpers'
|
5 |
|
6 |
import './variables'
|
7 |
|
12 |
})
|
13 |
)
|
14 |
|
15 |
+
if (
|
16 |
+
document.body.classList.contains('single') ||
|
17 |
+
document.body.classList.contains('page')
|
18 |
+
) {
|
19 |
+
checkAndReplace({
|
20 |
+
id: 'mailchimp_single_post_enabled',
|
21 |
+
strategy: 'append',
|
22 |
|
23 |
+
parent_selector: '.content-area article',
|
24 |
+
selector: '.ct-mailchimp-block',
|
25 |
+
fragment_id: 'blocksy-mailchimp-subscribe',
|
26 |
|
27 |
+
watch: [
|
28 |
+
'has_mailchimp_name',
|
29 |
+
'mailchimp_button_text',
|
30 |
+
'mailchimp_title',
|
31 |
+
'mailchimp_text',
|
32 |
+
'mailchimp_name_label',
|
33 |
+
'mailchimp_mail_label'
|
34 |
+
],
|
35 |
|
36 |
+
whenInserted: () => {
|
37 |
+
if (
|
38 |
+
!document.body.classList.contains('single') &&
|
39 |
+
!document.body.classList.contains('page')
|
40 |
+
) {
|
41 |
+
return
|
42 |
+
}
|
43 |
+
const block = document.querySelector('.ct-mailchimp-block')
|
44 |
|
45 |
+
responsiveClassesFor('mailchimp_subscribe_visibility', block)
|
46 |
+
|
47 |
+
if (wp.customize('has_mailchimp_name')() !== 'yes') {
|
48 |
+
block.querySelector('[name="FNAME"]').remove()
|
49 |
+
} else {
|
50 |
+
block
|
51 |
+
.querySelector('[name="FNAME"]')
|
52 |
+
.setAttribute(
|
53 |
+
'placeholder',
|
54 |
+
`${wp.customize('mailchimp_name_label')()}`
|
55 |
+
)
|
56 |
+
}
|
57 |
|
|
|
58 |
block
|
59 |
+
.querySelector('[name="EMAIL"]')
|
60 |
+
.setAttribute(
|
61 |
+
'placeholder',
|
62 |
+
`${wp.customize('mailchimp_mail_label')()} *`
|
63 |
+
)
|
64 |
|
65 |
+
block.querySelector('button').innerHTML = wp.customize(
|
66 |
+
'mailchimp_button_text'
|
67 |
+
)()
|
68 |
|
69 |
+
block.querySelector('h4').innerHTML = wp.customize(
|
70 |
+
'mailchimp_title'
|
71 |
+
)()
|
72 |
|
73 |
+
block.querySelector(
|
74 |
+
'.ct-mailchimp-description'
|
75 |
+
).innerHTML = wp.customize('mailchimp_text')()
|
76 |
+
}
|
77 |
+
})
|
78 |
+
}
|
framework/extensions/mailchimp/admin-static/js/variables.js
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
import { handleVariablesFor } from 'customizer-sync-helpers'
|
2 |
|
3 |
handleVariablesFor({
|
4 |
-
|
5 |
-
mailchimpContent:
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
mailchimpButton: [
|
11 |
{
|
@@ -22,18 +31,22 @@ handleVariablesFor({
|
|
22 |
],
|
23 |
|
24 |
mailchimpBackground: {
|
|
|
25 |
variable: 'mailchimpBackground',
|
26 |
type: 'color'
|
27 |
},
|
28 |
|
29 |
mailchimpShadow: {
|
30 |
-
|
31 |
-
type: '
|
32 |
-
|
|
|
|
|
33 |
|
34 |
mailchimpSpacing: {
|
35 |
-
|
|
|
36 |
responsive: true,
|
37 |
unit: ''
|
38 |
}
|
39 |
-
})
|
1 |
import { handleVariablesFor } from 'customizer-sync-helpers'
|
2 |
|
3 |
handleVariablesFor({
|
4 |
+
|
5 |
+
mailchimpContent: [
|
6 |
+
{
|
7 |
+
selector: '.ct-mailchimp-block',
|
8 |
+
variable: 'color',
|
9 |
+
type: 'color:default'
|
10 |
+
},
|
11 |
+
|
12 |
+
{
|
13 |
+
selector: '.ct-mailchimp-block',
|
14 |
+
variable: 'linkHoverColor',
|
15 |
+
type: 'color:hover'
|
16 |
+
}
|
17 |
+
],
|
18 |
|
19 |
mailchimpButton: [
|
20 |
{
|
31 |
],
|
32 |
|
33 |
mailchimpBackground: {
|
34 |
+
selector: '.ct-mailchimp-block',
|
35 |
variable: 'mailchimpBackground',
|
36 |
type: 'color'
|
37 |
},
|
38 |
|
39 |
mailchimpShadow: {
|
40 |
+
selector: '.ct-mailchimp-block',
|
41 |
+
type: 'box-shadow',
|
42 |
+
variable: 'box-shadow',
|
43 |
+
responsive: true
|
44 |
+
},
|
45 |
|
46 |
mailchimpSpacing: {
|
47 |
+
selector: '.ct-mailchimp-block',
|
48 |
+
variable: 'padding',
|
49 |
responsive: true,
|
50 |
unit: ''
|
51 |
}
|
52 |
+
})
|
framework/extensions/mailchimp/config.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
$config = [
|
|
|
4 |
'description' => __('Display a Mailchimp subscribe form with the help of a widget or a block.', 'blc')
|
5 |
];
|
6 |
|
1 |
<?php
|
2 |
|
3 |
$config = [
|
4 |
+
'name' => __('Mailchimp', 'blc'),
|
5 |
'description' => __('Display a Mailchimp subscribe form with the help of a widget or a block.', 'blc')
|
6 |
];
|
7 |
|
framework/extensions/mailchimp/ct-mailchimp/options.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
|
10 |
|
11 |
$options = [
|
12 |
-
|
13 |
'title' => [
|
14 |
'type' => 'text',
|
15 |
'label' => __( 'Title', 'blc' ),
|
@@ -64,9 +63,33 @@ $options = [
|
|
64 |
'disableRevertButton' => true,
|
65 |
],
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
'mailchimp_button_text' => [
|
68 |
'type' => 'text',
|
69 |
-
'label' => __( 'Button
|
70 |
'design' => 'inline',
|
71 |
'value' => __( 'Subscribe', 'blc' ),
|
72 |
'disableRevertButton' => true,
|
@@ -77,6 +100,7 @@ $options = [
|
|
77 |
'label' => __( 'Content Alignment', 'blc' ),
|
78 |
'value' => 'center',
|
79 |
'view' => 'text',
|
|
|
80 |
'attr' => [ 'data-type' => 'alignment' ],
|
81 |
'disableRevertButton' => true,
|
82 |
'choices' => [
|
9 |
|
10 |
|
11 |
$options = [
|
|
|
12 |
'title' => [
|
13 |
'type' => 'text',
|
14 |
'label' => __( 'Title', 'blc' ),
|
63 |
'disableRevertButton' => true,
|
64 |
],
|
65 |
|
66 |
+
blocksy_rand_md5() => [
|
67 |
+
'type' => 'ct-condition',
|
68 |
+
'condition' => [ 'has_mailchimp_name' => 'yes' ],
|
69 |
+
'options' => [
|
70 |
+
|
71 |
+
'mailchimp_name_label' => [
|
72 |
+
'type' => 'text',
|
73 |
+
'label' => __( 'Name Label', 'blc' ),
|
74 |
+
'design' => 'inline',
|
75 |
+
'value' => __( 'Your name', 'blc' ),
|
76 |
+
'disableRevertButton' => true,
|
77 |
+
],
|
78 |
+
|
79 |
+
],
|
80 |
+
],
|
81 |
+
|
82 |
+
'mailchimp_mail_label' => [
|
83 |
+
'type' => 'text',
|
84 |
+
'label' => __( 'Mail Label', 'blc' ),
|
85 |
+
'design' => 'inline',
|
86 |
+
'value' => __( 'Your email', 'blc' ),
|
87 |
+
'disableRevertButton' => true,
|
88 |
+
],
|
89 |
+
|
90 |
'mailchimp_button_text' => [
|
91 |
'type' => 'text',
|
92 |
+
'label' => __( 'Button Label', 'blc' ),
|
93 |
'design' => 'inline',
|
94 |
'value' => __( 'Subscribe', 'blc' ),
|
95 |
'disableRevertButton' => true,
|
100 |
'label' => __( 'Content Alignment', 'blc' ),
|
101 |
'value' => 'center',
|
102 |
'view' => 'text',
|
103 |
+
'design' => 'inline',
|
104 |
'attr' => [ 'data-type' => 'alignment' ],
|
105 |
'disableRevertButton' => true,
|
106 |
'choices' => [
|
framework/extensions/mailchimp/ct-mailchimp/view.php
CHANGED
@@ -30,19 +30,31 @@ if (blocksy_default_akg( 'mailchimp_list_id_source', $atts, 'default' ) === 'cus
|
|
30 |
$manager = new BlocksyMailchimpManager();
|
31 |
|
32 |
// Button value
|
33 |
-
$
|
34 |
|
35 |
-
if (! $
|
36 |
return;
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
// Content alignment
|
40 |
$alignment = blocksy_default_akg( 'mailchimp_alignment', $atts, 'center' );
|
41 |
|
|
|
|
|
|
|
42 |
$data_alignment = '';
|
43 |
|
44 |
if ( $alignment !== 'left' ) {
|
45 |
-
$data_alignment = 'data-alignment=' . $alignment;
|
46 |
}
|
47 |
|
48 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
@@ -56,7 +68,7 @@ echo $before_title . wp_kses_post( $title ) . $after_title;
|
|
56 |
?>
|
57 |
|
58 |
|
59 |
-
<form action="<?php echo esc_attr($form_url) ?>" method="post" class="ct-mailchimp-form"
|
60 |
|
61 |
<?php if( !empty( $message ) ) { ?>
|
62 |
<div class="ct-mailchimp-description">
|
@@ -64,23 +76,23 @@ echo $before_title . wp_kses_post( $title ) . $after_title;
|
|
64 |
</div>
|
65 |
<?php } ?>
|
66 |
|
67 |
-
|
68 |
-
<?php
|
69 |
-
|
70 |
-
|
|
|
71 |
|
72 |
-
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
<?php echo esc_html($button_text) ?>
|
76 |
-
</button>
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
</div>
|
84 |
</form>
|
85 |
|
86 |
</div>
|
30 |
$manager = new BlocksyMailchimpManager();
|
31 |
|
32 |
// Button value
|
33 |
+
$mailchimp_data = $manager->get_form_url_and_gdpr_for($list_id);
|
34 |
|
35 |
+
if (! $mailchimp_data) {
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
+
$form_url = $mailchimp_data['form_url'];
|
40 |
+
$has_gdpr_fields = $mailchimp_data['has_gdpr_fields'];
|
41 |
+
|
42 |
+
$skip_submit_output = '';
|
43 |
+
|
44 |
+
if ($has_gdpr_fields) {
|
45 |
+
$skip_submit_output = 'data-skip-submit';
|
46 |
+
}
|
47 |
+
|
48 |
// Content alignment
|
49 |
$alignment = blocksy_default_akg( 'mailchimp_alignment', $atts, 'center' );
|
50 |
|
51 |
+
$name_label = blocksy_default_akg('mailchimp_name_label', $atts, __( 'Your name', 'blc' ));
|
52 |
+
$email_label = blocksy_default_akg('mailchimp_mail_label', $atts, __( 'Your email', 'blc' ));
|
53 |
+
|
54 |
$data_alignment = '';
|
55 |
|
56 |
if ( $alignment !== 'left' ) {
|
57 |
+
$data_alignment = ' data-alignment=' . $alignment;
|
58 |
}
|
59 |
|
60 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
68 |
?>
|
69 |
|
70 |
|
71 |
+
<form action="<?php echo esc_attr($form_url) ?>" method="post" class="ct-mailchimp-widget-form" target="_blank" <?php echo $skip_submit_output ?>>
|
72 |
|
73 |
<?php if( !empty( $message ) ) { ?>
|
74 |
<div class="ct-mailchimp-description">
|
76 |
</div>
|
77 |
<?php } ?>
|
78 |
|
79 |
+
<?php if ( $has_name ) { ?>
|
80 |
+
<input type="text" name="FNAME" placeholder="<?php esc_attr_e($name_label, 'blc'); ?>" title="<?php echo __('Name', 'blocksy') ?>" />
|
81 |
+
<?php } ?>
|
82 |
+
|
83 |
+
<input type="email" name="EMAIL" placeholder="<?php esc_attr_e($email_label, 'blc'); ?> *" title="<?php echo __('Email', 'blocksy') ?>" required />
|
84 |
|
85 |
+
<button class="button">
|
86 |
+
<?php echo esc_html($button_text) ?>
|
87 |
+
</button>
|
88 |
|
89 |
+
<div class="ct-mailchimp-message"></div>
|
|
|
|
|
90 |
|
91 |
+
<?php
|
92 |
+
if (function_exists('blocksy_ext_cookies_checkbox')) {
|
93 |
+
echo blocksy_ext_cookies_checkbox('mailchimp');
|
94 |
+
}
|
95 |
+
?>
|
|
|
96 |
</form>
|
97 |
|
98 |
</div>
|
framework/extensions/mailchimp/customizer.php
CHANGED
@@ -9,7 +9,7 @@ $options = [
|
|
9 |
'inner-options' => [
|
10 |
|
11 |
blocksy_rand_md5() => [
|
12 |
-
'title' => __( 'General', '
|
13 |
'type' => 'tab',
|
14 |
'options' => [
|
15 |
|
@@ -70,6 +70,11 @@ $options = [
|
|
70 |
],
|
71 |
],
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
'has_mailchimp_name' => [
|
74 |
'type' => 'ct-switch',
|
75 |
'label' => __( 'Name Field', 'blc' ),
|
@@ -78,10 +83,36 @@ $options = [
|
|
78 |
'setting' => [ 'transport' => 'postMessage' ],
|
79 |
],
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
'mailchimp_button_text' => [
|
82 |
'type' => 'text',
|
83 |
-
'label' => __( 'Button
|
84 |
-
'design' => '
|
85 |
'value' => __( 'Subscribe', 'blc' ),
|
86 |
'disableRevertButton' => true,
|
87 |
'setting' => [ 'transport' => 'postMessage' ],
|
@@ -89,11 +120,10 @@ $options = [
|
|
89 |
|
90 |
blocksy_rand_md5() => [
|
91 |
'type' => 'ct-divider',
|
92 |
-
'attr' => [ 'data-type' => 'small' ],
|
93 |
],
|
94 |
|
95 |
'mailchimp_subscribe_visibility' => [
|
96 |
-
'label' => __( 'Visibility', '
|
97 |
'type' => 'ct-visibility',
|
98 |
'design' => 'block',
|
99 |
'setting' => [ 'transport' => 'postMessage' ],
|
@@ -104,9 +134,9 @@ $options = [
|
|
104 |
],
|
105 |
|
106 |
'choices' => blocksy_ordered_keys([
|
107 |
-
'desktop' => __( 'Desktop', '
|
108 |
-
'tablet' => __( 'Tablet', '
|
109 |
-
'mobile' => __( 'Mobile', '
|
110 |
]),
|
111 |
],
|
112 |
|
@@ -114,32 +144,43 @@ $options = [
|
|
114 |
],
|
115 |
|
116 |
blocksy_rand_md5() => [
|
117 |
-
'title' => __( 'Design', '
|
118 |
'type' => 'tab',
|
119 |
'options' => [
|
120 |
|
121 |
'mailchimpContent' => [
|
122 |
-
'label' => __( 'Content Color', '
|
123 |
'type' => 'ct-color-picker',
|
124 |
'design' => 'inline',
|
125 |
'setting' => [ 'transport' => 'postMessage' ],
|
126 |
|
127 |
'value' => [
|
128 |
'default' => [
|
129 |
-
'color' => '
|
|
|
|
|
|
|
|
|
130 |
],
|
131 |
],
|
132 |
|
133 |
'pickers' => [
|
134 |
[
|
135 |
-
'title' => __( 'Initial', '
|
136 |
'id' => 'default',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
],
|
138 |
],
|
139 |
],
|
140 |
|
141 |
'mailchimpButton' => [
|
142 |
-
'label' => __( 'Button Color', '
|
143 |
'type' => 'ct-color-picker',
|
144 |
'design' => 'inline',
|
145 |
'setting' => [ 'transport' => 'postMessage' ],
|
@@ -156,64 +197,39 @@ $options = [
|
|
156 |
|
157 |
'pickers' => [
|
158 |
[
|
159 |
-
'title' => __( 'Initial', '
|
160 |
'id' => 'default',
|
161 |
],
|
162 |
|
163 |
[
|
164 |
-
'title' => __( 'Hover', '
|
165 |
'id' => 'hover',
|
166 |
],
|
167 |
],
|
168 |
],
|
169 |
|
170 |
'mailchimpBackground' => [
|
171 |
-
'label' => __( 'Background Color', '
|
172 |
'type' => 'ct-color-picker',
|
173 |
'design' => 'inline',
|
174 |
'setting' => [ 'transport' => 'postMessage' ],
|
175 |
|
176 |
'value' => [
|
177 |
'default' => [
|
178 |
-
'color' =>
|
179 |
],
|
180 |
],
|
181 |
|
182 |
'pickers' => [
|
183 |
[
|
184 |
-
'title' => __( 'Initial', '
|
185 |
'id' => 'default',
|
186 |
],
|
187 |
],
|
188 |
],
|
189 |
|
190 |
-
'mailchimpShadow' => [
|
191 |
-
'label' => __( 'Shadow Color', 'blocksy' ),
|
192 |
-
'type' => 'ct-color-picker',
|
193 |
-
'design' => 'inline',
|
194 |
-
'setting' => [ 'transport' => 'postMessage' ],
|
195 |
-
|
196 |
-
'value' => [
|
197 |
-
'default' => [
|
198 |
-
'color' => 'rgba(210, 213, 218, 0.4)',
|
199 |
-
],
|
200 |
-
],
|
201 |
-
|
202 |
-
'pickers' => [
|
203 |
-
[
|
204 |
-
'title' => __( 'Initial', 'blocksy' ),
|
205 |
-
'id' => 'default',
|
206 |
-
],
|
207 |
-
],
|
208 |
-
],
|
209 |
-
|
210 |
-
blocksy_rand_md5() => [
|
211 |
-
'type' => 'ct-divider',
|
212 |
-
'attr' => [ 'data-type' => 'small' ],
|
213 |
-
],
|
214 |
-
|
215 |
'mailchimpSpacing' => [
|
216 |
-
'label' => __( 'Container Inner Spacing', '
|
217 |
'type' => 'ct-slider',
|
218 |
'value' => '40px',
|
219 |
'units' => blocksy_units_config([
|
@@ -224,11 +240,31 @@ $options = [
|
|
224 |
],
|
225 |
]),
|
226 |
'responsive' => true,
|
|
|
227 |
'setting' => [ 'transport' => 'postMessage' ],
|
228 |
],
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
],
|
231 |
],
|
232 |
|
233 |
],
|
234 |
-
];
|
9 |
'inner-options' => [
|
10 |
|
11 |
blocksy_rand_md5() => [
|
12 |
+
'title' => __( 'General', 'blc' ),
|
13 |
'type' => 'tab',
|
14 |
'options' => [
|
15 |
|
70 |
],
|
71 |
],
|
72 |
|
73 |
+
blocksy_rand_md5() => [
|
74 |
+
'type' => 'ct-divider',
|
75 |
+
'attr' => [ 'data-type' => 'small' ],
|
76 |
+
],
|
77 |
+
|
78 |
'has_mailchimp_name' => [
|
79 |
'type' => 'ct-switch',
|
80 |
'label' => __( 'Name Field', 'blc' ),
|
83 |
'setting' => [ 'transport' => 'postMessage' ],
|
84 |
],
|
85 |
|
86 |
+
blocksy_rand_md5() => [
|
87 |
+
'type' => 'ct-condition',
|
88 |
+
'condition' => [ 'has_mailchimp_name' => 'yes' ],
|
89 |
+
'options' => [
|
90 |
+
|
91 |
+
'mailchimp_name_label' => [
|
92 |
+
'type' => 'text',
|
93 |
+
'label' => __( 'Name Label', 'blc' ),
|
94 |
+
'design' => 'inline',
|
95 |
+
'value' => __( 'Your name', 'blc' ),
|
96 |
+
'disableRevertButton' => true,
|
97 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
98 |
+
],
|
99 |
+
|
100 |
+
],
|
101 |
+
],
|
102 |
+
|
103 |
+
'mailchimp_mail_label' => [
|
104 |
+
'type' => 'text',
|
105 |
+
'label' => __( 'Mail Label', 'blc' ),
|
106 |
+
'design' => 'inline',
|
107 |
+
'value' => __( 'Your email', 'blc' ),
|
108 |
+
'disableRevertButton' => true,
|
109 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
110 |
+
],
|
111 |
+
|
112 |
'mailchimp_button_text' => [
|
113 |
'type' => 'text',
|
114 |
+
'label' => __( 'Button Label', 'blc' ),
|
115 |
+
'design' => 'inline',
|
116 |
'value' => __( 'Subscribe', 'blc' ),
|
117 |
'disableRevertButton' => true,
|
118 |
'setting' => [ 'transport' => 'postMessage' ],
|
120 |
|
121 |
blocksy_rand_md5() => [
|
122 |
'type' => 'ct-divider',
|
|
|
123 |
],
|
124 |
|
125 |
'mailchimp_subscribe_visibility' => [
|
126 |
+
'label' => __( 'Visibility', 'blc' ),
|
127 |
'type' => 'ct-visibility',
|
128 |
'design' => 'block',
|
129 |
'setting' => [ 'transport' => 'postMessage' ],
|
134 |
],
|
135 |
|
136 |
'choices' => blocksy_ordered_keys([
|
137 |
+
'desktop' => __( 'Desktop', 'blc' ),
|
138 |
+
'tablet' => __( 'Tablet', 'blc' ),
|
139 |
+
'mobile' => __( 'Mobile', 'blc' ),
|
140 |
]),
|
141 |
],
|
142 |
|
144 |
],
|
145 |
|
146 |
blocksy_rand_md5() => [
|
147 |
+
'title' => __( 'Design', 'blc' ),
|
148 |
'type' => 'tab',
|
149 |
'options' => [
|
150 |
|
151 |
'mailchimpContent' => [
|
152 |
+
'label' => __( 'Content Color', 'blc' ),
|
153 |
'type' => 'ct-color-picker',
|
154 |
'design' => 'inline',
|
155 |
'setting' => [ 'transport' => 'postMessage' ],
|
156 |
|
157 |
'value' => [
|
158 |
'default' => [
|
159 |
+
'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT'),
|
160 |
+
],
|
161 |
+
|
162 |
+
'hover' => [
|
163 |
+
'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT'),
|
164 |
],
|
165 |
],
|
166 |
|
167 |
'pickers' => [
|
168 |
[
|
169 |
+
'title' => __( 'Initial', 'blc' ),
|
170 |
'id' => 'default',
|
171 |
+
'inherit' => 'var(--color)'
|
172 |
+
],
|
173 |
+
|
174 |
+
[
|
175 |
+
'title' => __( 'Hover', 'blc' ),
|
176 |
+
'id' => 'hover',
|
177 |
+
'inherit' => 'var(--linkHoverColor)'
|
178 |
],
|
179 |
],
|
180 |
],
|
181 |
|
182 |
'mailchimpButton' => [
|
183 |
+
'label' => __( 'Button Color', 'blc' ),
|
184 |
'type' => 'ct-color-picker',
|
185 |
'design' => 'inline',
|
186 |
'setting' => [ 'transport' => 'postMessage' ],
|
197 |
|
198 |
'pickers' => [
|
199 |
[
|
200 |
+
'title' => __( 'Initial', 'blc' ),
|
201 |
'id' => 'default',
|
202 |
],
|
203 |
|
204 |
[
|
205 |
+
'title' => __( 'Hover', 'blc' ),
|
206 |
'id' => 'hover',
|
207 |
],
|
208 |
],
|
209 |
],
|
210 |
|
211 |
'mailchimpBackground' => [
|
212 |
+
'label' => __( 'Background Color', 'blc' ),
|
213 |
'type' => 'ct-color-picker',
|
214 |
'design' => 'inline',
|
215 |
'setting' => [ 'transport' => 'postMessage' ],
|
216 |
|
217 |
'value' => [
|
218 |
'default' => [
|
219 |
+
'color' => '#ffffff',
|
220 |
],
|
221 |
],
|
222 |
|
223 |
'pickers' => [
|
224 |
[
|
225 |
+
'title' => __( 'Initial', 'blc' ),
|
226 |
'id' => 'default',
|
227 |
],
|
228 |
],
|
229 |
],
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
'mailchimpSpacing' => [
|
232 |
+
'label' => __( 'Container Inner Spacing', 'blc' ),
|
233 |
'type' => 'ct-slider',
|
234 |
'value' => '40px',
|
235 |
'units' => blocksy_units_config([
|
240 |
],
|
241 |
]),
|
242 |
'responsive' => true,
|
243 |
+
'divider' => 'top',
|
244 |
'setting' => [ 'transport' => 'postMessage' ],
|
245 |
],
|
246 |
|
247 |
+
'mailchimpShadow' => [
|
248 |
+
'label' => __( 'Shadow', 'blocksy' ),
|
249 |
+
'type' => 'ct-box-shadow',
|
250 |
+
'responsive' => true,
|
251 |
+
'divider' => 'top',
|
252 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
253 |
+
'value' => blocksy_box_shadow_value([
|
254 |
+
'enable' => true,
|
255 |
+
'h_offset' => 0,
|
256 |
+
'v_offset' => 50,
|
257 |
+
'blur' => 90,
|
258 |
+
'spread' => 0,
|
259 |
+
'inset' => false,
|
260 |
+
'color' => [
|
261 |
+
'color' => 'rgba(210, 213, 218, 0.4)',
|
262 |
+
],
|
263 |
+
])
|
264 |
+
],
|
265 |
+
|
266 |
],
|
267 |
],
|
268 |
|
269 |
],
|
270 |
+
];
|
framework/extensions/mailchimp/dashboard-static/bundle/main.js
CHANGED
@@ -1,20 +1,14 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/
|
7 |
-
|
8 |
-
Copyright (c) 2017 Jed Watson.
|
9 |
-
Licensed under the MIT License (MIT), see
|
10 |
-
http://jedwatson.github.io/classnames
|
11 |
-
*/
|
12 |
-
!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===i)for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(6)),i=r(n(4)),a=r(n(1)),s=r(n(12));let u=void 0,l=void 0,c=[],d=e=>"undefined"!=typeof window&&window.requestAnimationFrame(e),p=e=>"undefined"!=typeof window&&window.cancelAnimationFrame(e),f=void 0,h=()=>Date.now(),m=void 0,g=void 0;const v=(e,t)=>l={fn:e,transform:t},y=e=>c=e,b=e=>u=e,w=e=>f=e,x=e=>m=e,O=e=>g=e;var S=Object.freeze({get bugfixes(){return u},get applyAnimatedValues(){return l},get colorNames(){return c},get requestFrame(){return d},get cancelFrame(){return p},get interpolation(){return f},get now(){return h},get defaultElement(){return m},get createAnimatedStyle(){return g},injectApplyAnimatedValues:v,injectColorNames:y,injectBugfixes:b,injectInterpolation:w,injectFrame:(e,t)=>{var n=[e,t];return d=n[0],p=n[1],n},injectNow:e=>h=e,injectDefaultElement:x,injectCreateAnimatedStyle:O});class E{attach(){}detach(){}getValue(){}getAnimatedValue(){return this.getValue()}addChild(e){}removeChild(e){}getChildren(){return[]}}const I=e=>Object.keys(e).map(t=>e[t]);class C extends E{constructor(){var e;super(...arguments),e=this,this.children=[],this.getChildren=(()=>this.children),this.getPayload=function(t){return void 0===t&&(t=void 0),void 0!==t&&e.payload?e.payload[t]:e.payload||e}}addChild(e){0===this.children.length&&this.attach(),this.children.push(e)}removeChild(e){const t=this.children.indexOf(e);this.children.splice(t,1),0===this.children.length&&this.detach()}}class A extends C{constructor(){super(...arguments),this.payload=[],this.getAnimatedValue=(()=>this.getValue()),this.attach=(()=>this.payload.forEach(e=>e instanceof E&&e.addChild(this))),this.detach=(()=>this.payload.forEach(e=>e instanceof E&&e.removeChild(this)))}}class j extends C{constructor(){super(...arguments),this.payload={},this.getAnimatedValue=(()=>this.getValue(!0)),this.attach=(()=>I(this.payload).forEach(e=>e instanceof E&&e.addChild(this))),this.detach=(()=>I(this.payload).forEach(e=>e instanceof E&&e.removeChild(this)))}getValue(e){void 0===e&&(e=!1);const t={};for(const n in this.payload){const r=this.payload[n];(!e||r instanceof E)&&(t[n]=r instanceof E?r[e?"getAnimatedValue":"getValue"]():r)}return t}}class k extends j{constructor(e){super(),!(e=e||{}).transform||e.transform instanceof E||(e=l.transform(e)),this.payload=e}}const P={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};class _{static create(e,t,n){if("function"==typeof e)return e;if(f&&e.output&&"string"==typeof e.output[0])return f(e);if(Array.isArray(e))return _.create({range:e,output:t,extrapolate:n||"extend"});let r=e.output,o=e.range||[0,1],i=e.easing||(e=>e),a="extend",s=e.map;void 0!==e.extrapolateLeft?a=e.extrapolateLeft:void 0!==e.extrapolate&&(a=e.extrapolate);let u="extend";return void 0!==e.extrapolateRight?u=e.extrapolateRight:void 0!==e.extrapolate&&(u=e.extrapolate),e=>{let t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,o);return function(e,t,n,r,o,i,a,s,u){let l=u?u(e):e;if(l<t){if("identity"===a)return l;"clamp"===a&&(l=t)}if(l>n){if("identity"===s)return l;"clamp"===s&&(l=n)}if(r===o)return r;if(t===n)return e<=t?r:o;t===-1/0?l=-l:n===1/0?l-=t:l=(l-t)/(n-t);l=i(l),r===-1/0?l=-l:o===1/0?l+=r:l=l*(o-r)+r;return l}(e,o[t],o[t+1],r[t],r[t+1],i,a,u,s)}}}const T="[-+]?\\d*\\.?\\d+",M=T+"%";function R(){return"\\(\\s*("+Array.prototype.slice.call(arguments).join(")\\s*,\\s*(")+")\\s*\\)"}const D=new RegExp("rgb"+R(T,T,T)),U=new RegExp("rgba"+R(T,T,T,T)),F=new RegExp("hsl"+R(T,M,M)),V=new RegExp("hsla"+R(T,M,M,T)),L=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,H=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,N=/^#([0-9a-fA-F]{6})$/,B=/^#([0-9a-fA-F]{8})$/;function K(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function W(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=K(o,r,e+1/3),a=K(o,r,e),s=K(o,r,e-1/3);return Math.round(255*i)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}function q(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function $(e){return(parseFloat(e)%360+360)%360/360}function z(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function G(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function Y(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=N.exec(e))?parseInt(t[1]+"ff",16)>>>0:P.hasOwnProperty(e)?P[e]:(t=D.exec(e))?(q(t[1])<<24|q(t[2])<<16|q(t[3])<<8|255)>>>0:(t=U.exec(e))?(q(t[1])<<24|q(t[2])<<16|q(t[3])<<8|z(t[4]))>>>0:(t=L.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=B.exec(e))?parseInt(t[1],16)>>>0:(t=H.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=F.exec(e))?(255|W($(t[1]),G(t[2]),G(t[3])))>>>0:(t=V.exec(e))?(W($(t[1]),G(t[2]),G(t[3]))|z(t[4]))>>>0:null}(e);return null===t?e:`rgba(${(4278190080&(t=t||0))>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`}const Q=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,J=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,X=new RegExp(`(${Object.keys(P).join("|")})`,"g");class Z extends A{constructor(e,t,n){super(),this.getValue=(()=>this.calc(...this.payload.map(e=>e.getValue()))),this.updateConfig=((e,t)=>this.calc=_.create(e,t)),this.interpolate=((e,t)=>new Z(this,e,t)),this.payload=e instanceof A&&!e.updateConfig?e.payload:Array.isArray(e)?e:[e],this.calc=_.create(t,n)}}class ee extends C{constructor(e){var t;super(),t=this,this.setValue=function(e,n){void 0===n&&(n=!0),t.value=e,n&&t.flush()},this.getValue=(()=>this.value),this.updateStyles=(()=>(function e(t,n){"function"==typeof t.update?n.add(t):t.getChildren().forEach(t=>e(t,n))})(this,this.animatedStyles)),this.updateValue=(e=>this.flush(this.value=e)),this.interpolate=((e,t)=>new Z(this,e,t)),this.value=e,this.animatedStyles=new Set,this.done=!1,this.startPosition=e,this.lastPosition=e,this.lastVelocity=void 0,this.lastTime=void 0,this.controller=void 0}flush(){0===this.animatedStyles.size&&this.updateStyles(),this.animatedStyles.forEach(e=>e.update())}prepare(e){void 0===this.controller&&(this.controller=e),this.controller===e&&(this.startPosition=this.value,this.lastPosition=this.value,this.lastVelocity=e.isActive?this.lastVelocity:void 0,this.lastTime=e.isActive?this.lastTime:void 0,this.done=!1,this.animatedStyles.clear())}}class te extends A{constructor(e){var t;super(),t=this,this.setValue=function(e,n){void 0===n&&(n=!0),Array.isArray(e)?e.length===t.payload.length&&e.forEach((e,r)=>t.payload[r].setValue(e,n)):t.payload.forEach((r,o)=>t.payload[o].setValue(e,n))},this.getValue=(()=>this.payload.map(e=>e.getValue())),this.interpolate=((e,t)=>new Z(this,e,t)),this.payload=e.map(e=>new ee(e))}}function ne(e,t){return null==e?t:e}function re(e){return void 0!==e?Array.isArray(e)?e:[e]:[]}function oe(e,t){if(typeof e!=typeof t)return!1;if("string"==typeof e||"number"==typeof e)return e===t;let n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return void 0!==n||e===t}function ie(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e(...n):e}function ae(e){return Object.keys(e).map(t=>e[t])}function se(e){const t=function(e){return e.to,e.from,e.config,e.native,e.onStart,e.onRest,e.onFrame,e.children,e.reset,e.reverse,e.force,e.immediate,e.impl,e.inject,e.delay,e.attach,e.destroyed,e.interpolateTo,e.autoStart,e.ref,o(e,["to","from","config","native","onStart","onRest","onFrame","children","reset","reverse","force","immediate","impl","inject","delay","attach","destroyed","interpolateTo","autoStart","ref"])}(e),n=Object.keys(e).reduce((n,r)=>void 0!==t[r]?n:i({},n,{[r]:e[r]}),{});return i({to:t},n)}function ue(e,t){let n=t[0],r=t[1];return i({},e,{[n]:new(Array.isArray(r)?te:ee)(r)})}function le(e){const t=e.from,n=e.to,r=e.native,o=Object.entries(i({},t,n));return r?o.reduce(ue,{}):i({},t,n)}function ce(e,t){return t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e}const de=e=>"auto"===e,pe=(e,t)=>(n,r)=>{let o=r[0],a=r[1];return i({},n,{[o]:"auto"===a?~o.indexOf("height")?t:e:a})};let fe={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0};const he=["Webkit","Ms","Moz","O"];function me(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}fe=Object.keys(fe).reduce((e,t)=>(he.forEach(n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t]),e),fe);const ge={};O(e=>new k(e)),x("div"),w(function(e){const t=e.output.map(e=>e.replace(J,Y)).map(e=>e.replace(X,Y)),n=t[0].match(Q).map(()=>[]);t.forEach(e=>{e.match(Q).forEach((e,t)=>n[t].push(+e))});const r=t[0].match(Q).map((t,r)=>_.create(i({},e,{output:n[r]})));return e=>{let n=0;return t[0].replace(Q,()=>r[n++](e)).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(e,t,n,r,o)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`)}}),y(P),b(function(e,t){const n=e.from,r=e.to,o=e.children;if(!ae(r).some(de)&&!ae(n).some(de))return;let u=o(le(e));if(!u)return;Array.isArray(u)&&(u={type:"div",props:{children:u}});const l=u.props.style;return a.createElement(u.type,i({key:u.key?u.key:void 0},u.props,{style:i({},l,{position:"absolute",visibility:"hidden"}),ref:o=>{if(o){let a,u,l=s.findDOMNode(o),c=getComputedStyle(l);if("border-box"===c.boxSizing)a=l.offsetWidth,u=l.offsetHeight;else{const e=parseFloat(c.paddingLeft||0)+parseFloat(c.paddingRight||0),t=parseFloat(c.paddingTop||0)+parseFloat(c.paddingBottom||0),n=parseFloat(c.borderLeftWidth||0)+parseFloat(c.borderRightWidth||0),r=parseFloat(c.borderTopWidth||0)+parseFloat(c.borderBottomWidth||0);a=l.offsetWidth-e-n,u=l.offsetHeight-t-r}const d=pe(a,u);t(i({},e,{from:Object.entries(n).reduce(d,n),to:Object.entries(r).reduce(d,r)}))}}}))}),v((e,t)=>{if(!e.nodeType||void 0===e.setAttribute)return!1;{const i=t.style,a=t.children,s=t.scrollTop,u=t.scrollLeft,l=o(t,["style","children","scrollTop","scrollLeft"]);void 0!==s&&(e.scrollTop=s),void 0!==u&&(e.scrollLeft=u),void 0!==a&&(e.textContent=a);for(let t in i)if(i.hasOwnProperty(t)){var n=0===t.indexOf("--"),r=me(t,i[t],n);"float"===t&&(t="cssFloat"),n?e.style.setProperty(t,r):e.style[t]=r}for(let t in l){const n=ge[t]||(ge[t]=t.replace(/([A-Z])/g,e=>"-"+e.toLowerCase()));void 0!==e.getAttribute(n)&&e.setAttribute(n,l[t])}}},e=>e);let ve=!1;const ye=new Set,be=()=>{let e=h();for(let t of ye){let n=!0,r=!0;for(let o=0;o<t.configs.length;o++){let i,a,s=t.configs[o];for(let o=0;o<s.animatedValues.length;o++){let u=s.animatedValues[o];if(u.done)continue;let l=s.fromValues[o],c=s.toValues[o],d=u.lastPosition,p=c instanceof E,f=Array.isArray(s.initialVelocity)?s.initialVelocity[o]:s.initialVelocity;if(p&&(c=c.getValue()),s.immediate||!p&&!s.decay&&l===c)u.updateValue(c),u.done=!0;else if(s.delay&&e-t.startTime<s.delay)n=!1;else if(r=!1,"string"!=typeof l&&"string"!=typeof c){if(void 0!==s.duration)d=l+s.easing((e-t.startTime-s.delay)/s.duration)*(c-l),i=e>=t.startTime+s.delay+s.duration;else if(s.decay)d=l+f/(1-.998)*(1-Math.exp(-(1-.998)*(e-t.startTime))),(i=Math.abs(u.lastPosition-d)<.1)&&(c=d);else{a=void 0!==u.lastTime?u.lastTime:e,f=void 0!==u.lastVelocity?u.lastVelocity:s.initialVelocity,e>a+64&&(a=e);let t=Math.floor(e-a);for(let e=0;e<t;++e){d+=1*(f+=1*((-s.tension*(d-c)+-s.friction*f)/s.mass)/1e3)/1e3}let n=!(!s.clamp||0===s.tension)&&(l<c?d>c:d<c),r=Math.abs(f)<=s.precision,o=0===s.tension||Math.abs(c-d)<=s.precision;i=n||r&&o,u.lastVelocity=f,u.lastTime=e}p&&!s.toValues[o].done&&(i=!1),i?(u.value!==c&&(d=c),u.done=!0):n=!1,u.updateValue(d),u.lastPosition=d}else u.updateValue(c),u.done=!0}!t.props.onFrame&&t.props.native||(t.animatedProps[s.name]=s.interpolation.getValue())}!t.props.onFrame&&t.props.native||(!t.props.native&&t.onUpdate&&t.onUpdate(),t.props.onFrame&&t.props.onFrame(t.animatedProps)),n&&(ye.delete(t),t.debouncedOnEnd({finished:!0,noChange:r}))}ye.size?d(be):ve=!1},we=e=>{ye.has(e)||(ye.add(e),ve||d(be),ve=!0)},xe=e=>{ye.has(e)&&ye.delete(e)};class Oe{constructor(e,t){void 0===t&&(t={native:!0,interpolateTo:!0,autoStart:!0}),this.getValues=(()=>this.props.native?this.interpolations:this.animatedProps),this.dependents=new Set,this.isActive=!1,this.hasChanged=!1,this.props={},this.merged={},this.animations={},this.interpolations={},this.animatedProps={},this.configs=[],this.frame=void 0,this.startTime=void 0,this.lastTime=void 0,this.update(i({},e,t))}update(e){this.props=i({},this.props,e);let t=this.props.interpolateTo?se(this.props):this.props,n=t.from,r=void 0===n?{}:n,o=t.to,a=void 0===o?{}:o,s=t.config,u=void 0===s?{}:s,l=t.delay,d=void 0===l?0:l,p=t.reverse,f=t.attach,h=t.reset,m=t.immediate,g=t.autoStart,v=t.ref;if(p){var y=[a,r];r=y[0],a=y[1]}this.hasChanged=!1;let b=f&&f(this),w=h?{}:this.merged;if(this.merged=i({},r,w,a),this.animations=Object.entries(this.merged).reduce((e,t,n)=>{let o=t[0],a=t[1],s=!h&&e[o]||{};const l="number"==typeof a,p="string"==typeof a&&!a.startsWith("#")&&!/\d/.test(a)&&!c[a],f=!l&&!p&&Array.isArray(a);let g=void 0!==r[o]?r[o]:a,v=l||f?a:p?a:1,y=ie(u,o);if(b&&(v=b.animations[o].parent),void 0===y.decay&&oe(s.changes,a))return e;{let t,n;if(this.hasChanged=!0,l||p)t=n=s.parent||new ee(g);else if(f)t=n=s.parent||new te(g);else{const e=s.interpolation&&s.interpolation.calc(s.parent.value);s.parent?(t=s.parent).setValue(0,!1):t=new ee(0);const r={output:[void 0!==e?e:g,a]};s.interpolation?(n=s.interpolation,s.interpolation.updateConfig(r)):n=t.interpolate(r)}ie(m,o)&&t.setValue(a,!1);const r=re(t.getPayload());return r.forEach(e=>e.prepare(this)),i({},e,{[o]:i({},s,{name:o,parent:t,interpolation:n,animatedValues:r,changes:a,fromValues:re(t.getValue()),toValues:re(b?v.getPayload():v),immediate:ie(m,o),delay:ne(y.delay,d||0),initialVelocity:ne(y.velocity,0),clamp:ne(y.clamp,!1),precision:ne(y.precision,.01),tension:ne(y.tension,170),friction:ne(y.friction,26),mass:ne(y.mass,1),duration:y.duration,easing:ne(y.easing,e=>e),decay:y.decay})})}},this.animations),this.hasChanged){this.configs=ae(this.animations),this.animatedProps={},this.interpolations={};for(let e in this.animations)this.interpolations[e]=this.animations[e].interpolation,this.animatedProps[e]=this.animations[e].interpolation.getValue()}for(var x=arguments.length,O=new Array(x>1?x-1:0),S=1;S<x;S++)O[S-1]=arguments[S];v||!g&&!O.length||this.start(...O);const E=O[0],I=O[1];return this.onEnd="function"==typeof E&&E,this.onUpdate=I,this.getValues()}start(e,t){return this.startTime=h(),this.isActive&&this.stop(),this.isActive=!0,this.onEnd="function"==typeof e&&e,this.onUpdate=t,this.props.onStart&&this.props.onStart(),we(this),new Promise(e=>this.resolve=e)}stop(e){void 0===e&&(e=!1),e&&ae(this.animations).forEach(e=>e.changes=void 0),this.debouncedOnEnd({finished:e})}destroy(){xe(this),this.props={},this.merged={},this.animations={},this.interpolations={},this.animatedProps={},this.configs=[]}debouncedOnEnd(e){xe(this),this.isActive=!1;const t=this.onEnd;this.onEnd=null,t&&t(e),this.resolve&&this.resolve(),this.resolve=null}}class Se extends j{constructor(e,t){super(),e.style&&(e=i({},e,{style:g(e.style)})),this.payload=e,this.update=t,this.attach()}}function Ee(e){class t extends a.Component{constructor(e){super(),this.callback=(()=>{if(this.node){!1===l.fn(this.node,this.propsAnimated.getAnimatedValue(),this)&&this.forceUpdate()}}),this.attachProps(e)}componentWillUnmount(){this.propsAnimated&&this.propsAnimated.detach()}setNativeProps(e){!1===l.fn(this.node,e,this)&&this.forceUpdate()}attachProps(e){e.forwardRef;let t=o(e,["forwardRef"]);const n=this.propsAnimated;this.propsAnimated=new Se(t,this.callback),n&&n.detach()}shouldComponentUpdate(e){const t=e.style,n=o(e,["style"]),r=this.props,i=r.style;return(!oe(o(r,["style"]),n)||!oe(i,t))&&(this.attachProps(e),!0)}render(){const t=this.propsAnimated.getValue(),n=(t.scrollTop,t.scrollLeft,o(t,["scrollTop","scrollLeft"]));return a.createElement(e,i({},n,{ref:e=>this.node=ce(e,this.props.forwardRef)}))}}return a.forwardRef((e,n)=>a.createElement(t,i({},e,{forwardRef:n})))}const Ie={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};class Ce extends a.Component{constructor(){super(...arguments),this.state={lastProps:{from:{},to:{}},propsChanged:!1,internal:!1},this.controller=new Oe(null,null),this.didUpdate=!1,this.didInject=!1,this.finished=!0,this.start=(()=>{this.finished=!1;let e=this.mounted;this.controller.start(t=>this.finish(i({},t,{wasMounted:e})),this.update)}),this.stop=(()=>this.controller.stop(!0)),this.update=(()=>this.mounted&&this.setState({internal:!0})),this.finish=(e=>{let t=e.finished,n=e.noChange,r=e.wasMounted;this.finished=!0,this.mounted&&t&&(!this.props.onRest||!r&&n||this.props.onRest(this.controller.merged),this.mounted&&this.didInject&&(this.afterInject=le(this.props),this.setState({internal:!0})),this.mounted&&(this.didInject||this.props.after)&&this.setState({internal:!0}),this.didInject=!1)})}componentDidMount(){this.componentDidUpdate(),this.mounted=!0}componentWillUnmount(){this.mounted=!1,this.stop()}static getDerivedStateFromProps(e,t){let n=t.internal,r=t.lastProps;const o=e.from,i=e.to,a=e.reset,s=e.force;return{propsChanged:!oe(i,r.to)||!oe(o,r.from)||a&&!n||s&&!n,lastProps:e,internal:!1}}render(){const e=this.props.children,t=this.state.propsChanged;if(this.props.inject&&t&&!this.injectProps){const e=this.props.inject(this.props,e=>{this.injectProps=e,this.setState({internal:!0})});if(e)return e}(this.injectProps||t)&&(this.didInject=!1,this.injectProps?(this.controller.update(this.injectProps),this.didInject=!0):t&&this.controller.update(this.props),this.didUpdate=!0,this.afterInject=void 0,this.injectProps=void 0);let n=i({},this.controller.getValues(),this.afterInject);return this.finished&&(n=i({},n,this.props.after)),Object.keys(n).length?e(n):null}componentDidUpdate(){this.didUpdate&&this.start(),this.didUpdate=!1}}Ce.defaultProps={from:{},to:{},config:Ie.default,native:!1,immediate:!1,reset:!1,force:!1,inject:u};class Ae extends a.PureComponent{constructor(){super(...arguments),this.first=!0,this.instances=new Set,this.hook=((e,t,n,r)=>(this.instances.add(e),(r?t===n-1:0===t)?void 0:Array.from(this.instances)[r?t+1:t-1]))}render(){const e=this.props,t=e.items,n=e.children,r=e.from,s=void 0===r?{}:r,u=e.initial,l=e.reverse,c=e.keys,d=e.delay,p=e.onRest,f=o(e,["items","children","from","initial","reverse","keys","delay","onRest"]),h=re(t);return re(h).map((e,t)=>a.createElement(Ce,i({onRest:0===t?p:null,key:"function"==typeof c?c(e):re(c)[t],from:this.first&&void 0!==u?u||{}:s},f,{delay:0===t&&d||void 0,attach:e=>this.hook(e,t,h.length,l),children:r=>{const o=n(e,t);return o?o(r):null}})))}componentDidUpdate(e){this.first=!1,e.items!==this.props.items&&this.instances.clear()}}Ae.defaultProps={keys:e=>e};class je extends a.PureComponent{constructor(){var e;super(...arguments),e=this,this.guid=0,this.state={props:{},resolve:()=>null,last:!0,index:0},this.next=function(t,n,r){return void 0===n&&(n=!0),void 0===r&&(r=0),e.running=!0,new Promise(o=>{e.mounted&&e.setState(e=>({props:t,resolve:o,last:n,index:r}),()=>e.running=!1)})}}componentDidMount(){this.mounted=!0,this.componentDidUpdate({})}componentWillUnmount(){this.mounted=!1}componentDidUpdate(e){var t=this;const n=this.props,r=n.states,o=n.filter,i=n.state;if((e.state!==this.props.state||this.props.reset&&!this.running||!oe(r[i],e.states[e.state]))&&r&&i&&r[i]){const e=++this.guid,n=r[i];if(n)if(Array.isArray(n)){let t=Promise.resolve();for(let r=0;r<n.length;r++){let i=r,a=n[i],s=i===n.length-1;t=t.then(()=>e===this.guid&&this.next(o(a),s,i))}}else if("function"==typeof n){let r=0;n(function(n,i){return void 0===i&&(i=!1),e===t.guid&&t.next(o(n),i,r++)},()=>d(()=>this.instance&&this.instance.stop()),this.props)}else this.next(o(r[i]))}}render(){const e=this.state,t=e.props,n=e.resolve,r=e.last,s=e.index;if(!t||0===Object.keys(t).length)return null;let u=this.props,l=(u.state,u.filter,u.states,u.config),c=u.primitive,d=u.onRest,p=u.forwardRef,f=o(u,["state","filter","states","config","primitive","onRest","forwardRef"]);return Array.isArray(l)&&(l=l[s]),a.createElement(c,i({ref:e=>this.instance=ce(e,p),config:l},f,t,{onRest:e=>{n(e),d&&r&&d(e)}}))}}je.defaultProps={state:"__default"};const ke=a.forwardRef((e,t)=>a.createElement(je,i({},e,{forwardRef:t})));ke.create=(e=>(function(t,n){return void 0===n&&(n=(e=>e)),("function"==typeof t||Array.isArray(t))&&(t={__default:t}),r=>a.createElement(je,i({primitive:e,states:t,filter:n},r))})),ke.Spring=(e=>ke.create(Ce)(e,se)),ke.Trail=(e=>ke.create(Ae)(e,se));let Pe=0,_e=e=>{let t=e.items,n=e.keys,r=o(e,["items","keys"]);return t=re(void 0!==t?t:null),n="function"==typeof n?t.map(n):re(n),i({items:t,keys:n.map(e=>String(e))},r)};class Te extends a.PureComponent{componentDidMount(){this.mounted=!0}componentWillUnmount(){this.mounted=!1}constructor(e){super(e),this.destroyItem=((e,t,n)=>r=>{const o=this.props,i=o.onRest,a=o.onDestroyed;this.mounted&&(a&&a(e),this.setState(e=>{return{deleted:e.deleted.filter(e=>e.key!==t)}}),i&&i(e,n,r))}),this.state={first:!0,transitions:[],current:{},deleted:[],prevProps:e}}static getDerivedStateFromProps(e,t){let n=t.first,r=t.prevProps,a=o(t,["first","prevProps"]),s=_e(e),u=s.items,l=s.keys,c=s.initial,d=s.from,p=s.enter,f=s.leave,h=s.update,m=s.trail,g=void 0===m?0:m,v=s.unique,y=s.config,b=_e(r),w=b.keys,x=b.items,O=i({},a.current),S=[...a.deleted],E=Object.keys(O),I=new Set(E),C=new Set(l),A=l.filter(e=>!I.has(e)),j=a.transitions.filter(e=>!e.destroyed&&!C.has(e.originalKey)).map(e=>e.originalKey),k=l.filter(e=>I.has(e)),P=0;A.forEach(e=>{v&&S.find(t=>t.originalKey===e)&&(S=S.filter(t=>t.originalKey!==e));const t=l.indexOf(e),r=u[t];O[e]={state:"enter",originalKey:e,key:v?String(e):Pe++,item:r,trail:P+=g,config:ie(y,r,"enter"),from:ie(n&&void 0!==c?c||{}:d,r),to:ie(p,r)}}),j.forEach(e=>{const t=w.indexOf(e),n=x[t];S.push(i({},O[e],{state:"leave",destroyed:!0,left:w[Math.max(0,t-1)],right:w[Math.min(w.length,t+1)],trail:P+=g,config:ie(y,n,"leave"),to:ie(f,n)})),delete O[e]}),k.forEach(e=>{const t=l.indexOf(e),n=u[t];O[e]=i({},O[e],{item:n,state:"update",trail:P+=g,config:ie(y,n,"update"),to:ie(h,n)})});let _=l.map(e=>O[e]);return S.forEach(e=>{let t,n=e.left,r=e.right,i=o(e,["left","right"]);-1!==(t=_.findIndex(e=>e.originalKey===n))&&(t+=1),-1===t&&(t=_.findIndex(e=>e.originalKey===r)),-1===t&&(t=S.findIndex(e=>e.originalKey===n)),-1===t&&(t=S.findIndex(e=>e.originalKey===r)),t=Math.max(0,t),_=[..._.slice(0,t),i,..._.slice(t)]}),{first:n&&0===A.length,transitions:_,current:O,deleted:S,prevProps:e}}render(){const e=this.props,t=(e.initial,e.from,e.enter,e.leave,e.update,e.onDestroyed,e.keys,e.items,e.onFrame),n=e.onRest,r=e.onStart,s=(e.trail,e.config,e.children),u=(e.unique,e.reset),l=o(e,["initial","from","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","trail","config","children","unique","reset"]);return this.state.transitions.map((e,o)=>{let c=e.state,d=e.key,p=e.item,f=e.from,h=e.to,m=e.trail,g=e.config,v=e.destroyed;return a.createElement(ke,i({reset:u&&"enter"===c,primitive:Ce,state:c,filter:se,states:{[c]:h},key:d,onRest:v?this.destroyItem(p,d,c):n&&(e=>n(p,c,e)),onStart:r&&(()=>r(p,c)),onFrame:t&&(e=>t(p,c,e)),delay:m,config:g},l,{from:f,children:e=>{const t=s(p,c,o);return t?t(e):null}}))})}}Te.defaultProps={keys:e=>e,unique:!1,reset:!1};const Me=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].reduce((e,t)=>(e[t]=Ee(t),e),Ee);t.Spring=Ce,t.Keyframes=ke,t.Transition=Te,t.Trail=Ae,t.Controller=Oe,t.config=Ie,t.animated=Me,t.interpolate=((e,t,n)=>e&&new Z(e,t,n)),t.Globals=S},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t,n){e.exports=n(19)()},function(e,t,n){e.exports=n(21)()},function(e,t){e.exports=window.BlocksyReactDOM},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){"use strict";e.exports=n(27)},function(e,t){e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),u=0;u<i.length;u++){var l=i[u];if(!s(l))return!1;var c=e[l],d=t[l];if(!1===(o=n?n.call(r,c,d,l):void 0)||void 0===o&&c!==d)return!1}return!0}},,,,function(e,t,n){"use strict";var r=n(20);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var r=n(22);function o(){}e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){var r=n(24);"string"==typeof r&&(r=[[e.i,r,""]]);n(26)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(25)()).push([e.i,"/* This code is subject to LICENSE in root of this repository */\n\n/* Used to detect in JavaScript if apps have loaded styles or not. */\n:root {\n --reach-dialog: 1;\n}\n\n[data-reach-dialog-overlay] {\n background: hsla(0, 0%, 0%, 0.33);\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow: auto;\n}\n\n[data-reach-dialog-content] {\n width: 50vw;\n margin: 10vh auto;\n background: white;\n padding: 2rem;\n outline: none;\n}\n","",{version:3,sources:["/Users/andreiglingeanu/Projects/full/plugins/blocksy-companion/node_modules/@reach/dialog/styles.css"],names:[],mappings:"AAAA,gEAAgE;;AAEhE,qEAAqE;AACrE;EACE,kBAAkB;CACnB;;AAED;EACE,kCAAkC;EAClC,gBAAgB;EAChB,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ;EACR,eAAe;CAChB;;AAED;EACE,YAAY;EACZ,kBAAkB;EAClB,kBAAkB;EAClB,cAAc;EACd,cAAc;CACf",file:"styles.css",sourcesContent:["/* This code is subject to LICENSE in root of this repository */\n\n/* Used to detect in JavaScript if apps have loaded styles or not. */\n:root {\n --reach-dialog: 1;\n}\n\n[data-reach-dialog-overlay] {\n background: hsla(0, 0%, 0%, 0.33);\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow: auto;\n}\n\n[data-reach-dialog-content] {\n width: 50vw;\n margin: 10vh auto;\n background: white;\n padding: 2rem;\n outline: none;\n}\n"],sourceRoot:""}])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(e,t){var n={},r=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}},o=r(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),i=r(function(){return document.head||document.getElementsByTagName("head")[0]}),a=null,s=0,u=[];function l(e,t){for(var r=0;r<e.length;r++){var o=e[r],i=n[o.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](o.parts[a]);for(;a<o.parts.length;a++)i.parts.push(h(o.parts[a],t))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(h(o.parts[a],t));n[o.id]={id:o.id,refs:1,parts:s}}}}function c(e){for(var t=[],n={},r=0;r<e.length;r++){var o=e[r],i=o[0],a={css:o[1],media:o[2],sourceMap:o[3]};n[i]?n[i].parts.push(a):t.push(n[i]={id:i,parts:[a]})}return t}function d(e,t){var n=i(),r=u[u.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),u.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function p(e){e.parentNode.removeChild(e);var t=u.indexOf(e);t>=0&&u.splice(t,1)}function f(e){var t=document.createElement("style");return t.type="text/css",d(e,t),t}function h(e,t){var n,r,o;if(t.singleton){var i=s++;n=a||(a=f(t)),r=v.bind(null,n,i,!1),o=v.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return t.rel="stylesheet",d(e,t),t}(t),r=function(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}.bind(null,n),o=function(){p(n),n.href&&URL.revokeObjectURL(n.href)}):(n=f(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){p(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");void 0===(t=t||{}).singleton&&(t.singleton=o()),void 0===t.insertAt&&(t.insertAt="bottom");var r=c(e);return l(r,t),function(e){for(var o=[],i=0;i<r.length;i++){var a=r[i];(s=n[a.id]).refs--,o.push(s)}e&&l(c(e),t);for(i=0;i<o.length;i++){var s;if(0===(s=o[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete n[s.id]}}}};var m,g=(m=[],function(e,t){return m[e]=t,m.filter(Boolean).join("\n")});function v(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=g(t,o);else{var i=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}},function(e,t,n){"use strict";
|
13 |
-
/** @license React v16.8.6
|
14 |
* react-is.production.min.js
|
15 |
*
|
16 |
* Copyright (c) Facebook, Inc. and its affiliates.
|
17 |
*
|
18 |
* This source code is licensed under the MIT license found in the
|
19 |
* LICENSE file in the root directory of this source tree.
|
20 |
-
*/Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,u=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,d=r?Symbol.for("react.async_mode"):60111,p=r?Symbol.for("react.concurrent_mode"):60111,f=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.memo"):60115,g=r?Symbol.for("react.lazy"):60116;function v(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case d:case p:case a:case u:case s:case h:return e;default:switch(e=e&&e.$$typeof){case c:case f:case l:return e;default:return t}}case g:case m:case i:return t}}}function y(e){return v(e)===p}t.typeOf=v,t.AsyncMode=d,t.ConcurrentMode=p,t.ContextConsumer=c,t.ContextProvider=l,t.Element=o,t.ForwardRef=f,t.Fragment=a,t.Lazy=g,t.Memo=m,t.Portal=i,t.Profiler=u,t.StrictMode=s,t.Suspense=h,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===u||e===s||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===f)},t.isAsyncMode=function(e){return y(e)||v(e)===d},t.isConcurrentMode=y,t.isContextConsumer=function(e){return v(e)===c},t.isContextProvider=function(e){return v(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return v(e)===f},t.isFragment=function(e){return v(e)===a},t.isLazy=function(e){return v(e)===g},t.isMemo=function(e){return v(e)===m},t.isPortal=function(e){return v(e)===i},t.isProfiler=function(e){return v(e)===u},t.isStrictMode=function(e){return v(e)===s},t.isSuspense=function(e){return v(e)===h}},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"FOCUS_GROUP",function(){return T}),n.d(r,"FOCUS_DISABLED",function(){return M}),n.d(r,"FOCUS_ALLOW",function(){return R}),n.d(r,"FOCUS_AUTO",function(){return D});var o=n(0),i=n(3),a=n(7),s=n.n(a),u=n(8),l=n(1),c=n.n(l);n(10);function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var p=function(e){e.initialState,e.getInitialState,e.refs,e.getRefs,e.didMount,e.didUpdate,e.willUnmount,e.getSnapshotBeforeUpdate,e.shouldUpdate,e.render;return function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["initialState","getInitialState","refs","getRefs","didMount","didUpdate","willUnmount","getSnapshotBeforeUpdate","shouldUpdate","render"])},f=function(e){function t(){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=d(this,e.call.apply(e,[this].concat(i))),h.call(r),d(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.getArgs=function(){var e=this.state,t=this.props,n=this._setState,r=this._forceUpdate,o=this._refs;return{state:e,props:p(t),refs:o,setState:n,forceUpdate:r}},t.prototype.componentDidMount=function(){this.props.didMount&&this.props.didMount(this.getArgs())},t.prototype.shouldComponentUpdate=function(e,t){return!this.props.shouldUpdate||this.props.shouldUpdate({props:this.props,state:this.state,nextProps:p(e),nextState:t})},t.prototype.componentWillUnmount=function(){this.props.willUnmount&&this.props.willUnmount({state:this.state,props:p(this.props),refs:this._refs})},t.prototype.componentDidUpdate=function(e,t,n){this.props.didUpdate&&this.props.didUpdate(Object.assign(this.getArgs(),{prevProps:p(e),prevState:t}),n)},t.prototype.getSnapshotBeforeUpdate=function(e,t){return this.props.getSnapshotBeforeUpdate?this.props.getSnapshotBeforeUpdate(Object.assign(this.getArgs(),{prevProps:p(e),prevState:t})):null},t.prototype.render=function(){var e=this.props,t=e.children,n=e.render;return n?n(this.getArgs()):"function"==typeof t?t(this.getArgs()):t||null},t}(c.a.Component);f.defaultProps={getInitialState:function(){},getRefs:function(){return{}}};var h=function(){var e=this;this.state=this.props.initialState||this.props.getInitialState(this.props),this._refs=this.props.refs||this.props.getRefs(this.getArgs()),this._setState=function(){return e.setState.apply(e,arguments)},this._forceUpdate=function(){return e.forceUpdate.apply(e,arguments)}},m=f,g=n(12),v=function(e){var t=e.children,n=e.type,r=void 0===n?"reach-portal":n;return c.a.createElement(m,{getRefs:function(){return{node:null}},didMount:function(e){var t=e.refs,n=e.forceUpdate;t.node=document.createElement(r),document.body.appendChild(t.node),n()},willUnmount:function(e){var t=e.refs.node;document.body.removeChild(t)},render:function(e){var n=e.refs.node;return n?Object(g.createPortal)(t,n):null}})};var y=function(e,t){return function(n){if(e&&e(n),!n.defaultPrevented)return t(n)}},b=n(13),w=n.n(b),x=n(9),O=n.n(x),S=n(2),E=n.n(S),I=n(5),C=n.n(I),A=(n(11),function(e){for(var t=Array(e.length),n=0;n<e.length;++n)t[n]=e[n];return t}),j=function(e){return Array.isArray(e)?e:[e]},k=function(e,t){var n=e.tabIndex-t.tabIndex,r=e.index-t.index;if(n){if(!e.tabIndex)return 1;if(!t.tabIndex)return-1}return n||r},P=function(e,t,n){return A(e).map(function(e,t){return{node:e,index:t,tabIndex:n&&-1===e.tabIndex?(e.dataset||{}).focusGuard?0:-1:e.tabIndex}}).filter(function(e){return!t||e.tabIndex>=0}).sort(k)},_=["button:enabled:not([readonly])","select:enabled:not([readonly])","textarea:enabled:not([readonly])","input:enabled:not([readonly])","a[href]","area[href]","iframe","object","embed","[tabindex]","[contenteditable]","[autofocus]"],T="data-focus-lock",M="data-focus-lock-disabled",R="data-no-focus-lock",D="data-autofocus-inside",U=_.join(","),F=U+", [data-focus-guard]",V=function(e,t){return e.reduce(function(e,n){return e.concat(A(n.querySelectorAll(t?F:U)),n.parentNode?A(n.parentNode.querySelectorAll(_.join(","))).filter(function(e){return e===n}):[])},[])},L=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return n.push(t),t.parentNode&&e(t.parentNode,n),n},H=function(e,t){for(var n=L(e),r=L(t),o=0;o<n.length;o+=1){var i=n[o];if(r.indexOf(i)>=0)return i}return!1},N=function(e){return A(e).filter(function(e){return function e(t){return!t||t===document||!((n=window.getComputedStyle(t,null))&&n.getPropertyValue&&("none"===n.getPropertyValue("display")||"hidden"===n.getPropertyValue("visibility")))&&e(t.parentNode);var n}(e)}).filter(function(e){return function(e){return!(("INPUT"===e.tagName||"BUTTON"===e.tagName)&&("hidden"===e.type||e.disabled))}(e)})},B=function(e,t){return P(N(V(e,t)),!0,t)},K=function(e){return N((t=e.querySelectorAll("["+D+"]"),A(t).map(function(e){return V([e])}).reduce(function(e,t){return e.concat(t)},[])));var t},W=function(e){return"INPUT"===e.tagName&&"radio"===e.type},q=function(e){return e[0]&&e.length>1&&W(e[0])&&e[0].name?function(e,t){return t.filter(W).filter(function(t){return t.name===e.name}).filter(function(e){return e.checked})[0]||e}(e[0],e):e[0]},$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z=function(e){return j(e).filter(Boolean).reduce(function(e,t){var n=t.getAttribute(T);return e.push.apply(e,n?function e(t){for(var n=t.length,r=0;r<n;r+=1)for(var o=function(n){if(r!==n&&t[r].contains(t[n]))return{v:e(t.filter(function(e){return e!==t[n]}))}},i=0;i<n;i+=1){var a=o(i);if("object"===(void 0===a?"undefined":$(a)))return a.v}return t}(A(function e(t){return t.parentNode?e(t.parentNode):t}(t).querySelectorAll("["+T+'="'+n+'"]:not(['+M+'="disabled"])'))):[t]),e},[])},G=function(e,t,n){var r=j(e),o=j(t),i=r[0],a=null;return o.filter(Boolean).forEach(function(e){a=H(a||e,e)||a,n.filter(Boolean).forEach(function(e){var t=H(i,e);t&&(a=!a||t.contains(a)?t:H(t,a))})}),a},Y=function(e){return!(e.dataset&&e.dataset.focusGuard)},Q=function(e,t){var n=document&&document.activeElement,r=z(e).filter(Y),o=G(n||e,e,r),i=B(r).filter(function(e){var t=e.node;return Y(t)});if(i[0]||(i=(a=r,P(N(V(a)),!1)).filter(function(e){var t=e.node;return Y(t)}))[0]){var a,s,u,l=B([o]).map(function(e){return e.node}),c=(s=i,l.map(function(e){return s.find(function(t){var n=t.node;return e===n})}).filter(Boolean)),d=c.map(function(e){return e.node}),p=function(e,t,n,r,o){var i=e.length,a=e[0],s=e[i-1];if(!(e.indexOf(n)>=0)){var u=t.indexOf(n),l=t.indexOf(r||u),c=e.indexOf(r),d=u-l,p=t.indexOf(a),f=t.indexOf(s);return-1===u||-1===c?e.indexOf(o.length?q(o):q(e)):!d&&c>=0?c:d&&Math.abs(d)>1?c:u<=p?i-1:u>f?0:d?Math.abs(d)>1?c:(i+c+d)%i:void 0}}(d,l,n,t,d.filter((u=function(e){return e.reduce(function(e,t){return e.concat(K(t))},[])}(r),function(e){return!!e.autofocus||e.dataset&&!!e.dataset.autofocus||u.indexOf(e)>=0})));return void 0===p?p:c[p]}},J=function(e){return e===document.activeElement},X=function(e){var t=document&&document.activeElement;return!(!t||t.dataset&&t.dataset.focusGuard)&&z(e).reduce(function(e,n){return e||n.contains(t)||(r=A(n.querySelectorAll("iframe")),o=J,!!r.filter(function(e){return e===o})[0]);var r,o},!1)},Z=function(){return document&&A(document.querySelectorAll("["+R+"]")).some(function(e){return e.contains(document.activeElement)})},ee=0,te=!1,ne=function(e,t){var n,r=Q(e,t);if(!te&&r){if(ee>2)return console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),te=!0,void setTimeout(function(){te=!1},1);ee++,(n=r.node).focus(),n.contentWindow&&n.contentWindow.focus(),ee--}},re=n(15),oe=n.n(re);function ie(e){var t=window.setImmediate;void 0!==t?t(e):setTimeout(e,1)}var ae=function(){return document&&document.activeElement===document.body||Z()},se=null,ue=null,le=null;function ce(e,t,n,r){var o=null,i=e;do{var a=r[i];if(a.guard)a.node.dataset.focusAutoGuard&&(o=a);else{if(!a.lockItem)break;if(i!==e)return;o=null}}while((i+=n)!==t);o&&(o.node.tabIndex=0)}var de=function(e){return e&&"current"in e?e.current:e},pe=function(){var e,t,n,r,o,i,a=!1;if(se){var s=se,u=s.observed,l=s.persistentFocus,c=s.autoFocus,d=s.shards,p=u||le&&le.portaledElement,f=document&&document.activeElement;if(p){var h=[p].concat(d.map(de).filter(Boolean));if(f&&!function(e){return(se.whiteList||function(){return!0})(e)}(f)||(l||!ae()||!ue&&c)&&(!p||X(h)||(i=f,le&&le.portaledElement===i)||(document&&!ue&&f&&!c?(f.blur(),document.body.focus()):(a=ne(h,ue),le={})),ue=document&&document.activeElement),document){var m=document&&document.activeElement,g=(t=z(e=h).filter(Y),n=G(e,e,t),r=B([n],!0),o=B(t).filter(function(e){var t=e.node;return Y(t)}).map(function(e){return e.node}),r.map(function(e){var t=e.node;return{node:t,index:e.index,lockItem:o.indexOf(t)>=0,guard:!Y(t)}})),v=g.find(function(e){return e.node===m});if(v){g.filter(function(e){var t=e.guard,n=e.node;return t&&n.dataset.focusAutoGuard}).forEach(function(e){return e.node.removeAttribute("tabIndex")});var y=g.indexOf(v);ce(y,g.length,1,g),ce(y,-1,-1,g)}}}}return a},fe=function(e){pe()&&e&&(e.stopPropagation(),e.preventDefault())},he=function(){return ie(pe)},me=function(e){var t=e.target,n=e.currentTarget;n.contains(t)||(le={observerNode:n,portaledElement:t})},ge=function(){document.addEventListener("focusin",fe,!0),document.addEventListener("focusout",he)},ve=function(){document.removeEventListener("focusin",fe,!0),document.removeEventListener("focusout",he)};var ye=function(e,t){return function(n){var r,o=[];function i(){r=e(o.map(function(e){return e.props})),t(r)}var a=function(e){function t(){return e.apply(this,arguments)||this}O()(t,e),t.peek=function(){return r};var a=t.prototype;return a.shouldComponentUpdate=function(e){return!oe()(e,this.props)},a.componentDidMount=function(){o.push(this),i()},a.componentDidUpdate=function(){i()},a.componentWillUnmount=function(){var e=o.indexOf(this);o.splice(e,1),i()},a.render=function(){return c.a.createElement(n,this.props)},t}(l.Component);return C()(a,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(n)+")"),a}}(function(e){return e.filter(function(e){return!e.disabled}).slice(-1)[0]},function(e){e&&!se&&ge();var t=se,n=t&&e&&e.onActivation===t.onActivation;se=e,t&&!n&&t.onDeactivation(),e?(ue=null,n&&t.observed===e.observed||e.onActivation(),pe(!0),ie(pe)):(ve(),ue=null)})(function(){return null}),be={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},we=function(e){var t=e.children;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{key:"guard-first","data-focus-guard":!0,"data-focus-auto-guard":!0,style:be}),t,t&&c.a.createElement("div",{key:"guard-last","data-focus-guard":!0,"data-focus-auto-guard":!0,style:be}))};we.propTypes={},we.defaultProps={children:null};var xe=function(e){var t=e.children;return c.a.createElement("div",null,t)};xe.propTypes={};var Oe=c.a.Fragment?c.a.Fragment:xe,Se=[],Ee=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t=e.call.apply(e,[this].concat(r))||this,C()(E()(E()(t)),"state",{observed:void 0}),C()(E()(E()(t)),"onActivation",function(){t.originalFocusedElement=t.originalFocusedElement||document&&document.activeElement,t.state.observed&&t.props.onActivation&&t.props.onActivation(t.state.observed),t.isActive=!0}),C()(E()(E()(t)),"onDeactivation",function(){t.isActive=!1,t.props.returnFocus&&t.originalFocusedElement&&t.originalFocusedElement.focus&&(t.originalFocusedElement.focus(),t.originalFocusedElement=null),t.props.onDeactivation&&t.props.onDeactivation(t.state.observed)}),C()(E()(E()(t)),"onFocus",function(e){t.isActive&&me(e)}),C()(E()(E()(t)),"onBlur",he),C()(E()(E()(t)),"setObserveNode",function(e){return t.setState({observed:e})}),C()(E()(E()(t)),"isActive",!1),C()(E()(E()(t)),"update",function(){return t.setState(function(e){return{escapeAttempts:e.escapeAttempts+1}})}),C()(E()(E()(t)),"originalFocusedElement",null),t}return O()(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,o=t.disabled,i=t.noFocusGuards,a=t.persistentFocus,s=t.autoFocus,u=(t.allowTextSelection,t.group),l=t.className,d=t.whiteList,p=t.shards,f=void 0===p?Se:p,h=t.as,m=void 0===h?"div":h,g=t.lockProps,v=void 0===g?{}:g,y=this.state.observed;var b=w()(((e={})[r.FOCUS_DISABLED]=o&&"disabled",e[r.FOCUS_GROUP]=u,e),v);return c.a.createElement(Oe,null,!i&&[c.a.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:o?-1:0,style:be}),c.a.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:o?-1:1,style:be})],c.a.createElement(m,w()({ref:this.setObserveNode},b,{className:l,onBlur:this.onBlur,onFocus:this.onFocus}),c.a.createElement(ye,{observed:y,disabled:o,persistentFocus:a,autoFocus:s,whiteList:d,shards:f,onActivation:this.onActivation,onDeactivation:this.onDeactivation}),n),!i&&c.a.createElement("div",{"data-focus-guard":!0,tabIndex:o?-1:0,style:be}))},t}(l.Component);Ee.propTypes={},Ee.defaultProps={disabled:!1,returnFocus:!1,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};var Ie=Ee,Ce=function(e,t){return(Ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function Ae(e,t){function n(){this.constructor=e}Ce(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var je=function(){return(je=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var ke,Pe={left:0,top:0,right:0,gap:0},_e=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Pe;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[parseInt(n||"",10)||0,parseInt(r||"",10)||0,parseInt(o||"",10)||0]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Te=(ke=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");return e.type="text/css",e}())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){!--e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}}(),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ae(t,e),t.prototype.componentDidMount=function(){ke.add(this.props.styles)},t.prototype.componentWillUnmount=function(){ke.remove()},t.prototype.render=function(){return null},t}(l.PureComponent)),Me=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n body {\n overflow: hidden "+r+";\n "+[t&&"position: relative "+r+";","margin"==n&&"\n padding-left: "+o+"px;\n padding-top: "+i+"px;\n padding-right: "+a+"px;\n margin-left:0;\n margin-top:0;\n margin-right: "+s+"px "+r+";\n ","padding"==n&&"padding-right: "+s+"px "+r+";"].filter(Boolean).join("")+"\n }\n \n .right-scroll-bar-position {\n right: "+s+"px "+r+";\n }\n \n .width-before-scroll-bar {\n margin-right: "+s+"px "+r+";\n }\n \n .right-scroll-bar-position .right-scroll-bar-position {\n right: 0 "+r+";\n }\n \n .width-before-scroll-bar .width-before-scroll-bar {\n margin-right: 0 "+r+";\n }\n"},Re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={gap:_e(t.props.gapMode)},t.onResize=function(){t.forceUpdate(),t.state.gap&&t.props.dynamic&&window.innerHeight>document.body.offsetHeight&&t.setState({gap:Pe})},t}return Ae(t,e),t.prototype.componentDidMount=function(){var e=_e(this.props.gapMode);e!==this.state.gap&&this.setState({gap:e}),"undefined"!=typeof window&&window.addEventListener("resize",this.onResize)},t.prototype.componentWillUnmount=function(){"undefined"!=typeof window&&window.removeEventListener("resize",this.onResize)},t.prototype.componentDidUpdate=function(){if(!this.state.gap){var e=_e(this.props.gapMode);e!==this.state.gap&&this.setState({gap:e})}},t.prototype.render=function(){var e=this.props,t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r,i=this.state.gap;return i.gap?l.createElement(Te,{styles:Me(i,!t,o,n?"":"!important")}):null},t}(l.Component),De=function(e,t,n){var r,o=n,i=t.target,a=e.contains(i),s=!1,u=o>0,l=0,c=0;do{var d=i.scrollTop,p=i.scrollHeight-i.clientHeight-d;(d||p)&&(r=i,"hidden"!==window.getComputedStyle(r).overflowY&&(l+=p,c+=d)),i=i.parentNode}while(!a&&i!==document.body||a&&(e.contains(i)||e===i));return u&&o>l?s=!0:!u&&-o>c&&(s=!0),s},Ue=!1;if("undefined"!=typeof window)try{var Fe=Object.defineProperty({},"passive",{get:function(){return Ue=!0,!0}});window.addEventListener("test",Fe,Fe),window.removeEventListener("test",Fe,Fe)}catch(e){Ue=!1}var Ve=!!Ue&&{passive:!1},Le=function(e){return e.changedTouches?e.changedTouches[0].clientY:0},He={fullWidth:"width-before-scroll-bar",zeroRight:"right-scroll-bar-position"},Ne=function(e){return e&&"current"in e?e.current:e},Be=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.shouldPreventQueue=[],n.touchStart=0,n.ref=l.createRef(),n.shouldPrevent=function(e){var r=t.stack.filter(function(e){return e.props.enabled});if(r.length&&r[r.length-1]===n){var o=e.deltaY||Le(e),i=n.shouldPreventQueue.filter(function(t){return t.name===e.type&&t.delta===o&&t.target===e.target})[0];if(i&&i.should)e.preventDefault();else if(!i){var a=(n.props.shards||[]).map(Ne).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?n.shouldCancelEvent(e,a[0]):!n.props.noIsolation)&&e.preventDefault()}}},n.shouldCancel=function(e,t,r,o){var i={name:e,delta:t,target:r,should:o};n.shouldPreventQueue.push(i),setTimeout(function(){n.shouldPreventQueue=n.shouldPreventQueue.filter(function(e){return e!==i})},1)},n.scrollTouchStart=function(e){n.touchStart=Le(e)},n.scrollWheel=function(e){n.shouldCancel(e.type,e.deltaY,e.target,n.shouldCancelEvent(e,n.ref.current))},n.scrollTouchMove=function(e){n.shouldCancel(e.type,Le(e),e.target,n.shouldCancelEvent(e,n.ref.current))},n}return Ae(t,e),t.prototype.componentDidMount=function(){t.stack.push(this),this.componentDidUpdate({enabled:!1})},t.prototype.componentWillUnmount=function(){var e=this;t.stack=t.stack.filter(function(t){return t!==e}),this.disable()},t.prototype.componentDidUpdate=function(e){e.enabled!==this.props.enabled&&(this.props.enabled?this.enable():this.disable())},t.prototype.enable=function(){"undefined"!=typeof document&&(document.addEventListener("wheel",this.shouldPrevent,Ve),document.addEventListener("touchmove",this.shouldPrevent,Ve),document.addEventListener("touchstart",this.scrollTouchStart,Ve))},t.prototype.disable=function(){"undefined"!=typeof window&&(document.removeEventListener("wheel",this.shouldPrevent,Ve),document.removeEventListener("touchmove",this.shouldPrevent,Ve),document.removeEventListener("touchstart",this.scrollTouchStart,Ve))},t.prototype.shouldCancelEvent=function(e,t){switch(e.type){case"wheel":case"scroll":return De(t,e,e.deltaY);case"touchmove":return De(t,e,this.touchStart-Le(e))}return!1},t.prototype.render=function(){var e=this.props,t=e.forwardProps,n=e.children,r=e.className,o=e.removeScrollBar,i=e.enabled,a={ref:this.ref,onScrollCapture:this.scrollWheel,onWheelCapture:this.scrollWheel,onTouchMoveCapture:this.scrollTouchMove};return l.createElement(l.Fragment,null,o&&i&&l.createElement(Re,{gapMode:"margin"}),t?l.cloneElement(l.Children.only(n),a):l.createElement("div",je({},a,{className:r}),n))},t.classNames=He,t.defaultProps={enabled:!0,removeScrollBar:!0},t.stack=[],t}(l.Component),Ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function We(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var qe=function(){},$e=function(){},ze=function(e){var t,n,r;e.disposeAriaHider=(t=e.overlayNode,n=[],r=[],Array.prototype.forEach.call(document.querySelectorAll("body > *"),function(e){if(e!==t.parentNode){var o=e.getAttribute("aria-hidden");null!==o&&"false"!==o||(n.push(o),r.push(e),e.setAttribute("aria-hidden","true"))}}),function(){r.forEach(function(e,t){var r=n[t];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)})})},Ge=function(e){e.refs.disposeAriaHider()},Ye=(c.a.createContext(),c.a.forwardRef(function(e,t){var n=e.isOpen,r=void 0===n||n,o=e.onDismiss,i=void 0===o?qe:o,a=e.initialFocusRef,s=e.onClick,u=e.onKeyDown,l=We(e,["isOpen","onDismiss","initialFocusRef","onClick","onKeyDown"]);return c.a.createElement(m,{didMount:$e},r?c.a.createElement(v,{"data-reach-dialog-wrapper":!0},c.a.createElement(m,{refs:{overlayNode:null},didMount:function(e){var t=e.refs;ze(t)},willUnmount:Ge},function(e){var n=e.refs;return c.a.createElement(Ie,{returnFocus:!0,onActivation:function(){a&&a.current.focus()}},c.a.createElement(Be,null,c.a.createElement("div",Ke({"data-reach-dialog-overlay":!0,onClick:y(s,function(e){e.stopPropagation(),i()}),onKeyDown:y(u,function(e){"Escape"===e.key&&(e.stopPropagation(),i())}),ref:function(e){n.overlayNode=e,t&&t(e)}},l))))})):null)}));Ye.propTypes={initialFocusRef:function(){}};var Qe=function(e){return e.stopPropagation()},Je=c.a.forwardRef(function(e,t){var n=e.onClick,r=(e.onKeyDown,We(e,["onClick","onKeyDown"]));return c.a.createElement("div",Ke({"aria-modal":"true","data-reach-dialog-content":!0,tabIndex:"-1",onClick:y(n,Qe),ref:function(e){t&&t(e)}},r))}),Xe=(n(23),function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()),Ze=function(e){var t=Object(o.useState)(!1),n=Xe(t,2),r=n[0],i=n[1];return[function(){return i(!0)},Object(o.createElement)(u.Transition,{items:r,config:{duration:200},from:{opacity:0,y:-10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}},function(t){return t&&function(t){return Object(o.createElement)(Ye,{style:{opacity:t.opacity},onDismiss:function(){return i(!1)}},Object(o.createElement)(Je,{style:{transform:"translate3d(0px, "+t.y+"px, 0px)"}},Object(o.createElement)("button",{className:"close-button",onClick:function(){return i(!1)}},"×"),Object(o.createElement)("div",{className:"ct-extension-readme",dangerouslySetInnerHTML:{__html:e.readme}})))}})]},et=n(6),tt=n(4);function nt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n(14);function rt(e){return null!=e&&"object"==typeof e&&1===e.nodeType}function ot(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function it(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return ot(n.overflowY,t)||ot(n.overflowX,t)}return!1}function at(e,t,n,r,o,i,a,s){return i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0}var st=function(e,t){var n=t.scrollMode,r=t.block,o=t.inline,i=t.boundary,a=t.skipOverflowHiddenElements,s="function"==typeof i?i:function(e){return e!==i};if(!rt(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],c=e;rt(c)&&s(c);){if((c=c.parentNode)===u){l.push(c);break}c===document.body&&it(c)&&!it(document.documentElement)||it(c,a)&&l.push(c)}for(var d=window.visualViewport?visualViewport.width:innerWidth,p=window.visualViewport?visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,m=e.getBoundingClientRect(),g=m.height,v=m.width,y=m.top,b=m.right,w=m.bottom,x=m.left,O="start"===r||"nearest"===r?y:"end"===r?w:y+g/2,S="center"===o?x+v/2:"end"===o?b:x,E=[],I=0;I<l.length;I++){var C=l[I],A=C.getBoundingClientRect(),j=A.height,k=A.width,P=A.top,_=A.right,T=A.bottom,M=A.left;if("if-needed"===n&&y>=0&&x>=0&&w<=p&&b<=d&&y>=P&&w<=T&&x>=M&&b<=_)return E;var R=getComputedStyle(C),D=parseInt(R.borderLeftWidth,10),U=parseInt(R.borderTopWidth,10),F=parseInt(R.borderRightWidth,10),V=parseInt(R.borderBottomWidth,10),L=0,H=0,N="offsetWidth"in C?C.offsetWidth-C.clientWidth-D-F:0,B="offsetHeight"in C?C.offsetHeight-C.clientHeight-U-V:0;if(u===C)L="start"===r?O:"end"===r?O-p:"nearest"===r?at(h,h+p,p,U,V,h+O,h+O+g,g):O-p/2,H="start"===o?S:"center"===o?S-d/2:"end"===o?S-d:at(f,f+d,d,D,F,f+S,f+S+v,v),L=Math.max(0,L+h),H=Math.max(0,H+f);else{L="start"===r?O-P-U:"end"===r?O-T+V+B:"nearest"===r?at(P,T,j,U,V+B,O,O+g,g):O-(P+j/2)+B/2,H="start"===o?S-M-D:"center"===o?S-(M+k/2)+N/2:"end"===o?S-_+F+N:at(M,_,k,D,F+N,S,S+v,v);var K=C.scrollLeft,W=C.scrollTop;O+=W-(L=Math.max(0,Math.min(W+L,C.scrollHeight-j+B))),S+=K-(H=Math.max(0,Math.min(K+H,C.scrollWidth-k+N)))}E.push({el:C,top:L,left:H})}return E},ut="undefined"==typeof document?null:document.getElementById("a11y-status-message"),lt=[];function ct(e){var t=lt[lt.length-1]===e;lt=t?[].concat(lt,[e]):[e];for(var n=function(){if(ut)return ut;return(ut=document.createElement("div")).setAttribute("id","a11y-status-message"),ut.setAttribute("role","status"),ut.setAttribute("aria-live","polite"),ut.setAttribute("aria-relevant","additions text"),Object.assign(ut.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(ut),ut}();n.lastChild;)n.removeChild(n.firstChild);lt.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===lt.length-1?"block":"none",r=document.createElement("div");return r.style.display=n,r.textContent=e,r}(e,t))})}var dt=0,pt=2,ft=3,ht=4,mt=5,gt=6,vt=7,yt=8,bt=9,wt=10,xt=11,Ot=12,St=13,Et=14,It=Object.freeze({unknown:dt,mouseUp:1,itemMouseEnter:pt,keyDownArrowUp:ft,keyDownArrowDown:ht,keyDownEscape:mt,keyDownEnter:gt,keyDownHome:vt,keyDownEnd:yt,clickItem:bt,blurInput:wt,changeInput:xt,keyDownSpaceButton:Ot,clickButton:St,blurButton:Et,controlledPropUpdatedSelectedItem:15,touchEnd:16}),Ct=0;function At(e){return"function"==typeof e?e:jt}function jt(){}function kt(e,t){return e===t||e.contains&&e.contains(t)}function Pt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some(function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault})}}function _t(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function Tt(e){return"string"==typeof e.type}function Mt(e){return e.props}var Rt=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Dt(e){void 0===e&&(e={});var t={};return Rt.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Ut(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function Ft(e,t,n){var r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);var o=t+e;return o<0?o=r:o>r&&(o=0),o}var Vt=function(e){var t,n;function r(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+String(Ct++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout(function(){n.timeoutIds=n.timeoutIds.filter(function(e){return e!==r}),e()},t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=Dt(t),n.internalSetState(Object(tt.default)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=Dt(t),n.internalSetState(Object(tt.default)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},a="function"==typeof e;return!a&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(tt.default)({},n.getStateAndHelpers(),e)),n.setState(function(t){t=n.getState(t);var s=a?e(t):e;s=n.props.stateReducer(t,s),r=s.hasOwnProperty("selectedItem");var u={},l={};return r&&s.selectedItem!==t.selectedItem&&(o=s.selectedItem),s.type=s.type||dt,Object.keys(s).forEach(function(e){t[e]!==s[e]&&(i[e]=s[e]),"type"!==e&&(l[e]=s[e],n.isControlledProp(e)||(u[e]=s[e]))}),a&&s.hasOwnProperty("inputValue")&&n.props.onInputValueChange(s.inputValue,Object(tt.default)({},n.getStateAndHelpers(),s)),u},function(){At(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())})},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,s=Object(et.default)(o,["refKey"]),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=l;var c=n.getState().isOpen;return Object(tt.default)(((r={})[a]=n.rootRef,r.role="combobox",r["aria-expanded"]=c,r["aria-haspopup"]="listbox",r["aria-owns"]=c?n.menuId:null,r["aria-labelledby"]=n.labelId,r),s)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:ht})}else this.internalSetState({isOpen:!0,type:ht},function(){var e=t.getItemCount();e>0&&t.setHighlightedIndex(Ft(1,t.getState().highlightedIndex,e),{type:ht})})},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:ft})}else this.internalSetState({isOpen:!0,type:ft},function(){var e=t.getItemCount();e>0&&t.setHighlightedIndex(Ft(-1,t.getState().highlightedIndex,e),{type:ht})})},Enter:function(e){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:gt})}},Escape:function(e){e.preventDefault(),this.reset({type:mt})}},n.buttonKeyDownHandlers=Object(tt.default)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:Ot})}}),n.inputKeyDownHandlers=Object(tt.default)({},n.keyDownHandlers,{Home:function(e){this.highlightFirstOrLastIndex(e,!0,{type:vt})},End:function(e){this.highlightFirstOrLastIndex(e,!1,{type:yt})}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick,o=(t.onPress,t.onKeyDown),i=t.onKeyUp,a=t.onBlur,s=Object(et.default)(t,["onClick","onPress","onKeyDown","onKeyUp","onBlur"]),u=n.getState().isOpen,l={onClick:Pt(r,n.buttonHandleClick),onKeyDown:Pt(o,n.buttonHandleKeyDown),onKeyUp:Pt(i,n.buttonHandleKeyUp),onBlur:Pt(a,n.buttonHandleBlur)},c=s.disabled?{}:l;return Object(tt.default)({type:"button",role:"button","aria-label":u?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},c,s)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=Ut(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(nt(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout(function(){return n.toggleMenu({type:St})})},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout(function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:Et})})},n.getLabelProps=function(e){return Object(tt.default)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,a=t.onInput,s=(t.onChangeText,Object(et.default)(t,["onKeyDown","onBlur","onChange","onInput","onChangeText"])),u={};var l,c=n.getState(),d=c.inputValue,p=c.isOpen,f=c.highlightedIndex;s.disabled||((l={}).onChange=Pt(i,a,n.inputHandleChange),l.onKeyDown=Pt(r,n.inputHandleKeyDown),l.onBlur=Pt(o,n.inputHandleBlur),u=l);return Object(tt.default)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,s)},n.inputHandleKeyDown=function(e){var t=Ut(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(nt(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:xt,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleTextChange=function(e){n.internalSetState({type:xt,isOpen:!0,inputValue:e,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout(function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:wt})})},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,s=o.ref,u=Object(et.default)(o,["refKey","ref"]),l=(void 0===t?{}:t).suppressRefError,c=void 0!==l&&l;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=c,Object(tt.default)(((r={})[a]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach(function(e){e&&e.apply(void 0,n)})}}(s,n.menuRef),r.role="listbox",r["aria-labelledby"]=u&&u["aria-label"]?null:n.labelId,r.id=n.menuId,r),u)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,a=r.onClick,s=(r.onPress,r.index),u=r.item,l=void 0===u?void 0:u,c=Object(et.default)(r,["onMouseMove","onMouseDown","onClick","onPress","index","item"]);void 0===s?(n.items.push(l),s=n.items.indexOf(l)):n.items[s]=l;var d=a,p=((t={onMouseMove:Pt(o,function(){s!==n.getState().highlightedIndex&&(n.setHighlightedIndex(s,{type:pt}),n.avoidScrolling=!0,n.internalSetTimeout(function(){return n.avoidScrolling=!1},250))}),onMouseDown:Pt(i,function(e){e.preventDefault()})}).onClick=Pt(d,function(){n.selectItemAtIndex(s,{type:bt})}),t),f=c.disabled?{onMouseDown:p.onMouseDown}:p;return Object(tt.default)({id:n.getItemId(s),role:"option","aria-selected":n.getState().highlightedIndex===s},f,c)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=Dt(e),n.internalSetState(function(t){var r=t.selectedItem;return Object(tt.default)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)},t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=Dt(e),n.internalSetState(function(t){var r=t.isOpen;return Object(tt.default)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)},function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),At(t)()})},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=function(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}return o.cancel=r,o}(function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(tt.default)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,ct(o)},200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,a=void 0===i?o:i,s=r.defaultIsOpen,u=r.initialIsOpen,l=void 0===u?s:u,c=r.initialInputValue,d=void 0===c?"":c,p=r.initialSelectedItem,f=void 0===p?null:p,h=n.getState({highlightedIndex:a,isOpen:l,inputValue:d,selectedItem:f});return null!=h.selectedItem&&void 0===n.props.initialInputValue&&(h.inputValue=n.props.itemToString(h.selectedItem)),n.state=h,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach(function(e){clearTimeout(e)}),this.timeoutIds=[]},o.getState=function(e){var t=this;return void 0===e&&(e=this.state),Object.keys(e).reduce(function(n,r){return n[r]=t.isControlledProp(r)?t.props[r]:e[r],n},{})},o.isControlledProp=function(e){return void 0!==this.props[e]},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this.getItemCount();if(n>0){var r=Ft(e,this.getState().highlightedIndex,n);this.setHighlightedIndex(r,t)}},o.highlightFirstOrLastIndex=function(e,t,n){var r=this.getItemCount()-1;r<0||!this.getState().isOpen||(e.preventDefault(),this.setHighlightedIndex(t?0:r,n))},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,a=this.id,s=this.getRootProps,u=this.getToggleButtonProps,l=this.getLabelProps,c=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,h=this.closeMenu,m=this.toggleMenu,g=this.selectItem,v=this.selectItemAtIndex,y=this.selectHighlightedItem,b=this.setHighlightedIndex,w=this.clearSelection,x=this.clearItems;return{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:c,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:h,toggleMenu:m,selectItem:g,selectItemAtIndex:v,selectHighlightedItem:y,setHighlightedIndex:b,clearSelection:w,clearItems:x,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:a,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this;var t=function(t,n){void 0===n&&(n=!0);var r=e.props.environment.document;return[e._rootNode,e._menuNode].some(function(e){return e&&(kt(e,t)||n&&kt(e,r.activeElement))})},n=function(){e.isMouseDown=!0},r=function(n){e.isMouseDown=!1,!t(n.target)&&e.getState().isOpen&&e.reset({type:1},function(){return e.props.onOuterClick(e.getStateAndHelpers())})},o=function(){e.isTouchMove=!1},i=function(){e.isTouchMove=!0},a=function(n){var r=t(n.target,!1);e.isTouchMove||r||!e.getState().isOpen||e.reset({type:16},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",n),this.props.environment.addEventListener("mouseup",r),this.props.environment.addEventListener("touchstart",o),this.props.environment.addEventListener("touchmove",i),this.props.environment.addEventListener("touchend",a),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),e.props.environment.removeEventListener("mousedown",n),e.props.environment.removeEventListener("mouseup",r),e.props.environment.removeEventListener("touchstart",o),e.props.environment.removeEventListener("touchmove",i),e.props.environment.removeEventListener("touchend",a)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=_t(this.props.children,jt);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=_t(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:Tt(t)?c.a.cloneElement(t,this.getRootProps(Mt(t))):void 0:null},r}(l.Component);Vt.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.selectedItem,r=e.resultCount,o=e.previousResultCount,i=e.itemToString;return t?r?r!==o?r+" result"+(1===r?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":n?i(n):""},itemToString:function(e){return null==e?"":String(e)},onStateChange:jt,onInputValueChange:jt,onUserAction:jt,onChange:jt,onSelect:jt,onOuterClick:jt,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:function(e,t){null!==e&&st(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach(function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r})}},Vt.stateChangeTypes=It;var Lt=Vt,Ht=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nt=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var Bt=function(e){var t,n,r=e.listId,a=e.apiKey,u=e.onChange,l=Object(o.useState)([]),c=Nt(l,2),d=c[0],p=c[1],f=Object(o.useState)(!1),h=Nt(f,2),m=h[0],g=h[1],v=Object(o.useState)({controller:null}),y=Nt(v,2),b=y[0].controller,w=y[1],x=(t=regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return b&&b.abort(),g(!0),"AbortController"in window&&(b=new AbortController,w({controller:b})),(t=new FormData).append("api_key",a),t.append("action","blocksy_ext_mailchimp_maybe_get_lists"),e.prev=6,e.next=9,fetch(ctDashboardLocalizations.ajax_url,{method:"POST",signal:b.signal,body:t});case 9:if(200!==(n=e.sent).status){e.next=19;break}return e.next=13,n.json();case 13:if(!(r=e.sent).success){e.next=19;break}if("api_key_invalid"===r.data.result){e.next=19;break}return g(!1),p(r.data.result),e.abrupt("return");case 19:e.next=23;break;case 21:e.prev=21,e.t0=e.catch(6);case 23:p([]),g(!1);case 25:case"end":return e.stop()}},e,void 0,[[6,21]])}),n=function(){var e=t.apply(this,arguments);return new Promise(function(t,n){return function r(o,i){try{var a=e[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});t(s)}("next")})},function(){return n.apply(this,arguments)});return Object(o.useEffect)(function(){a&&-1!==a.indexOf("-")?x():p([])},[a]),0===d.length?Object(o.createElement)("div",{className:"ct-select-input"},Object(o.createElement)("input",{disabled:!0,placeholder:m?Object(i.__)("Loading"):Object(i.__)("Invalid API Key...")})):Object(o.createElement)(Lt,{selectedItem:r||"",onChange:function(e){return u(e)},itemToString:function(e){return e?(d.find(function(t){return t.id===e})||{}).name:""}},function(e){var t=e.getInputProps,n=e.getItemProps,r=(e.getLabelProps,e.getMenuProps),a=e.isOpen,u=(e.inputValue,e.highlightedIndex),l=e.selectedItem,c=e.openMenu;return Object(o.createElement)("div",{className:"ct-select-input"},Object(o.createElement)("input",Ht({},t({onFocus:function(){return c()},onClick:function(){return c()}}),{placeholder:Object(i.__)("Select list..."),readOnly:!0})),a&&Object(o.createElement)("div",r({className:"ct-select-dropdown"}),d.map(function(e,t){return Object(o.createElement)("div",n({key:e.id,index:t,item:e.id,className:s()("ct-select-dropdown-item",{active:u===t,selected:l===e.id})}),e.name)})))})},Kt=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var Wt=function(e){var t,n,r=e.extension,a=e.isEditingCredentials,l=e.setIsEditingCredentials,c=e.onCredentialsValidated,d=Object(o.useState)(r.data.api_key),p=Kt(d,2),f=p[0],h=p[1],m=Object(o.useState)(r.data.list_id),g=Kt(m,2),v=g[0],y=g[1],b=Object(o.useState)(!1),w=Kt(b,2),x=w[0],O=w[1],S=Object(o.useState)(!1),E=Kt(S,2),I=E[0],C=E[1],A=(t=regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(t=new FormData).append("api_key",f),t.append("list_id",v),t.append("action","blocksy_ext_mailchimp_maybe_save_credentials"),O(!0),e.prev=5,e.next=8,fetch(ctDashboardLocalizations.ajax_url,{method:"POST",body:t});case 8:if(200!==(n=e.sent).status){e.next=14;break}return e.next=12,n.json();case 12:(r=e.sent).success&&"api_key_invalid"!==r.data.result&&(c(),C(!1));case 14:C(!0),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(5),C(!0);case 20:return e.next=22,new Promise(function(e){return setTimeout(function(){return e()},1e3)});case 22:O(!1);case 23:case"end":return e.stop()}},e,void 0,[[5,17]])}),n=function(){var e=t.apply(this,arguments);return new Promise(function(t,n){return function r(o,i){try{var a=e[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});t(s)}("next")})},function(){return n.apply(this,arguments)});return Object(o.createElement)(u.Transition,{items:a,config:{duration:200},from:{opacity:0,y:-10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}},function(e){return e&&function(e){return Object(o.createElement)(Ye,{style:{opacity:e.opacity},onDismiss:function(){return l(!1)}},Object(o.createElement)(Je,{style:{transform:"translate3d(0px, "+e.y+"px, 0px)"}},Object(o.createElement)("button",{className:"close-button",onClick:function(){return l(!1)}},"×"),Object(o.createElement)("div",{className:s()("ct-mailchimp-edit-credentials ct-extension-config",{"ct-key-invalid":I})},Object(o.createElement)("h1",null,Object(i.__)("MailChimp Credentials")),Object(o.createElement)("p",{dangerouslySetInnerHTML:{__html:Object(i.sprintf)(Object(i.__)("Enter your MailChimp credentials in the form below. More info on how to generate an API key can be found %s."),Object(i.sprintf)('<a target="_blank" href="https://mailchimp.com/help/about-api-keys/">%s</a>',Object(i.__)("here")))}}),Object(o.createElement)("ul",{className:"mailchimp-credentials"},Object(o.createElement)("li",null,Object(o.createElement)("label",null,Object(i.__)("API Key")),Object(o.createElement)("input",{type:"text",onChange:function(e){var t=e.target.value;return h(t)},value:f||""})),Object(o.createElement)("li",null,Object(o.createElement)("label",null,Object(i.__)("List ID")),Object(o.createElement)(Bt,{listId:v,onChange:function(e){return y(e)},apiKey:f})),Object(o.createElement)("li",null,Object(o.createElement)("button",{className:"ct-button","data-button":"blue",disabled:!f||!v||x,onClick:function(){return A()}},x?Object(i.__)("Loading..."):Object(i.__)("Activate")))))))}})},qt=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var $t=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},i=Object(o.useState)(!1),a=qt(i,2),s=a[0],u=a[1],l=Object(o.useState)(!1),c=qt(l,2),d=c[0],p=c[1],f=(t=regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new FormData).append("ext",e.name),n.append("action",e.__object?"blocksy_extension_deactivate":"blocksy_extension_activate"),u(!0),t.prev=4,t.next=7,fetch(ctDashboardLocalizations.ajax_url,{method:"POST",body:n});case 7:r(),t.next=12;break;case 10:t.prev=10,t.t0=t.catch(4);case 12:return t.next=14,new Promise(function(e){return setTimeout(function(){return e()},1e3)});case 14:u(!1);case 15:case"end":return t.stop()}},t,void 0,[[4,10]])}),n=function(){var e=t.apply(this,arguments);return new Promise(function(t,n){return function r(o,i){try{var a=e[o](i),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});t(s)}("next")})},function(){return n.apply(this,arguments)});return[s,function(){e.__object||e.data.api_key?f():p(!0)},Object(o.createElement)(o.Fragment,null,e.__object&&e.data.api_key&&Object(o.createElement)("button",{className:"ct-minimal-button ct-config-btn dashicons dashicons-admin-generic",title:"Edit Credentials",onClick:function(){return p(!0)}}),Object(o.createElement)(Wt,{isEditingCredentials:d,setIsEditingCredentials:p,extension:e,onCredentialsValidated:function(){e.__object||f(),p(!1)}}))]},zt=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Gt=function(e){var t=e.extension,n=e.onExtsSync,r=$t(t,function(){n()}),a=zt(r,3),u=a[0],l=a[1],c=a[2],d=Ze(t),p=zt(d,2),f=p[0],h=p[1];return Object(o.createElement)("li",{className:s()({active:!!t.__object})},Object(o.createElement)("h4",{className:"ct-extension-title"},t.config.name),t.config.description&&Object(o.createElement)("div",{className:"ct-extension-description"},t.config.description),Object(o.createElement)("div",{className:"ct-extension-actions"},Object(o.createElement)("button",{className:"ct-button","data-button":"white",disabled:u,onClick:function(){return l()}},u?Object(i.__)("Loading"):t.__object?Object(i.__)("Deactivate"):Object(i.__)("Activate")),c,t.readme&&Object(o.createElement)("button",{onClick:function(){return f()},"data-button":"white",className:"ct-minimal-button ct-instruction"},Object(o.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})))),h)};ctEvents.on("ct:extensions:card",function(e){var t=e.CustomComponent;"mailchimp"===e.extension.name&&(t.extension=Gt)})}]);
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t,n){e.exports=n(11)()},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.r(t),n.d(t,"default",(function(){return r}))},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.i18n},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}n.r(t),n.d(t,"default",(function(){return r}))},function(e,t,n){var r;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===i)for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(5)),i=r(n(2)),a=r(n(3)),s=r(n(15));let l=void 0,u=void 0,c=[],d=e=>"undefined"!=typeof window&&window.requestAnimationFrame(e),p=e=>"undefined"!=typeof window&&window.cancelAnimationFrame(e),f=void 0,h=()=>Date.now(),m=void 0,g=void 0;const y=(e,t)=>u={fn:e,transform:t},v=e=>c=e,b=e=>l=e,w=e=>f=e,O=e=>m=e,S=e=>g=e;var I=Object.freeze({get bugfixes(){return l},get applyAnimatedValues(){return u},get colorNames(){return c},get requestFrame(){return d},get cancelFrame(){return p},get interpolation(){return f},get now(){return h},get defaultElement(){return m},get createAnimatedStyle(){return g},injectApplyAnimatedValues:y,injectColorNames:v,injectBugfixes:b,injectInterpolation:w,injectFrame:(e,t)=>{var n=[e,t];return d=n[0],p=n[1],n},injectNow:e=>h=e,injectDefaultElement:O,injectCreateAnimatedStyle:S});class x{attach(){}detach(){}getValue(){}getAnimatedValue(){return this.getValue()}addChild(e){}removeChild(e){}getChildren(){return[]}}const j=e=>Object.keys(e).map(t=>e[t]);class E extends x{constructor(){var e;super(...arguments),e=this,this.children=[],this.getChildren=()=>this.children,this.getPayload=function(t){return void 0===t&&(t=void 0),void 0!==t&&e.payload?e.payload[t]:e.payload||e}}addChild(e){0===this.children.length&&this.attach(),this.children.push(e)}removeChild(e){const t=this.children.indexOf(e);this.children.splice(t,1),0===this.children.length&&this.detach()}}class C extends E{constructor(){super(...arguments),this.payload=[],this.getAnimatedValue=()=>this.getValue(),this.attach=()=>this.payload.forEach(e=>e instanceof x&&e.addChild(this)),this.detach=()=>this.payload.forEach(e=>e instanceof x&&e.removeChild(this))}}class k extends E{constructor(){super(...arguments),this.payload={},this.getAnimatedValue=()=>this.getValue(!0),this.attach=()=>j(this.payload).forEach(e=>e instanceof x&&e.addChild(this)),this.detach=()=>j(this.payload).forEach(e=>e instanceof x&&e.removeChild(this))}getValue(e){void 0===e&&(e=!1);const t={};for(const n in this.payload){const r=this.payload[n];(!e||r instanceof x)&&(t[n]=r instanceof x?r[e?"getAnimatedValue":"getValue"]():r)}return t}}class A extends k{constructor(e){super(),!(e=e||{}).transform||e.transform instanceof x||(e=u.transform(e)),this.payload=e}}const P={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};class _{static create(e,t,n){if("function"==typeof e)return e;if(f&&e.output&&"string"==typeof e.output[0])return f(e);if(Array.isArray(e))return _.create({range:e,output:t,extrapolate:n||"extend"});let r=e.output,o=e.range||[0,1],i=e.easing||(e=>e),a="extend",s=e.map;void 0!==e.extrapolateLeft?a=e.extrapolateLeft:void 0!==e.extrapolate&&(a=e.extrapolate);let l="extend";return void 0!==e.extrapolateRight?l=e.extrapolateRight:void 0!==e.extrapolate&&(l=e.extrapolate),e=>{let t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,o);return function(e,t,n,r,o,i,a,s,l){let u=l?l(e):e;if(u<t){if("identity"===a)return u;"clamp"===a&&(u=t)}if(u>n){if("identity"===s)return u;"clamp"===s&&(u=n)}if(r===o)return r;if(t===n)return e<=t?r:o;t===-1/0?u=-u:n===1/0?u-=t:u=(u-t)/(n-t);u=i(u),r===-1/0?u=-u:o===1/0?u+=r:u=u*(o-r)+r;return u}(e,o[t],o[t+1],r[t],r[t+1],i,a,l,s)}}}const D="[-+]?\\d*\\.?\\d+";function M(){return"\\(\\s*("+Array.prototype.slice.call(arguments).join(")\\s*,\\s*(")+")\\s*\\)"}const T=new RegExp("rgb"+M(D,D,D)),R=new RegExp("rgba"+M(D,D,D,D)),V=new RegExp("hsl"+M(D,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%")),H=new RegExp("hsla"+M(D,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%",D)),F=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,U=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,N=/^#([0-9a-fA-F]{6})$/,L=/^#([0-9a-fA-F]{8})$/;function K(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function $(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=K(o,r,e+1/3),a=K(o,r,e),s=K(o,r,e-1/3);return Math.round(255*i)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}function B(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function W(e){return(parseFloat(e)%360+360)%360/360}function q(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function z(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function G(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=N.exec(e))?parseInt(t[1]+"ff",16)>>>0:P.hasOwnProperty(e)?P[e]:(t=T.exec(e))?(B(t[1])<<24|B(t[2])<<16|B(t[3])<<8|255)>>>0:(t=R.exec(e))?(B(t[1])<<24|B(t[2])<<16|B(t[3])<<8|q(t[4]))>>>0:(t=F.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=L.exec(e))?parseInt(t[1],16)>>>0:(t=U.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=V.exec(e))?(255|$(W(t[1]),z(t[2]),z(t[3])))>>>0:(t=H.exec(e))?($(W(t[1]),z(t[2]),z(t[3]))|q(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}const Y=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,X=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,Z=new RegExp(`(${Object.keys(P).join("|")})`,"g");class J extends C{constructor(e,t,n){super(),this.getValue=()=>this.calc(...this.payload.map(e=>e.getValue())),this.updateConfig=(e,t)=>this.calc=_.create(e,t),this.interpolate=(e,t)=>new J(this,e,t),this.payload=e instanceof C&&!e.updateConfig?e.payload:Array.isArray(e)?e:[e],this.calc=_.create(t,n)}}class Q extends E{constructor(e){var t;super(),t=this,this.setValue=function(e,n){void 0===n&&(n=!0),t.value=e,n&&t.flush()},this.getValue=()=>this.value,this.updateStyles=()=>function e(t,n){"function"==typeof t.update?n.add(t):t.getChildren().forEach(t=>e(t,n))}(this,this.animatedStyles),this.updateValue=e=>this.flush(this.value=e),this.interpolate=(e,t)=>new J(this,e,t),this.value=e,this.animatedStyles=new Set,this.done=!1,this.startPosition=e,this.lastPosition=e,this.lastVelocity=void 0,this.lastTime=void 0,this.controller=void 0}flush(){0===this.animatedStyles.size&&this.updateStyles(),this.animatedStyles.forEach(e=>e.update())}prepare(e){void 0===this.controller&&(this.controller=e),this.controller===e&&(this.startPosition=this.value,this.lastPosition=this.value,this.lastVelocity=e.isActive?this.lastVelocity:void 0,this.lastTime=e.isActive?this.lastTime:void 0,this.done=!1,this.animatedStyles.clear())}}class ee extends C{constructor(e){var t;super(),t=this,this.setValue=function(e,n){void 0===n&&(n=!0),Array.isArray(e)?e.length===t.payload.length&&e.forEach((e,r)=>t.payload[r].setValue(e,n)):t.payload.forEach((r,o)=>t.payload[o].setValue(e,n))},this.getValue=()=>this.payload.map(e=>e.getValue()),this.interpolate=(e,t)=>new J(this,e,t),this.payload=e.map(e=>new Q(e))}}function te(e,t){return null==e?t:e}function ne(e){return void 0!==e?Array.isArray(e)?e:[e]:[]}function re(e,t){if(typeof e!=typeof t)return!1;if("string"==typeof e||"number"==typeof e)return e===t;let n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return void 0!==n||e===t}function oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e(...n):e}function ie(e){return Object.keys(e).map(t=>e[t])}function ae(e){const t=function(e){return e.to,e.from,e.config,e.native,e.onStart,e.onRest,e.onFrame,e.children,e.reset,e.reverse,e.force,e.immediate,e.impl,e.inject,e.delay,e.attach,e.destroyed,e.interpolateTo,e.autoStart,e.ref,o(e,["to","from","config","native","onStart","onRest","onFrame","children","reset","reverse","force","immediate","impl","inject","delay","attach","destroyed","interpolateTo","autoStart","ref"])}(e),n=Object.keys(e).reduce((n,r)=>void 0!==t[r]?n:i({},n,{[r]:e[r]}),{});return i({to:t},n)}function se(e,t){let n=t[0],r=t[1];return i({},e,{[n]:new(Array.isArray(r)?ee:Q)(r)})}function le(e){const t=e.from,n=e.to,r=e.native,o=Object.entries(i({},t,n));return r?o.reduce(se,{}):i({},t,n)}function ue(e,t){return t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e}const ce=e=>"auto"===e;let de={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0};const pe=["Webkit","Ms","Moz","O"];function fe(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||de.hasOwnProperty(e)&&de[e]?(""+t).trim():t+"px"}de=Object.keys(de).reduce((e,t)=>(pe.forEach(n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t]),e),de);const he={};S(e=>new A(e)),O("div"),w((function(e){const t=e.output.map(e=>e.replace(X,G)).map(e=>e.replace(Z,G)),n=t[0].match(Y).map(()=>[]);t.forEach(e=>{e.match(Y).forEach((e,t)=>n[t].push(+e))});const r=t[0].match(Y).map((t,r)=>_.create(i({},e,{output:n[r]})));return e=>{let n=0;return t[0].replace(Y,()=>r[n++](e)).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(e,t,n,r,o)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`)}})),v(P),b((function(e,t){const n=e.from,r=e.to,o=e.children;if(!ie(r).some(ce)&&!ie(n).some(ce))return;let l=o(le(e));if(!l)return;Array.isArray(l)&&(l={type:"div",props:{children:l}});const u=l.props.style;return a.createElement(l.type,i({key:l.key?l.key:void 0},l.props,{style:i({},u,{position:"absolute",visibility:"hidden"}),ref:o=>{if(o){let a,l,u=s.findDOMNode(o),c=getComputedStyle(u);if("border-box"===c.boxSizing)a=u.offsetWidth,l=u.offsetHeight;else{const e=parseFloat(c.paddingLeft||0)+parseFloat(c.paddingRight||0),t=parseFloat(c.paddingTop||0)+parseFloat(c.paddingBottom||0),n=parseFloat(c.borderLeftWidth||0)+parseFloat(c.borderRightWidth||0),r=parseFloat(c.borderTopWidth||0)+parseFloat(c.borderBottomWidth||0);a=u.offsetWidth-e-n,l=u.offsetHeight-t-r}const d=((e,t)=>(n,r)=>{let o=r[0],a=r[1];return i({},n,{[o]:"auto"===a?~o.indexOf("height")?t:e:a})})(a,l);t(i({},e,{from:Object.entries(n).reduce(d,n),to:Object.entries(r).reduce(d,r)}))}}}))})),y((e,t)=>{if(!e.nodeType||void 0===e.setAttribute)return!1;{const i=t.style,a=t.children,s=t.scrollTop,l=t.scrollLeft,u=o(t,["style","children","scrollTop","scrollLeft"]);void 0!==s&&(e.scrollTop=s),void 0!==l&&(e.scrollLeft=l),void 0!==a&&(e.textContent=a);for(let t in i)if(i.hasOwnProperty(t)){var n=0===t.indexOf("--"),r=fe(t,i[t],n);"float"===t&&(t="cssFloat"),n?e.style.setProperty(t,r):e.style[t]=r}for(let t in u){const n=he[t]||(he[t]=t.replace(/([A-Z])/g,e=>"-"+e.toLowerCase()));void 0!==e.getAttribute(n)&&e.setAttribute(n,u[t])}}},e=>e);let me=!1;const ge=new Set,ye=()=>{let e=h();for(let t of ge){let n=!0,r=!0;for(let o=0;o<t.configs.length;o++){let i,a,s=t.configs[o];for(let o=0;o<s.animatedValues.length;o++){let l=s.animatedValues[o];if(l.done)continue;let u=s.fromValues[o],c=s.toValues[o],d=l.lastPosition,p=c instanceof x,f=Array.isArray(s.initialVelocity)?s.initialVelocity[o]:s.initialVelocity;if(p&&(c=c.getValue()),s.immediate||!p&&!s.decay&&u===c)l.updateValue(c),l.done=!0;else if(s.delay&&e-t.startTime<s.delay)n=!1;else if(r=!1,"string"!=typeof u&&"string"!=typeof c){if(void 0!==s.duration)d=u+s.easing((e-t.startTime-s.delay)/s.duration)*(c-u),i=e>=t.startTime+s.delay+s.duration;else if(s.decay)d=u+f/(1-.998)*(1-Math.exp(-(1-.998)*(e-t.startTime))),i=Math.abs(l.lastPosition-d)<.1,i&&(c=d);else{a=void 0!==l.lastTime?l.lastTime:e,f=void 0!==l.lastVelocity?l.lastVelocity:s.initialVelocity,e>a+64&&(a=e);let t=Math.floor(e-a);for(let e=0;e<t;++e){f+=1*((-s.tension*(d-c)+-s.friction*f)/s.mass)/1e3,d+=1*f/1e3}let n=!(!s.clamp||0===s.tension)&&(u<c?d>c:d<c),r=Math.abs(f)<=s.precision,o=0===s.tension||Math.abs(c-d)<=s.precision;i=n||r&&o,l.lastVelocity=f,l.lastTime=e}p&&!s.toValues[o].done&&(i=!1),i?(l.value!==c&&(d=c),l.done=!0):n=!1,l.updateValue(d),l.lastPosition=d}else l.updateValue(c),l.done=!0}!t.props.onFrame&&t.props.native||(t.animatedProps[s.name]=s.interpolation.getValue())}!t.props.onFrame&&t.props.native||(!t.props.native&&t.onUpdate&&t.onUpdate(),t.props.onFrame&&t.props.onFrame(t.animatedProps)),n&&(ge.delete(t),t.debouncedOnEnd({finished:!0,noChange:r}))}ge.size?d(ye):me=!1},ve=e=>{ge.has(e)&&ge.delete(e)};class be{constructor(e,t){void 0===t&&(t={native:!0,interpolateTo:!0,autoStart:!0}),this.getValues=()=>this.props.native?this.interpolations:this.animatedProps,this.dependents=new Set,this.isActive=!1,this.hasChanged=!1,this.props={},this.merged={},this.animations={},this.interpolations={},this.animatedProps={},this.configs=[],this.frame=void 0,this.startTime=void 0,this.lastTime=void 0,this.update(i({},e,t))}update(e){this.props=i({},this.props,e);let t=this.props.interpolateTo?ae(this.props):this.props,n=t.from,r=void 0===n?{}:n,o=t.to,a=void 0===o?{}:o,s=t.config,l=void 0===s?{}:s,u=t.delay,d=void 0===u?0:u,p=t.reverse,f=t.attach,h=t.reset,m=t.immediate,g=t.autoStart,y=t.ref;if(p){var v=[a,r];r=v[0],a=v[1]}this.hasChanged=!1;let b=f&&f(this),w=h?{}:this.merged;if(this.merged=i({},r,w,a),this.animations=Object.entries(this.merged).reduce((e,t,n)=>{let o=t[0],a=t[1],s=!h&&e[o]||{};const u="number"==typeof a,p="string"==typeof a&&!a.startsWith("#")&&!/\d/.test(a)&&!c[a],f=!u&&!p&&Array.isArray(a);let g=void 0!==r[o]?r[o]:a,y=u||f||p?a:1,v=oe(l,o);if(b&&(y=b.animations[o].parent),void 0===v.decay&&re(s.changes,a))return e;{let t,n;if(this.hasChanged=!0,u||p)t=n=s.parent||new Q(g);else if(f)t=n=s.parent||new ee(g);else{const e=s.interpolation&&s.interpolation.calc(s.parent.value);s.parent?(t=s.parent,t.setValue(0,!1)):t=new Q(0);const r={output:[void 0!==e?e:g,a]};s.interpolation?(n=s.interpolation,s.interpolation.updateConfig(r)):n=t.interpolate(r)}oe(m,o)&&t.setValue(a,!1);const r=ne(t.getPayload());return r.forEach(e=>e.prepare(this)),i({},e,{[o]:i({},s,{name:o,parent:t,interpolation:n,animatedValues:r,changes:a,fromValues:ne(t.getValue()),toValues:ne(b?y.getPayload():y),immediate:oe(m,o),delay:te(v.delay,d||0),initialVelocity:te(v.velocity,0),clamp:te(v.clamp,!1),precision:te(v.precision,.01),tension:te(v.tension,170),friction:te(v.friction,26),mass:te(v.mass,1),duration:v.duration,easing:te(v.easing,e=>e),decay:v.decay})})}},this.animations),this.hasChanged){this.configs=ie(this.animations),this.animatedProps={},this.interpolations={};for(let e in this.animations)this.interpolations[e]=this.animations[e].interpolation,this.animatedProps[e]=this.animations[e].interpolation.getValue()}for(var O=arguments.length,S=new Array(O>1?O-1:0),I=1;I<O;I++)S[I-1]=arguments[I];y||!g&&!S.length||this.start(...S);const x=S[0],j=S[1];return this.onEnd="function"==typeof x&&x,this.onUpdate=j,this.getValues()}start(e,t){var n;return this.startTime=h(),this.isActive&&this.stop(),this.isActive=!0,this.onEnd="function"==typeof e&&e,this.onUpdate=t,this.props.onStart&&this.props.onStart(),n=this,ge.has(n)||(ge.add(n),me||d(ye),me=!0),new Promise(e=>this.resolve=e)}stop(e){void 0===e&&(e=!1),e&&ie(this.animations).forEach(e=>e.changes=void 0),this.debouncedOnEnd({finished:e})}destroy(){ve(this),this.props={},this.merged={},this.animations={},this.interpolations={},this.animatedProps={},this.configs=[]}debouncedOnEnd(e){ve(this),this.isActive=!1;const t=this.onEnd;this.onEnd=null,t&&t(e),this.resolve&&this.resolve(),this.resolve=null}}class we extends k{constructor(e,t){super(),e.style&&(e=i({},e,{style:g(e.style)})),this.payload=e,this.update=t,this.attach()}}function Oe(e){class t extends a.Component{constructor(e){super(),this.callback=()=>{if(this.node){!1===u.fn(this.node,this.propsAnimated.getAnimatedValue(),this)&&this.forceUpdate()}},this.attachProps(e)}componentWillUnmount(){this.propsAnimated&&this.propsAnimated.detach()}setNativeProps(e){!1===u.fn(this.node,e,this)&&this.forceUpdate()}attachProps(e){e.forwardRef;let t=o(e,["forwardRef"]);const n=this.propsAnimated;this.propsAnimated=new we(t,this.callback),n&&n.detach()}shouldComponentUpdate(e){const t=e.style,n=o(e,["style"]),r=this.props,i=r.style;return(!re(o(r,["style"]),n)||!re(i,t))&&(this.attachProps(e),!0)}render(){const t=this.propsAnimated.getValue(),n=(t.scrollTop,t.scrollLeft,o(t,["scrollTop","scrollLeft"]));return a.createElement(e,i({},n,{ref:e=>this.node=ue(e,this.props.forwardRef)}))}}return a.forwardRef((e,n)=>a.createElement(t,i({},e,{forwardRef:n})))}const Se={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};class Ie extends a.Component{constructor(){super(...arguments),this.state={lastProps:{from:{},to:{}},propsChanged:!1,internal:!1},this.controller=new be(null,null),this.didUpdate=!1,this.didInject=!1,this.finished=!0,this.start=()=>{this.finished=!1;let e=this.mounted;this.controller.start(t=>this.finish(i({},t,{wasMounted:e})),this.update)},this.stop=()=>this.controller.stop(!0),this.update=()=>this.mounted&&this.setState({internal:!0}),this.finish=e=>{let t=e.finished,n=e.noChange,r=e.wasMounted;this.finished=!0,this.mounted&&t&&(!this.props.onRest||!r&&n||this.props.onRest(this.controller.merged),this.mounted&&this.didInject&&(this.afterInject=le(this.props),this.setState({internal:!0})),this.mounted&&(this.didInject||this.props.after)&&this.setState({internal:!0}),this.didInject=!1)}}componentDidMount(){this.componentDidUpdate(),this.mounted=!0}componentWillUnmount(){this.mounted=!1,this.stop()}static getDerivedStateFromProps(e,t){let n=t.internal,r=t.lastProps;const o=e.from,i=e.to,a=e.reset,s=e.force;return{propsChanged:!re(i,r.to)||!re(o,r.from)||a&&!n||s&&!n,lastProps:e,internal:!1}}render(){const e=this.props.children,t=this.state.propsChanged;if(this.props.inject&&t&&!this.injectProps){const e=this.props.inject(this.props,e=>{this.injectProps=e,this.setState({internal:!0})});if(e)return e}(this.injectProps||t)&&(this.didInject=!1,this.injectProps?(this.controller.update(this.injectProps),this.didInject=!0):t&&this.controller.update(this.props),this.didUpdate=!0,this.afterInject=void 0,this.injectProps=void 0);let n=i({},this.controller.getValues(),this.afterInject);return this.finished&&(n=i({},n,this.props.after)),Object.keys(n).length?e(n):null}componentDidUpdate(){this.didUpdate&&this.start(),this.didUpdate=!1}}Ie.defaultProps={from:{},to:{},config:Se.default,native:!1,immediate:!1,reset:!1,force:!1,inject:l};class xe extends a.PureComponent{constructor(){super(...arguments),this.first=!0,this.instances=new Set,this.hook=(e,t,n,r)=>(this.instances.add(e),(r?t===n-1:0===t)?void 0:Array.from(this.instances)[r?t+1:t-1])}render(){const e=this.props,t=e.items,n=e.children,r=e.from,s=void 0===r?{}:r,l=e.initial,u=e.reverse,c=e.keys,d=e.delay,p=e.onRest,f=o(e,["items","children","from","initial","reverse","keys","delay","onRest"]),h=ne(t);return ne(h).map((e,t)=>a.createElement(Ie,i({onRest:0===t?p:null,key:"function"==typeof c?c(e):ne(c)[t],from:this.first&&void 0!==l?l||{}:s},f,{delay:0===t&&d||void 0,attach:e=>this.hook(e,t,h.length,u),children:r=>{const o=n(e,t);return o?o(r):null}})))}componentDidUpdate(e){this.first=!1,e.items!==this.props.items&&this.instances.clear()}}xe.defaultProps={keys:e=>e};class je extends a.PureComponent{constructor(){var e;super(...arguments),e=this,this.guid=0,this.state={props:{},resolve:()=>null,last:!0,index:0},this.next=function(t,n,r){return void 0===n&&(n=!0),void 0===r&&(r=0),e.running=!0,new Promise(o=>{e.mounted&&e.setState(e=>({props:t,resolve:o,last:n,index:r}),()=>e.running=!1)})}}componentDidMount(){this.mounted=!0,this.componentDidUpdate({})}componentWillUnmount(){this.mounted=!1}componentDidUpdate(e){var t=this;const n=this.props,r=n.states,o=n.filter,i=n.state;if((e.state!==this.props.state||this.props.reset&&!this.running||!re(r[i],e.states[e.state]))&&r&&i&&r[i]){const e=++this.guid,n=r[i];if(n)if(Array.isArray(n)){let t=Promise.resolve();for(let r=0;r<n.length;r++){let i=r,a=n[i],s=i===n.length-1;t=t.then(()=>e===this.guid&&this.next(o(a),s,i))}}else if("function"==typeof n){let r=0;n((function(n,i){return void 0===i&&(i=!1),e===t.guid&&t.next(o(n),i,r++)}),()=>d(()=>this.instance&&this.instance.stop()),this.props)}else this.next(o(r[i]))}}render(){const e=this.state,t=e.props,n=e.resolve,r=e.last,s=e.index;if(!t||0===Object.keys(t).length)return null;let l=this.props,u=(l.state,l.filter,l.states,l.config),c=l.primitive,d=l.onRest,p=l.forwardRef,f=o(l,["state","filter","states","config","primitive","onRest","forwardRef"]);return Array.isArray(u)&&(u=u[s]),a.createElement(c,i({ref:e=>this.instance=ue(e,p),config:u},f,t,{onRest:e=>{n(e),d&&r&&d(e)}}))}}je.defaultProps={state:"__default"};const Ee=a.forwardRef((e,t)=>a.createElement(je,i({},e,{forwardRef:t})));Ee.create=e=>function(t,n){return void 0===n&&(n=e=>e),("function"==typeof t||Array.isArray(t))&&(t={__default:t}),r=>a.createElement(je,i({primitive:e,states:t,filter:n},r))},Ee.Spring=e=>Ee.create(Ie)(e,ae),Ee.Trail=e=>Ee.create(xe)(e,ae);let Ce=0,ke=e=>{let t=e.items,n=e.keys,r=o(e,["items","keys"]);return t=ne(void 0!==t?t:null),n="function"==typeof n?t.map(n):ne(n),i({items:t,keys:n.map(e=>String(e))},r)};class Ae extends a.PureComponent{componentDidMount(){this.mounted=!0}componentWillUnmount(){this.mounted=!1}constructor(e){super(e),this.destroyItem=(e,t,n)=>r=>{const o=this.props,i=o.onRest,a=o.onDestroyed;this.mounted&&(a&&a(e),this.setState(e=>({deleted:e.deleted.filter(e=>e.key!==t)})),i&&i(e,n,r))},this.state={first:!0,transitions:[],current:{},deleted:[],prevProps:e}}static getDerivedStateFromProps(e,t){let n=t.first,r=t.prevProps,a=o(t,["first","prevProps"]),s=ke(e),l=s.items,u=s.keys,c=s.initial,d=s.from,p=s.enter,f=s.leave,h=s.update,m=s.trail,g=void 0===m?0:m,y=s.unique,v=s.config,b=ke(r),w=b.keys,O=b.items,S=i({},a.current),I=[...a.deleted],x=Object.keys(S),j=new Set(x),E=new Set(u),C=u.filter(e=>!j.has(e)),k=a.transitions.filter(e=>!e.destroyed&&!E.has(e.originalKey)).map(e=>e.originalKey),A=u.filter(e=>j.has(e)),P=0;C.forEach(e=>{y&&I.find(t=>t.originalKey===e)&&(I=I.filter(t=>t.originalKey!==e));const t=u.indexOf(e),r=l[t];S[e]={state:"enter",originalKey:e,key:y?String(e):Ce++,item:r,trail:P+=g,config:oe(v,r,"enter"),from:oe(n&&void 0!==c?c||{}:d,r),to:oe(p,r)}}),k.forEach(e=>{const t=w.indexOf(e),n=O[t];I.push(i({},S[e],{state:"leave",destroyed:!0,left:w[Math.max(0,t-1)],right:w[Math.min(w.length,t+1)],trail:P+=g,config:oe(v,n,"leave"),to:oe(f,n)})),delete S[e]}),A.forEach(e=>{const t=u.indexOf(e),n=l[t];S[e]=i({},S[e],{item:n,state:"update",trail:P+=g,config:oe(v,n,"update"),to:oe(h,n)})});let _=u.map(e=>S[e]);return I.forEach(e=>{let t,n=e.left,r=e.right,i=o(e,["left","right"]);-1!==(t=_.findIndex(e=>e.originalKey===n))&&(t+=1),-1===t&&(t=_.findIndex(e=>e.originalKey===r)),-1===t&&(t=I.findIndex(e=>e.originalKey===n)),-1===t&&(t=I.findIndex(e=>e.originalKey===r)),t=Math.max(0,t),_=[..._.slice(0,t),i,..._.slice(t)]}),{first:n&&0===C.length,transitions:_,current:S,deleted:I,prevProps:e}}render(){const e=this.props,t=(e.initial,e.from,e.enter,e.leave,e.update,e.onDestroyed,e.keys,e.items,e.onFrame),n=e.onRest,r=e.onStart,s=(e.trail,e.config,e.children),l=(e.unique,e.reset),u=o(e,["initial","from","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","trail","config","children","unique","reset"]);return this.state.transitions.map((e,o)=>{let c=e.state,d=e.key,p=e.item,f=e.from,h=e.to,m=e.trail,g=e.config,y=e.destroyed;return a.createElement(Ee,i({reset:l&&"enter"===c,primitive:Ie,state:c,filter:ae,states:{[c]:h},key:d,onRest:y?this.destroyItem(p,d,c):n&&(e=>n(p,c,e)),onStart:r&&(()=>r(p,c)),onFrame:t&&(e=>t(p,c,e)),delay:m,config:g},u,{from:f,children:e=>{const t=s(p,c,o);return t?t(e):null}}))})}}Ae.defaultProps={keys:e=>e,unique:!1,reset:!1};const Pe=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].reduce((e,t)=>(e[t]=Oe(t),e),Oe);t.Spring=Ie,t.Keyframes=Ee,t.Transition=Ae,t.Trail=xe,t.Controller=be,t.config=Se,t.animated=Pe,t.interpolate=(e,t,n)=>e&&new J(e,t,n),t.Globals=I},function(e,t,n){"use strict";e.exports=n(16)},function(e,t){e.exports=ctEvents},function(e,t,n){var r,o,i=n(13),a=n(14),s=(o=[],{activateTrap:function(e){if(o.length>0){var t=o[o.length-1];t!==e&&t.pause()}var n=o.indexOf(e);-1===n||o.splice(n,1),o.push(e)},deactivateTrap:function(e){var t=o.indexOf(e);-1!==t&&o.splice(t,1),o.length>0&&o[o.length-1].unpause()}});function l(e){return setTimeout(e,0)}e.exports=function(e,t){var n=document,o="string"==typeof e?n.querySelector(e):e,u=a({returnFocusOnDeactivate:!0,escapeDeactivates:!0},t),c={firstTabbableNode:null,lastTabbableNode:null,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1},d={activate:function(e){if(c.active)return;O(),c.active=!0,c.paused=!1,c.nodeFocusedBeforeActivation=n.activeElement;var t=e&&e.onActivate?e.onActivate:u.onActivate;t&&t();return f(),d},deactivate:p,pause:function(){if(c.paused||!c.active)return;c.paused=!0,h()},unpause:function(){if(!c.paused||!c.active)return;c.paused=!1,O(),f()}};return d;function p(e){if(c.active){clearTimeout(r),h(),c.active=!1,c.paused=!1,s.deactivateTrap(d);var t=e&&void 0!==e.onDeactivate?e.onDeactivate:u.onDeactivate;return t&&t(),(e&&void 0!==e.returnFocus?e.returnFocus:u.returnFocusOnDeactivate)&&l((function(){var e;S((e=c.nodeFocusedBeforeActivation,m("setReturnFocus")||e))})),d}}function f(){if(c.active)return s.activateTrap(d),r=l((function(){S(g())})),n.addEventListener("focusin",v,!0),n.addEventListener("mousedown",y,{capture:!0,passive:!1}),n.addEventListener("touchstart",y,{capture:!0,passive:!1}),n.addEventListener("click",w,{capture:!0,passive:!1}),n.addEventListener("keydown",b,{capture:!0,passive:!1}),d}function h(){if(c.active)return n.removeEventListener("focusin",v,!0),n.removeEventListener("mousedown",y,!0),n.removeEventListener("touchstart",y,!0),n.removeEventListener("click",w,!0),n.removeEventListener("keydown",b,!0),d}function m(e){var t=u[e],r=t;if(!t)return null;if("string"==typeof t&&!(r=n.querySelector(t)))throw new Error("`"+e+"` refers to no known node");if("function"==typeof t&&!(r=t()))throw new Error("`"+e+"` did not return a node");return r}function g(){var e;if(!(e=null!==m("initialFocus")?m("initialFocus"):o.contains(n.activeElement)?n.activeElement:c.firstTabbableNode||m("fallbackFocus")))throw new Error("Your focus-trap needs to have at least one focusable element");return e}function y(e){o.contains(e.target)||(u.clickOutsideDeactivates?p({returnFocus:!i.isFocusable(e.target)}):u.allowOutsideClick&&u.allowOutsideClick(e)||e.preventDefault())}function v(e){o.contains(e.target)||e.target instanceof Document||(e.stopImmediatePropagation(),S(c.mostRecentlyFocusedNode||g()))}function b(e){if(!1!==u.escapeDeactivates&&function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e))return e.preventDefault(),void p();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){if(O(),e.shiftKey&&e.target===c.firstTabbableNode)return e.preventDefault(),void S(c.lastTabbableNode);if(!e.shiftKey&&e.target===c.lastTabbableNode)e.preventDefault(),S(c.firstTabbableNode)}(e)}function w(e){u.clickOutsideDeactivates||o.contains(e.target)||u.allowOutsideClick&&u.allowOutsideClick(e)||(e.preventDefault(),e.stopImmediatePropagation())}function O(){var e=i(o);c.firstTabbableNode=e[0]||g(),c.lastTabbableNode=e[e.length-1]||g()}function S(e){e!==n.activeElement&&(e&&e.focus?(e.focus(),c.mostRecentlyFocusedNode=e,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(e)&&e.select()):S(g()))}}},function(e,t,n){"use strict";var r=n(12);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])'],r=n.join(","),o="undefined"==typeof Element?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector;function i(e,t){t=t||{};var n,i,s,l=[],d=[],p=e.querySelectorAll(r);for(t.includeContainer&&o.call(e,r)&&(p=Array.prototype.slice.apply(p)).unshift(e),n=0;n<p.length;n++)a(i=p[n])&&(0===(s=u(i))?l.push(i):d.push({documentOrder:n,tabIndex:s,node:i}));return d.sort(c).map((function(e){return e.node})).concat(l)}function a(e){return!(!s(e)||function(e){return function(e){return d(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t=function(e){for(var t=0;t<e.length;t++)if(e[t].checked)return e[t]}(e.ownerDocument.querySelectorAll('input[type="radio"][name="'+e.name+'"]'));return!t||t===e}(e)}(e)||u(e)<0)}function s(e){return!(e.disabled||function(e){return d(e)&&"hidden"===e.type}(e)||function(e){return null===e.offsetParent||"hidden"===getComputedStyle(e).visibility}(e))}i.isTabbable=function(e){if(!e)throw new Error("No node provided");return!1!==o.call(e,r)&&a(e)},i.isFocusable=function(e){if(!e)throw new Error("No node provided");return!1!==o.call(e,l)&&s(e)};var l=n.concat("iframe").join(",");function u(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?function(e){return"true"===e.contentEditable}(e)?0:e.tabIndex:t}function c(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex}function d(e){return"INPUT"===e.tagName}e.exports=i},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t){e.exports=window.ReactDOM},function(e,t,n){"use strict";
|
7 |
+
/** @license React v16.13.1
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
* react-is.production.min.js
|
9 |
*
|
10 |
* Copyright (c) Facebook, Inc. and its affiliates.
|
11 |
*
|
12 |
* This source code is licensed under the MIT license found in the
|
13 |
* LICENSE file in the root directory of this source tree.
|
14 |
+
*/var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,l=r?Symbol.for("react.profiler"):60114,u=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,d=r?Symbol.for("react.async_mode"):60111,p=r?Symbol.for("react.concurrent_mode"):60111,f=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,v=r?Symbol.for("react.block"):60121,b=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,O=r?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case d:case p:case a:case l:case s:case h:return e;default:switch(e=e&&e.$$typeof){case c:case f:case y:case g:case u:return e;default:return t}}case i:return t}}}function I(e){return S(e)===p}t.AsyncMode=d,t.ConcurrentMode=p,t.ContextConsumer=c,t.ContextProvider=u,t.Element=o,t.ForwardRef=f,t.Fragment=a,t.Lazy=y,t.Memo=g,t.Portal=i,t.Profiler=l,t.StrictMode=s,t.Suspense=h,t.isAsyncMode=function(e){return I(e)||S(e)===d},t.isConcurrentMode=I,t.isContextConsumer=function(e){return S(e)===c},t.isContextProvider=function(e){return S(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return S(e)===f},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===y},t.isMemo=function(e){return S(e)===g},t.isPortal=function(e){return S(e)===i},t.isProfiler=function(e){return S(e)===l},t.isStrictMode=function(e){return S(e)===s},t.isSuspense=function(e){return S(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===l||e===s||e===h||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===u||e.$$typeof===c||e.$$typeof===f||e.$$typeof===b||e.$$typeof===w||e.$$typeof===O||e.$$typeof===v)},t.typeOf=S},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(9),i=n.n(o),a=n(4),s=n(6),l=n.n(s),u=n(3),c=n.n(u),d=n(1),p=n.n(d);function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var m=function(e){e.initialState,e.getInitialState,e.refs,e.getRefs,e.didMount,e.didUpdate,e.willUnmount,e.getSnapshotBeforeUpdate,e.shouldUpdate,e.render;return function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["initialState","getInitialState","refs","getRefs","didMount","didUpdate","willUnmount","getSnapshotBeforeUpdate","shouldUpdate","render"])},g=function(e){function t(){var n,r;f(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=h(this,e.call.apply(e,[this].concat(i))),y.call(r),h(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.getArgs=function(){var e=this.state,t=this.props,n=this._setState,r=this._forceUpdate,o=this._refs;return{state:e,props:m(t),refs:o,setState:n,forceUpdate:r}},t.prototype.componentDidMount=function(){this.props.didMount&&this.props.didMount(this.getArgs())},t.prototype.shouldComponentUpdate=function(e,t){return!this.props.shouldUpdate||this.props.shouldUpdate({props:this.props,state:this.state,nextProps:m(e),nextState:t})},t.prototype.componentWillUnmount=function(){this.props.willUnmount&&this.props.willUnmount({state:this.state,props:m(this.props),refs:this._refs})},t.prototype.componentDidUpdate=function(e,t,n){this.props.didUpdate&&this.props.didUpdate(Object.assign(this.getArgs(),{prevProps:m(e),prevState:t}),n)},t.prototype.getSnapshotBeforeUpdate=function(e,t){return this.props.getSnapshotBeforeUpdate?this.props.getSnapshotBeforeUpdate(Object.assign(this.getArgs(),{prevProps:m(e),prevState:t})):null},t.prototype.render=function(){var e=this.props,t=e.children,n=e.render;return n?n(this.getArgs()):"function"==typeof t?t(this.getArgs()):t||null},t}(c.a.Component);g.defaultProps={getInitialState:function(){},getRefs:function(){return{}}};var y=function(){var e=this;this.state=this.props.initialState||this.props.getInitialState(this.props),this._refs=this.props.refs||this.props.getRefs(this.getArgs()),this._setState=function(){return e.setState.apply(e,arguments)},this._forceUpdate=function(){return e.forceUpdate.apply(e,arguments)}},v=g,b=function(e){var t=e.children,n=e.container,o=void 0===n?document.body:n,i=e.type,a=void 0===i?"reach-portal":i;return Object(r.createElement)(v,{getRefs:function(){return{node:null}},didMount:function(e){var t=e.refs,n=e.forceUpdate,r=o.hasOwnProperty("current")?o.current:o;t.node=document.createElement(a),r.appendChild(t.node),n()},willUnmount:function(e){var t=e.refs.node,n=o.hasOwnProperty("current")?o.current:o;n&&n.removeChild(t)},render:function(e){var n=e.refs.node;return n?Object(r.createPortal)(t,n):null}})};var w=function(e,t){return function(n){if(e&&e(n),!n.defaultPrevented)return t(n)}},O=n(10),S=n.n(O);function I(){return(I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var j=function(){},E=function(){},C=function(e,t){var n,r,o;e.disposeAriaHider=(n=e.overlayNode,r=[],o=[],Array.prototype.forEach.call(document.querySelectorAll("body > *"),(function(e){if(e!==n.parentNode){var t=e.getAttribute("aria-hidden");null!==t&&"false"!==t||(r.push(t),o.push(e),e.setAttribute("aria-hidden","true"))}})),function(){o.forEach((function(e,t){var n=r[t];null===n?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n)}))}),e.trap=S()(e.overlayNode,{initialFocus:t?function(){return t.current}:void 0,fallbackFocus:e.contentNode,escapeDeactivates:!1,clickOutsideDeactivates:!1})},k=function(e){var t=e.refs;t.trap.deactivate(),t.disposeAriaHider()},A=React.createContext(),P=React.forwardRef((function(e,t){var n=e.container,o=e.isOpen,i=void 0===o||o,a=e.onDismiss,s=void 0===a?j:a,l=e.initialFocusRef,u=e.onClick,c=e.onKeyDown,d=x(e,["container","isOpen","onDismiss","initialFocusRef","onClick","onKeyDown"]);return Object(r.createElement)(v,{didMount:E},i?Object(r.createElement)(b,{container:n,"data-reach-dialog-wrapper":!0},Object(r.createElement)(v,{refs:{overlayNode:null,contentNode:null},didMount:function(e){var t=e.refs;C(t,l)},willUnmount:k},(function(e){var n=e.refs;return Object(r.createElement)(A.Provider,{value:function(e){return n.contentNode=e}},Object(r.createElement)("div",I({"data-reach-dialog-overlay":!0,onClick:w(u,(function(e){e.stopPropagation(),s()})),onKeyDown:w(c,(function(e){"Escape"===e.key&&(e.stopPropagation(),s())})),ref:function(e){n.overlayNode=e,t&&t(e)}},d)))}))):null)}));P.propTypes={initialFocusRef:function(){}};var _=function(e){return e.stopPropagation()},D=React.forwardRef((function(e,t){var n=e.onClick,o=(e.onKeyDown,x(e,["onClick","onKeyDown"]));return Object(r.createElement)(A.Consumer,null,(function(e){return Object(r.createElement)("div",I({"aria-modal":"true","data-reach-dialog-content":!0,tabIndex:"-1",onClick:w(n,_),ref:function(n){e(n),t&&t(n)}},o))}))})),M=n(7),T=function(e){return!!e},R=function(e){var t=e.items,n=e.isVisible,o=void 0===n?T:n,i=e.render,a=e.className,s=e.onDismiss;return Object(r.createElement)(M.Transition,{items:t,onStart:function(){return document.body.classList[o(t)?"add":"remove"]("ct-dashboard-overlay-open")},config:{duration:200},from:{opacity:0,y:-10},enter:{opacity:1,y:0},leave:{opacity:0,y:10}},(function(e){return o(e)&&function(t){return Object(r.createElement)(P,{style:{opacity:t.opacity},container:document.querySelector("#wpbody"),onDismiss:function(){return s()}},Object(r.createElement)(D,{className:l()("ct-admin-modal",a),style:{transform:"translate3d(0px, ".concat(t.y,"px, 0px)")}},Object(r.createElement)("button",{className:"close-button",onClick:function(){return s()}},"×"),i(e,t)))}}))};function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return H(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var F=function(e){var t=V(Object(r.useState)(!1),2),n=t[0],o=t[1];return[function(){return o(!0)},Object(r.createElement)(R,{items:n,onDismiss:function(){return o(!1)},render:function(){return Object(r.createElement)("div",{className:"ct-modal-content",dangerouslySetInnerHTML:{__html:e.readme}})}})]},U=n(5),N=n(2);function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n(8);function K(e){return null!=e&&"object"==typeof e&&1===e.nodeType}function $(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function B(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return $(n.overflowY,t)||$(n.overflowX,t)||function(e){var t=function(e){return e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView.frameElement:null}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function W(e,t,n,r,o,i,a,s){return i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0}var q=0;function z(e){return"function"==typeof e?e:G}function G(){}function Y(e,t){null!==e&&function(e,t){var n=t.scrollMode,r=t.block,o=t.inline,i=t.boundary,a=t.skipOverflowHiddenElements,s="function"==typeof i?i:function(e){return e!==i};if(!K(e))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,u=[],c=e;K(c)&&s(c);){if((c=c.parentNode)===l){u.push(c);break}c===document.body&&B(c)&&!B(document.documentElement)||B(c,a)&&u.push(c)}for(var d=window.visualViewport?visualViewport.width:innerWidth,p=window.visualViewport?visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,m=e.getBoundingClientRect(),g=m.height,y=m.width,v=m.top,b=m.right,w=m.bottom,O=m.left,S="start"===r||"nearest"===r?v:"end"===r?w:v+g/2,I="center"===o?O+y/2:"end"===o?b:O,x=[],j=0;j<u.length;j++){var E=u[j],C=E.getBoundingClientRect(),k=C.height,A=C.width,P=C.top,_=C.right,D=C.bottom,M=C.left;if("if-needed"===n&&v>=0&&O>=0&&w<=p&&b<=d&&v>=P&&w<=D&&O>=M&&b<=_)return x;var T=getComputedStyle(E),R=parseInt(T.borderLeftWidth,10),V=parseInt(T.borderTopWidth,10),H=parseInt(T.borderRightWidth,10),F=parseInt(T.borderBottomWidth,10),U=0,N=0,L="offsetWidth"in E?E.offsetWidth-E.clientWidth-R-H:0,$="offsetHeight"in E?E.offsetHeight-E.clientHeight-V-F:0;if(l===E)U="start"===r?S:"end"===r?S-p:"nearest"===r?W(h,h+p,p,V,F,h+S,h+S+g,g):S-p/2,N="start"===o?I:"center"===o?I-d/2:"end"===o?I-d:W(f,f+d,d,R,H,f+I,f+I+y,y),U=Math.max(0,U+h),N=Math.max(0,N+f);else{U="start"===r?S-P-V:"end"===r?S-D+F+$:"nearest"===r?W(P,D,k,V,F+$,S,S+g,g):S-(P+k/2)+$/2,N="start"===o?I-M-R:"center"===o?I-(M+A/2)+L/2:"end"===o?I-_+H+L:W(M,_,A,R,H+L,I,I+y,y);var q=E.scrollLeft,z=E.scrollTop;S+=z-(U=Math.max(0,Math.min(z+U,E.scrollHeight-k+$))),I+=q-(N=Math.max(0,Math.min(q+N,E.scrollWidth-A+L)))}x.push({el:E,top:U,left:N})}return x}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function X(e,t){return e===t||e.contains&&e.contains(t)}function Z(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function ee(e){var t=e.isOpen,n=e.selectedItem,r=e.resultCount,o=e.previousResultCount,i=e.itemToString;return t?r?r!==o?r+" result"+(1===r?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":n?i(n):""}function te(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function ne(e){return"string"==typeof e.type}function re(e){return e.props}var oe=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ie(e){void 0===e&&(e={});var t={};return oe.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function ae(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function se(e,t,n){var r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);var o=t+e;return o<0?o=r:o>r&&(o=0),o}var le=Z((function(){ce().textContent=""}),500);function ue(e,t){var n=ce(t);e&&(n.textContent=e,le())}function ce(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var de=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),pe=function(){var e=function(e){var t,n;function r(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+String(q++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=ie(t),n.internalSetState(Object(N.default)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=ie(t),n.internalSetState(Object(N.default)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},a="function"==typeof e;return!a&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(N.default)({},n.getStateAndHelpers(),{},e)),n.setState((function(t){t=n.getState(t);var s=a?e(t):e;s=n.props.stateReducer(t,s),r=s.hasOwnProperty("selectedItem");var l={},u={};return r&&s.selectedItem!==t.selectedItem&&(o=s.selectedItem),s.type=s.type||0,Object.keys(s).forEach((function(e){t[e]!==s[e]&&(i[e]=s[e]),"type"!==e&&(u[e]=s[e],n.isControlledProp(e)||(l[e]=s[e]))})),a&&s.hasOwnProperty("inputValue")&&n.props.onInputValueChange(s.inputValue,Object(N.default)({},n.getStateAndHelpers(),{},s)),l}),(function(){z(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,s=o.ref,l=Object(U.default)(o,["refKey","ref"]),u=(void 0===t?{}:t).suppressRefError,c=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=c;var d=n.getState().isOpen;return Object(N.default)(((r={})[a]=Q(s,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),l)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();e>0&&t.setHighlightedIndex(se(1,t.getState().highlightedIndex,e),{type:4})}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();e>0&&t.setHighlightedIndex(se(-1,t.getState().highlightedIndex,e),{type:4})}))},Enter:function(e){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape:function(e){e.preventDefault(),this.reset({type:5,selectedItem:null,inputValue:""})}},n.buttonKeyDownHandlers=Object(N.default)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(N.default)({},n.keyDownHandlers,{Home:function(e){this.highlightFirstOrLastIndex(e,!0,{type:7})},End:function(e){this.highlightFirstOrLastIndex(e,!1,{type:8})}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick,o=(t.onPress,t.onKeyDown),i=t.onKeyUp,a=t.onBlur,s=Object(U.default)(t,["onClick","onPress","onKeyDown","onKeyUp","onBlur"]),l=n.getState().isOpen,u={onClick:J(r,n.buttonHandleClick),onKeyDown:J(o,n.buttonHandleKeyDown),onKeyUp:J(i,n.buttonHandleKeyUp),onBlur:J(a,n.buttonHandleBlur)},c=s.disabled?{}:u;return Object(N.default)({type:"button",role:"button","aria-label":l?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},c,{},s)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=ae(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(L(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(N.default)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,a=t.onInput,s=(t.onChangeText,Object(U.default)(t,["onKeyDown","onBlur","onChange","onInput","onChangeText"])),l={};var u,c=n.getState(),d=c.inputValue,p=c.isOpen,f=c.highlightedIndex;s.disabled||((u={}).onChange=J(i,a,n.inputHandleChange),u.onKeyDown=J(r,n.inputHandleKeyDown),u.onBlur=J(o,n.inputHandleBlur),l=u);return Object(N.default)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},l,{},s)},n.inputHandleKeyDown=function(e){var t=ae(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(L(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,s=o.ref,l=Object(U.default)(o,["refKey","ref"]),u=(void 0===t?{}:t).suppressRefError,c=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=c,Object(N.default)(((r={})[a]=Q(s,n.menuRef),r.role="listbox",r["aria-labelledby"]=l&&l["aria-label"]?null:n.labelId,r.id=n.menuId,r),l)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,a=r.onClick,s=(r.onPress,r.index),l=r.item,u=void 0===l?void 0:l,c=Object(U.default)(r,["onMouseMove","onMouseDown","onClick","onPress","index","item"]);void 0===s?(n.items.push(u),s=n.items.indexOf(u)):n.items[s]=u;var d=a,p=((t={onMouseMove:J(o,(function(){s!==n.getState().highlightedIndex&&(n.setHighlightedIndex(s,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:J(i,(function(e){e.preventDefault()}))}).onClick=J(d,(function(){n.selectItemAtIndex(s,{type:9})})),t),f=c.disabled?{onMouseDown:p.onMouseDown}:p;return Object(N.default)({id:n.getItemId(s),role:"option","aria-selected":n.getState().highlightedIndex===s},f,{},c)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=ie(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(N.default)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=ie(e),n.internalSetState((function(t){var r=t.isOpen;return Object(N.default)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},{},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),z(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=Z((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(N.default)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,ue(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,a=void 0===i?o:i,s=r.defaultIsOpen,l=r.initialIsOpen,u=void 0===l?s:l,c=r.initialInputValue,d=void 0===c?"":c,p=r.initialSelectedItem,f=void 0===p?null:p,h=n.getState({highlightedIndex:a,isOpen:u,inputValue:d,selectedItem:f});return null!=h.selectedItem&&void 0===n.props.initialInputValue&&(h.inputValue=n.props.itemToString(h.selectedItem)),n.state=h,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){var t=this;return void 0===e&&(e=this.state),Object.keys(e).reduce((function(n,r){return n[r]=t.isControlledProp(r)?t.props[r]:e[r],n}),{})},o.isControlledProp=function(e){return void 0!==this.props[e]},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this.getItemCount();if(n>0){var r=se(e,this.getState().highlightedIndex,n);this.setHighlightedIndex(r,t)}},o.highlightFirstOrLastIndex=function(e,t,n){var r=this.getItemCount()-1;r<0||!this.getState().isOpen||(e.preventDefault(),this.setHighlightedIndex(t?0:r,n))},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,a=this.id,s=this.getRootProps,l=this.getToggleButtonProps,u=this.getLabelProps,c=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,h=this.closeMenu,m=this.toggleMenu,g=this.selectItem,y=this.selectItemAtIndex,v=this.selectHighlightedItem,b=this.setHighlightedIndex,w=this.clearSelection,O=this.clearItems;return{getRootProps:s,getToggleButtonProps:l,getLabelProps:u,getMenuProps:c,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:h,toggleMenu:m,selectItem:g,selectItemAtIndex:y,selectHighlightedItem:v,setHighlightedIndex:b,clearSelection:w,clearItems:O,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:a,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this;var t=function(t,n){void 0===n&&(n=!0);var r=e.props.environment.document;return[e._rootNode,e._menuNode].some((function(e){return e&&(X(e,t)||n&&X(e,r.activeElement))}))},n=function(){e.isMouseDown=!0},r=function(n){e.isMouseDown=!1,!t(n.target)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},o=function(){e.isTouchMove=!1},i=function(){e.isTouchMove=!0},a=function(n){var r=t(n.target,!1);e.isTouchMove||r||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},s=this.props.environment;s.addEventListener("mousedown",n),s.addEventListener("mouseup",r),s.addEventListener("touchstart",o),s.addEventListener("touchmove",i),s.addEventListener("touchend",a),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),s.removeEventListener("mousedown",n),s.removeEventListener("mouseup",r),s.removeEventListener("touchstart",o),s.removeEventListener("touchmove",i),s.removeEventListener("touchend",a)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=te(this.props.children,G);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=te(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:ne(t)?Object(u.cloneElement)(t,this.getRootProps(re(t))):void 0:null},r}(u.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:ee,itemToString:function(e){return null==e?"":String(e)},onStateChange:G,onInputValueChange:G,onUserAction:G,onChange:G,onSelect:G,onOuterClick:G,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:Y},e.stateChangeTypes=de,e}();p.a.array.isRequired,p.a.func,p.a.func,p.a.func,p.a.bool,p.a.number,p.a.number,p.a.number,p.a.bool,p.a.bool,p.a.bool,p.a.any,p.a.any,p.a.any,p.a.string,p.a.string,p.a.string,p.a.func,p.a.string,p.a.func,p.a.func,p.a.func,p.a.func,p.a.func,p.a.shape({addEventListener:p.a.func,removeEventListener:p.a.func,document:p.a.shape({getElementById:p.a.func,activeElement:p.a.any,body:p.a.any})});"undefined"==typeof window||window;var fe=pe;function he(){return(he=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function me(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ye(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ve=function(e){var t=e.listId,n=e.apiKey,o=e.onChange,i=ge(Object(r.useState)([]),2),s=i[0],u=i[1],c=ge(Object(r.useState)(!1),2),d=c[0],p=c[1],f=ge(Object(r.useState)({controller:null}),2),h=f[0].controller,m=f[1],g=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h&&h.abort(),p(!0),"AbortController"in window&&(h=new AbortController,m({controller:h})),(t=new FormData).append("api_key",n),t.append("action","blocksy_ext_mailchimp_maybe_get_lists"),e.prev=6,e.next=9,fetch(ctDashboardLocalizations.ajax_url,{method:"POST",signal:h.signal,body:t});case 9:if(200!==(r=e.sent).status){e.next=19;break}return e.next=13,r.json();case 13:if(!(o=e.sent).success){e.next=19;break}if("api_key_invalid"===o.data.result){e.next=19;break}return p(!1),u(o.data.result),e.abrupt("return");case 19:e.next=23;break;case 21:e.prev=21,e.t0=e.catch(6);case 23:u([]),p(!1);case 25:case"end":return e.stop()}}),e,null,[[6,21]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){me(i,r,o,a,s,"next",e)}function s(e){me(i,r,o,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return Object(r.useEffect)((function(){n&&-1!==n.indexOf("-")?g():u([])}),[n]),0===s.length?Object(r.createElement)("div",{className:"ct-select-input"},Object(r.createElement)("input",{disabled:!0,placeholder:d?Object(a.__)("Loading","blc"):Object(a.__)("Invalid API Key...","blc")})):Object(r.createElement)(fe,{selectedItem:t||"",onChange:function(e){return o(e)},itemToString:function(e){return e?(s.find((function(t){return t.id===e}))||{}).name:""}},(function(e){var t=e.getInputProps,n=e.getItemProps,o=(e.getLabelProps,e.getMenuProps),i=e.isOpen,u=(e.inputValue,e.highlightedIndex),c=e.selectedItem,d=e.openMenu;return Object(r.createElement)("div",{className:"ct-select-input"},Object(r.createElement)("input",he({},t({onFocus:function(){return d()},onClick:function(){return d()}}),{placeholder:Object(a.__)("Select list...","blc"),readOnly:!0})),i&&Object(r.createElement)("div",o({className:"ct-select-dropdown"}),s.map((function(e,t){return Object(r.createElement)("div",n({key:e.id,index:t,item:e.id,className:l()("ct-select-dropdown-item",{active:u===t,selected:c===e.id})}),e.name)}))))}))};function be(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function we(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Se=function(e){var t=e.extension,n=e.isEditingCredentials,o=e.setIsEditingCredentials,i=e.onCredentialsValidated,s=we(Object(r.useState)(t.data.api_key),2),u=s[0],c=s[1],d=we(Object(r.useState)(t.data.list_id),2),p=d[0],f=d[1],h=we(Object(r.useState)(!1),2),m=h[0],g=h[1],y=we(Object(r.useState)(!1),2),v=y[0],b=y[1],w=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=new FormData).append("api_key",u),t.append("list_id",p),t.append("action","blocksy_ext_mailchimp_maybe_save_credentials"),g(!0),e.prev=5,e.next=8,fetch(ctDashboardLocalizations.ajax_url,{method:"POST",body:t});case 8:if(200!==(n=e.sent).status){e.next=14;break}return e.next=12,n.json();case 12:(r=e.sent).success&&"api_key_invalid"!==r.data.result&&(i(),b(!1));case 14:b(!0),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(5),b(!0);case 20:return e.next=22,new Promise((function(e){return setTimeout((function(){return e()}),1e3)}));case 22:g(!1);case 23:case"end":return e.stop()}}),e,null,[[5,17]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){be(i,r,o,a,s,"next",e)}function s(e){be(i,r,o,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return Object(r.createElement)(R,{items:n,onDismiss:function(){return o(!1)},className:"ct-mailchimp-modal",render:function(){return Object(r.createElement)("div",{className:l()("ct-modal-content",{"ct-key-invalid":v})},Object(r.createElement)("h2",null,Object(a.__)("MailChimp Credentials","blc")),Object(r.createElement)("p",{dangerouslySetInnerHTML:{__html:Object(a.sprintf)(Object(a.__)("Enter your MailChimp credentials in the form below. More info on how to generate an API key can be found %shere%s.","blc"),'<a target="_blank" href="https://mailchimp.com/help/about-api-keys/">',"</a>")}}),Object(r.createElement)("div",{className:"mailchimp-credentials"},Object(r.createElement)("section",null,Object(r.createElement)("label",null,Object(a.__)("API Key","blc")),Object(r.createElement)("div",{className:"ct-option-input"},Object(r.createElement)("input",{type:"text",onChange:function(e){var t=e.target.value;return c(t)},value:u||""}))),Object(r.createElement)("section",null,Object(r.createElement)("label",null,Object(a.__)("List ID","blc")),Object(r.createElement)(ve,{listId:p,onChange:function(e){return f(e)},apiKey:u})),Object(r.createElement)("section",null,Object(r.createElement)("label",null," "),Object(r.createElement)("button",{className:"ct-button","data-button":"blue",disabled:!u||!p||m,onClick:function(){return w()}},m?Object(a.__)("Loading...","blc"):t.__object?Object(a.__)("Save Settings","blc"):Object(a.__)("Activate","blc")))))}})};function Ie(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function xe(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Ie(i,r,o,a,s,"next",e)}function s(e){Ie(i,r,o,a,s,"throw",e)}a(void 0)}))}}function je(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=Object(r.useState)(!1),o=je(n,2),i=o[0],s=o[1],l=Object(r.useState)(!1),u=je(l,2),c=u[0],d=u[1],p=function(){var n=xe(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return(r=new FormData).append("ext",e.name),r.append("action",e.__object?"blocksy_extension_deactivate":"blocksy_extension_activate"),s(!0),n.prev=4,n.next=7,fetch(ctDashboardLocalizations.ajax_url,{method:"POST",body:r});case 7:t(),n.next=12;break;case 10:n.prev=10,n.t0=n.catch(4);case 12:s(!1);case 13:case"end":return n.stop()}}),n,null,[[4,10]])})));return function(){return n.apply(this,arguments)}}(),f=function(){e.__object||e.data.api_key?p():d(!0)};return[i,f,Object(r.createElement)(r.Fragment,null,e.__object&&e.data.api_key&&Object(r.createElement)("button",{className:"ct-button ct-config-btn","data-button":"white",title:"Edit Credentials",onClick:function(){return d(!0)}},Object(a.__)("Configure","blc")),Object(r.createElement)(Se,{isEditingCredentials:c,setIsEditingCredentials:d,extension:e,onCredentialsValidated:function(){e.__object||p(),d(!1)}}))]};function ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ae(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Pe=function(e){var t=e.extension,n=e.onExtsSync,o=ke(Ce(t,(function(){n()})),3),i=o[0],s=o[1],u=o[2],c=ke(F(t),2),d=c[0],p=c[1];return Object(r.createElement)("li",{className:l()({active:!!t.__object})},Object(r.createElement)("h4",{className:"ct-extension-title"},t.config.name,i&&Object(r.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 100 100"},Object(r.createElement)("g",{transform:"translate(50,50)"},Object(r.createElement)("g",{transform:"scale(1)"},Object(r.createElement)("circle",{cx:"0",cy:"0",r:"50",fill:"#687c93"}),Object(r.createElement)("circle",{cx:"0",cy:"-26",r:"12",fill:"#ffffff",transform:"rotate(161.634)"},Object(r.createElement)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"linear",values:"0 0 0;360 0 0",keyTimes:"0;1",dur:"1s",begin:"0s",repeatCount:"indefinite"})))))),t.config.description&&Object(r.createElement)("div",{className:"ct-extension-description"},t.config.description),Object(r.createElement)("div",{className:"ct-extension-actions"},Object(r.createElement)("button",{className:l()(t.__object?"ct-button":"ct-button-primary"),"data-button":"white",disabled:i,onClick:function(){return s()}},t.__object?Object(a.__)("Deactivate","blc"):Object(a.__)("Activate","blc")),u,t.readme&&Object(r.createElement)("button",{onClick:function(){return d()},"data-button":"white",className:"ct-minimal-button ct-instruction"},Object(r.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})))),p)};i.a.on("ct:extensions:card",(function(e){var t=e.CustomComponent;"mailchimp"===e.extension.name&&(t.extension=Pe)}))}]);
|
framework/extensions/mailchimp/dashboard-static/js/EditCredentials.js
CHANGED
@@ -3,20 +3,19 @@ import {
|
|
3 |
Component,
|
4 |
useEffect,
|
5 |
useState,
|
6 |
-
Fragment
|
7 |
} from '@wordpress/element'
|
8 |
|
9 |
-
import { Transition } from 'react-spring/renderprops'
|
10 |
-
import { Dialog, DialogOverlay, DialogContent } from '@reach/dialog'
|
11 |
import classnames from 'classnames'
|
12 |
import { __, sprintf } from 'ct-i18n'
|
13 |
import ListPicker from './ListPicker'
|
|
|
14 |
|
15 |
const EditCredentials = ({
|
16 |
extension,
|
17 |
isEditingCredentials,
|
18 |
setIsEditingCredentials,
|
19 |
-
onCredentialsValidated
|
20 |
}) => {
|
21 |
const [apiKey, setApiKey] = useState(extension.data.api_key)
|
22 |
const [listId, setListId] = useState(extension.data.list_id)
|
@@ -36,7 +35,7 @@ const EditCredentials = ({
|
|
36 |
try {
|
37 |
const response = await fetch(ctDashboardLocalizations.ajax_url, {
|
38 |
method: 'POST',
|
39 |
-
body
|
40 |
})
|
41 |
|
42 |
if (response.status === 200) {
|
@@ -55,102 +54,83 @@ const EditCredentials = ({
|
|
55 |
makeKeyInvalid(true)
|
56 |
}
|
57 |
|
58 |
-
await new Promise(r => setTimeout(() => r(), 1000))
|
59 |
|
60 |
setIsLoading(false)
|
61 |
}
|
62 |
|
63 |
return (
|
64 |
-
<
|
65 |
items={isEditingCredentials}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
-
|
93 |
-
<h1>{__('MailChimp Credentials')}</h1>
|
94 |
-
<p
|
95 |
-
dangerouslySetInnerHTML={{
|
96 |
-
__html: sprintf(
|
97 |
-
__(
|
98 |
-
'Enter your MailChimp credentials in the form below. More info on how to generate an API key can be found %s.'
|
99 |
-
),
|
100 |
-
|
101 |
-
sprintf(
|
102 |
-
'<a target="_blank" href="https://mailchimp.com/help/about-api-keys/">%s</a>',
|
103 |
-
__('here')
|
104 |
-
)
|
105 |
-
)
|
106 |
-
}}
|
107 |
/>
|
108 |
-
|
109 |
-
<ul className="mailchimp-credentials">
|
110 |
-
<li>
|
111 |
-
<label>{__('API Key')}</label>
|
112 |
-
|
113 |
-
<input
|
114 |
-
type="text"
|
115 |
-
onChange={({ target: { value } }) =>
|
116 |
-
setApiKey(value)
|
117 |
-
}
|
118 |
-
value={apiKey || ''}
|
119 |
-
/>
|
120 |
-
</li>
|
121 |
-
|
122 |
-
<li>
|
123 |
-
<label>{__('List ID')}</label>
|
124 |
-
|
125 |
-
<ListPicker
|
126 |
-
listId={listId}
|
127 |
-
onChange={id => setListId(id)}
|
128 |
-
apiKey={apiKey}
|
129 |
-
/>
|
130 |
-
</li>
|
131 |
-
|
132 |
-
<li>
|
133 |
-
<button
|
134 |
-
className="ct-button"
|
135 |
-
data-button="blue"
|
136 |
-
disabled={
|
137 |
-
!apiKey || !listId || isLoading
|
138 |
-
}
|
139 |
-
onClick={() =>
|
140 |
-
attemptToSaveCredentials()
|
141 |
-
}>
|
142 |
-
{isLoading
|
143 |
-
? __('Loading...')
|
144 |
-
: __('Activate')}
|
145 |
-
</button>
|
146 |
-
</li>
|
147 |
-
</ul>
|
148 |
</div>
|
149 |
-
</
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
)
|
155 |
}
|
156 |
|
3 |
Component,
|
4 |
useEffect,
|
5 |
useState,
|
6 |
+
Fragment,
|
7 |
} from '@wordpress/element'
|
8 |
|
|
|
|
|
9 |
import classnames from 'classnames'
|
10 |
import { __, sprintf } from 'ct-i18n'
|
11 |
import ListPicker from './ListPicker'
|
12 |
+
import Overlay from '../../../../../static/js/helpers/Overlay'
|
13 |
|
14 |
const EditCredentials = ({
|
15 |
extension,
|
16 |
isEditingCredentials,
|
17 |
setIsEditingCredentials,
|
18 |
+
onCredentialsValidated,
|
19 |
}) => {
|
20 |
const [apiKey, setApiKey] = useState(extension.data.api_key)
|
21 |
const [listId, setListId] = useState(extension.data.list_id)
|
35 |
try {
|
36 |
const response = await fetch(ctDashboardLocalizations.ajax_url, {
|
37 |
method: 'POST',
|
38 |
+
body,
|
39 |
})
|
40 |
|
41 |
if (response.status === 200) {
|
54 |
makeKeyInvalid(true)
|
55 |
}
|
56 |
|
57 |
+
await new Promise((r) => setTimeout(() => r(), 1000))
|
58 |
|
59 |
setIsLoading(false)
|
60 |
}
|
61 |
|
62 |
return (
|
63 |
+
<Overlay
|
64 |
items={isEditingCredentials}
|
65 |
+
onDismiss={() => setIsEditingCredentials(false)}
|
66 |
+
className={'ct-mailchimp-modal'}
|
67 |
+
render={() => (
|
68 |
+
<div
|
69 |
+
className={classnames(
|
70 |
+
'ct-modal-content',
|
71 |
+
{
|
72 |
+
'ct-key-invalid': isApiKeyInvalid,
|
73 |
+
}
|
74 |
+
)}>
|
75 |
+
|
76 |
+
<h2>{__('MailChimp Credentials', 'blc')}</h2>
|
77 |
+
|
78 |
+
<p
|
79 |
+
dangerouslySetInnerHTML={{
|
80 |
+
__html: sprintf(
|
81 |
+
__(
|
82 |
+
'Enter your MailChimp credentials in the form below. More info on how to generate an API key can be found %shere%s.',
|
83 |
+
'blc'
|
84 |
+
),
|
85 |
+
'<a target="_blank" href="https://mailchimp.com/help/about-api-keys/">',
|
86 |
+
'</a>'
|
87 |
+
),
|
88 |
+
}}
|
89 |
+
/>
|
90 |
+
|
91 |
+
<div className="mailchimp-credentials">
|
92 |
+
<section>
|
93 |
+
<label>{__('API Key', 'blc')}</label>
|
94 |
+
|
95 |
+
<div className="ct-option-input">
|
96 |
+
<input
|
97 |
+
type="text"
|
98 |
+
onChange={({ target: { value } }) =>
|
99 |
+
setApiKey(value)
|
100 |
}
|
101 |
+
value={apiKey || ''}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
</div>
|
104 |
+
</section>
|
105 |
+
|
106 |
+
<section>
|
107 |
+
<label>{__('List ID', 'blc')}</label>
|
108 |
+
|
109 |
+
<ListPicker
|
110 |
+
listId={listId}
|
111 |
+
onChange={(id) => setListId(id)}
|
112 |
+
apiKey={apiKey}
|
113 |
+
/>
|
114 |
+
</section>
|
115 |
+
|
116 |
+
<section>
|
117 |
+
<label> </label>
|
118 |
+
<button
|
119 |
+
className="ct-button"
|
120 |
+
data-button="blue"
|
121 |
+
disabled={!apiKey || !listId || isLoading}
|
122 |
+
onClick={() => attemptToSaveCredentials()}>
|
123 |
+
{isLoading
|
124 |
+
? __('Loading...', 'blc')
|
125 |
+
: !extension.__object
|
126 |
+
? __('Activate', 'blc')
|
127 |
+
: __('Save Settings', 'blc')}
|
128 |
+
</button>
|
129 |
+
</section>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
)}
|
133 |
+
/>
|
134 |
)
|
135 |
}
|
136 |
|
framework/extensions/mailchimp/dashboard-static/js/ListPicker.js
CHANGED
@@ -61,29 +61,28 @@ const ListPicker = ({ listId, apiKey, onChange }) => {
|
|
61 |
setListsLoading(false)
|
62 |
}
|
63 |
|
64 |
-
useEffect(
|
65 |
-
()
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
[apiKey]
|
79 |
-
)
|
80 |
|
81 |
return lists.length === 0 ? (
|
82 |
<div className="ct-select-input">
|
83 |
<input
|
84 |
disabled
|
85 |
placeholder={
|
86 |
-
isLoadingLists
|
|
|
|
|
87 |
}
|
88 |
/>
|
89 |
</div>
|
@@ -111,7 +110,7 @@ const ListPicker = ({ listId, apiKey, onChange }) => {
|
|
111 |
onFocus: () => openMenu(),
|
112 |
onClick: () => openMenu()
|
113 |
})}
|
114 |
-
placeholder={__('Select list...')}
|
115 |
readOnly
|
116 |
/>
|
117 |
|
61 |
setListsLoading(false)
|
62 |
}
|
63 |
|
64 |
+
useEffect(() => {
|
65 |
+
if (!apiKey) {
|
66 |
+
setLists([])
|
67 |
+
return
|
68 |
+
}
|
|
|
69 |
|
70 |
+
if (apiKey.indexOf('-') === -1) {
|
71 |
+
setLists([])
|
72 |
+
return
|
73 |
+
}
|
74 |
|
75 |
+
maybeFetchLists()
|
76 |
+
}, [apiKey])
|
|
|
|
|
77 |
|
78 |
return lists.length === 0 ? (
|
79 |
<div className="ct-select-input">
|
80 |
<input
|
81 |
disabled
|
82 |
placeholder={
|
83 |
+
isLoadingLists
|
84 |
+
? __('Loading', 'blc')
|
85 |
+
: __('Invalid API Key...', 'blc')
|
86 |
}
|
87 |
/>
|
88 |
</div>
|
110 |
onFocus: () => openMenu(),
|
111 |
onClick: () => openMenu()
|
112 |
})}
|
113 |
+
placeholder={__('Select list...', 'blc')}
|
114 |
readOnly
|
115 |
/>
|
116 |
|
framework/extensions/mailchimp/dashboard-static/js/Mailchimp.js
CHANGED
@@ -24,7 +24,36 @@ const Mailchimp = ({ extension, onExtsSync }) => {
|
|
24 |
|
25 |
return (
|
26 |
<li className={classnames({ active: !!extension.__object })}>
|
27 |
-
<h4 className="ct-extension-title">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
{extension.config.description && (
|
30 |
<div className="ct-extension-description">
|
@@ -34,15 +63,15 @@ const Mailchimp = ({ extension, onExtsSync }) => {
|
|
34 |
|
35 |
<div className="ct-extension-actions">
|
36 |
<button
|
37 |
-
className=
|
|
|
|
|
38 |
data-button="white"
|
39 |
disabled={isLoading}
|
40 |
onClick={() => activationAction()}>
|
41 |
-
{
|
42 |
-
? __('
|
43 |
-
:
|
44 |
-
? __('Deactivate')
|
45 |
-
: __('Activate')}
|
46 |
</button>
|
47 |
|
48 |
{ui}
|
24 |
|
25 |
return (
|
26 |
<li className={classnames({ active: !!extension.__object })}>
|
27 |
+
<h4 className="ct-extension-title">
|
28 |
+
{extension.config.name}
|
29 |
+
|
30 |
+
{isLoading && (
|
31 |
+
<svg width="15" height="15" viewBox="0 0 100 100">
|
32 |
+
<g transform="translate(50,50)">
|
33 |
+
<g transform="scale(1)">
|
34 |
+
<circle cx="0" cy="0" r="50" fill="#687c93" />
|
35 |
+
<circle
|
36 |
+
cx="0"
|
37 |
+
cy="-26"
|
38 |
+
r="12"
|
39 |
+
fill="#ffffff"
|
40 |
+
transform="rotate(161.634)">
|
41 |
+
<animateTransform
|
42 |
+
attributeName="transform"
|
43 |
+
type="rotate"
|
44 |
+
calcMode="linear"
|
45 |
+
values="0 0 0;360 0 0"
|
46 |
+
keyTimes="0;1"
|
47 |
+
dur="1s"
|
48 |
+
begin="0s"
|
49 |
+
repeatCount="indefinite"
|
50 |
+
/>
|
51 |
+
</circle>
|
52 |
+
</g>
|
53 |
+
</g>
|
54 |
+
</svg>
|
55 |
+
)}
|
56 |
+
</h4>
|
57 |
|
58 |
{extension.config.description && (
|
59 |
<div className="ct-extension-description">
|
63 |
|
64 |
<div className="ct-extension-actions">
|
65 |
<button
|
66 |
+
className={classnames(
|
67 |
+
extension.__object ? 'ct-button' : 'ct-button-primary'
|
68 |
+
)}
|
69 |
data-button="white"
|
70 |
disabled={isLoading}
|
71 |
onClick={() => activationAction()}>
|
72 |
+
{extension.__object
|
73 |
+
? __('Deactivate', 'blc')
|
74 |
+
: __('Activate', 'blc')}
|
|
|
|
|
75 |
</button>
|
76 |
|
77 |
{ui}
|
framework/extensions/mailchimp/dashboard-static/js/hooks/useActivationWithRequirements.js
CHANGED
@@ -7,8 +7,8 @@ import {
|
|
7 |
} from '@wordpress/element'
|
8 |
|
9 |
import { Transition } from 'react-spring/renderprops'
|
10 |
-
import { Dialog, DialogOverlay, DialogContent } from '@reach/dialog'
|
11 |
import EditCredentials from '../EditCredentials'
|
|
|
12 |
|
13 |
const useActivationWithRequirements = (extension, cb = () => {}) => {
|
14 |
const [isLoading, setIsLoading] = useState(false)
|
@@ -36,8 +36,6 @@ const useActivationWithRequirements = (extension, cb = () => {}) => {
|
|
36 |
cb()
|
37 |
} catch (e) {}
|
38 |
|
39 |
-
await new Promise(r => setTimeout(() => r(), 1000))
|
40 |
-
|
41 |
setIsLoading(false)
|
42 |
}
|
43 |
|
@@ -54,14 +52,15 @@ const useActivationWithRequirements = (extension, cb = () => {}) => {
|
|
54 |
isLoading,
|
55 |
handleActionWithRequirements,
|
56 |
<Fragment>
|
57 |
-
{extension.__object &&
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
<EditCredentials
|
67 |
isEditingCredentials={isEditingCredentials}
|
7 |
} from '@wordpress/element'
|
8 |
|
9 |
import { Transition } from 'react-spring/renderprops'
|
|
|
10 |
import EditCredentials from '../EditCredentials'
|
11 |
+
import { __, sprintf } from 'ct-i18n'
|
12 |
|
13 |
const useActivationWithRequirements = (extension, cb = () => {}) => {
|
14 |
const [isLoading, setIsLoading] = useState(false)
|
36 |
cb()
|
37 |
} catch (e) {}
|
38 |
|
|
|
|
|
39 |
setIsLoading(false)
|
40 |
}
|
41 |
|
52 |
isLoading,
|
53 |
handleActionWithRequirements,
|
54 |
<Fragment>
|
55 |
+
{extension.__object && extension.data.api_key && (
|
56 |
+
<button
|
57 |
+
className="ct-button ct-config-btn"
|
58 |
+
data-button="white"
|
59 |
+
title="Edit Credentials"
|
60 |
+
onClick={() => setIsEditingCredentials(true)}>
|
61 |
+
{__('Configure', 'blc')}
|
62 |
+
</button>
|
63 |
+
)}
|
64 |
|
65 |
<EditCredentials
|
66 |
isEditingCredentials={isEditingCredentials}
|
framework/extensions/mailchimp/dashboard-static/js/main.js
CHANGED
@@ -5,6 +5,7 @@ import {
|
|
5 |
useState,
|
6 |
Fragment
|
7 |
} from '@wordpress/element'
|
|
|
8 |
|
9 |
import Mailchimp from './Mailchimp'
|
10 |
|
5 |
useState,
|
6 |
Fragment
|
7 |
} from '@wordpress/element'
|
8 |
+
import ctEvents from 'ct-events'
|
9 |
|
10 |
import Mailchimp from './Mailchimp'
|
11 |
|
framework/extensions/mailchimp/extension.php
CHANGED
@@ -5,20 +5,11 @@ require_once dirname( __FILE__ ) . '/mailchimp-manager.php';
|
|
5 |
|
6 |
class BlocksyExtensionMailchimp {
|
7 |
public function __construct() {
|
8 |
-
add_action('blocksy:global-dynamic-css:enqueue', function (
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
dirname( __FILE__ ) . '/global.php',
|
14 |
-
[],
|
15 |
-
[
|
16 |
-
'css' => $css,
|
17 |
-
'tablet_css' => $tablet_css,
|
18 |
-
'mobile_css' => $mobile_css
|
19 |
-
]
|
20 |
-
);
|
21 |
-
|
22 |
}, 10, 3);
|
23 |
|
24 |
add_filter('blocksy-options-scripts-dependencies', function ($d) {
|
@@ -38,7 +29,31 @@ class BlocksyExtensionMailchimp {
|
|
38 |
BLOCKSY_URL . 'framework/extensions/mailchimp/admin-static/bundle/main.js',
|
39 |
[],
|
40 |
$data['Version'],
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
);
|
43 |
|
44 |
wp_localize_script(
|
@@ -64,9 +79,17 @@ class BlocksyExtensionMailchimp {
|
|
64 |
wp_enqueue_style(
|
65 |
'blocksy-ext-mailchimp-styles',
|
66 |
BLOCKSY_URL . 'framework/extensions/mailchimp/static/bundle/main.css',
|
67 |
-
[],
|
68 |
$data['Version']
|
69 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
});
|
71 |
|
72 |
add_filter('blocksy_widgets_paths', function ($all_widgets) {
|
@@ -77,7 +100,8 @@ class BlocksyExtensionMailchimp {
|
|
77 |
add_filter(
|
78 |
'blocksy_single_posts_end_customizer_options',
|
79 |
function ($opts) {
|
80 |
-
$opts['mailchimp_single_post_enabled'] =
|
|
|
81 |
dirname( __FILE__ ) . '/customizer.php',
|
82 |
[], false
|
83 |
);
|
@@ -86,10 +110,20 @@ class BlocksyExtensionMailchimp {
|
|
86 |
}
|
87 |
);
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
add_action(
|
90 |
-
'
|
91 |
function () {
|
92 |
-
if (! function_exists('get_plugin_data')){
|
93 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
94 |
}
|
95 |
|
@@ -98,7 +132,7 @@ class BlocksyExtensionMailchimp {
|
|
98 |
wp_enqueue_script(
|
99 |
'blocksy-mailchimp-customizer-sync',
|
100 |
BLOCKSY_URL . 'framework/extensions/mailchimp/admin-static/bundle/sync.js',
|
101 |
-
[ 'customize-preview' ],
|
102 |
$data['Version'],
|
103 |
true
|
104 |
);
|
5 |
|
6 |
class BlocksyExtensionMailchimp {
|
7 |
public function __construct() {
|
8 |
+
add_action('blocksy:global-dynamic-css:enqueue', function ($args) {
|
9 |
+
blocksy_theme_get_dynamic_styles(array_merge([
|
10 |
+
'path' => dirname( __FILE__ ) . '/global.php',
|
11 |
+
'chunk' => 'global'
|
12 |
+
], $args));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}, 10, 3);
|
14 |
|
15 |
add_filter('blocksy-options-scripts-dependencies', function ($d) {
|
29 |
BLOCKSY_URL . 'framework/extensions/mailchimp/admin-static/bundle/main.js',
|
30 |
[],
|
31 |
$data['Version'],
|
32 |
+
true
|
33 |
+
);
|
34 |
+
|
35 |
+
wp_localize_script(
|
36 |
+
'blocksy-ext-mailchimp-admin-scripts',
|
37 |
+
'blocksy_ext_mailchimp_localization',
|
38 |
+
[
|
39 |
+
'public_url' => BLOCKSY_URL . 'framework/extensions/mailchimp/admin-static/bundle/',
|
40 |
+
]
|
41 |
+
);
|
42 |
+
});
|
43 |
+
|
44 |
+
add_action('customize_controls_enqueue_scripts', function () {
|
45 |
+
if (! function_exists('get_plugin_data')) {
|
46 |
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
47 |
+
}
|
48 |
+
|
49 |
+
$data = get_plugin_data(BLOCKSY__FILE__);
|
50 |
+
|
51 |
+
wp_register_script(
|
52 |
+
'blocksy-ext-mailchimp-admin-scripts',
|
53 |
+
BLOCKSY_URL . 'framework/extensions/mailchimp/admin-static/bundle/main.js',
|
54 |
+
[],
|
55 |
+
$data['Version'],
|
56 |
+
true
|
57 |
);
|
58 |
|
59 |
wp_localize_script(
|
79 |
wp_enqueue_style(
|
80 |
'blocksy-ext-mailchimp-styles',
|
81 |
BLOCKSY_URL . 'framework/extensions/mailchimp/static/bundle/main.css',
|
82 |
+
['ct-main-styles'],
|
83 |
$data['Version']
|
84 |
);
|
85 |
+
|
86 |
+
wp_enqueue_script(
|
87 |
+
'blocksy-ext-mailchimp-scripts',
|
88 |
+
BLOCKSY_URL . 'framework/extensions/mailchimp/static/bundle/main.js',
|
89 |
+
[],
|
90 |
+
$data['Version'],
|
91 |
+
true
|
92 |
+
);
|
93 |
});
|
94 |
|
95 |
add_filter('blocksy_widgets_paths', function ($all_widgets) {
|
100 |
add_filter(
|
101 |
'blocksy_single_posts_end_customizer_options',
|
102 |
function ($opts) {
|
103 |
+
$opts['mailchimp_single_post_enabled'] = blc_call_fn(
|
104 |
+
['fn' => 'blocksy_get_options'],
|
105 |
dirname( __FILE__ ) . '/customizer.php',
|
106 |
[], false
|
107 |
);
|
110 |
}
|
111 |
);
|
112 |
|
113 |
+
add_filter('blocksy_extensions_metabox_post:elements:before', function ($opts) {
|
114 |
+
$opts['disable_subscribe_form'] = [
|
115 |
+
'label' => __( 'Disable Subscribe Form', 'blc' ),
|
116 |
+
'type' => 'ct-switch',
|
117 |
+
'value' => 'no',
|
118 |
+
];
|
119 |
+
|
120 |
+
return $opts;
|
121 |
+
}, 5);
|
122 |
+
|
123 |
add_action(
|
124 |
+
'customize_controls_enqueue_scripts',
|
125 |
function () {
|
126 |
+
if (! function_exists('get_plugin_data')) {
|
127 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
128 |
}
|
129 |
|
132 |
wp_enqueue_script(
|
133 |
'blocksy-mailchimp-customizer-sync',
|
134 |
BLOCKSY_URL . 'framework/extensions/mailchimp/admin-static/bundle/sync.js',
|
135 |
+
[ 'customize-preview', 'ct-events' ],
|
136 |
$data['Version'],
|
137 |
true
|
138 |
);
|
framework/extensions/mailchimp/global.php
CHANGED
@@ -1,60 +1,98 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Mailchimp
|
4 |
-
|
5 |
-
'mailchimpContent',
|
6 |
-
|
7 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
'mailchimpButton',
|
16 |
-
[
|
17 |
'default' => [ 'color' => 'var(--paletteColor1)' ],
|
18 |
'hover' => [ 'color' => 'var(--paletteColor2)' ],
|
19 |
-
]
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$css->put(
|
28 |
-
'.ct-mailchimp-block',
|
29 |
-
"--buttonHoverColor: {$mailchimpButton['hover']}"
|
30 |
-
);
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
'
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
43 |
-
'mailchimpShadow',
|
44 |
-
[
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
'
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
53 |
'css' => $css,
|
54 |
'tablet_css' => $tablet_css,
|
55 |
'mobile_css' => $mobile_css,
|
56 |
-
'selector' => '
|
57 |
-
'variableName' => '
|
58 |
'value' => get_theme_mod('mailchimpSpacing', [
|
59 |
'mobile' => '40px',
|
60 |
'tablet' => '40px',
|
1 |
<?php
|
2 |
|
3 |
// Mailchimp
|
4 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
5 |
+
'value' => get_theme_mod('mailchimpContent'),
|
6 |
+
'default' => [
|
7 |
+
'default' => [ 'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT') ],
|
8 |
+
'hover' => [ 'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT') ],
|
9 |
+
],
|
10 |
+
'css' => $css,
|
11 |
+
'variables' => [
|
12 |
+
'default' => [
|
13 |
+
'selector' => '.ct-mailchimp-block',
|
14 |
+
'variable' => 'color'
|
15 |
+
],
|
16 |
|
17 |
+
'hover' => [
|
18 |
+
'selector' => '.ct-mailchimp-block',
|
19 |
+
'variable' => 'linkHoverColor'
|
20 |
+
],
|
21 |
+
],
|
22 |
+
]);
|
23 |
|
24 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
25 |
+
'value' => get_theme_mod('mailchimpButton'),
|
26 |
+
'default' => [
|
27 |
'default' => [ 'color' => 'var(--paletteColor1)' ],
|
28 |
'hover' => [ 'color' => 'var(--paletteColor2)' ],
|
29 |
+
],
|
30 |
+
'css' => $css,
|
31 |
+
'variables' => [
|
32 |
+
'default' => [
|
33 |
+
'selector' => '.ct-mailchimp-block',
|
34 |
+
'variable' => 'buttonInitialColor'
|
35 |
+
],
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
'hover' => [
|
38 |
+
'selector' => '.ct-mailchimp-block',
|
39 |
+
'variable' => 'buttonHoverColor'
|
40 |
+
]
|
41 |
+
],
|
42 |
+
]);
|
43 |
|
44 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
45 |
+
'value' => get_theme_mod('mailchimpBackground'),
|
46 |
+
'default' => ['default' => [ 'color' => '#ffffff' ]],
|
47 |
+
'css' => $css,
|
48 |
+
'variables' => [
|
49 |
+
'default' => [
|
50 |
+
'selector' => '.ct-mailchimp-block',
|
51 |
+
'variable' => 'backgroundColor'
|
52 |
+
],
|
53 |
+
],
|
54 |
+
]);
|
55 |
|
56 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
57 |
+
'value' => get_theme_mod('mailchimpShadow'),
|
58 |
+
'default' => ['default' => [ 'color' => 'rgba(210, 213, 218, 0.4)' ]],
|
59 |
+
'css' => $css,
|
60 |
+
'variables' => [
|
61 |
+
'default' => [
|
62 |
+
'selector' => '.ct-mailchimp-block',
|
63 |
+
'variable' => 'mailchimpShadow'
|
64 |
+
],
|
65 |
+
],
|
66 |
+
]);
|
67 |
|
68 |
+
blc_call_fn(['fn' => 'blocksy_output_box_shadow'], [
|
69 |
+
'css' => $css,
|
70 |
+
'tablet_css' => $tablet_css,
|
71 |
+
'mobile_css' => $mobile_css,
|
72 |
+
'selector' => '.ct-mailchimp-block',
|
73 |
+
'value' => get_theme_mod(
|
74 |
+
'mailchimpShadow',
|
75 |
+
blc_call_fn(['fn' => 'blocksy_box_shadow_value'], [
|
76 |
+
'enable' => true,
|
77 |
+
'h_offset' => 0,
|
78 |
+
'v_offset' => 50,
|
79 |
+
'blur' => 90,
|
80 |
+
'spread' => 0,
|
81 |
+
'inset' => false,
|
82 |
+
'color' => [
|
83 |
+
'color' => 'rgba(210, 213, 218, 0.4)',
|
84 |
+
],
|
85 |
+
])
|
86 |
+
),
|
87 |
+
'responsive' => true
|
88 |
+
]);
|
89 |
|
90 |
+
blc_call_fn(['fn' => 'blocksy_output_responsive'], [
|
91 |
'css' => $css,
|
92 |
'tablet_css' => $tablet_css,
|
93 |
'mobile_css' => $mobile_css,
|
94 |
+
'selector' => '.ct-mailchimp-block',
|
95 |
+
'variableName' => 'padding',
|
96 |
'value' => get_theme_mod('mailchimpSpacing', [
|
97 |
'mobile' => '40px',
|
98 |
'tablet' => '40px',
|
framework/extensions/mailchimp/helpers.php
CHANGED
@@ -23,6 +23,19 @@ function blc_ext_mailchimp_subscribe_form($forced = false) {
|
|
23 |
}
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
$title = get_theme_mod('mailchimp_title', __(
|
27 |
'Newsletter Updates', 'blc'
|
28 |
));
|
@@ -38,6 +51,9 @@ function blc_ext_mailchimp_subscribe_form($forced = false) {
|
|
38 |
|
39 |
$has_name = get_theme_mod( 'has_mailchimp_name', 'no' ) === 'yes';
|
40 |
|
|
|
|
|
|
|
41 |
if ($forced) {
|
42 |
$has_name = true;
|
43 |
}
|
@@ -50,15 +66,25 @@ function blc_ext_mailchimp_subscribe_form($forced = false) {
|
|
50 |
|
51 |
$manager = new BlocksyMailchimpManager();
|
52 |
|
53 |
-
$
|
54 |
|
55 |
-
if (! $
|
56 |
return '';
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
$class = 'ct-mailchimp-block';
|
60 |
|
61 |
-
$class .= ' ' .
|
|
|
62 |
get_theme_mod('mailchimp_subscribe_visibility', [
|
63 |
'desktop' => true,
|
64 |
'tablet' => true,
|
@@ -66,33 +92,41 @@ function blc_ext_mailchimp_subscribe_form($forced = false) {
|
|
66 |
])
|
67 |
);
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
ob_start();
|
70 |
|
71 |
?>
|
72 |
|
73 |
-
<div class="<?php
|
74 |
-
<
|
75 |
-
<?php echo esc_html($title) ?>
|
76 |
-
</h4>
|
77 |
|
78 |
<p class="ct-mailchimp-description">
|
79 |
-
<?php echo
|
80 |
</p>
|
81 |
|
82 |
-
<form action="<?php echo esc_attr($form_url) ?>" method="post" class="ct-mailchimp-form"
|
83 |
-
<?php
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
86 |
|
87 |
-
|
|
|
|
|
|
|
88 |
|
89 |
-
<
|
90 |
-
<?php echo esc_html($button_text) ?>
|
91 |
-
</button>
|
92 |
|
93 |
<?php
|
94 |
if (function_exists('blocksy_ext_cookies_checkbox')) {
|
95 |
-
echo blocksy_ext_cookies_checkbox();
|
96 |
}
|
97 |
?>
|
98 |
|
23 |
}
|
24 |
}
|
25 |
|
26 |
+
if (
|
27 |
+
blocksy_default_akg(
|
28 |
+
'disable_subscribe_form',
|
29 |
+
blc_call_fn([
|
30 |
+
'fn' => 'blocksy_get_post_options',
|
31 |
+
'default' => 'array'
|
32 |
+
]),
|
33 |
+
'no'
|
34 |
+
) === 'yes'
|
35 |
+
) {
|
36 |
+
return '';
|
37 |
+
}
|
38 |
+
|
39 |
$title = get_theme_mod('mailchimp_title', __(
|
40 |
'Newsletter Updates', 'blc'
|
41 |
));
|
51 |
|
52 |
$has_name = get_theme_mod( 'has_mailchimp_name', 'no' ) === 'yes';
|
53 |
|
54 |
+
$name_label = get_theme_mod('mailchimp_name_label', __( 'Your name', 'blc' ));
|
55 |
+
$email_label = get_theme_mod('mailchimp_mail_label', __( 'Your email', 'blc' ));
|
56 |
+
|
57 |
if ($forced) {
|
58 |
$has_name = true;
|
59 |
}
|
66 |
|
67 |
$manager = new BlocksyMailchimpManager();
|
68 |
|
69 |
+
$mailchimp_data = $manager->get_form_url_and_gdpr_for($list_id);
|
70 |
|
71 |
+
if (! $mailchimp_data) {
|
72 |
return '';
|
73 |
}
|
74 |
|
75 |
+
$form_url = $mailchimp_data['form_url'];
|
76 |
+
$has_gdpr_fields = $mailchimp_data['has_gdpr_fields'];
|
77 |
+
|
78 |
+
$skip_submit_output = '';
|
79 |
+
|
80 |
+
if ($has_gdpr_fields) {
|
81 |
+
$skip_submit_output = 'data-skip-submit';
|
82 |
+
}
|
83 |
+
|
84 |
$class = 'ct-mailchimp-block';
|
85 |
|
86 |
+
$class .= ' ' . blc_call_fn(
|
87 |
+
['fn' => 'blocksy_visibility_classes'],
|
88 |
get_theme_mod('mailchimp_subscribe_visibility', [
|
89 |
'desktop' => true,
|
90 |
'tablet' => true,
|
92 |
])
|
93 |
);
|
94 |
|
95 |
+
$fields_number = '1';
|
96 |
+
|
97 |
+
if ($has_name) {
|
98 |
+
$fields_number = '2';
|
99 |
+
}
|
100 |
+
|
101 |
ob_start();
|
102 |
|
103 |
?>
|
104 |
|
105 |
+
<div class="<?php echo esc_attr($class) ?>">
|
106 |
+
<h3><?php echo esc_html($title) ?></h3>
|
|
|
|
|
107 |
|
108 |
<p class="ct-mailchimp-description">
|
109 |
+
<?php echo $description ?>
|
110 |
</p>
|
111 |
|
112 |
+
<form target="_blank" action="<?php echo esc_attr($form_url) ?>" method="post" class="ct-mailchimp-block-form" <?php echo $skip_submit_output ?>>
|
113 |
+
<section data-fields="<?php echo $fields_number ?>">
|
114 |
+
<?php if ($has_name) { ?>
|
115 |
+
<input type="text" name="FNAME" placeholder="<?php esc_attr_e($name_label, 'blc'); ?>" title="<?php echo __('Name', 'blc') ?>" />
|
116 |
+
<?php } ?>
|
117 |
+
|
118 |
+
<input type="email" name="EMAIL" placeholder="<?php esc_attr_e($email_label, 'blc'); ?> *" title="<?php echo __('Email', 'blc') ?>" required />
|
119 |
|
120 |
+
<button class="button">
|
121 |
+
<?php echo esc_html($button_text) ?>
|
122 |
+
</button>
|
123 |
+
</section>
|
124 |
|
125 |
+
<div class="ct-mailchimp-message"></div>
|
|
|
|
|
126 |
|
127 |
<?php
|
128 |
if (function_exists('blocksy_ext_cookies_checkbox')) {
|
129 |
+
echo blocksy_ext_cookies_checkbox('subscribe');
|
130 |
}
|
131 |
?>
|
132 |
|
framework/extensions/mailchimp/mailchimp-manager.php
CHANGED
@@ -5,10 +5,16 @@ class BlocksyMailchimpManager {
|
|
5 |
}
|
6 |
|
7 |
public function get_settings() {
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
return array_merge([
|
9 |
'api_key' => null,
|
10 |
'list_id' => null
|
11 |
-
],
|
12 |
}
|
13 |
|
14 |
public function set_settings($vals) {
|
@@ -18,15 +24,15 @@ class BlocksyMailchimpManager {
|
|
18 |
], $vals));
|
19 |
}
|
20 |
|
21 |
-
public function can(
|
22 |
-
if (
|
23 |
// Only network admin can change files that affects the entire network.
|
24 |
$can = current_user_can_for_blog( get_current_blog_id(), $capability );
|
25 |
} else {
|
26 |
$can = current_user_can( $capability );
|
27 |
}
|
28 |
|
29 |
-
if (
|
30 |
// Also you can use this method to get the capability.
|
31 |
$can = $capability;
|
32 |
}
|
@@ -43,7 +49,6 @@ class BlocksyMailchimpManager {
|
|
43 |
return 'api_key_invalid';
|
44 |
}
|
45 |
|
46 |
-
|
47 |
$region = explode('-', $api_key);
|
48 |
|
49 |
$response = wp_remote_get('https://' . $region[1] . '.api.mailchimp.com/3.0/lists', [
|
@@ -71,7 +76,12 @@ class BlocksyMailchimpManager {
|
|
71 |
return [
|
72 |
'name' => $list['name'],
|
73 |
'id' => $list['id'],
|
74 |
-
'subscribe_url_long' => $list['subscribe_url_long']
|
|
|
|
|
|
|
|
|
|
|
75 |
];
|
76 |
}, $body['lists']);
|
77 |
} else {
|
@@ -79,7 +89,15 @@ class BlocksyMailchimpManager {
|
|
79 |
}
|
80 |
}
|
81 |
|
82 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
$settings = $this->get_settings();
|
84 |
|
85 |
if (! isset($settings['api_key'])) {
|
@@ -105,16 +123,25 @@ class BlocksyMailchimpManager {
|
|
105 |
}
|
106 |
|
107 |
if (! $settings['list_id']) {
|
108 |
-
return
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
foreach ($lists as $single_list) {
|
112 |
if ($single_list['id'] === $settings['list_id']) {
|
113 |
-
return
|
|
|
|
|
|
|
114 |
}
|
115 |
}
|
116 |
|
117 |
-
return
|
|
|
|
|
|
|
118 |
}
|
119 |
}
|
120 |
|
5 |
}
|
6 |
|
7 |
public function get_settings() {
|
8 |
+
$option = get_option('blocksy_ext_mailchimp_credentials', []);
|
9 |
+
|
10 |
+
if (empty($option)) {
|
11 |
+
$option = [];
|
12 |
+
}
|
13 |
+
|
14 |
return array_merge([
|
15 |
'api_key' => null,
|
16 |
'list_id' => null
|
17 |
+
], $option);
|
18 |
}
|
19 |
|
20 |
public function set_settings($vals) {
|
24 |
], $vals));
|
25 |
}
|
26 |
|
27 |
+
public function can($capability = 'manage_options') {
|
28 |
+
if (is_multisite()) {
|
29 |
// Only network admin can change files that affects the entire network.
|
30 |
$can = current_user_can_for_blog( get_current_blog_id(), $capability );
|
31 |
} else {
|
32 |
$can = current_user_can( $capability );
|
33 |
}
|
34 |
|
35 |
+
if ($can) {
|
36 |
// Also you can use this method to get the capability.
|
37 |
$can = $capability;
|
38 |
}
|
49 |
return 'api_key_invalid';
|
50 |
}
|
51 |
|
|
|
52 |
$region = explode('-', $api_key);
|
53 |
|
54 |
$response = wp_remote_get('https://' . $region[1] . '.api.mailchimp.com/3.0/lists', [
|
76 |
return [
|
77 |
'name' => $list['name'],
|
78 |
'id' => $list['id'],
|
79 |
+
'subscribe_url_long' => $list['subscribe_url_long'],
|
80 |
+
'subscribe_url_long_json' => $this->transform_subscribe_url(
|
81 |
+
$list['subscribe_url_long']
|
82 |
+
),
|
83 |
+
|
84 |
+
'has_gdpr_fields' => $list['marketing_permissions']
|
85 |
];
|
86 |
}, $body['lists']);
|
87 |
} else {
|
89 |
}
|
90 |
}
|
91 |
|
92 |
+
public function transform_subscribe_url($url) {
|
93 |
+
return str_replace(
|
94 |
+
'subscribe',
|
95 |
+
'subscribe/post-json',
|
96 |
+
$url . '&c=callback'
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
public function get_form_url_and_gdpr_for($maybe_custom_list = null) {
|
101 |
$settings = $this->get_settings();
|
102 |
|
103 |
if (! isset($settings['api_key'])) {
|
123 |
}
|
124 |
|
125 |
if (! $settings['list_id']) {
|
126 |
+
return [
|
127 |
+
'form_url' => $lists[0]['subscribe_url_long'],
|
128 |
+
'has_gdpr_fields' => $lists[0]['has_gdpr_fields']
|
129 |
+
];
|
130 |
}
|
131 |
|
132 |
foreach ($lists as $single_list) {
|
133 |
if ($single_list['id'] === $settings['list_id']) {
|
134 |
+
return [
|
135 |
+
'form_url' => $single_list['subscribe_url_long'],
|
136 |
+
'has_gdpr_fields' => $single_list['has_gdpr_fields']
|
137 |
+
];
|
138 |
}
|
139 |
}
|
140 |
|
141 |
+
return [
|
142 |
+
'form_url' => $lists[0]['subscribe_url_long'],
|
143 |
+
'has_gdpr_fields' => $lists[0]['has_gdpr_fields']
|
144 |
+
];
|
145 |
}
|
146 |
}
|
147 |
|
framework/extensions/mailchimp/pre-boot.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
require_once dirname( __FILE__ ) . '/mailchimp-manager.php';
|
4 |
|
5 |
class BlocksyExtensionMailchimpPreBoot {
|
6 |
-
|
7 |
public function __construct() {
|
8 |
add_action(
|
9 |
'wp_ajax_blocksy_ext_mailchimp_maybe_get_lists',
|
3 |
require_once dirname( __FILE__ ) . '/mailchimp-manager.php';
|
4 |
|
5 |
class BlocksyExtensionMailchimpPreBoot {
|
|
|
6 |
public function __construct() {
|
7 |
add_action(
|
8 |
'wp_ajax_blocksy_ext_mailchimp_maybe_get_lists',
|
framework/extensions/mailchimp/readme.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
-
<
|
2 |
|
3 |
<p>
|
4 |
<?php echo __('After installing and activating the Mailchimp extension you will have two possibilities to show your subscribe form:', 'blc') ?>
|
5 |
</p>
|
6 |
|
7 |
-
<ol>
|
8 |
<li>
|
9 |
-
<
|
10 |
-
<?php echo __('Mailchimp Widget', 'blc') ?>
|
11 |
-
</b>
|
12 |
<i>
|
13 |
<?php
|
14 |
echo sprintf(
|
@@ -23,9 +21,7 @@
|
|
23 |
</li>
|
24 |
|
25 |
<li>
|
26 |
-
<
|
27 |
-
<?php echo __('Mailchimp Block', 'blc') ?>
|
28 |
-
</b>
|
29 |
<i>
|
30 |
<?php
|
31 |
echo sprintf(
|
@@ -38,6 +34,4 @@
|
|
38 |
?>
|
39 |
</i>
|
40 |
</li>
|
41 |
-
</ol>
|
42 |
-
|
43 |
-
|
1 |
+
<h2><?php echo __('Instructions', 'blc'); ?></h2>
|
2 |
|
3 |
<p>
|
4 |
<?php echo __('After installing and activating the Mailchimp extension you will have two possibilities to show your subscribe form:', 'blc') ?>
|
5 |
</p>
|
6 |
|
7 |
+
<ol class="ct-modal-list">
|
8 |
<li>
|
9 |
+
<h4><?php echo __('Mailchimp Widget', 'blc') ?></h4>
|
|
|
|
|
10 |
<i>
|
11 |
<?php
|
12 |
echo sprintf(
|
21 |
</li>
|
22 |
|
23 |
<li>
|
24 |
+
<h4><?php echo __('Mailchimp Block', 'blc') ?></h4>
|
|
|
|
|
25 |
<i>
|
26 |
<?php
|
27 |
echo sprintf(
|
34 |
?>
|
35 |
</i>
|
36 |
</li>
|
37 |
+
</ol>
|
|
|
|
framework/extensions/mailchimp/static/bundle/main.css
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/**
|
2 |
-
* - v1.
|
3 |
*
|
4 |
-
* Copyright (c)
|
5 |
* Licensed GPLv2+
|
6 |
*/
|
7 |
|
8 |
-
|
1 |
/**
|
2 |
+
* - v1.7.32
|
3 |
*
|
4 |
+
* Copyright (c) 2020
|
5 |
* Licensed GPLv2+
|
6 |
*/
|
7 |
|
8 |
+
aside[data-type="type-1"] .ct-mailchimp-widget{padding:30px;background:#fff;border-radius:3px;box-shadow:0px 12px 18px -6px rgba(34,56,101,0.04)}.ct-widget-inner[data-alignment="center"]{text-align:center}.ct-widget-inner[data-alignment="right"]{text-align:right}.ct-mailchimp-widget-form .ct-mailchimp-description:not(:empty){margin-bottom:10px}.ct-mailchimp-widget-form>*:not(:first-child){margin-top:10px}.ct-mailchimp-widget-form button{width:100%}.ct-mailchimp-widget-form .gdpr-confirm-policy{--display: inline-flex;--contentSpacing: 0;margin-top:20px}.ct-mailchimp-block{margin-top:60px;text-align:center;color:var(--color);padding:var(--padding);background:var(--backgroundColor);box-shadow:var(--box-shadow);--linkInitialColor: var(--color)}.ct-mailchimp-block>*:first-child{margin-top:20px}.ct-mailchimp-block>*:last-child{margin-bottom:20px}.ct-mailchimp-block>h3{--fontSize: 25px}.ct-mailchimp-block .ct-mailchimp-description:not(:empty){margin-bottom:30px}.ct-mailchimp-block form{max-width:550px;margin:0 auto}@media (min-width: 690px){.ct-mailchimp-block form{width:85%}}.ct-mailchimp-block form button{--buttonMinHeight: var(--formInputHeight);--padding: 0 15px;width:100%}.ct-mailchimp-block form [data-fields]{display:grid;grid-column-gap:15px;grid-row-gap:15px}@media (min-width: 690px){.ct-mailchimp-block form [data-fields="1"]{grid-template-columns:65% 1fr}}@media (min-width: 690px){.ct-mailchimp-block form [data-fields="2"]{grid-template-columns:32.5% 32.5% 1fr}}.ct-mailchimp-block .ct-mailchimp-message,.ct-mailchimp-block .gdpr-confirm-policy{margin-top:15px;--contentSpacing: 0}form[class*="ct-mailchimp"] .button{--buttonFontWeight: 600}.ct-mailchimp-message{display:none;font-size:16px}.ct-mailchimp-message a{text-decoration:underline}.subscribe-error .ct-mailchimp-message{display:block;font-size:14px;color:#e42b2b}.subscribe-success button.button,.subscribe-success input[type="text"],.subscribe-success input[type="email"],.subscribe-success .gdpr-confirm-policy,.subscribe-success .ct-mailchimp-description{display:none}.subscribe-success .ct-mailchimp-message{display:block}
|
framework/extensions/mailchimp/static/bundle/main.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);var n;function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}n=function(){o(document.querySelectorAll(".ct-mailchimp-widget-form, .ct-mailchimp-block-form")).map((function(e){e.matches("[data-skip-submit]")||e.addEventListener("submit",(function(e){e.preventDefault();var t=e.target;if(t.querySelector('[type="email"]').value.trim()){if(document.getElementById("js-validate-robot")&&""!==document.getElementById("js-validate-robot").value)return!1;for(var r=t.action.replace("subscribe","subscribe/post-json"),n="",o="mailchimpCallback",i=t.querySelectorAll("input"),c=0;c<i.length;c++)n+="&"+i[c].name+"="+encodeURIComponent(i[c].value);n+="&c=".concat(o);var u=document.createElement("script");u.src=r+n,document.body.appendChild(u),t.classList.remove("subscribe-error","subscribe-success"),t.classList.add("subscribe-loading"),window[o]=function(e){delete window[o],document.body.removeChild(u),t.classList.remove("subscribe-loading"),e&&(t.classList.add("error"===e.result?"subscribe-error":"subscribe-success"),t.querySelector(".ct-mailchimp-message").innerHTML=e.msg.replace("0 - ",""))}}}))}))},/comp|inter|loaded/.test(document.readyState)?n():document.addEventListener("DOMContentLoaded",n,!1)}]);
|
framework/extensions/mailchimp/static/js/main.js
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { onDocumentLoaded } from '../../../cookies-consent/static/js/helpers'
|
2 |
+
|
3 |
+
onDocumentLoaded(() => {
|
4 |
+
;[
|
5 |
+
...document.querySelectorAll(
|
6 |
+
'.ct-mailchimp-widget-form, .ct-mailchimp-block-form'
|
7 |
+
)
|
8 |
+
].map(el => {
|
9 |
+
if (el.matches('[data-skip-submit]')) {
|
10 |
+
return
|
11 |
+
}
|
12 |
+
|
13 |
+
el.addEventListener('submit', e => {
|
14 |
+
e.preventDefault()
|
15 |
+
const form = e.target
|
16 |
+
|
17 |
+
if (!form.querySelector('[type="email"]').value.trim()) {
|
18 |
+
return
|
19 |
+
}
|
20 |
+
|
21 |
+
// Check for spam
|
22 |
+
if (
|
23 |
+
document.getElementById('js-validate-robot') &&
|
24 |
+
document.getElementById('js-validate-robot').value !== ''
|
25 |
+
) {
|
26 |
+
return false
|
27 |
+
}
|
28 |
+
|
29 |
+
// Get url for mailchimp
|
30 |
+
var url = form.action.replace('subscribe', 'subscribe/post-json')
|
31 |
+
|
32 |
+
// Add form data to object
|
33 |
+
var data = ''
|
34 |
+
|
35 |
+
var callback = 'mailchimpCallback'
|
36 |
+
|
37 |
+
var inputs = form.querySelectorAll('input')
|
38 |
+
|
39 |
+
for (var i = 0; i < inputs.length; i++) {
|
40 |
+
data +=
|
41 |
+
'&' +
|
42 |
+
inputs[i].name +
|
43 |
+
'=' +
|
44 |
+
encodeURIComponent(inputs[i].value)
|
45 |
+
}
|
46 |
+
|
47 |
+
data += `&c=${callback}`
|
48 |
+
|
49 |
+
// Create & add post script to the DOM
|
50 |
+
var script = document.createElement('script')
|
51 |
+
script.src = url + data
|
52 |
+
|
53 |
+
document.body.appendChild(script)
|
54 |
+
|
55 |
+
form.classList.remove('subscribe-error', 'subscribe-success')
|
56 |
+
form.classList.add('subscribe-loading')
|
57 |
+
|
58 |
+
// Callback function
|
59 |
+
window[callback] = function (data) {
|
60 |
+
// Remove post script from the DOM
|
61 |
+
delete window[callback]
|
62 |
+
document.body.removeChild(script)
|
63 |
+
|
64 |
+
form.classList.remove('subscribe-loading')
|
65 |
+
|
66 |
+
if (!data) {
|
67 |
+
return
|
68 |
+
}
|
69 |
+
|
70 |
+
form.classList.add(
|
71 |
+
data.result === 'error'
|
72 |
+
? 'subscribe-error'
|
73 |
+
: 'subscribe-success'
|
74 |
+
)
|
75 |
+
|
76 |
+
form.querySelector(
|
77 |
+
'.ct-mailchimp-message'
|
78 |
+
).innerHTML = data.msg.replace('0 - ', '')
|
79 |
+
}
|
80 |
+
})
|
81 |
+
})
|
82 |
+
})
|
framework/extensions/mailchimp/static/sass/main.scss
CHANGED
@@ -2,29 +2,39 @@
|
|
2 |
@import 'widget';
|
3 |
@import 'single-block';
|
4 |
|
5 |
-
.ct-mailchimp-form {
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
margin-bottom: 10px;
|
11 |
-
}
|
12 |
-
}
|
13 |
}
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
// pointer-events: none;
|
28 |
-
}
|
29 |
}
|
30 |
}
|
2 |
@import 'widget';
|
3 |
@import 'single-block';
|
4 |
|
|
|
5 |
|
6 |
+
form[class*="ct-mailchimp"] {
|
7 |
+
.button {
|
8 |
+
--buttonFontWeight: 600;
|
|
|
|
|
|
|
9 |
}
|
10 |
+
}
|
11 |
|
12 |
+
// form messages
|
13 |
+
.ct-mailchimp-message {
|
14 |
+
display: none;
|
15 |
+
font-size: 16px;
|
16 |
+
|
17 |
+
a {
|
18 |
+
text-decoration: underline;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
.subscribe-error .ct-mailchimp-message {
|
23 |
+
display: block;
|
24 |
+
font-size: 14px;
|
25 |
+
color: #e42b2b;
|
26 |
+
}
|
27 |
|
28 |
+
.subscribe-success {
|
29 |
+
button.button,
|
30 |
+
input[type="text"],
|
31 |
+
input[type="email"],
|
32 |
+
.gdpr-confirm-policy,
|
33 |
+
.ct-mailchimp-description {
|
34 |
+
display: none;
|
35 |
}
|
36 |
|
37 |
+
.ct-mailchimp-message {
|
38 |
+
display: block;
|
|
|
|
|
39 |
}
|
40 |
}
|
framework/extensions/mailchimp/static/sass/single-block.scss
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
.ct-mailchimp-block {
|
2 |
margin-top: 60px;
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
|
8 |
> * {
|
9 |
&:first-child {
|
@@ -15,40 +17,54 @@
|
|
15 |
}
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
|
20 |
}
|
21 |
|
22 |
.ct-mailchimp-description {
|
23 |
-
text-align: center;
|
24 |
-
|
25 |
&:not(:empty) {
|
26 |
-
margin-top: 10px;
|
27 |
-
margin-bottom:
|
28 |
}
|
29 |
}
|
30 |
|
31 |
-
|
32 |
form {
|
33 |
-
|
34 |
-
|
35 |
-
grid-row-gap: 15px;
|
36 |
-
margin-left: auto;
|
37 |
-
margin-right: auto;
|
38 |
-
|
39 |
-
@include media-breakpoint-down (sm) {
|
40 |
-
input {
|
41 |
-
text-align: center;
|
42 |
-
}
|
43 |
-
}
|
44 |
|
45 |
@include media-breakpoint-up (md) {
|
46 |
-
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
1 |
.ct-mailchimp-block {
|
2 |
margin-top: 60px;
|
3 |
+
text-align: center;
|
4 |
+
color: var(--color);
|
5 |
+
padding: var(--padding);
|
6 |
+
background: var(--backgroundColor);
|
7 |
+
box-shadow: var(--box-shadow);
|
8 |
+
--linkInitialColor: var(--color);
|
9 |
|
10 |
> * {
|
11 |
&:first-child {
|
17 |
}
|
18 |
}
|
19 |
|
20 |
+
> h3 {
|
21 |
+
--fontSize: 25px;
|
22 |
}
|
23 |
|
24 |
.ct-mailchimp-description {
|
|
|
|
|
25 |
&:not(:empty) {
|
26 |
+
// margin-top: 10px;
|
27 |
+
margin-bottom: 30px;
|
28 |
}
|
29 |
}
|
30 |
|
|
|
31 |
form {
|
32 |
+
max-width: 550px;
|
33 |
+
margin: 0 auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
@include media-breakpoint-up (md) {
|
36 |
+
width: 85%;
|
37 |
}
|
38 |
|
39 |
+
button {
|
40 |
+
--buttonMinHeight: var(--formInputHeight);
|
41 |
+
--padding: 0 15px;
|
42 |
+
width: 100%;
|
43 |
+
}
|
44 |
+
|
45 |
+
[data-fields] {
|
46 |
+
display: grid;
|
47 |
+
grid-column-gap: 15px;
|
48 |
+
grid-row-gap: 15px;
|
49 |
+
}
|
50 |
+
|
51 |
+
[data-fields="1"] {
|
52 |
+
|
53 |
+
@include media-breakpoint-up (md) {
|
54 |
+
grid-template-columns: 65% 1fr;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
[data-fields="2"] {
|
59 |
+
@include media-breakpoint-up (md) {
|
60 |
+
grid-template-columns: 32.5% 32.5% 1fr;
|
61 |
+
}
|
62 |
}
|
63 |
}
|
64 |
+
|
65 |
+
.ct-mailchimp-message,
|
66 |
+
.gdpr-confirm-policy {
|
67 |
+
margin-top: 15px;
|
68 |
+
--contentSpacing: 0;
|
69 |
+
}
|
70 |
}
|
framework/extensions/mailchimp/static/sass/widget.scss
CHANGED
@@ -1,15 +1,3 @@
|
|
1 |
-
.ct-mailchimp-widget {
|
2 |
-
.ct-mailchimp-description {
|
3 |
-
&:not(:empty) {
|
4 |
-
margin-bottom: 20px;
|
5 |
-
}
|
6 |
-
}
|
7 |
-
|
8 |
-
input {
|
9 |
-
text-align: center;
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
aside[data-type="type-1"] {
|
14 |
.ct-mailchimp-widget {
|
15 |
padding: 30px;
|
@@ -23,18 +11,32 @@ aside[data-type="type-1"] {
|
|
23 |
.ct-widget-inner {
|
24 |
&[data-alignment="center"] {
|
25 |
text-align: center;
|
26 |
-
|
27 |
-
.gdpr-confirm-policy {
|
28 |
-
justify-content: center;
|
29 |
-
}
|
30 |
}
|
31 |
|
32 |
&[data-alignment="right"] {
|
33 |
text-align: right;
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
|
|
37 |
}
|
38 |
}
|
39 |
-
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
aside[data-type="type-1"] {
|
2 |
.ct-mailchimp-widget {
|
3 |
padding: 30px;
|
11 |
.ct-widget-inner {
|
12 |
&[data-alignment="center"] {
|
13 |
text-align: center;
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
|
16 |
&[data-alignment="right"] {
|
17 |
text-align: right;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
.ct-mailchimp-widget-form {
|
22 |
|
23 |
+
.ct-mailchimp-description {
|
24 |
+
&:not(:empty) {
|
25 |
+
margin-bottom: 10px;
|
26 |
}
|
27 |
}
|
|
|
28 |
|
29 |
+
> *:not(:first-child) {
|
30 |
+
margin-top: 10px;
|
31 |
+
}
|
32 |
+
|
33 |
+
button {
|
34 |
+
width: 100%;
|
35 |
+
}
|
36 |
+
|
37 |
+
.gdpr-confirm-policy {
|
38 |
+
--display: inline-flex;
|
39 |
+
--contentSpacing: 0;
|
40 |
+
margin-top: 20px;
|
41 |
+
}
|
42 |
+
}
|
framework/extensions/trending/config.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$config = [
|
4 |
+
'title' => __('Trending Block', 'blc'),
|
5 |
+
'description' => __('Display a trending list of posts, products or custom post types at the bottom of your website.', 'blc')
|
6 |
+
];
|
framework/extensions/trending/customizer.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$all_post_types = [
|
4 |
+
'post' => __('Posts', 'blc')
|
5 |
+
];
|
6 |
+
|
7 |
+
if (class_exists('WooCommerce')) {
|
8 |
+
$all_post_types['product'] = __('Products', 'blc');
|
9 |
+
}
|
10 |
+
|
11 |
+
if (function_exists('blocksy_manager')) {
|
12 |
+
$post_types = blocksy_manager()->post_types->get_supported_post_types();
|
13 |
+
|
14 |
+
foreach ($post_types as $single_post_type) {
|
15 |
+
$post_type_object = get_post_type_object($single_post_type);
|
16 |
+
|
17 |
+
if (! $post_type_object) {
|
18 |
+
continue;
|
19 |
+
}
|
20 |
+
|
21 |
+
$all_post_types[$single_post_type] = $post_type_object->labels->singular_name;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
$options = [
|
26 |
+
'title' => __('Trending Posts', 'blc'),
|
27 |
+
'container' => [ 'priority' => 8 ],
|
28 |
+
'options' => [
|
29 |
+
'trending_posts_section_options' => [
|
30 |
+
'type' => 'ct-options',
|
31 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
32 |
+
'inner-options' => [
|
33 |
+
blocksy_rand_md5() => [
|
34 |
+
'type' => 'ct-title',
|
35 |
+
'label' => __( 'Trending Posts', 'blocksy' ),
|
36 |
+
],
|
37 |
+
|
38 |
+
blocksy_rand_md5() => [
|
39 |
+
'title' => __( 'General', 'blc' ),
|
40 |
+
'type' => 'tab',
|
41 |
+
'options' => [
|
42 |
+
'trending_block_post_type' => count($all_post_types) > 1 ? [
|
43 |
+
'label' => __( 'Post Type', 'blc' ),
|
44 |
+
'type' => 'ct-select',
|
45 |
+
'value' => 'post',
|
46 |
+
'design' => 'inline',
|
47 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
48 |
+
'choices' => blocksy_ordered_keys($all_post_types),
|
49 |
+
|
50 |
+
'sync' => [
|
51 |
+
'selector' => '.ct-trending-block',
|
52 |
+
'render' => function () {
|
53 |
+
echo blc_get_trending_block();
|
54 |
+
}
|
55 |
+
],
|
56 |
+
] : [
|
57 |
+
'label' => __('Post Type', 'blc'),
|
58 |
+
'type' => 'hidden',
|
59 |
+
'value' => 'post',
|
60 |
+
'design' => 'none',
|
61 |
+
'setting' => ['transport' => 'postMessage'],
|
62 |
+
],
|
63 |
+
|
64 |
+
'trending_block_filter' => [
|
65 |
+
'label' => __( 'Trending From', 'blc' ),
|
66 |
+
'type' => 'ct-select',
|
67 |
+
'value' => 'all_time',
|
68 |
+
'view' => 'text',
|
69 |
+
'design' => 'inline',
|
70 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
71 |
+
'choices' => blocksy_ordered_keys(
|
72 |
+
[
|
73 |
+
'all_time' => __( 'All Time', 'blc' ),
|
74 |
+
'last_24_hours' => __( 'Last 24 Hours', 'blc' ),
|
75 |
+
'last_7_days' => __( 'Last 7 Days', 'blc' ),
|
76 |
+
'last_month' => __( 'Last Month', 'blc' ),
|
77 |
+
]
|
78 |
+
),
|
79 |
+
|
80 |
+
'sync' => [
|
81 |
+
'selector' => '.ct-trending-block',
|
82 |
+
'render' => function () {
|
83 |
+
echo blocksy_get_trending_block();
|
84 |
+
}
|
85 |
+
],
|
86 |
+
],
|
87 |
+
|
88 |
+
blocksy_rand_md5() => [
|
89 |
+
'type' => 'ct-divider',
|
90 |
+
],
|
91 |
+
|
92 |
+
'trendingBlockContainerSpacing' => [
|
93 |
+
'label' => __( 'Container Inner Spacing', 'blc' ),
|
94 |
+
'type' => 'ct-slider',
|
95 |
+
'value' => [
|
96 |
+
'mobile' => '30px',
|
97 |
+
'tablet' => '30px',
|
98 |
+
'desktop' => '30px',
|
99 |
+
],
|
100 |
+
'units' => blocksy_units_config([
|
101 |
+
[
|
102 |
+
'unit' => 'px',
|
103 |
+
'min' => 0,
|
104 |
+
'max' => 100,
|
105 |
+
],
|
106 |
+
]),
|
107 |
+
'responsive' => true,
|
108 |
+
'sync' => 'live',
|
109 |
+
],
|
110 |
+
|
111 |
+
blocksy_rand_md5() => [
|
112 |
+
'type' => 'ct-divider',
|
113 |
+
],
|
114 |
+
|
115 |
+
'trending_block_visibility' => [
|
116 |
+
'label' => __( 'Container Visibility', 'blc' ),
|
117 |
+
'type' => 'ct-visibility',
|
118 |
+
'design' => 'block',
|
119 |
+
'sync' => 'live',
|
120 |
+
|
121 |
+
'value' => [
|
122 |
+
'desktop' => true,
|
123 |
+
'tablet' => true,
|
124 |
+
'mobile' => false,
|
125 |
+
],
|
126 |
+
|
127 |
+
'choices' => blocksy_ordered_keys([
|
128 |
+
'desktop' => __( 'Desktop', 'blc' ),
|
129 |
+
'tablet' => __( 'Tablet', 'blc' ),
|
130 |
+
'mobile' => __( 'Mobile', 'blc' ),
|
131 |
+
]),
|
132 |
+
],
|
133 |
+
|
134 |
+
],
|
135 |
+
],
|
136 |
+
|
137 |
+
blocksy_rand_md5() => [
|
138 |
+
'title' => __( 'Design', 'blc' ),
|
139 |
+
'type' => 'tab',
|
140 |
+
'options' => [
|
141 |
+
|
142 |
+
'trendingBlockFontColor' => [
|
143 |
+
'label' => __( 'Font Color', 'blc' ),
|
144 |
+
'type' => 'ct-color-picker',
|
145 |
+
'design' => 'inline',
|
146 |
+
'sync' => 'live',
|
147 |
+
|
148 |
+
'value' => [
|
149 |
+
'default' => [
|
150 |
+
'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT'),
|
151 |
+
],
|
152 |
+
|
153 |
+
'hover' => [
|
154 |
+
'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT'),
|
155 |
+
],
|
156 |
+
],
|
157 |
+
|
158 |
+
'pickers' => [
|
159 |
+
[
|
160 |
+
'title' => __( 'Initial', 'blc' ),
|
161 |
+
'id' => 'default',
|
162 |
+
'inherit' => 'var(--color)'
|
163 |
+
],
|
164 |
+
|
165 |
+
[
|
166 |
+
'title' => __( 'Hover', 'blc' ),
|
167 |
+
'id' => 'hover',
|
168 |
+
'inherit' => 'var(--linkHoverColor)'
|
169 |
+
],
|
170 |
+
],
|
171 |
+
],
|
172 |
+
|
173 |
+
'trending_block_background' => [
|
174 |
+
'label' => __( 'Container Background', 'blc' ),
|
175 |
+
'type' => 'ct-background',
|
176 |
+
'design' => 'inline',
|
177 |
+
'divider' => 'top',
|
178 |
+
'sync' => 'live',
|
179 |
+
'value' => blocksy_background_default_value([
|
180 |
+
'backgroundColor' => [
|
181 |
+
'default' => [
|
182 |
+
'color' => '#e0e3e8',
|
183 |
+
],
|
184 |
+
],
|
185 |
+
])
|
186 |
+
],
|
187 |
+
|
188 |
+
],
|
189 |
+
],
|
190 |
+
]
|
191 |
+
]
|
192 |
+
]
|
193 |
+
];
|
framework/extensions/trending/extension.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once dirname(__FILE__) . '/helpers.php';
|
4 |
+
|
5 |
+
class BlocksyExtensionTrending {
|
6 |
+
public function __construct() {
|
7 |
+
add_action('wp_enqueue_scripts', function () {
|
8 |
+
if (! function_exists('get_plugin_data')) {
|
9 |
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
10 |
+
}
|
11 |
+
|
12 |
+
$data = get_plugin_data(BLOCKSY__FILE__);
|
13 |
+
|
14 |
+
if (is_admin()) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
wp_enqueue_style(
|
19 |
+
'blocksy-ext-trending-styles',
|
20 |
+
BLOCKSY_URL . 'framework/extensions/trending/static/bundle/main.css',
|
21 |
+
['ct-main-styles'],
|
22 |
+
$data['Version']
|
23 |
+
);
|
24 |
+
|
25 |
+
wp_enqueue_script(
|
26 |
+
'blocksy-ext-trending-scripts',
|
27 |
+
BLOCKSY_URL . 'framework/extensions/trending/static/bundle/main.js',
|
28 |
+
['ct-events'],
|
29 |
+
$data['Version'],
|
30 |
+
true
|
31 |
+
);
|
32 |
+
});
|
33 |
+
|
34 |
+
add_filter(
|
35 |
+
'blocksy_extensions_customizer_options',
|
36 |
+
function ($opts) {
|
37 |
+
$opts['trending_posts_ext'] = blc_call_fn(
|
38 |
+
[
|
39 |
+
'fn' => 'blocksy_get_options',
|
40 |
+
'default' => 'array'
|
41 |
+
],
|
42 |
+
dirname( __FILE__ ) . '/customizer.php',
|
43 |
+
[], false
|
44 |
+
);
|
45 |
+
|
46 |
+
return $opts;
|
47 |
+
}
|
48 |
+
);
|
49 |
+
|
50 |
+
add_action(
|
51 |
+
'blocksy:template:after',
|
52 |
+
function () {
|
53 |
+
echo blc_get_trending_block();
|
54 |
+
}
|
55 |
+
);
|
56 |
+
|
57 |
+
add_action(
|
58 |
+
'customize_preview_init',
|
59 |
+
function () {
|
60 |
+
if (! function_exists('get_plugin_data')) {
|
61 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
62 |
+
}
|
63 |
+
|
64 |
+
$data = get_plugin_data(BLOCKSY__FILE__);
|
65 |
+
|
66 |
+
wp_enqueue_script(
|
67 |
+
'blocksy-trending-customizer-sync',
|
68 |
+
BLOCKSY_URL . 'framework/extensions/trending/static/bundle/sync.js',
|
69 |
+
['customize-preview', 'ct-events', 'ct-customizer'],
|
70 |
+
$data['Version'],
|
71 |
+
true
|
72 |
+
);
|
73 |
+
}
|
74 |
+
);
|
75 |
+
|
76 |
+
add_action('blocksy:global-dynamic-css:enqueue', function ($args) {
|
77 |
+
blocksy_theme_get_dynamic_styles(array_merge([
|
78 |
+
'path' => dirname( __FILE__ ) . '/global.php',
|
79 |
+
'chunk' => 'global'
|
80 |
+
], $args));
|
81 |
+
}, 10, 3);
|
82 |
+
}
|
83 |
+
}
|
framework/extensions/trending/global.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
blc_call_fn(['fn' => 'blocksy_output_background_css'], [
|
4 |
+
'selector' => '.ct-trending-block',
|
5 |
+
'css' => $css,
|
6 |
+
'value' => get_theme_mod(
|
7 |
+
'trending_block_background',
|
8 |
+
blc_call_fn([
|
9 |
+
'fn' => 'blocksy_background_default_value',
|
10 |
+
'default' => null
|
11 |
+
], [
|
12 |
+
'backgroundColor' => [
|
13 |
+
'default' => [
|
14 |
+
'color' => '#e0e3e8'
|
15 |
+
],
|
16 |
+
],
|
17 |
+
])
|
18 |
+
)
|
19 |
+
]);
|
20 |
+
|
21 |
+
blc_call_fn(['fn' => 'blocksy_output_responsive'], [
|
22 |
+
'css' => $css,
|
23 |
+
'tablet_css' => $tablet_css,
|
24 |
+
'mobile_css' => $mobile_css,
|
25 |
+
'selector' => ".ct-trending-block",
|
26 |
+
'variableName' => 'padding',
|
27 |
+
'value' => get_theme_mod('trendingBlockContainerSpacing', [
|
28 |
+
'mobile' => '30px',
|
29 |
+
'tablet' => '30px',
|
30 |
+
'desktop' => '30px',
|
31 |
+
]),
|
32 |
+
'unit' => ''
|
33 |
+
]);
|
34 |
+
|
35 |
+
blc_call_fn(['fn' => 'blocksy_output_colors'], [
|
36 |
+
'value' => get_theme_mod('trendingBlockFontColor'),
|
37 |
+
'default' => [
|
38 |
+
'default' => [ 'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT') ],
|
39 |
+
'hover' => [ 'color' => Blocksy_Css_Injector::get_skip_rule_keyword('DEFAULT') ],
|
40 |
+
],
|
41 |
+
'css' => $css,
|
42 |
+
'variables' => [
|
43 |
+
'default' => [
|
44 |
+
'selector' => '.ct-trending-block',
|
45 |
+
'variable' => 'color'
|
46 |
+
],
|
47 |
+
|
48 |
+
'hover' => [
|
49 |
+
'selector' => '.ct-trending-block',
|
50 |
+
'variable' => 'linkHoverColor'
|
51 |
+
],
|
52 |
+
],
|
53 |
+
]);
|
framework/extensions/trending/helpers.php
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action('wp_ajax_blocksy_get_trending_posts', 'blc_get_trending_posts');
|
4 |
+
add_action('wp_ajax_nopriv_blocksy_get_trending_posts', 'blc_get_trending_posts');
|
5 |
+
|
6 |
+
if (! function_exists('blc_get_trending_posts')) {
|
7 |
+
function blc_get_trending_posts() {
|
8 |
+
if (! isset($_REQUEST['page'])) {
|
9 |
+
wp_send_json_error();
|
10 |
+
}
|
11 |
+
|
12 |
+
$page = intval(sanitize_text_field($_REQUEST['page']));
|
13 |
+
|
14 |
+
if (! $page) {
|
15 |
+
wp_send_json_error();
|
16 |
+
}
|
17 |
+
|
18 |
+
wp_send_json_success([
|
19 |
+
'posts' => blc_get_trending_posts_value([
|
20 |
+
'paged' => $page
|
21 |
+
])
|
22 |
+
]);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
if (! function_exists('blc_get_trending_posts_value')) {
|
27 |
+
function blc_get_trending_posts_value($args = []) {
|
28 |
+
$args = wp_parse_args(
|
29 |
+
$args,
|
30 |
+
[
|
31 |
+
'paged' => 1
|
32 |
+
]
|
33 |
+
);
|
34 |
+
|
35 |
+
$date_query = [];
|
36 |
+
|
37 |
+
$date_filter = get_theme_mod('trending_block_filter', 'all_time');
|
38 |
+
|
39 |
+
if ($date_filter && 'all_time' !== $date_filter) {
|
40 |
+
$days = [
|
41 |
+
'last_24_hours' => 1,
|
42 |
+
'last_7_days' => 7,
|
43 |
+
'last_month' => 30
|
44 |
+
][$date_filter];
|
45 |
+
|
46 |
+
if (! $days) {
|
47 |
+
$days = 30;
|
48 |
+
}
|
49 |
+
|
50 |
+
$time = time() - (intval($days) * 24 * 60 * 60);
|
51 |
+
|
52 |
+
$date_query = array(
|
53 |
+
'after' => [
|
54 |
+
'year' => date('Y', $time),
|
55 |
+
'month' => date('n', $time),
|
56 |
+
'days' => date('j', $time),
|
57 |
+
],
|
58 |
+
'before' => [
|
59 |
+
'year' => date('Y'),
|
60 |
+
'month' => date('n'),
|
61 |
+
'days' => date('j'),
|
62 |
+
],
|
63 |
+
'inclusive' => true,
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
$post_type = get_theme_mod('trending_block_post_type', 'post');
|
68 |
+
|
69 |
+
if ($post_type === 'product' && !class_exists('WooCommerce')) {
|
70 |
+
$post_type = 'post';
|
71 |
+
}
|
72 |
+
|
73 |
+
$query = new WP_Query(
|
74 |
+
[
|
75 |
+
'post_type' => $post_type,
|
76 |
+
'order' => 'DESC',
|
77 |
+
'date_query' => $date_query,
|
78 |
+
'posts_per_page' => 4,
|
79 |
+
'orderby' => 'comment_count',
|
80 |
+
'paged' => $args['paged'],
|
81 |
+
'ignore_sticky_posts' => true,
|
82 |
+
'post_status' => 'publish'
|
83 |
+
]
|
84 |
+
);
|
85 |
+
|
86 |
+
if (! $query->have_posts()) {
|
87 |
+
return [
|
88 |
+
'posts' => [],
|
89 |
+
'is_last_page' => false
|
90 |
+
];
|
91 |
+
}
|
92 |
+
|
93 |
+
$result = [];
|
94 |
+
|
95 |
+
while ($query->have_posts()) {
|
96 |
+
$query->the_post();
|
97 |
+
|
98 |
+
$result[] = [
|
99 |
+
'id' => get_the_ID(),
|
100 |
+
'attachment_id' => get_post_thumbnail_id(),
|
101 |
+
'title' => get_the_title(),
|
102 |
+
'url' => get_permalink(),
|
103 |
+
'image' => blc_call_fn(['fn' => 'blocksy_image'], [
|
104 |
+
'attachment_id' => get_post_thumbnail_id(),
|
105 |
+
'size' => 'thumbnail',
|
106 |
+
'ratio' => '1/1',
|
107 |
+
'tag_name' => 'div',
|
108 |
+
])
|
109 |
+
];
|
110 |
+
}
|
111 |
+
|
112 |
+
$is_last = intval($query->max_num_pages) === intval($args['paged']);
|
113 |
+
|
114 |
+
wp_reset_postdata();
|
115 |
+
|
116 |
+
return [
|
117 |
+
'posts' => $result,
|
118 |
+
'is_last_page' => $is_last
|
119 |
+
];
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
if (! function_exists('blc_get_trending_block')) {
|
124 |
+
function blc_get_trending_block($forced = false) {
|
125 |
+
$result = blc_get_trending_posts_value();
|
126 |
+
|
127 |
+
if (empty($result['posts'])) {
|
128 |
+
return '';
|
129 |
+
}
|
130 |
+
|
131 |
+
ob_start();
|
132 |
+
|
133 |
+
$data_page = 'data-page="1"';
|
134 |
+
|
135 |
+
if ($result['is_last_page']) {
|
136 |
+
$data_page = '';
|
137 |
+
}
|
138 |
+
|
139 |
+
$class = 'ct-trending-block';
|
140 |
+
|
141 |
+
$class .= ' ' . blc_call_fn(
|
142 |
+
['fn' => 'blocksy_visibility_classes'],
|
143 |
+
get_theme_mod('trending_block_visibility', [
|
144 |
+
'desktop' => true,
|
145 |
+
'tablet' => true,
|
146 |
+
'mobile' => false,
|
147 |
+
])
|
148 |
+
);
|
149 |
+
|
150 |
+
?>
|
151 |
+
|
152 |
+
<section class="<?php echo $class ?>">
|
153 |
+
<div class="ct-container" <?php echo $data_page ?>>
|
154 |
+
<h5 class="ct-block-title">
|
155 |
+
<?php echo __('Trending now', 'blc') ?>
|
156 |
+
|
157 |
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline><polyline points="17 6 23 6 23 12"></polyline></svg>
|
158 |
+
|
159 |
+
<?php if (! $result['is_last_page']) { ?>
|
160 |
+
<span class="ct-arrow-left">
|
161 |
+
</span>
|
162 |
+
|
163 |
+
<span class="ct-arrow-right">
|
164 |
+
</span>
|
165 |
+
<?php } ?>
|
166 |
+
</h5>
|
167 |
+
|
168 |
+
<?php
|
169 |
+
foreach ($result['posts'] as $post) {
|
170 |
+
echo blocksy_html_tag(
|
171 |
+
'a',
|
172 |
+
[
|
173 |
+
'href' => $post['url']
|
174 |
+
],
|
175 |
+
|
176 |
+
$post['image'] . blocksy_html_tag(
|
177 |
+
'span',
|
178 |
+
[
|
179 |
+
'class' => 'ct-item-title',
|
180 |
+
],
|
181 |
+
$post['title']
|
182 |
+
)
|
183 |
+
);
|
184 |
+
}
|
185 |
+
|
186 |
+
?>
|
187 |
+
|
188 |
+
</div>
|
189 |
+
</section>
|
190 |
+
|
191 |
+
<?php
|
192 |
+
|
193 |
+
return ob_get_clean();
|
194 |
+
}
|
195 |
+
}
|
framework/extensions/trending/static/bundle/main.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* - v1.7.32
|
3 |
+
*
|
4 |
+
* Copyright (c) 2020
|
5 |
+
* Licensed GPLv2+
|
6 |
+
*/
|
7 |
+
|
framework/extensions/trending/static/bundle/main.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e){t.exports=ctEvents},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n);function a(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var c=function(t){return a(t.querySelectorAll(".ct-image-container.ct-lazy")).map((function(t){t.querySelector("img")&&(t.querySelector("img").setAttribute("src",t.querySelector("img").dataset.ctLazy),t.querySelector("img").dataset.ctLazySet&&t.querySelector("img").setAttribute("srcset",t.querySelector("img").dataset.ctLazySet)),t.classList.remove("ct-lazy"),t.classList.add("ct-lazy-loaded")}))};function l(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return r}(t,e)||s(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){if(t){if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var p,b={},v=function(t){return b[t]?new Promise((function(e){e(b[t]),window.ct_customizer_localizations||(b[t]=b[t].clone())})):new Promise((function(e){return fetch(t).then((function(r){e(r),window.ct_customizer_localizations||(b[t]=r.clone())}))}))},g=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((t=y({el:null,action:null},t)).el&&t.action&&!t.el.classList.contains("ct-loading")){var e=parseInt(t.el.dataset.page,10);if(("prev"!==t.action||1!==e)&&!(t.el.querySelectorAll(".ct-container > a").length<4&&1===e||t.el.dataset.page.indexOf("last")>-1&&"next"===t.action)){t.el.classList.add("ct-loading");var r="prev"===t.action?e-1:e+1;Promise.all([new Promise((function(e){t.el.classList.add("ct-leave-active"),requestAnimationFrame((function(){t.el.classList.remove("ct-leave-active"),t.el.classList.add("ct-leave"),setTimeout((function(){return e()}),650)}))})),v("".concat(ct_localizations.ajax_url,"?action=blocksy_get_trending_posts&page=").concat(r)).then((function(t){return t.json()}))]).then((function(e){var n=u(e,2),o=(n[0],n[1]),a=o.success,i=o.data;if(a){var s=i.posts,f=s.is_last_page,d=s.posts;t.el.dataset.page="".concat(r).concat(f?":last":""),l(t.el.querySelectorAll("a")).map((function(t){return t.remove()})),d.map((function(e){return t.el.insertAdjacentHTML("beforeend",'<a href="'.concat(e.url,'">\n ').concat(e.image,'\n <span class="ct-item-title">\n ').concat(e.title,"\n </span>\n </a>"))})),setTimeout((function(){t.el.classList.remove("ct-leave"),t.el.classList.add("ct-enter-active"),requestAnimationFrame((function(){t.el.classList.remove("ct-enter-active"),t.el.classList.add("ct-active"),setTimeout((function(){t.el.classList.remove("ct-active"),t.el.classList.remove("ct-loading")}),650)}))}),50),c(t.el)}}))}}},S=function(){Array.from(document.querySelectorAll(".ct-trending-block [data-page]")).map((function(t){return function(t){t.hasListeners||(t.hasListeners=!0,t.querySelector(".ct-arrow-left").addEventListener("click",(function(e){e.preventDefault(),g({el:t,action:"prev"})})),t.querySelector(".ct-arrow-right").addEventListener("click",(function(e){e.preventDefault(),g({el:t,action:"next"})})))}(t)}))};p=function(){S()},/comp|inter|loaded/.test(document.readyState)?p():document.addEventListener("DOMContentLoaded",p,!1),o.a.on("blocksy:frontend:init",(function(){S()}))}]);
|
framework/extensions/trending/static/bundle/sync.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=window.blocksyCustomizerSync},function(e,t,n){"use strict";n.r(t);var o,r=function(e){if([e.top,e.right,e.bottom,e.left].reduce((function(e,t){return!!e&&!("auto"!==t&&t&&t.toString().match(/\d/g))}),!0))return"CT_CSS_SKIP_RULE";var t=["auto"!==e.top&&e.top.toString().match(/\d/g)?e.top:0,"auto"!==e.right&&e.right.toString().match(/\d/g)?e.right:0,"auto"!==e.bottom&&e.bottom.toString().match(/\d/g)?e.bottom:0,"auto"!==e.left&&e.left.toString().match(/\d/g)?e.left:0];return t[0]===t[1]&&t[0]===t[2]&&t[0]===t[3]?t[0]:t[0]===t[2]&&t[1]===t[3]?"".concat(t[0]," ").concat(t[3]):t.join(" ")},c=function(e,t){var n=t.forcedOutput,o=void 0!==n&&n;if("CT_CSS_SKIP_RULE"===e)return"CT_CSS_SKIP_RULE";if("none"===e)return"none";if(!e.enable)return o?"none":"CT_CSS_SKIP_RULE";if(0===parseFloat(e.blur)&&0===parseFloat(e.spread)&&0===parseFloat(e.v_offset)&&0===parseFloat(e.h_offset))return o?"none":"CT_CSS_SKIP_RULE";var r=[];return e.inset&&r.push("inset"),r.push("".concat(e.h_offset,"px")),r.push("".concat(e.v_offset,"px")),0!==parseFloat(e.blur)&&(r.push("".concat(e.blur,"px")),0!==parseFloat(e.spread)&&r.push("".concat(e.spread,"px"))),0===parseFloat(e.blur)&&0!==parseFloat(e.spread)&&(r.push("".concat(e.blur,"px")),r.push("".concat(e.spread,"px"))),r.push(e.color.color),r.join(" ")},a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",o={desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"},r=document.querySelector("style#".concat(o[n])),c=r.innerText,a="".concat(e["".concat(n,"_selector_prefix")]?"".concat(e["".concat(n,"_selector_prefix")]," "):"").concat(e.selector||":root"),i=null,l=c.match(i);0===c.trim().indexOf(a)?(i=new RegExp("".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(i)):(i=new RegExp("\\}\\s*?".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(i)),l||(0===(c="".concat(c," ").concat(a," { }")).trim().indexOf(a)?(i=new RegExp("".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(i)):(i=new RegExp("\\}\\s*?".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{[\\s\\S]*?}"),"gm"),l=c.match(i))),r.innerText=c.replace(i,l[0].indexOf("--".concat(e.variable,":"))>-1?l[0].replace(new RegExp("--".concat(e.variable,":[\\s\\S]*?;"),"gm"),t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";")):l[0].replace(new RegExp("".concat(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s?{"),"gm"),"".concat(a," {").concat(t.indexOf("CT_CSS_SKIP_RULE")>-1||t.indexOf(e.variable)>-1?"":"--".concat(e.variable,": ").concat(t,";"))))},i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",o=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:t;"border"===(e.type||"")&&(o="none"===t.style?"none":"".concat(t.width,"px ").concat(t.style," ").concat(t.color.color)),"spacing"===(e.type||"")&&(o=r(t)),"box-shadow"===(e.type||"")&&(o=c(t,e)),a(e,"".concat(o).concat(e.unit||"").concat(e.important?" !important":""),n)},l=function(e,t){var n=t;t=e.extractValue?e.extractValue(t):t,e.whenDone&&e.whenDone(t,n),t=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&Object.keys(e).indexOf("desktop")>-1?t?e:e.desktop:t?{desktop:e,tablet:e,mobile:e}:e}(t,!!e.responsive),e.responsive?(e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),i(e,t.desktop,"desktop"),i(e,t.tablet,"tablet"),i(e,t.mobile,"mobile")):i(e,t)},s=n(0);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({trendingBlockContainerSpacing:{selector:".ct-trending-block",variable:"padding",responsive:!0,unit:""},trendingBlockFontColor:[{selector:".ct-trending-block",variable:"color",type:"color:default"},{selector:".ct-trending-block",variable:"linkHoverColor",type:"color:hover"}]},Object(s.handleBackgroundOptionFor)({id:"trending_block_background",selector:".ct-trending-block"})),wp.customize.bind("change",(function(e){return o[e.id]&&(Array.isArray(o[e.id])?o[e.id]:[o[e.id]]).map((function(t){return l(t,e())}))})),wp.customize("trending_block_visibility",(function(e){return e.bind((function(e){return Object(s.responsiveClassesFor)("trending_block_visibility",document.querySelector(".ct-trending-block"))}))}))}]);
|
framework/extensions/trending/static/js/main.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { onDocumentLoaded } from '../../../cookies-consent/static/js/helpers'
|
2 |
+
import ctEvents from 'ct-events'
|
3 |
+
import { mount } from './trending-block'
|
4 |
+
|
5 |
+
const initTrending = () => {
|
6 |
+
Array.from(
|
7 |
+
document.querySelectorAll('.ct-trending-block [data-page]')
|
8 |
+
).map(el => mount(el))
|
9 |
+
}
|
10 |
+
|
11 |
+
onDocumentLoaded(() => {
|
12 |
+
initTrending()
|
13 |
+
})
|
14 |
+
|
15 |
+
ctEvents.on('blocksy:frontend:init', () => {
|
16 |
+
initTrending()
|
17 |
+
})
|
framework/extensions/trending/static/js/sync.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { handleVariablesFor } from 'customizer-sync-helpers'
|
2 |
+
import {
|
3 |
+
handleBackgroundOptionFor,
|
4 |
+
responsiveClassesFor
|
5 |
+
} from 'blocksy-customizer-sync'
|
6 |
+
|
7 |
+
handleVariablesFor({
|
8 |
+
trendingBlockContainerSpacing: {
|
9 |
+
selector: '.ct-trending-block',
|
10 |
+
variable: 'padding',
|
11 |
+
responsive: true,
|
12 |
+
unit: ''
|
13 |
+
},
|
14 |
+
|
15 |
+
trendingBlockFontColor: [
|
16 |
+
{
|
17 |
+
selector: '.ct-trending-block',
|
18 |
+
variable: 'color',
|
19 |
+
type: 'color:default'
|
20 |
+
},
|
21 |
+
|
22 |
+
{
|
23 |
+
selector: '.ct-trending-block',
|
24 |
+
variable: 'linkHoverColor',
|
25 |
+
type: 'color:hover'
|
26 |
+
}
|
27 |
+
],
|
28 |
+
|
29 |
+
...handleBackgroundOptionFor({
|
30 |
+
id: 'trending_block_background',
|
31 |
+
selector: '.ct-trending-block'
|
32 |
+
})
|
33 |
+
})
|
34 |
+
|
35 |
+
wp.customize('trending_block_visibility', value =>
|
36 |
+
value.bind(to =>
|
37 |
+
responsiveClassesFor(
|
38 |
+
'trending_block_visibility',
|
39 |
+
document.querySelector('.ct-trending-block')
|
40 |
+
)
|
41 |
+
)
|
42 |
+
)
|
framework/extensions/trending/static/js/trending-block.js
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { markImagesAsLoaded } from '../../../cookies-consent/static/js/lazy-load-helpers'
|
2 |
+
|
3 |
+
const store = {}
|
4 |
+
|
5 |
+
const cachedFetch = url =>
|
6 |
+
store[url]
|
7 |
+
? new Promise(resolve => {
|
8 |
+
resolve(store[url])
|
9 |
+
if (!window.ct_customizer_localizations) {
|
10 |
+
store[url] = store[url].clone()
|
11 |
+
}
|
12 |
+
})
|
13 |
+
: new Promise(resolve =>
|
14 |
+
fetch(url).then(response => {
|
15 |
+
resolve(response)
|
16 |
+
|
17 |
+
if (!window.ct_customizer_localizations) {
|
18 |
+
store[url] = response.clone()
|
19 |
+
}
|
20 |
+
})
|
21 |
+
)
|
22 |
+
|
23 |
+
const loadPage = (args = {}) => {
|
24 |
+
args = {
|
25 |
+
el: null,
|
26 |
+
// prev | next
|
27 |
+
action: null,
|
28 |
+
|
29 |
+
...args
|
30 |
+
}
|
31 |
+
|
32 |
+
if (!args.el) {
|
33 |
+
return
|
34 |
+
}
|
35 |
+
|
36 |
+
if (!args.action) {
|
37 |
+
return
|
38 |
+
}
|
39 |
+
|
40 |
+
if (args.el.classList.contains('ct-loading')) {
|
41 |
+
return
|
42 |
+
}
|
43 |
+
|
44 |
+
let currentPage = parseInt(args.el.dataset.page, 10)
|
45 |
+
|
46 |
+
if (args.action === 'prev' && currentPage === 1) {
|
47 |
+
return
|
48 |
+
}
|
49 |
+
|
50 |
+
if (args.el.querySelectorAll('.ct-container > a').length < 4) {
|
51 |
+
if (currentPage === 1) {
|
52 |
+
return
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
if (args.el.dataset.page.indexOf('last') > -1) {
|
57 |
+
if (args.action === 'next') {
|
58 |
+
return
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
args.el.classList.add('ct-loading')
|
63 |
+
|
64 |
+
let newPage = args.action === 'prev' ? currentPage - 1 : currentPage + 1
|
65 |
+
|
66 |
+
Promise.all([
|
67 |
+
new Promise(resolve => {
|
68 |
+
args.el.classList.add('ct-leave-active')
|
69 |
+
requestAnimationFrame(() => {
|
70 |
+
args.el.classList.remove('ct-leave-active')
|
71 |
+
args.el.classList.add('ct-leave')
|
72 |
+
|
73 |
+
setTimeout(() => resolve(), 650)
|
74 |
+
})
|
75 |
+
}),
|
76 |
+
|
77 |
+
cachedFetch(
|
78 |
+
`${ct_localizations.ajax_url}?action=blocksy_get_trending_posts&page=${newPage}`
|
79 |
+
).then(response => response.json())
|
80 |
+
]).then(([_, { success, data }]) => {
|
81 |
+
if (!success) {
|
82 |
+
return
|
83 |
+
}
|
84 |
+
|
85 |
+
let {
|
86 |
+
posts: { is_last_page, posts }
|
87 |
+
} = data
|
88 |
+
|
89 |
+
args.el.dataset.page = `${newPage}${is_last_page ? ':last' : ''}`
|
90 |
+
;[...args.el.querySelectorAll('a')].map(el => el.remove())
|
91 |
+
|
92 |
+
posts.map(post =>
|
93 |
+
args.el.insertAdjacentHTML(
|
94 |
+
'beforeend',
|
95 |
+
`<a href="${post.url}">
|
96 |
+
${post.image}
|
97 |
+
<span class="ct-item-title">
|
98 |
+
${post.title}
|
99 |
+
</span>
|
100 |
+
</a>`
|
101 |
+
)
|
102 |
+
)
|
103 |
+
|
104 |
+
setTimeout(() => {
|
105 |
+
args.el.classList.remove('ct-leave')
|
106 |
+
args.el.classList.add('ct-enter-active')
|
107 |
+
|
108 |
+
requestAnimationFrame(() => {
|
109 |
+
args.el.classList.remove('ct-enter-active')
|
110 |
+
args.el.classList.add('ct-active')
|
111 |
+
|
112 |
+
setTimeout(() => {
|
113 |
+
args.el.classList.remove('ct-active')
|
114 |
+
args.el.classList.remove('ct-loading')
|
115 |
+
}, 650)
|
116 |
+
})
|
117 |
+
}, 50)
|
118 |
+
|
119 |
+
markImagesAsLoaded(args.el)
|
120 |
+
})
|
121 |
+
}
|
122 |
+
|
123 |
+
export const mount = el => {
|
124 |
+
if (el.hasListeners) {
|
125 |
+
return
|
126 |
+
}
|
127 |
+
|
128 |
+
el.hasListeners = true
|
129 |
+
|
130 |
+
el.querySelector('.ct-arrow-left').addEventListener('click', e => {
|
131 |
+
e.preventDefault()
|
132 |
+
loadPage({ el, action: 'prev' })
|
133 |
+
})
|
134 |
+
|
135 |
+
el.querySelector('.ct-arrow-right').addEventListener('click', e => {
|
136 |
+
e.preventDefault()
|
137 |
+
loadPage({ el, action: 'next' })
|
138 |
+
})
|
139 |
+
}
|
framework/extensions/trending/static/sass/main.scss
ADDED
File without changes
|
framework/extensions/widgets/static/bundle/main.css
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/**
|
2 |
-
* - v1.
|
3 |
*
|
4 |
-
* Copyright (c)
|
5 |
* Licensed GPLv2+
|
6 |
*/
|
7 |
|
8 |
-
.ct-posts-widget ul
|
1 |
/**
|
2 |
+
* - v1.7.32
|
3 |
*
|
4 |
+
* Copyright (c) 2020
|
5 |
* Licensed GPLv2+
|
6 |
*/
|
7 |
|
8 |
+
.ct-posts-widget ul{--listItemSpacing: 20px}.ct-posts-widget ul a{display:var(--display, grid)}.ct-posts-widget ul .ct-image-container{align-self:start}.ct-posts-widget ul .ct-entry-content{align-self:center}.ct-posts-widget ul .ct-post-title{--fontSize: 15px;--lineHeight: 1.5;--fontWeight: 500;word-break:break-word}.ct-posts-widget ul .ct-entry-excerpt{margin-top:5px;font-size:13px;color:var(--color)}.ct-posts-widget ul .ct-entry-meta{color:var(--color)}.ct-posts-widget ul .ct-entry-meta span:not(:last-child):after{content:'/';margin:0 3px}.ct-posts-widget ul[data-type="rounded"] a,.ct-posts-widget ul[data-type="large-small"] a,.ct-posts-widget ul[data-type="small-thumbs"] a{grid-template-columns:25% 1fr;grid-column-gap:20px}.ct-posts-widget ul[data-type="no-thumbs"] a{--display: block}.ct-posts-widget ul[data-type="large-thumbs"]{--listItemSpacing: 25px}.ct-posts-widget ul[data-type="large-thumbs"] a{--display: block}.ct-posts-widget ul[data-type="large-thumbs"] a .ct-image-container{margin-bottom:12px}.ct-posts-widget ul[data-type="large-thumbs"] a .ct-post-title{--fontSize: 17px;--fontWeight: 600}.ct-posts-widget ul[data-type="large-small"] li:first-child{--listItemSpacing: 30px}.ct-posts-widget ul[data-type="large-small"] li:first-child a{--display: block}.ct-posts-widget ul[data-type="large-small"] li:first-child a .ct-image-container{margin-bottom:20px}.ct-posts-widget ul[data-type="large-small"] li:first-child a .ct-post-title{--fontSize: 17px;--fontWeight: 600}.ct-posts-widget ul[data-type="rounded"] .ct-image-container{overflow:hidden;border-radius:100%;-webkit-mask-image:-webkit-radial-gradient(white, black)}.ct-posts-widget ul[data-type="numbered"]{counter-reset:ct-counter}.ct-posts-widget ul[data-type="numbered"] a{grid-template-columns:34px 1fr;grid-column-gap:15px}.ct-posts-widget ul[data-type="numbered"] a:before{counter-increment:ct-counter;content:counter(ct-counter);display:flex;align-items:center;justify-content:center;width:34px;height:34px;font-size:12px;font-weight:700;border-radius:100%;border:1px solid #E5E5E5;transition:var(--transition)}.ct-posts-widget ul[data-type="numbered"] a:hover:before{color:#fff;border-color:var(--paletteColor1);background:var(--paletteColor1)}.ct-posts-widget ul[data-type="numbered"] .ct-post-title::before{content:'';display:block;height:0;width:0;margin-top:calc((1 - 1.65) * 0.5em)}.ct-quote-widget{--color: #fff;position:relative;min-height:250px;border-radius:7px;padding:70px 40px 60px 60px !important;background:var(--paletteColor1) !important}.ct-quote-widget:before{position:absolute;top:50px;left:35px;content:"”";font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-weight:bold;font-size:200px;line-height:150px;opacity:0.3;width:80px;height:80px;display:flex;justify-content:center;transform:rotate(180deg)}.ct-quote-widget .ct-quote-author{display:grid;grid-template-columns:40px 1fr;grid-column-gap:15px;align-items:center;margin-top:25px;--fontWeight: 500}.ct-quote-widget .ct-quote-author figure{max-width:40px;border-radius:100%}.ct-about-me-widget figure{margin-bottom:15px}.ct-about-me-widget figure[data-size="small"]{max-width:90px}.ct-about-me-widget figure[data-size="medium"]{max-width:140px}.ct-about-me-widget figure[data-shape="square"]{border-radius:2px}.ct-about-me-widget figure[data-shape="rounded"]{border-radius:100%}.ct-about-me-widget .ct-about-me-name{display:flex;flex-direction:column}.ct-about-me-widget .ct-about-me-name:not(:last-child){margin-bottom:15px}.ct-about-me-widget .ct-about-me-text:not(:last-child){margin-bottom:25px}.ct-about-me-widget .ct-about-me-link{font-size:13px;font-weight:normal}.ct-about-me-widget [data-alignment="center"]{text-align:center}.ct-about-me-widget [data-alignment="center"] .ct-social-box{justify-content:center}.ct-about-me-widget [data-alignment="right"]{text-align:right}.ct-about-me-widget [data-alignment="right"] .ct-social-box{justify-content:flex-end}.ct-about-me-widget [data-type="bordered"]{padding:35px 25px;border-radius:7px;background:#fff;border:1px dashed rgba(0,0,0,0.1)}.ct-facebook-like-box{overflow:hidden;--fbHeader: 0px;--fbFacepile: 0px}.ct-facebook-like-box .fb-page{display:flex;justify-content:center}.ct-facebook-like-box .fb-page[data-small-header="false"]{--fbHeader: 130px}.ct-facebook-like-box .fb-page[data-small-header="true"]{--fbHeader: 70px}.ct-facebook-like-box .fb-page[data-show-facepile="true"]{--fbFacepile: 84px}.ct-facebook-like-box .fb-page:not([data-tabs="timeline"]){min-height:calc(var(--fbHeader) + var(--fbFacepile))}.ct-facebook-like-box .fb-page[data-tabs="timeline"]{min-height:500px}.ct-facebook-like-box iframe{max-width:500px;margin:0 auto}[class*="ct-contact-info"] ul{--contentSpacing: 0}[class*="ct-contact-info"] li{display:grid;grid-template-columns:auto 1fr;grid-column-gap:15px;align-items:center}[class*="ct-contact-info"] .contact-info{display:flex;flex-direction:column;color:var(--color)}[class*="ct-contact-info"] .contact-title{font-weight:600}[class*="ct-contact-info"] .ct-contact-info-text{margin-bottom:20px}.ct-contact-info-widget{--listItemSpacing: 20px}.ct-contact-info-widget .contact-info{font-size:15px;line-height:1.4}.ct-socials-widget [data-icons-type*="solid"],.ct-about-me-widget [data-icons-type*="solid"],.ct-contact-info-widget [data-icons-type*="solid"]{--icon-color: rgba(100, 110, 119, 1);--icon-hover-color: #fff;--background-color: rgba(218, 222, 228, 0.3);--background-hover-color: var(--paletteColor1)}.ct-socials-widget [data-icons-type*="outline"],.ct-about-me-widget [data-icons-type*="outline"],.ct-contact-info-widget [data-icons-type*="outline"]{--icon-color: rgba(100, 110, 119, 1);--icon-hover-color: var(--paletteColor1);--background-color: rgba(218, 222, 228, 1);--background-hover-color: var(--paletteColor1)}
|
framework/extensions/widgets/static/sass/about-me.scss
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ct-about-me-widget {
|
2 |
+
|
3 |
+
figure {
|
4 |
+
margin-bottom: 15px;
|
5 |
+
|
6 |
+
&[data-size="small"] {
|
7 |
+
max-width: 90px;
|
8 |
+
}
|
9 |
+
|
10 |
+
&[data-size="medium"] {
|
11 |
+
max-width: 140px;
|
12 |
+
}
|
13 |
+
|
14 |
+
&[data-shape="square"] {
|
15 |
+
border-radius: 2px;
|
16 |
+
}
|
17 |
+
|
18 |
+
&[data-shape="rounded"] {
|
19 |
+
border-radius: 100%;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
.ct-about-me-name {
|
24 |
+
display: flex;
|
25 |
+
flex-direction: column;
|
26 |
+
|
27 |
+
&:not(:last-child) {
|
28 |
+
margin-bottom: 15px;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
.ct-about-me-text {
|
33 |
+
&:not(:last-child) {
|
34 |
+
margin-bottom: 25px;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
.ct-about-me-link {
|
39 |
+
font-size: 13px;
|
40 |
+
font-weight: normal;
|
41 |
+
}
|
42 |
+
|
43 |
+
// alignment
|
44 |
+
[data-alignment="center"] {
|
45 |
+
text-align: center;
|
46 |
+
|
47 |
+
.ct-social-box {
|
48 |
+
justify-content: center;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
[data-alignment="right"] {
|
53 |
+
text-align: right;
|
54 |
+
|
55 |
+
.ct-social-box {
|
56 |
+
justify-content: flex-end;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
// bordered
|
61 |
+
[data-type="bordered"] {
|
62 |
+
padding: 35px 25px;
|
63 |
+
border-radius: 7px;
|
64 |
+
background: #fff;
|
65 |
+
border: 1px dashed rgba(0, 0, 0, 0.1);
|
66 |
+
}
|
67 |
+
}
|
framework/extensions/widgets/static/sass/contact-info.scss
CHANGED
@@ -1,45 +1,38 @@
|
|
1 |
-
|
2 |
|
3 |
ul {
|
4 |
-
|
5 |
-
margin-top: 30px;
|
6 |
-
|
7 |
-
li {
|
8 |
-
display: flex;
|
9 |
-
align-items: center;
|
10 |
-
margin-bottom: 20px;
|
11 |
-
}
|
12 |
}
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
}
|
20 |
}
|
21 |
|
22 |
.contact-info {
|
23 |
display: flex;
|
24 |
flex-direction: column;
|
|
|
25 |
}
|
26 |
|
27 |
.contact-title {
|
28 |
font-weight: 600;
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
|
34 |
-
i {
|
35 |
-
background: rgba(218, 222, 228, 0.3);
|
36 |
-
transition: color 0.12s cubic-bezier(0.455, 0.03, 0.515, 0.955),
|
37 |
-
background 0.12s cubic-bezier(0.455, 0.03, 0.515, 0.955);
|
38 |
-
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
1 |
+
[class*="ct-contact-info"] {
|
2 |
|
3 |
ul {
|
4 |
+
--contentSpacing: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
6 |
|
7 |
+
li {
|
8 |
+
display: grid;
|
9 |
+
grid-template-columns: auto 1fr;
|
10 |
+
grid-column-gap: 15px;
|
11 |
+
align-items: center;
|
|
|
12 |
}
|
13 |
|
14 |
.contact-info {
|
15 |
display: flex;
|
16 |
flex-direction: column;
|
17 |
+
color: var(--color);
|
18 |
}
|
19 |
|
20 |
.contact-title {
|
21 |
font-weight: 600;
|
22 |
}
|
23 |
|
24 |
+
.ct-contact-info-text {
|
25 |
+
margin-bottom: 20px;
|
26 |
+
}
|
27 |
+
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
// widget
|
31 |
+
.ct-contact-info-widget {
|
32 |
+
--listItemSpacing: 20px;
|
33 |
+
|
34 |
+
.contact-info {
|
35 |
+
font-size: 15px;
|
36 |
+
line-height: 1.4;
|
37 |
}
|
38 |
}
|
framework/extensions/widgets/static/sass/facebook.scss
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ct-facebook-like-box {
|
2 |
+
overflow: hidden;
|
3 |
+
|
4 |
+
--fbHeader: 0px;
|
5 |
+
--fbFacepile: 0px;
|
6 |
+
|
7 |
+
.fb-page {
|
8 |
+
display: flex;
|
9 |
+
justify-content: center;
|
10 |
+
|
11 |
+
&[data-small-header="false"] {
|
12 |
+
--fbHeader: 130px;
|
13 |
+
}
|
14 |
+
|
15 |
+
&[data-small-header="true"] {
|
16 |
+
--fbHeader: 70px;
|
17 |
+
}
|
18 |
+
|
19 |
+
&[data-show-facepile="true"] {
|
20 |
+
--fbFacepile: 84px;
|
21 |
+
}
|
22 |
+
|
23 |
+
&:not([data-tabs="timeline"]) {
|
24 |
+
min-height: calc(var(--fbHeader) + var(--fbFacepile));
|
25 |
+
}
|
26 |
+
|
27 |
+
&[data-tabs="timeline"] {
|
28 |
+
min-height: 500px;
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
iframe {
|
34 |
+
max-width: 500px;
|
35 |
+
margin: 0 auto;
|
36 |
+
}
|
37 |
+
}
|
framework/extensions/widgets/static/sass/main.scss
CHANGED
@@ -1,4 +1,8 @@
|
|
1 |
@import '../../../../../static/sass/common-frontend';
|
2 |
|
3 |
@import 'posts';
|
|
|
|
|
|
|
4 |
@import 'contact-info';
|
|
1 |
@import '../../../../../static/sass/common-frontend';
|
2 |
|
3 |
@import 'posts';
|
4 |
+
@import 'quote';
|
5 |
+
@import 'about-me';
|
6 |
+
@import 'facebook';
|
7 |
@import 'contact-info';
|
8 |
+
@import 'social-icons';
|
framework/extensions/widgets/static/sass/posts.scss
CHANGED
@@ -1,49 +1,132 @@
|
|
1 |
-
.ct-posts-widget {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
.ct-image-container {
|
8 |
-
|
|
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
-
.ct-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
display: flex;
|
23 |
-
|
24 |
justify-content: center;
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
word-break: break-word;
|
33 |
-
@include lhCrop(1.65);
|
34 |
-
}
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
margin: 0 3px;
|
43 |
-
}
|
44 |
-
}
|
45 |
}
|
46 |
}
|
47 |
}
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
-
}
|
1 |
+
.ct-posts-widget ul {
|
2 |
+
--listItemSpacing: 20px;
|
3 |
+
|
4 |
+
a {
|
5 |
+
display: var(--display, grid);
|
6 |
+
}
|
7 |
+
|
8 |
+
.ct-image-container {
|
9 |
+
align-self: start;
|
10 |
+
}
|
11 |
+
|
12 |
+
.ct-entry-content {
|
13 |
+
align-self: center;
|
14 |
+
}
|
15 |
+
|
16 |
+
.ct-post-title {
|
17 |
+
--fontSize: 15px;
|
18 |
+
--lineHeight: 1.5;
|
19 |
+
--fontWeight: 500;
|
20 |
+
word-break: break-word;
|
21 |
+
}
|
22 |
+
|
23 |
+
.ct-entry-excerpt {
|
24 |
+
margin-top: 5px;
|
25 |
+
font-size: 13px;
|
26 |
+
color: var(--color);
|
27 |
+
}
|
28 |
+
|
29 |
+
.ct-entry-meta {
|
30 |
+
color: var(--color);
|
31 |
+
|
32 |
+
span:not(:last-child) {
|
33 |
+
&:after {
|
34 |
+
content: '/';
|
35 |
+
margin: 0 3px;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
&[data-type="rounded"],
|
42 |
+
&[data-type="large-small"],
|
43 |
+
&[data-type="small-thumbs"] {
|
44 |
+
a {
|
45 |
+
grid-template-columns: 25% 1fr;
|
46 |
+
grid-column-gap: 20px;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
&[data-type="no-thumbs"] a {
|
52 |
+
--display: block;
|
53 |
+
}
|
54 |
+
|
55 |
+
&[data-type="large-thumbs"] {
|
56 |
+
--listItemSpacing: 25px;
|
57 |
+
|
58 |
+
a {
|
59 |
+
--display: block;
|
60 |
|
61 |
.ct-image-container {
|
62 |
+
margin-bottom: 12px;
|
63 |
+
}
|
64 |
|
65 |
+
.ct-post-title {
|
66 |
+
--fontSize: 17px;
|
67 |
+
--fontWeight: 600;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
|
72 |
+
&[data-type="large-small"] li:first-child {
|
73 |
+
--listItemSpacing: 30px;
|
74 |
+
|
75 |
+
a {
|
76 |
+
--display: block;
|
77 |
+
|
78 |
+
.ct-image-container {
|
79 |
+
margin-bottom: 20px;
|
80 |
}
|
81 |
|
82 |
+
.ct-post-title {
|
83 |
+
--fontSize: 17px;
|
84 |
+
--fontWeight: 600;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
&[data-type="rounded"] {
|
90 |
+
.ct-image-container {
|
91 |
+
overflow: hidden;
|
92 |
+
border-radius: 100%;
|
93 |
+
-webkit-mask-image: -webkit-radial-gradient(white, black);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
&[data-type="numbered"] {
|
98 |
+
counter-reset: ct-counter;
|
99 |
+
|
100 |
+
a {
|
101 |
+
grid-template-columns: 34px 1fr;
|
102 |
+
grid-column-gap: 15px;
|
103 |
+
|
104 |
+
&:before {
|
105 |
+
counter-increment: ct-counter;
|
106 |
+
content: counter(ct-counter);
|
107 |
display: flex;
|
108 |
+
align-items: center;
|
109 |
justify-content: center;
|
110 |
+
width: 34px;
|
111 |
+
height: 34px;
|
112 |
+
font-size: 12px;
|
113 |
+
font-weight: 700;
|
114 |
+
border-radius: 100%;
|
115 |
+
border: 1px solid #E5E5E5;
|
116 |
+
transition: var(--transition);
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
+
&:hover {
|
120 |
+
&:before {
|
121 |
+
color: #fff;
|
122 |
+
border-color: var(--paletteColor1);
|
123 |
+
background: var(--paletteColor1);
|
|
|
|
|
|
|
124 |
}
|
125 |
}
|
126 |
}
|
127 |
+
|
128 |
+
.ct-post-title {
|
129 |
+
@include lhCrop(1.65);
|
130 |
+
}
|
131 |
}
|
132 |
+
}
|
framework/extensions/widgets/static/sass/quote.scss
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ct-quote-widget {
|
2 |
+
--color: #fff;
|
3 |
+
position: relative;
|
4 |
+
min-height: 250px;
|
5 |
+
border-radius: 7px;
|
6 |
+
padding: 70px 40px 60px 60px !important;
|
7 |
+
background: var(--paletteColor1) !important;
|
8 |
+
|
9 |
+
&:before {
|
10 |
+
position: absolute;
|
11 |
+
top: 50px;
|
12 |
+
left: 35px;
|
13 |
+
content: "”";
|
14 |
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
15 |
+
font-weight: bold;
|
16 |
+
font-size: 200px;
|
17 |
+
line-height: 150px;
|
18 |
+
opacity: 0.3;
|
19 |
+
width: 80px;
|
20 |
+
height: 80px;
|
21 |
+
display: flex;
|
22 |
+
justify-content: center;
|
23 |
+
transform: rotate(180deg);
|
24 |
+
}
|
25 |
+
|
26 |
+
.ct-quote-author {
|
27 |
+
display: grid;
|
28 |
+
grid-template-columns: 40px 1fr;
|
29 |
+
grid-column-gap: 15px;
|
30 |
+
align-items: center;
|
31 |
+
margin-top: 25px;
|
32 |
+
--fontWeight: 500;
|
33 |
+
|
34 |
+
figure {
|
35 |
+
max-width: 40px;
|
36 |
+
border-radius: 100%;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
framework/extensions/widgets/static/sass/social-icons.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ct-socials-widget,
|
2 |
+
.ct-about-me-widget,
|
3 |
+
.ct-contact-info-widget {
|
4 |
+
|
5 |
+
// [data-icons-type*="simple"] {
|
6 |
+
// --icon-color: rgba(100, 110, 119, 1);
|
7 |
+
// --icon-hover-color: var(--paletteColor1);
|
8 |
+
// }
|
9 |
+
|
10 |
+
[data-icons-type*="solid"] {
|
11 |
+
--icon-color: rgba(100, 110, 119, 1);
|
12 |
+
--icon-hover-color: #fff;
|
13 |
+
--background-color: rgba(218, 222, 228, 0.3);
|
14 |
+
--background-hover-color: var(--paletteColor1);
|
15 |
+
}
|
16 |
+
|
17 |
+
[data-icons-type*="outline"] {
|
18 |
+
--icon-color: rgba(100, 110, 119, 1);
|
19 |
+
--icon-hover-color: var(--paletteColor1);
|
20 |
+
--background-color: rgba(218, 222, 228, 1);
|
21 |
+
--background-hover-color: var(--paletteColor1);
|
22 |
+
}
|
23 |
+
}
|
framework/extensions/widgets/widgets/ct-about-me/helpers.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function blc_get_user_choices() {
|
4 |
+
global $wpdb;
|
5 |
+
|
6 |
+
$wp_user_search = $wpdb->get_results(
|
7 |
+
"SELECT ID, display_name FROM $wpdb->users ORDER BY ID"
|
8 |
+
);
|
9 |
+
|
10 |
+
$result = [];
|
11 |
+
|
12 |
+
foreach ($wp_user_search as $userid) {
|
13 |
+
$user_id = (int) $userid->ID;
|
14 |
+
$result[$user_id] = $userid->display_name;
|
15 |
+
}
|
16 |
+
|
17 |
+
return $result;
|
18 |
+
}
|
framework/extensions/widgets/widgets/ct-about-me/options.php
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* About me widget
|
4 |
+
*
|
5 |
+
* @copyright 2019-present Creative Themes
|
6 |
+
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
7 |
+
* @package Blocksy
|
8 |
+
*/
|
9 |
+
|
10 |
+
require_once dirname( __FILE__ ) . '/helpers.php';
|
11 |
+
|
12 |
+
$options = [
|
13 |
+
'title' => [
|
14 |
+
'type' => 'text',
|
15 |
+
'label' => __( 'Title', 'blc' ),
|
16 |
+
'field_attr' => [ 'id' => 'widget-title' ],
|
17 |
+
'design' => 'inline',
|
18 |
+
'value' => __( 'About me', 'blc' ),
|
19 |
+
'disableRevertButton' => true,
|
20 |
+
],
|
21 |
+
|
22 |
+
'about_type' => [
|
23 |
+
'label' => __( 'Type', 'blc' ),
|
24 |
+
'type' => 'ct-radio',
|
25 |
+
'value' => 'simple',
|
26 |
+
'view' => 'radio',
|
27 |
+
'design' => 'inline',
|
28 |
+
'inline' => true,
|
29 |
+
'disableRevertButton' => true,
|
30 |
+
'choices' => [
|
31 |
+
'simple' => __( 'Simple', 'blc' ),
|
32 |
+
'bordered' => __( 'Boxed', 'blc' ),
|
33 |
+
],
|
34 |
+
],
|
35 |
+
|
36 |
+
'about_source' => [
|
37 |
+
'label' => __( 'Source', 'blc' ),
|
38 |
+
'type' => 'ct-radio',
|
39 |
+
'value' => 'from_wp',
|
40 |
+
'view' => 'radio',
|
41 |
+
'design' => 'inline',
|
42 |
+
'inline' => true,
|
43 |
+
'disableRevertButton' => true,
|
44 |
+
'choices' => [
|
45 |
+
'from_wp' => __( 'From WP', 'blc' ),
|
46 |
+
'custom' => __( 'Custom', 'blc' ),
|
47 |
+
],
|
48 |
+
],
|
49 |
+
|
50 |
+
blocksy_rand_md5() => [
|
51 |
+
'type' => 'ct-condition',
|
52 |
+
'condition' => [ 'about_source' => 'from_wp' ],
|
53 |
+
'options' => [
|
54 |
+
|
55 |
+
'wp_user' => [
|
56 |
+
'type' => 'ct-select',
|
57 |
+
'label' => __( 'User', 'blc' ),
|
58 |
+
'value' => array_keys(blc_get_user_choices())[0],
|
59 |
+
'design' => 'inline',
|
60 |
+
'choices' => blocksy_ordered_keys(blc_get_user_choices()),
|
61 |
+
],
|
62 |
+
|
63 |
+
]
|
64 |
+
],
|
65 |
+
|
66 |
+
blocksy_rand_md5() => [
|
67 |
+
'type' => 'ct-condition',
|
68 |
+
'condition' => [ 'about_source' => 'custom' ],
|
69 |
+
'options' => [
|
70 |
+
|
71 |
+
'about_avatar' => [
|
72 |
+
'label' => __('Avatar', 'blc'),
|
73 |
+
'type' => 'ct-image-uploader',
|
74 |
+
'design' => 'inline',
|
75 |
+
'value' => [ 'attachment_id' => null ],
|
76 |
+
'attr' => [ 'data-type' => 'no-frame' ],
|
77 |
+
],
|
78 |
+
|
79 |
+
'about_name' => [
|
80 |
+
'type' => 'text',
|
81 |
+
'label' => __( 'Name', 'blc' ),
|
82 |
+
'field_attr' => [ 'id' => 'widget-title' ],
|
83 |
+
'design' => 'inline',
|
84 |
+
'value' => __( 'John Doe', 'blc' ),
|
85 |
+
'disableRevertButton' => true,
|
86 |
+
],
|
87 |
+
|
88 |
+
'about_text' => [
|
89 |
+
'label' => __( 'Description', 'blc' ),
|
90 |
+
'type' => 'textarea',
|
91 |
+
'value' => '',
|
92 |
+
'design' => 'inline',
|
93 |
+
'disableRevertButton' => true,
|
94 |
+
],
|
95 |
+
],
|
96 |
+
],
|
97 |
+
|
98 |
+
'about_avatar_size' => [
|
99 |
+
'type' => 'text',
|
100 |
+
'label' => __( 'Avatar Size', 'blc' ),
|
101 |
+
'design' => 'inline',
|
102 |
+
'value' => 75,
|
103 |
+
'disableRevertButton' => true,
|
104 |
+
],
|
105 |
+
|
106 |
+
'about_avatar_size' => [
|
107 |
+
'label' => __( 'Avatar Size', 'blc' ),
|
108 |
+
'type' => 'ct-select',
|
109 |
+
'value' => 'small',
|
110 |
+
'design' => 'inline',
|
111 |
+
'disableRevertButton' => true,
|
112 |
+
'choices' => [
|
113 |
+
'small' => __( 'Small', 'blc' ),
|
114 |
+
'medium' => __( 'Medium', 'blc' ),
|
115 |
+
'large' => __( 'Large', 'blc' ),
|
116 |
+
],
|
117 |
+
],
|
118 |
+
|
119 |
+
'avatar_shape' => [
|
120 |
+
'label' => __( 'Avatar Shape', 'blc' ),
|
121 |
+
'type' => 'ct-radio',
|
122 |
+
'value' => 'rounded',
|
123 |
+
'view' => 'radio',
|
124 |
+
'design' => 'inline',
|
125 |
+
'inline' => true,
|
126 |
+
'disableRevertButton' => true,
|
127 |
+
'choices' => [
|
128 |
+
'rounded' => __( 'Rounded', 'blc' ),
|
129 |
+
'square' => __( 'Square', 'blc' ),
|
130 |
+
],
|
131 |
+
],
|
132 |
+
|
133 |
+
'about_alignment' => [
|
134 |
+
'type' => 'ct-radio',
|
135 |
+
'label' => __( 'Alignment', 'blocksy' ),
|
136 |
+
'value' => 'center',
|
137 |
+
'view' => 'text',
|
138 |
+
'attr' => [ 'data-type' => 'alignment' ],
|
139 |
+
'disableRevertButton' => true,
|
140 |
+
'design' => 'inline',
|
141 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
142 |
+
'choices' => [
|
143 |
+
'left' => '',
|
144 |
+
'center' => '',
|
145 |
+
'right' => '',
|
146 |
+
],
|
147 |
+
],
|
148 |
+
|
149 |
+
'about_socials' => [
|
150 |
+
'type' => 'ct-layers',
|
151 |
+
'label' => __( 'Social Channels', 'blc' ),
|
152 |
+
'manageable' => true,
|
153 |
+
'desc' => sprintf(
|
154 |
+
__( 'You can configure social URLs in %s.', 'blc' ),
|
155 |
+
sprintf(
|
156 |
+
'<a href="%s" target="_blank">%s</a>',
|
157 |
+
admin_url('/customize.php?autofocus[section]=social_accounts'),
|
158 |
+
__('Customizer', 'blc')
|
159 |
+
)
|
160 |
+
),
|
161 |
+
'value' => [
|
162 |
+
[
|
163 |
+
'id' => 'facebook',
|
164 |
+
'enabled' => true,
|
165 |
+
],
|
166 |
+
|
167 |
+
[
|
168 |
+
'id' => 'twitter',
|
169 |
+
'enabled' => true,
|
170 |
+
],
|
171 |
+
|
172 |
+
[
|
173 |
+
'id' => 'instagram',
|
174 |
+
'enabled' => true,
|
175 |
+
],
|
176 |
+
],
|
177 |
+
|
178 |
+
'settings' => blc_call_fn(
|
179 |
+
[
|
180 |
+
'fn' => 'blocksy_get_social_networks_list',
|
181 |
+
'default' => []
|
182 |
+
]
|
183 |
+
)
|
184 |
+
],
|
185 |
+
|
186 |
+
'about_social_icons_size' => [
|
187 |
+
'label' => __( 'Icons Size', 'blc' ),
|
188 |
+
'type' => 'ct-radio',
|
189 |
+
'value' => 'small',
|
190 |
+
'view' => 'text',
|
191 |
+
'design' => 'block',
|
192 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
193 |
+
'choices' => [
|
194 |
+
'small' => __( 'Small', 'blc' ),
|
195 |
+
'medium' => __( 'Medium', 'blc' ),
|
196 |
+
'large' => __( 'Large', 'blc' ),
|
197 |
+
],
|
198 |
+
],
|
199 |
+
|
200 |
+
'about_social_type' => [
|
201 |
+
'label' => __( 'Icons Shape Type', 'blc' ),
|
202 |
+
'type' => 'ct-radio',
|
203 |
+
'value' => 'rounded',
|
204 |
+
'view' => 'text',
|
205 |
+
'design' => 'block',
|
206 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
207 |
+
'choices' => [
|
208 |
+
'simple' => __( 'None', 'blc' ),
|
209 |
+
'rounded' => __( 'Rounded', 'blc' ),
|
210 |
+
'square' => __( 'Square', 'blc' ),
|
211 |
+
],
|
212 |
+
],
|
213 |
+
|
214 |
+
blocksy_rand_md5() => [
|
215 |
+
'type' => 'ct-condition',
|
216 |
+
'condition' => [ 'about_social_type' => '!simple' ],
|
217 |
+
'options' => [
|
218 |
+
|
219 |
+
'about_social_icons_fill' => [
|
220 |
+
'label' => __( 'Shape Fill Type', 'blc' ),
|
221 |
+
'type' => 'ct-radio',
|
222 |
+
'value' => 'outline',
|
223 |
+
'view' => 'text',
|
224 |
+
'design' => 'block',
|
225 |
+
'setting' => [ 'transport' => 'postMessage' ],
|
226 |
+
'choices' => [
|
227 |
+
'solid' => __( 'Solid', 'blc' ),
|
228 |
+
'outline' => __( 'Outline', 'blc' ),
|
229 |
+
],
|
230 |
+
],
|
231 |
+
|
232 |
+
],
|
233 |
+
],
|
234 |
+
|
235 |
+
];
|
framework/extensions/widgets/widgets/ct-about-me/view.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* About me widget
|
4 |
+
*
|
5 |
+
* @copyright 2019-present Creative Themes
|
6 |
+
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
7 |
+
* @package Blocksy
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
// Widget title
|
12 |
+
$title = blocksy_default_akg( 'title', $atts, __( 'About me', 'blc' ) );
|
13 |
+
|
14 |
+
$about_source = blocksy_default_akg('about_source', $atts, 'from_wp');
|
15 |
+
$about_type = blocksy_default_akg('about_type', $atts, 'simple');
|
16 |
+
$alignment = blocksy_default_akg('about_alignment', $atts, 'center');
|
17 |
+
$avatar_size = blocksy_default_akg('about_avatar_size', $atts, 'small');
|
18 |
+
$avatar_shape = blocksy_default_akg('avatar_shape', $atts, 'rounded');
|
19 |
+
|
20 |
+
$sizes = [
|
21 |
+
'small' => 90,
|
22 |
+
'medium' => 140,
|
23 |
+
'large' => 200
|
24 |
+
];
|
25 |
+
|
26 |
+
$user_id = blocksy_akg('wp_user', $atts, null);
|
27 |
+
|
28 |
+
$image_output = blc_call_fn(['fn' => 'blocksy_image'], [
|
29 |
+
'attachment_id' => blocksy_default_akg('about_avatar/attachment_id', $atts, null),
|
30 |
+
'ratio' => '1/1',
|
31 |
+
'tag_name' => 'figure',
|
32 |
+
'size' => $avatar_size === 'small' ? 'thumb' : 'medium',
|
33 |
+
// 'lazyload' => false,
|
34 |
+
'html_atts' => [
|
35 |
+
'data-size' => $avatar_size,
|
36 |
+
'data-shape' => $avatar_shape,
|
37 |
+
]
|
38 |
+
]);
|
39 |
+
|
40 |
+
$about_name = blocksy_default_akg('about_name', $atts, __('John Doe', 'blc'));
|
41 |
+
$about_text = blocksy_default_akg('about_text', $atts, '');
|
42 |
+
|
43 |
+
if ($about_source === 'from_wp') {
|
44 |
+
if (! $user_id) {
|
45 |
+
require_once dirname( __FILE__ ) . '/helpers.php';
|
46 |
+
$user_id = array_keys(blc_get_user_choices())[0];
|
47 |
+
}
|
48 |
+
|
49 |
+
$image_output = blc_call_fn(
|
50 |
+
['fn' => 'blocksy_simple_image'],
|
51 |
+
get_avatar_url($user_id, [
|
52 |
+
/*
|
53 |
+
'size' => intval(
|
54 |
+
blocksy_default_akg('about_avatar_size', $atts, 75)
|
55 |
+
)
|
56 |
+
*/
|
57 |
+
'size' => $sizes[$avatar_size] * 2
|
58 |
+
]),
|
59 |
+
[
|
60 |
+
'tag_name' => 'figure',
|
61 |
+
'ratio' => '1/1',
|
62 |
+
'html_atts' => [
|
63 |
+
'data-size' => $avatar_size,
|
64 |
+
'data-shape' => $avatar_shape,
|
65 |
+
// 'style' => 'max-width: ' . blocksy_default_akg(
|
66 |
+
// 'about_avatar_size', $atts, 75
|
67 |
+
// ) . 'px'
|
68 |
+
]
|
69 |
+
]
|
70 |
+
);
|
71 |
+
|
72 |
+
$about_name = get_the_author_meta('display_name', $user_id);
|
73 |
+
$about_text = get_the_author_meta('description', $user_id);
|
74 |
+
}
|
75 |
+
|
76 |
+
$size = blocksy_default_akg('about_social_icons_size', $atts, 'small');
|
77 |
+
$type = blocksy_default_akg('about_social_type', $atts, 'rounded');
|
78 |
+
$fill = blocksy_default_akg('about_social_icons_fill', $atts, 'outline');
|
79 |
+
|
80 |
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
81 |
+
echo $before_widget;
|
82 |
+
|
83 |
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
84 |
+
echo $before_title . wp_kses_post( $title ) . $after_title;
|
85 |
+
?>
|
86 |
+
|
87 |
+
|
88 |
+
<section
|
89 |
+
data-type="<?php echo esc_attr($about_type) ?>"
|
90 |
+
data-alignment="<?php echo esc_attr($alignment) ?>">
|
91 |
+
|
92 |
+
<?php echo $image_output; ?>
|
93 |
+
|
94 |
+
<h6 class="ct-about-me-name">
|
95 |
+
<?php echo $about_name; ?>
|
96 |
+
|
97 |
+
<?php if ($about_source === 'from_wp') { ?>
|
98 |
+
<a href="<?php echo get_author_posts_url($user_id) ?>" class="ct-about-me-link">
|
99 |
+
<?php echo __('View Profile', 'blc') ?>
|
100 |
+
</a>
|
101 |
+
<?php } ?>
|
102 |
+
</h6>
|
103 |
+
|
104 |
+
<div class="ct-about-me-text"><?php echo $about_text; ?></div>
|
105 |
+
|
106 |
+
<?php
|
107 |
+
echo blc_call_fn(
|
108 |
+
['fn' => 'blocksy_social_icons'],
|
109 |
+
blocksy_default_akg(
|
110 |
+
'about_socials',
|
111 |
+
$atts,
|
112 |
+
[
|
113 |
+
[
|
114 |
+
'id' => 'facebook',
|
115 |
+
'enabled' => true,
|
116 |
+
],
|
117 |
+
|
118 |
+
[
|
119 |
+
'id' => 'twitter',
|
120 |
+
'enabled' => true,
|
121 |
+
],
|
122 |
+
|
123 |
+
[
|
124 |
+
'id' => 'instagram',
|
125 |
+
'enabled' => true,
|
126 |
+
],
|
127 |
+
]
|
128 |
+
),
|
129 |
+
|
130 |
+
[
|
131 |
+
'size' => $size,
|
132 |
+
'type' => $type,
|
133 |
+
'fill' => $fill
|
134 |
+
]
|
135 |
+
);
|
136 |
+
?>
|
137 |
+
</section>
|
138 |
+
|
139 |
+
<?php echo wp_kses_post($after_widget); ?>
|
framework/extensions/widgets/widgets/ct-about-me/widget.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* About me widget
|
4 |
+
*
|
5 |
+
* @copyright 2019-present Creative Themes
|
6 |
+
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
7 |
+
* @package Blocksy
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Blocksy_Widget_Ct_About_Me extends BlocksyWidgetFactory {
|
11 |
+
protected function get_config() {
|
12 |
+
return [
|
13 |
+
'name' => __('About Me', 'blc'),
|
14 |
+
'description' => __('About me', 'blc'),
|
15 |
+
'customize_selective_refresh' => true
|
16 |
+
];
|
17 |
+
}
|
18 |
+
|
19 |
+
public function get_path() {
|
20 |
+
return dirname(__FILE__);
|
21 |
+
}
|
22 |
+
}
|
framework/extensions/widgets/widgets/ct-advertisement/view.php
CHANGED
@@ -20,10 +20,14 @@ $ad_code = blocksy_default_akg( 'ad_code', $atts, '' );
|
|
20 |
// Ad link
|
21 |
$ad_link = blocksy_default_akg( 'ad_link', $atts, '' );
|
22 |
|
|
|
|
|
|
|
|
|
23 |
// Ad link target
|
24 |
$ad_link_target = blocksy_default_akg( 'ad_link_target', $atts, 'yes' );
|
25 |
|
26 |
-
$image_output =
|
27 |
'attachment_id' => blocksy_default_akg( 'ad_image/attachment_id', $atts, null ),
|
28 |
'ratio' => 'original',
|
29 |
'tag_name' => 'a',
|
@@ -40,7 +44,9 @@ $image_output = blocksy_image([
|
|
40 |
echo $before_widget;
|
41 |
|
42 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
43 |
-
|
|
|
|
|
44 |
|
45 |
?>
|
46 |
|
@@ -52,4 +58,4 @@ echo $before_title . wp_kses_post( $title ) . $after_title;
|
|
52 |
} ?>
|
53 |
</div>
|
54 |
|
55 |
-
<?php echo wp_kses_post(
|
20 |
// Ad link
|
21 |
$ad_link = blocksy_default_akg( 'ad_link', $atts, '' );
|
22 |
|
23 |
+
if (empty(trim($ad_link))) {
|
24 |
+
$ad_link = '#';
|
25 |
+
}
|
26 |
+
|
27 |
// Ad link target
|
28 |
$ad_link_target = blocksy_default_akg( 'ad_link_target', $atts, 'yes' );
|
29 |
|
30 |
+
$image_output = blc_call_fn(['fn' => 'blocksy_image'], [
|
31 |
'attachment_id' => blocksy_default_akg( 'ad_image/attachment_id', $atts, null ),
|
32 |
'ratio' => 'original',
|
33 |
'tag_name' => 'a',
|
44 |
echo $before_widget;
|
45 |
|
46 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
47 |
+
if (! empty(trim($title))) {
|
48 |
+
echo $before_title . wp_kses_post( $title ) . $after_title;
|
49 |
+
}
|
50 |
|
51 |
?>
|
52 |
|
58 |
} ?>
|
59 |
</div>
|
60 |
|
61 |
+
<?php echo wp_kses_post($after_widget); ?>
|
framework/extensions/widgets/widgets/ct-advertisement/widget.php
CHANGED
@@ -12,6 +12,7 @@ class Blocksy_Widget_Ct_Advertisement extends BlocksyWidgetFactory {
|
|
12 |
return [
|
13 |
'name' => __('Advertisement', 'blc'),
|
14 |
'description' => __('Advertisement', 'blc'),
|
|
|
15 |
];
|
16 |
}
|
17 |
|
12 |
return [
|
13 |
'name' => __('Advertisement', 'blc'),
|
14 |
'description' => __('Advertisement', 'blc'),
|
15 |
+
'customize_selective_refresh' => true
|
16 |
];
|
17 |
}
|
18 |
|
framework/extensions/widgets/widgets/ct-contact-info/options.php
CHANGED
@@ -79,11 +79,14 @@ $options = [
|
|
79 |
'label' => __('Link (optional)', 'blc'),
|
80 |
'design' => 'inline',
|
81 |
]
|
82 |
-
]
|
|
|
|
|
83 |
],
|
84 |
|
85 |
'phone' => [
|
86 |
'label' => __( 'Phone', 'blc' ),
|
|
|
87 |
'options' => [
|
88 |
|
89 |
'title' => [
|
@@ -112,6 +115,7 @@ $options = [
|
|
112 |
|
113 |
'mobile' => [
|
114 |
'label' => __( 'Mobile', 'blc' ),
|
|
|
115 |
'options' => [
|
116 |
'title' => [
|
117 |
'type' => 'text',
|
@@ -137,8 +141,37 @@ $options = [
|
|
137 |
]
|
138 |
],
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
'fax' => [
|
141 |
'label' => __( 'Fax', 'blc' ),
|
|
|
142 |
'options' => [
|
143 |
'title' => [
|
144 |
'type' => 'text',
|
@@ -166,6 +199,7 @@ $options = [
|
|
166 |
|
167 |
'email' => [
|
168 |
'label' => __( 'Email', 'blc' ),
|
|
|
169 |
'options' => [
|
170 |
'title' => [
|
171 |
'type' => 'text',
|
@@ -193,6 +227,7 @@ $options = [
|
|
193 |
|
194 |
'website' => [
|
195 |
'label' => __( 'Website', 'blc' ),
|
|
|
196 |
'options' => [
|
197 |
'title' => [
|
198 |
'type' => 'text',
|
@@ -214,20 +249,12 @@ $options = [
|
|
214 |
'value' => 'https://creativethemes.com',
|
215 |
'design' => 'inline',
|
216 |
],
|
217 |
-
|
218 |
]
|
219 |
],
|
220 |
],
|
221 |
],
|
222 |
|
223 |
-
'
|
224 |
-
'type' => 'ct-switch',
|
225 |
-
'label' => __( 'Open link in new tab', 'blc' ),
|
226 |
-
'value' => 'no',
|
227 |
-
'disableRevertButton' => true,
|
228 |
-
],
|
229 |
-
|
230 |
-
'contact_icons_size' => [
|
231 |
'label' => __( 'Icons Size', 'blc' ),
|
232 |
'type' => 'ct-radio',
|
233 |
'value' => 'medium',
|
@@ -241,15 +268,15 @@ $options = [
|
|
241 |
],
|
242 |
],
|
243 |
|
244 |
-
'
|
245 |
-
'label' => __( 'Icons Type', 'blc' ),
|
246 |
'type' => 'ct-radio',
|
247 |
'value' => 'rounded',
|
248 |
'view' => 'text',
|
249 |
'design' => 'block',
|
250 |
'setting' => [ 'transport' => 'postMessage' ],
|
251 |
'choices' => [
|
252 |
-
'simple' => __( '
|
253 |
'rounded' => __( 'Rounded', 'blc' ),
|
254 |
'square' => __( 'Square', 'blc' ),
|
255 |
],
|
@@ -257,22 +284,29 @@ $options = [
|
|
257 |
|
258 |
blocksy_rand_md5() => [
|
259 |
'type' => 'ct-condition',
|
260 |
-
'condition' => [ '
|
261 |
'options' => [
|
262 |
|
263 |
-
'
|
264 |
-
'label' => __( '
|
265 |
'type' => 'ct-radio',
|
266 |
'value' => 'outline',
|
267 |
'view' => 'text',
|
268 |
'design' => 'block',
|
269 |
'setting' => [ 'transport' => 'postMessage' ],
|
270 |
'choices' => [
|
271 |
-
'outline' => __( 'Outline', 'blc' ),
|
272 |
'solid' => __( 'Solid', 'blc' ),
|
|
|
273 |
],
|
274 |
],
|
275 |
|
276 |
],
|
277 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
];
|
79 |
'label' => __('Link (optional)', 'blc'),
|
80 |
'design' => 'inline',
|
81 |
]
|
82 |
+
],
|
83 |
+
|
84 |
+
'clone' => true
|
85 |
],
|
86 |
|
87 |
'phone' => [
|
88 |
'label' => __( 'Phone', 'blc' ),
|
89 |
+
'clone' => true,
|
90 |
'options' => [
|
91 |
|
92 |
'title' => [
|
115 |
|
116 |
'mobile' => [
|
117 |
'label' => __( 'Mobile', 'blc' ),
|
118 |
+
'clone' => true,
|
119 |
'options' => [
|
120 |
'title' => [
|
121 |
'type' => 'text',
|
141 |
]
|
142 |
],
|
143 |
|
144 |
+
'hours' => [
|
145 |
+
'label' => __( 'Work Hours', 'blc' ),
|
146 |
+
'clone' => true,
|
147 |
+
'options' => [
|
148 |
+
'title' => [
|
149 |
+
'type' => 'text',
|
150 |
+
'label' => __('Title', 'blc'),
|
151 |
+
'value' => __('Opening hours', 'blc'),
|
152 |
+
'design' => 'inline',
|
153 |
+
],
|
154 |
+
|
155 |
+
'content' => [
|
156 |
+
'type' => 'text',
|
157 |
+
'label' => __('Content', 'blc'),
|
158 |
+
'value' => '9AM - 5PM',
|
159 |
+
'design' => 'inline',
|
160 |
+
],
|
161 |
+
|
162 |
+
'link' => [
|
163 |
+
'type' => 'text',
|
164 |
+
'label' => __('Link (optional)', 'blc'),
|
165 |
+
'value' => '',
|
166 |
+
'design' => 'inline',
|
167 |
+
],
|
168 |
+
|
169 |
+
]
|
170 |
+
],
|
171 |
+
|
172 |
'fax' => [
|
173 |
'label' => __( 'Fax', 'blc' ),
|
174 |
+
'clone' => true,
|
175 |
'options' => [
|
176 |
'title' => [
|
177 |
'type' => 'text',
|
199 |
|
200 |
'email' => [
|
201 |
'label' => __( 'Email', 'blc' ),
|
202 |
+
'clone' => true,
|
203 |
'options' => [
|
204 |
'title' => [
|
205 |
'type' => 'text',
|
227 |
|
228 |
'website' => [
|
229 |
'label' => __( 'Website', 'blc' ),
|
230 |
+
'clone' => true,
|
231 |
'options' => [
|
232 |
'title' => [
|
233 |
'type' => 'text',
|
249 |
'value' => 'https://creativethemes.com',
|
250 |
'design' => 'inline',
|
251 |
],
|
|
|
252 |
]
|
253 |
],
|
254 |
],
|
255 |
],
|
256 |
|
257 |
+
'contacts_icons_size' => [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
'label' => __( 'Icons Size', 'blc' ),
|
259 |
'type' => 'ct-radio',
|
260 |
'value' => 'medium',
|
268 |
],
|
269 |
],
|
270 |
|
271 |
+
'contacts_icon_shape' => [
|
272 |
+
'label' => __( 'Icons Shape Type', 'blc' ),
|
273 |
'type' => 'ct-radio',
|
274 |
'value' => 'rounded',
|
275 |
'view' => 'text',
|
276 |
'design' => 'block',
|
277 |
'setting' => [ 'transport' => 'postMessage' ],
|
278 |
'choices' => [
|
279 |
+
'simple' => __( 'None', 'blc' ),
|
280 |
'rounded' => __( 'Rounded', 'blc' ),
|
281 |
'square' => __( 'Square', 'blc' ),
|
282 |
],
|
284 |
|
285 |
blocksy_rand_md5() => [
|
286 |
'type' => 'ct-condition',
|
287 |
+
'condition' => [ 'contacts_icon_shape' => '!simple' ],
|
288 |
'options' => [
|
289 |
|
290 |
+
'contacts_icon_fill_type' => [
|
291 |
+
'label' => __( 'Shape Fill Type', 'blc' ),
|
292 |
'type' => 'ct-radio',
|
293 |
'value' => 'outline',
|
294 |
'view' => 'text',
|
295 |
'design' => 'block',
|
296 |
'setting' => [ 'transport' => 'postMessage' ],
|
297 |
'choices' => [
|
|
|
298 |
'solid' => __( 'Solid', 'blc' ),
|
299 |
+
'outline' => __( 'Outline', 'blc' ),
|
300 |
],
|
301 |
],
|
302 |
|
303 |
],
|
304 |
],
|
305 |
+
|
306 |
+
'contact_link_target' => [
|
307 |
+
'type' => 'ct-switch',
|
308 |
+
'label' => __( 'Open link in new tab', 'blc' ),
|
309 |
+
'value' => 'no',
|
310 |
+
'disableRevertButton' => true,
|
311 |
+
],
|
312 |
];
|
framework/extensions/widgets/widgets/ct-contact-info/view.php
CHANGED
@@ -14,21 +14,6 @@ $title = blocksy_default_akg( 'title', $atts, __( 'Contact Info', 'blc' ) );
|
|
14 |
// Text
|
15 |
$text = blocksy_default_akg( 'contact_text', $atts, '' );
|
16 |
|
17 |
-
// Icons size
|
18 |
-
$icons_size = blocksy_default_akg( 'contact_icons_size', $atts, 'medium' );
|
19 |
-
|
20 |
-
// Icons type
|
21 |
-
$icons_type = blocksy_default_akg( 'contact_icons_type', $atts, 'rounded' );
|
22 |
-
|
23 |
-
// Icons fill type
|
24 |
-
$fill_type = blocksy_default_akg( 'contact_icons_fill', $atts, 'outline' );
|
25 |
-
|
26 |
-
$fill_type_output = '';
|
27 |
-
|
28 |
-
if ( $icons_type !== 'simple' ) {
|
29 |
-
$fill_type_output = '-' . $fill_type;
|
30 |
-
}
|
31 |
-
|
32 |
$contact_information = blocksy_default_akg(
|
33 |
'contact_information',
|
34 |
$atts,
|
@@ -58,40 +43,6 @@ $contact_information = blocksy_default_akg(
|
|
58 |
]
|
59 |
);
|
60 |
|
61 |
-
$svgs = [
|
62 |
-
'address' => '<svg width="20" height="20" viewBox="0 0 20 20"><path d="M10,0C6.1,0,3,3.1,3,7c0,4.5,6,11.8,6.2,12.1L10,20l0.8-0.9C11,18.8,17,11.5,17,7C17,3.1,13.9,0,10,0z M10,2c2.8,0,5,2.2,5,5c0,2.7-3.1,7.4-5,9.8C8.1,14.4,5,9.7,5,7C5,4.2,7.2,2,10,2zM10,4.5C8.6,4.5,7.5,5.6,7.5,7S8.6,9.5,10,9.5s2.5-1.1,2.5-2.5S11.4,4.5,10,4.5z"/></svg>',
|
63 |
-
|
64 |
-
'phone' => '<svg width="20" height="20" viewBox="0 0 20 20"><path d="M4.4,0C4,0,3.6,0.2,3.2,0.4l0,0l0,0L0.8,2.9l0,0C0,3.6-0.2,4.7,0.1,5.6c0,0,0,0,0,0c0.7,1.9,2.3,5.5,5.6,8.7c3.3,3.3,6.9,4.9,8.7,5.6h0c0.9,0.3,1.9,0.1,2.7-0.5l2.4-2.4c0.6-0.6,0.6-1.7,0-2.4l-3.1-3.1l0,0c-0.6-0.6-1.8-0.6-2.4,0l-1.5,1.5c-0.6-0.3-1.9-1-3.1-2.2C8,9.5,7.4,8.2,7.2,7.6l1.5-1.5c0.6-0.6,0.7-1.7,0-2.4l0,0L8.6,3.6L5.6,0.5l0,0l0,0C5.2,0.2,4.8,0,4.4,0zM4.4,1.5c0.1,0,0.1,0,0.2,0.1l3.1,3.1l0.1,0.1c0,0,0,0.1,0,0.2L5.7,6.9L5.3,7.3l0.2,0.5c0,0,0.9,2.4,2.7,4.1L8.4,12c1.8,1.6,3.9,2.5,3.9,2.5l0.5,0.2l2.3-2.3c0.1-0.1,0.1-0.1,0.2,0l3.1,3.1c0.1,0.1,0.1,0.1,0,0.2l-2.4,2.4c-0.4,0.3-0.7,0.4-1.2,0.2c-1.7-0.7-5.1-2.2-8.1-5.2c-3-3-4.6-6.5-5.2-8.2c-0.1-0.3,0-0.8,0.2-1l0,0l2.3-2.4C4.2,1.6,4.3,1.5,4.4,1.5z"/></svg>',
|
65 |
-
|
66 |
-
'mobile' => '<svg width="20" height="20" viewBox="0 0 20 20"><path d="M13.5,20H6.5c-1.6,0-2.9-1.3-2.9-2.9V2.9C3.5,1.3,4.8,0,6.5,0h7.1c1.6,0,2.9,1.3,2.9,2.9v14.1C16.5,18.7,15.2,20,13.5,20zM6.7,1.7C5.8,1.7,5,2.5,5,3.4v13.2c0,0.9,0.7,1.7,1.7,1.7h6.6c0.9,0,1.7-0.7,1.7-1.7V3.4c0-0.9-0.7-1.7-1.7-1.7H6.7z"/><path d="M11.2,4.4H8.8c-0.3,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h2.4c0.3,0,0.6,0.3,0.6,0.6S11.5,4.4,11.2,4.4z"/><circle cx="10" cy="15.7" r="1.2"/></svg>',
|
67 |
-
|
68 |
-
'fax' => '<svg width="20" height="20" viewBox="0 0 20 20"><path d="M17.5,5.8h-1.7v-4V0h-1.7H5.8H4.2v1.8v4H2.5C1.1,5.8,0,7,0,8.3v8.3h4.2V20h11.7v-3.3H20V8.3C20,7,18.9,5.8,17.5,5.8zM5.8,1.8h8.3v4H5.8V1.8zM14.2,18.3H5.8v-5h8.3V18.3zM18.3,15h-2.5v-3.3H4.2V15H1.7V8.3c0-0.5,0.4-0.8,0.8-0.8h15c0.5,0,0.8,0.4,0.8,0.8V15zM4.2,9.2c0,0.5-0.4,0.8-0.8,0.8S2.5,9.6,2.5,9.2s0.4-0.8,0.8-0.8S4.2,8.7,4.2,9.2z"/></svg>',
|
69 |
-
|
70 |
-
'email' => '<svg width="20" height="20" viewBox="0 0 20 20"><path d="M10,0C4.5,0,0,4.5,0,10s4.5,10,10,10h5v-2h-5c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8v1.5c0,0.8-0.7,1.5-1.5,1.5S15,12.3,15,11.5V10c0-2.7-2.3-5-5-5s-5,2.3-5,5s2.3,5,5,5c1.4,0,2.7-0.6,3.6-1.6c0.6,0.9,1.7,1.6,2.9,1.6c1.9,0,3.5-1.6,3.5-3.5V10C20,4.5,15.5,0,10,0zM10,7c1.7,0,3,1.3,3,3s-1.3,3-3,3s-3-1.3-3-3S8.3,7,10,7z"/></svg>',
|
71 |
-
|
72 |
-
'website' => '<svg width="20" height="20" viewBox="0 0 20 20"><path d="M9.3,0C4.4,0,0.4,4,0.4,8.9s4,8.9,8.9,8.9c0.8,0,1.5-0.1,2.2-0.3v-3.9c-0.6,1.7-1.4,2.7-2.2,2.7c-0.9,0-2-1.5-2.5-3.7h4.8
|
73 |
-
v-1.5h-5c-0.1-0.7-0.1-1.4-0.1-2.2c0-0.8,0.1-1.5,0.2-2.2h5.6c0.1,0.7,0.2,1.4,0.2,2.2c0,0.2,0,0.4,0,0.6c0.4-0.4,0.9-0.6,1.5-0.6c0-0.8,0-1.5-0.1-2.2h2.8c0.2,0.7,0.3,1.4,0.3,2.2c0,0.5-0.1,1-0.2,1.5l1.3,0.9c0.2-0.8,0.3-1.6,0.3-2.4C18.1,4,14.2,0,9.3,0zM9.3,1.5c0.9,0,2,1.5,2.5,3.7h-5C7.3,2.9,8.3,1.5,9.3,1.5zM6.3,2.1C5.9,2.9,5.5,4,5.2,5.2H2.8C3.6,3.8,4.9,2.7,6.3,2.1zM12.2,2.1c1.5,0.6,2.7,1.7,3.5,3.1h-2.3C13.1,4,12.7,2.9,12.2,2.1zM2.2,6.7h2.8C4.9,7.4,4.8,8.1,4.8,8.9c0,0.8,0.1,1.5,0.1,2.2H2.2C2,10.4,1.9,9.7,1.9,8.9C1.9,8.1,2,7.4,2.2,6.7z M13.7,10.4c-0.4,0-0.7,0.3-0.8,0.7c0,0,0,0.1,0,0.1v6.6c0,0.4,0.3,0.7,0.7,0.7c0.2,0,0.4-0.1,0.5-0.2l0,0l1.4-1.6l1.5,3c0.2,0.4,0.6,0.5,1,0.3c0.4-0.2,0.5-0.6,0.3-1l-1.5-3l2.2-0.4l0,0c0.3-0.1,0.5-0.4,0.5-0.7c0-0.3-0.1-0.5-0.3-0.6l0,0l-5.1-3.6C14.1,10.4,13.9,10.4,13.7,10.4zM2.9,12.6h2.3c0.3,1.2,0.7,2.3,1.1,3.1C4.9,15.1,3.7,14,2.9,12.6z"/></svg>',
|
74 |
-
];
|
75 |
-
|
76 |
-
$has_enabled_layer = false;
|
77 |
-
|
78 |
-
foreach ($contact_information as $single_layer) {
|
79 |
-
if ($single_layer['enabled']) {
|
80 |
-
$has_enabled_layer = true;
|
81 |
-
break;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
// Link target
|
86 |
-
$target = blocksy_default_akg( 'contact_link_target', $atts, 'no' );
|
87 |
-
|
88 |
-
$data_target = '';
|
89 |
-
|
90 |
-
if ( $target !== 'no' ) {
|
91 |
-
$data_target = 'target="_blank"';
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
96 |
echo $before_widget;
|
97 |
|
@@ -100,47 +51,18 @@ echo $before_title . wp_kses_post( $title ) . $after_title;
|
|
100 |
|
101 |
?>
|
102 |
|
103 |
-
<?php if(
|
104 |
<div class="ct-contact-info-text">
|
105 |
<?php echo wp_kses_post($text) ?>
|
106 |
</div>
|
107 |
-
<?php }
|
108 |
-
|
109 |
-
<?php if ($has_enabled_layer) { ?>
|
110 |
-
|
111 |
-
<ul data-icons="<?php echo $icons_size . '-' . $icons_type . $fill_type_output ?>">
|
112 |
-
<?php foreach ($contact_information as $single_layer) { ?>
|
113 |
-
<li>
|
114 |
-
<i>
|
115 |
-
<?php echo $svgs[$single_layer['id']] ?>
|
116 |
-
</i>
|
117 |
-
|
118 |
-
<div class="contact-info">
|
119 |
-
<?php if (! empty(blocksy_akg('title', $single_layer, ''))) { ?>
|
120 |
-
<span class="contact-title">
|
121 |
-
<?php echo esc_html(blocksy_akg('title', $single_layer, '')) ?>
|
122 |
-
</span>
|
123 |
-
<?php } ?>
|
124 |
-
|
125 |
-
<?php if (! empty(blocksy_akg('content', $single_layer, ''))) { ?>
|
126 |
-
<span class="contact-text">
|
127 |
-
<?php if (! empty(blocksy_akg('link', $single_layer, ''))) { ?>
|
128 |
-
<a href="<?php echo blocksy_akg('link', $single_layer, '') ?>" <?php echo $data_target ?>>
|
129 |
-
<?php } ?>
|
130 |
-
|
131 |
-
<?php echo esc_html(blocksy_akg('content', $single_layer, '')) ?>
|
132 |
-
|
133 |
-
<?php if (! empty(blocksy_akg('link', $single_layer, ''))) { ?>
|
134 |
-
</a>
|
135 |
-
<?php } ?>
|
136 |
-
</span>
|
137 |
-
<?php } ?>
|
138 |
-
</div>
|
139 |
-
</li>
|
140 |
-
|
141 |
-
<?php } ?>
|
142 |
-
</ul>
|
143 |
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
-
|
14 |
// Text
|
15 |
$text = blocksy_default_akg( 'contact_text', $atts, '' );
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
$contact_information = blocksy_default_akg(
|
18 |
'contact_information',
|
19 |
$atts,
|
43 |
]
|
44 |
);
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
47 |
echo $before_widget;
|
48 |
|
51 |
|
52 |
?>
|
53 |
|
54 |
+
<?php if (! empty($text)) { ?>
|
55 |
<div class="ct-contact-info-text">
|
56 |
<?php echo wp_kses_post($text) ?>
|
57 |
</div>
|
58 |
+
<?php }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
echo blc_call_fn(['fn' => 'blc_get_contacts_output'], [
|
61 |
+
'data' => $contact_information,
|
62 |
+
'link_target' => blocksy_default_akg('contact_link_target', $atts, 'no'),
|
63 |
+
'type' => blocksy_akg('contacts_icon_shape', $atts, 'rounded'),
|
64 |
+
'fill' => blocksy_akg('contacts_icon_fill_type', $atts, 'outline'),
|
65 |
+
'size' => blocksy_akg('contacts_icons_size', $atts, 'medium')
|
66 |
+
]);
|
67 |
|
68 |
+
echo wp_kses_post($after_widget);
|
framework/extensions/widgets/widgets/ct-contact-info/widget.php
CHANGED
@@ -12,6 +12,7 @@ class Blocksy_Widget_Ct_Contact_Info extends BlocksyWidgetFactory {
|
|
12 |
return [
|
13 |
'name' => __('Contact Info', 'blc'),
|
14 |
'description' => __('Contact info', 'blc'),
|
|
|
15 |
];
|
16 |
}
|
17 |
|
12 |
return [
|
13 |
'name' => __('Contact Info', 'blc'),
|
14 |
'description' => __('Contact info', 'blc'),
|
15 |
+
'customize_selective_refresh' => true
|
16 |
];
|
17 |
}
|
18 |
|
framework/extensions/widgets/widgets/ct-facebook/options.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Facebook widget
|
4 |
+
*
|
5 |
+
* @copyright 2019-present Creative Themes
|
6 |
+
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
7 |
+
* @package Blocksy
|
8 |
+
*/
|
9 |
+
|
10 |
+
$options = [
|
11 |
+
'title' => [
|
12 |
+
'type' => 'text',
|
13 |
+
'label' => __( 'Title', 'blc' ),
|
14 |
+
'field_attr' => [ 'id' => 'widget-title' ],
|
15 |
+
'design' => 'inline',
|
16 |
+
'value' => __( 'Facebook', 'blc' ),
|
17 |
+
'disableRevertButton' => true,
|
18 |
+
],
|
19 |
+
|
20 |
+
'facebook_page_url' => [
|
21 |
+
'type' => 'text',
|
22 |
+
'label' => __( 'Page URL', 'blc' ),
|
23 |
+
'field_attr' => [ 'id' => 'widget-title' ],
|
24 |
+
'design' => 'inline',
|
25 |
+
'disableRevertButton' => true,
|
26 |
+
],
|
27 |
+
|
28 |
+
'facebook_faces' => [
|
29 |
+
'type' => 'ct-switch',
|
30 |
+
'label' => __( 'Profile Photos', 'blc' ),
|
31 |
+
'value' => 'yes',
|
32 |
+
],
|
33 |
+
|
34 |
+
'facebook_timeline' => [
|
35 |
+
'type' => 'ct-switch',
|
36 |
+
'label' => __( 'Timeline', 'blc' ),
|
37 |
+
'value' => 'no',
|
38 |
+
],
|
39 |
+
|
40 |
+
'facebook_cover' => [
|
41 |
+
'type' => 'ct-switch',
|
42 |
+
'label' => __( 'Cover Photo', 'blc' ),
|
43 |
+
'value' => 'no',
|
44 |
+
],
|
45 |
+
|
46 |
+
'facebook_small_header' => [
|
47 |
+
'type' => 'ct-switch',
|
48 |
+
'label' => __( 'Small Header', 'blc' ),
|
49 |
+
'value' => 'no',
|
50 |
+
],
|
51 |
+
|
52 |
+
];
|
framework/extensions/widgets/widgets/ct-facebook/view.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Facebook widget
|
4 |
+
*
|
5 |
+
* @copyright 2019-present Creative Themes
|
6 |
+
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
7 |
+
* @package Blocksy
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
// Widget title
|
12 |
+
$title = blocksy_default_akg( 'title', $atts, __( 'Facebook', 'blc' ) );
|
13 |
+
|
14 |
+
$url = blocksy_default_akg('facebook_page_url', $atts, '');
|
15 |
+
|
16 |
+
if (empty($url)) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$faces = blocksy_default_akg('facebook_faces', $atts, 'yes') === 'yes' ? 'true' : 'false';
|
21 |
+
$cover = blocksy_default_akg('facebook_cover', $atts, 'no') === 'yes' ? 'false' : 'true';
|
22 |
+
$header = blocksy_default_akg('facebook_small_header', $atts, 'no') === 'yes' ? 'true' : 'false';
|
23 |
+
$timeline = blocksy_default_akg('facebook_timeline', $atts, 'no') === 'yes' ? 'timeline' : '';
|
24 |
+
$posts = blocksy_default_akg('facebook_posts', $atts, 'no') === 'yes' ? 'true' : 'false';
|
25 |
+
|
26 |
+
$app_id = '';
|
27 |
+
|
28 |
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
29 |
+
echo $before_widget;
|
30 |
+
|
31 |
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
32 |
+
echo $before_title . wp_kses_post( $title ) . $after_title;
|
33 |
+
|
34 |
+
?>
|
35 |
+
|
36 |
+
<div class="ct-facebook-like-box">
|
37 |
+
<div class="fb-page"
|
38 |
+
data-href="<?php echo esc_url( $url ); ?>"
|
39 |
+
data-width="500"
|
40 |
+
data-hide-cover="<?php echo $cover; ?>"
|
41 |
+
data-show-facepile="<?php echo $faces; ?>"
|
42 |
+
data-small-header="<?php echo $header; ?>"
|
43 |
+
data-tabs="<?php echo $timeline; ?>"></div>
|
44 |
+
|
45 |
+
<div id="fb-root"></div>
|
46 |
+
|
47 |
+
<script>(function(d, s, id) {
|
48 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
49 |
+
if (d.getElementById(id)) return;
|
50 |
+
js = d.createElement(s); js.id = id;
|
51 |
+
js.src = 'https://connect.facebook.net/<?php echo esc_attr(get_locale()); ?>/sdk.js#xfbml=1&version=v3.2<?php
|
52 |
+
if ( ! empty( $app_id ) ) {
|
53 |
+
echo '&appId=' . esc_attr($app_id);
|
54 |
+
}
|
55 |
+
?>';
|
56 |
+
fjs.parentNode.insertBefore(js, fjs);
|
57 |
+
}(document, 'script', 'facebook-jssdk'));</script>
|
58 |
+
|
59 |
+
</div>
|
60 |
+
|
61 |
+
<?php echo wp_kses_post( $after_widget ); ?>
|
framework/extensions/widgets/widgets/ct-facebook/widget.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Facebook widget
|
4 |
+
*
|
5 |
+
* @copyright 2019-present Creative Themes
|
6 |
+
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
7 |
+
* @package Blocksy
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Blocksy_Widget_Ct_Facebook extends BlocksyWidgetFactory {
|
11 |
+
protected function get_config() {
|
12 |
+
return [
|
13 |
+
'name' => __('Facebook', 'blc'),
|
14 |
+
'description' => __('Facebook like box', 'blc'),
|
15 |
+
'customize_selective_refresh' => true
|
16 |
+
];
|
17 |
+
}
|
18 |
+
|
19 |
+
public function get_path() {
|
20 |
+
return dirname(__FILE__);
|
21 |
+
}
|
22 |
+
}
|
framework/extensions/widgets/widgets/ct-posts/options.php
CHANGED
@@ -7,77 +7,271 @@
|
|
7 |
* @package Blocksy
|
8 |
*/
|
9 |
|
10 |
-
$
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
'orderby' => 'name',
|
14 |
-
'order'
|
15 |
-
|
16 |
-
);
|
17 |
|
18 |
-
$category_choices = [
|
19 |
-
|
20 |
-
];
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
$options = [
|
27 |
-
|
28 |
-
'
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
],
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
'
|
39 |
-
'
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
],
|
48 |
|
49 |
-
|
50 |
-
'type' => 'ct-
|
51 |
-
'
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
'
|
59 |
-
'
|
60 |
-
'
|
61 |
-
'
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
],
|
65 |
|
66 |
-
|
67 |
-
'type' => 'ct-
|
68 |
-
'
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
],
|
73 |
|
74 |
-
|
75 |
-
'type' => 'ct-
|
76 |
-
'
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
],
|
82 |
|
83 |
'display_date' => [
|
@@ -86,16 +280,33 @@ $options = [
|
|
86 |
'value' => 'no',
|
87 |
],
|
88 |
|
89 |
-
'
|
90 |
'type' => 'ct-switch',
|
91 |
-
'label' => __( 'Show
|
92 |
'value' => 'no',
|
93 |
],
|
94 |
|
95 |
-
'
|
96 |
'type' => 'ct-switch',
|
97 |
-
'label' => __( 'Show
|
98 |
'value' => 'no',
|
99 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
];
|
101 |
|
7 |
* @package Blocksy
|
8 |
*/
|
9 |
|
10 |
+
$all_post_types = [
|
11 |
+
'post' => __('Posts', 'blc'),
|
12 |
+
'page' => __('Pages', 'blc'),
|
13 |
+
];
|
14 |
+
|
15 |
+
if (function_exists('blocksy_manager')) {
|
16 |
+
$post_types = blocksy_manager()->post_types->get_supported_post_types();
|
17 |
+
|
18 |
+
foreach ($post_types as $single_post_type) {
|
19 |
+
$post_type_object = get_post_type_object($single_post_type);
|
20 |
+
|
21 |
+
if (! $post_type_object) {
|
22 |
+
continue;
|
23 |
+
}
|
24 |
+
|
25 |
+
$all_post_types[$single_post_type] = $post_type_object->labels->singular_name;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
$cpt_options = [];
|
30 |
+
|
31 |
+
foreach ($all_post_types as $custom_post_type => $label) {
|
32 |
+
if ($custom_post_type === 'page') {
|
33 |
+
continue;
|
34 |
+
}
|
35 |
+
|
36 |
+
$opt_id = 'category';
|
37 |
+
$label = __('Category', 'blc');
|
38 |
+
$label_multiple = __('All categories', 'blc');
|
39 |
+
$taxonomy = 'category';
|
40 |
+
|
41 |
+
if ($custom_post_type !== 'post') {
|
42 |
+
$opt_id = $custom_post_type . '_taxonomy';
|
43 |
+
$label = __('Taxonomy', 'blc');
|
44 |
+
$label_multiple = __('All taxonomies', 'blc');
|
45 |
+
|
46 |
+
$taxonomies = get_object_taxonomies($custom_post_type);
|
47 |
+
|
48 |
+
if (count($taxonomies) > 0) {
|
49 |
+
$taxonomy = $taxonomies[0];
|
50 |
+
} else {
|
51 |
+
$taxonomy = 'nonexistent';
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
$categories = get_terms([
|
56 |
+
'taxonomy' => $taxonomy,
|
57 |
+
// 'post_type' => $custom_post_type,
|
58 |
'orderby' => 'name',
|
59 |
+
'order' => 'ASC',
|
60 |
+
'hide_empty' => false
|
61 |
+
]);
|
62 |
|
63 |
+
$category_choices = [
|
64 |
+
'all_categories' => $label_multiple
|
65 |
+
];
|
66 |
+
|
67 |
+
if (! is_wp_error($categories)) {
|
68 |
+
foreach ($categories as $category) {
|
69 |
+
$category_choices[$category->term_id] = $category->name;
|
70 |
+
}
|
71 |
+
}
|
72 |
|
73 |
+
$cpt_options[blocksy_rand_md5()] = [
|
74 |
+
'type' => 'ct-condition',
|
75 |
+
'condition' => [
|
76 |
+
'post_type_source' => $custom_post_type,
|
77 |
+
'post_source' => '!custom'
|
78 |
+
],
|
79 |
+
'options' => [
|
80 |
+
$opt_id => [
|
81 |
+
'type' => 'ct-select',
|
82 |
+
'label' => $label,
|
83 |
+
'value' => 'all_categories',
|
84 |
+
'choices' => blocksy_ordered_keys($category_choices),
|
85 |
+
'design' => 'inline',
|
86 |
+
],
|
87 |
+
]
|
88 |
+
];
|
89 |
}
|
90 |
|
91 |
$options = [
|
92 |
+
[
|
93 |
+
'title' => [
|
94 |
+
'type' => 'text',
|
95 |
+
'label' => __('Title', 'blc'),
|
96 |
+
'field_attr' => ['id' => 'widget-title'],
|
97 |
+
'design' => 'inline',
|
98 |
+
'value' => __('Posts', 'blc'),
|
99 |
+
],
|
100 |
+
|
101 |
+
'posts_type' => [
|
102 |
+
'type' => 'ct-select',
|
103 |
+
'label' => __('Widget Design', 'blc'),
|
104 |
+
'value' => 'small-thumbs',
|
105 |
+
'design' => 'inline',
|
106 |
+
'choices' => blocksy_ordered_keys(
|
107 |
+
[
|
108 |
+
'no-thumbs' => __( 'Without Thumbnails', 'blc' ),
|
109 |
+
'small-thumbs' => __( 'Small Thumbnails', 'blc' ),
|
110 |
+
'large-thumbs' => __( 'Large Thumbnails', 'blc' ),
|
111 |
+
'large-small' => __( 'First Thumbnail Large', 'blc' ),
|
112 |
+
'rounded' => __( 'Rounded Thumbnails', 'blc' ),
|
113 |
+
'numbered' => __( 'Numbered', 'blc' ),
|
114 |
+
]
|
115 |
+
),
|
116 |
+
],
|
117 |
+
|
118 |
+
'post_type_source' => [
|
119 |
+
'type' => 'ct-select',
|
120 |
+
'label' => __( 'Post Type', 'blc' ),
|
121 |
+
'value' => 'post',
|
122 |
+
'design' => 'inline',
|
123 |
+
'choices' => blocksy_ordered_keys($all_post_types)
|
124 |
+
],
|
125 |
+
|
126 |
+
blocksy_rand_md5() => [
|
127 |
+
'type' => 'ct-condition',
|
128 |
+
'condition' => ['post_type_source' => '!page'],
|
129 |
+
'options' => [
|
130 |
+
'post_source' => [
|
131 |
+
'type' => 'ct-select',
|
132 |
+
'label' => __( 'Source', 'blc' ),
|
133 |
+
'value' => 'categories',
|
134 |
+
'design' => 'inline',
|
135 |
+
'choices' => blocksy_ordered_keys(
|
136 |
+
[
|
137 |
+
'categories' => __('Taxonomies', 'blc'),
|
138 |
+
'custom' => __( 'Custom Query', 'blc' ),
|
139 |
+
]
|
140 |
+
),
|
141 |
+
],
|
142 |
+
],
|
143 |
+
],
|
144 |
+
|
145 |
+
blocksy_rand_md5() => [
|
146 |
+
'type' => 'ct-condition',
|
147 |
+
'condition' => ['post_type_source' => 'page'],
|
148 |
+
'options' => [
|
149 |
+
'page_source' => [
|
150 |
+
'type' => 'ct-select',
|
151 |
+
'label' => __('Source', 'blc'),
|
152 |
+
'value' => 'default',
|
153 |
+
'design' => 'inline',
|
154 |
+
'choices' => blocksy_ordered_keys(
|
155 |
+
[
|
156 |
+
'default' => __('Default', 'blc'),
|
157 |
+
'custom' => __('Custom Query', 'blc'),
|
158 |
+
]
|
159 |
+
),
|
160 |
+
],
|
161 |
+
],
|
162 |
+
],
|
163 |
],
|
164 |
|
165 |
+
$cpt_options,
|
166 |
+
|
167 |
+
blocksy_rand_md5() => [
|
168 |
+
'type' => 'ct-condition',
|
169 |
+
'condition' => [
|
170 |
+
'post_type_source' => '!page',
|
171 |
+
'post_source' => '!custom'
|
172 |
+
],
|
173 |
+
'options' => [
|
174 |
+
'type' => [
|
175 |
+
'type' => 'ct-select',
|
176 |
+
'label' => __( 'Sort by', 'blc' ),
|
177 |
+
'value' => 'commented',
|
178 |
+
'design' => 'inline',
|
179 |
+
'choices' => blocksy_ordered_keys(
|
180 |
+
[
|
181 |
+
'recent' => __( 'Recent', 'blc' ),
|
182 |
+
'commented' => __( 'Most Commented', 'blc' ),
|
183 |
+
]
|
184 |
+
),
|
185 |
+
],
|
186 |
+
|
187 |
+
'days' => [
|
188 |
+
'type' => 'ct-select',
|
189 |
+
'label' => __( 'Order by', 'blc' ),
|
190 |
+
'value' => 'all_time',
|
191 |
+
'design' => 'inline',
|
192 |
+
'choices' => blocksy_ordered_keys(
|
193 |
+
[
|
194 |
+
'all_time' => __( 'All Time', 'blc' ),
|
195 |
+
'7' => __( '1 Week', 'blc' ),
|
196 |
+
'30' => __( '1 Month', 'blc' ),
|
197 |
+
'90' => __( '3 Months', 'blc' ),
|
198 |
+
'180' => __( '6 Months', 'blc' ),
|
199 |
+
'360' => __( '1 Year', 'blc' ),
|
200 |
+
]
|
201 |
+
),
|
202 |
+
],
|
203 |
+
|
204 |
+
'posts_number' => [
|
205 |
+
'type' => 'ct-number',
|
206 |
+
'label' => __( 'Posts Count', 'blc' ),
|
207 |
+
'min' => 1,
|
208 |
+
'max' => 30,
|
209 |
+
'value' => 5,
|
210 |
+
'design' => 'inline',
|
211 |
+
],
|
212 |
+
],
|
213 |
],
|
214 |
|
215 |
+
blocksy_rand_md5() => [
|
216 |
+
'type' => 'ct-condition',
|
217 |
+
'condition' => [
|
218 |
+
'post_type_source' => '!page',
|
219 |
+
'post_source' => 'custom'
|
220 |
+
],
|
221 |
+
'options' => [
|
222 |
+
|
223 |
+
'post_id' => [
|
224 |
+
'label' => __( 'Posts ID', 'blocksy' ),
|
225 |
+
'type' => 'text',
|
226 |
+
'design' => 'inline',
|
227 |
+
'desc' => sprintf(
|
228 |
+
__('Separate posts ID by comma. How to find the %spost ID%s.', 'blocksy'),
|
229 |
+
'<a href="https://www.wpbeginner.com/beginners-guide/how-to-find-post-category-tag-comments-or-user-id-in-wordpress/" target="_blank">',
|
230 |
+
'</a>'
|
231 |
+
),
|
232 |
+
],
|
233 |
+
|
234 |
+
],
|
235 |
],
|
236 |
|
237 |
+
blocksy_rand_md5() => [
|
238 |
+
'type' => 'ct-condition',
|
239 |
+
'condition' => [
|
240 |
+
'post_type_source' => 'page',
|
241 |
+
'page_source' => 'custom'
|
242 |
+
],
|
243 |
+
'options' => [
|
244 |
+
|
245 |
+
'page_id' => [
|
246 |
+
'label' => __( 'Pages ID', 'blocksy' ),
|
247 |
+
'type' => 'text',
|
248 |
+
'design' => 'inline',
|
249 |
+
'desc' => sprintf(
|
250 |
+
__('Separate pages ID by comma. How to find the %spage ID%s.', 'blocksy'),
|
251 |
+
'<a href="https://www.wpbeginner.com/beginners-guide/how-to-find-post-category-tag-comments-or-user-id-in-wordpress/" target="_blank">',
|
252 |
+
'</a>'
|
253 |
+
),
|
254 |
+
],
|
255 |
+
|
256 |
+
],
|
257 |
],
|
258 |
|
259 |
+
blocksy_rand_md5() => [
|
260 |
+
'type' => 'ct-condition',
|
261 |
+
'condition' => [
|
262 |
+
'post_type_source' => 'page',
|
263 |
+
'page_source' => '!custom'
|
264 |
+
],
|
265 |
+
'options' => [
|
266 |
+
'page_number' => [
|
267 |
+
'type' => 'ct-number',
|
268 |
+
'label' => __( 'Pages Count', 'blc' ),
|
269 |
+
'min' => 1,
|
270 |
+
'max' => 30,
|
271 |
+
'value' => 5,
|
272 |
+
'design' => 'inline',
|
273 |
+
],
|
274 |
+
],
|
275 |
],
|
276 |
|
277 |
'display_date' => [
|
280 |
'value' => 'no',
|
281 |
],
|
282 |
|
283 |
+
'display_comments' => [
|
284 |
'type' => 'ct-switch',
|
285 |
+
'label' => __( 'Show Comments', 'blc' ),
|
286 |
'value' => 'no',
|
287 |
],
|
288 |
|
289 |
+
'display_excerpt' => [
|
290 |
'type' => 'ct-switch',
|
291 |
+
'label' => __( 'Show Excerpt', 'blc' ),
|
292 |
'value' => 'no',
|
293 |
],
|
294 |
+
|
295 |
+
blocksy_rand_md5() => [
|
296 |
+
'type' => 'ct-condition',
|
297 |
+
'condition' => [ 'display_excerpt' => 'yes' ],
|
298 |
+
'options' => [
|
299 |
+
|
300 |
+
'excerpt_lenght' => [
|
301 |
+
'type' => 'ct-number',
|
302 |
+
'label' => __( 'Excerpt Lenght', 'blc' ),
|
303 |
+
'min' => 5,
|
304 |
+
'max' => 30,
|
305 |
+
'value' => 10,
|
306 |
+
'design' => 'inline',
|
307 |
+
],
|
308 |
+
|
309 |
+
],
|
310 |
+
],
|
311 |
];
|
312 |
|
framework/extensions/widgets/widgets/ct-posts/view.php
CHANGED
@@ -7,49 +7,121 @@
|
|
7 |
* @package Blocksy
|
8 |
*/
|
9 |
|
10 |
-
$
|
11 |
-
|
12 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|