@useinsider/guido 1.4.4 → 2.0.0-beta.087a24f

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 (111) hide show
  1. package/README.md +295 -664
  2. package/dist/@types/config/defaults.js +44 -0
  3. package/dist/@types/config/schemas.js +231 -0
  4. package/dist/@types/config/validator.js +56 -0
  5. package/dist/components/Guido.vue.js +1 -1
  6. package/dist/components/Guido.vue2.js +64 -86
  7. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
  9. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  10. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
  11. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
  12. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  13. package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
  14. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  15. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
  16. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
  17. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
  18. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  19. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
  20. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
  21. package/dist/composables/useActionsApi.js +42 -25
  22. package/dist/composables/useBlocksConfig.js +23 -20
  23. package/dist/composables/useConfig.js +51 -5
  24. package/dist/composables/useHtmlCompiler.js +20 -19
  25. package/dist/composables/useHtmlValidator.js +41 -41
  26. package/dist/composables/usePartner.js +19 -9
  27. package/dist/composables/useStripo.js +55 -56
  28. package/dist/composables/useTimerClone.js +53 -0
  29. package/dist/composables/useTranslations.js +3 -2
  30. package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
  31. package/dist/config/migrator/index.js +9 -8
  32. package/dist/config/migrator/itemsBlockMigrator.js +283 -0
  33. package/dist/enums/defaults.js +4 -67
  34. package/dist/enums/unsubscribe.js +23 -20
  35. package/dist/extensions/Blocks/Items/block.js +39 -40
  36. package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
  37. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
  38. package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
  39. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
  40. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
  41. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
  42. package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
  43. package/dist/extensions/Blocks/Items/template.js +296 -123
  44. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
  45. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
  46. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  47. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
  48. package/dist/extensions/Blocks/common-control.js +64 -53
  49. package/dist/guido.css +1 -1
  50. package/dist/library.js +12 -2
  51. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
  52. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
  53. package/dist/node_modules/valibot/dist/index.js +476 -103
  54. package/dist/services/stripoApi.js +13 -14
  55. package/dist/services/templateLibraryApi.js +18 -18
  56. package/dist/src/@types/config/defaults.d.ts +68 -0
  57. package/dist/src/@types/config/index.d.ts +14 -0
  58. package/dist/src/@types/config/schemas.d.ts +509 -0
  59. package/dist/src/@types/config/types.d.ts +142 -0
  60. package/dist/src/@types/config/validator.d.ts +119 -0
  61. package/dist/src/@types/generic.d.ts +4 -45
  62. package/dist/src/components/Guido.vue.d.ts +13 -12
  63. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  64. package/dist/src/composables/useActionsApi.d.ts +2 -0
  65. package/dist/src/composables/useConfig.d.ts +186 -2
  66. package/dist/src/composables/usePartner.d.ts +8 -0
  67. package/dist/src/composables/useTimerClone.d.ts +6 -0
  68. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  69. package/dist/src/enums/defaults.d.ts +5 -6
  70. package/dist/src/enums/unsubscribe.d.ts +5 -1
  71. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  72. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  73. package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
  74. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
  75. package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
  76. package/dist/src/library.d.ts +3 -1
  77. package/dist/src/stores/config.d.ts +1564 -102
  78. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  79. package/dist/stores/config.js +141 -9
  80. package/package.json +3 -3
  81. package/dist/node_modules/lodash-es/_apply.js +0 -16
  82. package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
  83. package/dist/node_modules/lodash-es/_assignValue.js +0 -10
  84. package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
  85. package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
  86. package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
  87. package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
  88. package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
  89. package/dist/node_modules/lodash-es/_baseRest.js +0 -9
  90. package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
  91. package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  92. package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
  93. package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  94. package/dist/node_modules/lodash-es/_copyArray.js +0 -9
  95. package/dist/node_modules/lodash-es/_copyObject.js +0 -14
  96. package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
  97. package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
  98. package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
  99. package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
  100. package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
  101. package/dist/node_modules/lodash-es/_overRest.js +0 -15
  102. package/dist/node_modules/lodash-es/_safeGet.js +0 -7
  103. package/dist/node_modules/lodash-es/_setToString.js +0 -6
  104. package/dist/node_modules/lodash-es/_shortOut.js +0 -16
  105. package/dist/node_modules/lodash-es/constant.js +0 -8
  106. package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
  107. package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
  108. package/dist/node_modules/lodash-es/keysIn.js +0 -9
  109. package/dist/node_modules/lodash-es/merge.js +0 -8
  110. package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
  111. package/dist/package.json.js +0 -7
@@ -0,0 +1,172 @@
1
+ import { ModificationDescription as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { DefaultConfigValues as e, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
3
+ function d() {
4
+ return String(Date.now() + Math.floor(Math.random() * 1e3));
5
+ }
6
+ function f() {
7
+ return {
8
+ initialized: !0,
9
+ blockInstanceId: d(),
10
+ source: n.ITEMS_TYPE.CART_ITEMS,
11
+ type: n.ITEMS_TYPE.CART_ITEMS,
12
+ itemsSelectValue: e.cartItemsSelectControlValue,
13
+ orientation: n.ORIENTATION.VERTICAL,
14
+ nameTrimming: e.productNameTrimmingControlValue === "1",
15
+ nameControlEnabled: e.productNameControlEnabled === "1",
16
+ priceHideDiscount: e.productPriceHideDiscountControlValue === "1",
17
+ priceFormatted: e.productPriceFormattedControlValue === "1",
18
+ priceCurrencySymbol: e.productPriceCurrencySymbolControlValue,
19
+ priceCurrencyLocation: e.productPriceCurrencyLocationControlValue,
20
+ priceControlOpened: e.productPriceControlOpened === "1",
21
+ priceOrientation: "horizontal",
22
+ quantityControlEnabled: e.productQuantityControlEnabled === "1",
23
+ buttonLink: e.productButtonLinkControlValue,
24
+ imageLink: e.productImageLinkControlValue,
25
+ buttonLabel: "Buy",
26
+ imageVisible: e.productImageVisible === "1",
27
+ nameVisible: e.productNameVisible === "1",
28
+ quantityVisible: e.productQuantityVisible === "1",
29
+ priceVisible: e.productPriceVisible === "1",
30
+ originalPriceVisible: e.productOriginalPriceVisible === "1",
31
+ buttonVisible: e.productButtonVisible === "1"
32
+ };
33
+ }
34
+ function s(r) {
35
+ if (!r)
36
+ return null;
37
+ const t = r.closest(".items-block-v2");
38
+ return t || r.closest(".esd-cart-items-block");
39
+ }
40
+ function m(r) {
41
+ return r ? {
42
+ CartItems: n.ITEMS_TYPE.CART_ITEMS,
43
+ BrowsedItems: n.ITEMS_TYPE.BROWSED_ITEMS,
44
+ PurchasedItems: n.ITEMS_TYPE.PURCHASED_ITEMS,
45
+ // Also handle already correct formats
46
+ CART_ITEMS: n.ITEMS_TYPE.CART_ITEMS,
47
+ BROWSED_ITEMS: n.ITEMS_TYPE.BROWSED_ITEMS,
48
+ PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
49
+ }[r] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
50
+ }
51
+ function C(r, t) {
52
+ if (!r)
53
+ return e.cartItemsSelectControlValue;
54
+ if (r.includes("{{"))
55
+ return r;
56
+ if (/^\d+$/.test(r)) {
57
+ const i = parseInt(r) - 1, o = g[t];
58
+ if (o && o[i])
59
+ return o[i].value;
60
+ }
61
+ return e.cartItemsSelectControlValue;
62
+ }
63
+ function I(r) {
64
+ const t = r.querySelector("esd-config-block");
65
+ if (!t)
66
+ return null;
67
+ const i = (c, a) => c == null ? a : c === "1" || c === "true", o = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), p = t.getAttribute("data-cart_items_select_control_value"), b = C(p, u);
68
+ return {
69
+ initialized: i(t.getAttribute("data-initialized"), !1),
70
+ blockInstanceId: o(
71
+ t.getAttribute("data-block-instance-id"),
72
+ d()
73
+ ),
74
+ source: u,
75
+ type: u,
76
+ itemsSelectValue: b,
77
+ orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
78
+ nameTrimming: i(
79
+ t.getAttribute("data-product_name_trimming"),
80
+ !0
81
+ ),
82
+ nameControlEnabled: i(
83
+ t.getAttribute("data-product_name_control_enabled"),
84
+ !0
85
+ ),
86
+ priceHideDiscount: i(
87
+ t.getAttribute("data-product_price_hide_discount"),
88
+ !0
89
+ ),
90
+ priceFormatted: i(
91
+ t.getAttribute("data-product_price_formatted"),
92
+ !0
93
+ ),
94
+ priceCurrencySymbol: o(
95
+ t.getAttribute("data-product_price_currency_symbol"),
96
+ e.productPriceCurrencySymbolControlValue
97
+ ),
98
+ priceCurrencyLocation: o(
99
+ t.getAttribute("data-product_price_currency_location"),
100
+ e.productPriceCurrencyLocationControlValue
101
+ ),
102
+ priceControlOpened: i(
103
+ t.getAttribute("data-product_price_control_opened"),
104
+ !0
105
+ ),
106
+ priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
107
+ quantityControlEnabled: i(
108
+ t.getAttribute("data-product_quantity_control_enabled"),
109
+ !0
110
+ ),
111
+ buttonLink: o(
112
+ t.getAttribute("data-product_button_link"),
113
+ e.productButtonLinkControlValue
114
+ ),
115
+ imageLink: o(
116
+ t.getAttribute("data-product_image_link"),
117
+ e.productImageLinkControlValue
118
+ ),
119
+ buttonLabel: o(
120
+ t.getAttribute("data-product_button_control_label"),
121
+ "Buy"
122
+ ),
123
+ imageVisible: i(
124
+ t.getAttribute("data-product_image_visible"),
125
+ !0
126
+ ),
127
+ nameVisible: i(
128
+ t.getAttribute("data-product_name_visible"),
129
+ !0
130
+ ),
131
+ quantityVisible: i(
132
+ t.getAttribute("data-product_quantity_visible"),
133
+ !0
134
+ ),
135
+ priceVisible: i(
136
+ t.getAttribute("data-product_price_visible"),
137
+ !0
138
+ ),
139
+ originalPriceVisible: i(
140
+ t.getAttribute("data-product_original_price_control_enabled"),
141
+ !0
142
+ ),
143
+ buttonVisible: i(
144
+ t.getAttribute("data-product_button_visible"),
145
+ !0
146
+ )
147
+ };
148
+ }
149
+ function S(r) {
150
+ const t = s(r);
151
+ if (!t)
152
+ return null;
153
+ const i = t.getNodeConfig();
154
+ if (i && i.initialized)
155
+ return i;
156
+ const o = I(t);
157
+ return o || null;
158
+ }
159
+ function y(r, t, i) {
160
+ const o = s(r);
161
+ if (!o)
162
+ return;
163
+ const u = { ...o.getNodeConfig() || {}, ...i };
164
+ t.getDocumentModifier().modifyHtml(o).setNodeConfig(u).apply(new _("Update Items block configuration"));
165
+ }
166
+ export {
167
+ d as generateBlockInstanceId,
168
+ f as getDefaultItemsBlockConfig,
169
+ S as getItemsBlockConfig,
170
+ s as getItemsBlockContainer,
171
+ y as setItemsBlockConfig
172
+ };
@@ -1,6 +1,6 @@
1
1
  import { useItemsBlockStore as e } from "../store/items-block.js";
2
2
  import { syncAttributeFromConfigBlock as r, createBooleanSyncConfig as i, createStringSyncConfig as s } from "./syncAttributeFromConfigBlock.js";
3
- function m(t) {
3
+ function C(t) {
4
4
  const o = e(), n = i(
5
5
  "PRODUCT_NAME_TRIMMING",
6
6
  (c) => o.setNameTrimming(c),
@@ -12,7 +12,7 @@ function f(t) {
12
12
  const o = e(), n = i(
13
13
  "PRODUCT_PRICE_HIDE_DISCOUNT",
14
14
  (c) => o.setHideDiscount(c),
15
- !1
15
+ !0
16
16
  );
17
17
  r(t, n);
18
18
  }
@@ -24,7 +24,7 @@ function R(t) {
24
24
  );
25
25
  r(t, n);
26
26
  }
27
- function O(t) {
27
+ function _(t) {
28
28
  const o = e(), n = s(
29
29
  "PRODUCT_PRICE_CURRENCY_SYMBOL",
30
30
  (c) => o.setCurrencySymbol(c),
@@ -32,7 +32,7 @@ function O(t) {
32
32
  );
33
33
  r(t, n);
34
34
  }
35
- function _(t) {
35
+ function y(t) {
36
36
  const o = e(), n = s(
37
37
  "PRODUCT_PRICE_CURRENCY_LOCATION",
38
38
  (c) => o.setCurrencyLocation(c),
@@ -40,7 +40,7 @@ function _(t) {
40
40
  );
41
41
  r(t, n);
42
42
  }
43
- function I(t) {
43
+ function T(t) {
44
44
  const o = e(), n = s(
45
45
  "PRODUCT_BUTTON_LINK",
46
46
  (c) => o.setButtonLink(c),
@@ -48,7 +48,7 @@ function I(t) {
48
48
  );
49
49
  r(t, n);
50
50
  }
51
- function T(t) {
51
+ function g(t) {
52
52
  const o = e(), n = s(
53
53
  "PRODUCT_IMAGE_LINK",
54
54
  (c) => o.setImageLink(c),
@@ -56,21 +56,12 @@ function T(t) {
56
56
  );
57
57
  r(t, n);
58
58
  }
59
- function y(t) {
60
- const o = e(), n = s(
61
- "PRODUCT_ORIGINAL_PRICE_CONTROL_ORIENTATION",
62
- (c) => o.setPriceOrientation(c),
63
- "horizontal"
64
- );
65
- r(t, n);
66
- }
67
59
  export {
68
- I as syncButtonLinkFromAttributes,
69
- _ as syncCurrencyLocationFromAttributes,
70
- O as syncCurrencySymbolFromAttributes,
60
+ T as syncButtonLinkFromAttributes,
61
+ y as syncCurrencyLocationFromAttributes,
62
+ _ as syncCurrencySymbolFromAttributes,
71
63
  R as syncFormattedPriceFromAttributes,
72
64
  f as syncHideDiscountFromAttributes,
73
- T as syncImageLinkFromAttributes,
74
- m as syncNameTrimmingFromAttributes,
75
- y as syncPriceOrientationFromAttributes
65
+ g as syncImageLinkFromAttributes,
66
+ C as syncNameTrimmingFromAttributes
76
67
  };
@@ -289,7 +289,7 @@ class b extends g {
289
289
  t.CURRENCY_DECIMAL_COUNT
290
290
  ].forEach((i) => {
291
291
  this.api.onValueChanged(i, (a) => this._onCurrencyConfigChange(i, a));
292
- }), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, i.toString())), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => this._onDataChange(t.PRODUCT_IN_ROW, i)), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => this._onDataChange(t.SHUFFLE_PRODUCTS, i)), this.api.onValueChanged(t.RESPONSIVE, (i) => this._onDataChange(t.RESPONSIVE, i)), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (o = this.addFilterButton) == null || o.addEventListener("click", this.addFilterListener);
292
+ }), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, String(i))), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => this._onDataChange(t.PRODUCT_IN_ROW, i)), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => this._onDataChange(t.SHUFFLE_PRODUCTS, i)), this.api.onValueChanged(t.RESPONSIVE, (i) => this._onDataChange(t.RESPONSIVE, i)), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (o = this.addFilterButton) == null || o.addEventListener("click", this.addFilterListener);
293
293
  }
294
294
  _listenStateUpdates() {
295
295
  this.storeUnsubscription = this.store.$subscribe((e) => {
@@ -1,8 +1,9 @@
1
- import { RecommendationFeedSourceMaps as s, PriceAttributes as l } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as c } from "../../../../services/recommendationApi.js";
1
+ import { RecommendationFeedSourceMaps as n, PriceAttributes as u } from "../../../../enums/extensions/recommendationBlock.js";
2
+ import { useRecommendationApi as l } from "../../../../services/recommendationApi.js";
3
+ import { useConfigStore as c } from "../../../../stores/config.js";
3
4
  import { defineStore as p } from "pinia";
4
5
  import { generateCompleteFilterQuery as m } from "../utils/filterUtil.js";
5
- const a = c(), d = () => ({
6
+ const a = l(), d = () => ({
6
7
  recommendationCampaignUrls: {},
7
8
  recommendationProducts: [],
8
9
  recommendationConfigs: {
@@ -133,7 +134,7 @@ const a = c(), d = () => ({
133
134
  filterSelectionDrawerStatus: !1,
134
135
  filterList: {},
135
136
  filterGroup: 1
136
- }), G = p("guidoRecommendationExtension", {
137
+ }), y = p("guidoRecommendationExtension", {
137
138
  state: () => d(),
138
139
  getters: {
139
140
  hasFilters: (e) => !!e.recommendationConfigs.filters.length,
@@ -144,7 +145,7 @@ const a = c(), d = () => ({
144
145
  getActivePredictiveAlgorithms: (e) => {
145
146
  const t = [];
146
147
  return e.activePredictiveAlgorithms.forEach((r) => {
147
- t.push(...s.filter((i) => i.id === r));
148
+ t.push(...n.filter((i) => i.id === r));
148
149
  }), t.map((r) => ({
149
150
  text: r.name,
150
151
  value: r.key
@@ -159,7 +160,7 @@ const a = c(), d = () => ({
159
160
  value: t.text
160
161
  })),
161
162
  getFilterList: (e) => Object.values(e.filterList).map((t) => {
162
- const r = t.type === "defaultAttribute", i = l.includes(t.attributeName);
163
+ const r = t.type === "defaultAttribute", i = u.includes(t.attributeName);
163
164
  let o = r ? t.attributeName : `product_attributes.${t.attributeName}`;
164
165
  return o = i ? `${o}.${e.recommendationConfigs.currencySettings.value}` : o, {
165
166
  text: t.displayName,
@@ -240,14 +241,14 @@ const a = c(), d = () => ({
240
241
  return m(this.recommendationConfigs.filters);
241
242
  },
242
243
  async fetchRecommendationProducts() {
243
- var i, o, n;
244
- const e = this.generateFilterQuery(), t = ((i = s.find((u) => u.key === this.recommendationConfigs.strategy)) == null ? void 0 : i.path) || "", r = await a.fetchRecommendationProducts(
244
+ var o;
245
+ const e = this.generateFilterQuery(), t = ((o = n.find((s) => s.key === this.recommendationConfigs.strategy)) == null ? void 0 : o.path) || "", r = c(), i = await a.fetchRecommendationProducts(
245
246
  t,
246
247
  {
247
248
  // TODO: Here will be optimized and filled carefully
248
249
  locale: this.recommendationConfigs.language,
249
250
  currency: this.recommendationConfigs.currencySettings.value,
250
- partnerName: ((n = (o = window.GuidoConfig) == null ? void 0 : o.partner) == null ? void 0 : n.partnerName) || "",
251
+ partnerName: r.partnerName,
251
252
  productId: this.recommendationConfigs.strategy === "manualMerchandising" ? this.recommendationConfigs.productIds.join(",") : "{itemId}",
252
253
  size: this.recommendationConfigs.size,
253
254
  details: !0,
@@ -256,11 +257,11 @@ const a = c(), d = () => ({
256
257
  }
257
258
  );
258
259
  this.$patch({
259
- recommendationProducts: r
260
+ recommendationProducts: i
260
261
  });
261
262
  }
262
263
  }
263
264
  });
264
265
  export {
265
- G as useRecommendationExtensionStore
266
+ y as useRecommendationExtensionStore
266
267
  };
@@ -1,8 +1,8 @@
1
1
  var c = Object.defineProperty;
2
- var I = (a, r, e) => r in a ? c(a, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[r] = e;
3
- var l = (a, r, e) => I(a, typeof r != "symbol" ? r + "" : r, e);
4
- import { Control as O, UIElementType as t, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- class _ extends O {
2
+ var I = (T, r, e) => r in T ? c(T, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[r] = e;
3
+ var l = (T, r, e) => I(T, typeof r != "symbol" ? r + "" : r, e);
4
+ import { Control as s, UIElementType as t, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ class B extends s {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  l(this, "currentNode");
@@ -19,43 +19,54 @@ class _ extends O {
19
19
  this.lastBlockInstanceId = null;
20
20
  }
21
21
  /**
22
- * Gets the config block element from the current node.
22
+ * Gets the Items block container element from the current node.
23
+ * @returns The container element or null if not found
24
+ */
25
+ getItemsBlockContainer() {
26
+ return this.currentNode ? this.currentNode.closest(".items-block-v2") : null;
27
+ }
28
+ /**
29
+ * Gets the config block element from the current node (legacy support).
30
+ * @deprecated Use getNodeConfig() from nodeConfigUtils instead for Stripo V2
23
31
  * @returns The config block element or null if not found
24
32
  */
25
33
  getConfigBlock() {
26
- if (!this.currentNode)
27
- return null;
28
- const e = this.currentNode.closest(".items-block-v2");
34
+ const e = this.getItemsBlockContainer();
29
35
  return e ? e.querySelector("esd-config-block") : null;
30
36
  }
31
37
  /**
32
- * Gets the current block instance ID from the config block.
33
- * @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
38
+ * Gets the current block instance ID from the node config (Stripo V2) or legacy config block.
34
39
  * @returns The block instance ID or null if not found
35
40
  */
36
- getBlockInstanceId(e = "data-block-instance-id") {
37
- const n = this.getConfigBlock();
38
- return n ? n.getAttribute(e) : null;
41
+ getBlockInstanceId() {
42
+ const e = this.getItemsBlockContainer();
43
+ if (!e)
44
+ return null;
45
+ const n = e.getNodeConfig();
46
+ if (n && typeof n.blockInstanceId == "string")
47
+ return n.blockInstanceId;
48
+ const o = this.getConfigBlock();
49
+ return o ? o.getAttribute("data-block-instance-id") : null;
39
50
  }
40
51
  /**
41
52
  * Handles block instance change detection and syncing.
42
- * This is a helper method for controls that need to sync attributes when switching between block instances.
43
- * @param syncFunction - Function to call when block instance changes (to sync from attributes)
53
+ * This is a helper method for controls that need to sync config when switching between block instances.
54
+ * Uses Stripo V2 nodeConfig API for block instance tracking.
55
+ * @param syncFunction - Function to call when block instance changes (to sync from node config)
44
56
  * @param updateUI - Function to call to update the UI (called both on change and when same block)
45
- * @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
46
57
  * @returns true if block instance changed, false otherwise
47
58
  */
48
- handleBlockInstanceChange(e, n, E = "data-block-instance-id") {
49
- const o = this.getBlockInstanceId(E);
59
+ handleBlockInstanceChange(e, n) {
60
+ const o = this.getBlockInstanceId();
50
61
  if (!o)
51
62
  return !1;
52
- const T = o !== this.lastBlockInstanceId;
53
- return T ? (this.currentNode && e(this.currentNode), n(), this.lastBlockInstanceId = o) : n(), T;
63
+ const E = o !== this.lastBlockInstanceId;
64
+ return E ? (this.currentNode && e(this.currentNode), n(), this.lastBlockInstanceId = o) : n(), E;
54
65
  }
55
- _GuLabel({ text: e, name: n = "", position: E = "top" }) {
66
+ _GuLabel({ text: e, name: n = "", position: o = "top" }) {
56
67
  return `
57
68
  <${t.LABEL}
58
- style="${E === "top" ? "margin-bottom: 8px;" : ""}"
69
+ style="${o === "top" ? "margin-bottom: 8px;" : ""}"
59
70
  ${$.LABEL.text}="${e}"
60
71
  ${$.LABEL.name}="${n || `${e} Label`}">
61
72
  </${t.LABEL}>
@@ -75,59 +86,59 @@ class _ extends O {
75
86
  ${$.SELECT_ITEM.value}="${n}">
76
87
  </${t.SELECT_ITEM}>`;
77
88
  }
78
- _GuSelect({ name: e, placeholder: n, options: E, className: o = "es-180w" }) {
89
+ _GuSelect({ name: e, placeholder: n, options: o, className: E = "es-180w" }) {
79
90
  return `
80
91
  <${t.SELECTPICKER}
81
- class="${o}"
92
+ class="${E}"
82
93
  ${$.SELECTPICKER.name}="${e}"
83
94
  ${$.SELECTPICKER.placeholder}="${n}">
84
- ${E.map((T) => this._GuSelectItem(T)).join("")}
95
+ ${o.map((a) => this._GuSelectItem(a)).join("")}
85
96
  </${t.SELECTPICKER}>
86
97
  `;
87
98
  }
88
- _GuTextInput({ name: e, placeholder: n, className: E = "", disabled: o = !1 }) {
99
+ _GuTextInput({ name: e, placeholder: n, className: o = "", disabled: E = !1 }) {
89
100
  return `
90
101
  <${t.TEXT}
91
- class=${E}
102
+ class=${o}
92
103
  ${$.TEXT.name}="${e}"
93
104
  placeholder="${n || e}"
94
- ${o ? `${$.TEXT.disabled}="true"` : ""}>
105
+ ${E ? `${$.TEXT.disabled}="true"` : ""}>
95
106
  </${t.TEXT}>
96
107
  `;
97
108
  }
98
- _GuCounter({ name: e, maxValue: n, minValue: E = 1, step: o = 1 }) {
109
+ _GuCounter({ name: e, maxValue: n, minValue: o = 1, step: E = 1 }) {
99
110
  return `
100
111
  <${t.COUNTER}
101
112
  ${$.COUNTER.name}="${e}"
102
- ${$.COUNTER.minValue}="${E}"
113
+ ${$.COUNTER.minValue}="${o}"
103
114
  ${$.COUNTER.maxValue}="${n}"
104
- ${$.COUNTER.step}="${o}">
115
+ ${$.COUNTER.step}="${E}">
105
116
  </${t.COUNTER}>
106
117
  `;
107
118
  }
108
- _GuRadioButtonItem({ text: e, value: n, icon: E }) {
119
+ _GuRadioButtonItem({ text: e, value: n, icon: o }) {
109
120
  return `
110
121
  <${t.RADIO_ITEM}
111
122
  ${$.RADIO_ITEM.value}="${n}"
112
123
  ${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
113
- ${E ? `${$.RADIO_ITEM.icon}="${E}"` : ""}>
124
+ ${o ? `${$.RADIO_ITEM.icon}="${o}"` : ""}>
114
125
  </${t.RADIO_ITEM}>
115
126
  `;
116
127
  }
117
- _GuRadioButton({ name: e, buttons: n, id: E = "" }) {
128
+ _GuRadioButton({ name: e, buttons: n, id: o = "" }) {
118
129
  return `
119
130
  <${t.RADIO_BUTTONS}
120
- ${E ? `id="${E}"` : ""}
131
+ ${o ? `id="${o}"` : ""}
121
132
  ${$.RADIO_BUTTONS.name}="${e}">
122
- ${n.map((o) => this._GuRadioButtonItem(o)).join("")}
133
+ ${n.map((E) => this._GuRadioButtonItem(E)).join("")}
123
134
  </${t.RADIO_BUTTONS}>
124
135
  `;
125
136
  }
126
- _GuButton({ name: e, label: n, id: E = "" }) {
137
+ _GuButton({ name: e, label: n, id: o = "" }) {
127
138
  return `
128
139
  <${t.BUTTON}
129
140
  ${$.BUTTON.name}="${e}"
130
- ${E ? `id="${E}"` : ""}
141
+ ${o ? `id="${o}"` : ""}
131
142
  ${$.BUTTON.caption}="${n}"}>
132
143
  </${t.BUTTON}>
133
144
  `;
@@ -137,10 +148,10 @@ class _ extends O {
137
148
  * @param param0
138
149
  * @returns It returns a button with an icon.
139
150
  */
140
- _GuIconButton({ name: e, icon: n, className: E = "" }) {
151
+ _GuIconButton({ name: e, icon: n, className: o = "" }) {
141
152
  return `
142
153
  <${t.BUTTON}
143
- class="${E}"
154
+ class="${o}"
144
155
  ${$.BUTTON.name}="${e}"
145
156
  ${$.BUTTON.icon}="${n}">
146
157
  </${t.BUTTON}>
@@ -168,19 +179,19 @@ class _ extends O {
168
179
  * @returns HTML string for the orderable control
169
180
  */
170
181
  _GuOrderable(e, n) {
171
- let E = "";
172
- n.forEach((T) => {
182
+ let o = "";
183
+ n.forEach((a) => {
173
184
  const u = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
174
- E += `
175
- <${t.ORDERABLE_ITEM} ${u}="${T.key}">
176
- ${T.content}
185
+ o += `
186
+ <${t.ORDERABLE_ITEM} ${u}="${a.key}">
187
+ ${a.content}
177
188
  </${t.ORDERABLE_ITEM}>
178
189
  `;
179
190
  });
180
- const o = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
191
+ const E = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
181
192
  return `
182
- <${t.ORDERABLE} ${o}="${e}">
183
- ${E}
193
+ <${t.ORDERABLE} ${E}="${e}">
194
+ ${o}
184
195
  </${t.ORDERABLE}>
185
196
  `;
186
197
  }
@@ -221,16 +232,16 @@ class _ extends O {
221
232
  `;
222
233
  }
223
234
  _GuRadioButtons(e, n) {
224
- const E = n.map((o) => `
235
+ const o = n.map((E) => `
225
236
  <${t.RADIO_ITEM}
226
- ${$.RADIO_ITEM.text}="${o.text}"
227
- ${$.RADIO_ITEM.value}="${o.value}">
237
+ ${$.RADIO_ITEM.text}="${E.text}"
238
+ ${$.RADIO_ITEM.value}="${E.value}">
228
239
  </${t.RADIO_ITEM}>
229
240
  `).join("");
230
241
  return `
231
242
  <${t.RADIO_BUTTONS}
232
243
  ${$.RADIO_BUTTONS.name}="${e}">
233
- ${E}
244
+ ${o}
234
245
  </${t.RADIO_BUTTONS}>
235
246
  `;
236
247
  }
@@ -244,5 +255,5 @@ class _ extends O {
244
255
  }
245
256
  }
246
257
  export {
247
- _ as CommonControl
258
+ B as CommonControl
248
259
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-98181b5a]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-98181b5a]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-98181b5a]{height:calc(100vh - 75px)}[data-v-70835920] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-06e6f7a7] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-282ca4d1]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-282ca4d1]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-282ca4d1]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-bb3bb07c] .guido__verion-history-view-option-selection-desktop svg,[data-v-bb3bb07c] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-bb3bb07c] .in-segments-wrapper__button_selected,[data-v-bb3bb07c] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-b37f3f6d],[data-v-b37f3f6d] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-4b876c1b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
package/dist/library.js CHANGED
@@ -1,4 +1,14 @@
1
- import { default as d } from "./components/Guido.vue.js";
1
+ import { default as a } from "./components/Guido.vue.js";
2
+ import { MessageType as f, ProductType as t } from "./@types/config/schemas.js";
3
+ import "./@types/config/defaults.js";
4
+ import { getValidationErrors as s, isValidConfig as d, parseConfig as g, parseConfigSafe as n, validateConfig as l } from "./@types/config/validator.js";
2
5
  export {
3
- d as Guido
6
+ a as Guido,
7
+ f as MessageType,
8
+ t as ProductType,
9
+ s as getValidationErrors,
10
+ d as isValidConfig,
11
+ g as parseConfig,
12
+ n as parseConfigSafe,
13
+ l as validateConfig
4
14
  };