@useinsider/guido 3.17.0-beta.e6704da → 3.17.0-beta.eae947f
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/README.md +5 -6
- package/dist/@types/config/schemas.js +6 -12
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +61 -63
- package/dist/composables/useCustomInterfaceAppearance.js +16 -19
- package/dist/composables/useRecommendation.js +34 -41
- package/dist/config/migrator/recommendationMigrator.js +4 -6
- package/dist/enums/academy.js +1 -2
- package/dist/enums/date.js +3 -4
- package/dist/enums/extensions/recommendationBlock.js +23 -25
- package/dist/extensions/Blocks/Items/block.js +98 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +11 -13
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +154 -156
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +68 -216
- package/dist/extensions/Blocks/common-control.js +19 -22
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +29 -78
- package/dist/src/@types/config/schemas.d.ts +0 -12
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -14
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -214
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
- package/dist/src/services/recommendationApi.d.ts +1 -4
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/utils/dateUtil.js +10 -23
- package/dist/utils/pairProductVariables.js +60 -59
- package/dist/utils/templatePreparation.js +34 -37
- package/package.json +2 -3
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -70
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +0 -20
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +0 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -141
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +0 -24
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -29
- package/dist/src/mock/api/recommendation-strategies.d.ts +0 -43
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -171
|
@@ -2,11 +2,10 @@ import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
|
2
2
|
const l = {
|
|
3
3
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
|
|
4
4
|
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
|
-
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
|
|
6
|
-
|
|
7
|
-
}, c = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", d = {
|
|
5
|
+
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
|
|
6
|
+
}, c = {
|
|
8
7
|
CLIENT_ID: "clientId"
|
|
9
|
-
},
|
|
8
|
+
}, d = () => {
|
|
10
9
|
const e = r();
|
|
11
10
|
return [
|
|
12
11
|
{
|
|
@@ -70,14 +69,14 @@ const l = {
|
|
|
70
69
|
path: "top-sellers"
|
|
71
70
|
}
|
|
72
71
|
];
|
|
73
|
-
},
|
|
72
|
+
}, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
|
|
74
73
|
{ text: "before the amount", value: "0" },
|
|
75
74
|
{ text: "after the amount", value: "1" }
|
|
76
|
-
],
|
|
75
|
+
], v = [
|
|
77
76
|
{ text: "dot(.)", value: "." },
|
|
78
77
|
{ text: "comma(,)", value: "," },
|
|
79
78
|
{ text: "space( )", value: " " }
|
|
80
|
-
],
|
|
79
|
+
], h = [
|
|
81
80
|
{ text: "0", value: "0" },
|
|
82
81
|
{ text: "1", value: "1" },
|
|
83
82
|
{ text: "2", value: "2" },
|
|
@@ -89,55 +88,54 @@ const l = {
|
|
|
89
88
|
{ text: "contains", value: "~" },
|
|
90
89
|
{ text: "does not contain", value: "!~" },
|
|
91
90
|
{ text: "any of", value: a }
|
|
92
|
-
],
|
|
91
|
+
], n = [
|
|
93
92
|
{ text: "is exactly", value: "=" },
|
|
94
93
|
{ text: "is not exactly", value: "!==" },
|
|
95
94
|
{ text: "contains", value: "~" },
|
|
96
95
|
{ text: "does not contain", value: "!~" },
|
|
97
96
|
{ text: "any of", value: a }
|
|
98
|
-
],
|
|
97
|
+
], o = [
|
|
99
98
|
{ text: "is equal to", value: "=" },
|
|
100
99
|
{ text: "is greater than", value: ">" },
|
|
101
100
|
{ text: "is less than", value: "<" }
|
|
102
|
-
],
|
|
101
|
+
], s = [
|
|
103
102
|
{ text: "is equal to", value: "=" },
|
|
104
103
|
{ text: "after", value: ">" },
|
|
105
104
|
{ text: "before", value: "<" }
|
|
106
105
|
], i = [
|
|
107
106
|
{ text: "true", value: "==" },
|
|
108
107
|
{ text: "false", value: "!=" }
|
|
109
|
-
],
|
|
108
|
+
], x = (e) => {
|
|
110
109
|
if (!e)
|
|
111
110
|
return t;
|
|
112
111
|
switch (e) {
|
|
113
112
|
case "Boolean":
|
|
114
113
|
return i;
|
|
115
114
|
case "Date":
|
|
116
|
-
return
|
|
115
|
+
return s;
|
|
117
116
|
case "Number":
|
|
118
|
-
return
|
|
117
|
+
return o;
|
|
119
118
|
case "String":
|
|
120
119
|
return t;
|
|
121
120
|
case "Strings":
|
|
122
|
-
return
|
|
121
|
+
return n;
|
|
123
122
|
default:
|
|
124
123
|
return t;
|
|
125
124
|
}
|
|
126
125
|
};
|
|
127
126
|
export {
|
|
128
127
|
a as OP_ANY_OF,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
c as RRS_ACTIVE_EMAIL_FILTER,
|
|
128
|
+
m as PriceAttributes,
|
|
129
|
+
c as QUERY_PARAMS,
|
|
132
130
|
l as URLS,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
h as currencyDecimalCounts,
|
|
132
|
+
p as currencyLocationMaps,
|
|
133
|
+
v as currencyOperators,
|
|
134
|
+
x as getOperatorOptions,
|
|
135
|
+
d as getRecommendationFeedSourceMaps,
|
|
136
|
+
n as operatorOptionsForArrayOfStrings,
|
|
139
137
|
i as operatorOptionsForBooleans,
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
s as operatorOptionsForDates,
|
|
139
|
+
o as operatorOptionsForNumbers,
|
|
142
140
|
t as operatorOptionsForStrings
|
|
143
141
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var k = (l, a, t) => a in l ? D(l, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[a] = t;
|
|
3
|
+
var I = (l, a, t) => k(l, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import { BlockId as N } from "../../../enums/block.js";
|
|
5
|
+
import { useOnboardingStore as T } from "../../../stores/onboarding.js";
|
|
6
|
+
import { getMigrationBannerHtml as _ } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
+
import { Block as A, BlockCompositionType as M, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { currencyPositionFromLocation as O, ITEMS_CURRENCY_ATTR as d } from "./constants/currency.js";
|
|
9
|
+
import { ItemsBlockId as R } from "./enums/controlEnums.js";
|
|
10
|
+
import { SETTINGS_ENUMS as b, DefaultConfigValues as f } from "./enums/settingsEnums.js";
|
|
11
|
+
import { getDefaultTemplate as E } from "./template.js";
|
|
12
|
+
import { getItemsBlockContainer as h, getItemsBlockConfig as C, deriveItemNumber as H, getDefaultItemsBlockConfig as B } from "./utils/nodeConfigUtils.js";
|
|
13
|
+
const S = N.Items, P = "Reconcile Items currency DOM attributes";
|
|
14
|
+
class G extends A {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
|
|
18
|
+
I(this, "_currencyHealed", /* @__PURE__ */ new Set());
|
|
19
|
+
}
|
|
10
20
|
getId() {
|
|
11
|
-
return
|
|
21
|
+
return S;
|
|
12
22
|
}
|
|
13
23
|
getIcon() {
|
|
14
24
|
return "items-icon";
|
|
15
25
|
}
|
|
16
26
|
getBlockCompositionType() {
|
|
17
|
-
return
|
|
27
|
+
return M.CONTAINER;
|
|
18
28
|
}
|
|
19
29
|
getName() {
|
|
20
30
|
return this.api.translate("Items");
|
|
@@ -23,20 +33,20 @@ class E extends C {
|
|
|
23
33
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
24
34
|
}
|
|
25
35
|
getSettingsPanelTitleHtml() {
|
|
26
|
-
return
|
|
27
|
-
|
|
36
|
+
return _(
|
|
37
|
+
S,
|
|
28
38
|
this.api.translate("Items"),
|
|
29
39
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
|
|
30
40
|
);
|
|
31
41
|
}
|
|
32
42
|
getTemplate() {
|
|
33
|
-
return
|
|
34
|
-
orientation:
|
|
35
|
-
itemsType:
|
|
43
|
+
return E({
|
|
44
|
+
orientation: b.ORIENTATION.VERTICAL,
|
|
45
|
+
itemsType: b.ITEMS_TYPE.CART_ITEMS,
|
|
36
46
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
37
|
-
currencySymbol:
|
|
38
|
-
currencyLocation:
|
|
39
|
-
formattedPrice:
|
|
47
|
+
currencySymbol: f.productPriceCurrencySymbolControlValue,
|
|
48
|
+
currencyLocation: f.productPriceCurrencyLocationControlValue,
|
|
49
|
+
formattedPrice: f.productPriceFormattedControlValue === "1"
|
|
40
50
|
});
|
|
41
51
|
}
|
|
42
52
|
allowInnerBlocksDND() {
|
|
@@ -45,24 +55,27 @@ class E extends C {
|
|
|
45
55
|
canBeSavedAsModule() {
|
|
46
56
|
return !0;
|
|
47
57
|
}
|
|
48
|
-
onCreated(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
58
|
+
onCreated(t) {
|
|
59
|
+
const o = this.api.getDocumentModifier(), s = this.api.getDocumentRootCssNode();
|
|
60
|
+
s.querySelector('[product-attr="imageSrc"] img') || o.modifyCss(s).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
61
|
+
const r = h(t);
|
|
62
|
+
if (!r)
|
|
53
63
|
return;
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
s.modifyHtml(e).setNodeConfig(i), this._stampProductTdDomAttributes(e, i, s), s.apply(new c("Migrate legacy config to nodeConfig"));
|
|
64
|
+
const i = r.getNodeConfig(), c = i && Object.keys(i).length > 0, e = C(t);
|
|
65
|
+
if (e != null && e.initialized) {
|
|
66
|
+
if (!c) {
|
|
67
|
+
const u = this.api.getDocumentModifier();
|
|
68
|
+
u.modifyHtml(r).setNodeConfig(e), this._stampProductTdDomAttributes(r, e, u), u.apply(new m("Migrate legacy config to nodeConfig"));
|
|
69
|
+
return;
|
|
61
70
|
}
|
|
62
|
-
else {
|
|
63
|
-
const
|
|
64
|
-
|
|
71
|
+
} else {
|
|
72
|
+
const u = B(), g = this.api.getDocumentModifier();
|
|
73
|
+
g.modifyHtml(r).setNodeConfig(u), this._stampProductTdDomAttributes(r, u, g, !0), g.apply(new m("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
|
|
74
|
+
return;
|
|
65
75
|
}
|
|
76
|
+
const n = e.blockInstanceId || String(Date.now()), p = this.api.getDocumentModifier();
|
|
77
|
+
let y = !1;
|
|
78
|
+
e.blockInstanceId || (p.modifyHtml(r).setNodeConfig({ ...e, blockInstanceId: n }), y = !0), this._shouldReconcileCurrency(e) && this._reconcileCurrencyDomAttributes(r, e, p) && (y = !0), y && p.apply(new m("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(n);
|
|
66
79
|
}
|
|
67
80
|
/**
|
|
68
81
|
* Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
|
|
@@ -70,18 +83,24 @@ class E extends C {
|
|
|
70
83
|
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
71
84
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
72
85
|
*/
|
|
73
|
-
onDocumentChanged(
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
86
|
+
onDocumentChanged(t) {
|
|
87
|
+
const o = h(t);
|
|
88
|
+
if (!o)
|
|
76
89
|
return;
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
90
|
+
const s = o.getNodeConfig();
|
|
91
|
+
if (s && Object.keys(s).length > 0) {
|
|
92
|
+
const e = C(t);
|
|
93
|
+
if (e != null && e.initialized && this._shouldReconcileCurrency(e)) {
|
|
94
|
+
const n = this.api.getDocumentModifier();
|
|
95
|
+
this._reconcileCurrencyDomAttributes(o, e, n) && n.apply(new m(P)), this._markCurrencyHealed(e.blockInstanceId);
|
|
96
|
+
}
|
|
79
97
|
return;
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
}
|
|
99
|
+
const i = C(t);
|
|
100
|
+
if (!(i != null && i.initialized))
|
|
82
101
|
return;
|
|
83
|
-
const
|
|
84
|
-
|
|
102
|
+
const c = this.api.getDocumentModifier();
|
|
103
|
+
c.modifyHtml(o).setNodeConfig(i), this._stampProductTdDomAttributes(o, i, c), c.apply(new m("Recover Items block config from saved module"));
|
|
85
104
|
}
|
|
86
105
|
/**
|
|
87
106
|
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
|
|
@@ -91,14 +110,44 @@ class E extends C {
|
|
|
91
110
|
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
92
111
|
* relies on this td-level fallback in pairProductVariables.
|
|
93
112
|
*/
|
|
94
|
-
_stampProductTdDomAttributes(
|
|
95
|
-
const
|
|
96
|
-
|
|
113
|
+
_stampProductTdDomAttributes(t, o, s, r = !1) {
|
|
114
|
+
const i = H(o.itemsSelectValue, o.type), c = (e, n) => {
|
|
115
|
+
r && t.getAttribute(e) || s.modifyHtml(t).setAttribute(e, n);
|
|
97
116
|
};
|
|
98
|
-
|
|
117
|
+
c("data-type", o.type), c("data-number", i), c("data-nodup", String(o.priceHideDiscount));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether the currency self-heal should run for this block. Two guards (SD-147588):
|
|
121
|
+
* 1. Config is only authoritative when the symbol was actually customized — a symbol still at
|
|
122
|
+
* the 'USD' sentinel may be a migrator default, so we trust the DOM's real value over a
|
|
123
|
+
* defaulted config and never overwrite it.
|
|
124
|
+
* 2. Heal each instance at most once per session, so the auto-fix can't fight undo (undo
|
|
125
|
+
* re-drifts the attr, which would otherwise re-trigger the heal forever).
|
|
126
|
+
*/
|
|
127
|
+
_shouldReconcileCurrency(t) {
|
|
128
|
+
const o = (t.priceCurrencySymbol ?? "").trim();
|
|
129
|
+
return !o || o === f.productPriceCurrencySymbolControlValue ? !1 : !t.blockInstanceId || !this._currencyHealed.has(t.blockInstanceId);
|
|
130
|
+
}
|
|
131
|
+
/** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
|
|
132
|
+
_markCurrencyHealed(t) {
|
|
133
|
+
t && this._currencyHealed.add(t);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
|
|
137
|
+
* attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
|
|
138
|
+
* Config is the source of truth — never derive from visible text. Callers gate this with
|
|
139
|
+
* `_shouldReconcileCurrency`. Returns true only when an attr actually changed, so the caller can
|
|
140
|
+
* skip an empty apply that would otherwise re-trigger onDocumentChanged and loop (SD-147588).
|
|
141
|
+
*/
|
|
142
|
+
_reconcileCurrencyDomAttributes(t, o, s) {
|
|
143
|
+
const r = O(o.priceCurrencyLocation), i = (o.priceCurrencySymbol ?? "").trim(), c = t.querySelectorAll(`.${R.PRICE} p`);
|
|
144
|
+
let e = !1;
|
|
145
|
+
return c.forEach((n) => {
|
|
146
|
+
n.getAttribute(d.POSITION) !== r && (s.modifyHtml(n).setAttribute(d.POSITION, r), e = !0), i && n.getAttribute(d.SYMBOL) !== i && (s.modifyHtml(n).setAttribute(d.SYMBOL, i), e = !0);
|
|
147
|
+
}), e;
|
|
99
148
|
}
|
|
100
149
|
}
|
|
101
150
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
151
|
+
S as BLOCK_ID,
|
|
152
|
+
G as ItemsBlock
|
|
104
153
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { currencyLocationMaps as
|
|
2
|
-
import { UEAttr as
|
|
3
|
-
import { CommonControl as
|
|
1
|
+
import { currencyLocationMaps as p } from "../../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { UEAttr as N, ModificationDescription as I } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
import { CommonControl as L } from "../../../common-control.js";
|
|
4
|
+
import { ITEMS_CURRENCY_ATTR as T, currencyPositionFromLocation as E } from "../../constants/currency.js";
|
|
4
5
|
import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
|
|
5
|
-
import { getItemsBlockConfig as
|
|
6
|
-
const
|
|
6
|
+
import { getItemsBlockConfig as l, setItemsBlockConfig as O, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
|
|
7
|
+
const b = m.PRICE_CURRENCY_LOCATION, c = {
|
|
7
8
|
CURRENCY_LOCATION: "currencyLocation"
|
|
8
9
|
};
|
|
9
|
-
class
|
|
10
|
+
class Y extends L {
|
|
10
11
|
getId() {
|
|
11
|
-
return
|
|
12
|
+
return b;
|
|
12
13
|
}
|
|
13
14
|
getTemplate() {
|
|
14
15
|
return `
|
|
@@ -18,32 +19,32 @@ class A extends N {
|
|
|
18
19
|
`;
|
|
19
20
|
}
|
|
20
21
|
onRender() {
|
|
21
|
-
const e =
|
|
22
|
-
this.api.setUIEAttribute(c.CURRENCY_LOCATION,
|
|
22
|
+
const e = l(this.currentNode);
|
|
23
|
+
this.api.setUIEAttribute(c.CURRENCY_LOCATION, N.SELECTPICKER.items, p), this.api.updateValues({ [c.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(c.CURRENCY_LOCATION, (t) => {
|
|
23
24
|
this._onCurrencyLocationChange(t);
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
onTemplateNodeUpdated(e) {
|
|
27
28
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
-
const t =
|
|
29
|
+
const t = l(this.currentNode);
|
|
29
30
|
this.api.updateValues({ [c.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
_onCurrencyLocationChange(e) {
|
|
33
|
-
if (console.debug("Currency location changed to: ", e),
|
|
34
|
+
if (console.debug("Currency location changed to: ", e), O(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
|
|
34
35
|
return;
|
|
35
36
|
const t = this._getPriceBlocks();
|
|
36
37
|
if (!t || t.length === 0)
|
|
37
38
|
return;
|
|
38
|
-
const r =
|
|
39
|
-
t.forEach((
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
39
|
+
const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = E(n), s = this.api.getDocumentModifier();
|
|
40
|
+
t.forEach((h) => {
|
|
41
|
+
const a = this._getParagraph(h);
|
|
42
|
+
if (!a)
|
|
42
43
|
return;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
`Updated currency location to ${
|
|
44
|
+
const d = a.getInnerHTML().trim() || "", C = a.getInnerText().trim() || "", u = (o == null ? void 0 : o.trim()) || "", _ = this._removeCurrencySymbol(C, u), g = this._detectSymbolInText(C) || u, R = this._buildPriceContent(_, g, n), y = d.replace(C, f(R));
|
|
45
|
+
s.modifyHtml(a).setInnerHtml(y).setAttribute(T.POSITION, i);
|
|
46
|
+
}), s.apply(new I(
|
|
47
|
+
`Updated currency location to ${i}`
|
|
47
48
|
));
|
|
48
49
|
}
|
|
49
50
|
_getPriceBlocks() {
|
|
@@ -65,8 +66,8 @@ class A extends N {
|
|
|
65
66
|
} else {
|
|
66
67
|
const o = r.match(/([^0-9.,\s]+)/);
|
|
67
68
|
if (o && o[1]) {
|
|
68
|
-
const i = o[1].trim(),
|
|
69
|
-
n = r.replace(
|
|
69
|
+
const i = o[1].trim(), s = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
|
|
70
|
+
n = r.replace(s, "").trim();
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
return n;
|
|
@@ -85,13 +86,13 @@ class A extends N {
|
|
|
85
86
|
this._GuSelect({
|
|
86
87
|
name: c.CURRENCY_LOCATION,
|
|
87
88
|
placeholder: "",
|
|
88
|
-
options:
|
|
89
|
+
options: p
|
|
89
90
|
})
|
|
90
91
|
])}
|
|
91
92
|
`;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
b as CONTROL_BLOCK_ID,
|
|
97
|
+
Y as PriceCurrencyLocationControl
|
|
97
98
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
2
|
var N = (s, c, e) => c in s ? R(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
|
|
3
3
|
var h = (s, c, e) => N(s, typeof c != "symbol" ? c + "" : c, e);
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
4
|
+
import { ModificationDescription as E } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as B } from "../../../common-control.js";
|
|
6
|
+
import { ITEMS_CURRENCY_ATTR as T } from "../../constants/currency.js";
|
|
6
7
|
import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
|
|
7
|
-
import { getItemsBlockConfig as p, setItemsBlockConfig as
|
|
8
|
-
const
|
|
8
|
+
import { getItemsBlockConfig as p, setItemsBlockConfig as Y, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
|
|
9
|
+
const x = y.PRICE_CURRENCY_SYMBOL, u = {
|
|
9
10
|
CURRENCY_SYMBOL: "currencySymbol"
|
|
10
11
|
};
|
|
11
|
-
class
|
|
12
|
+
class $ extends B {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
15
|
h(this, "originalPriceContents", /* @__PURE__ */ new Map());
|
|
15
16
|
}
|
|
16
17
|
getId() {
|
|
17
|
-
return
|
|
18
|
+
return x;
|
|
18
19
|
}
|
|
19
20
|
getTemplate() {
|
|
20
21
|
return `
|
|
@@ -42,7 +43,7 @@ class P extends E {
|
|
|
42
43
|
var a;
|
|
43
44
|
console.debug("Currency symbol changed to: ", e);
|
|
44
45
|
const t = p(this.currentNode), o = ((a = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : a.trim()) || "";
|
|
45
|
-
if (
|
|
46
|
+
if (Y(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
|
|
46
47
|
return;
|
|
47
48
|
const r = this._getPriceBlocks();
|
|
48
49
|
if (!r || r.length === 0)
|
|
@@ -53,8 +54,8 @@ class P extends E {
|
|
|
53
54
|
if (!m)
|
|
54
55
|
return;
|
|
55
56
|
const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
|
|
56
|
-
i.modifyHtml(m).setInnerHtml(b).setAttribute(
|
|
57
|
-
}), i.apply(new
|
|
57
|
+
i.modifyHtml(m).setInnerHtml(b).setAttribute(T.SYMBOL, n);
|
|
58
|
+
}), i.apply(new E(
|
|
58
59
|
`Updated currency symbol to ${n || "removed"}`
|
|
59
60
|
));
|
|
60
61
|
}
|
|
@@ -115,6 +116,6 @@ class P extends E {
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
x as CONTROL_BLOCK_ID,
|
|
120
|
+
$ as PriceCurrencySymbolControl
|
|
120
121
|
};
|