@useinsider/guido 1.0.3-beta.cd0d7f3 → 1.0.3-beta.ce3ed00
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 -3
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +73 -79
- package/dist/components/organisms/header/RightSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
- package/dist/composables/useActionsApi.js +1 -1
- package/dist/composables/useGuidoActions.js +9 -19
- package/dist/composables/useHtmlCompiler.js +13 -15
- package/dist/composables/useHtmlValidator.js +35 -36
- package/dist/composables/useStripo.js +36 -38
- package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
- package/dist/enums/defaults.js +1 -2
- package/dist/enums/onboarding.js +3 -7
- package/dist/enums/unsubscribe.js +25 -27
- package/dist/extensions/Blocks/Items/block.js +42 -38
- package/dist/extensions/Blocks/Items/controls/button/link.js +17 -25
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +57 -151
- package/dist/extensions/Blocks/Items/controls/image/link.js +20 -28
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +22 -29
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +18 -25
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +8 -18
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -37
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +14 -37
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +118 -148
- package/dist/extensions/Blocks/Items/enums/productEnums.js +5 -96
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -20
- package/dist/extensions/Blocks/Items/extension.js +4 -4
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +8 -6
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +12 -7
- package/dist/extensions/Blocks/Items/settingsPanel.js +45 -71
- package/dist/extensions/Blocks/Items/store/items-block.js +1 -5
- package/dist/extensions/Blocks/Items/template.js +63 -149
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
- package/dist/extensions/Blocks/common-control.js +125 -164
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
- package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +2 -12
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +12 -13
- package/dist/node_modules/lodash-es/keysIn.js +3 -3
- package/dist/package.json.js +1 -1
- package/dist/src/@types/generic.d.ts +6 -27
- package/dist/src/components/Guido.vue.d.ts +2 -3
- package/dist/src/composables/useGuidoActions.d.ts +0 -9
- package/dist/src/enums/onboarding.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +7 -20
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +1 -5
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -3
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -18
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -14
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +2 -25
- package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
- package/dist/src/stores/config.d.ts +2 -3
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/src/stores/editor.d.ts +1 -1
- package/dist/src/stores/onboarding.d.ts +1 -335
- package/dist/src/stores/preview.d.ts +1 -1
- package/dist/src/stores/recommendation.d.ts +1 -1
- package/dist/src/stores/save-as-template.d.ts +1 -1
- package/dist/src/stores/toaster.d.ts +1 -1
- package/dist/src/stores/unsubscribe.d.ts +1 -1
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/genericUtil.d.ts +0 -1
- package/dist/stores/config.js +5 -5
- package/dist/stores/dynamic-content.js +2 -2
- package/dist/stores/editor.js +1 -1
- package/dist/stores/onboarding.js +36 -44
- package/dist/stores/preview.js +1 -1
- package/dist/stores/recommendation.js +3 -3
- package/dist/stores/save-as-template.js +2 -2
- package/dist/stores/toaster.js +1 -1
- package/dist/stores/unsubscribe.js +1 -1
- package/dist/stores/version-history.js +4 -4
- package/dist/utils/genericUtil.js +6 -17
- package/package.json +3 -3
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +0 -99
- package/dist/config/compiler/itemsCompilerRules.js +0 -14
- package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
- package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -67
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -44
- package/dist/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/lodash-es/_SetCache.js +0 -13
- package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
- package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
- package/dist/node_modules/lodash-es/_arraySome.js +0 -9
- package/dist/node_modules/lodash-es/_baseEach.js +0 -6
- package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
- package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
- package/dist/node_modules/lodash-es/_baseGet.js +0 -11
- package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
- package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
- package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
- package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
- package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
- package/dist/node_modules/lodash-es/_baseMap.js +0 -11
- package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
- package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
- package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
- package/dist/node_modules/lodash-es/_baseRange.js +0 -9
- package/dist/node_modules/lodash-es/_baseToString.js +0 -18
- package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
- package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
- package/dist/node_modules/lodash-es/_createRange.js +0 -11
- package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
- package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
- package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
- package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
- package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/lodash-es/_getTag.js +0 -28
- package/dist/node_modules/lodash-es/_hasPath.js +0 -19
- package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
- package/dist/node_modules/lodash-es/_isKey.js +0 -12
- package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
- package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
- package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
- package/dist/node_modules/lodash-es/flatMap.js +0 -8
- package/dist/node_modules/lodash-es/get.js +0 -8
- package/dist/node_modules/lodash-es/hasIn.js +0 -8
- package/dist/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/lodash-es/map.js +0 -11
- package/dist/node_modules/lodash-es/property.js +0 -10
- package/dist/node_modules/lodash-es/range.js +0 -5
- package/dist/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/lodash-es/toFinite.js +0 -14
- package/dist/node_modules/lodash-es/toNumber.js +0 -22
- package/dist/node_modules/lodash-es/toString.js +0 -7
- package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +0 -2
- package/dist/src/config/compiler/itemsCompilerRules.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
- package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -44
- package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
- package/dist/src/utils/environmentUtil.d.ts +0 -5
- package/dist/src/utils/pairProductVariables.d.ts +0 -7
- package/dist/utils/environmentUtil.js +0 -4
- package/dist/utils/pairProductVariables.js +0 -136
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { CommonControl as R } from "../../common-control.js";
|
|
6
|
-
import { ItemsBlockId as s } from "../enums/controlEnums.js";
|
|
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 = {
|
|
1
|
+
import { UIElementType as a, UEAttr as l, ModificationDescription as o } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as s } from "../../common-control.js";
|
|
3
|
+
import { ItemsBlockId as r } from "../enums/controlEnums.js";
|
|
4
|
+
const d = "ui-elements-items-card-composition-block", i = {
|
|
12
5
|
PRODUCT_IMAGE: "image",
|
|
13
6
|
PRODUCT_NAME: "name",
|
|
14
7
|
PRODUCT_QUANTITY: "quantity",
|
|
@@ -16,21 +9,9 @@ const h = "ui-elements-items-card-composition-block", i = {
|
|
|
16
9
|
PRODUCT_ORIGINAL_PRICE: "originalPrice",
|
|
17
10
|
PRODUCT_BUTTON: "button"
|
|
18
11
|
};
|
|
19
|
-
class g extends
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
_(this, "store", O());
|
|
23
|
-
_(this, "visibilityState", {
|
|
24
|
-
[i.PRODUCT_IMAGE]: !0,
|
|
25
|
-
[i.PRODUCT_NAME]: !0,
|
|
26
|
-
[i.PRODUCT_QUANTITY]: !0,
|
|
27
|
-
[i.PRODUCT_PRICE]: !0,
|
|
28
|
-
[i.PRODUCT_ORIGINAL_PRICE]: !0,
|
|
29
|
-
[i.PRODUCT_BUTTON]: !0
|
|
30
|
-
});
|
|
31
|
-
}
|
|
12
|
+
class g extends s {
|
|
32
13
|
getId() {
|
|
33
|
-
return
|
|
14
|
+
return d;
|
|
34
15
|
}
|
|
35
16
|
getTemplate() {
|
|
36
17
|
return `
|
|
@@ -42,152 +23,77 @@ class g extends R {
|
|
|
42
23
|
{ name: i.PRODUCT_PRICE, label: "Product Price" },
|
|
43
24
|
{ name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
|
|
44
25
|
{ name: i.PRODUCT_BUTTON, label: "Product Button" }
|
|
45
|
-
].map((
|
|
26
|
+
].map((t) => this._getToggleContainer(t)).join("")}
|
|
46
27
|
</div>
|
|
47
28
|
`;
|
|
48
29
|
}
|
|
49
30
|
onRender() {
|
|
50
|
-
this.
|
|
31
|
+
this._initializeToggles(), this._listenToFormUpdates();
|
|
51
32
|
}
|
|
52
|
-
|
|
53
|
-
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
54
|
-
() => {
|
|
55
|
-
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._applyVisibilityStyles();
|
|
56
|
-
},
|
|
57
|
-
() => {
|
|
58
|
-
this._updateTogglesFromState();
|
|
59
|
-
}
|
|
60
|
-
);
|
|
33
|
+
onDestroy() {
|
|
61
34
|
}
|
|
62
|
-
_getToggleContainer({ name:
|
|
35
|
+
_getToggleContainer({ name: e, label: t }) {
|
|
63
36
|
return `
|
|
64
|
-
<div class="container"
|
|
37
|
+
<div class="container">
|
|
65
38
|
<div class="display-flex align-items-center justify-content-between">
|
|
66
|
-
${
|
|
67
|
-
${this._GuToggle(
|
|
39
|
+
<${a.LABEL} ${l.LABEL.text}="${t}"></${a.LABEL}>
|
|
40
|
+
${this._GuToggle(e)}
|
|
68
41
|
</div>
|
|
69
42
|
</div>
|
|
70
43
|
`;
|
|
71
44
|
}
|
|
72
45
|
_initializeToggles() {
|
|
73
|
-
this._updateTogglesFromState();
|
|
74
|
-
}
|
|
75
|
-
_updateTogglesFromState() {
|
|
76
46
|
this.api.updateValues({
|
|
77
|
-
[i.PRODUCT_IMAGE]:
|
|
78
|
-
[i.PRODUCT_NAME]:
|
|
79
|
-
[i.PRODUCT_QUANTITY]:
|
|
80
|
-
[i.PRODUCT_PRICE]:
|
|
81
|
-
[i.PRODUCT_ORIGINAL_PRICE]:
|
|
82
|
-
[i.PRODUCT_BUTTON]:
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
_syncVisibilityFromAttributes() {
|
|
86
|
-
const t = P(this.currentNode);
|
|
87
|
-
if (!t)
|
|
88
|
-
return;
|
|
89
|
-
const e = {
|
|
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"
|
|
96
|
-
};
|
|
97
|
-
Object.entries(e).forEach(([o, r]) => {
|
|
98
|
-
const T = t.getAttribute(C[r]);
|
|
99
|
-
this.visibilityState[o] = U(T, !0);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* If itemsType is not BROWSED_ITEMS, show quantity
|
|
104
|
-
* If itemsType is BROWSED_ITEMS, hide quantity
|
|
105
|
-
* and mark it as '0'
|
|
106
|
-
*/
|
|
107
|
-
_handleBrowsedItemsQuantity() {
|
|
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");
|
|
110
|
-
if (!e)
|
|
111
|
-
return;
|
|
112
|
-
const o = e.getAttribute(C.PRODUCT_QUANTITY_VISIBLE) === "1";
|
|
113
|
-
this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
|
|
114
|
-
}
|
|
115
|
-
_applyVisibilityStyles() {
|
|
116
|
-
const t = {
|
|
117
|
-
[i.PRODUCT_IMAGE]: s.IMAGE,
|
|
118
|
-
[i.PRODUCT_NAME]: s.NAME,
|
|
119
|
-
[i.PRODUCT_QUANTITY]: s.QUANTITY,
|
|
120
|
-
[i.PRODUCT_PRICE]: s.PRICE,
|
|
121
|
-
[i.PRODUCT_ORIGINAL_PRICE]: s.ORIGINAL_PRICE,
|
|
122
|
-
[i.PRODUCT_BUTTON]: s.BUTTON
|
|
123
|
-
};
|
|
124
|
-
Object.entries(t).forEach(([e, o]) => {
|
|
125
|
-
var d;
|
|
126
|
-
const r = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
|
|
127
|
-
if (!r)
|
|
128
|
-
return;
|
|
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`));
|
|
47
|
+
[i.PRODUCT_IMAGE]: !0,
|
|
48
|
+
[i.PRODUCT_NAME]: !0,
|
|
49
|
+
[i.PRODUCT_QUANTITY]: !0,
|
|
50
|
+
[i.PRODUCT_PRICE]: !0,
|
|
51
|
+
[i.PRODUCT_ORIGINAL_PRICE]: !0,
|
|
52
|
+
[i.PRODUCT_BUTTON]: !0
|
|
131
53
|
});
|
|
132
54
|
}
|
|
133
|
-
_updateVisibilityAttribute(t, e) {
|
|
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"
|
|
144
|
-
}[t];
|
|
145
|
-
T && this.api.getDocumentModifier().modifyHtml(o).setAttribute(C[T], e ? "1" : "0").apply(new l(`Updated ${t} visibility attribute`));
|
|
146
|
-
}
|
|
147
55
|
_listenToFormUpdates() {
|
|
148
|
-
this.api.onValueChanged(i.PRODUCT_IMAGE, (
|
|
56
|
+
this.api.onValueChanged(i.PRODUCT_IMAGE, (e) => this._onProductImageChange(e)), this.api.onValueChanged(i.PRODUCT_NAME, (e) => this._onProductNameChange(e)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (e) => this._onProductQuantityChange(e)), this.api.onValueChanged(i.PRODUCT_PRICE, (e) => this._onProductPriceChange(e)), this.api.onValueChanged(
|
|
149
57
|
i.PRODUCT_ORIGINAL_PRICE,
|
|
150
|
-
(
|
|
151
|
-
), this.api.onValueChanged(i.PRODUCT_BUTTON, (
|
|
152
|
-
}
|
|
153
|
-
_onProductImageChange(
|
|
154
|
-
var
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
_onProductNameChange(
|
|
159
|
-
var
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
_onProductQuantityChange(
|
|
164
|
-
var
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
`Product quantity visibility changed to ${
|
|
168
|
-
))
|
|
169
|
-
}
|
|
170
|
-
_onProductPriceChange(
|
|
171
|
-
var
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
_onProductOriginalPriceChange(
|
|
176
|
-
var
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
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 l(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
|
|
58
|
+
(e) => this._onProductOriginalPriceChange(e)
|
|
59
|
+
), this.api.onValueChanged(i.PRODUCT_BUTTON, (e) => this._onProductButtonChange(e));
|
|
60
|
+
}
|
|
61
|
+
_onProductImageChange(e) {
|
|
62
|
+
var n;
|
|
63
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.IMAGE}"]`);
|
|
64
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product image visibility changed to ${e ? "visible" : "hidden"}`));
|
|
65
|
+
}
|
|
66
|
+
_onProductNameChange(e) {
|
|
67
|
+
var n;
|
|
68
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.NAME}"]`);
|
|
69
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product name visibility changed to ${e ? "visible" : "hidden"}`));
|
|
70
|
+
}
|
|
71
|
+
_onProductQuantityChange(e) {
|
|
72
|
+
var n;
|
|
73
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.QUANTITY}"]`);
|
|
74
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
|
|
75
|
+
`Product quantity visibility changed to ${e ? "visible" : "hidden"}`
|
|
76
|
+
));
|
|
77
|
+
}
|
|
78
|
+
_onProductPriceChange(e) {
|
|
79
|
+
var n;
|
|
80
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.PRICE}"]`);
|
|
81
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product price visibility changed to ${e ? "visible" : "hidden"}`));
|
|
82
|
+
}
|
|
83
|
+
_onProductOriginalPriceChange(e) {
|
|
84
|
+
var n;
|
|
85
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.ORIGINAL_PRICE}"]`);
|
|
86
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
|
|
87
|
+
`Product original price visibility changed to ${e ? "visible" : "hidden"}`
|
|
88
|
+
));
|
|
89
|
+
}
|
|
90
|
+
_onProductButtonChange(e) {
|
|
91
|
+
var n;
|
|
92
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.BUTTON}"]`);
|
|
93
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product button visibility changed to ${e ? "visible" : "hidden"}`));
|
|
188
94
|
}
|
|
189
95
|
}
|
|
190
96
|
export {
|
|
191
|
-
|
|
97
|
+
d as COMPOSITION_CONTROL_BLOCK_ID,
|
|
192
98
|
g as ItemsBlockCardCompositionControl
|
|
193
99
|
};
|
|
@@ -1,68 +1,60 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var r = (n, t, e) => t in n ? a(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var s = (n, t, e) => r(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { CommonControl as m } from "../../../common-control.js";
|
|
5
|
-
import { ItemsBlockControlId as
|
|
6
|
-
import { useItemsBlockStore as
|
|
7
|
-
|
|
8
|
-
import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
|
|
9
|
-
const s = d.IMAGE_LINK, n = {
|
|
5
|
+
import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
|
|
6
|
+
import { useItemsBlockStore as L } from "../../store/items-block.js";
|
|
7
|
+
const i = l.IMAGE_LINK, o = {
|
|
10
8
|
LINK: "link"
|
|
11
9
|
};
|
|
12
|
-
class
|
|
10
|
+
class u extends m {
|
|
13
11
|
constructor() {
|
|
14
12
|
super(...arguments);
|
|
15
|
-
|
|
13
|
+
s(this, "store", L());
|
|
16
14
|
}
|
|
17
15
|
getId() {
|
|
18
|
-
return
|
|
16
|
+
return i;
|
|
19
17
|
}
|
|
20
18
|
getTemplate() {
|
|
21
19
|
return `
|
|
22
|
-
<div class="${
|
|
20
|
+
<div class="${i}">
|
|
23
21
|
${this._getLink()}
|
|
24
22
|
</div>
|
|
25
23
|
`;
|
|
26
24
|
}
|
|
27
25
|
onRender() {
|
|
28
26
|
this.api.updateValues({
|
|
29
|
-
[
|
|
27
|
+
[o.LINK]: this.store.imageLink
|
|
30
28
|
}), this._listenToFormUpdates();
|
|
31
29
|
}
|
|
32
30
|
onTemplateNodeUpdated(e) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.api.updateValues({
|
|
37
|
-
[n.LINK]: this.store.imageLink
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
);
|
|
31
|
+
this.currentNode = e, this.api.updateValues({
|
|
32
|
+
[o.LINK]: this.store.imageLink
|
|
33
|
+
});
|
|
41
34
|
}
|
|
42
35
|
_listenToFormUpdates() {
|
|
43
36
|
this.api.onValueChanged(
|
|
44
|
-
|
|
37
|
+
o.LINK,
|
|
45
38
|
(e) => this._onLinkChange(e)
|
|
46
39
|
);
|
|
47
40
|
}
|
|
48
41
|
_onLinkChange(e) {
|
|
49
|
-
console.debug("Image link changed to: ", e), this.store.setImageLink(e)
|
|
42
|
+
console.debug("Image link changed to: ", e), this.store.setImageLink(e);
|
|
50
43
|
}
|
|
51
44
|
_getLink() {
|
|
52
45
|
return `
|
|
53
46
|
${this._GuOneColumn([
|
|
54
47
|
this._GuLabel({ text: "Link" }),
|
|
55
48
|
this._GuTextInput({
|
|
56
|
-
name:
|
|
49
|
+
name: o.LINK,
|
|
57
50
|
placeholder: "Enter Link",
|
|
58
|
-
className: "es-100"
|
|
59
|
-
disabled: !0
|
|
51
|
+
className: "es-100"
|
|
60
52
|
})
|
|
61
53
|
])}
|
|
62
54
|
`;
|
|
63
55
|
}
|
|
64
56
|
}
|
|
65
57
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
i as CONTROL_BLOCK_ID,
|
|
59
|
+
u as ImageLinkControl
|
|
68
60
|
};
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var s = (i, t, e) =>
|
|
4
|
-
import { ModificationDescription as n, UIElementType as
|
|
2
|
+
var g = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var s = (i, t, e) => g(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as n, UIElementType as l, UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
-
import { ItemsBlockControlId as
|
|
6
|
+
import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
|
|
7
7
|
import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
|
|
8
|
-
import { useItemsBlockStore as
|
|
9
|
-
|
|
10
|
-
import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
|
|
11
|
-
const f = l.NAME_TRIMMING, r = {
|
|
8
|
+
import { useItemsBlockStore as y } from "../../store/items-block.js";
|
|
9
|
+
const M = a.NAME_TRIMMING, r = {
|
|
12
10
|
TRIMMING: "trimming"
|
|
13
11
|
};
|
|
14
|
-
class
|
|
12
|
+
class x extends c {
|
|
15
13
|
constructor() {
|
|
16
14
|
super(...arguments);
|
|
17
|
-
s(this, "store",
|
|
15
|
+
s(this, "store", y());
|
|
18
16
|
}
|
|
19
17
|
getId() {
|
|
20
|
-
return
|
|
18
|
+
return M;
|
|
21
19
|
}
|
|
22
20
|
getTemplate() {
|
|
23
21
|
return `
|
|
24
|
-
<div class="${
|
|
22
|
+
<div class="${a.NAME_TRIMMING}">
|
|
25
23
|
${this._getTextTrimming()}
|
|
26
24
|
</div>
|
|
27
25
|
`;
|
|
@@ -32,32 +30,27 @@ class R extends c {
|
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
32
|
onTemplateNodeUpdated(e) {
|
|
35
|
-
|
|
36
|
-
() => y(this.currentNode),
|
|
37
|
-
() => {
|
|
38
|
-
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
|
|
39
|
-
}
|
|
40
|
-
), this.store.nameTrimming && this._applyTrimmingStyles();
|
|
33
|
+
this.currentNode = e, this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.store.nameTrimming && this._applyTrimmingStyles();
|
|
41
34
|
}
|
|
42
35
|
_onTrimmingChange(e) {
|
|
43
|
-
this.store.setNameTrimming(e),
|
|
36
|
+
this.store.setNameTrimming(e), this._applyTrimmingStyles(e);
|
|
44
37
|
}
|
|
45
38
|
_applyTrimmingStyles(e) {
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
39
|
+
var o;
|
|
40
|
+
const m = (o = this.currentNode) == null ? void 0 : o.querySelector("p");
|
|
41
|
+
if (!m)
|
|
49
42
|
return;
|
|
50
|
-
const
|
|
51
|
-
|
|
43
|
+
const T = e !== void 0 ? e : this.store.nameTrimming, p = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
44
|
+
T ? this.api.getDocumentModifier().modifyHtml(m).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", p ? "130px" : "100%").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(m).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
|
|
52
45
|
}
|
|
53
46
|
_getTextTrimming() {
|
|
54
47
|
return `
|
|
55
48
|
<div class="container">
|
|
56
49
|
<div class="display-flex align-items-center justify-content-between">
|
|
57
|
-
<${
|
|
58
|
-
${
|
|
50
|
+
<${l.LABEL}
|
|
51
|
+
${h.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
59
52
|
>
|
|
60
|
-
</${
|
|
53
|
+
</${l.LABEL}>
|
|
61
54
|
${this._GuToggle(r.TRIMMING)}
|
|
62
55
|
</div>
|
|
63
56
|
</div>
|
|
@@ -65,6 +58,6 @@ class R extends c {
|
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
M as CONTROL_BLOCK_ID,
|
|
62
|
+
x as NameTrimmingControl
|
|
70
63
|
};
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var y = (s, o, e) => o in s ? R(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e;
|
|
3
|
+
var p = (s, o, e) => y(s, 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 I, ModificationDescription as N } 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
8
|
import { useItemsBlockStore as E } from "../../store/items-block.js";
|
|
9
|
-
|
|
10
|
-
import { updateConfigBlockAttributes as O } from "../../utils/updateAttributes.js";
|
|
11
|
-
const b = h.PRICE_CURRENCY_LOCATION, a = {
|
|
9
|
+
const O = h.PRICE_CURRENCY_LOCATION, a = {
|
|
12
10
|
CURRENCY_LOCATION: "currencyLocation"
|
|
13
11
|
};
|
|
14
|
-
class
|
|
12
|
+
class S extends T {
|
|
15
13
|
constructor() {
|
|
16
14
|
super(...arguments);
|
|
17
15
|
p(this, "store", E());
|
|
18
16
|
}
|
|
19
17
|
getId() {
|
|
20
|
-
return
|
|
18
|
+
return O;
|
|
21
19
|
}
|
|
22
20
|
getTemplate() {
|
|
23
21
|
return `
|
|
@@ -27,31 +25,26 @@ class Y extends T {
|
|
|
27
25
|
`;
|
|
28
26
|
}
|
|
29
27
|
onRender() {
|
|
30
|
-
this.api.setUIEAttribute(a.CURRENCY_LOCATION,
|
|
28
|
+
this.api.setUIEAttribute(a.CURRENCY_LOCATION, I.SELECTPICKER.items, m), this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation }), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
|
|
31
29
|
this._onCurrencyLocationChange(e);
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
32
|
onTemplateNodeUpdated(e) {
|
|
35
|
-
|
|
36
|
-
() => f(this.currentNode),
|
|
37
|
-
() => {
|
|
38
|
-
this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
|
|
39
|
-
}
|
|
40
|
-
);
|
|
33
|
+
this.currentNode = e, this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
|
|
41
34
|
}
|
|
42
35
|
_onCurrencyLocationChange(e) {
|
|
43
|
-
if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e),
|
|
36
|
+
if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), !this.currentNode)
|
|
44
37
|
return;
|
|
45
38
|
const t = this._getPriceBlocks();
|
|
46
39
|
if (!t || t.length === 0)
|
|
47
40
|
return;
|
|
48
41
|
const r = e || "0", { currencySymbol: n } = this.store;
|
|
49
42
|
t.forEach((c) => {
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
43
|
+
const i = this._getParagraph(c);
|
|
44
|
+
if (!i)
|
|
52
45
|
return;
|
|
53
|
-
const
|
|
54
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
46
|
+
const C = i.getInnerHTML() || "", l = i.getInnerText() || "", u = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(l, u), _ = this._detectSymbolInText(l) || u, g = this._buildPriceContent(d, _, r), L = C.replace(l, g);
|
|
47
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(L).apply(new N(
|
|
55
48
|
`Updated currency location to ${r === "1" ? "after" : "before"}`
|
|
56
49
|
));
|
|
57
50
|
});
|
|
@@ -75,8 +68,8 @@ class Y extends T {
|
|
|
75
68
|
} else {
|
|
76
69
|
const c = r.match(/([^0-9.,\s]+)/);
|
|
77
70
|
if (c && c[1]) {
|
|
78
|
-
const
|
|
79
|
-
n = r.replace(
|
|
71
|
+
const i = c[1].trim(), C = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
|
|
72
|
+
n = r.replace(C, "").trim();
|
|
80
73
|
}
|
|
81
74
|
}
|
|
82
75
|
return n;
|
|
@@ -102,6 +95,6 @@ class Y extends T {
|
|
|
102
95
|
}
|
|
103
96
|
}
|
|
104
97
|
export {
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
O as CONTROL_BLOCK_ID,
|
|
99
|
+
S as PriceCurrencyLocationControl
|
|
107
100
|
};
|
|
@@ -3,14 +3,12 @@ var _ = (c, s, e) => s in c ? S(c, s, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var u = (c, s, e) => _(c, typeof s != "symbol" ? s + "" : s, e);
|
|
4
4
|
import { ModificationDescription as b } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as R } from "../../../common-control.js";
|
|
6
|
-
import { ItemsBlockControlId as
|
|
6
|
+
import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
|
|
7
7
|
import { useItemsBlockStore as f } from "../../store/items-block.js";
|
|
8
|
-
|
|
9
|
-
import { updateConfigBlockAttributes as B } from "../../utils/updateAttributes.js";
|
|
10
|
-
const E = h.PRICE_CURRENCY_SYMBOL, m = {
|
|
8
|
+
const E = p.PRICE_CURRENCY_SYMBOL, m = {
|
|
11
9
|
CURRENCY_SYMBOL: "currencySymbol"
|
|
12
10
|
};
|
|
13
|
-
class
|
|
11
|
+
class M extends R {
|
|
14
12
|
constructor() {
|
|
15
13
|
super(...arguments);
|
|
16
14
|
u(this, "store", f());
|
|
@@ -21,7 +19,7 @@ class P extends R {
|
|
|
21
19
|
}
|
|
22
20
|
getTemplate() {
|
|
23
21
|
return `
|
|
24
|
-
<div class="${
|
|
22
|
+
<div class="${p.PRICE_CURRENCY_SYMBOL}">
|
|
25
23
|
${this._getCurrencySymbol()}
|
|
26
24
|
</div>
|
|
27
25
|
`;
|
|
@@ -31,22 +29,14 @@ class P extends R {
|
|
|
31
29
|
this._onCurrencySymbolChange(e);
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
|
-
onDestroy() {
|
|
35
|
-
super.onDestroy(), this.originalPriceContents.clear();
|
|
36
|
-
}
|
|
37
32
|
onTemplateNodeUpdated(e) {
|
|
38
|
-
|
|
39
|
-
() => N(this.currentNode),
|
|
40
|
-
() => {
|
|
41
|
-
this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents();
|
|
42
|
-
}
|
|
43
|
-
);
|
|
33
|
+
this.currentNode = e, this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents();
|
|
44
34
|
}
|
|
45
35
|
_onCurrencySymbolChange(e) {
|
|
46
36
|
var i;
|
|
47
37
|
console.debug("Currency symbol changed to: ", e);
|
|
48
38
|
const r = ((i = this.store.currencySymbol) == null ? void 0 : i.trim()) || "";
|
|
49
|
-
if (this.store.setCurrencySymbol(e),
|
|
39
|
+
if (this.store.setCurrencySymbol(e), !this.currentNode)
|
|
50
40
|
return;
|
|
51
41
|
const t = this._getPriceBlocks();
|
|
52
42
|
if (!t || t.length === 0)
|
|
@@ -56,7 +46,7 @@ class P extends R {
|
|
|
56
46
|
const a = this._getParagraph(l);
|
|
57
47
|
if (!a)
|
|
58
48
|
return;
|
|
59
|
-
const
|
|
49
|
+
const C = a.getInnerHTML() || "", h = a.getInnerText() || "", y = this._removeCurrencySymbol(h, r), g = this._buildPriceContent(y, o, n), d = C.replace(h, g);
|
|
60
50
|
this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(d).apply(new b(
|
|
61
51
|
`Updated currency symbol to ${o || "removed"}`
|
|
62
52
|
));
|
|
@@ -119,5 +109,5 @@ class P extends R {
|
|
|
119
109
|
}
|
|
120
110
|
export {
|
|
121
111
|
E as CONTROL_BLOCK_ID,
|
|
122
|
-
|
|
112
|
+
M as PriceCurrencySymbolControl
|
|
123
113
|
};
|