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