@useinsider/guido 3.20.0 → 3.20.1-beta.04cd240

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 (78) hide show
  1. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  2. package/dist/composables/useStripo.js +11 -10
  3. package/dist/composables/useVersionHistoryApi.js +42 -37
  4. package/dist/config/compiler/itemsCompilerRules.js +21 -5
  5. package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
  6. package/dist/config/migrator/itemsBlockMigrator.js +112 -108
  7. package/dist/extensions/Blocks/Items/block.js +76 -64
  8. package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
  9. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  10. package/dist/extensions/Blocks/Recommendation/block.js +60 -49
  11. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +163 -149
  12. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +102 -78
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +313 -210
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +15 -13
  16. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +17 -12
  17. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +92 -84
  18. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +219 -193
  19. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +23 -18
  20. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +1 -2
  21. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +6 -6
  22. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +12 -9
  23. package/dist/extensions/Blocks/Recommendation/extension.js +4 -2
  24. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +240 -190
  26. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
  27. package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
  28. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
  29. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
  30. package/dist/extensions/Blocks/Recommendation/utils/followUpApply.js +34 -0
  31. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +73 -28
  32. package/dist/extensions/Blocks/Recommendation/utils/restoreRefresh.js +36 -0
  33. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +39 -20
  34. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  35. package/dist/package.json.js +1 -1
  36. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
  37. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  38. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  39. package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
  40. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
  41. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  42. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  43. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +3 -0
  44. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  45. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  46. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
  47. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  48. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +3 -0
  50. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +22 -3
  51. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +1 -18
  52. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +8 -0
  53. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +10 -6
  54. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  55. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  56. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  58. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +2 -3
  60. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +1 -1
  61. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  62. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +28 -6
  63. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +19 -0
  64. package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
  65. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
  66. package/dist/src/extensions/Blocks/Recommendation/utils/followUpApply.d.ts +20 -0
  67. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +15 -2
  68. package/dist/src/extensions/Blocks/Recommendation/utils/restoreRefresh.d.ts +2 -0
  69. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  70. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  71. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  72. package/dist/src/stores/editor.d.ts +3 -1
  73. package/dist/src/utils/liquidProtection.d.ts +3 -0
  74. package/dist/static/styles/components/button.css.js +5 -0
  75. package/dist/stores/editor.js +5 -0
  76. package/dist/utils/liquidProtection.js +5 -0
  77. package/dist/utils/templatePreparation.js +61 -85
  78. package/package.json +3 -3
@@ -1,29 +1,33 @@
1
- import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const r = "ins-recommendation-desktop-container", l = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", u = `.${l} { display: none; }`, m = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${l} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${l}, .${i} .ins-recommendation-mobile-row { display: none !important; } .${i} .product-image-cell { width: 80px !important; } .${i} .product-image-cell img { max-width: 80px !important; } .${i} .button-cell { width: 80px !important; } .${i} .product-info-cell { padding: 5px 8px !important; } }`, d = `@media only screen and (max-width: 480px) { .${s} .${r} { display: table !important; } .${s} .${l}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, p = `.${l}`;
3
- function c(t, e) {
1
+ import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { applyFollowUp as m } from "../../utils/followUpApply.js";
3
+ const r = "ins-recommendation-desktop-container", l = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", p = `.${l} { display: none; }`, d = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${l} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${l}, .${i} .ins-recommendation-mobile-row { display: none !important; } .${i} .product-image-cell { width: 80px !important; } .${i} .product-image-cell img { max-width: 80px !important; } .${i} .button-cell { width: 80px !important; } .${i} .product-info-cell { padding: 5px 8px !important; } }`, c = `@media only screen and (max-width: 480px) { .${s} .${r} { display: table !important; } .${s} .${l}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, f = `.${l}`;
4
+ function y(t, e) {
4
5
  return !!t.querySelector(e);
5
6
  }
6
- function f(t) {
7
+ function _(t) {
7
8
  return t.querySelectorAll(`*${r}`).length > 0;
8
9
  }
9
- function y(t) {
10
+ function O(t) {
10
11
  return t.querySelectorAll(`*${s}`).length > 0;
11
12
  }
12
- function S(t) {
13
- const e = t.getDocumentRootCssNode();
14
- if (!e)
13
+ function $(t, e = !1) {
14
+ const o = t.getDocumentRootCssNode();
15
+ if (!o)
15
16
  return;
16
- const o = t.getDocumentModifier();
17
- let n = !1;
18
- c(e, p) || (o.modifyCss(e).appendRule(u), n = !0), f(e) || (o.modifyCss(e).appendRule(m), n = !0), y(e) || (o.modifyCss(e).appendRule(d), n = !0), n && o.apply(new a("Add mobile layout CSS rules"));
17
+ const n = t.getDocumentModifier();
18
+ let a = !1;
19
+ y(o, f) || (n.modifyCss(o).appendRule(p), a = !0), _(o) || (n.modifyCss(o).appendRule(d), a = !0), O(o) || (n.modifyCss(o).appendRule(c), a = !0), a && m(n, "Add mobile layout CSS rules", e);
19
20
  }
20
- function C(t) {
21
+ function E(t) {
21
22
  return "hasClass" in t ? t.hasClass(s) : !1;
22
23
  }
23
- function O(t, e, o) {
24
+ function S(t, e, o) {
25
+ o ? t.modifyHtml(e).setClass(s) : t.modifyHtml(e).removeClass(s);
26
+ }
27
+ function R(t, e, o) {
24
28
  const n = t.getDocumentModifier();
25
- o ? n.modifyHtml(e).setClass(s) : n.modifyHtml(e).removeClass(s), n.apply(
26
- new a(
29
+ S(n, e, o), n.apply(
30
+ new u(
27
31
  o ? "Opt out of mobile layout" : "Opt in to mobile layout"
28
32
  )
29
33
  );
@@ -32,7 +36,8 @@ export {
32
36
  r as CSS_CLASS_DESKTOP_CONTAINER,
33
37
  l as CSS_CLASS_MOBILE_CONTAINER,
34
38
  s as CSS_CLASS_NO_MOBILE_LAYOUT,
35
- S as ensureMobileCssRulesExist,
36
- C as hasMobileLayoutOptOut,
37
- O as setMobileLayoutOptOut
39
+ $ as ensureMobileCssRulesExist,
40
+ E as hasMobileLayoutOptOut,
41
+ R as setMobileLayoutOptOut,
42
+ S as stageMobileLayoutOptOut
38
43
  };
@@ -58,7 +58,6 @@ class N extends u {
58
58
  );
59
59
  if (!i.length)
60
60
  return;
61
- e && T(this.api);
62
61
  const o = this.api.getDocumentModifier();
63
62
  i.forEach((n) => {
64
63
  e ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
@@ -66,7 +65,7 @@ class N extends u {
66
65
  new l(
67
66
  e ? "Enable product name text trimming" : "Disable product name text trimming"
68
67
  )
69
- );
68
+ ), e && T(this.api, !0);
70
69
  }
71
70
  _listenToFormUpdates() {
72
71
  this.api.onValueChanged(s.TEXT_TRIM_ENABLED, (e) => {
@@ -1,14 +1,14 @@
1
- import { ModificationDescription as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const t = "text-trim-enabled", l = `.${t}`, c = `.${t} p`, S = `.${t} { max-width: 0; }`, T = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
3
- function f(n) {
1
+ import { applyFollowUp as r } from "../../utils/followUpApply.js";
2
+ const t = "text-trim-enabled", c = `.${t}`, S = `.${t} p`, T = `.${t} { max-width: 0; }`, p = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
3
+ function u(n, l = !1) {
4
4
  const e = n.getDocumentRootCssNode();
5
5
  if (!e)
6
6
  return;
7
7
  const o = n.getDocumentModifier();
8
- let i = !1;
9
- e.querySelector(l) || (o.modifyCss(e).appendRule(S), i = !0), e.querySelectorAll(`*${t}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" && s.getSelector() === c) || (o.modifyCss(e).appendRule(T), i = !0), i && o.apply(new r("Add text trim CSS rules"));
8
+ let s = !1;
9
+ e.querySelector(c) || (o.modifyCss(e).appendRule(T), s = !0), e.querySelectorAll(`*${t}`).some((i) => "getSelector" in i && typeof i.getSelector == "function" && i.getSelector() === S) || (o.modifyCss(e).appendRule(p), s = !0), s && r(o, "Add text trim CSS rules", l);
10
10
  }
11
11
  export {
12
12
  t as CSS_CLASS_TEXT_TRIM,
13
- f as ensureTextTrimCssRulesExist
13
+ u as ensureTextTrimCssRulesExist
14
14
  };
@@ -1,12 +1,12 @@
1
- var y = Object.defineProperty;
2
- var M = (u, s, t) => s in u ? y(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
3
- var g = (u, s, t) => M(u, typeof s != "symbol" ? s + "" : s, t);
4
- import { ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var M = Object.defineProperty;
2
+ var y = (u, s, t) => s in u ? M(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
3
+ var g = (u, s, t) => y(u, typeof s != "symbol" ? s + "" : s, t);
5
4
  import { CommonControl as E } from "../../../common-control.js";
6
5
  import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as L } from "../../constants/selectors.js";
7
6
  import { SPACING_STEP as P, MAX_SPACING as G, MIN_SPACING as R, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as I } from "../../constants/layout.js";
8
7
  import { RecommendationConfigService as p } from "../../services/configService.js";
9
8
  import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
9
+ import { applyFollowUp as S } from "../../utils/followUpApply.js";
10
10
  import { safeGetStyle as f, safeGetParent as B } from "../../utils/tagName.js";
11
11
  import { getCurrentLayout as _, getBlockElement as U } from "../main/utils.js";
12
12
  import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
@@ -201,7 +201,7 @@ class j extends E {
201
201
  ).forEach((l) => {
202
202
  const d = "parent" in l ? l.parent() : void 0;
203
203
  d && i.modifyHtml(d).setStyle("padding", r);
204
- }), i.apply(new S(`Update column spacing to ${t}px`)));
204
+ }), S(i, `Update column spacing to ${t}px`, !0));
205
205
  }
206
206
  /**
207
207
  * Handles row spacing changes for desktop.
@@ -227,7 +227,7 @@ class j extends E {
227
227
  const i = this.api.getDocumentModifier(), a = `${t}px`;
228
228
  n.forEach((r) => {
229
229
  i.modifyHtml(r).setStyle("height", a);
230
- }), i.apply(new S(`Update row spacing to ${t}px`));
230
+ }), S(i, `Update row spacing to ${t}px`, !0);
231
231
  }
232
232
  // ========================================================================
233
233
  // Mobile Spacing Handlers
@@ -255,7 +255,7 @@ class j extends E {
255
255
  ).forEach((l) => {
256
256
  const d = "parent" in l ? l.parent() : void 0;
257
257
  d && i.modifyHtml(d).setStyle("padding", r);
258
- }), i.apply(new S(`Update mobile column spacing to ${t}px`)));
258
+ }), S(i, `Update mobile column spacing to ${t}px`, !0));
259
259
  }
260
260
  /**
261
261
  * Handles row spacing changes for mobile.
@@ -281,7 +281,7 @@ class j extends E {
281
281
  const i = this.api.getDocumentModifier(), a = `${t}px`;
282
282
  n.forEach((r) => {
283
283
  i.modifyHtml(r).setStyle("height", a);
284
- }), i.apply(new S(`Update mobile row spacing to ${t}px`));
284
+ }), S(i, `Update mobile row spacing to ${t}px`, !0);
285
285
  }
286
286
  // ========================================================================
287
287
  // Data Attribute Storage
@@ -291,7 +291,10 @@ class j extends E {
291
291
  */
292
292
  _storeDataAttribute(t, e) {
293
293
  const n = U(this.currentNode);
294
- n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new S(`Store ${t}`));
294
+ if (!n)
295
+ return;
296
+ const i = this.api.getDocumentModifier();
297
+ i.modifyHtml(n).setAttribute(t, e.toString()), S(i, `Store ${t}`, !0);
295
298
  }
296
299
  // ========================================================================
297
300
  // Event Listeners
@@ -5,6 +5,8 @@ import { RecommendationBlockControl as i } from "./controls/main/index.js";
5
5
  import "./constants/selectors.js";
6
6
  import "./store/recommendation.js";
7
7
  import "./utils/captureStyleTemplates.js";
8
+ import "../../../stores/editor.js";
9
+ import "vue";
8
10
  import { TitleControls as e } from "./controls/title/index.js";
9
11
  import { NameControls as l } from "./controls/name/index.js";
10
12
  import { PriceControls as s } from "./controls/price/index.js";
@@ -42,10 +44,10 @@ const w = [
42
44
  ], v = [
43
45
  ...b,
44
46
  ...w.flatMap((o) => Object.values(o))
45
- ], Y = v.reduce(
47
+ ], _ = v.reduce(
46
48
  (o, r) => o.addControl(r),
47
49
  new t().addBlock(m).withSettingsPanelRegistry(k)
48
50
  ).addStyles(S).withPreviewStyles(n).withIconsRegistry(R).build();
49
51
  export {
50
- Y as default
52
+ _ as default
51
53
  };
@@ -6,6 +6,8 @@ import "./constants/selectors.js";
6
6
  import { CONTROL_BLOCK_ID as L } from "./controls/main/index.js";
7
7
  import "./store/recommendation.js";
8
8
  import "./utils/captureStyleTemplates.js";
9
+ import "../../../stores/editor.js";
10
+ import "vue";
9
11
  import "./controls/title/index.js";
10
12
  import "./controls/name/index.js";
11
13
  import "./controls/price/index.js";
@@ -19,7 +21,7 @@ import "./controls/blockBackground/index.js";
19
21
  import { CARD_BACKGROUND_COLOR_CONTROL_ID as U } from "./controls/cardBackground/index.js";
20
22
  import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
21
23
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
22
- class s extends E {
24
+ class x extends E {
23
25
  registerBlockControls(O) {
24
26
  O[R] = [
25
27
  new _(
@@ -216,5 +218,5 @@ class s extends E {
216
218
  }
217
219
  }
218
220
  export {
219
- s as SettingsPanel
221
+ x as SettingsPanel
220
222
  };