@useinsider/guido 3.18.1-beta.c5d7fb4 → 3.18.1-beta.d56e3d5

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 (49) hide show
  1. package/dist/@types/config/schemas.js +1 -3
  2. package/dist/components/Guido.vue.js +4 -4
  3. package/dist/components/Guido.vue2.js +53 -55
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
  6. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +22 -24
  7. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +24 -28
  8. package/dist/composables/useCustomInterfaceAppearance.js +42 -46
  9. package/dist/composables/usePreviewMode.js +21 -18
  10. package/dist/config/compiler/htmlCompilerRules.js +14 -6
  11. package/dist/enums/extensions/recommendationBlock.js +1 -2
  12. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +69 -70
  13. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +28 -72
  14. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -45
  15. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +58 -104
  16. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  17. package/dist/guido.css +1 -1
  18. package/dist/services/recommendationApi.js +52 -61
  19. package/dist/src/@types/config/schemas.d.ts +0 -4
  20. package/dist/src/composables/useConfig.d.ts +0 -2
  21. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -1
  22. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -2
  23. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -4
  24. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -54
  25. package/dist/src/services/recommendationApi.d.ts +1 -2
  26. package/dist/src/stores/config.d.ts +0 -160
  27. package/dist/src/stores/onboarding.d.ts +10 -808
  28. package/dist/src/utils/fixMobileNonResponsiveLayout.d.ts +23 -0
  29. package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
  30. package/dist/static/styles/customEditorStyle.css.js +17 -2
  31. package/dist/stores/config.js +59 -66
  32. package/dist/stores/onboarding.js +36 -46
  33. package/dist/utils/fixMobileNonResponsiveLayout.js +54 -0
  34. package/package.json +1 -1
  35. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
  36. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
  37. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +0 -21
  38. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +0 -46
  39. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
  40. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -46
  41. package/dist/composables/useLegacyStrategyConversion.js +0 -54
  42. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -58
  43. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
  44. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +0 -2
  45. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
  46. package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
  47. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -39
  48. package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
  49. package/dist/static/assets/icons/line-info.svg.js +0 -5
@@ -1,32 +1,26 @@
1
- var p = Object.defineProperty;
2
- var v = (i, s, t) => s in i ? p(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
3
- var r = (i, s, t) => v(i, typeof s != "symbol" ? s + "" : s, t);
4
- import { useLegacyStrategyConversion as _ } from "../../../../../composables/useLegacyStrategyConversion.js";
5
- import { ACADEMY_LINKS as b } from "../../../../../enums/academy.js";
6
- import { useOnboardingStore as S } from "../../../../../stores/onboarding.js";
7
- import { CommonControl as f } from "../../../common-control.js";
8
- import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
9
- const C = "recommendation-strategy-control";
10
- class N extends f {
1
+ var d = Object.defineProperty;
2
+ var y = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
+ var o = (r, s, t) => y(r, typeof s != "symbol" ? s + "" : s, t);
4
+ import { ACADEMY_LINKS as m } from "../../../../../enums/academy.js";
5
+ import { CommonControl as h } from "../../../common-control.js";
6
+ import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
7
+ const p = "recommendation-strategy-control";
8
+ class f extends h {
11
9
  constructor() {
12
10
  super(...arguments);
13
- r(this, "store", $());
14
- r(this, "onboardingStore", S());
15
- r(this, "legacyConversion", _());
16
- r(this, "storeUnsubscription", () => {
11
+ o(this, "store", u());
12
+ o(this, "storeUnsubscription", () => {
17
13
  });
18
- r(this, "listeners", []);
19
- r(this, "lastPaintedState", null);
14
+ o(this, "listeners", []);
15
+ o(this, "lastPaintedState", null);
20
16
  }
21
17
  getId() {
22
- return C;
18
+ return p;
23
19
  }
24
20
  getTemplate() {
25
21
  const t = this.api.translate(
26
22
  "You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
27
- ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), o = this.api.translate("Legacy Strategy"), n = this.api.translate(
28
- "Note that this is an older version of the Recommendation Strategy. We recommend you update it to the new Recommendation Strategy for an improved experience."
29
- );
23
+ ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
30
24
  return `
31
25
  <div class="strategy-control-container">
32
26
  <div class="strategy-control-header">
@@ -37,7 +31,7 @@ class N extends f {
37
31
  ${t}
38
32
  ${e}
39
33
  <a
40
- href="${b.EMAIL_RECOMMENDATION_BLOCK}"
34
+ href="${m.EMAIL_RECOMMENDATION_BLOCK}"
41
35
  target="_blank"
42
36
  rel="noopener noreferrer">${a}</a>.
43
37
  </p>
@@ -59,33 +53,6 @@ class N extends f {
59
53
  })
60
54
  ], "strategy-control-cta-row")}
61
55
  </div>
62
- <div data-strategy-legacy-state style="display: none;">
63
- <div class="strategy-control-notice-row">
64
- <div class="strategy-control-notice">
65
- <p class="strategy-control-notice-text">${n}</p>
66
- </div>
67
- </div>
68
- <div class="strategy-control-name-band">
69
- <span class="strategy-control-name">${o}</span>
70
- ${this._strategyAction({
71
- id: "guido__btn-update-legacy-strategy",
72
- label: this.api.translate("Update"),
73
- modifier: "update"
74
- })}
75
- </div>
76
- <div class="strategy-control-actions">
77
- ${this._strategyAction({
78
- id: "guido__btn-change-legacy-strategy",
79
- label: this.api.translate("Change"),
80
- modifier: "change"
81
- })}
82
- ${this._strategyAction({
83
- id: "guido__btn-remove-legacy-strategy",
84
- label: this.api.translate("Remove"),
85
- modifier: "remove"
86
- })}
87
- </div>
88
- </div>
89
56
  <div data-strategy-assigned-state style="display: none;">
90
57
  <div class="strategy-control-name-band">
91
58
  <span class="strategy-control-name" data-strategy-name></span>
@@ -121,8 +88,6 @@ class N extends f {
121
88
  this._renderState();
122
89
  }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
123
90
  });
124
- const t = this.store.currentRecommendationId, e = t !== null && !!this.store.blockStates[t], a = this.store.isLegacyStrategyBlock;
125
- e && !this.store.recommendationConfigs.strategyId && !a && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding"), e && a && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding");
126
91
  }
127
92
  onDestroy() {
128
93
  this._teardown();
@@ -135,34 +100,25 @@ class N extends f {
135
100
  const t = this.getContainer();
136
101
  if (!t)
137
102
  return;
138
- const e = (a, o) => {
139
- const n = t.querySelector(a);
140
- n && (n.addEventListener("click", o), this.listeners.push({ element: n, handler: o }));
103
+ const e = (a, n) => {
104
+ const i = t.querySelector(a);
105
+ i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
141
106
  };
142
- e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
143
- this.legacyConversion.convertLegacyStrategy();
144
- });
107
+ e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
145
108
  }
146
109
  _renderState() {
147
- var h;
148
- const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((h = this.store.assignedStrategy) == null ? void 0 : h.name) ?? "" : "", a = this.store.legacyConversionLoading, o = this.store.isLegacyStrategyBlock, n = `${t}\0${e}\0${a}\0${o}`;
149
- if (n === this.lastPaintedState)
150
- return;
151
- const c = this.getContainer();
152
- if (!c)
110
+ var l;
111
+ const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
112
+ if (a === this.lastPaintedState)
153
113
  return;
154
- const d = c.querySelector("[data-strategy-empty-state]"), y = c.querySelector("[data-strategy-assigned-state]"), g = c.querySelector("[data-strategy-legacy-state]"), m = c.querySelector("[data-strategy-name]");
155
- if (!d || !y || !g)
114
+ const n = this.getContainer();
115
+ if (!n)
156
116
  return;
157
- const u = t ? y : o ? g : d;
158
- [d, y, g].forEach((l) => {
159
- l.style.display = l === u ? "" : "none";
160
- }), g.querySelectorAll("button").forEach((l) => {
161
- l.disabled = a;
162
- }), g.classList.toggle("is-converting", a), m && t && (m.textContent = e || `#${t}`), this.lastPaintedState = n;
117
+ const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
118
+ !i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
163
119
  }
164
120
  }
165
121
  export {
166
- C as STRATEGY_CONTROL_ID,
167
- N as StrategyControl
122
+ p as STRATEGY_CONTROL_ID,
123
+ f as StrategyControl
168
124
  };
@@ -94,9 +94,9 @@ function j(e, t = {}) {
94
94
  const u = s ?? P(n), l = y.getConfig(n);
95
95
  if (u === "list" || !l.mobileLayoutEnabled)
96
96
  return te({ currentNode: n, documentModifier: o });
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, {
97
+ const c = A(), a = $(r, c.recommendationProducts), f = 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(a, u, {
98
98
  productsPerRow: l.mobileCardsInRow,
99
- composition: a,
99
+ composition: f,
100
100
  filterList: c.filterList,
101
101
  priceInline: !l.priceMovedToNextLine,
102
102
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
@@ -122,9 +122,9 @@ function ie(e, t = {}) {
122
122
  const u = n.querySelector(L) ?? n.querySelector(W);
123
123
  if (!u)
124
124
  return !1;
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,
125
+ const l = A(), c = $(r, l.recommendationProducts), { cardsInRow: a } = y.getConfig(n), f = i ?? U(n, l.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
126
+ productsPerRow: a,
127
+ composition: f,
128
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).
@@ -153,10 +153,10 @@ function ce(e, t, n) {
153
153
  return !1;
154
154
  const s = A(), i = r.split(",").filter(Boolean), u = D(i, o, s.filterList), l = [], c = u.join(",") !== i.join(",");
155
155
  c && l.push([R, u.join(",")]);
156
- const f = le(
156
+ const a = le(
157
157
  o.getAttribute(q)
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)
158
+ ), f = a && z(a, o, s.filterList);
159
+ if (a && f && f.join(",") !== a.join(",") && l.push([q, JSON.stringify(f)]), l.length === 0)
160
160
  return !1;
161
161
  if (l.forEach(([d, p]) => {
162
162
  t.modifyHtml(o).setAttribute(d, p);
@@ -177,20 +177,19 @@ function Te(e) {
177
177
  products: r,
178
178
  layout: s,
179
179
  composition: i,
180
- skipStylePreservation: u,
181
- forceApply: l = !1
180
+ skipStylePreservation: u
182
181
  } = e;
183
182
  if (!t)
184
183
  return;
185
- const c = u ? {} : x(t), f = {
184
+ const l = u ? {} : x(t), c = {
186
185
  currentNode: t,
187
186
  documentModifier: n,
188
187
  products: r,
189
188
  layout: s,
190
189
  composition: i
191
190
  };
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();
191
+ let a = ie(c, l);
192
+ a = j(c, l) || a, a && (ce(t, n, i), n.apply(new S("Regenerate products with styles"))), o == null || o();
194
193
  }
195
194
  function Re(e, t) {
196
195
  return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...H(t - e.length)];
@@ -251,16 +250,16 @@ function se(e) {
251
250
  omnibusDiscountEl: l,
252
251
  buttonEl: c
253
252
  } = e;
254
- let f = !1;
253
+ let a = !1;
255
254
  if (o && "querySelector" in o) {
256
- const a = o.querySelector("img");
257
- a && (t.modifyHtml(a).setAttribute("src", X(n.image_url)).setAttribute("alt", n.name), f = !0);
255
+ const f = o.querySelector("img");
256
+ f && (t.modifyHtml(f).setAttribute("src", X(n.image_url)).setAttribute("alt", n.name), a = !0);
258
257
  const d = o.querySelector("a");
259
- d && (t.modifyHtml(d).setAttribute("href", n.url), f = !0);
258
+ d && (t.modifyHtml(d).setAttribute("href", n.url), a = !0);
260
259
  }
261
260
  if (r && "querySelector" in r) {
262
- const a = r.querySelector("strong") ?? r.querySelector("p");
263
- b(t, a ?? null, n.name) && (f = !0);
261
+ const f = r.querySelector("strong") ?? r.querySelector("p");
262
+ b(t, f ?? null, n.name) && (a = !0);
264
263
  }
265
264
  if (K({
266
265
  documentModifier: t,
@@ -269,11 +268,11 @@ function se(e) {
269
268
  oldPriceEl: i,
270
269
  omnibusPriceEl: u,
271
270
  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);
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);
275
274
  }
276
- return f;
275
+ return a;
277
276
  }
278
277
  function V(e) {
279
278
  return "querySelector" in e ? e.querySelector(L) ?? e : e;
@@ -309,14 +308,14 @@ function fe(e, t, n) {
309
308
  let s = !1;
310
309
  return r.forEach((i, u) => {
311
310
  const l = Math.min(i.length, n.length);
312
- i.slice(0, l).forEach((c, f) => {
311
+ i.slice(0, l).forEach((c, a) => {
313
312
  if (!("querySelector" in c))
314
313
  return;
315
- const a = ae(u, n[f]);
316
- if (a === null)
314
+ const f = ae(u, n[a]);
315
+ if (f === null)
317
316
  return;
318
317
  const d = c.querySelector("p") ?? null;
319
- b(t, d, a) && (s = !0);
318
+ b(t, d, f) && (s = !0);
320
319
  });
321
320
  }), s;
322
321
  }
@@ -337,9 +336,9 @@ function O(e, t, n) {
337
336
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
338
337
  ), c = e.querySelectorAll(
339
338
  `[esd-extension-block-id="${m.BUTTON}"]`
340
- ), f = Math.min(o.length, n.length);
341
- let a = !1;
342
- for (let d = 0; d < f; d++) {
339
+ ), a = Math.min(o.length, n.length);
340
+ let f = !1;
341
+ for (let d = 0; d < a; d++) {
343
342
  const p = se({
344
343
  documentModifier: t,
345
344
  product: n[d],
@@ -351,33 +350,33 @@ function O(e, t, n) {
351
350
  omnibusDiscountEl: l[d] ?? null,
352
351
  buttonEl: c[d] ?? null
353
352
  });
354
- a = a || p;
353
+ f = f || p;
355
354
  }
356
- return fe(e, t, n) && (a = !0), a;
355
+ return fe(e, t, n) && (f = !0), f;
357
356
  }
358
357
  function qe(e) {
359
- const { currentNode: t, documentModifier: n, products: o, forceApply: r = !1 } = e;
358
+ const { currentNode: t, documentModifier: n, products: o } = e;
360
359
  if (!t || !("querySelectorAll" in t))
361
360
  return !1;
362
- const s = V(t);
363
- if (!("querySelectorAll" in s) || s.querySelectorAll(
361
+ const r = V(t);
362
+ if (!("querySelectorAll" in r) || r.querySelectorAll(
364
363
  `[esd-extension-block-id="${m.IMAGE}"]`
365
364
  ).length !== o.length)
366
365
  return !1;
367
- let u = O(s, n, o);
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) {
366
+ let i = O(r, n, o);
367
+ const u = P(t), l = y.getConfig(t);
368
+ if (u !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
369
+ const c = t.querySelector(N);
370
+ if (c) {
372
371
  const a = O(
373
- f,
372
+ c,
374
373
  n,
375
374
  o
376
375
  );
377
- u = u || a;
376
+ i = i || a;
378
377
  }
379
378
  }
380
- return (u || r) && n.apply(new S("Updated product content in-place")), !0;
379
+ return i && n.apply(new S("Updated product content in-place")), !0;
381
380
  }
382
381
  function _(e, t, n) {
383
382
  if (!("querySelectorAll" in e))
@@ -418,8 +417,8 @@ function Me(e) {
418
417
  if (u !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
419
418
  const c = t.querySelector(N);
420
419
  if (c) {
421
- const f = _(c, n, r);
422
- i = i || f;
420
+ const a = _(c, n, r);
421
+ i = i || a;
423
422
  }
424
423
  }
425
424
  return i && n.apply(new S("Updated price formatting in-place")), i;