@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,13 +1,21 @@
|
|
|
1
1
|
import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, ContainerControls as C, TextControls as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { BLOCK_ID as U } from "./block.js";
|
|
3
|
+
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
3
5
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
+
import "./store/recommendation.js";
|
|
7
|
+
import "./controls/name/index.js";
|
|
8
|
+
import "./controls/price/index.js";
|
|
9
|
+
import "./controls/oldPrice/index.js";
|
|
10
|
+
import "./controls/omnibusPrice/index.js";
|
|
11
|
+
import "./controls/omnibusDiscount/index.js";
|
|
12
|
+
import "./controls/button/index.js";
|
|
13
|
+
import "./controls/image/index.js";
|
|
14
|
+
import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
15
|
+
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
6
16
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
7
|
-
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
8
17
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
9
|
-
|
|
10
|
-
class F extends E {
|
|
18
|
+
class Z extends E {
|
|
11
19
|
registerBlockControls(I) {
|
|
12
20
|
I[U] = [
|
|
13
21
|
new _(
|
|
@@ -21,8 +29,8 @@ class F extends E {
|
|
|
21
29
|
O.STYLES,
|
|
22
30
|
[
|
|
23
31
|
R.TEXT_BLOCK_BACKGROUND_COLOR,
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
D,
|
|
33
|
+
L
|
|
26
34
|
]
|
|
27
35
|
),
|
|
28
36
|
new _(
|
|
@@ -186,5 +194,5 @@ class F extends E {
|
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
196
|
export {
|
|
189
|
-
|
|
197
|
+
Z as SettingsPanel
|
|
190
198
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { RecommendationFeedSourceMaps as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { RecommendationFeedSourceMaps as g, getOperatorOptions as k, PriceAttributes as R } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as y } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as G } from "pinia";
|
|
5
|
+
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
|
+
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
8
|
+
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
+
import { isFilterValid as D } from "../validation/filterSchema.js";
|
|
10
|
+
import { isConfigValid as P } from "../validation/requiredFields.js";
|
|
11
|
+
const h = C();
|
|
11
12
|
let m = null, u = null, d = null;
|
|
12
|
-
function
|
|
13
|
+
function I() {
|
|
13
14
|
return {
|
|
14
|
-
cardsInRow:
|
|
15
|
+
cardsInRow: F,
|
|
15
16
|
currencySettings: {
|
|
16
17
|
name: "USD",
|
|
17
18
|
value: "USD",
|
|
@@ -37,9 +38,9 @@ function b() {
|
|
|
37
38
|
customAttributes: []
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function v() {
|
|
41
42
|
return {
|
|
42
|
-
recommendationConfigs:
|
|
43
|
+
recommendationConfigs: I(),
|
|
43
44
|
recommendationProducts: [],
|
|
44
45
|
filterStatus: !1,
|
|
45
46
|
filterSelectionDrawerStatus: !1,
|
|
@@ -48,7 +49,7 @@ function D() {
|
|
|
48
49
|
filterSnapshot: null
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
const
|
|
52
|
+
const x = () => ({
|
|
52
53
|
recommendationCampaignUrls: {},
|
|
53
54
|
activePredictiveAlgorithms: [],
|
|
54
55
|
languages: {},
|
|
@@ -57,8 +58,8 @@ const P = () => ({
|
|
|
57
58
|
blockStates: {},
|
|
58
59
|
currentRecommendationId: null,
|
|
59
60
|
configVersion: 0
|
|
60
|
-
}),
|
|
61
|
-
state: () =>
|
|
61
|
+
}), M = G("guidoRecommendationExtension", {
|
|
62
|
+
state: () => x(),
|
|
62
63
|
getters: {
|
|
63
64
|
// ====================================================================
|
|
64
65
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -68,7 +69,7 @@ const P = () => ({
|
|
|
68
69
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
69
70
|
*/
|
|
70
71
|
recommendationConfigs(t) {
|
|
71
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
72
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : I();
|
|
72
73
|
},
|
|
73
74
|
/**
|
|
74
75
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -114,8 +115,8 @@ const P = () => ({
|
|
|
114
115
|
},
|
|
115
116
|
getActivePredictiveAlgorithms: (t) => {
|
|
116
117
|
const r = [];
|
|
117
|
-
return t.activePredictiveAlgorithms.filter((e) => !
|
|
118
|
-
r.push(...
|
|
118
|
+
return t.activePredictiveAlgorithms.filter((e) => !w.includes(e)).forEach((e) => {
|
|
119
|
+
r.push(...g.filter((n) => n.id === e));
|
|
119
120
|
}), r.map((e) => ({
|
|
120
121
|
text: e.name,
|
|
121
122
|
value: e.key
|
|
@@ -154,7 +155,7 @@ const P = () => ({
|
|
|
154
155
|
setCurrentBlock(t) {
|
|
155
156
|
this.blockStates[t] || (this.blockStates = {
|
|
156
157
|
...this.blockStates,
|
|
157
|
-
[t]:
|
|
158
|
+
[t]: v()
|
|
158
159
|
}), this.currentRecommendationId = t;
|
|
159
160
|
},
|
|
160
161
|
/**
|
|
@@ -164,13 +165,13 @@ const P = () => ({
|
|
|
164
165
|
removeBlockState(t) {
|
|
165
166
|
const r = t.toString();
|
|
166
167
|
if (this.recommendationCampaignUrls[r]) {
|
|
167
|
-
const
|
|
168
|
-
delete
|
|
168
|
+
const n = { ...this.recommendationCampaignUrls };
|
|
169
|
+
delete n[r], this.recommendationCampaignUrls = n;
|
|
169
170
|
}
|
|
170
171
|
const e = { ...this.blockStates };
|
|
171
172
|
if (delete e[t], this.blockStates = e, this.currentRecommendationId === t) {
|
|
172
|
-
const
|
|
173
|
-
this.currentRecommendationId =
|
|
173
|
+
const n = Object.keys(this.blockStates).map(Number);
|
|
174
|
+
this.currentRecommendationId = n.length > 0 ? n[0] : null;
|
|
174
175
|
}
|
|
175
176
|
},
|
|
176
177
|
/**
|
|
@@ -196,18 +197,18 @@ const P = () => ({
|
|
|
196
197
|
...t.currencySettings || {}
|
|
197
198
|
}
|
|
198
199
|
};
|
|
199
|
-
const { triggerRefetch:
|
|
200
|
-
|
|
200
|
+
const { triggerRefetch: n = !0 } = r;
|
|
201
|
+
n && this.configVersion++;
|
|
201
202
|
},
|
|
202
203
|
/**
|
|
203
204
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
204
205
|
*/
|
|
205
206
|
createDefaultFilter(t, r) {
|
|
206
|
-
const [e] = this.getFilterList, [
|
|
207
|
+
const [e] = this.getFilterList, [n] = k(e == null ? void 0 : e.type);
|
|
207
208
|
return {
|
|
208
209
|
type: "standardFilter",
|
|
209
|
-
attribute: e
|
|
210
|
-
operator:
|
|
210
|
+
attribute: (e == null ? void 0 : e.value) ?? "",
|
|
211
|
+
operator: (n == null ? void 0 : n.value) ?? "",
|
|
211
212
|
innerGroupOperator: "*",
|
|
212
213
|
outerGroupOperator: "*",
|
|
213
214
|
filterNumber: r,
|
|
@@ -266,8 +267,8 @@ const P = () => ({
|
|
|
266
267
|
currencies: e
|
|
267
268
|
} = await h.fetchRecommendationCreateData();
|
|
268
269
|
if (this.activePredictiveAlgorithms = t, this.languages = r, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
269
|
-
const
|
|
270
|
-
|
|
270
|
+
const n = this.blockStates[this.currentRecommendationId];
|
|
271
|
+
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
271
272
|
}
|
|
272
273
|
this.currencyList = e;
|
|
273
274
|
})();
|
|
@@ -306,41 +307,41 @@ const P = () => ({
|
|
|
306
307
|
deleteFilterGroup(t) {
|
|
307
308
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
308
309
|
return;
|
|
309
|
-
const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.filter((
|
|
310
|
-
r.recommendationConfigs.filters = e.map((
|
|
311
|
-
...
|
|
312
|
-
filterGroup: c.get(
|
|
310
|
+
const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.filter((i) => i.filterGroup !== t), n = [...new Set(e.map((i) => i.filterGroup))].sort((i, o) => i - o), c = new Map(n.map((i, o) => [i, o + 1]));
|
|
311
|
+
r.recommendationConfigs.filters = e.map((i) => ({
|
|
312
|
+
...i,
|
|
313
|
+
filterGroup: c.get(i.filterGroup) ?? i.filterGroup
|
|
313
314
|
}));
|
|
314
315
|
},
|
|
315
316
|
updateFilter(t) {
|
|
316
317
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
317
318
|
return;
|
|
318
|
-
const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.findIndex((
|
|
319
|
+
const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.findIndex((n) => n.filterNumber === t.filterNumber && n.filterGroup === t.filterGroup);
|
|
319
320
|
if (e !== -1) {
|
|
320
|
-
const
|
|
321
|
-
|
|
321
|
+
const n = [...r.recommendationConfigs.filters];
|
|
322
|
+
n[e] = {
|
|
322
323
|
...t,
|
|
323
|
-
isValid:
|
|
324
|
-
}, r.recommendationConfigs.filters =
|
|
324
|
+
isValid: D(t)
|
|
325
|
+
}, r.recommendationConfigs.filters = n;
|
|
325
326
|
}
|
|
326
327
|
},
|
|
327
328
|
deleteFilter(t) {
|
|
328
329
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
329
330
|
return;
|
|
330
|
-
const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters].findIndex((
|
|
331
|
+
const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters].findIndex((n) => n.filterNumber === t.filterNumber && n.filterGroup === t.filterGroup);
|
|
331
332
|
if (e !== -1) {
|
|
332
|
-
let
|
|
333
|
-
if (
|
|
334
|
-
let
|
|
335
|
-
|
|
333
|
+
let n = [...r.recommendationConfigs.filters];
|
|
334
|
+
if (n.splice(e, 1), n.some((i) => i.filterGroup === t.filterGroup)) {
|
|
335
|
+
let i = 1;
|
|
336
|
+
n = n.map((o) => o.filterGroup === t.filterGroup ? { ...o, filterNumber: i++ } : o);
|
|
336
337
|
} else {
|
|
337
|
-
const
|
|
338
|
-
|
|
338
|
+
const i = [...new Set(n.map((s) => s.filterGroup))].sort((s, l) => s - l), o = new Map(i.map((s, l) => [s, l + 1]));
|
|
339
|
+
n = n.map((s) => ({
|
|
339
340
|
...s,
|
|
340
341
|
filterGroup: o.get(s.filterGroup) ?? s.filterGroup
|
|
341
342
|
}));
|
|
342
343
|
}
|
|
343
|
-
r.recommendationConfigs.filters =
|
|
344
|
+
r.recommendationConfigs.filters = n;
|
|
344
345
|
}
|
|
345
346
|
},
|
|
346
347
|
addFilter(t) {
|
|
@@ -348,8 +349,8 @@ const P = () => ({
|
|
|
348
349
|
return;
|
|
349
350
|
const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters], c = e.filter(
|
|
350
351
|
(o) => o.filterGroup === t.filterGroup
|
|
351
|
-
).length + 1,
|
|
352
|
-
|
|
352
|
+
).length + 1, i = e.findLastIndex((o) => o.filterGroup === t.filterGroup);
|
|
353
|
+
i !== -1 ? e.splice(i + 1, 0, {
|
|
353
354
|
...t,
|
|
354
355
|
filterNumber: c
|
|
355
356
|
}) : e.push({
|
|
@@ -358,7 +359,15 @@ const P = () => ({
|
|
|
358
359
|
}), r.recommendationConfigs.filters = e;
|
|
359
360
|
},
|
|
360
361
|
generateFilterQuery() {
|
|
361
|
-
return
|
|
362
|
+
return b(this.recommendationConfigs.filters);
|
|
363
|
+
},
|
|
364
|
+
/**
|
|
365
|
+
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
366
|
+
* (not a getter) so reading it does not register reactive tracking on
|
|
367
|
+
* every block's recommendationConfigs across user edits.
|
|
368
|
+
*/
|
|
369
|
+
hasInvalidBlock() {
|
|
370
|
+
return Object.values(this.blockStates).some((t) => !P(t.recommendationConfigs, this));
|
|
362
371
|
},
|
|
363
372
|
// ====================================================================
|
|
364
373
|
// Per-Block Product Fetching
|
|
@@ -378,7 +387,8 @@ const P = () => ({
|
|
|
378
387
|
}
|
|
379
388
|
},
|
|
380
389
|
async _doFetchProducts() {
|
|
381
|
-
|
|
390
|
+
var p;
|
|
391
|
+
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = y(), s = {
|
|
382
392
|
locale: e.language,
|
|
383
393
|
currency: e.currencySettings.value,
|
|
384
394
|
partnerName: o.partnerName,
|
|
@@ -390,7 +400,7 @@ const P = () => ({
|
|
|
390
400
|
const l = parseInt(e.size) || 6;
|
|
391
401
|
let f;
|
|
392
402
|
try {
|
|
393
|
-
f = await h.fetchRecommendationProducts(
|
|
403
|
+
f = await h.fetchRecommendationProducts(i, s);
|
|
394
404
|
} catch {
|
|
395
405
|
f = [];
|
|
396
406
|
}
|
|
@@ -402,5 +412,5 @@ const P = () => ({
|
|
|
402
412
|
}
|
|
403
413
|
});
|
|
404
414
|
export {
|
|
405
|
-
|
|
415
|
+
M as useRecommendationExtensionStore
|
|
406
416
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useRecommendationExtensionStore as p } from "../../store/recommendation.js";
|
|
2
|
-
import { formatPrice as b } from "../../utils/priceFormatter.js";
|
|
3
|
-
import { sanitizeImageUrl as g, CUSTOM_CELL_HTML as u } from "../utils.js";
|
|
4
|
-
import { ATTR_PRODUCT_ATTR as m, ATTR_PRODUCT_BUTTON as h, ATTR_PRODUCT_OMNIBUS_DISCOUNT as y, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as x, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_IMAGE as $ } from "../../constants/selectors.js";
|
|
5
1
|
import { RecommendationBlockId as s } from "../../constants/blockIds.js";
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
|
|
4
|
+
import { formatPrice as $ } from "../../utils/priceFormatter.js";
|
|
5
|
+
import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as R } from "../utils.js";
|
|
6
6
|
const a = "0 5px", l = "attribute-cell";
|
|
7
|
-
function
|
|
8
|
-
const t =
|
|
7
|
+
function p() {
|
|
8
|
+
const t = _(), { currencySettings: e } = t.recommendationConfigs;
|
|
9
9
|
return {
|
|
10
10
|
code: e.value,
|
|
11
11
|
symbol: e.symbol,
|
|
@@ -16,14 +16,14 @@ function c() {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
function r(t, e = "price") {
|
|
19
|
-
const o =
|
|
20
|
-
return
|
|
19
|
+
const o = p(), n = t[e], d = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
20
|
+
return $({
|
|
21
21
|
price: d,
|
|
22
22
|
currency: o
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
[
|
|
25
|
+
const I = {
|
|
26
|
+
[x]: (t) => `
|
|
27
27
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
28
28
|
<table
|
|
29
29
|
class="product-card-segment"
|
|
@@ -40,7 +40,7 @@ const U = {
|
|
|
40
40
|
esd-extension-block-id="${s.IMAGE}">
|
|
41
41
|
<a target="_blank" href="${t.url}">
|
|
42
42
|
<img
|
|
43
|
-
src="${
|
|
43
|
+
src="${C(t.image_url)}"
|
|
44
44
|
alt="${t.name}"
|
|
45
45
|
style="display: block; max-width: 100%; height: auto;"
|
|
46
46
|
class="adapt-img">
|
|
@@ -51,7 +51,7 @@ const U = {
|
|
|
51
51
|
</table>
|
|
52
52
|
</td>
|
|
53
53
|
`,
|
|
54
|
-
[
|
|
54
|
+
[f]: (t) => `
|
|
55
55
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
56
56
|
<table
|
|
57
57
|
class="product-card-segment"
|
|
@@ -76,7 +76,7 @@ const U = {
|
|
|
76
76
|
</table>
|
|
77
77
|
</td>
|
|
78
78
|
`,
|
|
79
|
-
[
|
|
79
|
+
[T]: (t) => `
|
|
80
80
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
81
81
|
<table
|
|
82
82
|
class="product-card-segment"
|
|
@@ -100,7 +100,7 @@ const U = {
|
|
|
100
100
|
</table>
|
|
101
101
|
</td>
|
|
102
102
|
`,
|
|
103
|
-
[
|
|
103
|
+
[y]: (t) => `
|
|
104
104
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
105
105
|
<table
|
|
106
106
|
class="product-card-segment"
|
|
@@ -124,7 +124,7 @@ const U = {
|
|
|
124
124
|
</table>
|
|
125
125
|
</td>
|
|
126
126
|
`,
|
|
127
|
-
[
|
|
127
|
+
[h]: (t) => `
|
|
128
128
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
129
129
|
<table
|
|
130
130
|
class="product-card-segment"
|
|
@@ -152,8 +152,9 @@ const U = {
|
|
|
152
152
|
</table>
|
|
153
153
|
</td>
|
|
154
154
|
`,
|
|
155
|
-
[
|
|
156
|
-
|
|
155
|
+
[m]: (t) => {
|
|
156
|
+
var c, i;
|
|
157
|
+
const e = p(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, d = o > 0 ? Math.round((o - n) / o * 100) : 0, b = d > 0 ? `-${d}%` : "0%";
|
|
157
158
|
return `
|
|
158
159
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
159
160
|
<table
|
|
@@ -173,7 +174,7 @@ const U = {
|
|
|
173
174
|
esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
|
|
174
175
|
<p contenteditable="false" style="font-size: 12px; color: #666666;">
|
|
175
176
|
<span class="omnibus-text-before"></span>
|
|
176
|
-
<span class="omnibus-discount-value">${
|
|
177
|
+
<span class="omnibus-discount-value">${b}</span>
|
|
177
178
|
<span class="omnibus-text-after"></span>
|
|
178
179
|
</p>
|
|
179
180
|
</td>
|
|
@@ -183,7 +184,7 @@ const U = {
|
|
|
183
184
|
</td>
|
|
184
185
|
`;
|
|
185
186
|
},
|
|
186
|
-
[
|
|
187
|
+
[u]: () => `
|
|
187
188
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
188
189
|
<table
|
|
189
190
|
class="product-card-segment"
|
|
@@ -226,7 +227,7 @@ const U = {
|
|
|
226
227
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
227
228
|
* @param content - Display content for the cell
|
|
228
229
|
*/
|
|
229
|
-
[
|
|
230
|
+
[R]: (t, e) => `
|
|
230
231
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
231
232
|
<table
|
|
232
233
|
class="product-card-segment"
|
|
@@ -239,7 +240,7 @@ const U = {
|
|
|
239
240
|
<tbody>
|
|
240
241
|
<tr valign="top">
|
|
241
242
|
<td
|
|
242
|
-
${
|
|
243
|
+
${g}="${t}"
|
|
243
244
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
244
245
|
align="center"
|
|
245
246
|
esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
|
|
@@ -254,5 +255,5 @@ const U = {
|
|
|
254
255
|
export {
|
|
255
256
|
l as ATTRIBUTE_CELL_CLASS,
|
|
256
257
|
a as DEFAULT_CELL_PADDING,
|
|
257
|
-
|
|
258
|
+
I as gridElementRenderer
|
|
258
259
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ATTR_PRODUCT_BUTTON as s, ATTR_PRODUCT_OMNIBUS_DISCOUNT as d, ATTR_PRODUCT_OMNIBUS_PRICE as c, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as i, ATTR_PRODUCT_NAME as r, ATTR_PRODUCT_IMAGE as p } from "../../constants/selectors.js";
|
|
2
|
+
import { prepareGridProductRows as b } from "./template.js";
|
|
3
3
|
const u = `
|
|
4
4
|
<td
|
|
5
5
|
align="left"
|
|
@@ -55,7 +55,7 @@ const u = `
|
|
|
55
55
|
</table>
|
|
56
56
|
</td>
|
|
57
57
|
`, e = "0 5px", a = "attribute-cell", g = {
|
|
58
|
-
[
|
|
58
|
+
[p]: (t) => `
|
|
59
59
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
60
60
|
<table
|
|
61
61
|
class="product-card-segment"
|
|
@@ -83,7 +83,7 @@ const u = `
|
|
|
83
83
|
</table>
|
|
84
84
|
</td>
|
|
85
85
|
`,
|
|
86
|
-
[
|
|
86
|
+
[r]: (t) => `
|
|
87
87
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
88
88
|
<table
|
|
89
89
|
class="product-card-segment"
|
|
@@ -108,7 +108,7 @@ const u = `
|
|
|
108
108
|
</table>
|
|
109
109
|
</td>
|
|
110
110
|
`,
|
|
111
|
-
[
|
|
111
|
+
[i]: () => `
|
|
112
112
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
113
113
|
<table
|
|
114
114
|
class="product-card-segment"
|
|
@@ -133,7 +133,7 @@ const u = `
|
|
|
133
133
|
</table>
|
|
134
134
|
</td>
|
|
135
135
|
`,
|
|
136
|
-
[
|
|
136
|
+
[o]: () => `
|
|
137
137
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
138
138
|
<table
|
|
139
139
|
class="product-card-segment"
|
|
@@ -158,7 +158,7 @@ const u = `
|
|
|
158
158
|
</table>
|
|
159
159
|
</td>
|
|
160
160
|
`,
|
|
161
|
-
[
|
|
161
|
+
[c]: () => `
|
|
162
162
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
163
163
|
<table
|
|
164
164
|
class="product-card-segment"
|
|
@@ -186,7 +186,7 @@ const u = `
|
|
|
186
186
|
</table>
|
|
187
187
|
</td>
|
|
188
188
|
`,
|
|
189
|
-
[
|
|
189
|
+
[d]: () => `
|
|
190
190
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
191
191
|
<table
|
|
192
192
|
class="product-card-segment"
|
|
@@ -214,7 +214,7 @@ const u = `
|
|
|
214
214
|
</table>
|
|
215
215
|
</td>
|
|
216
216
|
`,
|
|
217
|
-
[
|
|
217
|
+
[s]: (t) => `
|
|
218
218
|
<td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
|
|
219
219
|
<table
|
|
220
220
|
class="product-card-segment"
|
|
@@ -243,7 +243,7 @@ const u = `
|
|
|
243
243
|
`
|
|
244
244
|
};
|
|
245
245
|
function T(t, l, n) {
|
|
246
|
-
return
|
|
246
|
+
return b(t, l, g, n);
|
|
247
247
|
}
|
|
248
248
|
export {
|
|
249
249
|
u as default,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
|
|
2
|
+
import { DEFAULT_CARD_COMPOSITION as E, spacer as I, getDefaultProducts as _, createBlockTemplate as S, DEFAULTS as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
|
|
3
|
+
import { gridElementRenderer as w, ATTRIBUTE_CELL_CLASS as D, DEFAULT_CELL_PADDING as C } from "./elementRenderer.js";
|
|
4
4
|
const O = `
|
|
5
5
|
<tr class="recommendation-product-row">
|
|
6
6
|
<td>
|
|
@@ -27,10 +27,10 @@ const O = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function P(t, e, o, r =
|
|
31
|
-
const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${
|
|
30
|
+
function P(t, e, o, r = E, n = {}) {
|
|
31
|
+
const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${D}" style="padding: ${C};" width="${c}%"></td>`, d = i > 0 ? l.repeat(i) : "", a = A(o, r, n);
|
|
32
32
|
return r.filter((s) => a[s]).map((s) => {
|
|
33
|
-
const T =
|
|
33
|
+
const T = f[s] ?? !0, u = T ? "" : 'style="display: none;"', R = t.map((m) => a[s](m).replace("<td", `<td width="${c}%"`)).join("");
|
|
34
34
|
return g.replace("{-{-ATTR_TYPE-}-}", s).replace("{-{-VISIBILITY-}-}", T ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", R + d);
|
|
35
35
|
}).join("");
|
|
36
36
|
}
|
|
@@ -46,15 +46,15 @@ function U(t, e, o, r, n = {}) {
|
|
|
46
46
|
r,
|
|
47
47
|
n
|
|
48
48
|
), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
|
|
49
|
-
return d > 0 ?
|
|
49
|
+
return d > 0 ? I + p : p;
|
|
50
50
|
}).join("");
|
|
51
51
|
}
|
|
52
52
|
function h(t, e, o, r = {}) {
|
|
53
|
-
return U(t, e,
|
|
53
|
+
return U(t, e, w, o, r);
|
|
54
54
|
}
|
|
55
55
|
function F(t) {
|
|
56
|
-
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o =
|
|
57
|
-
return o.replace("{-{-TITLE-}-}",
|
|
56
|
+
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = S("grid", e), r = _(), n = h(r, L);
|
|
57
|
+
return o.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
58
58
|
}
|
|
59
59
|
export {
|
|
60
60
|
F as getDefaultTemplate,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { prepareProductRows as c } from "./
|
|
3
|
-
import {
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
|
|
2
|
+
import { prepareProductRows as c } from "./grid/template.js";
|
|
3
|
+
import { prepareProductRows as R } from "./list/template.js";
|
|
4
4
|
function a(o, t, r = {}) {
|
|
5
5
|
if (t === "list")
|
|
6
|
-
return
|
|
7
|
-
const { productsPerRow: e =
|
|
8
|
-
return
|
|
6
|
+
return R(o, r.composition, r.filterList);
|
|
7
|
+
const { productsPerRow: e = s, composition: p, filterList: i } = r;
|
|
8
|
+
return c(o, e, p, i);
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
11
|
a as prepareProductRows
|