@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,25 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { currencyLocationMaps as
|
|
5
|
-
import { UEAttr as
|
|
6
|
-
import { CommonControl as
|
|
7
|
-
import { RecommendationConfigService as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const f = "recommendation-currency-control", _ = [
|
|
12
|
-
"code",
|
|
13
|
-
"symbol",
|
|
14
|
-
"alignment",
|
|
15
|
-
"thousandSeparator",
|
|
16
|
-
"decimalSeparator",
|
|
17
|
-
"decimalCount"
|
|
18
|
-
];
|
|
19
|
-
function m(s, i) {
|
|
20
|
-
return _.every((e) => s[e] === i[e]);
|
|
21
|
-
}
|
|
22
|
-
const r = {
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var R = (o, a, e) => a in o ? p(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
|
+
var c = (o, a, e) => R(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
+
import { currencyLocationMaps as l, currencyOperators as i, currencyDecimalCounts as h } from "../../../../../enums/extensions/recommendationBlock.js";
|
|
5
|
+
import { UEAttr as _ } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
7
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
9
|
+
import { setCurrencyAttributes as S, updatePricesInPlace as N } from "./utils.js";
|
|
10
|
+
const E = "recommendation-currency-control", t = {
|
|
23
11
|
CURRENCY: "currencyCode",
|
|
24
12
|
CURRENCY_LOCATION: "currencyAlignment",
|
|
25
13
|
CURRENCY_SYMBOL: "currencySymbol",
|
|
@@ -27,16 +15,16 @@ const r = {
|
|
|
27
15
|
CURRENCY_DECIMAL_SEPARATOR: "currencyDecimalSeparator",
|
|
28
16
|
CURRENCY_DECIMAL_COUNT: "currencyDecimalCount"
|
|
29
17
|
};
|
|
30
|
-
class
|
|
18
|
+
class Y extends m {
|
|
31
19
|
constructor() {
|
|
32
20
|
super(...arguments);
|
|
33
21
|
// Store is used ONLY for API-fetched data (currency list), not for config
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
c(this, "store", d());
|
|
23
|
+
c(this, "storeUnsubscription", () => {
|
|
36
24
|
});
|
|
37
25
|
}
|
|
38
26
|
getId() {
|
|
39
|
-
return
|
|
27
|
+
return E;
|
|
40
28
|
}
|
|
41
29
|
getTemplate() {
|
|
42
30
|
return `
|
|
@@ -44,37 +32,37 @@ class P extends g {
|
|
|
44
32
|
${this._GuTwoColumns([
|
|
45
33
|
this._GuLabel({ text: this.api.translate("Currency") }),
|
|
46
34
|
this._GuSelect({
|
|
47
|
-
name:
|
|
35
|
+
name: t.CURRENCY,
|
|
48
36
|
placeholder: this.api.translate("Select Currency"),
|
|
49
37
|
options: this.store.currencyList
|
|
50
38
|
}),
|
|
51
39
|
this._GuLabel({ text: this.api.translate("Currency Location") }),
|
|
52
40
|
this._GuSelect({
|
|
53
|
-
name:
|
|
41
|
+
name: t.CURRENCY_LOCATION,
|
|
54
42
|
placeholder: this.api.translate("Select Currency Location"),
|
|
55
|
-
options:
|
|
43
|
+
options: l
|
|
56
44
|
}),
|
|
57
45
|
this._GuLabel({ text: this.api.translate("Currency Symbol") }),
|
|
58
46
|
this._GuTextInput({
|
|
59
|
-
name:
|
|
47
|
+
name: t.CURRENCY_SYMBOL,
|
|
60
48
|
placeholder: this.api.translate("Enter Currency Symbol"),
|
|
61
49
|
className: "es-180w"
|
|
62
50
|
}),
|
|
63
51
|
this._GuLabel({ text: this.api.translate("Thousand Separator") }),
|
|
64
52
|
this._GuSelect({
|
|
65
|
-
name:
|
|
53
|
+
name: t.CURRENCY_THOUSAND_SEPARATOR,
|
|
66
54
|
placeholder: this.api.translate("Select Thousand Separator"),
|
|
67
|
-
options:
|
|
55
|
+
options: i
|
|
68
56
|
}),
|
|
69
57
|
this._GuLabel({ text: this.api.translate("Decimal Separator") }),
|
|
70
58
|
this._GuSelect({
|
|
71
|
-
name:
|
|
59
|
+
name: t.CURRENCY_DECIMAL_SEPARATOR,
|
|
72
60
|
placeholder: this.api.translate("Select Decimal Separator"),
|
|
73
|
-
options:
|
|
61
|
+
options: i
|
|
74
62
|
}),
|
|
75
63
|
this._GuLabel({ text: this.api.translate("Decimal Count") }),
|
|
76
64
|
this._GuSelect({
|
|
77
|
-
name:
|
|
65
|
+
name: t.CURRENCY_DECIMAL_COUNT,
|
|
78
66
|
placeholder: this.api.translate("Select Decimal Count"),
|
|
79
67
|
options: h
|
|
80
68
|
})
|
|
@@ -94,79 +82,73 @@ class P extends g {
|
|
|
94
82
|
this.storeUnsubscription();
|
|
95
83
|
}
|
|
96
84
|
_setFormValues() {
|
|
97
|
-
const e =
|
|
85
|
+
const e = s.getConfig(this.currentNode), { currency: r } = e;
|
|
98
86
|
this.api.updateValues({
|
|
99
|
-
[
|
|
100
|
-
[
|
|
101
|
-
[
|
|
102
|
-
[
|
|
103
|
-
[
|
|
104
|
-
[
|
|
87
|
+
[t.CURRENCY]: `price.${r.code}`,
|
|
88
|
+
[t.CURRENCY_LOCATION]: r.alignment === "before" ? "0" : "1",
|
|
89
|
+
[t.CURRENCY_SYMBOL]: r.symbol,
|
|
90
|
+
[t.CURRENCY_THOUSAND_SEPARATOR]: r.thousandSeparator,
|
|
91
|
+
[t.CURRENCY_DECIMAL_SEPARATOR]: r.decimalSeparator,
|
|
92
|
+
[t.CURRENCY_DECIMAL_COUNT]: r.decimalCount.toString()
|
|
105
93
|
});
|
|
106
94
|
}
|
|
107
95
|
_initializeSelectItems() {
|
|
108
|
-
const { store: e } = this,
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
96
|
+
const { store: e } = this, r = {
|
|
97
|
+
[t.CURRENCY]: e.currencyList,
|
|
98
|
+
[t.CURRENCY_LOCATION]: l,
|
|
99
|
+
[t.CURRENCY_THOUSAND_SEPARATOR]: i,
|
|
100
|
+
[t.CURRENCY_DECIMAL_SEPARATOR]: i,
|
|
101
|
+
[t.CURRENCY_DECIMAL_COUNT]: h
|
|
114
102
|
};
|
|
115
|
-
Object.entries(
|
|
116
|
-
this.api.setUIEAttribute(
|
|
103
|
+
Object.entries(r).forEach(([C, n]) => {
|
|
104
|
+
this.api.setUIEAttribute(C, _.SELECTPICKER.items, n);
|
|
117
105
|
});
|
|
118
106
|
}
|
|
119
107
|
/**
|
|
120
|
-
* Applies
|
|
121
|
-
* config, block attributes, store and the price text in ONE apply. No product refetch.
|
|
108
|
+
* Applies currency updates to node config, HTML attributes, Pinia store, and DOM.
|
|
122
109
|
* @param updates - Partial currency config to merge
|
|
110
|
+
* @param triggerRefetch - Whether to trigger a product API refetch.
|
|
111
|
+
* true for currency code changes (different prices from API),
|
|
112
|
+
* false for display-only changes (symbol, separators, alignment, decimal count).
|
|
123
113
|
*/
|
|
124
|
-
_updateCurrency(e) {
|
|
114
|
+
_updateCurrency(e, r = !1) {
|
|
125
115
|
if (!this.currentNode)
|
|
126
116
|
return;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
const n = { ...s.getConfig(this.currentNode).currency, ...e };
|
|
118
|
+
s.updateConfig(
|
|
119
|
+
this.api,
|
|
120
|
+
this.currentNode,
|
|
121
|
+
{ currency: n },
|
|
122
|
+
"Updated currency settings"
|
|
123
|
+
);
|
|
124
|
+
const u = this.api.getDocumentModifier();
|
|
125
|
+
S({
|
|
134
126
|
currentNode: this.currentNode,
|
|
135
|
-
documentModifier:
|
|
136
|
-
currency: n
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
documentModifier: u,
|
|
128
|
+
currency: n
|
|
129
|
+
}), this.store.patchCurrentBlockConfig({
|
|
130
|
+
currencySettings: {
|
|
131
|
+
name: n.code,
|
|
132
|
+
value: n.code,
|
|
133
|
+
symbol: n.symbol,
|
|
134
|
+
alignment: n.alignment === "before" ? "0" : "1",
|
|
135
|
+
decimalCount: n.decimalCount.toString(),
|
|
136
|
+
decimalSeparator: n.decimalSeparator,
|
|
137
|
+
thousandSeparator: n.thousandSeparator
|
|
138
|
+
}
|
|
139
|
+
}, { triggerRefetch: r }), N({
|
|
142
140
|
currentNode: this.currentNode,
|
|
143
|
-
documentModifier:
|
|
144
|
-
|
|
145
|
-
}), o.apply(new l("Updated currency settings"));
|
|
146
|
-
}
|
|
147
|
-
/** Re-stamps the compiler-read block attributes where they drifted from the node config. */
|
|
148
|
-
_repairCurrencyAttributes(e) {
|
|
149
|
-
const t = T(this.currentNode);
|
|
150
|
-
if (t && _.every((o) => t[o] === e[o]))
|
|
151
|
-
return;
|
|
152
|
-
const n = this.api.getDocumentModifier();
|
|
153
|
-
R({ currentNode: this.currentNode, documentModifier: n, currency: e, stageOnly: !0 }) && n.apply(new l("Update currency attributes"));
|
|
141
|
+
documentModifier: u
|
|
142
|
+
});
|
|
154
143
|
}
|
|
155
144
|
_onCurrencyChange(e) {
|
|
156
|
-
const [,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.store.patchCurrentBlockConfig({
|
|
164
|
-
currencySettings: { ...d, name: t, value: t, symbol: t }
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
this.api.updateValues({
|
|
168
|
-
[r.CURRENCY_SYMBOL]: t
|
|
169
|
-
});
|
|
145
|
+
const [, r] = e.includes(".") ? e.split(".") : [null, e];
|
|
146
|
+
s.getConfig(this.currentNode).currency.code !== r && (this._updateCurrency({
|
|
147
|
+
code: r,
|
|
148
|
+
symbol: r
|
|
149
|
+
}, !0), this.api.updateValues({
|
|
150
|
+
[t.CURRENCY_SYMBOL]: r
|
|
151
|
+
}));
|
|
170
152
|
}
|
|
171
153
|
_onCurrencyLocationChange(e) {
|
|
172
154
|
this._updateCurrency({
|
|
@@ -187,23 +169,23 @@ class P extends g {
|
|
|
187
169
|
});
|
|
188
170
|
}
|
|
189
171
|
_onDecimalCountChange(e) {
|
|
190
|
-
const
|
|
172
|
+
const r = parseInt(e);
|
|
191
173
|
this._updateCurrency({
|
|
192
|
-
decimalCount: Number.isNaN(
|
|
174
|
+
decimalCount: Number.isNaN(r) ? 2 : r
|
|
193
175
|
});
|
|
194
176
|
}
|
|
195
177
|
_listenToFormUpdates() {
|
|
196
|
-
this.api.onValueChanged(
|
|
178
|
+
this.api.onValueChanged(t.CURRENCY, (e) => {
|
|
197
179
|
this._onCurrencyChange(e);
|
|
198
|
-
}), this.api.onValueChanged(
|
|
180
|
+
}), this.api.onValueChanged(t.CURRENCY_LOCATION, (e) => {
|
|
199
181
|
this._onCurrencyLocationChange(e);
|
|
200
|
-
}), this.api.onValueChanged(
|
|
182
|
+
}), this.api.onValueChanged(t.CURRENCY_SYMBOL, (e) => {
|
|
201
183
|
this._onCurrencySymbolChange(e);
|
|
202
|
-
}), this.api.onValueChanged(
|
|
184
|
+
}), this.api.onValueChanged(t.CURRENCY_THOUSAND_SEPARATOR, (e) => {
|
|
203
185
|
this._onThousandSeparatorChange(e);
|
|
204
|
-
}), this.api.onValueChanged(
|
|
186
|
+
}), this.api.onValueChanged(t.CURRENCY_DECIMAL_SEPARATOR, (e) => {
|
|
205
187
|
this._onDecimalSeparatorChange(e);
|
|
206
|
-
}), this.api.onValueChanged(
|
|
188
|
+
}), this.api.onValueChanged(t.CURRENCY_DECIMAL_COUNT, (e) => {
|
|
207
189
|
this._onDecimalCountChange(e);
|
|
208
190
|
});
|
|
209
191
|
}
|
|
@@ -214,12 +196,12 @@ class P extends g {
|
|
|
214
196
|
_subscribeToStoreChanges() {
|
|
215
197
|
let e = this.store.currencyList.length;
|
|
216
198
|
this.storeUnsubscription = this.store.$subscribe(() => {
|
|
217
|
-
const
|
|
218
|
-
|
|
199
|
+
const r = this.store.currencyList.length;
|
|
200
|
+
r > 0 && r !== e && (e = r, this._initializeSelectItems(), this._setFormValues());
|
|
219
201
|
});
|
|
220
202
|
}
|
|
221
203
|
}
|
|
222
204
|
export {
|
|
223
|
-
|
|
224
|
-
|
|
205
|
+
E as CURRENCY_CONTROL_ID,
|
|
206
|
+
Y as CurrencyControl
|
|
225
207
|
};
|