@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29
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.
- package/dist/composables/useActionsApi.js +64 -80
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +10 -11
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/extensions/Blocks/Items/block.js +42 -43
- package/dist/extensions/Blocks/Recommendation/block.js +29 -33
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -5
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
- package/dist/src/stores/editor.d.ts +1 -3
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/static/styles/components/button.css.js +0 -5
- package/dist/stores/editor.js +0 -5
- package/dist/utils/fullStoryScripts.js +8 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
|
-
var T = (
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
2
|
+
var T = (a, n, t) => n in a ? f(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
|
+
var l = (a, n, t) => T(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { UEAttr as d, EditorStatePropertyType as b, PreviewDeviceMode as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as P } from "../../../common-control.js";
|
|
6
6
|
import "../../constants/selectors.js";
|
|
7
|
-
import { MAX_PRODUCTS_PER_ROW as
|
|
8
|
-
import { RecommendationConfigService as
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import {
|
|
11
|
-
import { isPartnerManagedBlock as
|
|
7
|
+
import { MAX_PRODUCTS_PER_ROW as C, MAX_MOBILE_PRODUCTS_PER_ROW as D, DEFAULT_MOBILE_CARDS_IN_ROW as _ } from "../../constants/layout.js";
|
|
8
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
9
|
+
import { useRecommendationExtensionStore as M } from "../../store/recommendation.js";
|
|
10
|
+
import { setMobileLayoutOptOut as m, ensureMobileCssRulesExist as L } from "../mobileLayout/cssRules.js";
|
|
11
|
+
import { isPartnerManagedBlock as y, getCurrentLayout as w, getBlockElement as U, adjustProductsToSize as I, regenerateProductRowsWithStyles as g, regenerateMobileProductRows as E } from "./utils.js";
|
|
12
|
+
import { useDebounceFn as A } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
13
|
const B = "recommendation-product-layout-control", e = {
|
|
13
14
|
// "Products in One Row" — shown when toggle is OFF
|
|
14
15
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
@@ -23,13 +24,16 @@ const B = "recommendation-product-layout-control", e = {
|
|
|
23
24
|
MOBILE_LAYOUT_TOGGLE: "mobileLayoutEnabled",
|
|
24
25
|
MOBILE_LAYOUT_LABEL: "mobileLayoutLabel"
|
|
25
26
|
};
|
|
26
|
-
class
|
|
27
|
+
class F extends P {
|
|
27
28
|
constructor() {
|
|
28
29
|
super(...arguments);
|
|
29
30
|
// Store is used for backward compatibility with product fetching and regeneration
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
l(this, "store", M());
|
|
32
|
+
l(this, "storeUnsubscription", () => {
|
|
32
33
|
});
|
|
34
|
+
l(this, "_debouncedRegenerateProductRows", A(() => {
|
|
35
|
+
this._regenerateProductRows();
|
|
36
|
+
}, 500));
|
|
33
37
|
}
|
|
34
38
|
getId() {
|
|
35
39
|
return B;
|
|
@@ -42,19 +46,19 @@ class K extends N {
|
|
|
42
46
|
text: this.api.translate("Products in One Row"),
|
|
43
47
|
name: e.PRODUCT_IN_ROW_LABEL
|
|
44
48
|
}),
|
|
45
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue:
|
|
49
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: C }),
|
|
46
50
|
this._GuLabel({
|
|
47
51
|
text: this.api.translate("Products in One Row on Desktop"),
|
|
48
52
|
name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
|
|
49
53
|
}),
|
|
50
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue:
|
|
54
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: C }),
|
|
51
55
|
this._GuLabel({
|
|
52
56
|
text: this.api.translate("Products in One Row on Mobile"),
|
|
53
57
|
name: e.MOBILE_CARDS_IN_ROW_LABEL
|
|
54
58
|
}),
|
|
55
59
|
this._GuCounter({
|
|
56
60
|
name: e.MOBILE_CARDS_IN_ROW,
|
|
57
|
-
maxValue:
|
|
61
|
+
maxValue: D
|
|
58
62
|
}),
|
|
59
63
|
this._GuLabel({
|
|
60
64
|
text: this.api.translate("Mobile Layout Optimization"),
|
|
@@ -82,14 +86,14 @@ class K extends N {
|
|
|
82
86
|
* these inputs there. Disabling coexists with the visibility logic above.
|
|
83
87
|
*/
|
|
84
88
|
_syncDisabledState() {
|
|
85
|
-
const t =
|
|
86
|
-
this.api.setUIEAttribute(e.PRODUCT_IN_ROW,
|
|
89
|
+
const t = y(this.currentNode);
|
|
90
|
+
this.api.setUIEAttribute(e.PRODUCT_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, d.SWITCHER.disabled, t);
|
|
87
91
|
}
|
|
88
92
|
onDestroy() {
|
|
89
93
|
this.storeUnsubscription();
|
|
90
94
|
}
|
|
91
95
|
_setFormValues() {
|
|
92
|
-
const t =
|
|
96
|
+
const t = s.getConfig(this.currentNode);
|
|
93
97
|
this.api.updateValues({
|
|
94
98
|
[e.PRODUCT_IN_ROW]: t.cardsInRow,
|
|
95
99
|
[e.PRODUCT_IN_ROW_DESKTOP]: t.cardsInRow,
|
|
@@ -101,7 +105,7 @@ class K extends N {
|
|
|
101
105
|
* Returns true when the editor preview is in mobile mode.
|
|
102
106
|
*/
|
|
103
107
|
_isMobilePreview() {
|
|
104
|
-
return this.api.getEditorState()[
|
|
108
|
+
return this.api.getEditorState()[b.previewDeviceMode] === N.MOBILE;
|
|
105
109
|
}
|
|
106
110
|
/**
|
|
107
111
|
* Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
|
|
@@ -116,22 +120,22 @@ class K extends N {
|
|
|
116
120
|
*/
|
|
117
121
|
_updateProductsInRowVisibility() {
|
|
118
122
|
var p;
|
|
119
|
-
const t =
|
|
123
|
+
const t = s.getConfig(this.currentNode), i = (t.layout || w(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, u = this._isMobilePreview();
|
|
120
124
|
this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, i), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, i);
|
|
121
|
-
const
|
|
122
|
-
this.api.setVisibility(e.PRODUCT_IN_ROW,
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
+
const c = i && !r, h = i && r && !u, R = i && r && u;
|
|
126
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, h), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, R), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, R);
|
|
127
|
+
const O = (p = this.getContainer()) == null ? void 0 : p.querySelector("[data-product-layout-control]");
|
|
128
|
+
O && (O.style.display = i ? "" : "none");
|
|
125
129
|
}
|
|
126
130
|
/**
|
|
127
131
|
* Initializes the mobile layout toggle using the same pattern as shuffle.ts.
|
|
128
132
|
* Sets the initial UI attribute value from the node config.
|
|
129
133
|
*/
|
|
130
134
|
_initializeMobileLayoutToggle() {
|
|
131
|
-
const t =
|
|
135
|
+
const t = s.getConfig(this.currentNode);
|
|
132
136
|
this.api.setUIEAttribute(
|
|
133
137
|
e.MOBILE_LAYOUT_TOGGLE,
|
|
134
|
-
|
|
138
|
+
d.SELECTPICKER.items,
|
|
135
139
|
t.mobileLayoutEnabled
|
|
136
140
|
);
|
|
137
141
|
}
|
|
@@ -143,91 +147,85 @@ class K extends N {
|
|
|
143
147
|
_onMobileLayoutToggleChange(t) {
|
|
144
148
|
if (!this.currentNode)
|
|
145
149
|
return;
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
150
|
+
const o = s.getConfig(this.currentNode);
|
|
151
|
+
if (o.mobileLayoutEnabled === t)
|
|
152
|
+
return;
|
|
153
|
+
const i = U(this.currentNode);
|
|
154
|
+
if (t) {
|
|
155
|
+
const r = o.previousMobileCardsInRow || _;
|
|
156
|
+
s.updateConfig(
|
|
157
|
+
this.api,
|
|
158
|
+
this.currentNode,
|
|
159
|
+
{
|
|
160
|
+
mobileLayoutEnabled: !0,
|
|
161
|
+
mobileCardsInRow: r
|
|
162
|
+
},
|
|
163
|
+
"Enabled mobile layout optimization"
|
|
164
|
+
), this.store.patchCurrentBlockConfig(
|
|
165
|
+
{
|
|
166
|
+
mobileLayoutEnabled: !0,
|
|
167
|
+
mobileCardsInRow: r
|
|
168
|
+
},
|
|
169
|
+
{ triggerRefetch: !1 }
|
|
170
|
+
), i && m(this.api, i, !1), L(this.api);
|
|
171
|
+
const u = parseInt(o.size) || 6, c = I(this.store.recommendationProducts, u);
|
|
172
|
+
g({
|
|
173
|
+
currentNode: this.currentNode,
|
|
174
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
175
|
+
products: c
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
const r = o.mobileCardsInRow;
|
|
179
|
+
s.updateConfig(
|
|
180
|
+
this.api,
|
|
181
|
+
this.currentNode,
|
|
182
|
+
{
|
|
166
183
|
mobileLayoutEnabled: !1,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
!
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
) && this.store.patchCurrentBlockConfig(
|
|
184
|
-
{ mobileLayoutEnabled: !1, mobileCardsInRow: R },
|
|
185
|
-
{ triggerRefetch: !1 }
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// One apply: a config/class mismatch between two applies makes the block's self-heal write its own entry.
|
|
192
|
-
// Reports false when nothing reached the node, so the caller keeps the store aligned with it.
|
|
193
|
-
_commitMobileLayoutToggle(t, s, i, o) {
|
|
194
|
-
if (!this.currentNode)
|
|
195
|
-
return !1;
|
|
196
|
-
const n = this.api.getDocumentModifier(), d = A(this.currentNode);
|
|
197
|
-
try {
|
|
198
|
-
return r.stageConfig(n, this.currentNode, t), d && D(n, d, s), o(n), n.apply(new O(i)), !0;
|
|
199
|
-
} catch (l) {
|
|
200
|
-
return console.warn("[recommendation] mobile layout toggle write failed", l), !1;
|
|
184
|
+
previousMobileCardsInRow: r,
|
|
185
|
+
mobileCardsInRow: _
|
|
186
|
+
},
|
|
187
|
+
"Disabled mobile layout optimization"
|
|
188
|
+
), this.store.patchCurrentBlockConfig(
|
|
189
|
+
{
|
|
190
|
+
mobileLayoutEnabled: !1,
|
|
191
|
+
mobileCardsInRow: _
|
|
192
|
+
},
|
|
193
|
+
{ triggerRefetch: !1 }
|
|
194
|
+
), i && m(this.api, i, !0), E({
|
|
195
|
+
currentNode: this.currentNode,
|
|
196
|
+
documentModifier: this.api.getDocumentModifier()
|
|
197
|
+
});
|
|
201
198
|
}
|
|
199
|
+
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
202
200
|
}
|
|
203
201
|
_onProductsInRowChange(t) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
202
|
+
!this.currentNode || s.getConfig(this.currentNode).cardsInRow === t || (s.updateConfig(
|
|
203
|
+
this.api,
|
|
204
|
+
this.currentNode,
|
|
205
|
+
{ cardsInRow: t },
|
|
206
|
+
`Changed products per row to ${t}`
|
|
207
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows());
|
|
208
208
|
}
|
|
209
209
|
_onMobileCardsInRowChange(t) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
!this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t || (s.updateConfig(
|
|
211
|
+
this.api,
|
|
212
|
+
this.currentNode,
|
|
213
|
+
{ mobileCardsInRow: t },
|
|
214
|
+
`Changed mobile products per row to ${t}`
|
|
215
|
+
), L(this.api), this.store.patchCurrentBlockConfig(
|
|
214
216
|
{ mobileCardsInRow: t },
|
|
215
217
|
{ triggerRefetch: !1 }
|
|
216
218
|
), E({
|
|
217
219
|
currentNode: this.currentNode,
|
|
218
|
-
documentModifier:
|
|
219
|
-
|
|
220
|
-
stageOnly: !0
|
|
221
|
-
}), o.apply(new O(`Changed mobile products per row to ${t}`));
|
|
220
|
+
documentModifier: this.api.getDocumentModifier()
|
|
221
|
+
}));
|
|
222
222
|
}
|
|
223
|
-
_regenerateProductRows(
|
|
224
|
-
const
|
|
225
|
-
|
|
223
|
+
_regenerateProductRows() {
|
|
224
|
+
const t = s.getConfig(this.currentNode), o = parseInt(t.size) || 6, i = I(this.store.recommendationProducts, o);
|
|
225
|
+
g({
|
|
226
226
|
currentNode: this.currentNode,
|
|
227
|
-
documentModifier:
|
|
228
|
-
products:
|
|
229
|
-
configOverrides: s,
|
|
230
|
-
stageOnly: !0
|
|
227
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
228
|
+
products: i
|
|
231
229
|
});
|
|
232
230
|
}
|
|
233
231
|
_listenToFormUpdates() {
|
|
@@ -248,8 +246,8 @@ class K extends N {
|
|
|
248
246
|
_listenStateUpdates() {
|
|
249
247
|
let t = this.store.recommendationConfigs.orientation;
|
|
250
248
|
this.storeUnsubscription = this.store.$subscribe(() => {
|
|
251
|
-
const
|
|
252
|
-
|
|
249
|
+
const o = this.store.recommendationConfigs.orientation;
|
|
250
|
+
o !== t && (t = o, this._updateProductsInRowVisibility());
|
|
253
251
|
});
|
|
254
252
|
}
|
|
255
253
|
/**
|
|
@@ -259,14 +257,14 @@ class K extends N {
|
|
|
259
257
|
*/
|
|
260
258
|
_listenEditorModeChanges() {
|
|
261
259
|
this.api.onEditorStatePropUpdated(
|
|
262
|
-
|
|
260
|
+
b.previewDeviceMode,
|
|
263
261
|
() => {
|
|
264
|
-
|
|
262
|
+
s.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
|
|
265
263
|
}
|
|
266
264
|
);
|
|
267
265
|
}
|
|
268
266
|
}
|
|
269
267
|
export {
|
|
270
268
|
B as PRODUCT_LAYOUT_CONTROL_ID,
|
|
271
|
-
|
|
269
|
+
F as ProductLayoutControl
|
|
272
270
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var r = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
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
4
|
import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { RecommendationConfigService as
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
const
|
|
5
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
6
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
8
|
+
const h = "recommendation-shuffle-control", i = {
|
|
9
9
|
SHUFFLE_PRODUCTS: "shuffleProducts"
|
|
10
10
|
};
|
|
11
|
-
class
|
|
11
|
+
class S extends l {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
// Store is used for backward compatibility with product fetching
|
|
15
|
-
|
|
15
|
+
n(this, "store", d());
|
|
16
16
|
}
|
|
17
17
|
getId() {
|
|
18
|
-
return
|
|
18
|
+
return h;
|
|
19
19
|
}
|
|
20
20
|
getTemplate() {
|
|
21
21
|
return `
|
|
22
22
|
<div class="shuffle-control-container" style="border-bottom: 1px solid #e0e0e0;">
|
|
23
23
|
${this._GuTwoColumns([
|
|
24
24
|
this._GuLabel({ text: this.api.translate("Shuffle Recommended Products") }),
|
|
25
|
-
this._GuToggle(
|
|
25
|
+
this._GuToggle(i.SHUFFLE_PRODUCTS)
|
|
26
26
|
])}
|
|
27
27
|
</div>
|
|
28
28
|
`;
|
|
@@ -34,29 +34,34 @@ class p extends f {
|
|
|
34
34
|
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
35
35
|
}
|
|
36
36
|
_setFormValues() {
|
|
37
|
-
const e =
|
|
37
|
+
const e = s.getConfig(this.currentNode);
|
|
38
38
|
this.api.updateValues({
|
|
39
|
-
[
|
|
39
|
+
[i.SHUFFLE_PRODUCTS]: e.shuffleProducts
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
_initializeToggle() {
|
|
43
|
-
const e =
|
|
43
|
+
const e = s.getConfig(this.currentNode);
|
|
44
44
|
this.api.setUIEAttribute(
|
|
45
|
-
|
|
45
|
+
i.SHUFFLE_PRODUCTS,
|
|
46
46
|
u.SELECTPICKER.items,
|
|
47
47
|
e.shuffleProducts
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
_onShuffleChange(e) {
|
|
51
|
-
this.currentNode
|
|
51
|
+
!this.currentNode || s.getConfig(this.currentNode).shuffleProducts === e || (s.updateConfig(
|
|
52
|
+
this.api,
|
|
53
|
+
this.currentNode,
|
|
54
|
+
{ shuffleProducts: e },
|
|
55
|
+
`${e ? "Enabled" : "Disabled"} product shuffle`
|
|
56
|
+
), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
|
|
52
57
|
}
|
|
53
58
|
_listenToFormUpdates() {
|
|
54
|
-
this.api.onValueChanged(
|
|
59
|
+
this.api.onValueChanged(i.SHUFFLE_PRODUCTS, (e) => {
|
|
55
60
|
this._onShuffleChange(!!e);
|
|
56
61
|
});
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
h as SHUFFLE_CONTROL_ID,
|
|
66
|
+
S as ShuffleControl
|
|
62
67
|
};
|