@useinsider/guido 3.18.2-beta.45f708c → 3.18.2-beta.4d2b065

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +21 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +72 -70
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -9
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -66
  7. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  8. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  9. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +40 -24
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -26
  11. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  12. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  13. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +3 -3
  14. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +20 -21
  15. package/dist/composables/useCustomInterfaceAppearance.js +47 -53
  16. package/dist/composables/useHtmlValidator.js +79 -84
  17. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  18. package/dist/composables/useRecommendation.js +35 -40
  19. package/dist/composables/useStripo.js +30 -30
  20. package/dist/enums/extensions/recommendationBlock.js +41 -39
  21. package/dist/extensions/Blocks/Recommendation/block.js +39 -43
  22. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
  23. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +80 -84
  24. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +94 -82
  25. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +97 -96
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +144 -179
  27. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  28. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +16 -26
  29. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
  30. package/dist/guido.css +1 -1
  31. package/dist/services/recommendationApi.js +46 -37
  32. package/dist/src/@types/config/schemas.d.ts +16 -0
  33. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  34. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  35. package/dist/src/composables/useConfig.d.ts +4 -0
  36. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  37. package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -3
  38. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -8
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -7
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +70 -76
  44. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  45. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
  46. package/dist/src/services/recommendationApi.d.ts +2 -1
  47. package/dist/src/stores/config.d.ts +322 -0
  48. package/dist/src/stores/onboarding.d.ts +421 -0
  49. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  50. package/dist/static/assets/icons/line-info.svg.js +5 -0
  51. package/dist/static/styles/components/recommendation-strategy.css.js +74 -39
  52. package/dist/stores/config.js +74 -60
  53. package/dist/stores/onboarding.js +6 -1
  54. package/dist/utils/templatePreparation.js +55 -55
  55. package/package.json +5 -5
  56. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +0 -24
  57. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +0 -14
  58. package/dist/static/styles/components/skeleton.css.js +0 -23
@@ -87,21 +87,21 @@ function j(e, t = {}) {
87
87
  documentModifier: o,
88
88
  products: r,
89
89
  layout: s,
90
- composition: l
90
+ composition: i
91
91
  } = e;
92
92
  if (!n || !("querySelector" in n))
93
93
  return !1;
94
- const u = s ?? P(n), i = y.getConfig(n);
95
- if (u === "list" || !i.mobileLayoutEnabled)
94
+ const u = s ?? P(n), l = y.getConfig(n);
95
+ if (u === "list" || !l.mobileLayoutEnabled)
96
96
  return te({ currentNode: n, documentModifier: o });
97
- const c = A(), a = $(r, c.recommendationProducts), f = l ?? U(n, c.filterList), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${k(a, u, {
98
- productsPerRow: i.mobileCardsInRow,
99
- composition: f,
97
+ const c = A(), f = $(r, c.recommendationProducts), a = i ?? U(n, c.filterList), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${k(f, u, {
98
+ productsPerRow: l.mobileCardsInRow,
99
+ composition: a,
100
100
  filterList: c.filterList,
101
- priceInline: !i.priceMovedToNextLine,
101
+ priceInline: !l.priceMovedToNextLine,
102
102
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
103
- cellPadding: v(i.mobileColumnSpacing),
104
- rowSpacingPx: i.mobileRowSpacing,
103
+ cellPadding: v(l.mobileColumnSpacing),
104
+ rowSpacingPx: l.mobileRowSpacing,
105
105
  ...t
106
106
  })}</table></td>`, E = n.querySelector(w);
107
107
  return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (re(n, o, p), !1);
@@ -115,17 +115,17 @@ function ie(e, t = {}) {
115
115
  documentModifier: o,
116
116
  products: r,
117
117
  layout: s,
118
- composition: l
118
+ composition: i
119
119
  } = e;
120
120
  if (!n || !("querySelector" in n))
121
121
  return !1;
122
122
  const u = n.querySelector(L) ?? n.querySelector(W);
123
123
  if (!u)
124
124
  return !1;
125
- const i = A(), c = $(r, i.recommendationProducts), { cardsInRow: a } = y.getConfig(n), f = l ?? U(n, i.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
126
- productsPerRow: a,
127
- composition: f,
128
- filterList: i.filterList,
125
+ const l = A(), c = $(r, l.recommendationProducts), { cardsInRow: f } = y.getConfig(n), a = i ?? U(n, l.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
126
+ productsPerRow: f,
127
+ composition: a,
128
+ filterList: l.filterList,
129
129
  priceInline: !p.priceMovedToNextLine,
130
130
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
131
131
  cellPadding: v(p.columnSpacing),
@@ -151,14 +151,14 @@ function ce(e, t, n) {
151
151
  const r = o.getAttribute(R);
152
152
  if (!r)
153
153
  return !1;
154
- const s = A(), l = r.split(",").filter(Boolean), u = D(l, o, s.filterList), i = [], c = u.join(",") !== l.join(",");
155
- c && i.push([R, u.join(",")]);
156
- const a = le(
154
+ const s = A(), i = r.split(",").filter(Boolean), u = D(i, o, s.filterList), l = [], c = u.join(",") !== i.join(",");
155
+ c && l.push([R, u.join(",")]);
156
+ const f = le(
157
157
  o.getAttribute(q)
158
- ), f = a && z(a, o, s.filterList);
159
- if (a && f && f.join(",") !== a.join(",") && i.push([q, JSON.stringify(f)]), i.length === 0)
158
+ ), a = f && z(f, o, s.filterList);
159
+ if (f && a && a.join(",") !== f.join(",") && l.push([q, JSON.stringify(a)]), l.length === 0)
160
160
  return !1;
161
- if (i.forEach(([d, p]) => {
161
+ if (l.forEach(([d, p]) => {
162
162
  t.modifyHtml(o).setAttribute(d, p);
163
163
  }), c && y.hasConfig(e)) {
164
164
  const d = {
@@ -176,20 +176,21 @@ function Te(e) {
176
176
  afterRegenerate: o,
177
177
  products: r,
178
178
  layout: s,
179
- composition: l,
180
- skipStylePreservation: u
179
+ composition: i,
180
+ skipStylePreservation: u,
181
+ forceApply: l = !1
181
182
  } = e;
182
183
  if (!t)
183
- return !1;
184
- const i = u ? {} : x(t), c = {
184
+ return;
185
+ const c = u ? {} : x(t), f = {
185
186
  currentNode: t,
186
187
  documentModifier: n,
187
188
  products: r,
188
189
  layout: s,
189
- composition: l
190
+ composition: i
190
191
  };
191
- let a = ie(c, i);
192
- return a = j(c, i) || a, a && (ce(t, n, l), n.apply(new S("Regenerate products with styles"))), o == null || o(), a;
192
+ let a = ie(f, c);
193
+ a = j(f, c) || a, a && ce(t, n, i), (a || l) && n.apply(new S("Regenerate products with styles")), o == null || o();
193
194
  }
194
195
  function Re(e, t) {
195
196
  return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...H(t - e.length)];
@@ -213,28 +214,28 @@ function T(e, t = "price") {
213
214
  });
214
215
  }
215
216
  function ue(e) {
216
- var s, l;
217
- const t = F(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((l = e.price) == null ? void 0 : l[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
217
+ var s, i;
218
+ const t = F(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((i = e.price) == null ? void 0 : i[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
218
219
  return r > 0 ? `-${r}%` : "0%";
219
220
  }
220
221
  function K(e) {
221
- const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: l } = e;
222
+ const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = e;
222
223
  let u = !1;
223
224
  if (o && "querySelector" in o) {
224
- const i = o.querySelector("strong") ?? o.querySelector("p"), c = T(n, "price");
225
- b(t, i ?? null, c) && (u = !0);
225
+ const l = o.querySelector("strong") ?? o.querySelector("p"), c = T(n, "price");
226
+ b(t, l ?? null, c) && (u = !0);
226
227
  }
227
228
  if (r && "querySelector" in r) {
228
- const i = r.querySelector("strong") ?? r.querySelector("p"), c = T(n, "original_price");
229
- b(t, i ?? null, c) && (u = !0), t.modifyHtml(r).setAttribute("data-same-price", String(Q(n))), u = !0;
229
+ const l = r.querySelector("strong") ?? r.querySelector("p"), c = T(n, "original_price");
230
+ b(t, l ?? null, c) && (u = !0), t.modifyHtml(r).setAttribute("data-same-price", String(Q(n))), u = !0;
230
231
  }
231
232
  if (s && "querySelector" in s) {
232
- const i = s.querySelector(".omnibus-price-value") ?? null, c = T(n, "original_price");
233
- b(t, i, c) && (u = !0);
233
+ const l = s.querySelector(".omnibus-price-value") ?? null, c = T(n, "original_price");
234
+ b(t, l, c) && (u = !0);
234
235
  }
235
- if (l && "querySelector" in l) {
236
- const i = l.querySelector(".omnibus-discount-value") ?? null, c = ue(n);
237
- b(t, i, c) && (u = !0);
236
+ if (i && "querySelector" in i) {
237
+ const l = i.querySelector(".omnibus-discount-value") ?? null, c = ue(n);
238
+ b(t, l, c) && (u = !0);
238
239
  }
239
240
  return u;
240
241
  }
@@ -245,34 +246,34 @@ function se(e) {
245
246
  imageEl: o,
246
247
  nameEl: r,
247
248
  priceEl: s,
248
- oldPriceEl: l,
249
+ oldPriceEl: i,
249
250
  omnibusPriceEl: u,
250
- omnibusDiscountEl: i,
251
+ omnibusDiscountEl: l,
251
252
  buttonEl: c
252
253
  } = e;
253
- let a = !1;
254
+ let f = !1;
254
255
  if (o && "querySelector" in o) {
255
- const f = o.querySelector("img");
256
- f && (t.modifyHtml(f).setAttribute("src", X(n.image_url)).setAttribute("alt", n.name), a = !0);
256
+ const a = o.querySelector("img");
257
+ a && (t.modifyHtml(a).setAttribute("src", X(n.image_url)).setAttribute("alt", n.name), f = !0);
257
258
  const d = o.querySelector("a");
258
- d && (t.modifyHtml(d).setAttribute("href", n.url), a = !0);
259
+ d && (t.modifyHtml(d).setAttribute("href", n.url), f = !0);
259
260
  }
260
261
  if (r && "querySelector" in r) {
261
- const f = r.querySelector("strong") ?? r.querySelector("p");
262
- b(t, f ?? null, n.name) && (a = !0);
262
+ const a = r.querySelector("strong") ?? r.querySelector("p");
263
+ b(t, a ?? null, n.name) && (f = !0);
263
264
  }
264
265
  if (K({
265
266
  documentModifier: t,
266
267
  product: n,
267
268
  priceEl: s,
268
- oldPriceEl: l,
269
+ oldPriceEl: i,
269
270
  omnibusPriceEl: u,
270
- omnibusDiscountEl: i
271
- }) && (a = !0), c && "querySelector" in c) {
272
- const f = c.querySelector("a.es-button") || c.querySelector("a");
273
- f && (t.modifyHtml(f).setAttribute("href", n.url), a = !0);
271
+ omnibusDiscountEl: l
272
+ }) && (f = !0), c && "querySelector" in c) {
273
+ const a = c.querySelector("a.es-button") || c.querySelector("a");
274
+ a && (t.modifyHtml(a).setAttribute("href", n.url), f = !0);
274
275
  }
275
- return a;
276
+ return f;
276
277
  }
277
278
  function V(e) {
278
279
  return "querySelector" in e ? e.querySelector(L) ?? e : e;
@@ -296,26 +297,26 @@ function fe(e, t, n) {
296
297
  if (o.length === 0)
297
298
  return !1;
298
299
  const r = /* @__PURE__ */ new Map();
299
- o.forEach((l) => {
300
- if (!("getAttribute" in l))
300
+ o.forEach((i) => {
301
+ if (!("getAttribute" in i))
301
302
  return;
302
- const u = l.getAttribute(Y);
303
+ const u = i.getAttribute(Y);
303
304
  if (!u)
304
305
  return;
305
- const i = r.get(u) ?? [];
306
- i.push(l), r.set(u, i);
306
+ const l = r.get(u) ?? [];
307
+ l.push(i), r.set(u, l);
307
308
  });
308
309
  let s = !1;
309
- return r.forEach((l, u) => {
310
- const i = Math.min(l.length, n.length);
311
- l.slice(0, i).forEach((c, a) => {
310
+ return r.forEach((i, u) => {
311
+ const l = Math.min(i.length, n.length);
312
+ i.slice(0, l).forEach((c, f) => {
312
313
  if (!("querySelector" in c))
313
314
  return;
314
- const f = ae(u, n[a]);
315
- if (f === null)
315
+ const a = ae(u, n[f]);
316
+ if (a === null)
316
317
  return;
317
318
  const d = c.querySelector("p") ?? null;
318
- b(t, d, f) && (s = !0);
319
+ b(t, d, a) && (s = !0);
319
320
  });
320
321
  }), s;
321
322
  }
@@ -328,34 +329,34 @@ function O(e, t, n) {
328
329
  `[esd-extension-block-id="${m.NAME}"]`
329
330
  ), s = e.querySelectorAll(
330
331
  `[esd-extension-block-id="${m.PRICE}"]`
331
- ), l = e.querySelectorAll(
332
+ ), i = e.querySelectorAll(
332
333
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
333
334
  ), u = e.querySelectorAll(
334
335
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
335
- ), i = e.querySelectorAll(
336
+ ), l = e.querySelectorAll(
336
337
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
337
338
  ), c = e.querySelectorAll(
338
339
  `[esd-extension-block-id="${m.BUTTON}"]`
339
- ), a = Math.min(o.length, n.length);
340
- let f = !1;
341
- for (let d = 0; d < a; d++) {
340
+ ), f = Math.min(o.length, n.length);
341
+ let a = !1;
342
+ for (let d = 0; d < f; d++) {
342
343
  const p = se({
343
344
  documentModifier: t,
344
345
  product: n[d],
345
346
  imageEl: o[d] ?? null,
346
347
  nameEl: r[d] ?? null,
347
348
  priceEl: s[d] ?? null,
348
- oldPriceEl: l[d] ?? null,
349
+ oldPriceEl: i[d] ?? null,
349
350
  omnibusPriceEl: u[d] ?? null,
350
- omnibusDiscountEl: i[d] ?? null,
351
+ omnibusDiscountEl: l[d] ?? null,
351
352
  buttonEl: c[d] ?? null
352
353
  });
353
- f = f || p;
354
+ a = a || p;
354
355
  }
355
- return fe(e, t, n) && (f = !0), f;
356
+ return fe(e, t, n) && (a = !0), a;
356
357
  }
357
358
  function qe(e) {
358
- const { currentNode: t, documentModifier: n, products: o, onApplied: r } = e;
359
+ const { currentNode: t, documentModifier: n, products: o, forceApply: r = !1 } = e;
359
360
  if (!t || !("querySelectorAll" in t))
360
361
  return !1;
361
362
  const s = V(t);
@@ -364,19 +365,19 @@ function qe(e) {
364
365
  ).length !== o.length)
365
366
  return !1;
366
367
  let u = O(s, n, o);
367
- const i = P(t), c = y.getConfig(t);
368
- if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
369
- const a = t.querySelector(N);
370
- if (a) {
371
- const f = O(
372
- a,
368
+ const l = P(t), c = y.getConfig(t);
369
+ if (l !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
370
+ const f = t.querySelector(N);
371
+ if (f) {
372
+ const a = O(
373
+ f,
373
374
  n,
374
375
  o
375
376
  );
376
- u = u || f;
377
+ u = u || a;
377
378
  }
378
379
  }
379
- return u && (n.apply(new S("Updated product content in-place")), r == null || r()), !0;
380
+ return (u || r) && n.apply(new S("Updated product content in-place")), !0;
380
381
  }
381
382
  function _(e, t, n) {
382
383
  if (!("querySelectorAll" in e))
@@ -387,10 +388,10 @@ function _(e, t, n) {
387
388
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
388
389
  ), s = e.querySelectorAll(
389
390
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
390
- ), l = e.querySelectorAll(
391
+ ), i = e.querySelectorAll(
391
392
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
392
393
  ), u = Math.min(o.length, n.length);
393
- let i = !1;
394
+ let l = !1;
394
395
  for (let c = 0; c < u; c++)
395
396
  K({
396
397
  documentModifier: t,
@@ -398,9 +399,9 @@ function _(e, t, n) {
398
399
  priceEl: o[c] ?? null,
399
400
  oldPriceEl: r[c] ?? null,
400
401
  omnibusPriceEl: s[c] ?? null,
401
- omnibusDiscountEl: l[c] ?? null
402
- }) && (i = !0);
403
- return i;
402
+ omnibusDiscountEl: i[c] ?? null
403
+ }) && (l = !0);
404
+ return l;
404
405
  }
405
406
  function Me(e) {
406
407
  const { currentNode: t, documentModifier: n } = e;
@@ -412,25 +413,25 @@ function Me(e) {
412
413
  if (r.length === 0)
413
414
  return !1;
414
415
  const s = V(t);
415
- let l = _(s, n, r);
416
- const u = P(t), i = y.getConfig(t);
417
- if (u !== "list" && i.mobileLayoutEnabled && "querySelector" in t) {
416
+ let i = _(s, n, r);
417
+ const u = P(t), l = y.getConfig(t);
418
+ if (u !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
418
419
  const c = t.querySelector(N);
419
420
  if (c) {
420
- const a = _(c, n, r);
421
- l = l || a;
421
+ const f = _(c, n, r);
422
+ i = i || f;
422
423
  }
423
424
  }
424
- return l && n.apply(new S("Updated price formatting in-place")), l;
425
+ return i && n.apply(new S("Updated price formatting in-place")), i;
425
426
  }
426
427
  function he(e) {
427
428
  const { currentNode: t, documentModifier: n, currency: o } = e, r = C(t);
428
429
  if (!r)
429
430
  return;
430
- const s = o.alignment === "before" ? "0" : "1", l = (u, i) => {
431
- n.modifyHtml(r).setAttribute(u, i);
431
+ const s = o.alignment === "before" ? "0" : "1", i = (u, l) => {
432
+ n.modifyHtml(r).setAttribute(u, l);
432
433
  };
433
- l(g.CURRENCY, o.code), l(g.SYMBOL, o.symbol), l(g.ALIGNMENT, s), l(g.THOUSAND_SEPARATOR, o.thousandSeparator), l(g.DECIMAL_SEPARATOR, o.decimalSeparator), l(g.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new S("Update currency attributes"));
434
+ i(g.CURRENCY, o.code), i(g.SYMBOL, o.symbol), i(g.ALIGNMENT, s), i(g.THOUSAND_SEPARATOR, o.thousandSeparator), i(g.DECIMAL_SEPARATOR, o.decimalSeparator), i(g.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new S("Update currency attributes"));
434
435
  }
435
436
  export {
436
437
  Re as adjustProductsToSize,