PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.2.11
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.2.11
3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 All 156 releases
notificationx / includes / Extensions / GlobalFields.php

GlobalFields.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.2.11, at includes/Extensions/GlobalFields.php

2,340 lines 152.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Register Global Fields
5 *
6 * @package NotificationX\Extensions
7 */
8
9 namespace NotificationX\Extensions;
10
11 use NotificationX\Admin\InfoTooltipManager;
12 use NotificationX\Admin\Settings;
13 use NotificationX\Core\Rules;
14 use NotificationX\Core\Database;
15 use NotificationX\Core\Helper;
16 use NotificationX\Core\Locations;
17 use NotificationX\GetInstance;
18 use NotificationX\Core\Modules;
19 use NotificationX\NotificationX;
20 use NotificationX\Types\TypeFactory;
21 use Sabberworm\CSS\Value\Value;
22
23 /**
24 * @method static GlobalFields get_instance($args = null)
25 */
26 class GlobalFields {
27 /**
28 * Instance of GlobalFields
29 *
30 * @var GlobalFields
31 */
32 use GetInstance;
33
34 /**
35 * Initially Invoked when initialized.
36 */
37 public function __construct() {
38
39 // dump(Rules::logicalRule([ Rules::is('test'), Rules::is('test2') ]));
40 }
41
42 public function tabs() {
43 if(defined('NX_DEBUG') && NX_DEBUG){
44 do_action( 'qm/start', __METHOD__ );
45 do_action( 'qm/debug', __METHOD__ );
46 }
47
48 do_action('nx_before_metabox_load');
49
50 $tabs = [
51 'id' => 'notificationx_metabox_wrapper',
52 'title' => __('NotificationX', 'notificationx'),
53 'object_types' => array('notificationx'),
54 'context' => 'normal',
55 'priority' => 'high',
56 'show_header' => false,
57 'tabnumber' => true,
58 'layout' => 'horizontal',
59 'version' => defined('NOTIFICATIONX_VERSION') ? NOTIFICATIONX_VERSION : null,
60 'pro_version' => defined('NOTIFICATIONX_PRO_VERSION') ? NOTIFICATIONX_PRO_VERSION : null,
61 'is_pro_active' => NotificationX::get_instance()->is_pro(),
62 'cus_imp_limit' => Settings::get_instance()->get('settings.custom_notification_import_limit', 100),
63 'is_pro_sources' => apply_filters('nx_is_pro_sources', []),
64 'config' => [
65 'active' => "source_tab",
66 'completionTrack' => true,
67 'sidebar' => true,
68 'content_heading' => [],
69 'step' => [
70 'show' => true,
71 'buttons' => [
72 'prev' => __('Previous', 'notificationx'),
73 'next' => __('Next', 'notificationx'),
74 ]
75 ],
76
77 ],
78 'submit' => [
79 'show' => false,
80 ],
81 'tabs' => [
82 "source_tab" => [
83 'label' => __("Source", 'notificationx'),
84 'id' => "source_tab",
85 'name' => "source_tab",
86 'icon' => [
87 'type' => 'tabs',
88 'name' => 'source'
89 ],
90 'classes' => "source_tab",
91 'fields' => apply_filters('nx_source_fields', [
92 'type_section' => [
93 'label' => __("Notification Type", 'notificationx'),
94 'name' => "type_section",
95 'type' => "section",
96 'fields' => [
97 'type' => [
98 // 'label' => "Notification Type",
99 'name' => "type",
100 'type' => "radio-card",
101 'default' => "notification_bar",
102 'style' => [
103 'label' => [
104 'position' => 'top'
105 ]
106 ],
107 'options' => (array) array_map(function ($type) {
108 return [
109 'value' => $type->id,
110 'label' => $type->title,
111 'is_pro' => $type->is_pro && ! NotificationX::is_pro(),
112 'priority' => $type->priority,
113 'popup' => apply_filters('nx_pro_alert_popup', $type->popup),
114 ];
115 }, array_values(TypeFactory::get_instance()->get_all())),
116 'validation_rules' => [
117 'required' => true,
118 'label' => "Type",
119 ],
120 // 'trigger' => [
121 // 'defaults' => apply_filters( 'nx_type_trigger', [] ),
122 // ]
123 ],
124 ]
125 ],
126 'source_section' => [
127 'label' => __("Source", 'notificationx'),
128 'name' => "source_section",
129 'type' => "section",
130 'fields' => [
131 'source_error' => [
132 'type' => 'message',
133 'name' => 'source_error',
134 'messages' => apply_filters('source_error_message', []),
135 'rules' => '',
136 ],
137 'source' => [
138 // 'label' => "Source",
139 'name' => "source",
140 'type' => "radio-card",
141 'options' => apply_filters('nx_sources', []),
142 'default' => 'woocommerce',
143 'style' => [
144 'label' => [
145 'position' => 'top'
146 ]
147 ],
148 'validation_rules' => [
149 'required' => true,
150 'label' => "Source",
151 ],
152 'trigger' => [
153 'defaults' => apply_filters( 'nx_source_trigger', [
154 "custom_notification" => [
155 'show_notification_image' => '@show_notification_image:featured_image',
156 ],
157 "custom_notification_conversions" => [
158 'show_notification_image' => '@show_notification_image:featured_image',
159 ],
160 "edd" => [
161 'show_notification_image' => '@show_notification_image:featured_image',
162 ],
163 "envato" => [
164 'show_notification_image' => '@show_notification_image:featured_image',
165 ],
166 "give" => [
167 'show_notification_image' => '@show_notification_image:featured_image',
168 ],
169 "learndash" => [
170 'show_notification_image' => '@show_notification_image:featured_image',
171 ],
172 "tutor" => [
173 'show_notification_image' => '@show_notification_image:featured_image',
174 ],
175 "reviewx" => [
176 'show_notification_image' => '@show_notification_image:featured_image',
177 ],
178 "woocommerce" => [
179 'show_notification_image' => '@show_notification_image:featured_image',
180 ],
181 "surecart" => [
182 'show_notification_image' => '@show_notification_image:featured_image',
183 ],
184 "woo_reviews" => [
185 'show_notification_image' => '@show_notification_image:featured_image',
186 ],
187 "wp_reviews" => [
188 'show_notification_image' => '@show_notification_image:featured_image',
189 ],
190 "freemius_conversions" => [
191 'show_notification_image' => '@show_notification_image:featured_image',
192 ],
193 "freemius_reviews" => [
194 'show_notification_image' => '@show_notification_image:featured_image',
195 ],
196 "freemius_stats" => [
197 'show_notification_image' => '@show_notification_image:featured_image',
198 ],
199 "convertkit" => [
200 'show_notification_image' => '@show_notification_image:gravatar',
201 ],
202 "zapier" => [
203 'show_notification_image' => '@show_notification_image:gravatar',
204 ],
205 "mailchimp" => [
206 'show_notification_image' => '@show_notification_image:gravatar',
207 ],
208 "wp_comments" => [
209 'show_notification_image' => '@show_notification_image:gravatar',
210 ],
211 "cf7" => [
212 'show_notification_image' => '@show_notification_image:gravatar',
213 ],
214 "njf" => [
215 'show_notification_image' => '@show_notification_image:gravatar',
216 ],
217 "grvf" => [
218 'show_notification_image' => '@show_notification_image:gravatar',
219 ],
220 "wpf" => [
221 'show_notification_image' => '@show_notification_image:gravatar',
222 ],
223 "woocommerce_sales" => [
224 'show_notification_image' => '@show_notification_image:featured_image',
225 ],
226 ] ),
227 ]
228 ],
229 ],
230 // 'rules' => Rules::logicalRule([
231 // Rules::is('type', 'notification_bar', true),
232 // ]),
233 ],
234 ]),
235 // 'rules' => Rules::is('source', false)
236 ],
237 "design_tab" => [
238 'label' => __("Design", 'notificationx'),
239 'id' => "design_tab",
240 'name' => "design_tab",
241 'icon' => [
242 'type' => 'tabs',
243 'name' => 'design'
244 ],
245 'classes' => "design_tab",
246 'fields' => apply_filters('nx_design_tab_fields', [
247 'design_error' => [
248 'type' => 'message',
249 'name' => 'design_error',
250 'messages' => apply_filters('design_error_message', []),
251 'rules' => '',
252 ],
253 "main_preview" => [
254 'label' => __("Preview", 'notificationx'),
255 'name' => "main_preview",
256 'type' => "section",
257 'priority' => 1,
258 'fields' => [
259 'preview_field' => [
260 'name' => "preview_field",
261 'type' => "preview",
262 'label' => __('Preview', 'notificationx'),
263 'priority' => 10,
264 ],
265 ],
266 'rules' => Rules::logicalRule([
267 Rules::is( 'type', 'notification_bar' ),
268 ]),
269 ],
270 "themes" => [
271 'label' => __("Themes", 'notificationx'),
272 'name' => "themes",
273 'type' => "section",
274 'fields' => [
275 // [
276 // 'label' => __("Select Theme", 'notificationx'),
277 // 'name' => "gdpr_s_theme",
278 // 'type' => "select",
279 // 'default' => 'light',
280 // 'options' => GlobalFields::get_instance()->normalize_fields([
281 // 'light' => __('Light', 'notificationx'),
282 // 'dark' => __('Dark', 'notificationx'),
283 // ]),
284 // 'rules' => Rules::logicalRule([
285 // Rules::is( 'type', 'gdpr' ),
286 // ]),
287 // ],
288 [
289 'label' => __("Select Theme", 'notificationx'),
290 'name' => "gdpr_theme",
291 'type' => "better-toggle",
292 'default' => false,
293 'toggle_label' => ['toggle_label_1' => __('Light', 'notificationx'), 'toggle_label_2' => __('Dark', 'notificationx')],
294 'rules' => Rules::logicalRule([
295 Rules::is( 'type', 'gdpr' ),
296 ]),
297 ],
298 "themes_section" => [
299 'type' => 'section',
300 'name' => 'themes_section',
301 'classes' => NotificationX::is_pro() ? 'pro-activated' : 'pro-deactivated','rules' => Rules::logicalRule([
302 Rules::is( 'type', 'gdpr', true ),
303 ]),
304 'fields' => [
305 'themes_tab' => [
306 'type' => 'tab',
307 'name' => 'themes_tab',
308 'submit' => [
309 'show' => false,
310 ],
311 'default' => 'for_desktop',
312 'fields' => [
313 'for_desktop' => [
314 'label' => __("For Desktop", 'notificationx'),
315 'name' => 'for_desktop',
316 'id' => 'for_desktop',
317 'type' => 'section',
318 'icon' => NOTIFICATIONX_ADMIN_URL . 'images/responsive/desktop.svg',
319 ],
320 'for_mobile' => [
321 'label' => __("For Mobile", 'notificationx'),
322 'type' => 'section',
323 'name' => 'for_mobile',
324 'id' => 'for_mobile',
325 'icon' => NOTIFICATIONX_ADMIN_URL . 'images/responsive/mobile.svg',
326 'rules' => Rules::logicalRule([
327 Rules::is( 'source', ['woocommerce_sales_inline'], true ),
328 Rules::includes('type', [ 'notification_bar', 'flashing_tab', 'inline', 'sales_inline', 'offer_announcement', 'custom' ], true),
329 ]),
330 ],
331 ]
332 ],
333 ],
334 ],
335 'themes' => [
336 // 'label' => "Themes",
337 'name' => "themes",
338 'type' => "radio-card",
339 // 'default' => "conversions_theme-one",
340 'options' => apply_filters('nx_themes', []),
341 'priority' => 10,
342 'style' => [
343 'label' => [
344 'position' => 'top'
345 ]
346 ],
347 'validation_rules' => [
348 'required' => true,
349 'label' => "Theme",
350 ],
351 'trigger' => [
352 'defaults' => apply_filters('nx_themes_trigger', []),
353 ],
354 'rules' => Rules::logicalRule([
355 Rules::is('themes_tab', 'for_desktop'),
356 ]),
357 ],
358 "responsive_themes" => [
359 // 'label' => __("Mobile Responsive Themes", 'notificationx'),
360 'name' => "responsive_themes",
361 'type' => "section",
362 'priority' => 10,
363 'classes' => NotificationX::is_pro() ? 'pro-activated' : 'pro-deactivated',
364 'rules' => Rules::logicalRule([
365 Rules::is('themes_tab', 'for_mobile'),
366 ]),
367 'fields' => [
368 'res_get_pro_btn' => array(
369 'name' => 'res_get_pro_btn',
370 'text' => __( 'Get PRO to Unlock', 'notificationx' ),
371 'type' => 'button',
372 'href' => esc_url('https://notificationx.com/#pricing'),
373 'target' => '_blank',
374 'classes' => 'res_get_pro_btn',
375 ),
376 'responsive_themes' => [
377 'name' => "responsive_themes",
378 'type' => "radio-card",
379 'options' => apply_filters('nx_res_themes', []),
380 'priority' => 10,
381 'style' => [
382 'label' => [
383 'position' => 'top'
384 ]
385 ],
386 'validation_rules' => [
387 'required' => true,
388 'label' => __("Mobile Responsive Themes",'notificationx'),
389 ],
390 'trigger' => [
391 'defaults' => apply_filters('nx_themes_trigger_for_responsive', []),
392 ],
393 ],
394 'is_mobile_responsive' => [
395 'label' => __("Enable Mobile Responsive", 'notificationx'),
396 'name' => "is_mobile_responsive",
397 'type' => "toggle",
398 'default' => true,
399 'priority' => 20,
400 'is_pro' => true,
401 ],
402 ]
403 ],
404 [
405 'label' => __("Position", 'notificationx'),
406 'name' => "gdpr_position",
407 'type' => "select",
408 'default' => 'cookie_notice_bottom_right',
409 'options' => GlobalFields::get_instance()->normalize_fields([
410 'cookie_notice_bottom_left' => __('Bottom Left', 'notificationx'),
411 'cookie_notice_bottom_right' => __('Bottom Right', 'notificationx'),
412 'cookie_notice_center' => __('Center', 'notificationx'),
413 ]),
414 'rules' => Rules::logicalRule([
415 Rules::is( 'type', 'gdpr' ),
416 Rules::includes('themes', [ 'gdpr_theme-light-one', 'gdpr_theme-light-two', 'gdpr_theme-light-three',
417 'gdpr_theme-light-four', 'gdpr_theme-dark-one', 'gdpr_theme-dark-two', 'gdpr_theme-dark-three', 'gdpr_theme-dark-four' ], false),
418 ]),
419 ],
420 [
421 'label' => __("Position", 'notificationx'),
422 'name' => "gdpr_banner_position",
423 'type' => "select",
424 'default' => 'cookie_banner_bottom',
425 'options' => GlobalFields::get_instance()->normalize_fields([
426 'cookie_banner_bottom' => __('Bottom', 'notificationx'),
427 'cookie_banner_top' => __('Top', 'notificationx'),
428 ]),
429 'rules' => Rules::logicalRule([
430 Rules::is( 'type', 'gdpr' ),
431 Rules::includes('themes', [ 'gdpr_theme-banner-light-one', 'gdpr_theme-banner-light-two', 'gdpr_theme-banner-dark-one', 'gdpr_theme-banner-dark-two' ], false),
432 ]),
433 ],
434 'advance_edit' => [
435 'label' => __("Advanced Design", 'notificationx'),
436 'name' => "advance_edit",
437 'type' => "toggle",
438 'default' => false,
439 'priority' => 20,
440 'rules' => Rules::logicalRule([
441 Rules::is('themes_tab', 'for_desktop'),
442 Rules::is('themes_tab', 'nxbar_build_with_ai'),
443 ], 'or'),
444 ],
445 ]
446 ],
447 'advance_design_section' => [
448 'label' => __('Advanced Design', 'notificationx'),
449 'type' => 'section',
450 'name' => 'advance_design_section',
451 'dependency_class' => [
452 'name' => 'advance_edit',
453 'is' => true,
454 'classes' => 'advanced_active',
455 'selector' => '#advance_design_section',
456 ],
457 'fields' => [
458 "advance_edit" => [
459 'label' => __("Advanced Toggle", 'notificationx'),
460 'name' => "advance_edit",
461 'type' => "toggle",
462 'default' => false,
463 'priority' => 1,
464 ],
465 "design" => [
466 'label' => __("Design", 'notificationx'),
467 'name' => "design",
468 'type' => "section",
469 'priority' => 5,
470 'rules' => Rules::is('advance_edit', true),
471 // 'rules' => Rules::is( 'advance_edit', true ),
472 'fields' => [
473 [
474 'label' => __("Background Color", 'notificationx'),
475 'name' => "bg_color",
476 'type' => "colorpicker",
477 'default' => "#fff",
478 ],
479 [
480 'label' => __("Text Color", 'notificationx'),
481 'name' => "text_color",
482 'type' => "colorpicker",
483 'default' => "#000",
484 ],
485 [
486 'label' => __("Want Border?", 'notificationx'),
487 'name' => "border",
488 'type' => "checkbox",
489 'default' => 0,
490 ],
491 [
492 'label' => __("Border Size", 'notificationx'),
493 'name' => "border_size",
494 'type' => "number",
495 'default' => 1,
496 'rules' => Rules::is( 'border', true ),
497 ],
498 [
499 'label' => __("Border Style", 'notificationx'),
500 'name' => "border_style",
501 'type' => "select",
502 'default' => 'solid',
503 'options' => $this->normalize_fields([
504 'solid' => __('Solid', 'notificationx'),
505 'dashed' => __('Dashed', 'notificationx'),
506 'dotted' => __('Dotted', 'notificationx'),
507 ]),
508 'rules' => Rules::is( 'border', true ),
509 ],
510 [
511 'label' => __('Border Color', 'notificationx'),
512 'name' => "border_color",
513 'type' => "colorpicker",
514 'default' => "#000",
515 'rules' => Rules::is( 'border', true ),
516 ],
517 [
518 'label' => __('Discount Text Color', 'notificationx'),
519 'name' => "discount_text_color",
520 'type' => "colorpicker",
521 'default' => "#fff",
522 'rules' => Rules::logicalRule([
523 Rules::is( 'type', 'offer_announcement' ),
524 Rules::includes('themes', [ 'announcements_theme-1', 'announcements_theme-2' ], false),
525 ]),
526 ],
527 [
528 'label' => __('Discount Background', 'notificationx'),
529 'name' => "discount_background",
530 'type' => "colorpicker",
531 'rules' => Rules::logicalRule([
532 Rules::is( 'type', 'offer_announcement' ),
533 Rules::includes('themes', [ 'announcements_theme-1', 'announcements_theme-2' ], false),
534 ]),
535 ],
536 ]
537 ],
538 "typography" => [
539 'label' => __('Typography', 'notificationx'),
540 'name' => "typography",
541 'type' => "section",
542 'priority' => 10,
543 'rules' => Rules::is( 'advance_edit', true ),
544 'fields' => [
545 [
546 'label' => __('Font Size', 'notificationx'),
547 'name' => "first_font_size",
548 'type' => "number",
549 'default' => '13',
550 'description' => 'px',
551 'help' => __('This font size will be applied for <mark>first</mark> row', 'notificationx'),
552 ],
553 [
554 'label' => __('Font Size', 'notificationx'),
555 'name' => "second_font_size",
556 'type' => "number",
557 'default' => '14',
558 'description' => 'px',
559 'help' => __('This font size will be applied for <mark>second</mark> row', 'notificationx'),
560 ],
561 [
562 'label' => __('Font Size', 'notificationx'),
563 'name' => "third_font_size",
564 'type' => "number",
565 'default' => '11',
566 'description' => 'px',
567 'help' => __('This font size will be applied for <mark>third</mark> row', 'notificationx'),
568 ],
569 ]
570 ],
571 "image-appearance" => [
572 'label' => __('Image Appearance', 'notificationx'),
573 'name' => "image-appearance",
574 'type' => "section",
575 'priority' => 15,
576 'rules' => Rules::is( 'advance_edit', true ),
577 'fields' => [
578 'image_shape' => [
579 'label' => __('Image Shape', 'notificationx'),
580 'name' => "image_shape",
581 'type' => "select",
582 'default' => 'circle',
583 'priority' => 5,
584 'options' => $this->normalize_fields([
585 'circle' => __('Circle', 'notificationx'),
586 'rounded' => __('Rounded', 'notificationx'),
587 'square' => __('Square', 'notificationx'),
588 ]),
589 ],
590 'image_position' => [
591 'label' => __('Position', 'notificationx'),
592 'name' => "image_position",
593 'type' => "select",
594 'default' => 'left',
595 'priority' => 15,
596 'options' => $this->normalize_fields([
597 'left' => __('Left', 'notificationx'),
598 'right' => __('Right', 'notificationx'),
599 ]),
600 ],
601 ]
602 ],
603 "custom_css" => [
604 'label' => __('Custom CSS', 'notificationx'),
605 'name' => "custom_css",
606 'type' => "section",
607 'priority' => 150,
608 'rules' => Rules::is( 'advance_edit', true ),
609 'fields' => [
610 [
611 'label' => __('Add Custom CSS', 'notificationx'),
612 'name' => "add_custom_css",
613 'type' => "advanced-codeviewer",
614 'button_text' => __( 'Click to Copy', 'notificationx' ),
615 'success_text' => __( 'Copied to clipboard.', 'notificationx' ),
616 'is_pro' => true,
617 'copyOnClick' => false,
618 'priority' => 5,
619 'info' => InfoTooltipManager::get_instance()->render('custom_css'),
620 'help' => __('Use custom CSS to style this Notification.', 'notificationx'),
621 ],
622 ]
623 ],
624 ]
625 ]
626 ])
627 ],
628 "content_tab" => [
629 'label' => __("Content", 'notificationx'),
630 'id' => "content_tab",
631 'name' => "content_tab",
632 'icon' => [
633 'type' => 'tabs',
634 'name' => 'content'
635 ],
636 'classes' => "content_tab",
637 'fields' => apply_filters('nx_content_fields', [
638 "main_preview" => [
639 'label' => __("Preview", 'notificationx'),
640 'name' => "main_preview",
641 'type' => "section",
642 'priority' => 1,
643 'fields' => [
644 'preview_field' => [
645 'name' => "preview_field",
646 'type' => "preview",
647 'label' => __('Preview', 'notificationx'),
648 'priority' => 10,
649 ],
650 ],
651 'rules' => Rules::logicalRule([
652 Rules::is( 'type', 'notification_bar' ),
653 ]),
654 ],
655 'content' => apply_filters('nx_content_field', [
656 'label' => __("Content", 'notificationx'),
657 'name' => "content",
658 'type' => "section",
659 'priority' => 90,
660 'fields' => [
661 "notification-template" => [
662 'label' => __("Notification Template", 'notificationx'),
663 'name' => "notification-template",
664 'type' => "group",
665 'display' => 'inline',
666 'priority' => 90,
667 'fields' => apply_filters('nx_notification_template', [
668 "first_param" => [
669 // 'label' => __("First Parameter", 'notificationx'),
670 'name' => "first_param",
671 'type' => "select",
672 'priority' => 3,
673 'default' => 'tag_name',
674 'options' => $this->normalize_fields([
675 'tag_custom' => __('Custom', 'notificationx'),
676 ]),
677 ],
678 "custom_first_param" => [
679 // 'label' => __("Custom First Parameter", 'notificationx'),
680 'name' => "custom_first_param",
681 'type' => "text",
682 'priority' => 5,
683 'default' => __('Someone', 'notificationx'),
684 'rules' => Rules::is( 'notification-template.first_param', 'tag_custom' ),
685 ],
686 "second_param" => [
687 // 'label' => __("Second Param", 'notificationx'),
688 'name' => "second_param",
689 'type' => "text",
690 'priority' => 10,
691 'default' => __('recently purchased', 'notificationx'),
692 ],
693 "third_param" => [
694 // 'label' => __("Third Parameter", 'notificationx'),
695 'name' => "third_param",
696 'type' => "select",
697 'priority' => 20,
698 'default' => 'tag_title',
699 'options' => $this->normalize_fields([
700 'tag_custom' => __('Custom', 'notificationx'),
701 ]),
702 ],
703 "custom_third_param" => [
704 // 'label' => __("Custom Third Param", 'notificationx'),
705 'name' => "custom_third_param",
706 'type' => "text",
707 'priority' => 25,
708 'default' => __('Some time ago', 'notificationx'),
709 'rules' => Rules::is( 'notification-template.third_param', 'tag_custom' ),
710 ],
711 "fourth_param" => [
712 // 'label' => __("Fourth Parameter", 'notificationx'),
713 'name' => "fourth_param",
714 'type' => "select",
715 'priority' => 30,
716 'default' => 'tag_time',
717 'options' => $this->normalize_fields([
718 'tag_custom' => __('Custom', 'notificationx'),
719 ]),
720 ],
721 "custom_fourth_param" => [
722 // 'label' => __("Custom Fourth Parameter", 'notificationx'),
723 'name' => "custom_fourth_param",
724 'type' => "text",
725 'priority' => 35,
726 'default' => __('Some time ago', 'notificationx'),
727 'rules' => Rules::is( 'notification-template.fourth_param', 'tag_custom' ),
728 ],
729 "fifth_param" => [
730 // 'label' => __("Fifth Parameter", 'notificationx'),
731 'name' => "fifth_param",
732 'type' => "select",
733 'priority' => 40,
734 'options' => $this->normalize_fields([
735 'tag_custom' => __('Custom', 'notificationx'),
736 ]),
737 ],
738 "custom_fifth_param" => [
739 // 'label' => __("Custom Fifth Parameter", 'notificationx'),
740 'name' => "custom_fifth_param",
741 'type' => "text",
742 'priority' => 45,
743 'rules' => Rules::is( 'notification-template.fifth_param', 'tag_custom' ),
744 ],
745 "sixth_param" => [
746 // 'label' => __("Sixth Parameter", 'notificationx'),
747 'name' => "sixth_param",
748 'type' => "select",
749 'priority' => 50,
750 // 'default' => 'tag_custom',
751 'options' => $this->normalize_fields([
752 'tag_custom' => __('Custom', 'notificationx'),
753 ]),
754 ],
755 "custom_sixth_param" => [
756 // 'label' => __("Custom Sixth Parameter", 'notificationx'),
757 'name' => "custom_sixth_param",
758 'type' => "text",
759 'priority' => 55,
760 'rules' => Rules::is( 'notification-template.sixth_param', 'tag_custom' ),
761 ],
762
763 ]),
764 'rules' => Rules::includes( 'source', apply_filters('nx_notification_template_dependency', []) ),
765 ],
766 'template_adv' => [
767 'label' => __("Advanced Template", 'notificationx'),
768 'name' => "template_adv",
769 'type' => "toggle",
770 'default' => false,
771 'is_pro' => true,
772 'priority' => 91,
773 'info' => InfoTooltipManager::get_instance()->render('advanced_template'),
774 ],
775 'advanced_template' => [
776 'name' => 'advanced_template',
777 'type' => 'advanced-template',
778 'label' => __('Advanced Template', 'notificationx'),
779 'priority' => 92,
780 'rules' => ['is', 'template_adv', true],
781 ],
782 'random_order' => array(
783 'name' => 'random_order',
784 'label' => __('Random Order', 'notificationx'),
785 'type' => 'checkbox',
786 'priority' => 93,
787 'default' => 0,
788 'is_pro' => true,
789 'description' => __('Enable to show notification in random order.', 'notificationx'),
790 'rules' => Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart","custom_notification", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart']),
791 'info' => InfoTooltipManager::get_instance()->render('random_order'),
792 ),
793 'product_control' => array(
794 'label' => __('Show Purchase Of', 'notificationx'),
795 'name' => 'product_control',
796 'type' => 'select',
797 'priority' => 94,
798 'default' => 'none',
799 // 'is_pro' => true,
800 // 'disable' => true,
801 'options' => GlobalFields::get_instance()->normalize_fields([
802 'none' => __('All', 'notificationx'),
803 'product_category' => __('Product Category', 'notificationx'),
804 'manual_selection' => __('Selected Product', 'notificationx'),
805 ]),
806 'info' => InfoTooltipManager::get_instance()->render('show_purchase_of'),
807 'rules' => Rules::includes('source', ['woocommerce','woocommerce_sales', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart",'woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
808 ),
809 'category_list' => array(
810 'label' => __('Select Product Category', 'notificationx'),
811 'name' => 'category_list',
812 'type' => 'select',
813 'multiple' => true,
814 'priority' => 95,
815 'options' => apply_filters('nx_conversion_category_list', []),
816 'rules' => Rules::logicalRule([
817 Rules::includes('source', ['woocommerce' , 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", "surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
818 Rules::is( 'product_control', 'product_category' ),
819 ]),
820 ),
821 'product_list' => array(
822 'label' => __('Select Product', 'notificationx'),
823 'name' => 'product_list',
824 'type' => 'select-async',
825 'multiple' => true,
826 'priority' => 96,
827 'options' => apply_filters('nx_conversion_product_list', [
828 [
829 'label' => "Type for more result...",
830 'value' => null,
831 'disabled' => true,
832 ],
833 ]),
834 'rules' => Rules::logicalRule([
835 Rules::includes('source', ['woocommerce', 'woocommerce_sales', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart",'woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
836 Rules::is( 'product_control', 'manual_selection' ),
837 ]),
838 'ajax' => [
839 'api' => "/notificationx/v1/get-data",
840 'data' => [
841 'type' => "@type",
842 'source' => "@source",
843 'field' => "product_list",
844 ],
845 // 'target' => "product_list",
846 'rules' => Rules::logicalRule([
847 Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", "surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
848 Rules::is( 'product_control', 'manual_selection' ),
849 ]),
850 ],
851 ),
852 'product_exclude_by' => array(
853 'label' => __('Exclude By', 'notificationx'),
854 'name' => 'product_exclude_by',
855 'type' => 'select',
856 'priority' => 97,
857 'default' => 'none',
858 // 'is_pro' => true,
859 // 'disable' => true,
860 'options' => GlobalFields::get_instance()->normalize_fields([
861 'none' => __('None', 'notificationx'),
862 'product_category' => __('Product Category', 'notificationx'),
863 'manual_selection' => __('Selected Product', 'notificationx'),
864 ]),
865 'info' => InfoTooltipManager::get_instance()->render('exclude_by'),
866 'rules' => Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
867 ),
868 'exclude_categories' => array(
869 'label' => __('Select Product Category', 'notificationx'),
870 'name' => 'exclude_categories',
871 'type' => 'select',
872 'multiple' => true,
873 'priority' => 98,
874 'options' => apply_filters('nx_conversion_category_list', []),
875 'rules' => Rules::logicalRule([
876 Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", "surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
877 Rules::is( 'product_exclude_by', 'product_category' ),
878 ]),
879 ),
880 'exclude_products' => array(
881 'label' => __('Select Product', 'notificationx'),
882 'name' => 'exclude_products',
883 'type' => 'select-async',
884 'multiple' => true,
885 'priority' => 99,
886 'options' => apply_filters('nx_conversion_product_list', [
887 [
888 'label' => "Type for more result...",
889 'value' => null,
890 'disabled' => true,
891 ],
892 ]),
893 'rules' => Rules::logicalRule([
894 Rules::includes('source', ['woocommerce', 'woocommerce_sales', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart",'woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
895 Rules::is( 'product_exclude_by', 'manual_selection' ),
896 ]),
897 'ajax' => [
898 'api' => "/notificationx/v1/get-data",
899 'data' => [
900 'type' => "@type",
901 'source' => "@source",
902 'field' => "exclude_products",
903 ],
904 'rules' => Rules::logicalRule([
905 Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']),
906 Rules::is( 'product_exclude_by', 'manual_selection' ),
907 ]),
908 ],
909 ),
910 'order_status' => array(
911 'label' => __('Order Status', 'notificationx'),
912 'name' => 'order_status',
913 'type' => 'select',
914 'multiple' => true,
915 'is_pro' => true,
916 'priority' => 99.5,
917 'default' => ['wc-completed', 'wc-processing'],
918 'help' => __("By default it will show Processing & Completed status.",'notificationx'),
919 'options' => apply_filters('nx_woo_order_status', []),
920 'info' => InfoTooltipManager::get_instance()->render('order_status'),
921 'rules' => Rules::logicalRule([
922 Rules::includes('source', ['woocommerce', 'woocommerce_sales', "woo_inline","woocommerce_sales_inline"]),
923 Rules::includes('themes', [ 'woo_inline_stock-theme-one', 'woo_inline_stock-theme-two', 'woocommerce_sales_inline_stock-theme-one', 'woocommerce_sales_inline_stock-theme-two'], true),
924 ]),
925
926 ),
927 'surecart_order_status' => array(
928 'label' => __('Order Status', 'notificationx'),
929 'name' => 'surecart_order_status',
930 'type' => 'select',
931 'multiple' => true,
932 'is_pro' => true,
933 'priority' => 99.6,
934 'default' => ['processing','fulfilled'],
935 'help' => __("By default it will show Processing & Fulfilled status.",'notificationx'),
936 'options' => apply_filters('nx_surecart_order_status', []),
937 'info' => InfoTooltipManager::get_instance()->render('order_status'),
938 'rules' => Rules::logicalRule([
939 Rules::includes('source', ["surecart"]),
940 ]),
941 ),
942 'fluentcart_order_status' => array(
943 'label' => __('Order Status', 'notificationx'),
944 'name' => 'fluentcart_order_status',
945 'type' => 'select',
946 'multiple' => true,
947 'is_pro' => true,
948 'priority' => 99.8,
949 'default' => ['on-hold','completed','processing'],
950 'help' => __("By default it will show Processing & Fulfilled status.",'notificationx'),
951 'options' => apply_filters('nx_fluentcart_order_status', []),
952 'info' => InfoTooltipManager::get_instance()->render('order_status'),
953 'rules' => Rules::logicalRule([
954 Rules::includes('source', ["fluentcart"]),
955 ]),
956 ),
957 'combine_multiorder' => [
958 'label' => __('Combine Multi Order', 'notificationx'),
959 'name' => 'combine_multiorder',
960 'type' => 'checkbox',
961 'priority' => 99.7,
962 'default' => true,
963 'description' => __('Combine order like, 2 more products.', 'notificationx'),
964 'rules' => Rules::logicalRule([
965 Rules::is('notification-template.first_param', 'tag_sales_count', true),
966 Rules::includes('source', [ 'woocommerce', 'edd', 'woocommerce_sales' ]),
967 ]),
968 ],
969 'combine_multiorder_display' => [
970 'label' => __('Combine Display', 'notificationx'),
971 'name' => 'combine_multiorder_display',
972 'type' => 'select',
973 'priority' => 99.71,
974 'default' => 'count',
975 'description' => __('Show the number of other products, or list their names.', 'notificationx'),
976 'options' => $this->normalize_fields([
977 'count' => __('Show count (e.g. & 2 more products)', 'notificationx'),
978 'list' => __('List product names (e.g. & Product B & Product C)', 'notificationx'),
979 ]),
980 'rules' => Rules::logicalRule([
981 Rules::is('notification-template.first_param', 'tag_sales_count', true),
982 Rules::includes('source', [ 'woocommerce', 'edd', 'woocommerce_sales' ]),
983 Rules::is('combine_multiorder', true),
984 ]),
985 ],
986 ],
987 ]),
988 'gdpr_content' => apply_filters('nx_content_gdpr', [
989 'label' => __("Cookies Content", 'notificationx'),
990 'name' => "content",
991 'type' => "section",
992 'priority' => 95,
993 'fields' => apply_filters('nx_content_fields_gdpr', []),
994 'rules' => Rules::is('type', 'gdpr' ),
995 ]),
996 'link_options' => [
997 'label' => __('Link Options', 'notificationx'),
998 'name' => "link_options",
999 'type' => "section",
1000 'priority' => 105,
1001 'fields' => [
1002 "link_type" => [
1003 'label' => __("Link Type", 'notificationx'),
1004 'name' => "link_type",
1005 'type' => "select",
1006 'default' => 'none',
1007 'options' => apply_filters('nx_link_types', $this->normalize_fields([
1008 'none' => __('None', 'notificationx'),
1009 ])),
1010 ],
1011 'link_button' => [
1012 'label' => __('Button', 'notificationx'),
1013 'name' => 'link_button',
1014 'type' => 'checkbox',
1015 'priority' => 100,
1016 'is_pro' => true,
1017 'default' => false,
1018 // 'default' => [
1019 // 'youtube_channel-1' => true,
1020 // 'youtube_channel-2' => true,
1021 // 'youtube_video-3' => true,
1022 // 'youtube_video-4' => true,
1023 // ],
1024 'info' => InfoTooltipManager::get_instance()->render('button'),
1025 'description' => __('Enable button with link', 'notificationx'),
1026 'rules' => Rules::logicalRule([
1027 Rules::includes('type', ['conversions','video','woocommerce', 'woocommerce_sales','page_analytics']),
1028 Rules::is('link_type','none',true),
1029 ]),
1030 ],
1031 ],
1032 // must be called after nx_link_types filter.
1033 'rules' => Rules::logicalRule([
1034 [ 'includes', 'source', apply_filters('nx_link_types_dependency', []) ],
1035 Rules::is( 'type', 'gdpr', true ),
1036 ]),
1037 ],
1038 ]),
1039 ],
1040 "manager_tab" => [
1041 'label' => __("Manager", 'notificationx'),
1042 'id' => "manager_tab",
1043 'name' => "manager_tab",
1044 'rules' => Rules::is('type', 'gdpr'),
1045 'icon' => [
1046 'type' => 'tabs',
1047 'name' => 'manager'
1048 ],
1049 'classes' => "manager_tab",
1050 'fields' => apply_filters('nx_manager_fields', [
1051 "main_preview" => [
1052 'label' => __("Preview", 'notificationx'),
1053 'name' => "main_preview",
1054 'type' => "section",
1055 'priority' => 1,
1056 'fields' => [
1057 'preview_field' => [
1058 'name' => "preview_field",
1059 'type' => "preview",
1060 'label' => __('Preview', 'notificationx'),
1061 'priority' => 10,
1062 ],
1063 ],
1064 'rules' => Rules::logicalRule([
1065 Rules::is( 'type', 'notification_bar' ),
1066 ]),
1067 ],
1068 'general_settngs' => [
1069 'label' => __("General Settings", 'notificationx'),
1070 'id' => "general_settngs",
1071 'name' => "general_settngs",
1072 'type' => 'section',
1073 'fields'=> [
1074 'gdpr_force_reload' => [
1075 'label' => __("Force Reload", 'notificationx'),
1076 'name' => "gdpr_force_reload",
1077 'type' => "better-toggle",
1078 'default' => false,
1079 'toggle_label' => ['toggle_label_1' => __('Enable Force Reload', 'notificationx'), 'toggle_label_2' => __('', 'notificationx')],
1080 'rules' => Rules::logicalRule([
1081 Rules::is( 'type', 'gdpr' ),
1082 ]),
1083 'info' => __('Choose whether the page should reload after the user accepts cookies. If not, your analytics software won’t register the current page visit, as cookies will only be loaded during the next page load', 'notificationx'),
1084 ],
1085 'gdpr_cookie_removal' => [
1086 'label' => __("Cookie Removal", 'notificationx'),
1087 'name' => "gdpr_cookie_removal",
1088 'type' => "better-toggle",
1089 'default' => false,
1090 'toggle_label' => ['toggle_label_1' => __('Enable Cookie Removal', 'notificationx'), 'toggle_label_2' => __('', 'notificationx')],
1091 'rules' => Rules::logicalRule([
1092 Rules::is( 'type', 'gdpr' ),
1093 ]),
1094 'info' => __('When cookies are not accepted, non-essential cookies are removed, ensuring compliance with GDPR requirements.', 'notificationx'),
1095 ],
1096 'gdpr_consent_expiry' => [
1097 'label' => __("Consent Expiry", 'notificationx'),
1098 'name' => "gdpr_consent_expiry",
1099 'type' => "number",
1100 'min' => 1,
1101 'description' => __('Days', 'notificationx'),
1102 'default' => 30,
1103 'suggestions' => [
1104 [
1105 'value' => 30,
1106 'unit' => 'days',
1107 ],
1108 [
1109 'value' => 90,
1110 'unit' => 'days',
1111 ],
1112 [
1113 'value' => 180,
1114 'unit' => 'days',
1115 ],
1116 [
1117 'value' => 365,
1118 'unit' => 'days',
1119 ],
1120 ],
1121 'rules' => Rules::logicalRule([
1122 Rules::is( 'type', 'gdpr' ),
1123 ]),
1124 'info' => __('By default, consent expires after 30 days. If needed, you can adjust this number to your preference', 'notificationx'),
1125 ],
1126 ]
1127 ],
1128 'scan_cookies' => [
1129 'label' => 'Scan Cookies',
1130 'type' => 'section',
1131 'name' => 'scan_cookies',
1132 'fields' => [
1133 'cookie_scanner' => [
1134 'type' => 'cookie-scanner',
1135 'name' => 'cookie_scanner',
1136 'id' => 'cookie_scanner',
1137 'label' => 'Cookie Scanner',
1138 ],
1139 ]
1140 ],
1141 'cookies_list_section' => [
1142 'label' => 'Cookies List',
1143 'type' => 'section',
1144 'name' => 'cookies_list_section',
1145 'fields' => [
1146 'cookies_lists' => [
1147 'type' => 'tab',
1148 'name' => 'cookies_lists',
1149 'submit' => [
1150 'show' => false,
1151 ],
1152 'default' => 'necessary_tab',
1153 'dataShare' => true,
1154 'fields' => [
1155 'necessary_tab' => [
1156 'label' => __("Necessary", 'notificationx'),
1157 'name' => 'necessary_tab',
1158 'id' => 'necessary_tab',
1159 'type' => 'section',
1160 'icon' => [
1161 'type' => 'tabs',
1162 'name' => 'necessary'
1163 ],
1164 'fields' => [
1165 'necessary_tab_info_modal' => [
1166 'name' => 'necessary_tab_info_modal',
1167 'type' => 'modal',
1168 'show_body' => true,
1169 'close_on_body' => true,
1170 'button' => [
1171 'name' => 'tab_info_edit',
1172 'text' => __(' ', 'notificationx'),
1173 'icon' => [
1174 'type' => 'tabs',
1175 'name' => 'edit_modal'
1176 ],
1177 ],
1178 'confirm_button' => [
1179 'type' => 'button',
1180 'text' => 'Save',
1181 'name' => 'necessary_close_tab_info_modal',
1182 "default" => false,
1183 'close_action' => true,
1184 ],
1185 'cancel' => "necessary_close_tab_info_modal",
1186 'body' => [
1187 'header' => __('Edit Category ', 'notificationx'),
1188 'fields' => [
1189 'tab_title' => Helper::tab_info_title('necessary', 'Necessary'),
1190 'tab_description' => Helper::tab_info_desc('necessary', 'Necessary cookies are needed to ensure the basic functions of this site, like allowing secure log-ins and managing your consent settings. These cookies do not collect any personal information.'),
1191 ],
1192 ],
1193 ],
1194 'necessary_cookie_lists' => [
1195 'label' => __('', 'notificationx'),
1196 'name' => 'necessary_cookie_lists',
1197 'type' => 'better-repeater',
1198 'priority' => 10,
1199 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png',
1200 'button' => [
1201 'label' => __('Add New', 'notificationx'),
1202 'position' => 'top',
1203 ],
1204 'default' => Helper::default_cookie_list(),
1205 'visible_fields' => ['cookies_id','load_inside', 'script_url_pattern', 'description'],
1206 '_fields' => Helper::gdpr_common_fields(),
1207 ]
1208 ],
1209 ],
1210 'functional_tab' => [
1211 'label' => __("Functional", 'notificationx'),
1212 'type' => 'section',
1213 'name' => 'functional_tab',
1214 'id' => 'functional_tab',
1215 'icon' => [
1216 'type' => 'tabs',
1217 'name' => 'functional'
1218 ],
1219 'fields' => [
1220 'functional_tab_info_modal' => [
1221 'name' => 'functional_tab_info_modal',
1222 'type' => 'modal',
1223 'show_body' => true,
1224 'close_on_body' => true,
1225 'button' => [
1226 'name' => 'tab_info_edit',
1227 'text' => __(' ', 'notificationx'),
1228 'icon' => [
1229 'type' => 'tabs',
1230 'name' => 'edit_modal'
1231 ],
1232 ],
1233 'confirm_button' => [
1234 'type' => 'button',
1235 'text' => 'Save',
1236 'name' => 'functional_close_tab_info_modal',
1237 "default" => false,
1238 'close_action' => true,
1239 ],
1240 'cancel' => "functional_close_tab_info_modal",
1241 'body' => [
1242 'header' => __('Edit Category ', 'notificationx'),
1243 'fields' => [
1244 'tab_title' => Helper::tab_info_title('functional', 'Functional'),
1245 'tab_description' => Helper::tab_info_desc('functional', 'Functional cookies assist in performing tasks like sharing website content on social media, collecting feedback, and enabling other third-party features.'),
1246 ],
1247 ],
1248 ],
1249 'functional_cookie_lists' => [
1250 'label' => __('', 'notificationx'),
1251 'name' => 'functional_cookie_lists',
1252 'type' => 'better-repeater',
1253 'priority' => 10,
1254 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png',
1255 'button' => [
1256 'label' => __('Add New', 'notificationx'),
1257 'position' => 'top',
1258 ],
1259 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(),
1260 '_fields' => Helper::gdpr_common_fields(),
1261 ]
1262 ],
1263 ],
1264 'analytics_tab' => [
1265 'label' => __("Analytics", 'notificationx'),
1266 'type' => 'section',
1267 'name' => 'analytics_tab',
1268 'id' => 'analytics_tab',
1269 'icon' => [
1270 'type' => 'tabs',
1271 'name' => 'analytics'
1272 ],
1273 'fields' => [
1274 'analytics_tab_info_modal' => [
1275 'name' => 'analytics_tab_info_modal',
1276 'type' => 'modal',
1277 'show_body' => true,
1278 'close_on_body' => true,
1279 'button' => [
1280 'name' => 'tab_info_edit',
1281 'text' => __(' ', 'notificationx'),
1282 'icon' => [
1283 'type' => 'tabs',
1284 'name' => 'edit_modal'
1285 ],
1286 ],
1287 'confirm_button' => [
1288 'type' => 'button',
1289 'text' => 'Save',
1290 'name' => 'analytics_close_tab_info_modal',
1291 "default" => false,
1292 'close_action' => true,
1293 ],
1294 'cancel' => "analytics_close_tab_info_modal",
1295 'body' => [
1296 'header' => __('Edit Category ', 'notificationx'),
1297 'fields' => [
1298 'tab_title' => Helper::tab_info_title('analytics', 'Analytics'),
1299 'tab_description' => Helper::tab_info_desc('analytics', 'Analytical cookies help us understand how visitors use the website. They provide data on metrics like the number of visitors, bounce rate, traffic sources etc.'),
1300 ],
1301 ],
1302 ],
1303 'analytics_cookie_lists' => [
1304 'label' => __('', 'notificationx'),
1305 'name' => 'analytics_cookie_lists',
1306 'type' => 'better-repeater',
1307 'priority' => 10,
1308 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png',
1309 'button' => [
1310 'label' => __('Add New', 'notificationx'),
1311 'position' => 'top',
1312 ],
1313 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(),
1314 '_fields' => Helper::gdpr_common_fields(),
1315 ]
1316 ],
1317 ],
1318 'performance_tab' => [
1319 'label' => __("Performance", 'notificationx'),
1320 'type' => 'section',
1321 'name' => 'performance_tab',
1322 'id' => 'performance_tab',
1323 'icon' => [
1324 'type' => 'tabs',
1325 'name' => 'performance'
1326 ],
1327 'fields' => [
1328 'performance_tab_info_modal' => [
1329 'name' => 'performance_tab_info_modal',
1330 'type' => 'modal',
1331 'show_body' => true,
1332 'close_on_body' => true,
1333 'button' => [
1334 'name' => 'tab_info_edit',
1335 'text' => __(' ', 'notificationx'),
1336 'icon' => [
1337 'type' => 'tabs',
1338 'name' => 'edit_modal'
1339 ],
1340 ],
1341 'confirm_button' => [
1342 'type' => 'button',
1343 'text' => 'Save',
1344 'name' => 'performance_close_tab_info_modal',
1345 "default" => false,
1346 'close_action' => true,
1347 ],
1348 'cancel' => "performance_close_tab_info_modal",
1349 'body' => [
1350 'header' => __('Edit Category ', 'notificationx'),
1351 'fields' => [
1352 'tab_title' => Helper::tab_info_title('performance', 'Performance'),
1353 'tab_description' => Helper::tab_info_desc('performance', "Performance cookies help analyze the website's key performance indicators, which in turn helps improve the user experience for visitors."),
1354 ],
1355 ],
1356 ],
1357 'performance_cookie_lists' => [
1358 'label' => __('', 'notificationx'),
1359 'name' => 'performance_cookie_lists',
1360 'type' => 'better-repeater',
1361 'priority' => 10,
1362 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png',
1363 'button' => [
1364 'label' => __('Add New', 'notificationx'),
1365 'position' => 'top',
1366 ],
1367 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(),
1368 '_fields' => Helper::gdpr_common_fields(),
1369 ]
1370 ],
1371 ],
1372 'advertisement_tab' => [
1373 'label' => __("Advertisement", 'notificationx'),
1374 'type' => 'section',
1375 'name' => 'advertisement_tab',
1376 'id' => 'advertisement_tab',
1377 'icon' => [
1378 'type' => 'tabs',
1379 'name' => 'performance'
1380 ],
1381 'fields' => [
1382 'advertising_tab_info_modal' => [
1383 'name' => 'advertising_tab_info_modal',
1384 'type' => 'modal',
1385 'show_body' => true,
1386 'close_on_body' => true,
1387 'button' => [
1388 'name' => 'tab_info_edit',
1389 'text' => __(' ', 'notificationx'),
1390 'icon' => [
1391 'type' => 'tabs',
1392 'name' => 'edit_modal'
1393 ],
1394 ],
1395 'confirm_button' => [
1396 'type' => 'button',
1397 'text' => 'Save',
1398 'name' => 'advertising_close_tab_info_modal',
1399 "default" => false,
1400 'close_action' => true,
1401 ],
1402 'cancel' => "advertising_close_tab_info_modal",
1403 'body' => [
1404 'header' => __('Edit Category ', 'notificationx'),
1405 'fields' => [
1406 'tab_title' => Helper::tab_info_title('advertising', 'Advertisement'),
1407 'tab_description' => Helper::tab_info_desc('advertising', "Advertisement cookies help analyze the website's key performance indicators, which in turn helps improve the user experience for visitors."),
1408 ],
1409 ],
1410 ],
1411 'advertising_cookie_lists' => [
1412 'label' => __('', 'notificationx'),
1413 'name' => 'advertising_cookie_lists',
1414 'type' => 'better-repeater',
1415 'priority' => 10,
1416 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png',
1417 'button' => [
1418 'label' => __('Add New', 'notificationx'),
1419 'position' => 'top',
1420 ],
1421 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(),
1422 '_fields' => Helper::gdpr_common_fields(),
1423 ]
1424 ],
1425 ],
1426 'uncategorized_tab' => [
1427 'label' => __("Uncategorized", 'notificationx'),
1428 'type' => 'section',
1429 'name' => 'uncategorized_tab',
1430 'id' => 'uncategorized_tab',
1431 'icon' => [
1432 'type' => 'tabs',
1433 'name' => 'uncategorized'
1434 ],
1435 'fields' => [
1436 'uncategorized_tab_info_modal' => [
1437 'name' => 'uncategorized_tab_info_modal',
1438 'type' => 'modal',
1439 'show_body' => true,
1440 'close_on_body' => true,
1441 'button' => [
1442 'name' => 'tab_info_edit',
1443 'text' => __(' ', 'notificationx'),
1444 'icon' => [
1445 'type' => 'tabs',
1446 'name' => 'edit_modal'
1447 ],
1448 ],
1449 'confirm_button' => [
1450 'type' => 'button',
1451 'text' => 'Save',
1452 'name' => 'uncategorized_close_tab_info',
1453 "default" => false,
1454 'close_action' => true,
1455 ],
1456 'cancel' => "uncategorized_close_tab_info",
1457 'body' => [
1458 'header' => __('Edit Category ', 'notificationx'),
1459 'fields' => [
1460 'tab_title' => Helper::tab_info_title('uncategorized', 'Uncategorized'),
1461 'tab_description' => Helper::tab_info_desc('uncategorized', "Uncategorized cookies are those that don't fall into any specific category but may still be used for various purposes on the site. These cookies help us improve user experience by tracking interactions that don't fit into other cookie types."),
1462 ],
1463 ],
1464 ],
1465 'uncategorized_cookie_lists' => [
1466 'label' => __('', 'notificationx'),
1467 'name' => 'uncategorized_cookie_lists',
1468 'type' => 'better-repeater',
1469 'priority' => 10,
1470 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png',
1471 'button' => [
1472 'label' => __('Add New', 'notificationx'),
1473 'position' => 'top',
1474 ],
1475 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(),
1476 '_fields' => Helper::gdpr_common_fields(),
1477 ]
1478 ],
1479 ],
1480 ]
1481 ],
1482 ]
1483 ]
1484 ]),
1485 ],
1486 "display_tab" => [
1487 'label' => __("Display", 'notificationx'),
1488 'id' => "display_tab",
1489 'name' => "display_tab",
1490 'rules' => Rules::is('type', 'gdpr', true),
1491 'icon' => [
1492 'type' => 'tabs',
1493 'name' => 'display'
1494 ],
1495 'classes' => "display_tab",
1496 'fields' => apply_filters('nx_display_fields', [
1497 "main_preview" => [
1498 'label' => __("Preview", 'notificationx'),
1499 'name' => "main_preview",
1500 'type' => "section",
1501 'priority' => 1,
1502 'fields' => [
1503 'preview_field' => [
1504 'name' => "preview_field",
1505 'type' => "preview",
1506 'label' => __('Preview', 'notificationx'),
1507 'priority' => 10,
1508 ],
1509 ],
1510 'rules' => Rules::logicalRule([
1511 Rules::is( 'type', 'notification_bar' ),
1512 ]),
1513 ],
1514 "image-section" => [
1515 'label' => __("IMAGE", 'notificationx'),
1516 'name' => "image-section",
1517 'type' => "section",
1518 // 'condition' => [
1519 // 'type' => '',
1520 // ],
1521 'fields' => [
1522 'show_default_image' => [
1523 'label' => __("Show Default Image", 'notificationx'),
1524 'name' => "show_default_image",
1525 'type' => "checkbox",
1526 'default' => false,
1527 ],
1528 'default_avatar' => [
1529 'label' =>__( "Choose an Image", 'notificationx'),
1530 'name' => "default_avatar",
1531 'type' => "radio-card",
1532 'default' => "verified.svg",
1533 'description' => __('If checked, this will show in notifications.', 'notificationx'),
1534 'rules' => Rules::is( 'show_default_image', true ),
1535 'style' => [
1536 'size' => 'medium'
1537 ],
1538 'options' => array(
1539 array(
1540 'value' => 'verified.svg',
1541 'label' => __('Verified', 'notificationx'),
1542 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/verified.svg',
1543 ),
1544 array(
1545 'value' => 'flames.svg',
1546 'label' => __('Flames', 'notificationx'),
1547 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/flames.svg',
1548 ),
1549 array(
1550 'value' => 'flames.gif',
1551 'label' => __('Flames GIF', 'notificationx'),
1552 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/flames.gif',
1553 ),
1554 array(
1555 'value' => 'pink-face-looped.gif',
1556 'label' => __('Pink Face', 'notificationx'),
1557 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif',
1558 ),
1559 array(
1560 'value' => 'blue-face-non-looped.gif',
1561 'label' => __('Blue Face', 'notificationx'),
1562 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/blue-face-non-looped.gif',
1563 ),
1564 //TODO: none
1565 )
1566 ],
1567 [
1568 'label' => __("Upload an Image", 'notificationx'),
1569 'name' => "image_url",
1570 'button' => __('Upload', 'notificationx'),
1571 'type' => "media",
1572 'default' => "",
1573 'rules' => Rules::is( 'show_default_image', true ),
1574 ],
1575 'show_notification_image' => [
1576 'label' => __("Image", 'notificationx'),
1577 'name' => "show_notification_image",
1578 'type' => "select",
1579 'default' => "none",
1580 'rules' => Rules::includes( 'source', [
1581 "fluentform",
1582 "cf7",
1583 "custom_notification",
1584 "custom_notification_conversions",
1585 "edd",
1586 "envato",
1587 "grvf",
1588 "give",
1589 // "ifttt",
1590 "learndash",
1591 "njf",
1592 "tutor",
1593 "wpf",
1594 "reviewx",
1595 "woocommerce",
1596 "surecart",
1597 "woo_reviews",
1598 "wp_comments",
1599 "wp_reviews",
1600 "zapier",
1601 "mailchimp",
1602 "convertkit",
1603 "freemius_conversions",
1604 "freemius_reviews",
1605 "freemius_stats",
1606 "youtube",
1607 "woocommerce_sales",
1608 'woocommerce_sales_reviews',
1609 ] ),
1610 'options' => apply_filters('nx_show_image_options', array(
1611 'none' => [
1612 'value' => 'none',
1613 'label' => __('None', 'notificationx'),
1614 ],
1615 'featured_image' => [
1616 'value' => 'featured_image',
1617 'label' => __('Featured Image', 'notificationx'),
1618 'rules' => [
1619 'includes',
1620 'source',
1621 [
1622 "cf7",
1623 "custom_notification",
1624 "custom_notification_conversions",
1625 "edd",
1626 "envato",
1627 "grvf",
1628 "give",
1629 // "ifttt",
1630 "learndash",
1631 "njf",
1632 "tutor",
1633 "wpf",
1634 "reviewx",
1635 "woocommerce",
1636 "surecart",
1637 "woo_reviews",
1638 "wp_reviews",
1639 "freemius_conversions",
1640 "freemius_reviews",
1641 "freemius_stats",
1642 "woocommerce_sales",
1643 'woocommerce_sales_reviews',
1644 ]
1645 ],
1646 ],
1647 'gravatar' => [
1648 // @todo move the rules to a filter.
1649 'value' => 'gravatar',
1650 'label' => __('Gravatar', 'notificationx'),
1651 'rules' => [
1652 'includes',
1653 'source',[
1654 "fluentform",
1655 "cf7",
1656 "custom_notification",
1657 "custom_notification_conversions",
1658 "edd",
1659 "grvf",
1660 "give",
1661 // "ifttt",
1662 "learndash",
1663 "njf",
1664 "tutor",
1665 "wpf",
1666 "reviewx",
1667 "woocommerce",
1668 "surecart",
1669 "woo_reviews",
1670 "wp_comments",
1671 "wp_reviews",
1672 "zapier",
1673 "mailchimp",
1674 "convertkit",
1675 "freemius_conversions",
1676 "freemius_reviews",
1677 "freemius_stats",
1678 "woocommerce_sales",
1679 'woocommerce_sales_reviews',
1680 ],
1681 ],
1682 ],
1683 )),
1684 ],
1685 ],
1686 ],
1687 "visibility" => [
1688 'label' => __("Visibility", 'notificationx'),
1689 'name' => "visibility",
1690 'type' => "section",
1691 'fields' => [
1692 "show_on" => [
1693 'label' => __("Show On", 'notificationx'),
1694 'name' => "show_on",
1695 'type' => "select",
1696 'default' => "everywhere",
1697 'priority' => 5,
1698 'options' => apply_filters('nx_show_on_options', $this->normalize_fields([
1699 'everywhere' => __('Show Everywhere', 'notificationx'),
1700 'on_selected' => __('Show On Selected', 'notificationx'),
1701 'hide_on_selected' => __('Hide On Selected', 'notificationx'),
1702 ])),
1703 ],
1704 "all_locations" => [
1705 'label' => __("Locations", 'notificationx'),
1706 'name' => "all_locations",
1707 'type' => "select",
1708 'default' => "",
1709 'multiple' => true,
1710 'priority' => 10,
1711 'rules' => [ 'includes', 'show_on', [
1712 'on_selected',
1713 'hide_on_selected',
1714 ] ],
1715 'options' => $this->normalize_fields(Locations::get_instance()->get_locations()),
1716 ],
1717 "show_on_display" => [
1718 'label' => __("Display For", 'notificationx'),
1719 'name' => "show_on_display",
1720 'type' => "select",
1721 'default' => "always",
1722 'priority' => 15,
1723 'options' => $this->normalize_fields([
1724 'always' => __('Everyone', 'notificationx'),
1725 'logged_out_user' => __('Logged Out User', 'notificationx'),
1726 'logged_in_user' => __('Logged In User', 'notificationx'),
1727 ]),
1728 'help' => sprintf('<a target="_blank" rel="nofollow" href="https://notificationx.com/in/pro-display-control">%s</a>', __('More Control in Pro', 'notificationx')),
1729 ],
1730 ],
1731 ],
1732 ]),
1733 ],
1734 "customize_tab" => [
1735 'label' => __("Customize", 'notificationx'),
1736 'id' => "customize_tab",
1737 'name' => "customize_tab",
1738 'icon' => [
1739 'type' => 'tabs',
1740 'name' => 'customize'
1741 ],
1742 'classes' => "customize_tab",
1743 'fields' => apply_filters('nx_customize_fields', [
1744 "main_preview" => [
1745 'label' => __("Preview", 'notificationx'),
1746 'name' => "main_preview",
1747 'type' => "section",
1748 'priority' => 1,
1749 'fields' => [
1750 'preview_field' => [
1751 'name' => "preview_field",
1752 'type' => "preview",
1753 'label' => __('Preview', 'notificationx'),
1754 'priority' => 10,
1755 ],
1756 ],
1757 'rules' => Rules::logicalRule([
1758 Rules::is( 'type', 'notification_bar' ),
1759 ]),
1760 ],
1761 'appearance' => [
1762 'label' => __("Appearance", 'notificationx'),
1763 'name' => "appearance",
1764 'type' => "section",
1765 'fields' => [
1766 'position' => [
1767 'label' => __("Position", 'notificationx'),
1768 'name' => "position", // combined "pressbar_position" && "conversion_position"
1769 'type' => "select",
1770 'default' => 'bottom_left',
1771 'priority' => 50,
1772 'options' => [
1773 'bottom_left' => [
1774 'label' => __('Bottom Left', 'notificationx'),
1775 'value' => 'bottom_left',
1776 ],
1777 'bottom_right' => [
1778 'label' => __('Bottom Right', 'notificationx'),
1779 'value' => 'bottom_right',
1780 ],
1781 ],
1782 ],
1783 'close_icon_position' => [
1784 'label' => __("Close Icon Position", 'notificationx'),
1785 'name' => "close_icon_position",
1786 'type' => "select",
1787 'default' => 'top_right',
1788 'priority' => 51,
1789 'options' => [
1790 'top_right' => [
1791 'label' => __('Top Right', 'notificationx'),
1792 'value' => 'top_right',
1793 ],
1794 'top_left' => [
1795 'label' => __('Top Left', 'notificationx'),
1796 'value' => 'top_left',
1797 ]
1798 ],
1799 'rules' => Rules::includes('source', ['press_bar']),
1800 ],
1801 'size' => [
1802 'label' => __("Notification Size", 'notificationx'),
1803 'name' => "size",
1804 'type' => "responsive-number",
1805 'default' => [
1806 "desktop" => 500,
1807 "tablet" => 500,
1808 "mobile" => 500,
1809 ],
1810 'priority' => 51,
1811 'min' => 300,
1812 'controls' => [
1813 "desktop" => [
1814 "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/desktop.svg',
1815 'size' => 18,
1816 ],
1817 "tablet" => [
1818 "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/tablet.svg',
1819 'size' => 14,
1820 ],
1821 "mobile" => [
1822 "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/mobile.svg',
1823 'size' => 12,
1824 ],
1825 ],
1826 'help' => __('Set a max width for notification.', 'notificationx'),
1827 ],
1828 'close_button' => [
1829 'label' => __("Display Close Option", 'notificationx'),
1830 'name' => "close_button",
1831 'type' => "checkbox",
1832 'default' => 1,
1833 'priority' => 70,
1834 'description' => __('Display a close button.', 'notificationx'),
1835 ],
1836 'hide_on_mobile' => [
1837 'label' => __("Mobile Visibility", 'notificationx'),
1838 'name' => "hide_on_mobile",
1839 'type' => "checkbox",
1840 'default' => false,
1841 'priority' => 200,
1842 'description' => __('Hide NotificationX on mobile.', 'notificationx'),
1843 ],
1844 ]
1845 ],
1846 'appearance' => [
1847 'label' => __("Appearance", 'notificationx'),
1848 'name' => "appearance",
1849 'type' => "section",
1850 'fields' => [
1851 'position' => [
1852 'label' => __("Position", 'notificationx'),
1853 'name' => "position", // combined "pressbar_position" && "conversion_position"
1854 'type' => "select",
1855 'default' => 'bottom_left',
1856 'priority' => 50,
1857 'options' => [
1858 'bottom_left' => [
1859 'label' => __('Bottom Left', 'notificationx'),
1860 'value' => 'bottom_left',
1861 ],
1862 'bottom_right' => [
1863 'label' => __('Bottom Right', 'notificationx'),
1864 'value' => 'bottom_right',
1865 ],
1866 ],
1867 ],
1868 'size' => [
1869 'label' => __("Notification Size", 'notificationx'),
1870 'name' => "size",
1871 'type' => "responsive-number",
1872 'default' => [
1873 "desktop" => 500,
1874 "tablet" => 500,
1875 "mobile" => 500,
1876 ],
1877 'priority' => 51,
1878 'min' => 300,
1879 'controls' => [
1880 "desktop" => [
1881 "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/desktop.svg',
1882 'size' => 18,
1883 ],
1884 "tablet" => [
1885 "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/tablet.svg',
1886 'size' => 14,
1887 ],
1888 "mobile" => [
1889 "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/mobile.svg',
1890 'size' => 12,
1891 ],
1892 ],
1893 'help' => __('Set a max width for notification.', 'notificationx'),
1894 ],
1895 'close_button_control' => [
1896 'label' => __("Display Close Button", 'notificationx'),
1897 'name' => "close_button_control",
1898 'type' => "section",
1899 'fields' => [
1900 'close_button' => [
1901 'name' => "close_button",
1902 'type' => "checkbox",
1903 'default' => 1,
1904 'priority' => 70,
1905 'description' => __('Desktop', 'notificationx'),
1906 ],
1907 'close_button_tab' => [
1908 'name' => "close_button_tab",
1909 'type' => "checkbox",
1910 'default' => 1,
1911 'priority' => 71,
1912 'description' => __('Tablet', 'notificationx'),
1913 ],
1914 'close_button_mobile' => [
1915 'name' => "close_button_mobile",
1916 'type' => "checkbox",
1917 'default' => 1,
1918 'priority' => 72,
1919 'description' => __('Mobile', 'notificationx'),
1920 ],
1921 ]
1922 ],
1923 'nx_visibility_control' => [
1924 'label' => __("Notification Visibility", 'notificationx'),
1925 'name' => "close_button_control",
1926 'type' => "section",
1927 'fields' => [
1928 'hide_on_desktop' => [
1929 'name' => "hide_on_desktop",
1930 'type' => "checkbox",
1931 'default' => true,
1932 'priority' => 201,
1933 'description' => __('Desktop', 'notificationx'),
1934 ],
1935 'hide_on_tab' => [
1936 'name' => "hide_on_tab",
1937 'type' => "checkbox",
1938 'default' => true,
1939 'priority' => 202,
1940 'description' => __('Tablet', 'notificationx'),
1941 ],
1942 'hide_on_mobile' => [
1943 'name' => "hide_on_mobile",
1944 'type' => "checkbox",
1945 'default' => true,
1946 'priority' => 205,
1947 'description' => __('Mobile', 'notificationx'),
1948 ],
1949 ]
1950 ],
1951 'notification_reappearance' => array(
1952 'label' => __( 'Notification Reappearance', 'notificationx' ),
1953 'type' => 'select',
1954 'name' => 'notification_reappearance',
1955 'default' => 'show_notification_next_visit',
1956 'rules' => Rules::logicalRule([
1957 Rules::is('source', 'press_bar', true),
1958 ]),
1959 'options' => GlobalFields::get_instance()->normalize_fields([
1960 'dont_show_notification' => __( "Don't show the Notification again for the user", 'notificationx' ),
1961 'show_notification_next_visit' => __( 'Show the Notification again when the user visits the website next time', 'notificationx' ),
1962 'show_notification_every_page' => __( 'Show the Notification when the user refreshes/goes to another page', 'notificationx' ),
1963 ]),
1964 ),
1965 'cache_duration_for_dont_show' => [
1966 'label' => __( 'Cache Duration for "Don\'t show again"', 'notificationx' ),
1967 'name' => 'cache_duration_for_dont_show',
1968 'type' => 'number',
1969 'default' => 10,
1970 'min' => 1,
1971 'max' => 365,
1972 'step' => 1,
1973 'description' => __('Days', 'notificationx'),
1974 'rules' => Rules::logicalRule([
1975 Rules::is('notification_reappearance', 'dont_show_notification'),
1976 ]),
1977 ],
1978 ]
1979 ],
1980 'animation' => [
1981 'label' => __("Animation", 'notificationx'),
1982 'name' => "animation",
1983 'type' => "section",
1984 'priority'=> 15,
1985 'fields' => [
1986 'animation_notification_show' => [
1987 'label' => __("Notification Show", 'notificationx'),
1988 'name' => "animation_notification_show",
1989 'type' => "select",
1990 'default' => 'default',
1991 'classes' => NotificationX::is_pro() ? '' : 'animation-pro-disabled',
1992 'priority' => 5,
1993 'info' => InfoTooltipManager::get_instance()->render('animation'),
1994 'options' => [
1995 'default' => [
1996 'label' => __('Default', 'notificationx'),
1997 'value' => 'default',
1998 'selected' => 'selected',
1999 ],
2000 'animate__fadeIn' => [
2001 'label' => __('Fade In', 'notificationx'),
2002 'value' => 'animate__fadeIn',
2003 'disabled' => NotificationX::is_pro() ? false : true,
2004 ],
2005 'animate__fadeInUp' => [
2006 'label' => __('Fade In Up', 'notificationx'),
2007 'value' => 'animate__fadeInUp',
2008 'disabled' => NotificationX::is_pro() ? false : true,
2009 ],
2010 'animate__fadeInDown' => [
2011 'label' => __('Fade In Down', 'notificationx'),
2012 'value' => 'animate__fadeInDown',
2013 'disabled' => NotificationX::is_pro() ? false : true,
2014 ],
2015 'animate__fadeInDownBig' => [
2016 'label' => __('Fade In Down Big', 'notificationx'),
2017 'value' => 'animate__fadeInDownBig',
2018 'disabled' => NotificationX::is_pro() ? false : true,
2019 ],
2020 'animate__fadeInLeft' => [
2021 'label' => __('Fade In Left', 'notificationx'),
2022 'value' => 'animate__fadeInLeft',
2023 'disabled' => NotificationX::is_pro() ? false : true,
2024 ],
2025 'animate__fadeInRight' => [
2026 'label' => __('Fade In Right', 'notificationx'),
2027 'value' => 'animate__fadeInRight',
2028 'disabled' => NotificationX::is_pro() ? false : true,
2029 ],
2030 'animate__lightSpeedInLeft' => [
2031 'label' => __('Light Speed In Left', 'notificationx'),
2032 'value' => 'animate__lightSpeedInLeft',
2033 'disabled' => NotificationX::is_pro() ? false : true,
2034 ],
2035 'animate__lightSpeedInRight' => [
2036 'label' => __('Light Speed In Right', 'notificationx'),
2037 'value' => 'animate__lightSpeedInRight',
2038 'disabled' => NotificationX::is_pro() ? false : true,
2039 ],
2040 'animate__zoomIn' => [
2041 'label' => __('Zoom In', 'notificationx'),
2042 'value' => 'animate__zoomIn',
2043 'disabled' => NotificationX::is_pro() ? false : true,
2044 ],
2045 'animate__slideInUp' => [
2046 'label' => __('Slide In Up', 'notificationx'),
2047 'value' => 'animate__slideInUp',
2048 'disabled' => NotificationX::is_pro() ? false : true,
2049 ],
2050 'animate__slideInLeft' => [
2051 'label' => __('Slide In Left', 'notificationx'),
2052 'value' => 'animate__slideInLeft',
2053 'disabled' => NotificationX::is_pro() ? false : true,
2054 ],
2055 'animate__slideInRight' => [
2056 'label' => __('Slide In Right', 'notificationx'),
2057 'value' => 'animate__slideInRight',
2058 'disabled' => NotificationX::is_pro() ? false : true,
2059 ],
2060 'animate__slideInDown' => [
2061 'label' => __('Slide In Down', 'notificationx'),
2062 'value' => 'animate__slideInDown',
2063 'disabled' => NotificationX::is_pro() ? false : true,
2064 ],
2065 ],
2066 ],
2067 'animation_notification_hide' => [
2068 'label' => __("Notification Hide", 'notificationx'),
2069 'name' => "animation_notification_hide",
2070 'type' => "select",
2071 'default' => 'default',
2072 'classes' => NotificationX::is_pro() ? '' : 'animation-pro-disabled',
2073 'priority' => 10,
2074 'info' => InfoTooltipManager::get_instance()->render('animation'),
2075 'options' => [
2076 'default' => [
2077 'label' => __('Default', 'notificationx'),
2078 'value' => 'default',
2079 ],
2080 'animate__fadeOut' => [
2081 'label' => __('Fade Out', 'notificationx'),
2082 'value' => 'animate__fadeOut',
2083 'disabled' => NotificationX::is_pro() ? false : true,
2084 ],
2085 'animate__fadeOutDown' => [
2086 'label' => __('Fade Out Down', 'notificationx'),
2087 'value' => 'animate__fadeOutDown',
2088 'disabled' => NotificationX::is_pro() ? false : true,
2089 ],
2090 'animate__fadeOutRight' => [
2091 'label' => __('Fade Out Right', 'notificationx'),
2092 'value' => 'animate__fadeOutRight',
2093 'disabled' => NotificationX::is_pro() ? false : true,
2094 ],
2095 'animate__fadeOutUp' => [
2096 'label' => __('Fade Out Up', 'notificationx'),
2097 'value' => 'animate__fadeOutUp',
2098 'disabled' => NotificationX::is_pro() ? false : true,
2099 ],
2100 'animate__lightSpeedOutLeft' => [
2101 'label' => __('Light Speed Out Left', 'notificationx'),
2102 'value' => 'animate__lightSpeedOutLeft',
2103 'disabled' => NotificationX::is_pro() ? false : true,
2104 ],
2105 'animate__zoomOut' => [
2106 'label' => __('Zoom Out', 'notificationx'),
2107 'value' => 'animate__zoomOut',
2108 'disabled' => NotificationX::is_pro() ? false : true,
2109 ],
2110 'animate__slideOutDown' => [
2111 'label' => __('Slide Out Down', 'notificationx'),
2112 'value' => 'animate__slideOutDown',
2113 'disabled' => NotificationX::is_pro() ? false : true,
2114 ],
2115 'animate__slideOutLeft' => [
2116 'label' => __('Slide Out Left', 'notificationx'),
2117 'value' => 'animate__slideOutLeft',
2118 'disabled' => NotificationX::is_pro() ? false : true,
2119 ],
2120 'animate__slideOutRight' => [
2121 'label' => __('Slide Out Right', 'notificationx'),
2122 'value' => 'animate__slideOutRight',
2123 'disabled' => NotificationX::is_pro() ? false : true,
2124 ],
2125 'animate__slideOutUp' => [
2126 'label' => __('Slide Out Up', 'notificationx'),
2127 'value' => 'animate__slideOutUp',
2128 'disabled' => NotificationX::is_pro() ? false : true,
2129 ],
2130 ],
2131 ],
2132 // 'animation_notification_duration' => [
2133 // 'label' => __("Duration", 'notificationx'),
2134 // 'name' => "animation_notification_duration",
2135 // 'type' => "select",
2136 // 'default' => 'default',
2137 // 'priority' => 15,
2138 // 'options' => [
2139 // 'default' => [
2140 // 'label' => __('Default', 'notificationx'),
2141 // 'value' => 'default',
2142 // ],
2143 // 'animate__faster' => [
2144 // 'label' => __('Faster', 'notificationx'),
2145 // 'value' => 'animate__faster',
2146 // 'disabled' => NotificationX::is_pro() ? false : true,
2147 // ],
2148 // 'animate__fast' => [
2149 // 'label' => __('Fast', 'notificationx'),
2150 // 'value' => 'animate__fast',
2151 // 'disabled' => NotificationX::is_pro() ? false : true,
2152 // ],
2153 // ],
2154 // ],
2155 ]
2156 ],
2157 'queue_management' => [
2158 'label' => __("Queue Management", 'notificationx'),
2159 'name' => "queue_management",
2160 'type' => "section",
2161 'priority' => 150,
2162 // @todo is_pro
2163 'is_pro' => true,
2164 'fields' => [
2165 [
2166 'label' => __("Enable Global Queue", 'notificationx'),
2167 'name' => "global_queue",
2168 'type' => "checkbox",
2169 'priority' => 0,
2170 'default' => false,
2171 'is_pro' => true,
2172 'info' => InfoTooltipManager::get_instance()->render('global_queue_management'),
2173 'description' => sprintf('%s <a href="%s" target="_blank">%s</a>', __('Activate global queue system for this notification.', 'notificationx'), 'https://notificationx.com/docs/centralized-queue', __('Check out this doc.', 'notificationx')),
2174 ],
2175 ]
2176 ],
2177 'timing' => [
2178 'label' => __("Timing", 'notificationx'),
2179 'name' => "timing",
2180 'type' => "section",
2181 'priority' => 200,
2182 // 'rules' => Rules::is( 'global_queue', false ),
2183 'rules' => Rules::is( 'global_queue', true, true ),
2184 'fields' => [
2185 'delay_before' => [
2186 'label' => __("Delay Before First Notification", 'notificationx'),
2187 'name' => "delay_before",
2188 'type' => "number",
2189 'priority' => 40,
2190 'default' => defined('NX_DEBUG') && NX_DEBUG ? 1 : 5,
2191 'help' => __('Initial Delay', 'notificationx'),
2192 'description' => __('seconds', 'notificationx'),
2193
2194 ],
2195 'display_for' => [
2196 'name' => "display_for",
2197 'type' => "number",
2198 'label' => __("Display For", 'notificationx'),
2199 'description' => __('seconds', 'notificationx'),
2200 'help' => __('Display each notification for * seconds', 'notificationx'),
2201 'priority' => 60,
2202 'default' => defined('NX_DEBUG') && NX_DEBUG ? 2 : 5,
2203 ],
2204 'delay_between' => [
2205 'name' => "delay_between",
2206 'type' => "number",
2207 'label' => __("Delay Between", 'notificationx'),
2208 'description' => __('seconds', 'notificationx'),
2209 'help' => __('Delay between each notification', 'notificationx'),
2210 'priority' => 70,
2211 'default' => defined('NX_DEBUG') && NX_DEBUG ? 1 : 5,
2212 ],
2213 ]
2214 ],
2215 'behaviour' => [
2216 'label' => __("Behavior", 'notificationx'),
2217 'name' => "behaviour",
2218 'type' => "section",
2219 'priority' => 300,
2220 'collapsable' => true,
2221 'fields' => [
2222 "display_last" => [
2223 'name' => "display_last",
2224 'type' => 'number',
2225 'label' => __('Display The Last', 'notificationx'),
2226 'description' => 'conversions',
2227 'default' => 20,
2228 'priority' => 40,
2229 'max' => 20,
2230 ],
2231 'display_from' => [
2232 'name' => 'display_from',
2233 'type' => 'number',
2234 'label' => __('Display From The Last', 'notificationx'),
2235 'priority' => 45,
2236 'default' => 30,
2237 'description' => 'Days',
2238 'min' => 0,
2239 ],
2240 'hour_minutes_section' => [
2241 'name' => "hour_minutes_section",
2242 'type' => "section",
2243 'rules' => Rules::logicalRule([
2244 Rules::includes('source', ['woocommerce', 'woocommerce_sales', 'woocommerce_sales_reviews', 'custom_notification_conversions', 'surecart', 'edd', 'tutor', 'learndash', 'learnpress', 'cf7', 'wp_comments', 'njf', 'wpf', 'fluentform', 'elementor_form', 'custom_notification', 'grvf', 'mailchimp', 'convertkit', 'ActiveCampaign', 'zapier_email_subscription', 'give', 'woo_reviews', 'freemius_conversions', 'freemius_reviews', 'zapier_conversions', 'zapier_reviews']),
2245 ]),
2246 'fields' => [
2247 [
2248 'help' => __('Hours', 'notificationx'),
2249 'name' => "display_from_hour",
2250 'type' => "number",
2251 'default' => '0',
2252 'description' => '',
2253 'max' => 23,
2254 'min' => 0,
2255 ],
2256 [
2257 'help' => __('Minutes', 'notificationx'),
2258 'name' => "display_from_minute",
2259 'type' => "number",
2260 'default' => '0',
2261 'description' => '',
2262 'max' => 59,
2263 'min' => 0,
2264 ],
2265 ]
2266 ],
2267 'loop' => [
2268 'name' => 'loop',
2269 'type' => 'checkbox',
2270 'label' => __('Loop Notification', 'notificationx'),
2271 'priority' => 50,
2272 'default' => true,
2273 'rules' => Rules::is( 'global_queue', true, true ),
2274 ],
2275 'link_open' => [
2276 'name' => 'link_open',
2277 'type' => 'checkbox',
2278 'label' => __('Open Link In New Tab', 'notificationx'),
2279 'priority' => 60,
2280 'default' => false,
2281 ],
2282 ]
2283 ],
2284 ]),
2285 ],
2286 ],
2287 'instructions' => apply_filters( 'nx_instructions', [] ),
2288 'pro_popup' => apply_filters( 'nx_popup_alert', [] ),
2289 ];
2290
2291 $tabs['tabs'] = apply_filters('nx_metabox_tabs', $tabs['tabs']);
2292 $tabs = apply_filters('nx_metabox_config', $tabs);
2293
2294 if(defined('NX_DEBUG') && NX_DEBUG){
2295 do_action( 'qm/stop', __METHOD__ );
2296 }
2297 return $tabs;
2298 }
2299
2300
2301 public function normalize_fields($fields, $key = '', $value = [], $return = []) {
2302 foreach ($fields as $val => $label) {
2303 $val = !empty( $label['value'] ) ? $label['value'] : $val;
2304 if (empty($return[$val]) && !is_array($label)) {
2305 $return[$val] = [
2306 'value' => $val,
2307 'label' => $label,
2308 ];
2309 }
2310 elseif (empty($return[$val])){
2311 $return[$val] = $label;
2312 }
2313 if(!empty($key)){
2314 $return[$val] = Rules::includes($key, $value, false, $return[$val]);
2315 }
2316 }
2317
2318 return $return;
2319 }
2320
2321 public function common_name_fields($display_name = false) {
2322 $fields = [
2323 'tag_name' => __('Full Name', 'notificationx'),
2324 'tag_first_name' => __('First Name', 'notificationx'),
2325 'tag_last_name' => __('Last Name', 'notificationx'),
2326 ];
2327 if ($display_name)
2328 $fields['tag_display_name'] = __('Display Name', 'notificationx');
2329 return $fields;
2330 }
2331
2332 public function common_time_fields() {
2333 return [
2334 'tag_time' => __('Definite Time', 'notificationx'),
2335 'tag_custom' => __('Some time ago', 'notificationx'),
2336 ];
2337 }
2338
2339 }
2340