@useinsider/guido 2.1.0-beta.e13d291 → 2.1.0-beta.e2153c2

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 (138) hide show
  1. package/README.md +36 -0
  2. package/dist/@types/config/schemas.js +70 -65
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +69 -58
  5. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +15 -14
  6. package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
  7. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  8. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  9. package/dist/composables/useActionsApi.js +15 -13
  10. package/dist/composables/useBlocksConfig.js +26 -16
  11. package/dist/composables/useHtmlValidator.js +114 -104
  12. package/dist/composables/useRecommendation.js +54 -21
  13. package/dist/composables/useStripo.js +25 -23
  14. package/dist/composables/useVersionHistoryApi.js +1 -1
  15. package/dist/config/compiler/recommendationCompilerRules.js +45 -39
  16. package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -0
  17. package/dist/config/i18n/en/index.js +11 -0
  18. package/dist/config/i18n/en/labels.json.js +7 -0
  19. package/dist/config/i18n/en/toasters.json.js +56 -0
  20. package/dist/config/i18n/en/tooltips.json.js +82 -0
  21. package/dist/config/i18n/index.js +7 -0
  22. package/dist/config/migrator/itemsBlockMigrator.js +142 -120
  23. package/dist/enums/defaults.js +8 -4
  24. package/dist/enums/extensions/recommendationBlock.js +1 -1
  25. package/dist/enums/recommendation.js +16 -15
  26. package/dist/extensions/Blocks/Items/block.js +19 -28
  27. package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
  28. package/dist/extensions/Blocks/Items/controls/cardComposition.js +124 -85
  29. package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
  30. package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
  31. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +35 -47
  32. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +49 -54
  33. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +42 -51
  34. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -36
  35. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
  36. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -60
  37. package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
  38. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
  39. package/dist/extensions/Blocks/Items/extension.js +8 -9
  40. package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
  41. package/dist/extensions/Blocks/Items/template.js +181 -175
  42. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
  43. package/dist/extensions/Blocks/Recommendation/block.js +117 -27
  44. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +33 -31
  45. package/dist/extensions/Blocks/Recommendation/constants/layout.js +6 -4
  46. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +12 -10
  47. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +10 -14
  48. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +19 -27
  49. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +49 -44
  50. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +1 -3
  51. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +147 -102
  52. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +1 -5
  53. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +85 -43
  54. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +9 -13
  55. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +138 -117
  56. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  57. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +66 -34
  58. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +2 -2
  59. package/dist/extensions/Blocks/Recommendation/services/configService.js +2 -1
  60. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +248 -206
  61. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +26 -31
  62. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
  63. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -34
  64. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +20 -25
  65. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -22
  66. package/dist/extensions/Blocks/Recommendation/templates/utils.js +52 -39
  67. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +10 -10
  68. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  69. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  70. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  71. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  72. package/dist/extensions/Blocks/common-control.js +91 -92
  73. package/dist/extensions/ModulesTabIcons/extension.js +17 -0
  74. package/dist/guido.css +1 -1
  75. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
  76. package/dist/package.json.js +1 -1
  77. package/dist/services/recommendationApi.js +11 -9
  78. package/dist/services/stripoApi.js +20 -17
  79. package/dist/services/templateLibraryApi.js +16 -13
  80. package/dist/src/@types/config/schemas.d.ts +8 -0
  81. package/dist/src/composables/useConfig.d.ts +4 -0
  82. package/dist/src/composables/useRecommendation.d.ts +1 -0
  83. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
  84. package/dist/src/config/i18n/en/index.d.ts +1 -0
  85. package/dist/src/config/i18n/index.d.ts +16 -0
  86. package/dist/src/enums/defaults.d.ts +4 -0
  87. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
  88. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
  89. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
  90. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
  91. package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
  92. package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
  93. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
  94. package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
  95. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
  96. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
  97. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
  98. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
  99. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
  100. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +44 -11
  101. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  102. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -0
  103. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
  104. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +8 -1
  105. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +27 -5
  106. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
  107. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -2
  108. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  109. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +19 -1
  110. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +2 -2
  111. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +138 -469
  112. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +2 -2
  113. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  114. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +2 -0
  115. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +2 -2
  116. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -2
  117. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +16 -4
  118. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +14 -2
  119. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +1 -1
  120. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  121. package/dist/src/extensions/Blocks/common-control.d.ts +4 -5
  122. package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
  123. package/dist/src/stores/config.d.ts +36 -0
  124. package/dist/static/styles/components/notification.css.js +19 -0
  125. package/dist/static/styles/components/tools.css.js +6 -2
  126. package/dist/static/styles/components/version-history.css.js +10 -2
  127. package/dist/static/styles/components/wide-panel.css.js +18 -2
  128. package/dist/static/styles/customEditorStyle.css.js +10 -9
  129. package/dist/static/styles/variables.css.js +2 -0
  130. package/dist/static/templates/empty/index.html.js +74 -0
  131. package/dist/static/templates/empty/style.css.js +779 -0
  132. package/dist/stores/unsubscribe.js +37 -34
  133. package/dist/utils/pairProductVariables.js +57 -56
  134. package/dist/utils/templatePreparation.js +15 -14
  135. package/package.json +2 -2
  136. package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
  137. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
  138. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
@@ -1,39 +1,40 @@
1
- import { TYPE_COLLECTIONS as i, PAGE_TYPES as a } from "../enums/unsubscribe.js";
2
- import { useUnsubscribeApi as r } from "../services/unsubscribeApi.js";
3
- import { defineStore as d } from "pinia";
4
- const p = () => ({
1
+ import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
2
+ import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
+ import { defineStore as h } from "pinia";
4
+ let o = null;
5
+ const r = () => ({
5
6
  templates: [],
6
7
  selectedTemplates: {},
7
8
  selectedUnsubscribePages: [],
8
- selectedCollectionType: a.GLOBAL_UNSUBSCRIBE,
9
- activeType: a.GLOBAL_UNSUBSCRIBE,
9
+ selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
10
+ activeType: p.GLOBAL_UNSUBSCRIBE,
10
11
  pageSelectionUpdateStatus: !1,
11
12
  pageSelectionDrawerStatus: !1,
12
13
  typeSelectionDrawerStatus: !1,
13
14
  isGlobalUnsubscribeDisabled: !1,
14
15
  isSubscriptionPreferencesCenterDisabled: !1
15
- }), g = d("guidoUnsubscribe", {
16
- state: () => p(),
16
+ }), b = h("guidoUnsubscribe", {
17
+ state: () => r(),
17
18
  getters: {
18
19
  getSelectedCollection: (e) => i[e.selectedCollectionType],
19
20
  getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
20
21
  getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
21
22
  getThumbnailByTemplateId: (e) => (t) => {
22
- var c;
23
- return ((c = e.templates.find((s) => s.id === t)) == null ? void 0 : c.thumbnail) ?? "";
23
+ var l;
24
+ return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
24
25
  },
25
26
  getSelectedUnsubscribePagesByCollection: (e) => (t) => {
26
- const c = i[t];
27
- if (!c)
27
+ const l = i[t];
28
+ if (!l)
28
29
  return [];
29
30
  const s = /* @__PURE__ */ new Map();
30
31
  e.templates.forEach((n) => {
31
32
  s.set(n.id, n.type);
32
33
  });
33
- const l = new Set(c);
34
+ const c = new Set(l);
34
35
  return e.selectedUnsubscribePages.filter((n) => {
35
- const o = s.get(n);
36
- return o !== void 0 && l.has(o);
36
+ const a = s.get(n);
37
+ return a !== void 0 && c.has(a);
37
38
  });
38
39
  },
39
40
  isActiveTypeFirstInCollection: (e) => {
@@ -47,7 +48,7 @@ const p = () => ({
47
48
  hasTemplatesByCollectionType: (e) => {
48
49
  const t = {};
49
50
  return i[e.selectedCollectionType].forEach((s) => {
50
- t[s] = e.templates.some((l) => l.type === s);
51
+ t[s] = e.templates.some((c) => c.type === s);
51
52
  }), t;
52
53
  },
53
54
  unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
@@ -56,29 +57,31 @@ const p = () => ({
56
57
  $reset() {
57
58
  const { templates: e, selectedUnsubscribePages: t } = this;
58
59
  Object.assign(this, {
59
- ...p(),
60
+ ...r(),
60
61
  templates: e,
61
62
  selectedUnsubscribePages: t
62
63
  });
63
64
  },
64
65
  async fetchTemplates() {
65
- if (this.templates.length)
66
- return;
67
- const { getUnsubscribePages: e } = r(), t = await e();
68
- this.templates = t;
66
+ this.templates.length || (o || (o = (async () => {
67
+ const { getUnsubscribePages: e } = d();
68
+ this.templates = await e();
69
+ })().finally(() => {
70
+ o = null;
71
+ })), await o);
69
72
  },
70
73
  setCollection(e) {
71
74
  this.selectedCollectionType = e;
72
75
  const t = i[e];
73
76
  if (t && t.length > 0) {
74
77
  [this.activeType] = t;
75
- const c = { ...this.selectedTemplates };
78
+ const l = { ...this.selectedTemplates };
76
79
  t.forEach((s) => {
77
- if (!c[s]) {
78
- const l = this.templates.find((n) => n.type === s);
79
- l && (c[s] = l.id);
80
+ if (!l[s]) {
81
+ const c = this.templates.find((n) => n.type === s);
82
+ c && (l[s] = c.id);
80
83
  }
81
- }), this.selectedTemplates = c;
84
+ }), this.selectedTemplates = l;
82
85
  }
83
86
  },
84
87
  setCollectionWithoutAutoSelection(e) {
@@ -101,17 +104,17 @@ const p = () => ({
101
104
  t >= 0 && (this.activeType = this.getSelectedCollection[t]);
102
105
  },
103
106
  loadSelectedTemplates(e) {
104
- const t = new Map(this.templates.map((s) => [s.id, s.type])), c = { ...this.selectedTemplates };
107
+ const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
105
108
  e.forEach((s) => {
106
- const l = t.get(s);
107
- l !== void 0 && (c[l] = s);
108
- }), this.selectedTemplates = c;
109
+ const c = t.get(s);
110
+ c !== void 0 && (l[c] = s);
111
+ }), this.selectedTemplates = l;
109
112
  },
110
113
  getSelectedTemplatesByCollection(e) {
111
- const t = i[e], c = [];
114
+ const t = i[e], l = [];
112
115
  return t.forEach((s) => {
113
- this.selectedTemplates[s] && c.push(this.selectedTemplates[s]);
114
- }), c;
116
+ this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
117
+ }), l;
115
118
  },
116
119
  addUnsubscribePages(e) {
117
120
  const t = /* @__PURE__ */ new Set([...this.selectedUnsubscribePages, ...e]);
@@ -125,5 +128,5 @@ const p = () => ({
125
128
  }
126
129
  });
127
130
  export {
128
- g as useUnsubscribeStore
131
+ b as useUnsubscribeStore
129
132
  };
@@ -1,77 +1,77 @@
1
- import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- function P(k) {
3
- const m = k.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(m, "text/html"), R = w.PAIRS_FOR_EXTENSION;
4
- Object.entries(R).forEach(([n, l]) => {
5
- $.querySelectorAll(".ins-product-td").forEach((o) => {
6
- const E = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
7
- o.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
- var y;
9
- const T = e.getAttribute("data-type") || b, u = e.getAttribute("data-number") || E, p = l[T];
1
+ import { productPairs as P } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ function L(F) {
3
+ const R = F.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(R, "text/html"), y = P.PAIRS_FOR_EXTENSION;
4
+ Object.entries(y).forEach(([n, l]) => {
5
+ $.querySelectorAll(".ins-product-td").forEach((c) => {
6
+ const E = c.getAttribute("data-number") || "1", T = c.getAttribute("data-type") || "CART_ITEMS";
7
+ c.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
+ var H;
9
+ const b = e.getAttribute("data-type") || T, u = e.getAttribute("data-number") || E, p = l[b];
10
10
  if (p)
11
11
  switch (n) {
12
12
  case "imageSrc": {
13
- let t = null, c = null;
14
- if (e.tagName === "IMG" ? (t = e, c = t.closest("a")) : (t = e.querySelector("img"), c = e.querySelector("a") || e.closest("a")), !t)
13
+ let t = null, o = null;
14
+ if (e.tagName === "IMG" ? (t = e, o = t.closest("a")) : (t = e.querySelector("img"), o = e.querySelector("a") || e.closest("a")), !t)
15
15
  break;
16
16
  const i = p.DEFAULT, a = p.ATTR;
17
17
  if (i && t.src) {
18
18
  const r = t.src;
19
- i.some((d) => {
20
- const s = d.split("/").pop() || "", _ = r.split("/").pop() || "";
21
- return r.includes(d) || r.includes(s) || _ === s;
19
+ i.some((f) => {
20
+ const s = f.split("/").pop() || "", _ = r.split("/").pop() || "";
21
+ return r.includes(f) || r.includes(s) || _ === s;
22
22
  }) && (t.src = `{{${a}_${u}}}`);
23
23
  }
24
- if (c) {
25
- const r = (y = R.itemLink) == null ? void 0 : y[T];
24
+ if (o) {
25
+ const r = (H = y.itemLink) == null ? void 0 : H[b];
26
26
  if (r) {
27
- const f = r.HREF, d = r.DEFAULT_HREF || "#!", s = c.href;
28
- (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(d) || s === `${window.location.href}${d}` || !s || s === window.location.href) && (c.href = `{{${f}_${u}}}`);
27
+ const d = r.HREF, f = r.DEFAULT_HREF || "#!", s = o.href;
28
+ (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(f) || s === `${window.location.href}${f}` || !s || s === window.location.href) && (o.href = `{{${d}_${u}}}`);
29
29
  }
30
30
  }
31
31
  break;
32
32
  }
33
33
  case "name": {
34
- const t = p, c = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
35
- e.textContent && (e.textContent = `{{${c}_${u}}}`);
34
+ const t = p, o = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
35
+ e.textContent && (e.textContent = `{{${o}_${u}}}`);
36
36
  const r = e.closest("a") || (e.tagName === "A" ? e : null);
37
37
  if (r && a) {
38
- const f = r.href, d = `${window.location.href}${i}`;
39
- (f === d || f.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
38
+ const d = r.href, f = `${window.location.href}${i}`;
39
+ (d === f || d.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
40
40
  }
41
41
  break;
42
42
  }
43
43
  case "price":
44
44
  case "originalPrice": {
45
- const t = p, c = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = c === "true", r = i === "true", f = e.getAttribute("data-curency") || "before";
46
- let d;
47
- r ? d = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : d = a ? t.PRICE_FORMATTED : t.PRICE;
45
+ const t = p, o = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = o === "true", r = i === "true", d = e.getAttribute("data-curency") || "before";
46
+ let f;
47
+ r ? f = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : f = a ? t.PRICE_FORMATTED : t.PRICE;
48
48
  const s = t.CURRENCY;
49
- let _ = `{{${d}_${u}}}`;
49
+ let _ = `{{${f}_${u}}}`;
50
50
  if (s) {
51
- const H = `{{${s}_${u}}}`;
52
- _ = f === "after" ? `${_} ${H}` : `${H} ${_}`;
51
+ const k = `{{${s}_${u}}}`;
52
+ _ = d === "after" ? `${_} ${k}` : `${k} ${_}`;
53
53
  }
54
54
  e.textContent = _;
55
55
  break;
56
56
  }
57
57
  case "quantity": {
58
- const t = p, c = t.ATTR, i = t.DEFAULT;
59
- e.textContent && e.textContent.trim() === i && (e.textContent = `{{${c}_${u}}}`);
58
+ const t = p, o = t.ATTR, i = t.DEFAULT;
59
+ e.textContent && e.textContent.trim() === i && (e.textContent = `{{${o}_${u}}}`);
60
60
  break;
61
61
  }
62
62
  case "button": {
63
- const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
63
+ const t = p, o = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
64
64
  if (a) {
65
- const r = a.href || "", f = `${window.location.href}${i}`;
66
- (r === "" || r === "#" || r === f || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${c}_${u}}}`);
65
+ const r = a.href || "", d = `${window.location.href}${i}`;
66
+ (r === "" || r === "#" || r === d || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${o}_${u}}}`);
67
67
  }
68
68
  break;
69
69
  }
70
70
  case "itemLink": {
71
- const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
71
+ const t = p, o = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
72
72
  if (a.href) {
73
- const r = a.href, f = `${window.location.href}${i}`;
74
- (r === f || r.endsWith(i)) && (a.href = `{{${c}_${u}}}`);
73
+ const r = a.href, d = `${window.location.href}${i}`;
74
+ (r === d || r.endsWith(i)) && (a.href = `{{${o}_${u}}}`);
75
75
  }
76
76
  break;
77
77
  }
@@ -86,44 +86,45 @@ function P(k) {
86
86
  });
87
87
  });
88
88
  });
89
- const F = $.querySelectorAll(".ins-product-td"), S = [];
90
- F.forEach((n) => {
91
- const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", o = n.getAttribute("data-nodup"), E = n.outerHTML;
92
- S.push({
89
+ const S = R.match(/<!DOCTYPE[^>]*>/i), I = S ? `${S[0]}
90
+ ` : "", w = $.querySelectorAll(".ins-product-td"), m = [];
91
+ w.forEach((n) => {
92
+ const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", c = n.getAttribute("data-nodup"), E = n.outerHTML;
93
+ m.push({
93
94
  element: n,
94
95
  outerHtml: E,
95
96
  type: l,
96
97
  number: A,
97
- nodup: o || void 0
98
+ nodup: c || void 0
98
99
  });
99
100
  });
100
- let h = $.body.innerHTML;
101
- S.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
102
- let o = "";
101
+ let h = I + $.documentElement.outerHTML;
102
+ m.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
103
+ let c = "";
103
104
  switch (l) {
104
105
  case "CART_ITEMS":
105
- o = "ins_apr_total_product_kind";
106
+ c = "ins_apr_total_product_kind";
106
107
  break;
107
108
  case "BROWSED_ITEMS":
108
- o = "browsed_item_total_product_kind";
109
+ c = "browsed_item_total_product_kind";
109
110
  break;
110
111
  case "PURCHASED_ITEMS":
111
- o = "purchased_item_total_product_kind";
112
+ c = "purchased_item_total_product_kind";
112
113
  break;
113
114
  }
114
- if (o) {
115
- const b = parseInt(A) - 1, T = `${`{% if ${o} > ${b} %}`}${n}{% endif %}`;
116
- h = h.replace(n, T);
115
+ if (c) {
116
+ const T = parseInt(A) - 1, b = `${`{% if ${c} > ${T} %}`}${n}{% endif %}`;
117
+ h = h.replace(n, b);
117
118
  }
118
119
  });
119
- const I = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
120
- return I.forEach((n) => {
120
+ const M = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
121
+ return M.forEach((n) => {
121
122
  const l = n.getAttribute("data-number"), A = n.getAttribute("data-type");
122
123
  if (!l || A !== "CART_ITEMS")
123
124
  return;
124
- const o = n.closest(".product-original-price-class");
125
- if (o) {
126
- const E = o.outerHTML;
125
+ const c = n.closest(".product-original-price-class");
126
+ if (c) {
127
+ const E = c.outerHTML;
127
128
  g.some((C) => C.tdOuterHtml === E) || g.push({ tdOuterHtml: E, number: l });
128
129
  }
129
130
  }), g.reverse().forEach(({ tdOuterHtml: n, number: l }) => {
@@ -135,5 +136,5 @@ function P(k) {
135
136
  }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
136
137
  }
137
138
  export {
138
- P as pairProductVariables
139
+ L as pairProductVariables
139
140
  };
@@ -1,31 +1,32 @@
1
- import { useActionsApi as b } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as f } from "../composables/useHtmlCompiler.js";
3
- import { useDynamicContentStore as C } from "../stores/dynamic-content.js";
4
- import { useUnsubscribeStore as T } from "../stores/unsubscribe.js";
5
- const P = () => {
6
- const i = C(), t = T(), { getCompiledEmail: o, getTemplateData: s, editorSave: n } = b(), { compileHtml: a } = f();
1
+ import { useActionsApi as f } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
5
+ import { useUnsubscribeStore as y } from "../stores/unsubscribe.js";
6
+ const E = () => {
7
+ const o = x(), t = y(), { getCompiledEmail: i, getTemplateData: n, editorSave: s } = f(), { compileHtml: m } = C();
7
8
  return {
8
9
  prepareTemplateDetails: async () => {
9
- const { html: r, ampHtml: m = "", ampErrors: c = [] } = await o({
10
+ const { html: a, ampHtml: r = "", ampErrors: c = [] } = await i({
10
11
  minimize: !0,
11
12
  resetDataSavedFlag: !1
12
- }), { html: l, css: p, syncModulesIds: u = [] } = await s(), { compiledHtml: d, stats: e, appliedRules: g } = a(r), S = i.getSelectedDynamicContentList;
13
- return n(), console.debug("HTML Compilation Stats:", {
13
+ }), { html: l, css: p, syncModulesIds: u = [] } = await n(), { compiledHtml: d, stats: e, appliedRules: S } = m(a), g = o.getSelectedDynamicContentList, b = T();
14
+ return s(), console.debug("HTML Compilation Stats:", {
14
15
  originalSize: e.originalSize,
15
16
  compiledSize: e.compiledSize,
16
17
  reduction: `${e.reductionPercentage.toFixed(2)}%`,
17
- appliedRules: g,
18
+ appliedRules: S,
18
19
  executionTime: `${e.executionTime.toFixed(2)}ms`
19
20
  }), {
20
- dynamicContentList: S,
21
+ dynamicContentList: g,
21
22
  compiledHtml: d,
22
23
  rawHtml: l,
23
24
  css: p,
24
- ampHtml: m,
25
+ ampHtml: r,
25
26
  ampErrors: c,
26
27
  modules: u,
27
28
  recommendation: {
28
- campaignUrls: {},
29
+ campaignUrls: b.recommendationCampaignUrls,
29
30
  configs: {}
30
31
  },
31
32
  unsubscribe: {
@@ -37,5 +38,5 @@ const P = () => {
37
38
  };
38
39
  };
39
40
  export {
40
- P as useTemplatePreparation
41
+ E as useTemplatePreparation
41
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.1.0-beta.e13d291",
3
+ "version": "2.1.0-beta.e2153c2",
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",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "guido": {
87
87
  "stripo": {
88
- "version": "2.52.0"
88
+ "version": "2.54.0"
89
89
  }
90
90
  }
91
91
  }
@@ -1,79 +0,0 @@
1
- import { defineStore as s } from "pinia";
2
- import { DefaultConfigValues as e } from "../enums/settingsEnums.js";
3
- const n = (t) => t.replace(/Url\}/, "Image}"), r = (t) => t.replace(/Image\}/, "Url}"), i = () => {
4
- const t = e.cartItemsSelectControlValue;
5
- return {
6
- itemsType: e.itemsType,
7
- itemIds: t,
8
- imageLink: n(t),
9
- buttonLink: r(t),
10
- orientation: e.cardOrientationControlValue,
11
- nameTrimming: !0,
12
- hideDiscount: !0,
13
- currencySymbol: "USD",
14
- currencyLocation: "0",
15
- formattedPrice: !0,
16
- singlePrice: !1,
17
- priceOrientation: "vertical",
18
- templateData: {
19
- imageSrc: "",
20
- name: "",
21
- price: "",
22
- originalPrice: "",
23
- quantity: "",
24
- button: ""
25
- }
26
- };
27
- }, m = s("guidoItemsBlock", {
28
- state: () => i(),
29
- actions: {
30
- setItemsType(t) {
31
- this.itemsType = t;
32
- },
33
- setItemIds(t) {
34
- this.itemIds = t, this.imageLink = n(t), this.buttonLink = r(t);
35
- },
36
- setImageLink(t) {
37
- this.imageLink = t;
38
- },
39
- setButtonLink(t) {
40
- this.buttonLink = t;
41
- },
42
- setOrientation(t) {
43
- this.orientation = t;
44
- },
45
- setNameTrimming(t) {
46
- this.nameTrimming = t;
47
- },
48
- setHideDiscount(t) {
49
- this.hideDiscount = t;
50
- },
51
- setCurrencySymbol(t) {
52
- this.currencySymbol = t;
53
- },
54
- setCurrencyLocation(t) {
55
- this.currencyLocation = t;
56
- },
57
- setFormattedPrice(t) {
58
- this.formattedPrice = t;
59
- },
60
- setSinglePrice(t) {
61
- this.singlePrice = t;
62
- },
63
- setPriceOrientation(t) {
64
- this.priceOrientation = t;
65
- },
66
- setTemplateData(t) {
67
- this.templateData = t;
68
- },
69
- updateFromAttributes(t) {
70
- t.itemsType && (this.itemsType = t.itemsType), t.itemIds && this.setItemIds(t.itemIds), t.orientation && (this.orientation = t.orientation);
71
- },
72
- reset() {
73
- Object.assign(this, i());
74
- }
75
- }
76
- });
77
- export {
78
- m as useItemsBlockStore
79
- };
@@ -1,45 +0,0 @@
1
- import type { OrientationType, ProductType } from '@@/Types/extensions/items';
2
- interface ItemsBlockState {
3
- itemsType: ProductType;
4
- itemIds: string;
5
- imageLink: string;
6
- buttonLink: string;
7
- orientation: OrientationType;
8
- nameTrimming: boolean;
9
- hideDiscount: boolean;
10
- currencySymbol: string;
11
- currencyLocation: string;
12
- formattedPrice: boolean;
13
- singlePrice: boolean;
14
- priceOrientation: 'vertical' | 'horizontal';
15
- templateData: {
16
- imageSrc: string;
17
- name: string;
18
- price: string;
19
- originalPrice: string;
20
- quantity: string;
21
- button: string;
22
- };
23
- }
24
- export declare const useItemsBlockStore: import("pinia").StoreDefinition<"guidoItemsBlock", ItemsBlockState, {}, {
25
- setItemsType(itemsType: ProductType): void;
26
- setItemIds(itemIds: string): void;
27
- setImageLink(imageLink: string): void;
28
- setButtonLink(buttonLink: string): void;
29
- setOrientation(orientation: OrientationType): void;
30
- setNameTrimming(nameTrimming: boolean): void;
31
- setHideDiscount(hideDiscount: boolean): void;
32
- setCurrencySymbol(currencySymbol: string): void;
33
- setCurrencyLocation(currencyLocation: string): void;
34
- setFormattedPrice(formattedPrice: boolean): void;
35
- setSinglePrice(singlePrice: boolean): void;
36
- setPriceOrientation(priceOrientation: "vertical" | "horizontal"): void;
37
- setTemplateData(templateData: ItemsBlockState["templateData"]): void;
38
- updateFromAttributes(attributes: {
39
- itemsType?: string;
40
- itemIds?: string;
41
- orientation?: string;
42
- }): void;
43
- reset(): void;
44
- }>;
45
- export {};
@@ -1,16 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { CommonControl } from '../../common-control';
3
- /**
4
- * Control for enabling/disabling text trimming on product names
5
- * When enabled, adds a CSS class that applies text-overflow: ellipsis
6
- */
7
- export declare class NameTextTrimControl extends CommonControl {
8
- getId(): string;
9
- getTemplate(): string;
10
- onRender(): void;
11
- onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
12
- _setFormValues(): void;
13
- _getCurrentTrimState(): boolean;
14
- _onTextTrimChange(enabled: boolean): void;
15
- _listenToFormUpdates(): void;
16
- }