@useinsider/guido 3.2.0-beta.78d83bd → 3.2.0-beta.7fb9b70

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 (118) hide show
  1. package/README.md +117 -1
  2. package/dist/@types/config/schemas.js +153 -95
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +90 -88
  5. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  6. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  7. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  8. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  9. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  10. package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
  11. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  12. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  13. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  14. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  15. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  16. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  17. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  18. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  19. package/dist/composables/useAutoSave.js +71 -0
  20. package/dist/composables/useRecommendation.js +46 -26
  21. package/dist/composables/useRibbonOffset.js +21 -0
  22. package/dist/composables/useSave.js +19 -16
  23. package/dist/composables/useStripo.js +14 -16
  24. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  25. package/dist/config/compiler/recommendationCompilerRules.js +25 -25
  26. package/dist/config/compiler/utils/recommendationCompilerUtils.js +104 -71
  27. package/dist/config/migrator/index.js +9 -9
  28. package/dist/config/migrator/radioButtonMigrator.js +64 -44
  29. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  30. package/dist/config/migrator/recommendation/extractors.js +27 -0
  31. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  32. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  33. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  34. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  35. package/dist/config/migrator/recommendationMigrator.js +74 -290
  36. package/dist/enums/extensions/recommendationBlock.js +2 -1
  37. package/dist/enums/onboarding.js +7 -2
  38. package/dist/extensions/Blocks/Items/template.js +48 -46
  39. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  40. package/dist/extensions/Blocks/Recommendation/block.js +35 -32
  41. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  42. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -24
  43. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
  44. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  45. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -90
  46. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +19 -10
  47. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  48. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -15
  49. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  50. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  51. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  52. package/dist/guido.css +1 -1
  53. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +259 -235
  54. package/dist/node_modules/valibot/dist/index.js +450 -235
  55. package/dist/package.json.js +1 -1
  56. package/dist/services/templateLibraryApi.js +5 -4
  57. package/dist/src/@types/config/defaults.d.ts +5 -1
  58. package/dist/src/@types/config/index.d.ts +3 -3
  59. package/dist/src/@types/config/schemas.d.ts +217 -0
  60. package/dist/src/@types/config/types.d.ts +9 -1
  61. package/dist/src/components/Guido.vue.d.ts +1 -1
  62. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  63. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  64. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  65. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  66. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  67. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  68. package/dist/src/composables/useAutoSave.d.ts +3 -0
  69. package/dist/src/composables/useConfig.d.ts +58 -0
  70. package/dist/src/composables/useRecommendation.d.ts +10 -1
  71. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  72. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  73. package/dist/src/composables/useSave.d.ts +1 -1
  74. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  75. package/dist/src/config/migrator/index.d.ts +2 -1
  76. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  77. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  78. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  79. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  80. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  81. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  82. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  83. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  84. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  85. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  86. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  87. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  88. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  89. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  90. package/dist/src/enums/onboarding.d.ts +6 -0
  91. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  92. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  93. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  94. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  95. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  96. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  97. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  98. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  99. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  100. package/dist/src/library.d.ts +1 -1
  101. package/dist/src/stores/autosave.d.ts +12 -0
  102. package/dist/src/stores/config.d.ts +522 -0
  103. package/dist/src/stores/editor.d.ts +23 -0
  104. package/dist/src/stores/onboarding.d.ts +4 -0
  105. package/dist/src/utils/htmlEscape.d.ts +5 -0
  106. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  107. package/dist/src/utils/timeUtil.d.ts +8 -0
  108. package/dist/stores/autosave.js +17 -0
  109. package/dist/stores/editor.js +3 -1
  110. package/dist/stores/onboarding.js +4 -0
  111. package/dist/utils/htmlEscape.js +13 -0
  112. package/dist/utils/pairProductVariables.js +89 -88
  113. package/dist/utils/templatePreparation.js +72 -32
  114. package/dist/utils/timeUtil.js +19 -0
  115. package/package.json +7 -3
  116. package/dist/enums/displayConditions.js +0 -80
  117. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  118. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -1,19 +1,19 @@
1
- import { BlockType as b, BlockAttr as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { BlockType as b, BlockAttr as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { ItemsBlockId as O } from "./enums/controlEnums.js";
3
- import { productPairs as P, templateFirstLine as C } from "./enums/productEnums.js";
4
- import { ItemInCartOptions as Y, SETTINGS_ENUMS as x, DefaultConfigValues as F } from "./enums/settingsEnums.js";
3
+ import { productPairs as A, templateFirstLine as C } from "./enums/productEnums.js";
4
+ import { ItemInCartOptions as Y, SETTINGS_ENUMS as x, DefaultConfigValues as D } from "./enums/settingsEnums.js";
5
5
  import j from "./layouts/horizontal.html.js";
6
6
  import q from "./layouts/vertical.html.js";
7
7
  import { escapeReplacement as V } from "./utils/nodeConfigUtils.js";
8
- let [M] = P.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [D] = P.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [N] = P.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [m] = P.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [U] = P.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
9
- const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), L = (s) => g(s, "text-align"), A = (s, e) => {
8
+ let [g] = A.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [L] = A.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [m] = A.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [S] = A.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [M] = A.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
9
+ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), F = (s) => U(s, "text-align"), w = (s, e) => {
10
10
  const r = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), a = s.match(r);
11
11
  return a ? a[1].trim() : null;
12
12
  }, v = (s, e, r) => new RegExp(`(${e}\\s*:\\s*)[^;]+`, "gi").test(s) ? s.replace(
13
13
  new RegExp(`(${e}\\s*:\\s*)[^;]+`, "gi"),
14
14
  `$1${r}`
15
15
  ) : s, Z = (s, e, r, a) => {
16
- const i = r || F.productImageHeight, n = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
16
+ const i = r || D.productImageHeight, n = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
17
17
  return `
18
18
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
19
19
  align="center"
@@ -28,7 +28,8 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
28
28
  href="#!">
29
29
  <img class="adapt-img document-node-component ng-star-inserted"
30
30
  style="object-fit: contain;"
31
- src="${M}"
31
+ src="${g}"
32
+ alt="${L}"
32
33
  width="${i}"
33
34
  height="${i}">
34
35
  </a>
@@ -36,10 +37,11 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
36
37
  `;
37
38
  }, J = (s, e) => `
38
39
  <${b.BLOCK_IMAGE}
39
- ${S.BLOCK_IMAGE.src}="${M}"
40
- ${S.BLOCK_IMAGE.href}="#!"
41
- ${S.BLOCK_IMAGE.width}="${F.productImageWidth}"
42
- ${S.BLOCK_IMAGE.height}="${F.productImageWidth}"
40
+ ${N.BLOCK_IMAGE.src}="${g}"
41
+ ${N.BLOCK_IMAGE.alt}="${L}"
42
+ ${N.BLOCK_IMAGE.href}="#!"
43
+ ${N.BLOCK_IMAGE.width}="${D.productImageWidth}"
44
+ ${N.BLOCK_IMAGE.height}="${D.productImageWidth}"
43
45
  esd-extension-block-id="${O.IMAGE}"
44
46
  data-slot-1
45
47
  product-attr="imageSrc"
@@ -62,7 +64,7 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
62
64
  text-overflow: ellipsis;
63
65
  `;
64
66
  if (e) {
65
- const c = A(a || "", "text-align") || "center", l = L(a || o), $ = A(l, "color"), t = A(l, "font-size"), E = A(l, "font-family"), _ = A(l, "font-weight"), u = A(l, "font-style"), w = _ === "bold" || _ === "700", p = u === "italic", R = [
67
+ const c = w(a || "", "text-align") || "center", l = F(a || o), $ = w(l, "color"), t = w(l, "font-size"), E = w(l, "font-family"), _ = w(l, "font-weight"), u = w(l, "font-style"), P = _ === "bold" || _ === "700", p = u === "italic", R = [
66
68
  $ ? `color: ${$}` : "",
67
69
  t ? `font-size: ${t}` : "",
68
70
  E ? `font-family: ${E}` : ""
@@ -72,17 +74,17 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
72
74
  "font-size",
73
75
  "inherit"
74
76
  );
75
- d = g(d, "font-weight"), d = g(d, "font-style");
77
+ d = U(d, "font-weight"), d = U(d, "font-style");
76
78
  const T = (i == null ? void 0 : i.nameVisible) === !1 ? "display: none;" : "display: table-cell;";
77
- let I = `<a
79
+ let h = `<a
78
80
  href="#!"
79
81
  style="${d}"
80
82
  product-attr="name"
81
83
  data-slot-2
82
84
  width="100%">
83
- ${D}
85
+ ${L}
84
86
  </a>`;
85
- return w && (I = `<strong>${I}</strong>`), p && (I = `<em>${I}</em>`), `
87
+ return P && (h = `<strong>${h}</strong>`), p && (h = `<em>${h}</em>`), `
86
88
  <td class="esd-block-text es-p10"
87
89
  align="${c}"
88
90
  width="100%"
@@ -90,7 +92,7 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
90
92
  esd-extension-block-id="${O.NAME}"
91
93
  style="${T}">
92
94
  <p contenteditable="false" path="1"${R ? ` style="${R}"` : ""}>
93
- ${I}
95
+ ${h}
94
96
  </p>
95
97
  </td>
96
98
  `;
@@ -122,26 +124,26 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
122
124
  product-attr="name"
123
125
  data-slot-2
124
126
  width="100%">
125
- ${D}
127
+ ${L}
126
128
  </a>
127
129
  </p>
128
130
  </${b.BLOCK_TEXT}>
129
131
  `;
130
132
  }, et = (s, e, r, a, i, n, o, c, l, $) => {
131
- let t = N;
133
+ let t = m;
132
134
  if (a && a.trim()) {
133
135
  const T = `${a.trim()}`;
134
- t = (i || "0") === "1" ? `${N}&nbsp;${T}` : `${T}&nbsp;${N}`;
136
+ t = (i || "0") === "1" ? `${m}&nbsp;${T}` : `${T}&nbsp;${m}`;
135
137
  }
136
- const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, w = a ? `data-currency_symbol="${a}"` : "", p = `data-single_price="${c ? "true" : "false"}"`, d = l === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
138
+ const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, P = a ? `data-currency_symbol="${a}"` : "", p = `data-single_price="${c ? "true" : "false"}"`, d = l === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
137
139
  if (n) {
138
- const h = L(o || "color: #060606; white-space: nowrap; font-size: 20px;"), I = $ ? "" : ' style="display: none;"';
140
+ const I = F(o || "color: #060606; white-space: nowrap; font-size: 20px;"), h = $ ? "" : ' style="display: none;"';
139
141
  return `
140
142
  <td class="esd-block-text items-block-price${d}"
141
143
  align="center"
142
144
  esd-extension-block-id="${O.PRICE}"
143
145
  width="100%"
144
- ${I}>
146
+ ${h}>
145
147
  <p product-attr="price"
146
148
  contenteditable="false"
147
149
  data-slot-4
@@ -149,9 +151,9 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
149
151
  data-number="${e}"
150
152
  ${_}
151
153
  ${u}
152
- ${w}
154
+ ${P}
153
155
  ${p}
154
- style="${h}">
156
+ style="${I}">
155
157
  ${t}
156
158
  </p>
157
159
  </td>`;
@@ -179,19 +181,19 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
179
181
  </${b.BLOCK_TEXT}>
180
182
  `;
181
183
  }, at = (s, e, r, a, i, n, o = !0, c, l, $) => {
182
- let t = m;
184
+ let t = S;
183
185
  if (a && a.trim()) {
184
186
  const T = `${a.trim()}`;
185
- t = (i || "0") === "1" ? `${m}&nbsp;${T}` : `${T}&nbsp;${m}`;
187
+ t = (i || "0") === "1" ? `${S}&nbsp;${T}` : `${T}&nbsp;${S}`;
186
188
  }
187
- const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, w = o ? "" : ' style="display: none;"', p = `data-single_price="${l ? "true" : "false"}"`, d = $ === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
189
+ const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, P = o ? "" : ' style="display: none;"', p = `data-single_price="${l ? "true" : "false"}"`, d = $ === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
188
190
  if (n) {
189
- const h = L(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
191
+ const I = F(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
190
192
  return `
191
193
  <td class="esd-block-text items-block-price${d}"
192
194
  esd-extension-block-id="${O.ORIGINAL_PRICE}"
193
195
  width="100%"
194
- align="center"${w}>
196
+ align="center"${P}>
195
197
  <p
196
198
  product-attr="originalPrice"
197
199
  contenteditable="false"
@@ -202,7 +204,7 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
202
204
  ${u}
203
205
  ${a ? `data-currency_symbol="${a}"` : ""}
204
206
  ${p}
205
- style="${h}">
207
+ style="${I}">
206
208
  <s>${t}</s>
207
209
  </p>
208
210
  </td>
@@ -235,7 +237,7 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
235
237
  }, st = (s = !0, e, r) => {
236
238
  const a = s ? "" : 'style="display: none;"';
237
239
  if (e) {
238
- const i = "font-size: 14px;", n = A(r || "", "text-align") || "center", o = L(r || i);
240
+ const i = "font-size: 14px;", n = w(r || "", "text-align") || "center", o = F(r || i);
239
241
  return `
240
242
  <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
241
243
  width="100%" align="${n}"
@@ -247,7 +249,7 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
247
249
  width="100%"
248
250
  path="1"
249
251
  style="${o}">
250
- ${U}
252
+ ${M}
251
253
  </p>
252
254
  </td>`;
253
255
  }
@@ -264,13 +266,13 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
264
266
  data-slot-3
265
267
  contenteditable="false"
266
268
  width="100%">
267
- ${U}
269
+ ${M}
268
270
  </p>
269
271
  </${b.BLOCK_TEXT}>
270
272
  `;
271
273
  }, lt = (s, e, r = "Buy", a, i, n = !0, o = !0) => {
272
274
  if (a) {
273
- const c = A(i || "", "background") || A(i || "", "background-color"), l = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", $ = n ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
275
+ const c = w(i || "", "background") || w(i || "", "background-color"), l = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", $ = n ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
274
276
  return `
275
277
  <td class="esd-block-button ins-button default-block-component selectable"
276
278
  align="center" width="100%" name="buy-button" caption="${r}"
@@ -326,10 +328,10 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
326
328
  }, it = (s) => s ? `<td align="center"
327
329
  esd-extension-block-id="items-block" width="560"
328
330
  data-number="4"
329
- class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : C, z = (s, e, r, a, i, n, o, c, l, $, t, E, _, u = "horizontal", w, p, R, d) => {
330
- const I = `${`data-type="${e}" data-number="${r}"`} data-orientation="${a}"`, y = s.replace(
331
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : C, z = (s, e, r, a, i, n, o, c, l, $, t, E, _, u = "horizontal", P, p, R, d) => {
332
+ const h = `${`data-type="${e}" data-number="${r}"`} data-orientation="${a}"`, y = s.replace(
331
333
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
332
- `<td$1 ${I}>`
334
+ `<td$1 ${h}>`
333
335
  ), X = l == null ? void 0 : l["data-product_image_control_image-height"], G = n ? Z(e, r, X, t) : J(e, r), K = (t == null ? void 0 : t.buttonLabel) || "Buy", B = (t == null ? void 0 : t.buttonFullWidth) !== void 0 ? t.buttonFullWidth : !0, W = e === x.ITEMS_TYPE.BROWSED_ITEMS ? !1 : t == null ? void 0 : t.quantityControlEnabled, Q = (t == null ? void 0 : t.buttonVisible) !== void 0 ? t.buttonVisible : (l == null ? void 0 : l["data-product_button_control_enabled"]) !== "false", k = (t == null ? void 0 : t.priceVisible) !== void 0 ? t.priceVisible : (l == null ? void 0 : l["data-product_price_control_enabled"]) !== "false", f = (t == null ? void 0 : t.originalPriceVisible) !== void 0 ? t.originalPriceVisible : (l == null ? void 0 : l["data-product_original_price_control_enabled"]) !== "false", H = y.replace("{-{-TEMPLATE_FIRST_LINE-}-}", it(n)).replace("{-{-PRODUCT_IMAGE-}-}", G).replace("{-{-PRODUCT_NAME-}-}", tt(e, n, a, E, t)).replaceAll(
334
336
  "{-{-PRODUCT_PRICE-}-}",
335
337
  V(et(
@@ -339,7 +341,7 @@ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
339
341
  o,
340
342
  c,
341
343
  n,
342
- w,
344
+ P,
343
345
  d,
344
346
  a,
345
347
  k
@@ -385,7 +387,7 @@ function Tt({
385
387
  priceStyles: E,
386
388
  originalPriceStyles: _,
387
389
  quantityStyles: u,
388
- priceOrientation: w
390
+ priceOrientation: P
389
391
  }) {
390
392
  const p = Y[e].findIndex((y) => y.value === r);
391
393
  let R = "1";
@@ -396,10 +398,10 @@ function Tt({
396
398
  y && y[1] && ([, R] = y);
397
399
  }
398
400
  const d = (l == null ? void 0 : l.priceSinglePrice) ?? (c == null ? void 0 : c["data-product_price_control_single_price"]) === "1" ?? !1;
399
- M = P.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[p >= 0 ? p : 0], D = P.PAIRS_FOR_EXTENSION.name[e].DEFAULT[p >= 0 ? p : 0];
400
- const T = P.PAIRS_FOR_EXTENSION.price[e], h = P.PAIRS_FOR_EXTENSION.originalPrice[e];
401
- d ? (N = o ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE, m = o ? h.DEFAULT_SINGLE_PRICE_FORMATTED : h.DEFAULT_SINGLE_PRICE) : (N = o ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE, m = o ? h.DEFAULT_PRICE_FORMATTED : h.DEFAULT_PRICE), U = P.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
402
- const I = w || (l == null ? void 0 : l.priceOrientation) || "horizontal";
401
+ g = A.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[p >= 0 ? p : 0], L = A.PAIRS_FOR_EXTENSION.name[e].DEFAULT[p >= 0 ? p : 0];
402
+ const T = A.PAIRS_FOR_EXTENSION.price[e], I = A.PAIRS_FOR_EXTENSION.originalPrice[e];
403
+ d ? (m = o ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE, S = o ? I.DEFAULT_SINGLE_PRICE_FORMATTED : I.DEFAULT_SINGLE_PRICE) : (m = o ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE, S = o ? I.DEFAULT_PRICE_FORMATTED : I.DEFAULT_PRICE), M = A.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
404
+ const h = P || (l == null ? void 0 : l.priceOrientation) || "horizontal";
403
405
  return s === x.ORIENTATION.VERTICAL ? z(
404
406
  q,
405
407
  e,
@@ -415,7 +417,7 @@ function Tt({
415
417
  l,
416
418
  $,
417
419
  t,
418
- I,
420
+ h,
419
421
  E,
420
422
  _,
421
423
  u,
@@ -435,7 +437,7 @@ function Tt({
435
437
  l,
436
438
  $,
437
439
  t,
438
- I,
440
+ h,
439
441
  E,
440
442
  _,
441
443
  u,
@@ -119,7 +119,7 @@ const e = {
119
119
  id="radioYes"
120
120
  name="unsubscribe"
121
121
  data-cke-editable="1"
122
- style="margin: 0px; vertical-align: middle;>
122
+ style="margin: 0px; vertical-align: middle;">
123
123
  </td>
124
124
  {-{-YES-}-}
125
125
  </tr>
@@ -1,15 +1,15 @@
1
- var k = Object.defineProperty;
2
- var I = (r, n, t) => n in r ? k(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
- var u = (r, n, t) => I(r, typeof n != "symbol" ? n + "" : n, t);
4
- import { BlockId as B } from "../../../enums/block.js";
5
- import { getMigrationBannerHtml as _ } from "../../../utils/migrationBannerHtml.js";
1
+ var I = Object.defineProperty;
2
+ var k = (r, n, t) => n in r ? I(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var u = (r, n, t) => k(r, typeof n != "symbol" ? n + "" : n, t);
4
+ import { BlockId as _ } from "../../../enums/block.js";
5
+ import { getMigrationBannerHtml as B } from "../../../utils/migrationBannerHtml.js";
6
6
  import { Block as b, BlockCompositionType as R, ModificationDescription as y } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
7
  import { regenerateMobileProductRows as C } from "./controls/main/utils.js";
8
8
  import { ensureMobileCssRulesExist as g, setMobileLayoutOptOut as d, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
9
9
  import { RecommendationConfigService as c } from "./services/configService.js";
10
10
  import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
11
11
  import { getDefaultTemplate as E } from "./templates/grid/template.js";
12
- const f = B.Recommendation, a = "recommendation-block-v2", l = "recommendation-id";
12
+ const f = _.Recommendation, l = "recommendation-block-v2", m = "recommendation-id";
13
13
  let h = !1;
14
14
  class q extends b {
15
15
  constructor() {
@@ -38,7 +38,7 @@ class q extends b {
38
38
  );
39
39
  }
40
40
  getSettingsPanelTitleHtml() {
41
- return _(
41
+ return B(
42
42
  f,
43
43
  this.api.translate("Recommendation Block"),
44
44
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
@@ -66,15 +66,18 @@ class q extends b {
66
66
  * @param node - The newly created block node
67
67
  */
68
68
  onCreated(t) {
69
- const e = this._pendingBlockId ?? this._generateNextId();
70
- this._pendingBlockId = null, this._assignRecommendationId(t, e);
71
- const o = c.initializeConfig(this.api, t, { recommendationId: e }), i = p();
72
- i.setCurrentBlock(e), g(this.api);
73
- const s = this._getBlockElement(t);
74
- s && (d(this.api, s, !0), C({
69
+ const e = this._getRecommendationId(t);
70
+ if (e !== null && e > 0)
71
+ return;
72
+ const i = this._pendingBlockId ?? this._generateNextId();
73
+ this._pendingBlockId = null, this._assignRecommendationId(t, i);
74
+ const o = c.initializeConfig(this.api, t, { recommendationId: i }), s = p();
75
+ s.setCurrentBlock(i), g(this.api);
76
+ const a = this._getBlockElement(t);
77
+ a && (d(this.api, a, !0), C({
75
78
  currentNode: t,
76
79
  documentModifier: this.api.getDocumentModifier()
77
- })), i.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
80
+ })), s.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
78
81
  }
79
82
  /**
80
83
  * Called when the document changes or template is loaded
@@ -97,10 +100,10 @@ class q extends b {
97
100
  c.needsMigration(t) && this._migrateFromLegacy(t);
98
101
  try {
99
102
  h || (g(this.api), h = !0);
100
- const e = c.getConfig(t), o = this._getBlockElement(t);
101
- if (o) {
102
- const i = !e.mobileLayoutEnabled;
103
- A(o) !== i && d(this.api, o, i);
103
+ const e = c.getConfig(t), i = this._getBlockElement(t);
104
+ if (i) {
105
+ const o = !e.mobileLayoutEnabled;
106
+ A(i) !== o && d(this.api, i, o);
104
107
  }
105
108
  } catch {
106
109
  }
@@ -124,10 +127,10 @@ class q extends b {
124
127
  let t = 0;
125
128
  try {
126
129
  const e = this.api.getDocumentRoot();
127
- e && "querySelectorAll" in e && e.querySelectorAll(`.${a}`).forEach((i) => {
128
- if ("getAttribute" in i) {
129
- const s = i.getAttribute(l), m = s ? parseInt(s) : 0;
130
- m > t && (t = m);
130
+ e && "querySelectorAll" in e && e.querySelectorAll(`.${l}`).forEach((o) => {
131
+ if ("getAttribute" in o) {
132
+ const s = o.getAttribute(m), a = s ? parseInt(s) : 0;
133
+ a > t && (t = a);
131
134
  }
132
135
  });
133
136
  } catch {
@@ -141,11 +144,11 @@ class q extends b {
141
144
  * added classes via setAttribute.
142
145
  */
143
146
  _assignRecommendationId(t, e) {
144
- const o = this._getBlockElement(t);
145
- if (!o)
147
+ const i = this._getBlockElement(t);
148
+ if (!i)
146
149
  return;
147
- const i = this.api.getDocumentModifier();
148
- i.modifyHtml(o).setAttribute(l, e.toString()), i.apply(new y(`Assign recommendation ID ${e}`));
150
+ const o = this.api.getDocumentModifier();
151
+ o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new y(`Assign recommendation ID ${e}`));
149
152
  }
150
153
  /**
151
154
  * Gets the recommendation-id from a block node
@@ -154,11 +157,11 @@ class q extends b {
154
157
  const e = this._getBlockElement(t);
155
158
  if (!e || !("getAttribute" in e))
156
159
  return null;
157
- const o = e.getAttribute(l);
158
- if (!o)
160
+ const i = e.getAttribute(m);
161
+ if (!i)
159
162
  return null;
160
- const i = parseInt(o);
161
- return Number.isNaN(i) ? null : i;
163
+ const o = parseInt(i);
164
+ return Number.isNaN(o) ? null : o;
162
165
  }
163
166
  /**
164
167
  * Gets the block element (the element with BLOCK_CLASS)
@@ -166,10 +169,10 @@ class q extends b {
166
169
  _getBlockElement(t) {
167
170
  if ("getAttribute" in t) {
168
171
  const e = t.getAttribute("class");
169
- if (e && e.includes(a))
172
+ if (e && e.includes(l))
170
173
  return t;
171
174
  }
172
- return "querySelector" in t ? t.querySelector(`.${a}`) ?? null : null;
175
+ return "querySelector" in t ? t.querySelector(`.${l}`) ?? null : null;
173
176
  }
174
177
  /**
175
178
  * Migrate configuration from legacy format
@@ -1,4 +1,4 @@
1
- import { DEFAULT_MOBILE_ROW_SPACING as R, DEFAULT_MOBILE_COLUMN_SPACING as U, DEFAULT_ROW_SPACING as i, DEFAULT_COLUMN_SPACING as s, DEFAULT_MOBILE_CARDS_IN_ROW as o, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
1
+ import { DEFAULT_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as U, DEFAULT_MOBILE_ROW_SPACING as i, DEFAULT_MOBILE_COLUMN_SPACING as s, DEFAULT_MOBILE_CARDS_IN_ROW as o, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
2
2
  import { ATTR_PRODUCT_IMAGE as _, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as t, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as n } from "./selectors.js";
3
3
  const O = {
4
4
  code: "USD",
@@ -44,10 +44,10 @@ const O = {
44
44
  mobileCardsInRow: o,
45
45
  mobileLayoutEnabled: !1,
46
46
  previousMobileCardsInRow: o,
47
- columnSpacing: s,
48
- rowSpacing: i,
49
- mobileColumnSpacing: U,
50
- mobileRowSpacing: R,
47
+ columnSpacing: R,
48
+ rowSpacing: U,
49
+ mobileColumnSpacing: s,
50
+ mobileRowSpacing: i,
51
51
  // Composition
52
52
  composition: a,
53
53
  visibility: E,
@@ -1,22 +1,23 @@
1
- var l = Object.defineProperty;
2
- var c = (s, i, t) => i in s ? l(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
3
- var a = (s, i, t) => c(s, typeof i != "symbol" ? i + "" : i, t);
1
+ var c = Object.defineProperty;
2
+ var l = (s, o, t) => o in s ? c(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
3
+ var a = (s, o, t) => l(s, typeof o != "symbol" ? o + "" : o, t);
4
4
  import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as d } from "../../../common-control.js";
6
6
  import { RecommendationConfigService as n } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
8
- const g = "recommendation-algorithm-control", e = {
8
+ import { mapLegacyStrategy as g } from "../../utils/legacyStrategyMap.js";
9
+ const u = "recommendation-algorithm-control", i = {
9
10
  ALGORITHM: "strategy",
10
11
  PRODUCT_IDS: "productIds"
11
12
  };
12
- class T extends d {
13
+ class R extends d {
13
14
  constructor() {
14
15
  super(...arguments);
15
16
  // Store is used ONLY for API-fetched data (algorithms list), not for config
16
17
  a(this, "store", m());
17
18
  }
18
19
  getId() {
19
- return g;
20
+ return u;
20
21
  }
21
22
  getTemplate() {
22
23
  return `
@@ -24,13 +25,13 @@ class T extends d {
24
25
  ${this._GuTwoColumns([
25
26
  this._GuLabel({ text: this.api.translate("Recommendation Algorithm") }),
26
27
  this._GuSelect({
27
- name: e.ALGORITHM,
28
+ name: i.ALGORITHM,
28
29
  placeholder: this.api.translate("Select Recommendation Algorithm"),
29
30
  options: this.store.getActivePredictiveAlgorithms
30
31
  }),
31
- this._GuLabel({ text: this.api.translate("Product Ids"), name: `${e.PRODUCT_IDS}_label` }),
32
+ this._GuLabel({ text: this.api.translate("Product Ids"), name: `${i.PRODUCT_IDS}_label` }),
32
33
  this._GuTextInput({
33
- name: e.PRODUCT_IDS,
34
+ name: i.PRODUCT_IDS,
34
35
  placeholder: this.api.translate("Enter Product Ids"),
35
36
  className: "es-180w"
36
37
  })
@@ -45,19 +46,19 @@ class T extends d {
45
46
  super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
46
47
  }
47
48
  _setFormValues() {
48
- const t = n.getConfig(this.currentNode);
49
- this._setProductIdsVisibility(t.strategy), this.api.updateValues({
50
- [e.ALGORITHM]: t.strategy,
51
- [e.PRODUCT_IDS]: t.productIds.join(",")
49
+ const t = n.getConfig(this.currentNode), e = g(t.strategy) ?? t.strategy;
50
+ this._setProductIdsVisibility(e), this.api.updateValues({
51
+ [i.ALGORITHM]: e,
52
+ [i.PRODUCT_IDS]: t.productIds.join(",")
52
53
  });
53
54
  }
54
55
  _initializeSelectItems() {
55
- var o;
56
- const t = (o = this.store) == null ? void 0 : o.getActivePredictiveAlgorithms;
56
+ var e;
57
+ const t = (e = this.store) == null ? void 0 : e.getActivePredictiveAlgorithms;
57
58
  if (t != null && t.length)
58
59
  try {
59
60
  this.api.setUIEAttribute(
60
- e.ALGORITHM,
61
+ i.ALGORITHM,
61
62
  h.SELECTPICKER.items,
62
63
  t
63
64
  );
@@ -67,7 +68,7 @@ class T extends d {
67
68
  }
68
69
  _setProductIdsVisibility(t) {
69
70
  const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
70
- this.api.setVisibility(e.PRODUCT_IDS, r), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, r);
71
+ this.api.setVisibility(i.PRODUCT_IDS, r), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, r);
71
72
  }
72
73
  _onAlgorithmChange(t) {
73
74
  !this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
@@ -80,23 +81,23 @@ class T extends d {
80
81
  _onProductIdsChange(t) {
81
82
  if (!this.currentNode)
82
83
  return;
83
- const o = t.split(",").map((r) => r.trim()).filter(Boolean);
84
+ const e = t.split(",").map((r) => r.trim()).filter(Boolean);
84
85
  n.updateConfig(
85
86
  this.api,
86
87
  this.currentNode,
87
- { productIds: o },
88
+ { productIds: e },
88
89
  "Updated product IDs"
89
- ), this.store.patchCurrentBlockConfig({ productIds: o });
90
+ ), this.store.patchCurrentBlockConfig({ productIds: e });
90
91
  }
91
92
  _listenToFormUpdates() {
92
- this.api.onValueChanged(e.ALGORITHM, (t) => {
93
+ this.api.onValueChanged(i.ALGORITHM, (t) => {
93
94
  this._onAlgorithmChange(t);
94
- }), this.api.onValueChanged(e.PRODUCT_IDS, (t) => {
95
+ }), this.api.onValueChanged(i.PRODUCT_IDS, (t) => {
95
96
  this._onProductIdsChange(t);
96
97
  });
97
98
  }
98
99
  }
99
100
  export {
100
- g as ALGORITHM_CONTROL_ID,
101
- T as AlgorithmControl
101
+ u as ALGORITHM_CONTROL_ID,
102
+ R as AlgorithmControl
102
103
  };