@useinsider/guido 3.20.1-beta.42d31bd → 3.20.1-beta.55d63aa

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 (60) 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 +78 -76
  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/composables/useBlocksConfig.js +32 -24
  15. package/dist/composables/useDisplayConditions.js +111 -0
  16. package/dist/enums/academy.js +1 -0
  17. package/dist/enums/display-condition.js +12 -0
  18. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +9 -9
  19. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +3 -5
  20. package/dist/extensions/DisplayConditions/bridge.js +17 -0
  21. package/dist/extensions/DisplayConditions/constants.js +17 -0
  22. package/dist/extensions/DisplayConditions/control.js +169 -0
  23. package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
  24. package/dist/extensions/DisplayConditions/extension.js +28 -0
  25. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  26. package/dist/extensions/DisplayConditions/library.js +25 -0
  27. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  28. package/dist/guido.css +1 -1
  29. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  30. package/dist/node_modules/valibot/dist/index.js +297 -261
  31. package/dist/services/displayConditionApi.js +39 -0
  32. package/dist/src/@types/config/schemas.d.ts +4 -0
  33. package/dist/src/@types/display-condition.d.ts +59 -0
  34. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  35. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  36. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  37. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  38. package/dist/src/composables/useConfig.d.ts +2 -0
  39. package/dist/src/composables/useDisplayConditions.d.ts +16 -0
  40. package/dist/src/enums/academy.d.ts +1 -0
  41. package/dist/src/enums/display-condition.d.ts +15 -0
  42. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +0 -2
  43. package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
  44. package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
  45. package/dist/src/extensions/DisplayConditions/control.d.ts +21 -0
  46. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  47. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  48. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  49. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  50. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  51. package/dist/src/services/displayConditionApi.d.ts +9 -0
  52. package/dist/src/stores/config.d.ts +20 -0
  53. package/dist/src/stores/display-condition.d.ts +81 -0
  54. package/dist/src/utils/displayCondition.d.ts +4 -0
  55. package/dist/src/utils/protectTableText.d.ts +2 -0
  56. package/dist/stores/display-condition.js +28 -0
  57. package/dist/utils/displayCondition.js +21 -0
  58. package/dist/utils/pairProductVariables.js +15 -14
  59. package/dist/utils/protectTableText.js +22 -0
  60. package/package.json +1 -1
@@ -1,28 +1,29 @@
1
- import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
1
+ import { ITEMS_CURRENCY_ATTR as N, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
2
  import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
3
  import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
4
  import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
5
+ import { protectTableText as v, restoreTableText as B } from "./protectTableText.js";
6
+ import { unwrapProductNameLinks as j } from "./unwrapProductNameLink.js";
6
7
  const O = {
7
8
  CART_ITEMS: "ins_apr",
8
9
  BROWSED_ITEMS: "browsed_item",
9
10
  PURCHASED_ITEMS: "purchased_item"
10
11
  }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function B(S, y, b) {
12
+ function Q(S, y, b) {
12
13
  let h = y;
13
14
  for (; h > 0 && /\s/.test(S[h - 1]); )
14
15
  h -= 1;
15
16
  return b.some((I) => S.endsWith(I, h));
16
17
  }
17
- function Z(S) {
18
- const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
19
- v(b);
18
+ function rt(S) {
19
+ const y = q(v(S)), b = new DOMParser().parseFromString(y, "text/html");
20
+ j(b);
20
21
  const h = w.PAIRS_FOR_EXTENSION;
21
22
  Object.entries(h).forEach(([n, d]) => {
22
23
  b.querySelectorAll(".ins-product-td").forEach((r) => {
23
24
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
25
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
- var $, F, D, N;
26
+ var $, F, x, D;
26
27
  const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
27
28
  if (f)
28
29
  switch (n) {
@@ -40,7 +41,7 @@ function Z(S) {
40
41
  }
41
42
  const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
42
43
  if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
43
- const s = (D = h.itemLink) == null ? void 0 : D[g];
44
+ const s = (x = h.itemLink) == null ? void 0 : x[g];
44
45
  if (s) {
45
46
  const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
46
47
  (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
@@ -60,18 +61,18 @@ function Z(S) {
60
61
  }
61
62
  case "price":
62
63
  case "originalPrice": {
63
- const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
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";
64
65
  let _;
65
66
  i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
66
67
  const R = e.CURRENCY;
67
68
  let u = `{{${_}_${o}}}`;
68
- const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
69
+ const H = (t.getAttribute(N.SYMBOL) || "").trim(), G = Y(H);
69
70
  let C = "";
70
71
  G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
71
72
  break;
72
73
  }
73
74
  case "quantity": {
74
- const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
75
+ const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (D = t.textContent) == null ? void 0 : D.trim();
75
76
  c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
76
77
  break;
77
78
  }
@@ -139,12 +140,12 @@ function Z(S) {
139
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)];
140
141
  let g = "", o = 0, f = 0, $ = A.indexOf(r);
141
142
  for (; $ !== -1; ) {
142
- const F = p[f] === !0 && !B(A, $, t);
143
+ const F = p[f] === !0 && !Q(A, $, t);
143
144
  g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
144
145
  }
145
146
  A = g + A.slice(o);
146
- }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
+ }), B(A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
147
148
  }
148
149
  export {
149
- Z as pairProductVariables
150
+ rt as pairProductVariables
150
151
  };
@@ -0,0 +1,22 @@
1
+ const c = "guido-table-text:", l = new RegExp(`<!--${c}([A-Za-z0-9+/=]*)-->`, "g"), i = /<!--[\s\S]*?-->|\{%[\s\S]*?%\}|<[a-zA-Z/!?](?:[^>"']|"[^"]*"|'[^']*')*>|[^<{]+|[<{]/g, o = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]), T = /* @__PURE__ */ new Set([...o, "td", "th", "caption"]), d = (s) => btoa(unescape(encodeURIComponent(s))), f = (s) => decodeURIComponent(escape(atob(s))), p = (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 u(s) {
6
+ const e = [];
7
+ let a = !1;
8
+ return s.replace(i, (t) => {
9
+ if (t.startsWith("<!--") || t.startsWith("{%"))
10
+ return t;
11
+ if (t.length > 1 && t.startsWith("<")) {
12
+ const { name: n, closing: r } = p(t);
13
+ return a = T.has(n), a && (r ? e.includes(n) && e.splice(e.lastIndexOf(n)) : e.push(n)), t;
14
+ }
15
+ return a && o.has(e[e.length - 1] ?? "") && t.trim() ? `<!--${c}${d(t)}-->` : t;
16
+ });
17
+ }
18
+ const E = (s) => s.replace(l, (e, a) => f(a));
19
+ export {
20
+ u as protectTableText,
21
+ E as restoreTableText
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.20.1-beta.42d31bd",
3
+ "version": "3.20.1-beta.55d63aa",
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",