@useinsider/guido 3.23.0-beta.86bed27 → 3.23.0-beta.95eb6bb

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 (111) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +41 -39
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +6 -6
  5. package/dist/components/Guido.vue2.js +84 -82
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +71 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +57 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  14. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
  15. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  16. package/dist/composables/useBlocksConfig.js +32 -24
  17. package/dist/composables/useDisplayConditions.js +109 -0
  18. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  19. package/dist/config/compiler/utils/recommendationCompilerUtils.js +78 -75
  20. package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
  21. package/dist/config/migrator/recommendation/extractors.js +100 -40
  22. package/dist/config/migrator/recommendation/htmlBuilder.js +285 -207
  23. package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
  24. package/dist/config/migrator/recommendation/themeMapper.js +53 -41
  25. package/dist/config/migrator/recommendationMigrator.js +68 -61
  26. package/dist/enums/academy.js +1 -0
  27. package/dist/enums/display-condition.js +12 -0
  28. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
  29. package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
  30. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
  31. package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
  32. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
  33. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
  34. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
  35. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
  36. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
  37. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
  38. package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
  39. package/dist/extensions/Blocks/Recommendation/block.js +33 -24
  40. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  41. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +27 -26
  42. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  43. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +165 -175
  44. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  46. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  47. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  48. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  49. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  51. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  52. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  53. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  54. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
  55. package/dist/extensions/Blocks/common-control.js +62 -55
  56. package/dist/extensions/DisplayConditions/bridge.js +18 -0
  57. package/dist/extensions/DisplayConditions/constants.js +17 -0
  58. package/dist/extensions/DisplayConditions/control.js +182 -0
  59. package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
  60. package/dist/extensions/DisplayConditions/extension.js +28 -0
  61. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  62. package/dist/extensions/DisplayConditions/library.js +27 -0
  63. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  64. package/dist/guido.css +1 -1
  65. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  66. package/dist/node_modules/valibot/dist/index.js +297 -261
  67. package/dist/package.json.js +1 -1
  68. package/dist/services/displayConditionApi.js +39 -0
  69. package/dist/src/@types/config/schemas.d.ts +4 -0
  70. package/dist/src/@types/display-condition.d.ts +60 -0
  71. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  72. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  73. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  74. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  75. package/dist/src/composables/useConfig.d.ts +2 -0
  76. package/dist/src/composables/useDisplayConditions.d.ts +16 -0
  77. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
  78. package/dist/src/config/migrator/recommendation/extractors.d.ts +35 -6
  79. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +3 -1
  80. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +3 -1
  81. package/dist/src/config/migrator/recommendation/types.d.ts +11 -1
  82. package/dist/src/enums/academy.d.ts +1 -0
  83. package/dist/src/enums/display-condition.d.ts +15 -0
  84. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
  85. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -10
  87. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  88. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  89. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
  90. package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
  91. package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
  92. package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
  93. package/dist/src/extensions/DisplayConditions/control.d.ts +23 -0
  94. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  95. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  96. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  97. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  98. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  99. package/dist/src/services/displayConditionApi.d.ts +8 -0
  100. package/dist/src/stores/config.d.ts +166 -0
  101. package/dist/src/stores/display-condition.d.ts +84 -0
  102. package/dist/src/stores/unsubscribe.d.ts +10 -0
  103. package/dist/src/utils/displayCondition.d.ts +10 -0
  104. package/dist/src/utils/protectTableText.d.ts +2 -0
  105. package/dist/stores/config.js +13 -6
  106. package/dist/stores/display-condition.js +29 -0
  107. package/dist/stores/unsubscribe.js +33 -29
  108. package/dist/utils/displayCondition.js +26 -0
  109. package/dist/utils/pairProductVariables.js +30 -29
  110. package/dist/utils/protectTableText.js +22 -0
  111. package/package.json +2 -2
@@ -1,23 +1,27 @@
1
- import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
1
+ import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
2
2
  import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
3
  import { defineStore as u } from "pinia";
4
- let o = null;
5
- const r = () => ({
4
+ let a = null;
5
+ const p = () => ({
6
6
  templates: [],
7
7
  selectedTemplates: {},
8
8
  selectedUnsubscribePages: [],
9
- selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
10
- activeType: p.GLOBAL_UNSUBSCRIBE,
9
+ selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
10
+ activeType: r.GLOBAL_UNSUBSCRIBE,
11
11
  pageSelectionUpdateStatus: !1,
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
15
  isSubscriptionPreferencesCenterDisabled: !1,
16
16
  pendingBlockId: null
17
- }), b = u("guidoUnsubscribe", {
18
- state: () => r(),
17
+ });
18
+ function h(e) {
19
+ return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
20
+ }
21
+ const f = u("guidoUnsubscribe", {
22
+ state: () => p(),
19
23
  getters: {
20
- getSelectedCollection: (e) => i[e.selectedCollectionType],
24
+ getSelectedCollection: (e) => c[e.selectedCollectionType],
21
25
  getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
22
26
  getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
23
27
  getThumbnailByTemplateId: (e) => (t) => {
@@ -25,31 +29,31 @@ const r = () => ({
25
29
  return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
26
30
  },
27
31
  getSelectedUnsubscribePagesByCollection: (e) => (t) => {
28
- const l = i[t];
32
+ const l = c[t];
29
33
  if (!l)
30
34
  return [];
31
35
  const s = /* @__PURE__ */ new Map();
32
36
  e.templates.forEach((n) => {
33
37
  s.set(n.id, n.type);
34
38
  });
35
- const c = new Set(l);
39
+ const i = new Set(l);
36
40
  return e.selectedUnsubscribePages.filter((n) => {
37
- const a = s.get(n);
38
- return a !== void 0 && c.has(a);
41
+ const o = s.get(n);
42
+ return o !== void 0 && i.has(o);
39
43
  });
40
44
  },
41
45
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType] ?? [];
46
+ const t = c[e.selectedCollectionType] ?? [];
43
47
  return e.activeType === t[0];
44
48
  },
45
49
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType] ?? [];
50
+ const t = c[e.selectedCollectionType] ?? [];
47
51
  return e.activeType === t[t.length - 1];
48
52
  },
49
53
  hasTemplatesByCollectionType: (e) => {
50
54
  const t = {};
51
- return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
- t[s] = e.templates.some((c) => c.type === s);
55
+ return (c[e.selectedCollectionType] ?? []).forEach((s) => {
56
+ t[s] = e.templates.some((i) => i.type === s);
53
57
  }), t;
54
58
  },
55
59
  unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
@@ -58,36 +62,36 @@ const r = () => ({
58
62
  $reset() {
59
63
  const { templates: e, selectedUnsubscribePages: t } = this;
60
64
  Object.assign(this, {
61
- ...r(),
65
+ ...p(),
62
66
  templates: e,
63
67
  selectedUnsubscribePages: t
64
68
  });
65
69
  },
66
70
  async fetchTemplates(e = !1) {
67
- !e && this.templates.length || ((e || !o) && (o = (async () => {
71
+ !e && this.templates.length || ((e || !a) && (a = (async () => {
68
72
  const { getUnsubscribePages: t } = d();
69
- this.templates = await t();
73
+ this.templates = h(await t());
70
74
  })().finally(() => {
71
- o = null;
72
- })), await o);
75
+ a = null;
76
+ })), await a);
73
77
  },
74
78
  setCollection(e) {
75
79
  this.selectedCollectionType = e;
76
- const t = i[e];
80
+ const t = c[e];
77
81
  if (t && t.length > 0) {
78
82
  [this.activeType] = t;
79
83
  const l = { ...this.selectedTemplates };
80
84
  t.forEach((s) => {
81
85
  if (!l[s]) {
82
- const c = this.templates.find((n) => n.type === s);
83
- c && (l[s] = c.id);
86
+ const i = this.templates.filter((o) => o.type === s), n = i.find((o) => o.isDefault) ?? i[0];
87
+ n && (l[s] = n.id);
84
88
  }
85
89
  }), this.selectedTemplates = l;
86
90
  }
87
91
  },
88
92
  setCollectionWithoutAutoSelection(e) {
89
93
  this.selectedCollectionType = e;
90
- const t = i[e];
94
+ const t = c[e];
91
95
  t && t.length > 0 && ([this.activeType] = t);
92
96
  },
93
97
  setSelectedTemplate(e) {
@@ -107,12 +111,12 @@ const r = () => ({
107
111
  loadSelectedTemplates(e) {
108
112
  const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
109
113
  e.forEach((s) => {
110
- const c = t.get(s);
111
- c !== void 0 && (l[c] = s);
114
+ const i = t.get(s);
115
+ i !== void 0 && (l[i] = s);
112
116
  }), this.selectedTemplates = l;
113
117
  },
114
118
  getSelectedTemplatesByCollection(e) {
115
- const t = i[e], l = [];
119
+ const t = c[e], l = [];
116
120
  return t.forEach((s) => {
117
121
  this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
118
122
  }), l;
@@ -129,5 +133,5 @@ const r = () => ({
129
133
  }
130
134
  });
131
135
  export {
132
- b as useUnsubscribeStore
136
+ f as useUnsubscribeStore
133
137
  };
@@ -0,0 +1,26 @@
1
+ import { DisplayConditionSourceType as d } from "../enums/display-condition.js";
2
+ const m = (e) => {
3
+ if (!e)
4
+ return null;
5
+ try {
6
+ return JSON.parse(e.extraData ?? "{}").source === d.INLINE ? "inline" : "saved";
7
+ } catch {
8
+ return "saved";
9
+ }
10
+ }, E = (e) => !e || !(e.name || e.beforeScript || e.afterScript) ? null : { ...e, description: e.description ?? "" };
11
+ let o = 0;
12
+ const w = () => (o = Math.max(Date.now(), o + 1), o), f = /{%-?\s*(\w+)[\s\S]*?-?%}/g, p = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, u = /{%-?\s*(comment|raw)\s*-?%}[\s\S]*?{%-?\s*end\1\s*-?%}/g, l = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), h = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), S = (e) => /{%|%}|{{|}}/.test(e.replace(p, "")), C = (e, c) => {
13
+ const t = /* @__PURE__ */ new Set(), r = [];
14
+ return [["codeBefore", e], ["codeAfter", c]].forEach(([n, i]) => {
15
+ const a = i.replace(u, "");
16
+ S(a) && t.add(n), Array.from(a.matchAll(f), (s) => s[1]).forEach((s) => {
17
+ l.has(s) ? r.push(s) : s.startsWith("end") && l.has(s.slice(3)) ? r.pop() !== s.slice(3) && t.add(n) : h.has(s) && !r.length && t.add(n);
18
+ });
19
+ }), r.length && t.add("codeAfter"), [...t];
20
+ };
21
+ export {
22
+ C as findInvalidCodeFields,
23
+ w as nextConditionId,
24
+ m as parseSource,
25
+ E as toAppliedCondition
26
+ };
@@ -2,34 +2,35 @@ import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as Y } from "../extens
2
2
  import { productPairs as M } from "../extensions/Blocks/Items/enums/productEnums.js";
3
3
  import { escapeReplacement as B } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
4
  import { preserveTextStyles as L } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
5
+ import { protectTableText as X, restoreTableText as v } from "./protectTableText.js";
6
+ import { unwrapProductNameLinks as j } from "./unwrapProductNameLink.js";
6
7
  const q = {
7
8
  CART_ITEMS: "ins_apr",
8
9
  BROWSED_ITEMS: "browsed_item",
9
10
  PURCHASED_ITEMS: "purchased_item"
10
11
  }, W = ($) => $.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function v($, C, A) {
12
+ function Q($, C, A) {
12
13
  let d = C;
13
14
  for (; d > 0 && /\s/.test($[d - 1]); )
14
15
  d -= 1;
15
16
  return A.some((E) => $.endsWith(E, d));
16
17
  }
17
- const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
18
- function Q($, C) {
18
+ const z = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
19
+ function J($, C) {
19
20
  var d;
20
21
  const A = $.ownerDocument.createTreeWalker($, NodeFilter.SHOW_COMMENT);
21
22
  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
+ (d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(z, (k, P) => `${P}href="${C}"`));
23
24
  }
24
- function et($) {
25
- const C = W($), A = new DOMParser().parseFromString(C, "text/html");
26
- X(A);
25
+ function ot($) {
26
+ const C = W(X($)), A = new DOMParser().parseFromString(C, "text/html");
27
+ j(A);
27
28
  const d = M.PAIRS_FOR_EXTENSION;
28
29
  Object.entries(d).forEach(([o, p]) => {
29
30
  A.querySelectorAll(".ins-product-td").forEach((r) => {
30
31
  const _ = r.getAttribute("data-number") || "1", y = r.getAttribute("data-type") || "CART_ITEMS";
31
32
  r.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
32
- var S, I, O, x;
33
+ var b, I, D, O;
33
34
  const m = t.getAttribute("data-type") || y, n = t.getAttribute("data-number") || _, f = p[m];
34
35
  if (f)
35
36
  switch (o) {
@@ -45,12 +46,12 @@ function et($) {
45
46
  return a.includes(g) || a.includes(u) || H === u;
46
47
  }) && (e.src = `{{${c}_${n}}}`);
47
48
  }
48
- const i = (I = (S = d.name) == null ? void 0 : S[m]) == null ? void 0 : I.ATTR;
49
+ const i = (I = (b = d.name) == null ? void 0 : b[m]) == null ? void 0 : I.ATTR;
49
50
  if (i && e.setAttribute("alt", `{{${i}_${n}}}`), s) {
50
- const a = (O = d.itemLink) == null ? void 0 : O[m];
51
+ const a = (D = d.itemLink) == null ? void 0 : D[m];
51
52
  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}}}`);
53
+ const S = a.HREF, g = a.DEFAULT_HREF || "#!", u = s.href;
54
+ (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(g) || u === `${window.location.href}${g}` || !u || u === window.location.href) && (s.href = `{{${S}_${n}}}`);
54
55
  }
55
56
  }
56
57
  break;
@@ -60,25 +61,25 @@ function et($) {
60
61
  t.textContent && (t.innerHTML = L(t, `{{${s}_${n}}}`));
61
62
  const i = t.closest("a") || (t.tagName === "A" ? t : null);
62
63
  if (i && c) {
63
- const a = i.href, b = `${window.location.href}${l}`;
64
- (a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
64
+ const a = i.href, S = `${window.location.href}${l}`;
65
+ (a === S || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
65
66
  }
66
67
  break;
67
68
  }
68
69
  case "price":
69
70
  case "originalPrice": {
70
71
  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;
72
+ let S;
73
+ i ? S = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : S = c ? e.PRICE_FORMATTED : e.PRICE;
73
74
  const g = e.CURRENCY;
74
- let u = `{{${b}_${n}}}`;
75
+ let u = `{{${S}_${n}}}`;
75
76
  const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
76
77
  let F = "";
77
78
  G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
78
79
  break;
79
80
  }
80
81
  case "quantity": {
81
- const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (x = t.textContent) == null ? void 0 : x.trim();
82
+ const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (O = t.textContent) == null ? void 0 : O.trim();
82
83
  c && l.includes(c) && (t.innerHTML = L(t, `{{${s}_${n}}}`));
83
84
  break;
84
85
  }
@@ -88,7 +89,7 @@ function et($) {
88
89
  const i = c.href || "", a = `${window.location.href}${l}`;
89
90
  (i === "" || i === "#" || i === a || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${s}_${n}}}`);
90
91
  }
91
- Q(t, `{{${s}_${n}}}`);
92
+ J(t, `{{${s}_${n}}}`);
92
93
  break;
93
94
  }
94
95
  case "itemLink": {
@@ -129,30 +130,30 @@ function et($) {
129
130
  h = h.replace(o, B(n));
130
131
  }
131
132
  });
132
- const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set();
133
+ const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set();
133
134
  return V.forEach((o) => {
134
135
  var t;
135
136
  const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
136
137
  if (!p || !q[T])
137
138
  return;
138
139
  const r = o.closest(".product-original-price-class");
139
- if (!r || D.has(r))
140
+ if (!r || x.has(r))
140
141
  return;
141
- D.add(r);
142
+ x.add(r);
142
143
  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
144
  R.wrap.push(y !== "false"), w.set(_, R);
144
145
  }), w.forEach(({ number: o, type: p, wrap: T }, r) => {
145
146
  if (r.includes("{% if") || !T.some(Boolean))
146
147
  return;
147
148
  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);
149
+ let m = "", n = 0, f = 0, b = h.indexOf(r);
150
+ for (; b !== -1; ) {
151
+ const I = T[f] === !0 && !Q(h, b, t);
152
+ m += h.slice(n, b) + (I ? `${R}${r}{% endif %}` : r), n = b + r.length, f += 1, b = h.indexOf(r, n);
152
153
  }
153
154
  h = m + h.slice(n);
154
- }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
155
+ }), v(h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
155
156
  }
156
157
  export {
157
- et as pairProductVariables
158
+ ot as pairProductVariables
158
159
  };
@@ -0,0 +1,22 @@
1
+ const n = "guido-table-text:", i = new RegExp(`<!--${n}([A-Za-z0-9+/=]*)-->`, "g"), T = /<!--[\s\S]*?-->|\{%[\s\S]*?%\}|<[a-zA-Z/!?](?:[^>"']|"[^"]*"|'[^']*')*>|[^<{]+|[<{]/g, o = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr", "colgroup"]), r = /* @__PURE__ */ new Set(["col"]), f = /* @__PURE__ */ new Set([...o, ...r, "td", "th", "caption"]), p = (s) => btoa(unescape(encodeURIComponent(s))), u = (s) => decodeURIComponent(escape(atob(s))), d = (s) => {
2
+ const e = /^<(\/?)([a-zA-Z][\w-]*)/.exec(s);
3
+ return { name: e ? e[2].toLowerCase() : "", closing: e ? e[1] === "/" : !1 };
4
+ };
5
+ function E(s) {
6
+ const e = [];
7
+ let a = !1;
8
+ return s.replace(T, (t) => {
9
+ if (t.startsWith("<!--") || t.startsWith("{%"))
10
+ return t;
11
+ if (t.length > 1 && t.startsWith("<")) {
12
+ const { name: c, closing: l } = d(t);
13
+ return a = f.has(c), !a || r.has(c) || (l ? e.includes(c) && e.splice(e.lastIndexOf(c)) : e.push(c)), t;
14
+ }
15
+ return a && o.has(e[e.length - 1] ?? "") && t.trim() ? `<!--${n}${p(t)}-->` : t;
16
+ });
17
+ }
18
+ const g = (s) => s.replace(i, (e, a) => u(a));
19
+ export {
20
+ E as protectTableText,
21
+ g as restoreTableText
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.23.0-beta.86bed27",
3
+ "version": "3.23.0-beta.95eb6bb",
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",
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "@stripoinc/ui-editor-extensions": "3.11.0",
61
61
  "@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
62
- "@useinsider/design-system-vue": "2.3.1",
62
+ "@useinsider/design-system-vue": "2.5.0",
63
63
  "@vueuse/core": "11.3.0",
64
64
  "lodash-es": "4.17.21",
65
65
  "pinia": "2.3.1",