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