@useinsider/guido 3.2.0-beta.e69fb3b → 3.2.0-beta.ecc7c6c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +1 -1
- package/dist/@types/config/validator.js +34 -27
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +81 -76
- package/dist/components/organisms/base/Toaster.vue2.js +11 -10
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -12
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +6 -6
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +15 -9
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +40 -31
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +20 -19
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +14 -11
- package/dist/components/organisms/header/EditorActions.vue.js +12 -11
- package/dist/components/organisms/header/EditorActions.vue2.js +22 -18
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -12
- package/dist/components/organisms/header/LeftSlot.vue2.js +19 -16
- package/dist/components/organisms/header/MiddleSlot.vue2.js +11 -14
- package/dist/components/organisms/header/RightSlot.vue2.js +17 -14
- package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +26 -24
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +44 -41
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +38 -36
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +21 -18
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +31 -27
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +32 -30
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +23 -21
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +9 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -9
- package/dist/composables/useActionsApi.js +38 -37
- package/dist/composables/useBlocksConfig.js +26 -26
- package/dist/composables/useFullStoryBridge.js +9 -8
- package/dist/composables/useHtmlCompiler.js +26 -34
- package/dist/composables/useHtmlValidator.js +114 -101
- package/dist/composables/useHttp.js +30 -30
- package/dist/composables/usePartner.js +1 -1
- package/dist/composables/useRecommendation.js +15 -14
- package/dist/composables/useRibbonOffset.js +15 -15
- package/dist/composables/useSave.js +23 -19
- package/dist/composables/useStripo.js +48 -53
- package/dist/composables/useSyncModuleExtractor.js +29 -31
- package/dist/composables/useTimerClone.js +25 -24
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useValidation.js +8 -7
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/composables/validators/useLiquidValidator.js +13 -13
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/compiler/unsubscribeCompilerRules.js +19 -17
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +11 -10
- package/dist/config/migrator/checkboxMigrator.js +21 -20
- package/dist/config/migrator/couponBlockMigrator.js +19 -18
- package/dist/config/migrator/itemsBlockMigrator.js +89 -87
- package/dist/config/migrator/radioButtonMigrator.js +63 -42
- package/dist/config/migrator/recommendationMigrator.js +109 -106
- package/dist/config/migrator/unsubscribeMigrator.js +11 -10
- package/dist/enums/unsubscribe.js +19 -18
- package/dist/extensions/Blocks/Items/block.js +9 -9
- package/dist/extensions/Blocks/Items/controls/button/link.js +14 -14
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +97 -89
- package/dist/extensions/Blocks/Items/controls/image/link.js +14 -14
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +24 -23
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +14 -13
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +47 -44
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +38 -38
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +11 -11
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +40 -38
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +35 -35
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +162 -155
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/template.js +210 -210
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +36 -36
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +133 -128
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +18 -17
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +6 -4
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +90 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +18 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +36 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +135 -134
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +32 -32
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +20 -18
- package/dist/extensions/Blocks/Recommendation/extension.js +32 -31
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +16 -8
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +64 -54
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +23 -22
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +10 -10
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +10 -10
- package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -6
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -24
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +47 -45
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +16 -13
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
- package/dist/extensions/Blocks/Unsubscribe/control.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +18 -16
- package/dist/extensions/Blocks/common-control.js +26 -25
- package/dist/extensions/DynamicContent/dynamic-content.js +58 -53
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +234 -233
- package/dist/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/lodash-es/_SetCache.js +13 -0
- package/dist/node_modules/lodash-es/_Stack.js +18 -0
- package/dist/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +20 -0
- package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
- package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
- package/dist/node_modules/lodash-es/_arraySome.js +9 -0
- package/dist/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
- package/dist/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/lodash-es/_baseGet.js +11 -0
- package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
- package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
- package/dist/node_modules/lodash-es/_baseIsTypedArray.js +12 -0
- package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
- package/dist/node_modules/lodash-es/_baseMap.js +11 -0
- package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/lodash-es/_baseRange.js +9 -0
- package/dist/node_modules/lodash-es/_baseTimes.js +8 -0
- package/dist/node_modules/lodash-es/_baseToString.js +18 -0
- package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
- package/dist/node_modules/lodash-es/_createBaseFor.js +13 -0
- package/dist/node_modules/lodash-es/_createRange.js +11 -0
- package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
- package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
- package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
- package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
- package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/lodash-es/_getTag.js +28 -0
- package/dist/node_modules/lodash-es/_getValue.js +1 -1
- package/dist/node_modules/lodash-es/_hasPath.js +19 -0
- package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
- package/dist/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/lodash-es/_isIterateeCall.js +13 -0
- package/dist/node_modules/lodash-es/_isKey.js +12 -0
- package/dist/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/lodash-es/_nodeUtil.js +11 -0
- package/dist/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/lodash-es/_stackSet.js +17 -0
- package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
- package/dist/node_modules/lodash-es/flatMap.js +8 -0
- package/dist/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/lodash-es/map.js +11 -0
- package/dist/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/lodash-es/range.js +5 -0
- package/dist/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/lodash-es/toFinite.js +14 -0
- package/dist/node_modules/lodash-es/toNumber.js +22 -0
- package/dist/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/valibot/dist/index.js +126 -122
- package/dist/services/recommendationApi.js +17 -14
- package/dist/services/templateLibraryApi.js +40 -38
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useHtmlCompiler.d.ts +2 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/stores/config.js +81 -25
- package/dist/stores/dynamic-content.js +11 -6
- package/dist/stores/onboarding.js +1 -1
- package/dist/stores/preview.js +9 -6
- package/dist/stores/unsubscribe.js +4 -1
- package/dist/utils/dateUtil.js +10 -7
- package/dist/utils/genericUtil.js +13 -10
- package/dist/utils/pairProductVariables.js +89 -87
- package/package.json +1 -6
- package/dist/enums/displayConditions.js +0 -80
- package/dist/src/enums/displayConditions.d.ts +0 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
1
|
+
import { ModificationDescription as N, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as U } from "../../common-control.js";
|
|
3
3
|
import { ItemsBlockId as I } from "../enums/controlEnums.js";
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { SETTINGS_ENUMS as d, ItemTypeOptions as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getDefaultTemplate as
|
|
9
|
-
import { getItemsBlockConfig as
|
|
10
|
-
const
|
|
4
|
+
import { productPairs as y, templateFirstLine as b } from "../enums/productEnums.js";
|
|
5
|
+
import { SETTINGS_ENUMS as d, ItemTypeOptions as D, OrientationOptions as k, ItemInCartOptions as g, DefaultConfigValues as x } from "../enums/settingsEnums.js";
|
|
6
|
+
import F from "../layouts/horizontal.html.js";
|
|
7
|
+
import $ from "../layouts/vertical.html.js";
|
|
8
|
+
import { getDefaultTemplate as q } from "../template.js";
|
|
9
|
+
import { getItemsBlockConfig as _, setItemsBlockConfig as O, escapeReplacement as A } from "../utils/nodeConfigUtils.js";
|
|
10
|
+
const w = "ui-elements-items-block", m = {
|
|
11
11
|
ITEMS_TYPE: "itemsType",
|
|
12
12
|
ORIENTATION: "orientation",
|
|
13
13
|
ITEM_IDS: "itemIds"
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class Z extends U {
|
|
16
16
|
getId() {
|
|
17
|
-
return
|
|
17
|
+
return w;
|
|
18
18
|
}
|
|
19
19
|
getTemplate() {
|
|
20
20
|
return `
|
|
@@ -26,20 +26,20 @@ class Q extends M {
|
|
|
26
26
|
`;
|
|
27
27
|
}
|
|
28
28
|
onRender() {
|
|
29
|
-
const e =
|
|
29
|
+
const e = _(this.currentNode);
|
|
30
30
|
this.api.updateValues({
|
|
31
|
-
[m.ORIENTATION]: e
|
|
32
|
-
[m.ITEMS_TYPE]: e
|
|
33
|
-
[m.ITEM_IDS]: e
|
|
31
|
+
[m.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL,
|
|
32
|
+
[m.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS,
|
|
33
|
+
[m.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
|
|
34
34
|
}), this._listenToFormUpdates();
|
|
35
35
|
}
|
|
36
36
|
onTemplateNodeUpdated(e) {
|
|
37
37
|
super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(() => {
|
|
38
|
-
const
|
|
38
|
+
const r = _(this.currentNode);
|
|
39
39
|
this.api.updateValues({
|
|
40
|
-
[m.ORIENTATION]:
|
|
41
|
-
[m.ITEMS_TYPE]:
|
|
42
|
-
[m.ITEM_IDS]:
|
|
40
|
+
[m.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? d.ORIENTATION.VERTICAL,
|
|
41
|
+
[m.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? d.ITEMS_TYPE.CART_ITEMS,
|
|
42
|
+
[m.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
|
|
43
43
|
}), this._initializeSelectItems();
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -51,7 +51,7 @@ class Q extends M {
|
|
|
51
51
|
name: m.ITEMS_TYPE,
|
|
52
52
|
className: "es-100",
|
|
53
53
|
placeholder: "Select Item Type",
|
|
54
|
-
options:
|
|
54
|
+
options: D
|
|
55
55
|
})
|
|
56
56
|
])}
|
|
57
57
|
`;
|
|
@@ -62,7 +62,7 @@ class Q extends M {
|
|
|
62
62
|
this._GuLabel({ text: "Orientation" }),
|
|
63
63
|
this._GuRadioButton({
|
|
64
64
|
name: m.ORIENTATION,
|
|
65
|
-
buttons:
|
|
65
|
+
buttons: k
|
|
66
66
|
})
|
|
67
67
|
])}
|
|
68
68
|
`;
|
|
@@ -82,57 +82,57 @@ class Q extends M {
|
|
|
82
82
|
}
|
|
83
83
|
_onOrientationChange(e) {
|
|
84
84
|
this.api.updateValues({ [m.ORIENTATION]: e });
|
|
85
|
-
const
|
|
86
|
-
|
|
85
|
+
const r = this.api.getDocumentModifier();
|
|
86
|
+
O(this.currentNode, this.api, {
|
|
87
87
|
orientation: e,
|
|
88
88
|
priceOrientation: "horizontal"
|
|
89
|
-
},
|
|
89
|
+
}, r), r.apply(new N("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
|
|
90
90
|
this._recalculateTrimming();
|
|
91
91
|
}, 50);
|
|
92
92
|
}
|
|
93
93
|
_onItemsTypeChange(e) {
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
94
|
+
const r = d.ITEMS_TYPE[e], t = g[e], i = t == null ? void 0 : t[0];
|
|
95
|
+
if (!r || !i)
|
|
96
96
|
return;
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
source:
|
|
100
|
-
type:
|
|
101
|
-
itemsSelectValue:
|
|
102
|
-
imageLink:
|
|
103
|
-
buttonLink:
|
|
104
|
-
},
|
|
105
|
-
const
|
|
106
|
-
this._updateImageSrc(
|
|
97
|
+
const n = i.value, s = i.value.replace("Url}}", "Image}}"), o = this.api.getDocumentModifier();
|
|
98
|
+
O(this.currentNode, this.api, {
|
|
99
|
+
source: r,
|
|
100
|
+
type: r,
|
|
101
|
+
itemsSelectValue: i.value,
|
|
102
|
+
imageLink: s,
|
|
103
|
+
buttonLink: n
|
|
104
|
+
}, o), this._updateDataTypeAttributes(r, o), this._initializeSelectItems();
|
|
105
|
+
const l = this._getTemplateData(r, i.value);
|
|
106
|
+
this._updateImageSrc(l.imageSrc, o), this._updateName(l.name, o), this._updatePrice(l.price, o), this._updateOriginalPrice(l.originalPrice, o), this._updateQuantity(l.quantity, r, o), o.apply(new N("Updated items type"));
|
|
107
107
|
}
|
|
108
108
|
_onItemIdsChange(e) {
|
|
109
109
|
this.api.updateValues({ [m.ITEM_IDS]: e });
|
|
110
|
-
const
|
|
111
|
-
|
|
110
|
+
const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
|
|
111
|
+
O(this.currentNode, this.api, {
|
|
112
112
|
itemsSelectValue: e,
|
|
113
|
-
imageLink:
|
|
114
|
-
buttonLink:
|
|
115
|
-
},
|
|
116
|
-
const
|
|
117
|
-
this._updateImageSrc(
|
|
113
|
+
imageLink: t,
|
|
114
|
+
buttonLink: r
|
|
115
|
+
}, i), this._updateDataNumberAttributes(e, i);
|
|
116
|
+
const n = this._getTemplateData(void 0, e);
|
|
117
|
+
this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new N("Updated item selection"));
|
|
118
118
|
}
|
|
119
119
|
_initializeSelectItems() {
|
|
120
120
|
this.api.setUIEAttribute(
|
|
121
121
|
m.ITEMS_TYPE,
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
L.SELECTPICKER.items,
|
|
123
|
+
D
|
|
124
124
|
);
|
|
125
|
-
const e =
|
|
125
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
|
|
126
126
|
this.api.updateValues({
|
|
127
|
-
[m.ITEMS_TYPE]:
|
|
127
|
+
[m.ITEMS_TYPE]: r
|
|
128
128
|
});
|
|
129
|
-
const
|
|
129
|
+
const i = g[r];
|
|
130
130
|
this.api.setUIEAttribute(
|
|
131
131
|
m.ITEM_IDS,
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
L.SELECTPICKER.items,
|
|
133
|
+
i
|
|
134
134
|
), this.api.updateValues({
|
|
135
|
-
[m.ITEM_IDS]:
|
|
135
|
+
[m.ITEM_IDS]: t
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
_listenToFormUpdates() {
|
|
@@ -148,145 +148,152 @@ class Q extends M {
|
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
_renderTemplate() {
|
|
151
|
-
const e =
|
|
152
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
153
|
-
orientation:
|
|
154
|
-
itemsType:
|
|
155
|
-
itemId:
|
|
156
|
-
currencySymbol:
|
|
157
|
-
currencyLocation:
|
|
158
|
-
formattedPrice:
|
|
159
|
-
})).apply(new
|
|
151
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", o = (e == null ? void 0 : e.priceFormatted) ?? !1;
|
|
152
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
|
|
153
|
+
orientation: r,
|
|
154
|
+
itemsType: t,
|
|
155
|
+
itemId: i,
|
|
156
|
+
currencySymbol: n,
|
|
157
|
+
currencyLocation: s,
|
|
158
|
+
formattedPrice: o
|
|
159
|
+
})).apply(new N("Updated template"));
|
|
160
160
|
}
|
|
161
|
-
_getTemplateData(e,
|
|
162
|
-
const
|
|
161
|
+
_getTemplateData(e, r) {
|
|
162
|
+
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, l = g[i].findIndex((h) => h.value === n), a = l > -1 ? l : 0, c = y.PAIRS_FOR_EXTENSION.price[i], T = y.PAIRS_FOR_EXTENSION.originalPrice[i];
|
|
163
163
|
let u, p;
|
|
164
|
-
return
|
|
165
|
-
imageSrc:
|
|
166
|
-
name:
|
|
164
|
+
return o ? (u = s ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, p = s ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE) : (u = s ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, p = s ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE), {
|
|
165
|
+
imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
|
|
166
|
+
name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
|
|
167
167
|
price: u,
|
|
168
168
|
originalPrice: p,
|
|
169
|
-
quantity:
|
|
170
|
-
button:
|
|
169
|
+
quantity: y.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
|
|
170
|
+
button: y.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
_updateImageSrc(e,
|
|
174
|
-
|
|
175
|
-
i
|
|
173
|
+
_updateImageSrc(e, r) {
|
|
174
|
+
var i;
|
|
175
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${I.IMAGE}"] img`);
|
|
176
|
+
t && r.modifyHtml(t).setAttribute("src", e);
|
|
176
177
|
}
|
|
177
|
-
_updateName(e,
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
_updateName(e, r) {
|
|
179
|
+
var s;
|
|
180
|
+
const t = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
181
|
+
if (!t)
|
|
180
182
|
return;
|
|
181
|
-
const
|
|
182
|
-
let
|
|
183
|
-
|
|
183
|
+
const i = t.getInnerText().trim();
|
|
184
|
+
let n = t.getInnerHTML().trim();
|
|
185
|
+
n = n.replace(i, A(e)), r.modifyHtml(t).setInnerHtml(n);
|
|
184
186
|
}
|
|
185
|
-
_updatePrice(e,
|
|
186
|
-
|
|
187
|
+
_updatePrice(e, r) {
|
|
188
|
+
var o;
|
|
189
|
+
const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
|
|
187
190
|
`[esd-extension-block-id="${I.PRICE}"]`
|
|
188
|
-
) || [],
|
|
189
|
-
|
|
190
|
-
const a = this._getParagraphFromBlock(
|
|
191
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
192
|
+
t.forEach((l) => {
|
|
193
|
+
const a = this._getParagraphFromBlock(l);
|
|
191
194
|
if (!a)
|
|
192
195
|
return;
|
|
193
|
-
const c = a.getInnerHTML().trim() || "",
|
|
194
|
-
|
|
196
|
+
const c = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), S = c.replace(T, A(E));
|
|
197
|
+
r.modifyHtml(a).setInnerHtml(S);
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
|
-
_updateOriginalPrice(e,
|
|
198
|
-
|
|
200
|
+
_updateOriginalPrice(e, r) {
|
|
201
|
+
var o;
|
|
202
|
+
const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
|
|
199
203
|
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
200
|
-
) || [],
|
|
201
|
-
|
|
202
|
-
const a = this._getParagraphFromBlock(
|
|
204
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
205
|
+
t.forEach((l) => {
|
|
206
|
+
const a = this._getParagraphFromBlock(l);
|
|
203
207
|
if (!a)
|
|
204
208
|
return;
|
|
205
209
|
const c = a.querySelector("s");
|
|
206
210
|
if (!c)
|
|
207
211
|
return;
|
|
208
|
-
const
|
|
209
|
-
|
|
212
|
+
const T = c.getInnerHTML().trim() || "", u = c.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, A(S))}</s>`;
|
|
213
|
+
r.modifyHtml(a).setInnerHtml(R);
|
|
210
214
|
});
|
|
211
215
|
}
|
|
212
|
-
_updateQuantity(e,
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
_updateQuantity(e, r, t) {
|
|
217
|
+
var h;
|
|
218
|
+
const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = s && o, a = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
|
|
219
|
+
if (!a)
|
|
215
220
|
return;
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
221
|
+
const c = this._getParagraphFromBlock(a);
|
|
222
|
+
if (!c)
|
|
218
223
|
return;
|
|
219
|
-
const T =
|
|
220
|
-
let u =
|
|
221
|
-
function p(
|
|
222
|
-
return
|
|
223
|
-
new RegExp(`(>\\s*)?${
|
|
224
|
-
`$1${
|
|
224
|
+
const T = c.getInnerText().trim();
|
|
225
|
+
let u = c.getInnerHTML().trim();
|
|
226
|
+
function p(E, S, C) {
|
|
227
|
+
return E.replace(
|
|
228
|
+
new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
|
|
229
|
+
`$1${C}$2`
|
|
225
230
|
);
|
|
226
231
|
}
|
|
227
|
-
u = p(u, T, e),
|
|
232
|
+
u = p(u, T, e), t.modifyHtml(c).setInnerHtml(u), t.modifyHtml(a).setStyle("display", l ? "table-cell" : "none");
|
|
228
233
|
}
|
|
229
234
|
_reOrderTemplate(e) {
|
|
230
|
-
|
|
235
|
+
var h, E, S, C, R, M;
|
|
236
|
+
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
|
|
231
237
|
`[esd-extension-block-id="${I.PRICE}"]`
|
|
232
|
-
) || [],
|
|
238
|
+
)) || [], n = ((C = this.currentNode) == null ? void 0 : C.querySelectorAll(
|
|
233
239
|
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
234
|
-
) || [], [
|
|
235
|
-
if (!
|
|
240
|
+
)) || [], [s] = i, [o] = n, l = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), a = (M = this.currentNode) == null ? void 0 : M.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
|
|
241
|
+
if (!r || !t || !s || !o || !l || !a)
|
|
236
242
|
return;
|
|
237
|
-
const
|
|
238
|
-
let p = u ?
|
|
243
|
+
const c = _(this.currentNode), u = ((c == null ? void 0 : c.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
|
|
244
|
+
let p = u ? $ : F;
|
|
239
245
|
setTimeout(() => {
|
|
240
|
-
const
|
|
241
|
-
p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ?
|
|
242
|
-
const
|
|
243
|
-
|
|
246
|
+
const H = A(s.getOuterHTML()), f = A(o.getOuterHTML());
|
|
247
|
+
p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? b : "").replace("{-{-PRODUCT_IMAGE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", H).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", f).replace("{-{-PRODUCT_QUANTITY-}-}", l.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", a.getOuterHTML()), p = p.trim().replace(b, "").slice(0, -5);
|
|
248
|
+
const P = e ?? this.api.getDocumentModifier();
|
|
249
|
+
P.modifyHtml(r.querySelector("img")).setAttribute("width", x.productImageWidth).setAttribute("height", x.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new N("Reordered template"));
|
|
244
250
|
}, 50);
|
|
245
251
|
}
|
|
246
|
-
_updateDataTypeAttributes(e,
|
|
252
|
+
_updateDataTypeAttributes(e, r) {
|
|
247
253
|
if (!this.currentNode)
|
|
248
254
|
return;
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
255
|
+
const t = this.currentNode.closest(".ins-product-td");
|
|
256
|
+
t && r.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
257
|
+
const s = n;
|
|
258
|
+
r.modifyHtml(s).setAttribute("data-type", e);
|
|
253
259
|
});
|
|
254
260
|
}
|
|
255
|
-
_updateDataNumberAttributes(e,
|
|
261
|
+
_updateDataNumberAttributes(e, r) {
|
|
256
262
|
if (!this.currentNode)
|
|
257
263
|
return;
|
|
258
|
-
const
|
|
259
|
-
let
|
|
260
|
-
if (
|
|
261
|
-
|
|
264
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = g[i].findIndex((a) => a.value === e);
|
|
265
|
+
let s = "1";
|
|
266
|
+
if (n >= 0)
|
|
267
|
+
s = String(n + 1);
|
|
262
268
|
else if (e) {
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
const [,
|
|
266
|
-
|
|
269
|
+
const a = e.match(/\((\d+)\)/);
|
|
270
|
+
if (a) {
|
|
271
|
+
const [, c] = a;
|
|
272
|
+
s = c;
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
|
|
275
|
+
const o = this.currentNode.closest(".ins-product-td");
|
|
276
|
+
o && r.modifyHtml(o).setAttribute("data-number", s), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
|
|
277
|
+
const c = a;
|
|
278
|
+
r.modifyHtml(c).setAttribute("data-number", s);
|
|
273
279
|
});
|
|
274
280
|
}
|
|
275
281
|
_reFillTemplate(e) {
|
|
276
|
-
const
|
|
277
|
-
this._updateImageSrc(
|
|
282
|
+
const r = this._getTemplateData(e), t = this.api.getDocumentModifier();
|
|
283
|
+
this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new N("Refilled template"));
|
|
278
284
|
}
|
|
279
285
|
_recalculateTrimming() {
|
|
286
|
+
var s;
|
|
280
287
|
if (!this.currentNode)
|
|
281
288
|
return;
|
|
282
|
-
const e = this.currentNode
|
|
289
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
283
290
|
if (!e)
|
|
284
291
|
return;
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
292
|
+
const r = e.querySelector("p > a");
|
|
293
|
+
if (!r)
|
|
287
294
|
return;
|
|
288
|
-
const
|
|
289
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
295
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.orientation) === d.ORIENTATION.HORIZONTAL, n = (t == null ? void 0 : t.nameTrimming) ?? !0;
|
|
296
|
+
this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", n ? "nowrap" : "normal").setStyle("text-overflow", n ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new N("Recalculated trimming after orientation change"));
|
|
290
297
|
}
|
|
291
298
|
_getParagraphFromBlock(e) {
|
|
292
299
|
return e.querySelector("p");
|
|
@@ -294,30 +301,30 @@ class Q extends M {
|
|
|
294
301
|
_escapeRegex(e) {
|
|
295
302
|
return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
|
|
296
303
|
}
|
|
297
|
-
_removeCurrencySymbol(e,
|
|
298
|
-
const
|
|
299
|
-
let
|
|
300
|
-
if (
|
|
301
|
-
const
|
|
302
|
-
|
|
304
|
+
_removeCurrencySymbol(e, r) {
|
|
305
|
+
const t = e || "";
|
|
306
|
+
let i = t;
|
|
307
|
+
if (r) {
|
|
308
|
+
const n = new RegExp(`\\s*${this._escapeRegex(r)}\\s*`);
|
|
309
|
+
i = t.replace(n, "").trim();
|
|
303
310
|
} else {
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
307
|
-
|
|
311
|
+
const n = t.match(/([^0-9.,\s]+)/);
|
|
312
|
+
if (n && n[1]) {
|
|
313
|
+
const s = n[1].trim(), o = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
314
|
+
i = t.replace(o, "").trim();
|
|
308
315
|
}
|
|
309
316
|
}
|
|
310
|
-
return
|
|
317
|
+
return i;
|
|
311
318
|
}
|
|
312
|
-
_replacePriceNumber(e,
|
|
313
|
-
const
|
|
314
|
-
return e.replace(
|
|
319
|
+
_replacePriceNumber(e, r) {
|
|
320
|
+
const t = /([0-9][0-9,.]*)/;
|
|
321
|
+
return e.replace(t, r).trim();
|
|
315
322
|
}
|
|
316
|
-
_buildPriceContent(e,
|
|
317
|
-
return
|
|
323
|
+
_buildPriceContent(e, r, t) {
|
|
324
|
+
return r ? t === "1" ? `${e} ${r}` : `${r} ${e}` : e;
|
|
318
325
|
}
|
|
319
326
|
}
|
|
320
327
|
export {
|
|
321
|
-
|
|
322
|
-
|
|
328
|
+
w as CONTROL_BLOCK_ID,
|
|
329
|
+
Z as ItemsBlockControl
|
|
323
330
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import _ from "../../../../node_modules/lodash-es/flatMap.js";
|
|
2
|
+
import E from "../../../../node_modules/lodash-es/range.js";
|
|
3
|
+
const T = '<td align="center" class="ins-product-td items-block items-block-v2">', a = { PAIRS_FOR_EXTENSION: {
|
|
2
4
|
imageSrc: {
|
|
3
5
|
CART_ITEMS: {
|
|
4
6
|
ATTR: "ins_apr_img",
|
|
@@ -209,11 +211,11 @@ const r = '<td align="center" class="ins-product-td items-block items-block-v2">
|
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
213
|
} };
|
|
212
|
-
function
|
|
213
|
-
return
|
|
214
|
+
function m(e, s = 8) {
|
|
215
|
+
return E(1, s + 1).map((i) => `${e}_${i}`);
|
|
214
216
|
}
|
|
215
|
-
function
|
|
216
|
-
const { PAIRS_FOR_EXTENSION: e } =
|
|
217
|
+
function r() {
|
|
218
|
+
const { PAIRS_FOR_EXTENSION: e } = a, s = [];
|
|
217
219
|
return s.push(
|
|
218
220
|
e.imageSrc.CART_ITEMS.ATTR,
|
|
219
221
|
e.imageSrc.BROWSED_ITEMS.ATTR,
|
|
@@ -271,9 +273,12 @@ function a() {
|
|
|
271
273
|
e.itemLink.PURCHASED_ITEMS.HREF
|
|
272
274
|
), s;
|
|
273
275
|
}
|
|
274
|
-
const
|
|
276
|
+
const o = _(
|
|
277
|
+
r(),
|
|
278
|
+
(e) => m(e)
|
|
279
|
+
);
|
|
275
280
|
export {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
281
|
+
o as itemsBlockDynamicVariables,
|
|
282
|
+
a as productPairs,
|
|
283
|
+
T as templateFirstLine
|
|
279
284
|
};
|