@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,15 +1,15 @@
|
|
|
1
1
|
import { ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CommonControl as m } from "../../../common-control.js";
|
|
3
|
-
import {
|
|
4
|
-
import { RecommendationControlId as
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
6
|
-
import {
|
|
3
|
+
import { RecommendationBlockId as n } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as l } from "../../constants/controlIds.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as u, ATTR_PRODUCT_ATTR as a } from "../../constants/selectors.js";
|
|
6
|
+
import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
|
|
7
7
|
const i = {
|
|
8
8
|
TEXT_TRIM_ENABLED: "customAttrTextTrimEnabled"
|
|
9
9
|
};
|
|
10
10
|
class g extends m {
|
|
11
11
|
getId() {
|
|
12
|
-
return
|
|
12
|
+
return l.CUSTOM_ATTR_TEXT_TRIM;
|
|
13
13
|
}
|
|
14
14
|
getTemplate() {
|
|
15
15
|
return `
|
|
@@ -57,17 +57,17 @@ class g extends m {
|
|
|
57
57
|
_getTargetElements() {
|
|
58
58
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
59
59
|
return [];
|
|
60
|
-
const t = this.currentNode.closest(
|
|
60
|
+
const t = this.currentNode.closest(u);
|
|
61
61
|
if (!t)
|
|
62
62
|
return [];
|
|
63
|
-
const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(
|
|
63
|
+
const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(a) : null;
|
|
64
64
|
if (e) {
|
|
65
|
-
const s = `[esd-extension-block-id="${
|
|
65
|
+
const s = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
|
|
66
66
|
return Array.from(t.querySelectorAll(s));
|
|
67
67
|
}
|
|
68
68
|
return Array.from(
|
|
69
69
|
t.querySelectorAll(
|
|
70
|
-
`[esd-extension-block-id="${
|
|
70
|
+
`[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"]`
|
|
71
71
|
)
|
|
72
72
|
);
|
|
73
73
|
}
|
|
@@ -78,7 +78,7 @@ class g extends m {
|
|
|
78
78
|
const e = this._getTargetElements();
|
|
79
79
|
if (!e.length)
|
|
80
80
|
return;
|
|
81
|
-
t &&
|
|
81
|
+
t && c(this.api);
|
|
82
82
|
const r = this.api.getDocumentModifier();
|
|
83
83
|
e.forEach((s) => {
|
|
84
84
|
t ? r.modifyHtml(s).setClass(o) : r.modifyHtml(s).removeClass(o);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createImageMarginsControl as m, createImageSizeControl as n } from "../../../controlFactories.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as r } from "../../constants/controlIds.js";
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as t } from "../../constants/selectors.js";
|
|
5
5
|
const e = n(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
r.IMAGE_SIZE,
|
|
7
|
+
o.IMAGE,
|
|
8
|
+
t
|
|
9
9
|
), i = m(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
r.IMAGE_MARGINS,
|
|
11
|
+
o.IMAGE,
|
|
12
|
+
t
|
|
13
13
|
), C = {
|
|
14
14
|
size: e,
|
|
15
15
|
margins: i
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var l = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
4
|
-
import { UEAttr as
|
|
2
|
+
var c = (s, i, t) => i in s ? l(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
3
|
+
var a = (s, i, t) => c(s, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as d } from "../../../common-control.js";
|
|
6
|
-
import { RecommendationConfigService as
|
|
6
|
+
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
|
|
8
8
|
const g = "recommendation-algorithm-control", e = {
|
|
9
9
|
ALGORITHM: "strategy",
|
|
@@ -45,31 +45,32 @@ class T extends d {
|
|
|
45
45
|
super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
|
|
46
46
|
}
|
|
47
47
|
_setFormValues() {
|
|
48
|
-
const t =
|
|
48
|
+
const t = n.getConfig(this.currentNode);
|
|
49
49
|
this._setProductIdsVisibility(t.strategy), this.api.updateValues({
|
|
50
50
|
[e.ALGORITHM]: t.strategy,
|
|
51
51
|
[e.PRODUCT_IDS]: t.productIds.join(",")
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
_initializeSelectItems() {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var o;
|
|
56
|
+
const t = (o = this.store) == null ? void 0 : o.getActivePredictiveAlgorithms;
|
|
57
|
+
if (t != null && t.length)
|
|
57
58
|
try {
|
|
58
59
|
this.api.setUIEAttribute(
|
|
59
60
|
e.ALGORITHM,
|
|
60
|
-
|
|
61
|
+
h.SELECTPICKER.items,
|
|
61
62
|
t
|
|
62
63
|
);
|
|
63
|
-
} catch (
|
|
64
|
-
console.warn("[AlgorithmControl] Failed to set algorithm options:",
|
|
64
|
+
} catch (r) {
|
|
65
|
+
console.warn("[AlgorithmControl] Failed to set algorithm options:", r);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
_setProductIdsVisibility(t) {
|
|
68
|
-
const
|
|
69
|
-
this.api.setVisibility(e.PRODUCT_IDS,
|
|
69
|
+
const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
|
|
70
|
+
this.api.setVisibility(e.PRODUCT_IDS, r), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, r);
|
|
70
71
|
}
|
|
71
72
|
_onAlgorithmChange(t) {
|
|
72
|
-
!this.currentNode ||
|
|
73
|
+
!this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
|
|
73
74
|
this.api,
|
|
74
75
|
this.currentNode,
|
|
75
76
|
{ strategy: t },
|
|
@@ -79,13 +80,13 @@ class T extends d {
|
|
|
79
80
|
_onProductIdsChange(t) {
|
|
80
81
|
if (!this.currentNode)
|
|
81
82
|
return;
|
|
82
|
-
const
|
|
83
|
-
|
|
83
|
+
const o = t.split(",").map((r) => r.trim()).filter(Boolean);
|
|
84
|
+
n.updateConfig(
|
|
84
85
|
this.api,
|
|
85
86
|
this.currentNode,
|
|
86
|
-
{ productIds:
|
|
87
|
+
{ productIds: o },
|
|
87
88
|
"Updated product IDs"
|
|
88
|
-
), this.store.patchCurrentBlockConfig({ productIds:
|
|
89
|
+
), this.store.patchCurrentBlockConfig({ productIds: o });
|
|
89
90
|
}
|
|
90
91
|
_listenToFormUpdates() {
|
|
91
92
|
this.api.onValueChanged(e.ALGORITHM, (t) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var n = Object.defineProperty;
|
|
2
|
-
var o = (e, t
|
|
3
|
-
var r = (e, t
|
|
2
|
+
var o = (i, e, t) => e in i ? n(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var r = (i, e, t) => o(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { CommonControl as s } from "../../../common-control.js";
|
|
5
5
|
import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
|
|
6
6
|
const d = "recommendation-filters-control", a = {
|
|
@@ -35,13 +35,15 @@ class h extends s {
|
|
|
35
35
|
this._setupButtonListener();
|
|
36
36
|
}
|
|
37
37
|
onDestroy() {
|
|
38
|
-
|
|
38
|
+
var t;
|
|
39
|
+
(t = this.addFilterButton) == null || t.removeEventListener("click", this.addFilterListener);
|
|
39
40
|
}
|
|
40
41
|
_onFilterSelectClick() {
|
|
41
42
|
this.store.openFilterDrawer();
|
|
42
43
|
}
|
|
43
44
|
_setupButtonListener() {
|
|
44
|
-
|
|
45
|
+
var t;
|
|
46
|
+
this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (t = this.addFilterButton) == null || t.addEventListener("click", this.addFilterListener);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
|
-
var p = (d,
|
|
3
|
-
var
|
|
2
|
+
var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
|
|
3
|
+
var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
|
-
import { DEFAULT_NODE_CONFIG as
|
|
5
|
+
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
6
|
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
8
|
import { AlgorithmControl as R } from "./algorithm.js";
|
|
@@ -12,13 +12,13 @@ import { CURRENCY_CONTROL_ID as X } from "./currency.js";
|
|
|
12
12
|
import { FiltersControl as _ } from "./filters.js";
|
|
13
13
|
import { FILTERS_CONTROL_ID as tt } from "./filters.js";
|
|
14
14
|
import { LayoutOrientationControl as b } from "./layoutOrientation.js";
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as ot } from "./layoutOrientation.js";
|
|
16
16
|
import { LocaleControl as O } from "./locale.js";
|
|
17
17
|
import { LOCALE_CONTROL_ID as nt } from "./locale.js";
|
|
18
18
|
import { ProductCountControl as I } from "./productCount.js";
|
|
19
19
|
import { PRODUCT_COUNT_CONTROL_ID as st } from "./productCount.js";
|
|
20
20
|
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
21
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
21
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
|
|
22
22
|
import { ShuffleControl as S } from "./shuffle.js";
|
|
23
23
|
import { SHUFFLE_CONTROL_ID as ut } from "./shuffle.js";
|
|
24
24
|
import { getBlockElement as L, updateProductContentInPlace as P, regenerateProductRowsWithStyles as D } from "./utils.js";
|
|
@@ -28,22 +28,22 @@ const k = "recommendation-id", E = "ui-elements-recommendation-block";
|
|
|
28
28
|
class H extends g {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
s(this, "store", y());
|
|
32
|
+
s(this, "storeUnsubscription", () => {
|
|
33
33
|
});
|
|
34
34
|
// Sub-control instances for lifecycle management
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
s(this, "algorithmControl", null);
|
|
36
|
+
s(this, "localeControl", null);
|
|
37
|
+
s(this, "currencyControl", null);
|
|
38
|
+
s(this, "productCountControl", null);
|
|
39
|
+
s(this, "productLayoutControl", null);
|
|
40
|
+
s(this, "filtersControl", null);
|
|
41
|
+
s(this, "shuffleControl", null);
|
|
42
|
+
s(this, "layoutOrientationControl", null);
|
|
43
43
|
/**
|
|
44
44
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
s(this, "_debouncedFetchProducts", m(() => {
|
|
47
47
|
this.store.fetchRecommendationProducts();
|
|
48
48
|
}, 500));
|
|
49
49
|
/**
|
|
@@ -57,18 +57,18 @@ class H extends g {
|
|
|
57
57
|
* count. The store pads products to the configured size, so in-place only
|
|
58
58
|
* fails when the size actually changed.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
s(this, "_debouncedRegenerateWithProducts", m(() => {
|
|
61
61
|
const t = this.store.recommendationProducts;
|
|
62
62
|
if (!this.currentNode || !this.api)
|
|
63
63
|
return;
|
|
64
|
-
const
|
|
64
|
+
const e = this.api.getDocumentModifier();
|
|
65
65
|
P({
|
|
66
66
|
currentNode: this.currentNode,
|
|
67
|
-
documentModifier:
|
|
67
|
+
documentModifier: e,
|
|
68
68
|
products: t
|
|
69
69
|
}) || D({
|
|
70
70
|
currentNode: this.currentNode,
|
|
71
|
-
documentModifier:
|
|
71
|
+
documentModifier: e,
|
|
72
72
|
products: t
|
|
73
73
|
});
|
|
74
74
|
}, 100));
|
|
@@ -86,8 +86,8 @@ class H extends g {
|
|
|
86
86
|
this.filtersControl,
|
|
87
87
|
this.shuffleControl,
|
|
88
88
|
this.layoutOrientationControl
|
|
89
|
-
].forEach((
|
|
90
|
-
|
|
89
|
+
].forEach((e) => {
|
|
90
|
+
e.api = this.api;
|
|
91
91
|
}), `
|
|
92
92
|
<div class="recommendation-controls-container">
|
|
93
93
|
${this.layoutOrientationControl.getTemplate()}
|
|
@@ -102,17 +102,19 @@ class H extends g {
|
|
|
102
102
|
`;
|
|
103
103
|
}
|
|
104
104
|
async onRender() {
|
|
105
|
+
var e;
|
|
105
106
|
const t = this._getRecommendationIdFromNode(this.currentNode) ?? this.store.currentRecommendationId;
|
|
106
|
-
if (t !== null && this.store.setCurrentBlock(t), this._listenStateUpdates(), t !== null && this.store.blockStates[t]
|
|
107
|
+
if (t !== null && this.store.setCurrentBlock(t), this._listenStateUpdates(), t !== null && ((e = this.store.blockStates[t]) != null && e.isInitialized)) {
|
|
107
108
|
this._initializeSubControls();
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
111
|
await this._fetchBlockData(t), this._initializeSubControls();
|
|
111
112
|
}
|
|
112
113
|
onTemplateNodeUpdated(t) {
|
|
114
|
+
var r;
|
|
113
115
|
super.onTemplateNodeUpdated(t);
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
+
const e = this._getRecommendationIdFromNode(t);
|
|
117
|
+
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e).then(() => {
|
|
116
118
|
this._initializeSubControls();
|
|
117
119
|
}), [
|
|
118
120
|
this.layoutOrientationControl,
|
|
@@ -123,8 +125,9 @@ class H extends g {
|
|
|
123
125
|
this.productLayoutControl,
|
|
124
126
|
this.filtersControl,
|
|
125
127
|
this.shuffleControl
|
|
126
|
-
].forEach((
|
|
127
|
-
|
|
128
|
+
].forEach((n) => {
|
|
129
|
+
var i;
|
|
130
|
+
n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
|
|
128
131
|
});
|
|
129
132
|
}
|
|
130
133
|
onDestroy() {
|
|
@@ -137,7 +140,10 @@ class H extends g {
|
|
|
137
140
|
this.productLayoutControl,
|
|
138
141
|
this.filtersControl,
|
|
139
142
|
this.shuffleControl
|
|
140
|
-
].forEach((
|
|
143
|
+
].forEach((e) => {
|
|
144
|
+
var o;
|
|
145
|
+
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
146
|
+
});
|
|
141
147
|
}
|
|
142
148
|
/**
|
|
143
149
|
* Initialize all sub-controls with the shared API context
|
|
@@ -153,8 +159,9 @@ class H extends g {
|
|
|
153
159
|
this.productLayoutControl,
|
|
154
160
|
this.filtersControl,
|
|
155
161
|
this.shuffleControl
|
|
156
|
-
].forEach((
|
|
157
|
-
|
|
162
|
+
].forEach((e) => {
|
|
163
|
+
var o;
|
|
164
|
+
e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
|
|
158
165
|
});
|
|
159
166
|
}
|
|
160
167
|
/**
|
|
@@ -169,7 +176,8 @@ class H extends g {
|
|
|
169
176
|
* values are being prepared for the upcoming initial fetch.
|
|
170
177
|
*/
|
|
171
178
|
_syncNodeConfigToStore() {
|
|
172
|
-
|
|
179
|
+
var r;
|
|
180
|
+
const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
173
181
|
this.store.patchCurrentBlockConfig({
|
|
174
182
|
strategy: t.strategy,
|
|
175
183
|
language: t.language,
|
|
@@ -178,7 +186,7 @@ class H extends g {
|
|
|
178
186
|
// Only sync filters from node config during initial load.
|
|
179
187
|
// After initialization, the Pinia store is the source of truth
|
|
180
188
|
// for filters (edited via the filter drawer).
|
|
181
|
-
...
|
|
189
|
+
...o ? {} : { filters: t.filters },
|
|
182
190
|
shuffleProducts: t.shuffleProducts,
|
|
183
191
|
currencySettings: {
|
|
184
192
|
name: t.currency.code,
|
|
@@ -204,13 +212,13 @@ class H extends g {
|
|
|
204
212
|
t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
|
|
205
213
|
this.store.fetchRecommendationCreateData(),
|
|
206
214
|
this.store.fetchRecommendationFilters()
|
|
207
|
-
])).forEach((
|
|
208
|
-
|
|
215
|
+
])).forEach((o, r) => {
|
|
216
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
|
|
209
217
|
}), this._applySmartDefaults();
|
|
210
218
|
try {
|
|
211
219
|
await this.store.fetchRecommendationProducts();
|
|
212
|
-
} catch (
|
|
213
|
-
console.warn("Recommendation block: fetchRecommendationProducts failed",
|
|
220
|
+
} catch (o) {
|
|
221
|
+
console.warn("Recommendation block: fetchRecommendationProducts failed", o);
|
|
214
222
|
}
|
|
215
223
|
}
|
|
216
224
|
/**
|
|
@@ -226,62 +234,62 @@ class H extends g {
|
|
|
226
234
|
_applySmartDefaults() {
|
|
227
235
|
if (!this.currentNode || !this.api)
|
|
228
236
|
return;
|
|
229
|
-
const t = h.getConfig(this.currentNode),
|
|
230
|
-
let
|
|
231
|
-
if (t.currency.code ===
|
|
232
|
-
const { currencyList:
|
|
233
|
-
|
|
234
|
-
(u) => u.value === `price.${
|
|
235
|
-
) || (
|
|
236
|
-
...
|
|
237
|
-
code:
|
|
238
|
-
symbol:
|
|
237
|
+
const t = h.getConfig(this.currentNode), e = {};
|
|
238
|
+
let o = null, r = null, n = null;
|
|
239
|
+
if (t.currency.code === a.currency.code) {
|
|
240
|
+
const { currencyList: i } = this.store;
|
|
241
|
+
i.length > 0 && (i.some(
|
|
242
|
+
(u) => u.value === `price.${a.currency.code}`
|
|
243
|
+
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
244
|
+
...a.currency,
|
|
245
|
+
code: o,
|
|
246
|
+
symbol: o
|
|
239
247
|
}));
|
|
240
248
|
}
|
|
241
|
-
if (t.strategy ===
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
(u) => u.value ===
|
|
245
|
-
) || (r =
|
|
249
|
+
if (t.strategy === a.strategy) {
|
|
250
|
+
const i = this.store.getActivePredictiveAlgorithms;
|
|
251
|
+
i.length > 0 && (i.some(
|
|
252
|
+
(u) => u.value === a.strategy
|
|
253
|
+
) || (r = i[0].value, e.strategy = r));
|
|
246
254
|
}
|
|
247
|
-
if (t.language ===
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
(u) => u.value ===
|
|
251
|
-
) || (
|
|
255
|
+
if (t.language === a.language) {
|
|
256
|
+
const i = this.store.getLanguages;
|
|
257
|
+
i.length > 0 && (i.some(
|
|
258
|
+
(u) => u.value === a.language
|
|
259
|
+
) || (n = i[0].value, e.language = n));
|
|
252
260
|
}
|
|
253
|
-
!
|
|
261
|
+
!o && !r && !n || (h.updateConfig(
|
|
254
262
|
this.api,
|
|
255
263
|
this.currentNode,
|
|
256
|
-
|
|
264
|
+
e,
|
|
257
265
|
"Applied smart defaults"
|
|
258
266
|
), this.store.patchCurrentBlockConfig({
|
|
259
|
-
...
|
|
267
|
+
...o ? {
|
|
260
268
|
currencySettings: {
|
|
261
|
-
name:
|
|
262
|
-
value:
|
|
263
|
-
symbol:
|
|
264
|
-
alignment:
|
|
265
|
-
decimalCount:
|
|
266
|
-
decimalSeparator:
|
|
267
|
-
thousandSeparator:
|
|
269
|
+
name: o,
|
|
270
|
+
value: o,
|
|
271
|
+
symbol: o,
|
|
272
|
+
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
273
|
+
decimalCount: a.currency.decimalCount.toString(),
|
|
274
|
+
decimalSeparator: a.currency.decimalSeparator,
|
|
275
|
+
thousandSeparator: a.currency.thousandSeparator
|
|
268
276
|
}
|
|
269
277
|
} : {},
|
|
270
278
|
...r ? { strategy: r } : {},
|
|
271
|
-
...
|
|
279
|
+
...n ? { language: n } : {}
|
|
272
280
|
}, { triggerRefetch: !1 }));
|
|
273
281
|
}
|
|
274
282
|
/**
|
|
275
283
|
* Reads the recommendation-id attribute from the block element within the node
|
|
276
284
|
*/
|
|
277
285
|
_getRecommendationIdFromNode(t) {
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
286
|
+
const e = L(t);
|
|
287
|
+
if (!e || !("getAttribute" in e))
|
|
280
288
|
return null;
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
289
|
+
const o = e.getAttribute(k);
|
|
290
|
+
if (!o)
|
|
283
291
|
return null;
|
|
284
|
-
const r = parseInt(
|
|
292
|
+
const r = parseInt(o);
|
|
285
293
|
return Number.isNaN(r) ? null : r;
|
|
286
294
|
}
|
|
287
295
|
/**
|
|
@@ -299,17 +307,17 @@ class H extends g {
|
|
|
299
307
|
*/
|
|
300
308
|
_listenStateUpdates() {
|
|
301
309
|
const { store: t } = this;
|
|
302
|
-
let
|
|
310
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
|
|
303
311
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
306
|
-
r =
|
|
312
|
+
const n = t.currentRecommendationId;
|
|
313
|
+
if (n !== r) {
|
|
314
|
+
r = n, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
307
315
|
return;
|
|
308
316
|
}
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
u && C && (
|
|
317
|
+
const i = t.$state.configVersion;
|
|
318
|
+
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
319
|
+
const c = t.recommendationProducts, u = c !== e, C = Array.isArray(c) && c.length > 0;
|
|
320
|
+
u && C && (e = c, this._debouncedRegenerateWithProducts());
|
|
313
321
|
});
|
|
314
322
|
}
|
|
315
323
|
/**
|
|
@@ -336,12 +344,12 @@ export {
|
|
|
336
344
|
N as CurrencyControl,
|
|
337
345
|
tt as FILTERS_CONTROL_ID,
|
|
338
346
|
_ as FiltersControl,
|
|
339
|
-
|
|
347
|
+
ot as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
340
348
|
nt as LOCALE_CONTROL_ID,
|
|
341
349
|
b as LayoutOrientationControl,
|
|
342
350
|
O as LocaleControl,
|
|
343
351
|
st as PRODUCT_COUNT_CONTROL_ID,
|
|
344
|
-
|
|
352
|
+
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
345
353
|
I as ProductCountControl,
|
|
346
354
|
T as ProductLayoutControl,
|
|
347
355
|
H as RecommendationBlockControl,
|
|
@@ -3,12 +3,12 @@ var p = (o, e, t) => e in o ? O(o, e, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var r = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as N } from "../../../common-control.js";
|
|
6
|
+
import { ATTR_DATA_CUSTOM_ATTRIBUTES as L } from "../../constants/selectors.js";
|
|
7
|
+
import { LAYOUT_OPTIONS as T, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
|
|
8
|
+
import { DEFAULT_COMPOSITION as _ } from "../../constants/defaultConfig.js";
|
|
6
9
|
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { getCurrentLayout as
|
|
9
|
-
import { LAYOUT_OPTIONS as I, DEFAULT_MOBILE_ROW_SPACING as d, DEFAULT_MOBILE_COLUMN_SPACING as l, DEFAULT_ROW_SPACING as g, DEFAULT_COLUMN_SPACING as _ } from "../../constants/layout.js";
|
|
10
|
-
import { DEFAULT_COMPOSITION as C } from "../../constants/defaultConfig.js";
|
|
11
|
-
import { ATTR_DATA_CUSTOM_ATTRIBUTES as S } from "../../constants/selectors.js";
|
|
10
|
+
import { useRecommendationExtensionStore as f } from "../../store/recommendation.js";
|
|
11
|
+
import { getCurrentLayout as C, getBlockElement as I, regenerateProductRowsWithStyles as S } from "./utils.js";
|
|
12
12
|
const U = "recommendation-layout-orientation-control", A = "recommendationInfoBannerTest", a = {
|
|
13
13
|
LAYOUT: "layout"
|
|
14
14
|
}, y = "data-card-composition", i = {
|
|
@@ -21,7 +21,7 @@ const U = "recommendation-layout-orientation-control", A = "recommendationInfoBa
|
|
|
21
21
|
class Y extends N {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
|
-
r(this, "store",
|
|
24
|
+
r(this, "store", f());
|
|
25
25
|
r(this, "isChangingLayout", !1);
|
|
26
26
|
}
|
|
27
27
|
getId() {
|
|
@@ -36,7 +36,7 @@ class Y extends N {
|
|
|
36
36
|
this._GuLabel({ text: this.api.translate("Layout Orientation") }),
|
|
37
37
|
this._GuRadioButton({
|
|
38
38
|
name: a.LAYOUT,
|
|
39
|
-
buttons:
|
|
39
|
+
buttons: T
|
|
40
40
|
})
|
|
41
41
|
])}
|
|
42
42
|
</div>
|
|
@@ -55,7 +55,7 @@ class Y extends N {
|
|
|
55
55
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
56
56
|
}
|
|
57
57
|
_setFormValues() {
|
|
58
|
-
const u = s.getConfig(this.currentNode).layout ||
|
|
58
|
+
const u = s.getConfig(this.currentNode).layout || C(this.currentNode);
|
|
59
59
|
this.api.updateValues({
|
|
60
60
|
[a.LAYOUT]: u
|
|
61
61
|
});
|
|
@@ -65,9 +65,9 @@ class Y extends N {
|
|
|
65
65
|
* Updates node config, data attribute and regenerates product rows
|
|
66
66
|
*/
|
|
67
67
|
_onLayoutChange(t) {
|
|
68
|
-
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout ||
|
|
68
|
+
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout || C(this.currentNode)) === t)
|
|
69
69
|
return;
|
|
70
|
-
const c =
|
|
70
|
+
const c = I(this.currentNode);
|
|
71
71
|
if (c) {
|
|
72
72
|
this.isChangingLayout = !0;
|
|
73
73
|
try {
|
|
@@ -76,15 +76,15 @@ class Y extends N {
|
|
|
76
76
|
this.currentNode,
|
|
77
77
|
{
|
|
78
78
|
layout: t,
|
|
79
|
-
columnSpacing:
|
|
80
|
-
rowSpacing:
|
|
81
|
-
mobileColumnSpacing:
|
|
82
|
-
mobileRowSpacing:
|
|
79
|
+
columnSpacing: g,
|
|
80
|
+
rowSpacing: l,
|
|
81
|
+
mobileColumnSpacing: d,
|
|
82
|
+
mobileRowSpacing: m
|
|
83
83
|
},
|
|
84
84
|
`Changed layout to ${t}`
|
|
85
85
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
86
|
-
const n = this.api.getDocumentModifier().modifyHtml(c).setAttribute(i.LAYOUT, t).setAttribute(i.COLUMN_SPACING,
|
|
87
|
-
t === "list" ? (n.setClass("es-m-p0"), n.setClass("ins-recommendation-list-layout")) : (n.removeClass("es-m-p0"), n.removeClass("ins-recommendation-list-layout")), n.setAttribute(y,
|
|
86
|
+
const n = this.api.getDocumentModifier().modifyHtml(c).setAttribute(i.LAYOUT, t).setAttribute(i.COLUMN_SPACING, g.toString()).setAttribute(i.ROW_SPACING, l.toString()).setAttribute(i.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(i.MOBILE_ROW_SPACING, m.toString());
|
|
87
|
+
t === "list" ? (n.setClass("es-m-p0"), n.setClass("ins-recommendation-list-layout")) : (n.removeClass("es-m-p0"), n.removeClass("ins-recommendation-list-layout")), n.setAttribute(y, _.join(",")).setAttribute(L, "[]"), n.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t);
|
|
88
88
|
} finally {
|
|
89
89
|
this.isChangingLayout = !1;
|
|
90
90
|
}
|
|
@@ -96,11 +96,11 @@ class Y extends N {
|
|
|
96
96
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
97
97
|
*/
|
|
98
98
|
_regenerateProductRows(t) {
|
|
99
|
-
this.currentNode &&
|
|
99
|
+
this.currentNode && S({
|
|
100
100
|
currentNode: this.currentNode,
|
|
101
101
|
documentModifier: this.api.getDocumentModifier(),
|
|
102
102
|
layout: t,
|
|
103
|
-
composition:
|
|
103
|
+
composition: _
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
_listenToFormUpdates() {
|
|
@@ -2,16 +2,16 @@ var s = Object.defineProperty;
|
|
|
2
2
|
var u = (e, o, t) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
3
|
var i = (e, o, t) => u(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
4
|
import { CommonControl as a } from "../../../common-control.js";
|
|
5
|
+
import { MAX_PRODUCT_COUNT as c } from "../../constants/layout.js";
|
|
5
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
6
|
-
import { useRecommendationExtensionStore as
|
|
7
|
-
import { MAX_PRODUCT_COUNT as d } from "../../constants/layout.js";
|
|
7
|
+
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
8
8
|
const C = "recommendation-product-count-control", r = {
|
|
9
9
|
PRODUCT_COUNT: "size"
|
|
10
10
|
};
|
|
11
11
|
class g extends a {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
|
-
i(this, "store",
|
|
14
|
+
i(this, "store", d());
|
|
15
15
|
}
|
|
16
16
|
getId() {
|
|
17
17
|
return C;
|
|
@@ -21,7 +21,7 @@ class g extends a {
|
|
|
21
21
|
<div class="product-count-control-container">
|
|
22
22
|
${this._GuTwoColumns([
|
|
23
23
|
this._GuLabel({ text: this.api.translate("Number of Products") }),
|
|
24
|
-
this._GuCounter({ name: r.PRODUCT_COUNT, maxValue:
|
|
24
|
+
this._GuCounter({ name: r.PRODUCT_COUNT, maxValue: c })
|
|
25
25
|
])}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|