@useinsider/guido 3.21.2-beta.cfc5be2 → 3.21.2-beta.eea8885

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +39 -41
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +79 -81
  5. package/dist/composables/useBlocksConfig.js +24 -32
  6. package/dist/enums/academy.js +0 -1
  7. package/dist/guido.css +1 -1
  8. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  9. package/dist/node_modules/valibot/dist/index.js +261 -297
  10. package/dist/src/@types/config/schemas.d.ts +0 -4
  11. package/dist/src/composables/useConfig.d.ts +0 -2
  12. package/dist/src/enums/academy.d.ts +0 -1
  13. package/dist/src/stores/config.d.ts +0 -166
  14. package/dist/stores/config.js +6 -13
  15. package/dist/utils/pairProductVariables.js +98 -91
  16. package/package.json +1 -1
  17. package/dist/@types/display-condition.js +0 -25
  18. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  19. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  20. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  21. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  22. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  23. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  24. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  25. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  26. package/dist/composables/useDisplayConditions.js +0 -102
  27. package/dist/enums/display-condition.js +0 -12
  28. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  29. package/dist/extensions/DisplayConditions/constants.js +0 -17
  30. package/dist/extensions/DisplayConditions/control.js +0 -178
  31. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  32. package/dist/extensions/DisplayConditions/extension.js +0 -28
  33. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  34. package/dist/extensions/DisplayConditions/library.js +0 -27
  35. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  36. package/dist/services/displayConditionApi.js +0 -39
  37. package/dist/src/@types/display-condition.d.ts +0 -59
  38. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  39. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  40. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  41. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  42. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  43. package/dist/src/enums/display-condition.d.ts +0 -15
  44. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  45. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  46. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  47. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  48. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  49. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  50. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  51. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  52. package/dist/src/services/displayConditionApi.d.ts +0 -8
  53. package/dist/src/stores/display-condition.d.ts +0 -81
  54. package/dist/src/utils/displayCondition.d.ts +0 -10
  55. package/dist/src/utils/protectTableText.d.ts +0 -2
  56. package/dist/stores/display-condition.js +0 -28
  57. package/dist/utils/displayCondition.js +0 -26
  58. package/dist/utils/protectTableText.js +0 -22
@@ -384,8 +384,6 @@ export declare const UISchema: v.ObjectSchema<{
384
384
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
385
385
  /** Custom label for back button (if shown) */
386
386
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
387
- /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
388
- readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
389
387
  }, undefined>;
390
388
  /**
391
389
  * Features configuration - enable/disable editor features
@@ -806,8 +804,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
806
804
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
807
805
  /** Custom label for back button (if shown) */
808
806
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
809
- /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
810
- readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
811
807
  }, undefined>, {}>;
812
808
  /** Feature toggles */
813
809
  readonly features: v.OptionalSchema<v.ObjectSchema<{
@@ -89,7 +89,6 @@ export declare const useConfig: () => {
89
89
  ui: {
90
90
  showHeader: boolean;
91
91
  backButtonLabel?: string | undefined;
92
- externalDisplayConditions: boolean;
93
92
  };
94
93
  features: {
95
94
  dynamicContent: boolean;
@@ -229,7 +228,6 @@ export declare const useConfig: () => {
229
228
  ui: import("vue").ComputedRef<{
230
229
  showHeader: boolean;
231
230
  backButtonLabel?: string | undefined;
232
- externalDisplayConditions: boolean;
233
231
  } | null>;
234
232
  features: import("vue").ComputedRef<{
235
233
  dynamicContent: boolean;
@@ -8,7 +8,6 @@ export declare const ACADEMY_LINKS: {
8
8
  readonly EMAIL_EDITOR: "https://academy.insiderone.com/docs/email-drag-and-drop-editor";
9
9
  readonly GLOBAL_UNSUBSCRIBE: "https://academy.insiderone.com/docs/global-unsubscribe-preference-center";
10
10
  readonly AMP_FOR_EMAILS: "https://academy.insiderone.com/docs/amp-for-emails";
11
- readonly EMAIL_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
12
11
  readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
13
12
  };
14
13
  export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
@@ -94,7 +94,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
94
94
  ui: {
95
95
  showHeader: boolean;
96
96
  backButtonLabel?: string | undefined;
97
- externalDisplayConditions: boolean;
98
97
  };
99
98
  features: {
100
99
  dynamicContent: boolean;
@@ -240,7 +239,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
240
239
  ui: {
241
240
  showHeader: boolean;
242
241
  backButtonLabel?: string | undefined;
243
- externalDisplayConditions: boolean;
244
242
  };
245
243
  features: {
246
244
  dynamicContent: boolean;
@@ -386,7 +384,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
386
384
  ui: {
387
385
  showHeader: boolean;
388
386
  backButtonLabel?: string | undefined;
389
- externalDisplayConditions: boolean;
390
387
  };
391
388
  features: {
392
389
  dynamicContent: boolean;
@@ -532,7 +529,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
532
529
  ui: {
533
530
  showHeader: boolean;
534
531
  backButtonLabel?: string | undefined;
535
- externalDisplayConditions: boolean;
536
532
  };
537
533
  features: {
538
534
  dynamicContent: boolean;
@@ -678,7 +674,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
678
674
  ui: {
679
675
  showHeader: boolean;
680
676
  backButtonLabel?: string | undefined;
681
- externalDisplayConditions: boolean;
682
677
  };
683
678
  features: {
684
679
  dynamicContent: boolean;
@@ -824,7 +819,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
824
819
  ui: {
825
820
  showHeader: boolean;
826
821
  backButtonLabel?: string | undefined;
827
- externalDisplayConditions: boolean;
828
822
  };
829
823
  features: {
830
824
  dynamicContent: boolean;
@@ -970,7 +964,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
970
964
  ui: {
971
965
  showHeader: boolean;
972
966
  backButtonLabel?: string | undefined;
973
- externalDisplayConditions: boolean;
974
967
  };
975
968
  features: {
976
969
  dynamicContent: boolean;
@@ -1116,7 +1109,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1116
1109
  ui: {
1117
1110
  showHeader: boolean;
1118
1111
  backButtonLabel?: string | undefined;
1119
- externalDisplayConditions: boolean;
1120
1112
  };
1121
1113
  features: {
1122
1114
  dynamicContent: boolean;
@@ -1262,7 +1254,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1262
1254
  ui: {
1263
1255
  showHeader: boolean;
1264
1256
  backButtonLabel?: string | undefined;
1265
- externalDisplayConditions: boolean;
1266
1257
  };
1267
1258
  features: {
1268
1259
  dynamicContent: boolean;
@@ -1408,7 +1399,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1408
1399
  ui: {
1409
1400
  showHeader: boolean;
1410
1401
  backButtonLabel?: string | undefined;
1411
- externalDisplayConditions: boolean;
1412
1402
  };
1413
1403
  features: {
1414
1404
  dynamicContent: boolean;
@@ -1554,7 +1544,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1554
1544
  ui: {
1555
1545
  showHeader: boolean;
1556
1546
  backButtonLabel?: string | undefined;
1557
- externalDisplayConditions: boolean;
1558
1547
  };
1559
1548
  features: {
1560
1549
  dynamicContent: boolean;
@@ -1700,7 +1689,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1700
1689
  ui: {
1701
1690
  showHeader: boolean;
1702
1691
  backButtonLabel?: string | undefined;
1703
- externalDisplayConditions: boolean;
1704
1692
  };
1705
1693
  features: {
1706
1694
  dynamicContent: boolean;
@@ -1846,7 +1834,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1846
1834
  ui: {
1847
1835
  showHeader: boolean;
1848
1836
  backButtonLabel?: string | undefined;
1849
- externalDisplayConditions: boolean;
1850
1837
  };
1851
1838
  features: {
1852
1839
  dynamicContent: boolean;
@@ -1992,7 +1979,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1992
1979
  ui: {
1993
1980
  showHeader: boolean;
1994
1981
  backButtonLabel?: string | undefined;
1995
- externalDisplayConditions: boolean;
1996
1982
  };
1997
1983
  features: {
1998
1984
  dynamicContent: boolean;
@@ -2138,7 +2124,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2138
2124
  ui: {
2139
2125
  showHeader: boolean;
2140
2126
  backButtonLabel?: string | undefined;
2141
- externalDisplayConditions: boolean;
2142
2127
  };
2143
2128
  features: {
2144
2129
  dynamicContent: boolean;
@@ -2284,7 +2269,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2284
2269
  ui: {
2285
2270
  showHeader: boolean;
2286
2271
  backButtonLabel?: string | undefined;
2287
- externalDisplayConditions: boolean;
2288
2272
  };
2289
2273
  features: {
2290
2274
  dynamicContent: boolean;
@@ -2430,7 +2414,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2430
2414
  ui: {
2431
2415
  showHeader: boolean;
2432
2416
  backButtonLabel?: string | undefined;
2433
- externalDisplayConditions: boolean;
2434
2417
  };
2435
2418
  features: {
2436
2419
  dynamicContent: boolean;
@@ -2588,7 +2571,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2588
2571
  ui: {
2589
2572
  showHeader: boolean;
2590
2573
  backButtonLabel?: string | undefined;
2591
- externalDisplayConditions: boolean;
2592
2574
  };
2593
2575
  features: {
2594
2576
  dynamicContent: boolean;
@@ -2734,153 +2716,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2734
2716
  ui: {
2735
2717
  showHeader: boolean;
2736
2718
  backButtonLabel?: string | undefined;
2737
- externalDisplayConditions: boolean;
2738
- };
2739
- features: {
2740
- dynamicContent: boolean;
2741
- saveAsTemplate: boolean;
2742
- versionHistory: boolean;
2743
- testMessage: boolean;
2744
- displayConditions: boolean;
2745
- unsubscribe: boolean;
2746
- modulesDisabled: boolean;
2747
- liquidSyntax: boolean;
2748
- autosave: boolean;
2749
- allowlistEnabled: boolean;
2750
- linkTrackingIds: boolean;
2751
- allowSaveWithErrors: boolean;
2752
- reusableRecommendationStrategy: boolean;
2753
- };
2754
- blocks: {
2755
- excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
2756
- includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
2757
- };
2758
- compiler: {
2759
- customRules: ({
2760
- type: "replace";
2761
- search: string;
2762
- replacement: string;
2763
- replaceAll?: boolean | undefined;
2764
- id: string;
2765
- description?: string | undefined;
2766
- priority: number;
2767
- } | {
2768
- type: "regex";
2769
- pattern: string;
2770
- replacement: string;
2771
- flags?: string | undefined;
2772
- id: string;
2773
- description?: string | undefined;
2774
- priority: number;
2775
- } | {
2776
- type: "remove";
2777
- targets: string[];
2778
- id: string;
2779
- description?: string | undefined;
2780
- priority: number;
2781
- } | {
2782
- type: "custom";
2783
- processor: (html: string) => string;
2784
- id: string;
2785
- description?: string | undefined;
2786
- priority: number;
2787
- })[];
2788
- ignoreDefaultRules: boolean;
2789
- };
2790
- callbacks: {
2791
- externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
2792
- };
2793
- } | null;
2794
- } & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => boolean;
2795
- /**
2796
- * Check if the Insider display-condition UI replaces Stripo's
2797
- */
2798
- externalDisplayConditions: (state: {
2799
- initialized: boolean;
2800
- config: {
2801
- identity: {
2802
- templateId: string;
2803
- userId: string;
2804
- variationId?: string | undefined;
2805
- campaignId?: string | undefined;
2806
- templateLibraryId?: string | undefined;
2807
- };
2808
- partner: {
2809
- name: string;
2810
- productType: 60 | 49 | 97;
2811
- messageType: 1 | 2;
2812
- username: string;
2813
- fallbackFont?: {
2814
- name: string;
2815
- family: string;
2816
- } | undefined;
2817
- };
2818
- template: {
2819
- html: string;
2820
- css: string;
2821
- preselectedDynamicContent: {
2822
- text: string;
2823
- value: string;
2824
- fallback?: string | undefined;
2825
- format?: {
2826
- key: string;
2827
- value: string;
2828
- } | undefined;
2829
- }[];
2830
- dynamicContentList: {
2831
- [x: string]: import("../library").DynamicContentNode[];
2832
- };
2833
- customFieldAttributes: string[];
2834
- selectedUnsubscribePages: number[];
2835
- forceRecreate: boolean;
2836
- trackIdCounter: number;
2837
- recommendationCampaignUrls?: Record<string, unknown> | undefined;
2838
- migration: {
2839
- recommendationConfigs: {
2840
- [x: string]: {
2841
- id?: number | undefined;
2842
- decimalCount?: string | number | undefined;
2843
- productIds?: unknown[] | undefined;
2844
- sendProductRequestFlag?: boolean | undefined;
2845
- shuffleProducts?: boolean | undefined;
2846
- filters?: unknown[] | undefined;
2847
- currency?: string | undefined;
2848
- currencySettings?: unknown;
2849
- language?: string | undefined;
2850
- strategy?: string | undefined;
2851
- recommendedProducts?: unknown[] | undefined;
2852
- cardsInRow?: number | undefined;
2853
- mobileRightPadding?: number | undefined;
2854
- mobileLeftPadding?: number | undefined;
2855
- unresponsive?: boolean | undefined;
2856
- orientation?: string | undefined;
2857
- textTrimming?: boolean | undefined;
2858
- blockType?: string | undefined;
2859
- size?: string | number | undefined;
2860
- verticalResponsiveness?: boolean | undefined;
2861
- isPriceMovedToNextLine?: boolean | undefined;
2862
- isPriceDeletedForZeroSale?: boolean | undefined;
2863
- } & {
2864
- [key: string]: unknown;
2865
- };
2866
- };
2867
- };
2868
- };
2869
- editor: {
2870
- locale: string;
2871
- translationsPath: string;
2872
- migrationDate: number;
2873
- emailHeader: {
2874
- senderName: string;
2875
- subject: string;
2876
- };
2877
- savedModulesFolderName: string;
2878
- defaultModulesFolderName: string;
2879
- };
2880
- ui: {
2881
- showHeader: boolean;
2882
- backButtonLabel?: string | undefined;
2883
- externalDisplayConditions: boolean;
2884
2719
  };
2885
2720
  features: {
2886
2721
  dynamicContent: boolean;
@@ -3028,7 +2863,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
3028
2863
  ui: {
3029
2864
  showHeader: boolean;
3030
2865
  backButtonLabel?: string | undefined;
3031
- externalDisplayConditions: boolean;
3032
2866
  };
3033
2867
  features: {
3034
2868
  dynamicContent: boolean;
@@ -1,8 +1,8 @@
1
- import { MessageType as a } from "../@types/config/schemas.js";
1
+ import { MessageType as r } from "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
- import { parseConfig as o } from "../@types/config/validator.js";
4
- import { defineStore as l } from "pinia";
5
- const g = l("guido-config", {
3
+ import { parseConfig as a } from "../@types/config/validator.js";
4
+ import { defineStore as o } from "pinia";
5
+ const g = o("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -132,7 +132,7 @@ const g = l("guido-config", {
132
132
  * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
133
133
  */
134
134
  isTransactional() {
135
- return this.messageType === a.TRANSACTIONAL;
135
+ return this.messageType === r.TRANSACTIONAL;
136
136
  },
137
137
  /**
138
138
  * Soft-save policy: may the editor persist a template with validation errors?
@@ -158,13 +158,6 @@ const g = l("guido-config", {
158
158
  var e, t;
159
159
  return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
160
160
  },
161
- /**
162
- * Check if the Insider display-condition UI replaces Stripo's
163
- */
164
- externalDisplayConditions: (i) => {
165
- var e, t, n, r;
166
- return (((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.externalDisplayConditions) ?? !1) && (((r = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : r.displayConditions) ?? !0);
167
- },
168
161
  /**
169
162
  * Check if a specific feature is enabled.
170
163
  * Returns false before init (config null) so header controls don't
@@ -181,7 +174,7 @@ const g = l("guido-config", {
181
174
  * Initialize the config store with validated configuration
182
175
  */
183
176
  init(i) {
184
- const e = o(i);
177
+ const e = a(i);
185
178
  this.config = e, this.initialized = !0;
186
179
  },
187
180
  /**
@@ -1,101 +1,108 @@
1
- import { ITEMS_CURRENCY_ATTR as N, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
- import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
- import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
- import { protectTableText as v, restoreTableText as B } from "./protectTableText.js";
6
- import { unwrapProductNameLinks as j } from "./unwrapProductNameLink.js";
7
- const O = {
1
+ import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { productPairs as M } from "../extensions/Blocks/Items/enums/productEnums.js";
3
+ import { escapeReplacement as B } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
+ import { preserveTextStyles as L } from "./preserveTextStyles.js";
5
+ import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
+ const q = {
8
7
  CART_ITEMS: "ins_apr",
9
8
  BROWSED_ITEMS: "browsed_item",
10
9
  PURCHASED_ITEMS: "purchased_item"
11
- }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
12
- function Q(S, y, b) {
13
- let h = y;
14
- for (; h > 0 && /\s/.test(S[h - 1]); )
15
- h -= 1;
16
- return b.some((I) => S.endsWith(I, h));
10
+ }, W = ($) => $.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function v($, C, A) {
12
+ let d = C;
13
+ for (; d > 0 && /\s/.test($[d - 1]); )
14
+ d -= 1;
15
+ return A.some((E) => $.endsWith(E, d));
17
16
  }
18
- function rt(S) {
19
- const y = q(v(S)), b = new DOMParser().parseFromString(y, "text/html");
20
- j(b);
21
- const h = w.PAIRS_FOR_EXTENSION;
22
- Object.entries(h).forEach(([n, d]) => {
23
- b.querySelectorAll(".ins-product-td").forEach((r) => {
24
- const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
25
- r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
26
- var $, F, x, D;
27
- const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
17
+ const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
18
+ function Q($, C) {
19
+ var d;
20
+ const A = $.ownerDocument.createTreeWalker($, NodeFilter.SHOW_COMMENT);
21
+ for (let E = A.nextNode(); E; E = A.nextNode())
22
+ (d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(j, (k, P) => `${P}href="${C}"`));
23
+ }
24
+ function et($) {
25
+ const C = W($), A = new DOMParser().parseFromString(C, "text/html");
26
+ X(A);
27
+ const d = M.PAIRS_FOR_EXTENSION;
28
+ Object.entries(d).forEach(([o, p]) => {
29
+ A.querySelectorAll(".ins-product-td").forEach((r) => {
30
+ const _ = r.getAttribute("data-number") || "1", y = r.getAttribute("data-type") || "CART_ITEMS";
31
+ r.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
32
+ var S, I, O, x;
33
+ const m = t.getAttribute("data-type") || y, n = t.getAttribute("data-number") || _, f = p[m];
28
34
  if (f)
29
- switch (n) {
35
+ switch (o) {
30
36
  case "imageSrc": {
31
- let e = null, a = null;
32
- if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
37
+ let e = null, s = null;
38
+ if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
33
39
  break;
34
40
  const l = f.DEFAULT, c = f.ATTR;
35
41
  if (l && e.src) {
36
- const s = e.src;
37
- l.some((R) => {
38
- const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
39
- return s.includes(R) || s.includes(u) || H === u;
40
- }) && (e.src = `{{${c}_${o}}}`);
42
+ const a = e.src;
43
+ l.some((g) => {
44
+ const u = g.split("/").pop() || "", H = a.split("/").pop() || "";
45
+ return a.includes(g) || a.includes(u) || H === u;
46
+ }) && (e.src = `{{${c}_${n}}}`);
41
47
  }
42
- const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
43
- if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
44
- const s = (x = h.itemLink) == null ? void 0 : x[g];
45
- if (s) {
46
- const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
47
- (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
48
+ const i = (I = (S = d.name) == null ? void 0 : S[m]) == null ? void 0 : I.ATTR;
49
+ if (i && e.setAttribute("alt", `{{${i}_${n}}}`), s) {
50
+ const a = (O = d.itemLink) == null ? void 0 : O[m];
51
+ if (a) {
52
+ const b = a.HREF, g = a.DEFAULT_HREF || "#!", u = s.href;
53
+ (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(g) || u === `${window.location.href}${g}` || !u || u === window.location.href) && (s.href = `{{${b}_${n}}}`);
48
54
  }
49
55
  }
50
56
  break;
51
57
  }
52
58
  case "name": {
53
- const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
54
- t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
59
+ const e = f, s = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
60
+ t.textContent && (t.innerHTML = L(t, `{{${s}_${n}}}`));
55
61
  const i = t.closest("a") || (t.tagName === "A" ? t : null);
56
62
  if (i && c) {
57
- const s = i.href, _ = `${window.location.href}${l}`;
58
- (s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
63
+ const a = i.href, b = `${window.location.href}${l}`;
64
+ (a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
59
65
  }
60
66
  break;
61
67
  }
62
68
  case "price":
63
69
  case "originalPrice": {
64
- const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(N.POSITION) || "before";
65
- let _;
66
- i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
67
- const R = e.CURRENCY;
68
- let u = `{{${_}_${o}}}`;
69
- const H = (t.getAttribute(N.SYMBOL) || "").trim(), G = Y(H);
70
- let C = "";
71
- G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
70
+ const e = f, s = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = s === "true", i = l === "true", a = t.getAttribute(U.POSITION) || "before";
71
+ let b;
72
+ i ? b = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : b = c ? e.PRICE_FORMATTED : e.PRICE;
73
+ const g = e.CURRENCY;
74
+ let u = `{{${b}_${n}}}`;
75
+ const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
76
+ let F = "";
77
+ G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
72
78
  break;
73
79
  }
74
80
  case "quantity": {
75
- const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (D = t.textContent) == null ? void 0 : D.trim();
76
- c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
81
+ const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (x = t.textContent) == null ? void 0 : x.trim();
82
+ c && l.includes(c) && (t.innerHTML = L(t, `{{${s}_${n}}}`));
77
83
  break;
78
84
  }
79
85
  case "button": {
80
- const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
86
+ const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
81
87
  if (c) {
82
- const i = c.href || "", s = `${window.location.href}${l}`;
83
- (i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
88
+ const i = c.href || "", a = `${window.location.href}${l}`;
89
+ (i === "" || i === "#" || i === a || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${s}_${n}}}`);
84
90
  }
91
+ Q(t, `{{${s}_${n}}}`);
85
92
  break;
86
93
  }
87
94
  case "itemLink": {
88
- const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
95
+ const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
89
96
  if (c.href) {
90
- const i = c.href, s = `${window.location.href}${l}`;
91
- (i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
97
+ const i = c.href, a = `${window.location.href}${l}`;
98
+ (i === a || i.endsWith(l)) && (c.href = `{{${s}_${n}}}`);
92
99
  }
93
100
  break;
94
101
  }
95
102
  default: {
96
103
  if ("ATTR" in f) {
97
104
  const e = f.ATTR;
98
- t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
105
+ t.textContent && (t.innerHTML = L(t, `{{${e}_${n}}}`));
99
106
  }
100
107
  break;
101
108
  }
@@ -103,49 +110,49 @@ function rt(S) {
103
110
  });
104
111
  });
105
112
  });
106
- const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
107
- ` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
108
- W.forEach((n) => {
109
- const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
110
- M.push({
111
- element: n,
113
+ const E = C.match(/<!DOCTYPE[^>]*>/i), k = E ? `${E[0]}
114
+ ` : "", P = A.querySelectorAll(".ins-product-td"), N = [];
115
+ P.forEach((o) => {
116
+ const p = o.getAttribute("data-type") || "CART_ITEMS", T = o.getAttribute("data-number") || "1", r = o.outerHTML;
117
+ N.push({
118
+ element: o,
112
119
  outerHtml: r,
113
- type: d,
114
- number: p
120
+ type: p,
121
+ number: T
115
122
  });
116
123
  });
117
- let A = U + b.documentElement.outerHTML;
118
- M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
119
- const r = O[d], E = r ? `${r}_total_product_kind` : "";
120
- if (E) {
121
- const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
122
- A = A.replace(n, X(o));
124
+ let h = k + A.documentElement.outerHTML;
125
+ N.reverse().forEach(({ outerHtml: o, type: p, number: T }) => {
126
+ const r = q[p], _ = r ? `${r}_total_product_kind` : "";
127
+ if (_) {
128
+ const R = parseInt(T) - 1, n = `${`{% if ${_} > ${R} %}`}${o}{% endif %}`;
129
+ h = h.replace(o, B(n));
123
130
  }
124
131
  });
125
- const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
126
- return V.forEach((n) => {
132
+ const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set();
133
+ return V.forEach((o) => {
127
134
  var t;
128
- const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
129
- if (!d || !O[p])
135
+ const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
136
+ if (!p || !q[T])
130
137
  return;
131
- const r = n.closest(".product-original-price-class");
132
- if (!r || k.has(r))
138
+ const r = o.closest(".product-original-price-class");
139
+ if (!r || D.has(r))
133
140
  return;
134
- k.add(r);
135
- const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
136
- T.wrap.push(m !== "false"), L.set(E, T);
137
- }), L.forEach(({ number: n, type: d, wrap: p }, r) => {
138
- if (r.includes("{% if") || !p.some(Boolean))
141
+ D.add(r);
142
+ const _ = r.outerHTML, y = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), R = w.get(_) ?? { number: p, type: T, wrap: [] };
143
+ R.wrap.push(y !== "false"), w.set(_, R);
144
+ }), w.forEach(({ number: o, type: p, wrap: T }, r) => {
145
+ if (r.includes("{% if") || !T.some(Boolean))
139
146
  return;
140
- const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
141
- let g = "", o = 0, f = 0, $ = A.indexOf(r);
142
- for (; $ !== -1; ) {
143
- const F = p[f] === !0 && !Q(A, $, t);
144
- g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
147
+ const _ = M.PAIRS_FOR_EXTENSION.price[p].PRICE, y = M.PAIRS_FOR_EXTENSION.originalPrice[p].PRICE, R = `{% if ${_}_${o} != ${y}_${o} %}`, t = [R, W(R)];
148
+ let m = "", n = 0, f = 0, S = h.indexOf(r);
149
+ for (; S !== -1; ) {
150
+ const I = T[f] === !0 && !v(h, S, t);
151
+ m += h.slice(n, S) + (I ? `${R}${r}{% endif %}` : r), n = S + r.length, f += 1, S = h.indexOf(r, n);
145
152
  }
146
- A = g + A.slice(o);
147
- }), B(A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
153
+ h = m + h.slice(n);
154
+ }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
148
155
  }
149
156
  export {
150
- rt as pairProductVariables
157
+ et as pairProductVariables
151
158
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.2-beta.cfc5be2",
3
+ "version": "3.21.2-beta.eea8885",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",