@useinsider/guido 2.2.0-beta.eeefcc3 → 3.0.0-beta.fd7cee3

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 (101) hide show
  1. package/README.md +41 -2
  2. package/dist/@types/config/schemas.js +1 -1
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +66 -66
  5. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  6. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  9. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
  10. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
  11. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
  12. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
  13. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
  14. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
  15. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
  16. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  17. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  18. package/dist/composables/useRecommendation.js +9 -9
  19. package/dist/composables/useSave.js +16 -12
  20. package/dist/composables/useStripo.js +66 -62
  21. package/dist/composables/useStripoEventHandler.js +27 -12
  22. package/dist/composables/useSyncModuleExtractor.js +45 -0
  23. package/dist/config/compiler/utils/recommendationCompilerUtils.js +1 -1
  24. package/dist/config/migrator/recommendationMigrator.js +1 -1
  25. package/dist/enums/unsubscribe.js +25 -21
  26. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  27. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
  28. package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
  29. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
  30. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
  31. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
  32. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
  33. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
  34. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
  35. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +194 -104
  36. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
  37. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
  38. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
  39. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +291 -217
  40. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +14 -14
  41. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
  42. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  43. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
  44. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
  46. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
  47. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
  48. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
  49. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +13 -13
  50. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
  51. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
  52. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +172 -85
  53. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +2 -2
  54. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
  55. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +2 -2
  56. package/dist/extensions/Blocks/Recommendation/templates/utils.js +32 -32
  57. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
  58. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
  59. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  60. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  61. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  62. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  63. package/dist/guido.css +1 -1
  64. package/dist/services/stripoApi.js +55 -19
  65. package/dist/src/@types/config/schemas.d.ts +1 -1
  66. package/dist/src/@types/events.d.ts +38 -2
  67. package/dist/src/components/Guido.vue.d.ts +2 -2
  68. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
  69. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
  70. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  71. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  72. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  73. package/dist/src/composables/useGuidoActions.d.ts +1 -1
  74. package/dist/src/composables/useSave.d.ts +2 -2
  75. package/dist/src/composables/useStripo.d.ts +2 -2
  76. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  77. package/dist/src/enums/unsubscribe.d.ts +3 -0
  78. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
  79. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
  80. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
  81. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +8 -1
  82. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +38 -10
  83. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +27 -14
  84. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
  85. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +19 -2
  86. package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
  87. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -2
  88. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
  89. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -1
  90. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
  91. package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
  92. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  93. package/dist/src/mock/api/settings.d.ts +2 -0
  94. package/dist/src/services/stripoApi.d.ts +5 -0
  95. package/dist/src/stores/editor.d.ts +23 -0
  96. package/dist/src/utils/templatePreparation.d.ts +1 -1
  97. package/dist/static/styles/customEditorStyle.css.js +50 -23
  98. package/dist/stores/editor.js +2 -1
  99. package/dist/stores/unsubscribe.js +37 -34
  100. package/dist/utils/templatePreparation.js +1 -1
  101. package/package.json +2 -2
@@ -1,41 +1,41 @@
1
- var _ = Object.defineProperty;
2
- var c = (i, o, t) => o in i ? _(i, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[o] = t;
3
- var d = (i, o, t) => c(i, typeof o != "symbol" ? o + "" : o, t);
4
- import { EditorStatePropertyType as u, PreviewDeviceMode as R } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as h } from "../../../common-control.js";
6
- import { MAX_PRODUCT_COUNT as C, MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
7
- import { RecommendationConfigService as s } from "../../services/configService.js";
1
+ var u = Object.defineProperty;
2
+ var _ = (n, r, t) => r in n ? u(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
3
+ var a = (n, r, t) => _(n, typeof r != "symbol" ? r + "" : r, t);
4
+ import { EditorStatePropertyType as c, PreviewDeviceMode as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as R } from "../../../common-control.js";
6
+ import { MAX_PRODUCT_COUNT as h, MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as g, DEFAULT_COLUMN_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as O } from "../../constants/layout.js";
7
+ import { RecommendationConfigService as i } from "../../services/configService.js";
8
8
  import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
9
- import { ensureMobileCssRulesExist as O } from "../mobileLayout/cssRules.js";
10
- import { getCurrentLayout as I, regenerateMobileProductRows as g, regenerateProductRowsWithStyles as b } from "./utils.js";
11
- import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
12
- const P = "recommendation-product-layout-control", e = {
9
+ import { ensureMobileCssRulesExist as I } from "../mobileLayout/cssRules.js";
10
+ import { getCurrentLayout as N, regenerateMobileProductRows as f, adjustProductsToSize as b, regenerateProductRowsWithStyles as P } from "./utils.js";
11
+ import { useDebounceFn as L } from "../../../../../node_modules/@vueuse/shared/index.js";
12
+ const M = "recommendation-product-layout-control", e = {
13
13
  PRODUCT_COUNT: "size",
14
14
  PRODUCT_IN_ROW: "cardsInRow",
15
15
  PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
16
16
  MOBILE_CARDS_IN_ROW: "mobileCardsInRow",
17
17
  MOBILE_CARDS_IN_ROW_LABEL: "mobileCardsInRowLabel"
18
18
  };
19
- class S extends h {
19
+ class V extends R {
20
20
  constructor() {
21
21
  super(...arguments);
22
22
  // Store is used for backward compatibility with product fetching and regeneration
23
- d(this, "store", l());
24
- d(this, "storeUnsubscription", () => {
23
+ a(this, "store", l());
24
+ a(this, "storeUnsubscription", () => {
25
25
  });
26
- d(this, "_debouncedRegenerateProductRows", N(() => {
26
+ a(this, "_debouncedRegenerateProductRows", L(() => {
27
27
  this._regenerateProductRows();
28
28
  }, 500));
29
29
  }
30
30
  getId() {
31
- return P;
31
+ return M;
32
32
  }
33
33
  getTemplate() {
34
34
  return `
35
35
  <div class="product-layout-control-container">
36
36
  ${this._GuTwoColumns([
37
37
  this._GuLabel({ text: "Number of Products" }),
38
- this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: C }),
38
+ this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: h }),
39
39
  this._GuLabel({
40
40
  text: "Products in One Row on Desktop",
41
41
  name: e.PRODUCT_IN_ROW_LABEL
@@ -47,7 +47,7 @@ class S extends h {
47
47
  }),
48
48
  this._GuCounter({
49
49
  name: e.MOBILE_CARDS_IN_ROW,
50
- maxValue: m
50
+ maxValue: g
51
51
  })
52
52
  ])}
53
53
  </div>
@@ -63,7 +63,7 @@ class S extends h {
63
63
  this.storeUnsubscription();
64
64
  }
65
65
  _setFormValues() {
66
- const t = s.getConfig(this.currentNode);
66
+ const t = i.getConfig(this.currentNode);
67
67
  this.api.updateValues({
68
68
  [e.PRODUCT_COUNT]: t.size,
69
69
  [e.PRODUCT_IN_ROW]: t.cardsInRow,
@@ -75,7 +75,7 @@ class S extends h {
75
75
  * using Stripo's EditorStatePropertyType API.
76
76
  */
77
77
  _isMobileMode() {
78
- return this.api.getEditorState()[u.previewDeviceMode] === R.MOBILE;
78
+ return this.api.getEditorState()[c.previewDeviceMode] === C.MOBILE;
79
79
  }
80
80
  /**
81
81
  * Updates counter visibility based on layout orientation and editor mode.
@@ -84,8 +84,8 @@ class S extends h {
84
84
  * - Grid + mobile mode: show mobile counter, hide desktop counter
85
85
  */
86
86
  _updateProductsInRowVisibility() {
87
- const r = (s.getConfig(this.currentNode).layout || I(this.currentNode)) === "grid", n = this._isMobileMode();
88
- this.api.setVisibility(e.PRODUCT_IN_ROW, r && !n), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, r && !n), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, r && n), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, r && n);
87
+ const o = (i.getConfig(this.currentNode).layout || N(this.currentNode)) === "grid", d = this._isMobileMode();
88
+ this.api.setVisibility(e.PRODUCT_IN_ROW, o && !d), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, o && !d), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, o && d), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, o && d);
89
89
  }
90
90
  /**
91
91
  * Subscribes to editor preview mode changes via Stripo API.
@@ -94,43 +94,51 @@ class S extends h {
94
94
  */
95
95
  _subscribeToEditorModeChanges() {
96
96
  this.api.onEditorStatePropUpdated(
97
- u.previewDeviceMode,
97
+ c.previewDeviceMode,
98
98
  () => {
99
99
  this._updateProductsInRowVisibility();
100
100
  }
101
101
  );
102
102
  }
103
103
  _onProductCountChange(t) {
104
- this.currentNode && (s.updateConfig(
104
+ !this.currentNode || i.getConfig(this.currentNode).size === t || (i.updateConfig(
105
105
  this.api,
106
106
  this.currentNode,
107
107
  { size: t },
108
108
  `Changed product count to ${t}`
109
- ), this.store.patchCurrentBlockConfig({ size: t }), this._debouncedRegenerateProductRows());
109
+ ), this.store.patchCurrentBlockConfig({ size: t }));
110
110
  }
111
111
  _onProductsInRowChange(t) {
112
- this.currentNode && (s.updateConfig(
112
+ if (!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t)
113
+ return;
114
+ const o = t === 1 ? 0 : m;
115
+ i.updateConfig(
113
116
  this.api,
114
117
  this.currentNode,
115
- { cardsInRow: t },
118
+ { cardsInRow: t, columnSpacing: o },
116
119
  `Changed products per row to ${t}`
117
- ), this.store.patchCurrentBlockConfig({ cardsInRow: t }), this._debouncedRegenerateProductRows());
120
+ ), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
118
121
  }
119
122
  _onMobileCardsInRowChange(t) {
120
- this.currentNode && (s.updateConfig(
123
+ if (!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t)
124
+ return;
125
+ const o = t === 1 ? 0 : O;
126
+ i.updateConfig(
121
127
  this.api,
122
128
  this.currentNode,
123
- { mobileCardsInRow: t },
129
+ { mobileCardsInRow: t, mobileColumnSpacing: o },
124
130
  `Changed mobile products per row to ${t}`
125
- ), O(this.api), g({
131
+ ), I(this.api), f({
126
132
  currentNode: this.currentNode,
127
133
  documentModifier: this.api.getDocumentModifier()
128
- }));
134
+ });
129
135
  }
130
136
  _regenerateProductRows() {
131
- b({
137
+ const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o = b(this.store.recommendationProducts, s);
138
+ P({
132
139
  currentNode: this.currentNode,
133
- documentModifier: this.api.getDocumentModifier()
140
+ documentModifier: this.api.getDocumentModifier(),
141
+ products: o
134
142
  });
135
143
  }
136
144
  _listenToFormUpdates() {
@@ -149,12 +157,12 @@ class S extends h {
149
157
  _listenStateUpdates() {
150
158
  let t = this.store.recommendationConfigs.orientation;
151
159
  this.storeUnsubscription = this.store.$subscribe(() => {
152
- const a = this.store.recommendationConfigs.orientation;
153
- a !== t && (t = a, this._updateProductsInRowVisibility());
160
+ const s = this.store.recommendationConfigs.orientation;
161
+ s !== t && (t = s, this._updateProductsInRowVisibility());
154
162
  });
155
163
  }
156
164
  }
157
165
  export {
158
- P as PRODUCT_LAYOUT_CONTROL_ID,
159
- S as ProductLayoutControl
166
+ M as PRODUCT_LAYOUT_CONTROL_ID,
167
+ V as ProductLayoutControl
160
168
  };
@@ -1,14 +1,14 @@
1
1
  var r = Object.defineProperty;
2
- var u = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var n = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as f } from "../../../common-control.js";
6
- import { RecommendationConfigService as i } from "../../services/configService.js";
2
+ var f = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var n = (o, t, e) => f(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as l } from "../../../common-control.js";
6
+ import { RecommendationConfigService as s } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
8
- const h = "recommendation-shuffle-control", s = {
8
+ const h = "recommendation-shuffle-control", i = {
9
9
  SHUFFLE_PRODUCTS: "shuffleProducts"
10
10
  };
11
- class g extends f {
11
+ class S extends l {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  // Store is used for backward compatibility with product fetching
@@ -22,7 +22,7 @@ class g extends f {
22
22
  <div class="shuffle-control-container">
23
23
  ${this._GuTwoColumns([
24
24
  this._GuLabel({ text: "Shuffle Recommended Products" }),
25
- this._GuToggle(s.SHUFFLE_PRODUCTS)
25
+ this._GuToggle(i.SHUFFLE_PRODUCTS)
26
26
  ])}
27
27
  </div>
28
28
  `;
@@ -34,21 +34,21 @@ class g extends f {
34
34
  super.onTemplateNodeUpdated(e), this._setFormValues();
35
35
  }
36
36
  _setFormValues() {
37
- const e = i.getConfig(this.currentNode);
37
+ const e = s.getConfig(this.currentNode);
38
38
  this.api.updateValues({
39
- [s.SHUFFLE_PRODUCTS]: e.shuffleProducts
39
+ [i.SHUFFLE_PRODUCTS]: e.shuffleProducts
40
40
  });
41
41
  }
42
42
  _initializeToggle() {
43
- const e = i.getConfig(this.currentNode);
43
+ const e = s.getConfig(this.currentNode);
44
44
  this.api.setUIEAttribute(
45
- s.SHUFFLE_PRODUCTS,
46
- l.SELECTPICKER.items,
45
+ i.SHUFFLE_PRODUCTS,
46
+ u.SELECTPICKER.items,
47
47
  e.shuffleProducts
48
48
  );
49
49
  }
50
50
  _onShuffleChange(e) {
51
- this.currentNode && (i.updateConfig(
51
+ !this.currentNode || s.getConfig(this.currentNode).shuffleProducts === e || (s.updateConfig(
52
52
  this.api,
53
53
  this.currentNode,
54
54
  { shuffleProducts: e },
@@ -56,12 +56,12 @@ class g extends f {
56
56
  ), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
57
57
  }
58
58
  _listenToFormUpdates() {
59
- this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
59
+ this.api.onValueChanged(i.SHUFFLE_PRODUCTS, (e) => {
60
60
  this._onShuffleChange(!!e);
61
61
  });
62
62
  }
63
63
  }
64
64
  export {
65
65
  h as SHUFFLE_CONTROL_ID,
66
- g as ShuffleControl
66
+ S as ShuffleControl
67
67
  };