@useinsider/guido 1.4.4 → 2.0.0-beta.087a24f
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 +295 -664
- package/dist/@types/config/defaults.js +44 -0
- package/dist/@types/config/schemas.js +231 -0
- package/dist/@types/config/validator.js +56 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +64 -86
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
- package/dist/composables/useActionsApi.js +42 -25
- package/dist/composables/useBlocksConfig.js +23 -20
- package/dist/composables/useConfig.js +51 -5
- package/dist/composables/useHtmlCompiler.js +20 -19
- package/dist/composables/useHtmlValidator.js +41 -41
- package/dist/composables/usePartner.js +19 -9
- package/dist/composables/useStripo.js +55 -56
- package/dist/composables/useTimerClone.js +53 -0
- package/dist/composables/useTranslations.js +3 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +283 -0
- package/dist/enums/defaults.js +4 -67
- package/dist/enums/unsubscribe.js +23 -20
- package/dist/extensions/Blocks/Items/block.js +39 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +296 -123
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
- package/dist/extensions/Blocks/common-control.js +64 -53
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
- package/dist/node_modules/valibot/dist/index.js +476 -103
- package/dist/services/stripoApi.js +13 -14
- package/dist/services/templateLibraryApi.js +18 -18
- package/dist/src/@types/config/defaults.d.ts +68 -0
- package/dist/src/@types/config/index.d.ts +14 -0
- package/dist/src/@types/config/schemas.d.ts +509 -0
- package/dist/src/@types/config/types.d.ts +142 -0
- package/dist/src/@types/config/validator.d.ts +119 -0
- package/dist/src/@types/generic.d.ts +4 -45
- package/dist/src/components/Guido.vue.d.ts +13 -12
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +186 -2
- package/dist/src/composables/usePartner.d.ts +8 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/enums/defaults.d.ts +5 -6
- package/dist/src/enums/unsubscribe.d.ts +5 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
- package/dist/src/library.d.ts +3 -1
- package/dist/src/stores/config.d.ts +1564 -102
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +141 -9
- package/package.json +3 -3
- package/dist/node_modules/lodash-es/_apply.js +0 -16
- package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
- package/dist/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
- package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
- package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- package/dist/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
- package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/lodash-es/_copyArray.js +0 -9
- package/dist/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
- package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
- package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
- package/dist/node_modules/lodash-es/_overRest.js +0 -15
- package/dist/node_modules/lodash-es/_safeGet.js +0 -7
- package/dist/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/lodash-es/_shortOut.js +0 -16
- package/dist/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
- package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
- package/dist/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/lodash-es/merge.js +0 -8
- package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
- package/dist/package.json.js +0 -7
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var _ = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
|
+
var d = (a, n, t) => _(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { ModificationDescription as r } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as u } from "../../common-control.js";
|
|
6
6
|
import { ItemsBlockId as s } from "../enums/controlEnums.js";
|
|
7
|
-
import {
|
|
8
|
-
import { SETTINGS_ENUMS as u } from "../enums/settingsEnums.js";
|
|
7
|
+
import { SETTINGS_ENUMS as R } from "../enums/settingsEnums.js";
|
|
9
8
|
import { useItemsBlockStore as O } from "../store/items-block.js";
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
9
|
+
import { getItemsBlockConfig as C, setItemsBlockConfig as h } from "../utils/nodeConfigUtils.js";
|
|
10
|
+
const I = "ui-elements-items-card-composition-block", i = {
|
|
12
11
|
PRODUCT_IMAGE: "image",
|
|
13
12
|
PRODUCT_NAME: "name",
|
|
14
13
|
PRODUCT_QUANTITY: "quantity",
|
|
@@ -16,11 +15,11 @@ const h = "ui-elements-items-card-composition-block", i = {
|
|
|
16
15
|
PRODUCT_ORIGINAL_PRICE: "originalPrice",
|
|
17
16
|
PRODUCT_BUTTON: "button"
|
|
18
17
|
};
|
|
19
|
-
class
|
|
18
|
+
class N extends u {
|
|
20
19
|
constructor() {
|
|
21
20
|
super(...arguments);
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
d(this, "store", O());
|
|
22
|
+
d(this, "visibilityState", {
|
|
24
23
|
[i.PRODUCT_IMAGE]: !0,
|
|
25
24
|
[i.PRODUCT_NAME]: !0,
|
|
26
25
|
[i.PRODUCT_QUANTITY]: !0,
|
|
@@ -30,7 +29,7 @@ class g extends R {
|
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
getId() {
|
|
33
|
-
return
|
|
32
|
+
return I;
|
|
34
33
|
}
|
|
35
34
|
getTemplate() {
|
|
36
35
|
return `
|
|
@@ -83,20 +82,20 @@ class g extends R {
|
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
84
|
_syncVisibilityFromAttributes() {
|
|
86
|
-
const t =
|
|
85
|
+
const t = C(this.currentNode);
|
|
87
86
|
if (!t)
|
|
88
87
|
return;
|
|
89
88
|
const e = {
|
|
90
|
-
[i.PRODUCT_IMAGE]: "
|
|
91
|
-
[i.PRODUCT_NAME]: "
|
|
92
|
-
[i.PRODUCT_QUANTITY]: "
|
|
93
|
-
[i.PRODUCT_PRICE]: "
|
|
94
|
-
[i.PRODUCT_ORIGINAL_PRICE]: "
|
|
95
|
-
[i.PRODUCT_BUTTON]: "
|
|
89
|
+
[i.PRODUCT_IMAGE]: "imageVisible",
|
|
90
|
+
[i.PRODUCT_NAME]: "nameVisible",
|
|
91
|
+
[i.PRODUCT_QUANTITY]: "quantityControlEnabled",
|
|
92
|
+
[i.PRODUCT_PRICE]: "priceVisible",
|
|
93
|
+
[i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
|
|
94
|
+
[i.PRODUCT_BUTTON]: "buttonVisible"
|
|
96
95
|
};
|
|
97
|
-
Object.entries(e).forEach(([o,
|
|
98
|
-
const T = t
|
|
99
|
-
this.visibilityState[o] =
|
|
96
|
+
Object.entries(e).forEach(([o, l]) => {
|
|
97
|
+
const T = t[l];
|
|
98
|
+
this.visibilityState[o] = T !== !1;
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
101
|
/**
|
|
@@ -105,11 +104,10 @@ class g extends R {
|
|
|
105
104
|
* and mark it as '0'
|
|
106
105
|
*/
|
|
107
106
|
_handleBrowsedItemsQuantity() {
|
|
108
|
-
|
|
109
|
-
const t = this.store.itemsType !== u.ITEMS_TYPE.BROWSED_ITEMS, e = (r = this.currentNode) == null ? void 0 : r.querySelector("esd-config-block");
|
|
107
|
+
const t = this.store.itemsType !== R.ITEMS_TYPE.BROWSED_ITEMS, e = C(this.currentNode);
|
|
110
108
|
if (!e)
|
|
111
109
|
return;
|
|
112
|
-
const o = e.
|
|
110
|
+
const o = e.quantityControlEnabled !== !1;
|
|
113
111
|
this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
|
|
114
112
|
}
|
|
115
113
|
_applyVisibilityStyles() {
|
|
@@ -122,27 +120,26 @@ class g extends R {
|
|
|
122
120
|
[i.PRODUCT_BUTTON]: s.BUTTON
|
|
123
121
|
};
|
|
124
122
|
Object.entries(t).forEach(([e, o]) => {
|
|
125
|
-
var
|
|
126
|
-
const
|
|
127
|
-
if (!
|
|
123
|
+
var c;
|
|
124
|
+
const l = (c = this.currentNode) == null ? void 0 : c.querySelector(`[esd-extension-block-id="${o}"]`);
|
|
125
|
+
if (!l)
|
|
128
126
|
return;
|
|
129
127
|
const T = this.visibilityState[e];
|
|
130
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
128
|
+
this.api.getDocumentModifier().modifyHtml(l).setStyle("display", T ? "table-cell" : "none").apply(new r(`Applied ${e} visibility from attributes`));
|
|
131
129
|
});
|
|
132
130
|
}
|
|
133
131
|
_updateVisibilityAttribute(t, e) {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
[i.
|
|
139
|
-
[i.
|
|
140
|
-
[i.
|
|
141
|
-
[i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
|
|
142
|
-
[i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
|
|
143
|
-
[i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
|
|
132
|
+
const l = {
|
|
133
|
+
[i.PRODUCT_IMAGE]: "imageVisible",
|
|
134
|
+
[i.PRODUCT_NAME]: "nameVisible",
|
|
135
|
+
[i.PRODUCT_QUANTITY]: "quantityControlEnabled",
|
|
136
|
+
[i.PRODUCT_PRICE]: "priceVisible",
|
|
137
|
+
[i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
|
|
138
|
+
[i.PRODUCT_BUTTON]: "buttonVisible"
|
|
144
139
|
}[t];
|
|
145
|
-
|
|
140
|
+
l && h(this.currentNode, this.api, {
|
|
141
|
+
[l]: e
|
|
142
|
+
});
|
|
146
143
|
}
|
|
147
144
|
_listenToFormUpdates() {
|
|
148
145
|
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(
|
|
@@ -153,41 +150,41 @@ class g extends R {
|
|
|
153
150
|
_onProductImageChange(t) {
|
|
154
151
|
var o;
|
|
155
152
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.IMAGE}"]`);
|
|
156
|
-
e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new
|
|
153
|
+
e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
|
|
157
154
|
}
|
|
158
155
|
_onProductNameChange(t) {
|
|
159
156
|
var o;
|
|
160
157
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.NAME}"]`);
|
|
161
|
-
e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new
|
|
158
|
+
e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
|
|
162
159
|
}
|
|
163
160
|
_onProductQuantityChange(t) {
|
|
164
161
|
var o;
|
|
165
162
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.QUANTITY}"]`);
|
|
166
|
-
e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new
|
|
163
|
+
e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(
|
|
167
164
|
`Product quantity visibility changed to ${t ? "visible" : "hidden"}`
|
|
168
165
|
)), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
|
|
169
166
|
}
|
|
170
167
|
_onProductPriceChange(t) {
|
|
171
168
|
var o;
|
|
172
169
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
|
|
173
|
-
e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new
|
|
170
|
+
e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t));
|
|
174
171
|
}
|
|
175
172
|
_onProductOriginalPriceChange(t) {
|
|
176
173
|
var o;
|
|
177
174
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(
|
|
178
175
|
`[esd-extension-block-id="${s.ORIGINAL_PRICE}"]`
|
|
179
176
|
);
|
|
180
|
-
e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new
|
|
177
|
+
e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(
|
|
181
178
|
`Product original price visibility changed to ${t ? "visible" : "hidden"}`
|
|
182
179
|
)), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t));
|
|
183
180
|
}
|
|
184
181
|
_onProductButtonChange(t) {
|
|
185
182
|
var o;
|
|
186
183
|
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.BUTTON}"]`);
|
|
187
|
-
e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new
|
|
184
|
+
e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
|
|
188
185
|
}
|
|
189
186
|
}
|
|
190
187
|
export {
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
I as COMPOSITION_CONTROL_BLOCK_ID,
|
|
189
|
+
N as ItemsBlockCardCompositionControl
|
|
193
190
|
};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
var I = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var m = (n, o, t) =>
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
2
|
+
var f = (n, o, t) => o in n ? I(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
|
|
3
|
+
var m = (n, o, t) => f(n, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as y } from "../../../common-control.js";
|
|
6
6
|
import { ItemsBlockControlId as O } from "../../enums/controlEnums.js";
|
|
7
|
-
import { SETTINGS_ENUMS as
|
|
8
|
-
import { useItemsBlockStore as
|
|
9
|
-
import {
|
|
10
|
-
import { updateConfigBlockAttributes as P } from "../../utils/updateAttributes.js";
|
|
7
|
+
import { SETTINGS_ENUMS as E } from "../../enums/settingsEnums.js";
|
|
8
|
+
import { useItemsBlockStore as N } from "../../store/items-block.js";
|
|
9
|
+
import { getItemsBlockConfig as T, setItemsBlockConfig as C } from "../../utils/nodeConfigUtils.js";
|
|
11
10
|
const _ = O.PRICE_ORIENTATION, p = {
|
|
12
11
|
PRICE_ORIENTATION: "priceOrientation"
|
|
13
|
-
},
|
|
12
|
+
}, P = [
|
|
14
13
|
{ icon: "vertical-orientation", value: "vertical" },
|
|
15
14
|
{ icon: "horizontal-orientation", value: "horizontal" }
|
|
16
15
|
];
|
|
17
|
-
class
|
|
16
|
+
class H extends y {
|
|
18
17
|
constructor() {
|
|
19
18
|
super(...arguments);
|
|
20
|
-
m(this, "store",
|
|
19
|
+
m(this, "store", N());
|
|
21
20
|
}
|
|
22
21
|
getId() {
|
|
23
22
|
return _;
|
|
@@ -31,13 +30,14 @@ class v extends E {
|
|
|
31
30
|
}
|
|
32
31
|
onRender() {
|
|
33
32
|
this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation }), this.api.onValueChanged(p.PRICE_ORIENTATION, (t) => {
|
|
34
|
-
this._onPriceOrientationChange(t);
|
|
33
|
+
typeof t == "string" && this._onPriceOrientationChange(t);
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
onTemplateNodeUpdated(t) {
|
|
38
37
|
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
39
38
|
() => {
|
|
40
|
-
T(this.currentNode);
|
|
39
|
+
const i = T(this.currentNode);
|
|
40
|
+
i && this.store.setPriceOrientation(i.priceOrientation || "horizontal");
|
|
41
41
|
},
|
|
42
42
|
() => {
|
|
43
43
|
this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation });
|
|
@@ -45,24 +45,26 @@ class v extends E {
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
_onPriceOrientationChange(t) {
|
|
48
|
-
if (
|
|
48
|
+
if (this.store.setPriceOrientation(t), C(this.currentNode, this.api, {
|
|
49
|
+
priceOrientation: t
|
|
50
|
+
}), !this.currentNode)
|
|
49
51
|
return;
|
|
50
|
-
const { orientation: i } = this.store, r = i ===
|
|
52
|
+
const { orientation: i } = this.store, r = i === E.ORIENTATION.VERTICAL, e = t === "horizontal";
|
|
51
53
|
r ? this._updateVerticalLayout(e) : this._updateHorizontalLayout(e);
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
_updateVerticalLayout(t) {
|
|
54
56
|
var c, l, d, a;
|
|
55
57
|
const i = ((l = (c = this.currentNode) == null ? void 0 : c.closest(".ins-product-td")) == null ? void 0 : l.querySelectorAll(".product-price-class")) || [], r = ((a = (d = this.currentNode) == null ? void 0 : d.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".product-original-price-class")) || [];
|
|
56
58
|
if (!i || !r)
|
|
57
59
|
return;
|
|
58
60
|
const e = t ? "50%" : "100%", s = this.api.getDocumentModifier();
|
|
59
|
-
i.forEach((
|
|
60
|
-
s.modifyHtml(
|
|
61
|
-
}), r.forEach((
|
|
62
|
-
s.modifyHtml(
|
|
63
|
-
}), s.apply(new
|
|
61
|
+
i.forEach((h) => {
|
|
62
|
+
s.modifyHtml(h).setAttribute("width", e).setStyle("width", e);
|
|
63
|
+
}), r.forEach((h) => {
|
|
64
|
+
s.modifyHtml(h).setAttribute("width", e).setStyle("width", e);
|
|
65
|
+
}), s.apply(new u(`Updated original price element width to ${e}`));
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
_updateHorizontalLayout(t) {
|
|
66
68
|
var s, c, l, d;
|
|
67
69
|
const i = ((c = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : c.querySelectorAll(".horizontal-price")) || [], r = (d = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : d.querySelector(".vertical-price");
|
|
68
70
|
if (!i || !r || i.length === 0)
|
|
@@ -70,9 +72,9 @@ class v extends E {
|
|
|
70
72
|
const e = this.api.getDocumentModifier();
|
|
71
73
|
t ? (i.forEach((a) => {
|
|
72
74
|
e.modifyHtml(a).setStyle("display", "table-cell");
|
|
73
|
-
}), e.modifyHtml(r).setStyle("display", "none").apply(new
|
|
75
|
+
}), e.modifyHtml(r).setStyle("display", "none"), e.apply(new u("Show horizontal price orientation"))) : (i.forEach((a) => {
|
|
74
76
|
e.modifyHtml(a).setStyle("display", "none");
|
|
75
|
-
}), e.modifyHtml(r).setStyle("display", "table-cell").apply(new
|
|
77
|
+
}), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new u("Show vertical price orientation")));
|
|
76
78
|
}
|
|
77
79
|
_getPriceOrientation() {
|
|
78
80
|
return `
|
|
@@ -80,7 +82,7 @@ class v extends E {
|
|
|
80
82
|
this._GuLabel({ text: "Price Orientation" }),
|
|
81
83
|
this._GuRadioButton({
|
|
82
84
|
name: p.PRICE_ORIENTATION,
|
|
83
|
-
buttons:
|
|
85
|
+
buttons: P
|
|
84
86
|
})
|
|
85
87
|
])}
|
|
86
88
|
`;
|
|
@@ -88,5 +90,5 @@ class v extends E {
|
|
|
88
90
|
}
|
|
89
91
|
export {
|
|
90
92
|
_ as CONTROL_BLOCK_ID,
|
|
91
|
-
|
|
93
|
+
H as PriceOrientationControl
|
|
92
94
|
};
|