@useinsider/guido 2.0.0-beta.4f6e85f → 2.0.0-beta.522e9d9
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 +0 -2
- package/dist/@types/config/schemas.js +39 -55
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +17 -15
- package/dist/components/organisms/email-preview/PreviewContainer.vue.js +3 -3
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +8 -8
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +17 -13
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +7 -8
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +14 -12
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +10 -14
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +18 -22
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +3 -3
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +12 -11
- package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +11 -10
- package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +15 -14
- package/dist/components/organisms/header/LeftSlot.vue.js +9 -9
- package/dist/components/organisms/header/LeftSlot.vue2.js +13 -14
- package/dist/components/organisms/header/MiddleSlot.vue.js +5 -4
- package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -13
- package/dist/components/organisms/header/RightSlot.vue.js +12 -12
- package/dist/components/organisms/header/RightSlot.vue2.js +26 -20
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +15 -15
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +20 -19
- package/dist/composables/useConfig.js +27 -29
- package/dist/composables/useSave.js +11 -13
- package/dist/composables/useStripo.js +40 -40
- package/dist/config/migrator/index.js +8 -9
- package/dist/enums/academy.js +8 -0
- package/dist/enums/onboarding.js +1 -2
- package/dist/enums/unsubscribe.js +20 -21
- package/dist/extensions/Blocks/Items/block.js +40 -39
- package/dist/extensions/Blocks/Items/controls/button/link.js +29 -22
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -66
- package/dist/extensions/Blocks/Items/controls/image/link.js +30 -23
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +17 -19
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +29 -31
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +19 -21
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +27 -29
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +143 -152
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -43
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +3 -4
- package/dist/extensions/Blocks/Items/extension.js +6 -7
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +49 -58
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +59 -48
- package/dist/extensions/Blocks/Items/settingsPanel.js +26 -27
- package/dist/extensions/Blocks/Items/store/items-block.js +7 -11
- package/dist/extensions/Blocks/Items/template.js +129 -366
- package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +17 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +28 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +76 -0
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +46 -0
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +30 -29
- package/dist/extensions/Blocks/controlFactories.js +45 -55
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +285 -364
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +10 -6
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +0 -30
- package/dist/src/@types/config/types.d.ts +1 -7
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +0 -8
- package/dist/src/enums/academy.d.ts +12 -0
- package/dist/src/enums/onboarding.d.ts +0 -1
- package/dist/src/enums/unsubscribe.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -9
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +26 -24
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/template.d.ts +1 -22
- package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +23 -0
- package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +32 -0
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +50 -0
- package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +8 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +10 -9
- package/dist/src/stores/config.d.ts +1 -164
- package/dist/static/assets/desktop/desktop-mockup-center.svg.js +4 -0
- package/dist/static/assets/desktop/desktop-mockup-left.svg.js +4 -0
- package/dist/static/assets/desktop/desktop-mockup-right.svg.js +4 -0
- package/dist/static/assets/mobile/email-mockup.svg.js +4 -0
- package/dist/static/assets/mobile/inbox-mockup.svg.js +4 -0
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/stores/config.js +0 -7
- package/dist/utils/pairProductVariables.js +58 -61
- package/package.json +3 -3
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
- package/dist/config/migrator/itemsBlockMigrator.js +0 -342
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +0 -93
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +0 -184
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +0 -6
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -18
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -73
- package/dist/static/assets/inbox-mockup.svg.js +0 -4
- package/dist/static/assets/phone-mockup.svg.js +0 -4
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var I = (a, n, t) => n in a ? c(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
|
+
var _ = (a, n, t) => I(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as
|
|
5
|
+
import { CommonControl as R } from "../../common-control.js";
|
|
6
6
|
import { ItemsBlockId as s } from "../enums/controlEnums.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { configAttributes as C } from "../enums/productEnums.js";
|
|
8
|
+
import { SETTINGS_ENUMS as u } from "../enums/settingsEnums.js";
|
|
9
|
+
import { useItemsBlockStore as O } from "../store/items-block.js";
|
|
10
|
+
import { getConfigBlock as P, attributeToBoolean as U } from "../utils/configBlockUtils.js";
|
|
11
|
+
const h = "ui-elements-items-card-composition-block", i = {
|
|
11
12
|
PRODUCT_IMAGE: "image",
|
|
12
13
|
PRODUCT_NAME: "name",
|
|
13
14
|
PRODUCT_QUANTITY: "quantity",
|
|
@@ -15,11 +16,11 @@ const b = "ui-elements-items-card-composition-block", i = {
|
|
|
15
16
|
PRODUCT_ORIGINAL_PRICE: "originalPrice",
|
|
16
17
|
PRODUCT_BUTTON: "button"
|
|
17
18
|
};
|
|
18
|
-
class
|
|
19
|
+
class g extends R {
|
|
19
20
|
constructor() {
|
|
20
21
|
super(...arguments);
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
_(this, "store", O());
|
|
23
|
+
_(this, "visibilityState", {
|
|
23
24
|
[i.PRODUCT_IMAGE]: !0,
|
|
24
25
|
[i.PRODUCT_NAME]: !0,
|
|
25
26
|
[i.PRODUCT_QUANTITY]: !0,
|
|
@@ -29,7 +30,7 @@ class S extends I {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
getId() {
|
|
32
|
-
return
|
|
33
|
+
return h;
|
|
33
34
|
}
|
|
34
35
|
getTemplate() {
|
|
35
36
|
return `
|
|
@@ -82,20 +83,20 @@ class S extends I {
|
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
_syncVisibilityFromAttributes() {
|
|
85
|
-
const t =
|
|
86
|
+
const t = P(this.currentNode);
|
|
86
87
|
if (!t)
|
|
87
88
|
return;
|
|
88
89
|
const e = {
|
|
89
|
-
[i.PRODUCT_IMAGE]: "
|
|
90
|
-
[i.PRODUCT_NAME]: "
|
|
91
|
-
[i.PRODUCT_QUANTITY]: "
|
|
92
|
-
[i.PRODUCT_PRICE]: "
|
|
93
|
-
[i.PRODUCT_ORIGINAL_PRICE]: "
|
|
94
|
-
[i.PRODUCT_BUTTON]: "
|
|
90
|
+
[i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
|
|
91
|
+
[i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
|
|
92
|
+
[i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
|
|
93
|
+
[i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
|
|
94
|
+
[i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
|
|
95
|
+
[i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
|
|
95
96
|
};
|
|
96
|
-
Object.entries(e).forEach(([o,
|
|
97
|
-
const
|
|
98
|
-
this.visibilityState[o] =
|
|
97
|
+
Object.entries(e).forEach(([o, r]) => {
|
|
98
|
+
const T = t.getAttribute(C[r]);
|
|
99
|
+
this.visibilityState[o] = U(T, !0);
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
@@ -104,10 +105,11 @@ class S extends I {
|
|
|
104
105
|
* and mark it as '0'
|
|
105
106
|
*/
|
|
106
107
|
_handleBrowsedItemsQuantity() {
|
|
107
|
-
|
|
108
|
+
var r;
|
|
109
|
+
const t = this.store.itemsType !== u.ITEMS_TYPE.BROWSED_ITEMS, e = (r = this.currentNode) == null ? void 0 : r.querySelector("esd-config-block");
|
|
108
110
|
if (!e)
|
|
109
111
|
return;
|
|
110
|
-
const o = e.
|
|
112
|
+
const o = e.getAttribute(C.PRODUCT_QUANTITY_VISIBLE) === "1";
|
|
111
113
|
this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
|
|
112
114
|
}
|
|
113
115
|
_applyVisibilityStyles() {
|
|
@@ -121,25 +123,26 @@ class S extends I {
|
|
|
121
123
|
};
|
|
122
124
|
Object.entries(t).forEach(([e, o]) => {
|
|
123
125
|
var d;
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
+
const r = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
|
|
127
|
+
if (!r)
|
|
126
128
|
return;
|
|
127
|
-
const
|
|
128
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
129
|
-
})
|
|
129
|
+
const T = this.visibilityState[e];
|
|
130
|
+
this.api.getDocumentModifier().modifyHtml(r).setStyle("display", T ? "table-cell" : "none").apply(new l(`Applied ${e} visibility from attributes`));
|
|
131
|
+
});
|
|
130
132
|
}
|
|
131
133
|
_updateVisibilityAttribute(t, e) {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
[i.
|
|
137
|
-
[i.
|
|
138
|
-
[i.
|
|
134
|
+
const o = P(this.currentNode);
|
|
135
|
+
if (!o)
|
|
136
|
+
return;
|
|
137
|
+
const T = {
|
|
138
|
+
[i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
|
|
139
|
+
[i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
|
|
140
|
+
[i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
|
|
141
|
+
[i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
|
|
142
|
+
[i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
|
|
143
|
+
[i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
|
|
139
144
|
}[t];
|
|
140
|
-
|
|
141
|
-
[n]: e
|
|
142
|
-
});
|
|
145
|
+
T && this.api.getDocumentModifier().modifyHtml(o).setAttribute(C[T], e ? "1" : "0").apply(new l(`Updated ${t} visibility attribute`));
|
|
143
146
|
}
|
|
144
147
|
_listenToFormUpdates() {
|
|
145
148
|
this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => this._onProductImageChange(t)), this.api.onValueChanged(i.PRODUCT_NAME, (t) => this._onProductNameChange(t)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (t) => this._onProductQuantityChange(t)), this.api.onValueChanged(i.PRODUCT_PRICE, (t) => this._onProductPriceChange(t)), this.api.onValueChanged(
|
|
@@ -167,7 +170,7 @@ class S extends I {
|
|
|
167
170
|
_onProductPriceChange(t) {
|
|
168
171
|
var o;
|
|
169
172
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
|
|
170
|
-
e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t)
|
|
173
|
+
e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t));
|
|
171
174
|
}
|
|
172
175
|
_onProductOriginalPriceChange(t) {
|
|
173
176
|
var o;
|
|
@@ -176,30 +179,7 @@ class S extends I {
|
|
|
176
179
|
);
|
|
177
180
|
e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
|
|
178
181
|
`Product original price visibility changed to ${t ? "visible" : "hidden"}`
|
|
179
|
-
)), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t)
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Updates both price cell widths in vertical layout based on priceOrientation and visibility.
|
|
183
|
-
* - When priceOrientation is 'vertical': both cells are 100% (stacked layout)
|
|
184
|
-
* - When priceOrientation is 'horizontal':
|
|
185
|
-
* - When original price is hidden, price cell expands to 100%
|
|
186
|
-
* - When price is hidden, original price cell expands to 100%
|
|
187
|
-
* - When both are visible, they share 50% each
|
|
188
|
-
*/
|
|
189
|
-
_updatePriceCellWidthsForVerticalLayout() {
|
|
190
|
-
var u, _;
|
|
191
|
-
if (!(this.store.orientation === h.ORIENTATION.VERTICAL))
|
|
192
|
-
return;
|
|
193
|
-
const e = (u = this.currentNode) == null ? void 0 : u.querySelector(".product-price-class"), o = (_ = this.currentNode) == null ? void 0 : _.querySelector(".product-original-price-class"), n = this.store.priceOrientation === "vertical", c = this.visibilityState[i.PRODUCT_PRICE], d = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = this.api.getDocumentModifier();
|
|
194
|
-
if (e) {
|
|
195
|
-
const C = n || !d ? "100%" : "50%";
|
|
196
|
-
T.modifyHtml(e).setStyle("width", C);
|
|
197
|
-
}
|
|
198
|
-
if (o) {
|
|
199
|
-
const C = n || !c ? "100%" : "50%";
|
|
200
|
-
T.modifyHtml(o).setStyle("width", C);
|
|
201
|
-
}
|
|
202
|
-
T.apply(new l("Updated price cell widths for vertical layout"));
|
|
182
|
+
)), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t));
|
|
203
183
|
}
|
|
204
184
|
_onProductButtonChange(t) {
|
|
205
185
|
var o;
|
|
@@ -208,6 +188,6 @@ class S extends I {
|
|
|
208
188
|
}
|
|
209
189
|
}
|
|
210
190
|
export {
|
|
211
|
-
|
|
212
|
-
|
|
191
|
+
h as COMPOSITION_CONTROL_BLOCK_ID,
|
|
192
|
+
g as ItemsBlockCardCompositionControl
|
|
213
193
|
};
|
|
@@ -1,52 +1,59 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommonControl as
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var a = (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) => a(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
5
5
|
import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
|
|
6
|
-
import { useItemsBlockStore as
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { useItemsBlockStore as l } from "../../store/items-block.js";
|
|
7
|
+
import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
8
|
+
import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
|
|
9
|
+
const s = d.IMAGE_LINK, n = {
|
|
9
10
|
LINK: "link"
|
|
10
11
|
};
|
|
11
|
-
class
|
|
12
|
+
class N extends m {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
|
-
|
|
15
|
+
i(this, "store", l());
|
|
15
16
|
}
|
|
16
17
|
getId() {
|
|
17
|
-
return
|
|
18
|
+
return s;
|
|
18
19
|
}
|
|
19
20
|
getTemplate() {
|
|
20
21
|
return `
|
|
21
|
-
<div class="
|
|
22
|
+
<div class="${s}">
|
|
22
23
|
${this._getLink()}
|
|
23
24
|
</div>
|
|
24
25
|
`;
|
|
25
26
|
}
|
|
26
27
|
onRender() {
|
|
27
28
|
this.api.updateValues({
|
|
28
|
-
[
|
|
29
|
-
});
|
|
29
|
+
[n.LINK]: this.store.imageLink
|
|
30
|
+
}), this._listenToFormUpdates();
|
|
30
31
|
}
|
|
31
|
-
onTemplateNodeUpdated(
|
|
32
|
-
super.onTemplateNodeUpdated(
|
|
33
|
-
() =>
|
|
34
|
-
const o = p(this.currentNode);
|
|
35
|
-
o != null && o.imageLink && this.store.setImageLink(o.imageLink);
|
|
36
|
-
},
|
|
32
|
+
onTemplateNodeUpdated(e) {
|
|
33
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
34
|
+
() => h(this.currentNode),
|
|
37
35
|
() => {
|
|
38
36
|
this.api.updateValues({
|
|
39
|
-
[
|
|
37
|
+
[n.LINK]: this.store.imageLink
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
40
|
);
|
|
43
41
|
}
|
|
42
|
+
_listenToFormUpdates() {
|
|
43
|
+
this.api.onValueChanged(
|
|
44
|
+
n.LINK,
|
|
45
|
+
(e) => this._onLinkChange(e)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
_onLinkChange(e) {
|
|
49
|
+
console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
|
|
50
|
+
}
|
|
44
51
|
_getLink() {
|
|
45
52
|
return `
|
|
46
53
|
${this._GuOneColumn([
|
|
47
54
|
this._GuLabel({ text: "Link" }),
|
|
48
55
|
this._GuTextInput({
|
|
49
|
-
name:
|
|
56
|
+
name: n.LINK,
|
|
50
57
|
placeholder: "Enter Link",
|
|
51
58
|
className: "es-100",
|
|
52
59
|
disabled: !0
|
|
@@ -56,6 +63,6 @@ class g extends l {
|
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
s as CONTROL_BLOCK_ID,
|
|
67
|
+
N as ImageLinkControl
|
|
61
68
|
};
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as a, UIElementType as l, UEAttr as
|
|
2
|
+
var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var n = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as a, UIElementType as l, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as c } from "../../../common-control.js";
|
|
6
6
|
import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
|
|
7
7
|
import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
|
|
8
8
|
import { useItemsBlockStore as N } from "../../store/items-block.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import { syncNameTrimmingFromAttributes as M } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.js";
|
|
11
|
+
const y = p.NAME_TRIMMING, o = {
|
|
11
12
|
TRIMMING: "trimming"
|
|
12
13
|
};
|
|
13
14
|
class _ extends c {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
16
|
-
|
|
17
|
+
n(this, "store", N());
|
|
17
18
|
}
|
|
18
19
|
getId() {
|
|
19
20
|
return y;
|
|
20
21
|
}
|
|
21
22
|
getTemplate() {
|
|
22
23
|
return `
|
|
23
|
-
<div class="
|
|
24
|
+
<div class="${p.NAME_TRIMMING}">
|
|
24
25
|
${this._getTextTrimming()}
|
|
25
26
|
</div>
|
|
26
27
|
`;
|
|
27
28
|
}
|
|
28
29
|
onRender() {
|
|
29
|
-
this.api.updateValues({ [
|
|
30
|
+
this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(o.TRIMMING, (e) => {
|
|
30
31
|
this._onTrimmingChange(e);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
onTemplateNodeUpdated(e) {
|
|
34
35
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
36
|
+
() => M(this.currentNode),
|
|
35
37
|
() => {
|
|
36
|
-
|
|
37
|
-
o && this.store.setNameTrimming(o.nameTrimming ?? !0);
|
|
38
|
-
},
|
|
39
|
-
() => {
|
|
40
|
-
this.api.updateValues({ [m.TRIMMING]: this.store.nameTrimming });
|
|
38
|
+
this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming });
|
|
41
39
|
}
|
|
42
40
|
);
|
|
43
41
|
}
|
|
44
42
|
_onTrimmingChange(e) {
|
|
45
|
-
this.store.setNameTrimming(e),
|
|
43
|
+
this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
46
44
|
}
|
|
47
45
|
_applyTrimmingStyles(e) {
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
46
|
+
var s;
|
|
47
|
+
const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
|
|
48
|
+
if (!r)
|
|
51
49
|
return;
|
|
52
|
-
const T = e !== void 0 ? e : this.store.nameTrimming,
|
|
53
|
-
T ? this.api.getDocumentModifier().modifyHtml(
|
|
50
|
+
const T = e !== void 0 ? e : this.store.nameTrimming, m = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
51
|
+
T ? this.api.getDocumentModifier().modifyHtml(r).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", m ? "130px" : "520px").apply(new a("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(r).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").setStyle("max-width", m ? "130px" : "520px").apply(new a("Text Trimming Disabled"));
|
|
54
52
|
}
|
|
55
53
|
_getTextTrimming() {
|
|
56
54
|
return `
|
|
57
|
-
<div class="
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
<div class="container">
|
|
56
|
+
<div class="display-flex align-items-center justify-content-between">
|
|
57
|
+
<${l.LABEL}
|
|
58
|
+
${g.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
59
|
+
>
|
|
60
|
+
</${l.LABEL}>
|
|
61
|
+
${this._GuToggle(o.TRIMMING)}
|
|
62
|
+
</div>
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
@@ -1,48 +1,46 @@
|
|
|
1
|
-
var
|
|
2
|
-
var R = (i, o, e) => o in i ?
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var R = (i, o, e) => o in i ? L(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
3
|
var p = (i, o, e) => R(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
4
|
import { currencyLocationMaps as m } from "../../../../../enums/extensions/recommendationBlock.js";
|
|
5
|
-
import { UEAttr as
|
|
5
|
+
import { UEAttr as N, ModificationDescription as I } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
6
|
import { CommonControl as T } from "../../../common-control.js";
|
|
7
7
|
import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
|
|
8
|
-
import { useItemsBlockStore as
|
|
9
|
-
import {
|
|
8
|
+
import { useItemsBlockStore as E } from "../../store/items-block.js";
|
|
9
|
+
import { syncCurrencyLocationFromAttributes as f } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as O } from "../../utils/updateAttributes.js";
|
|
10
11
|
const b = h.PRICE_CURRENCY_LOCATION, a = {
|
|
11
12
|
CURRENCY_LOCATION: "currencyLocation"
|
|
12
13
|
};
|
|
13
|
-
class
|
|
14
|
+
class Y extends T {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
16
|
-
p(this, "store",
|
|
17
|
+
p(this, "store", E());
|
|
17
18
|
}
|
|
18
19
|
getId() {
|
|
19
20
|
return b;
|
|
20
21
|
}
|
|
21
22
|
getTemplate() {
|
|
22
23
|
return `
|
|
23
|
-
<div class="
|
|
24
|
+
<div class="${h.PRICE_CURRENCY_LOCATION}">
|
|
24
25
|
${this._getCurrencyLocation()}
|
|
25
26
|
</div>
|
|
26
27
|
`;
|
|
27
28
|
}
|
|
28
29
|
onRender() {
|
|
29
|
-
this.api.setUIEAttribute(a.CURRENCY_LOCATION,
|
|
30
|
+
this.api.setUIEAttribute(a.CURRENCY_LOCATION, N.SELECTPICKER.items, m), this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation }), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
|
|
30
31
|
this._onCurrencyLocationChange(e);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
onTemplateNodeUpdated(e) {
|
|
34
35
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
35
|
-
() =>
|
|
36
|
-
const t = E(this.currentNode);
|
|
37
|
-
t && this.store.setCurrencyLocation(t.priceCurrencyLocation || "0");
|
|
38
|
-
},
|
|
36
|
+
() => f(this.currentNode),
|
|
39
37
|
() => {
|
|
40
38
|
this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
|
|
41
39
|
}
|
|
42
40
|
);
|
|
43
41
|
}
|
|
44
42
|
_onCurrencyLocationChange(e) {
|
|
45
|
-
if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), O(this.currentNode, this.api
|
|
43
|
+
if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), O(this.currentNode, this.api), !this.currentNode)
|
|
46
44
|
return;
|
|
47
45
|
const t = this._getPriceBlocks();
|
|
48
46
|
if (!t || t.length === 0)
|
|
@@ -52,8 +50,8 @@ class B extends T {
|
|
|
52
50
|
const s = this._getParagraph(c);
|
|
53
51
|
if (!s)
|
|
54
52
|
return;
|
|
55
|
-
const
|
|
56
|
-
this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(
|
|
53
|
+
const u = s.getInnerHTML() || "", l = s.getInnerText() || "", C = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(l, C), g = this._detectSymbolInText(l) || C, _ = this._buildPriceContent(d, g, r), y = u.replace(l, _);
|
|
54
|
+
this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(y).apply(new I(
|
|
57
55
|
`Updated currency location to ${r === "1" ? "after" : "before"}`
|
|
58
56
|
));
|
|
59
57
|
});
|
|
@@ -77,8 +75,8 @@ class B extends T {
|
|
|
77
75
|
} else {
|
|
78
76
|
const c = r.match(/([^0-9.,\s]+)/);
|
|
79
77
|
if (c && c[1]) {
|
|
80
|
-
const s = c[1].trim(),
|
|
81
|
-
n = r.replace(
|
|
78
|
+
const s = c[1].trim(), u = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
79
|
+
n = r.replace(u, "").trim();
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
return n;
|
|
@@ -105,5 +103,5 @@ class B extends T {
|
|
|
105
103
|
}
|
|
106
104
|
export {
|
|
107
105
|
b as CONTROL_BLOCK_ID,
|
|
108
|
-
|
|
106
|
+
Y as PriceCurrencyLocationControl
|
|
109
107
|
};
|
|
@@ -5,11 +5,12 @@ import { ModificationDescription as b } from "../../../../../node_modules/@strip
|
|
|
5
5
|
import { CommonControl as R } from "../../../common-control.js";
|
|
6
6
|
import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
|
|
7
7
|
import { useItemsBlockStore as f } from "../../store/items-block.js";
|
|
8
|
-
import {
|
|
8
|
+
import { syncCurrencySymbolFromAttributes as N } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
9
|
+
import { updateConfigBlockAttributes as B } from "../../utils/updateAttributes.js";
|
|
9
10
|
const E = h.PRICE_CURRENCY_SYMBOL, m = {
|
|
10
11
|
CURRENCY_SYMBOL: "currencySymbol"
|
|
11
12
|
};
|
|
12
|
-
class
|
|
13
|
+
class P extends R {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
16
|
u(this, "store", f());
|
|
@@ -20,7 +21,7 @@ class M extends R {
|
|
|
20
21
|
}
|
|
21
22
|
getTemplate() {
|
|
22
23
|
return `
|
|
23
|
-
<div class="
|
|
24
|
+
<div class="${h.PRICE_CURRENCY_SYMBOL}">
|
|
24
25
|
${this._getCurrencySymbol()}
|
|
25
26
|
</div>
|
|
26
27
|
`;
|
|
@@ -35,10 +36,7 @@ class M extends R {
|
|
|
35
36
|
}
|
|
36
37
|
onTemplateNodeUpdated(e) {
|
|
37
38
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
38
|
-
() =>
|
|
39
|
-
const t = B(this.currentNode);
|
|
40
|
-
t && this.store.setCurrencySymbol(t.priceCurrencySymbol || "");
|
|
41
|
-
},
|
|
39
|
+
() => N(this.currentNode),
|
|
42
40
|
() => {
|
|
43
41
|
this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents();
|
|
44
42
|
}
|
|
@@ -47,18 +45,18 @@ class M extends R {
|
|
|
47
45
|
_onCurrencySymbolChange(e) {
|
|
48
46
|
var i;
|
|
49
47
|
console.debug("Currency symbol changed to: ", e);
|
|
50
|
-
const
|
|
51
|
-
if (this.store.setCurrencySymbol(e),
|
|
48
|
+
const r = ((i = this.store.currencySymbol) == null ? void 0 : i.trim()) || "";
|
|
49
|
+
if (this.store.setCurrencySymbol(e), B(this.currentNode, this.api), !this.currentNode)
|
|
52
50
|
return;
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
51
|
+
const t = this._getPriceBlocks();
|
|
52
|
+
if (!t || t.length === 0)
|
|
55
53
|
return;
|
|
56
54
|
const o = (e == null ? void 0 : e.trim()) || "", { currencyLocation: n } = this.store;
|
|
57
|
-
|
|
55
|
+
t.forEach((l) => {
|
|
58
56
|
const a = this._getParagraph(l);
|
|
59
57
|
if (!a)
|
|
60
58
|
return;
|
|
61
|
-
const y = a.getInnerHTML() || "", p = a.getInnerText() || "", C = this._removeCurrencySymbol(p,
|
|
59
|
+
const y = a.getInnerHTML() || "", p = a.getInnerText() || "", C = this._removeCurrencySymbol(p, r), g = this._buildPriceContent(C, o, n), d = y.replace(p, g);
|
|
62
60
|
this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(d).apply(new b(
|
|
63
61
|
`Updated currency symbol to ${o || "removed"}`
|
|
64
62
|
));
|
|
@@ -69,18 +67,18 @@ class M extends R {
|
|
|
69
67
|
return;
|
|
70
68
|
this.currentNode.querySelectorAll(
|
|
71
69
|
".items-block-price"
|
|
72
|
-
).forEach((
|
|
70
|
+
).forEach((r) => {
|
|
73
71
|
var o;
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
const n =
|
|
77
|
-
this.originalPriceContents.set(
|
|
72
|
+
const t = r.querySelector("p");
|
|
73
|
+
if (t && !this.originalPriceContents.has(t)) {
|
|
74
|
+
const n = t.getInnerText() || "", i = ((o = this.store.currencySymbol) == null ? void 0 : o.trim()) || "", l = this._removeCurrencySymbol(n, i);
|
|
75
|
+
this.originalPriceContents.set(t, l);
|
|
78
76
|
}
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
79
|
_getPriceBlocks() {
|
|
82
|
-
var e,
|
|
83
|
-
return ((
|
|
80
|
+
var e, r;
|
|
81
|
+
return ((r = (e = this.currentNode) == null ? void 0 : e.closest(".items-block")) == null ? void 0 : r.querySelectorAll(".items-block-price")) || [];
|
|
84
82
|
}
|
|
85
83
|
_getParagraph(e) {
|
|
86
84
|
return e.querySelector("p");
|
|
@@ -88,23 +86,23 @@ class M extends R {
|
|
|
88
86
|
_escapeRegex(e) {
|
|
89
87
|
return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
|
|
90
88
|
}
|
|
91
|
-
_removeCurrencySymbol(e,
|
|
92
|
-
const
|
|
93
|
-
let o =
|
|
94
|
-
if (
|
|
95
|
-
const n = new RegExp(`\\s*${this._escapeRegex(
|
|
96
|
-
o =
|
|
89
|
+
_removeCurrencySymbol(e, r) {
|
|
90
|
+
const t = e || "";
|
|
91
|
+
let o = t;
|
|
92
|
+
if (r) {
|
|
93
|
+
const n = new RegExp(`\\s*${this._escapeRegex(r)}\\s*`);
|
|
94
|
+
o = t.replace(n, "").trim();
|
|
97
95
|
} else {
|
|
98
|
-
const n =
|
|
96
|
+
const n = t.match(/([^0-9.,\s]+)/);
|
|
99
97
|
if (n && n[1]) {
|
|
100
98
|
const i = n[1].trim(), l = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
|
|
101
|
-
o =
|
|
99
|
+
o = t.replace(l, "").trim();
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
return o;
|
|
105
103
|
}
|
|
106
|
-
_buildPriceContent(e,
|
|
107
|
-
return
|
|
104
|
+
_buildPriceContent(e, r, t) {
|
|
105
|
+
return r ? t === "1" ? `${e} ${r}` : `${r} ${e}` : e;
|
|
108
106
|
}
|
|
109
107
|
_getCurrencySymbol() {
|
|
110
108
|
return `
|
|
@@ -121,5 +119,5 @@ class M extends R {
|
|
|
121
119
|
}
|
|
122
120
|
export {
|
|
123
121
|
E as CONTROL_BLOCK_ID,
|
|
124
|
-
|
|
122
|
+
P as PriceCurrencySymbolControl
|
|
125
123
|
};
|