@useinsider/guido 3.2.0-beta.7e0c6bd → 3.2.0-beta.7fb9b70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -1
- package/dist/@types/config/schemas.js +153 -95
- package/dist/@types/config/validator.js +34 -27
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +95 -88
- package/dist/components/organisms/AutoSaveController.vue.js +17 -0
- package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
- 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/AutoSaveToggle.vue.js +22 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
- 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.vue.js +8 -8
- package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
- 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/useAutoSave.js +71 -0
- 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 +109 -101
- package/dist/composables/useHttp.js +30 -30
- package/dist/composables/usePartner.js +1 -1
- package/dist/composables/useRecommendation.js +46 -25
- package/dist/composables/useRibbonOffset.js +15 -15
- package/dist/composables/useSave.js +25 -21
- 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 +16 -23
- 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 +25 -25
- package/dist/config/compiler/unsubscribeCompilerRules.js +19 -17
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +105 -71
- package/dist/config/migrator/checkboxMigrator.js +21 -20
- package/dist/config/migrator/couponBlockMigrator.js +19 -18
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/itemsBlockMigrator.js +89 -87
- package/dist/config/migrator/radioButtonMigrator.js +63 -42
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -287
- package/dist/config/migrator/unsubscribeMigrator.js +11 -10
- package/dist/enums/extensions/recommendationBlock.js +2 -1
- 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/block.js +35 -32
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- 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 +34 -32
- 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 +240 -192
- 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/services/configService.js +65 -29
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +16 -8
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +150 -109
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +37 -27
- 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 +37 -26
- 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/utils/legacyStrategyMap.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +16 -13
- 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/_Hash.js +20 -0
- package/dist/node_modules/lodash-es/_ListCache.js +20 -0
- package/dist/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/lodash-es/_MapCache.js +20 -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/_Symbol.js +5 -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/_assocIndexOf.js +10 -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/_baseGetTag.js +10 -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/_baseIsNative.js +16 -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/_coreJsData.js +5 -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/_freeGlobal.js +4 -0
- package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
- package/dist/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/lodash-es/_getRawTag.js +15 -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 +6 -0
- package/dist/node_modules/lodash-es/_hasPath.js +19 -0
- package/dist/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/lodash-es/_hashSet.js +9 -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/_isKeyable.js +7 -0
- package/dist/node_modules/lodash-es/_isMasked.js +11 -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/_listCacheClear.js +6 -0
- package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
- package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -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/_nativeCreate.js +5 -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/_objectToString.js +7 -0
- package/dist/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/lodash-es/_root.js +5 -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/_toSource.js +17 -0
- package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
- package/dist/node_modules/lodash-es/eq.js +6 -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/isFunction.js +12 -0
- package/dist/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/lodash-es/isObject.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/memoize.js +18 -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 +458 -239
- package/dist/services/recommendationApi.js +17 -14
- package/dist/services/templateLibraryApi.js +40 -38
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +217 -0
- package/dist/src/@types/config/types.d.ts +9 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/composables/useAutoSave.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +58 -0
- package/dist/src/composables/useHtmlCompiler.d.ts +2 -1
- package/dist/src/composables/useRecommendation.d.ts +10 -1
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/composables/useTranslations.d.ts +1 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/autosave.d.ts +12 -0
- package/dist/src/stores/config.d.ts +522 -0
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/src/utils/timeUtil.d.ts +8 -0
- package/dist/stores/autosave.js +17 -0
- package/dist/stores/config.js +81 -25
- package/dist/stores/dynamic-content.js +11 -6
- package/dist/stores/editor.js +3 -1
- 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/htmlEscape.js +13 -0
- package/dist/utils/pairProductVariables.js +89 -87
- package/dist/utils/templatePreparation.js +72 -32
- package/dist/utils/timeUtil.js +19 -0
- package/package.json +7 -6
- package/dist/enums/displayConditions.js +0 -80
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/src/enums/displayConditions.d.ts +0 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var G = Object.defineProperty;
|
|
2
2
|
var P = (u, s, t) => s in u ? G(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
3
|
+
var C = (u, s, t) => P(u, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ModificationDescription as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as R } from "../../../common-control.js";
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as M } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as g, DEFAULT_ROW_SPACING as E } from "../../constants/layout.js";
|
|
6
8
|
import { RecommendationConfigService as p } from "../../services/configService.js";
|
|
7
9
|
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
8
10
|
import { safeGetStyle as L, safeGetParent as V } from "../../utils/tagName.js";
|
|
9
|
-
import { getCurrentLayout as
|
|
10
|
-
import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as M } from "../../constants/layout.js";
|
|
11
|
-
import { DESKTOP_CONTAINER_SELECTOR as f, MOBILE_CONTAINER_SELECTOR as E } from "../../constants/selectors.js";
|
|
11
|
+
import { getCurrentLayout as f, getBlockElement as B } from "../main/utils.js";
|
|
12
12
|
import { useDebounceFn as O } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
13
|
const U = "recommendation-spacing-control", n = {
|
|
14
14
|
COLUMN_SPACING: "columnSpacing",
|
|
@@ -34,31 +34,31 @@ function I(u, s) {
|
|
|
34
34
|
class j extends R {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
C(this, "store", w());
|
|
38
|
+
C(this, "unsubscribeOrientation", null);
|
|
39
39
|
/**
|
|
40
40
|
* Debounced version of _onColumnSpacingChange
|
|
41
41
|
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
C(this, "_debouncedOnColumnSpacingChange", O((t) => {
|
|
44
44
|
this._onColumnSpacingChange(t);
|
|
45
45
|
}, 300));
|
|
46
46
|
/**
|
|
47
47
|
* Debounced version of _onRowSpacingChange
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
C(this, "_debouncedOnRowSpacingChange", O((t) => {
|
|
50
50
|
this._onRowSpacingChange(t);
|
|
51
51
|
}, 300));
|
|
52
52
|
/**
|
|
53
53
|
* Debounced version of _onMobileColumnSpacingChange
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
C(this, "_debouncedOnMobileColumnSpacingChange", O((t) => {
|
|
56
56
|
this._onMobileColumnSpacingChange(t);
|
|
57
57
|
}, 300));
|
|
58
58
|
/**
|
|
59
59
|
* Debounced version of _onMobileRowSpacingChange
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
C(this, "_debouncedOnMobileRowSpacingChange", O((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
@@ -132,7 +132,7 @@ class j extends R {
|
|
|
132
132
|
_updateSpacingVisibility() {
|
|
133
133
|
if (!this.api)
|
|
134
134
|
return;
|
|
135
|
-
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e ||
|
|
135
|
+
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || f(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, c = t.mobileCardsInRow > 1;
|
|
136
136
|
this.api.setVisibility(n.COLUMN_SPACING, i && r), this.api.setVisibility(n.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(n.ROW_SPACING, !0), this.api.setVisibility(n.ROW_SPACING_LABEL, !0), this.api.setVisibility(
|
|
137
137
|
n.MOBILE_COLUMN_SPACING,
|
|
138
138
|
i && a && c
|
|
@@ -165,20 +165,20 @@ class j extends R {
|
|
|
165
165
|
*/
|
|
166
166
|
_getStoredColumnSpacing() {
|
|
167
167
|
if (!this.currentNode)
|
|
168
|
-
return
|
|
169
|
-
const t = this.currentNode.querySelector(
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
168
|
+
return g;
|
|
169
|
+
const t = this.currentNode.querySelector(S) ?? this.currentNode;
|
|
170
|
+
if (f(this.currentNode) === "grid") {
|
|
171
|
+
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d = L(l, "padding");
|
|
172
172
|
if (!d)
|
|
173
|
-
return
|
|
173
|
+
return g;
|
|
174
174
|
const y = d.trim().split(/\s+/);
|
|
175
|
-
return y.length < 2 ?
|
|
175
|
+
return y.length < 2 ? g : I(y[1], g / 2) * 2;
|
|
176
176
|
}
|
|
177
177
|
const o = t.querySelector(".product-card-wrapper") ?? null, i = V(o), a = L(i, "padding");
|
|
178
178
|
if (!a)
|
|
179
|
-
return
|
|
179
|
+
return g;
|
|
180
180
|
const r = a.trim().split(/\s+/);
|
|
181
|
-
return r.length < 2 ?
|
|
181
|
+
return r.length < 2 ? g : I(r[1], g / 2) * 2;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -186,9 +186,9 @@ class j extends R {
|
|
|
186
186
|
*/
|
|
187
187
|
_getStoredRowSpacing() {
|
|
188
188
|
if (!this.currentNode)
|
|
189
|
-
return
|
|
190
|
-
const e = (this.currentNode.querySelector(
|
|
191
|
-
return I(o,
|
|
189
|
+
return E;
|
|
190
|
+
const e = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer") ?? null, o = L(e, "height");
|
|
191
|
+
return I(o, E);
|
|
192
192
|
}
|
|
193
193
|
// ========================================================================
|
|
194
194
|
// Desktop Spacing Handlers
|
|
@@ -206,7 +206,7 @@ class j extends R {
|
|
|
206
206
|
{ columnSpacing: t },
|
|
207
207
|
`Changed column spacing to ${t}px`
|
|
208
208
|
), this._storeDataAttribute(A.COLUMN_SPACING, t);
|
|
209
|
-
const o = p.getConfig(this.currentNode).layout ||
|
|
209
|
+
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(S);
|
|
210
210
|
c && (o === "grid" ? Array.from(
|
|
211
211
|
c.querySelectorAll(".attribute-cell")
|
|
212
212
|
).forEach((l) => {
|
|
@@ -216,7 +216,7 @@ class j extends R {
|
|
|
216
216
|
).forEach((l) => {
|
|
217
217
|
const d = "parent" in l ? l.parent() : void 0;
|
|
218
218
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
219
|
-
}), i.apply(new
|
|
219
|
+
}), i.apply(new m(`Update column spacing to ${t}px`)));
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Handles row spacing changes for desktop.
|
|
@@ -231,7 +231,7 @@ class j extends R {
|
|
|
231
231
|
{ rowSpacing: t },
|
|
232
232
|
`Changed row spacing to ${t}px`
|
|
233
233
|
), this._storeDataAttribute(A.ROW_SPACING, t);
|
|
234
|
-
const e = this.currentNode.querySelector(
|
|
234
|
+
const e = this.currentNode.querySelector(S);
|
|
235
235
|
if (!e)
|
|
236
236
|
return;
|
|
237
237
|
const o = Array.from(
|
|
@@ -242,7 +242,7 @@ class j extends R {
|
|
|
242
242
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
243
243
|
o.forEach((r) => {
|
|
244
244
|
i.modifyHtml(r).setStyle("height", a);
|
|
245
|
-
}), i.apply(new
|
|
245
|
+
}), i.apply(new m(`Update row spacing to ${t}px`));
|
|
246
246
|
}
|
|
247
247
|
// ========================================================================
|
|
248
248
|
// Mobile Spacing Handlers
|
|
@@ -260,7 +260,7 @@ class j extends R {
|
|
|
260
260
|
{ mobileColumnSpacing: t },
|
|
261
261
|
`Changed mobile column spacing to ${t}px`
|
|
262
262
|
), this._storeDataAttribute(A.MOBILE_COLUMN_SPACING, t);
|
|
263
|
-
const o = p.getConfig(this.currentNode).layout ||
|
|
263
|
+
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(M);
|
|
264
264
|
c && (o === "grid" ? Array.from(
|
|
265
265
|
c.querySelectorAll(".attribute-cell")
|
|
266
266
|
).forEach((l) => {
|
|
@@ -270,7 +270,7 @@ class j extends R {
|
|
|
270
270
|
).forEach((l) => {
|
|
271
271
|
const d = "parent" in l ? l.parent() : void 0;
|
|
272
272
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
273
|
-
}), i.apply(new
|
|
273
|
+
}), i.apply(new m(`Update mobile column spacing to ${t}px`)));
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* Handles row spacing changes for mobile.
|
|
@@ -285,7 +285,7 @@ class j extends R {
|
|
|
285
285
|
{ mobileRowSpacing: t },
|
|
286
286
|
`Changed mobile row spacing to ${t}px`
|
|
287
287
|
), this._storeDataAttribute(A.MOBILE_ROW_SPACING, t);
|
|
288
|
-
const e = this.currentNode.querySelector(
|
|
288
|
+
const e = this.currentNode.querySelector(M);
|
|
289
289
|
if (!e)
|
|
290
290
|
return;
|
|
291
291
|
const o = Array.from(
|
|
@@ -296,7 +296,7 @@ class j extends R {
|
|
|
296
296
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
297
297
|
o.forEach((r) => {
|
|
298
298
|
i.modifyHtml(r).setStyle("height", a);
|
|
299
|
-
}), i.apply(new
|
|
299
|
+
}), i.apply(new m(`Update mobile row spacing to ${t}px`));
|
|
300
300
|
}
|
|
301
301
|
// ========================================================================
|
|
302
302
|
// Data Attribute Storage
|
|
@@ -306,7 +306,7 @@ class j extends R {
|
|
|
306
306
|
*/
|
|
307
307
|
_storeDataAttribute(t, e) {
|
|
308
308
|
const o = B(this.currentNode);
|
|
309
|
-
o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new
|
|
309
|
+
o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new m(`Store ${t}`));
|
|
310
310
|
}
|
|
311
311
|
// ========================================================================
|
|
312
312
|
// Event Listeners
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UIElementType as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { RecommendationControlId as
|
|
7
|
-
const
|
|
8
|
-
class
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var _ = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UIElementType as c, UEAttr as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as d } from "../../common-control.js";
|
|
6
|
+
import { RecommendationControlId as C } from "../constants/controlIds.js";
|
|
7
|
+
const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
|
|
8
|
+
class h extends d {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
|
-
|
|
11
|
+
a(this, "_repositionedElement", null);
|
|
12
12
|
}
|
|
13
13
|
getId() {
|
|
14
|
-
return
|
|
14
|
+
return S;
|
|
15
15
|
}
|
|
16
16
|
getTemplate() {
|
|
17
17
|
return `
|
|
18
18
|
<div class="${r}">
|
|
19
|
-
<${
|
|
20
|
-
${
|
|
19
|
+
<${c.ICON}
|
|
20
|
+
${p.ICON.src}="migration-info-icon"
|
|
21
21
|
class="${r}__icon">
|
|
22
|
-
</${
|
|
22
|
+
</${c.ICON}>
|
|
23
23
|
<p class="${r}__text">
|
|
24
|
-
${this.api.translate(
|
|
24
|
+
${this.api.translate(u)}
|
|
25
25
|
</p>
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
@@ -30,7 +30,8 @@ class f extends p {
|
|
|
30
30
|
this._repositionAboveTabs();
|
|
31
31
|
}
|
|
32
32
|
onDestroy() {
|
|
33
|
-
|
|
33
|
+
var t;
|
|
34
|
+
super.onDestroy(), (t = this._repositionedElement) == null || t.remove(), this._repositionedElement = null;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Moves the info message from inside the Settings tab content
|
|
@@ -47,6 +48,7 @@ class f extends p {
|
|
|
47
48
|
* The element reference is stored so onDestroy() can remove it.
|
|
48
49
|
*/
|
|
49
50
|
_repositionAboveTabs() {
|
|
51
|
+
var l;
|
|
50
52
|
const n = this.getContainer().querySelector(`.${r}`);
|
|
51
53
|
if (!n)
|
|
52
54
|
return;
|
|
@@ -54,10 +56,10 @@ class f extends p {
|
|
|
54
56
|
if (!i)
|
|
55
57
|
return;
|
|
56
58
|
const s = i.querySelector("ue-tabs-header");
|
|
57
|
-
s && (s.parentElement
|
|
59
|
+
s && ((l = s.parentElement) == null || l.insertBefore(n, s), this._repositionedElement = n);
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
S as SYNC_INFO_MESSAGE_CONTROL_ID,
|
|
64
|
+
h as SyncInfoMessageControl
|
|
63
65
|
};
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { RecommendationBlock as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
2
|
+
import { RecommendationBlock as m } from "./block.js";
|
|
3
|
+
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
4
|
+
import "./store/recommendation.js";
|
|
5
|
+
import { NameControls as i } from "./controls/name/index.js";
|
|
6
|
+
import { PriceControls as e } from "./controls/price/index.js";
|
|
7
|
+
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
8
|
+
import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
|
|
9
|
+
import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
|
|
10
|
+
import { ButtonControls as p } from "./controls/button/index.js";
|
|
11
|
+
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
|
+
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
13
|
+
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
14
|
+
import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
|
|
15
|
+
import { RecommendationCardCompositionControl as u } from "./controls/cardComposition/index.js";
|
|
16
|
+
import { SyncInfoMessageControl as g } from "./controls/syncInfoMessage.js";
|
|
17
|
+
import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
|
|
18
|
+
import y from "./recommendation.css.js";
|
|
19
|
+
import { SettingsPanel as B } from "./settingsPanel.js";
|
|
19
20
|
const b = [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
d,
|
|
23
|
-
u,
|
|
24
|
-
g,
|
|
25
|
-
R,
|
|
26
|
-
y,
|
|
27
|
-
B
|
|
28
|
-
], P = [
|
|
21
|
+
i,
|
|
22
|
+
e,
|
|
29
23
|
s,
|
|
30
24
|
l,
|
|
31
25
|
a,
|
|
32
26
|
p,
|
|
33
|
-
c
|
|
27
|
+
c,
|
|
28
|
+
C
|
|
29
|
+
], P = [
|
|
30
|
+
n,
|
|
31
|
+
d,
|
|
32
|
+
f,
|
|
33
|
+
u,
|
|
34
|
+
g
|
|
34
35
|
], S = [
|
|
35
36
|
...P,
|
|
36
37
|
...b.flatMap((o) => Object.values(o))
|
|
37
|
-
],
|
|
38
|
+
], K = S.reduce(
|
|
38
39
|
(o, t) => o.addControl(t),
|
|
39
|
-
new r().addBlock(
|
|
40
|
-
).addStyles(
|
|
40
|
+
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
|
+
).addStyles(y).withIconsRegistry(R).build();
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
K as default
|
|
43
44
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CURRENT_CONFIG_VERSION as
|
|
3
|
-
import { setCurrencyAttributes as
|
|
4
|
-
import { hasMinimalConfig as
|
|
5
|
-
|
|
1
|
+
import { ModificationDescription as h } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CURRENT_CONFIG_VERSION as l, DEFAULT_NODE_CONFIG as r } from "../constants/defaultConfig.js";
|
|
3
|
+
import { setCurrencyAttributes as D } from "../controls/main/utils.js";
|
|
4
|
+
import { hasMinimalConfig as A } from "../types/nodeConfig.js";
|
|
5
|
+
function S(e) {
|
|
6
|
+
return e === "." || e === "," || e === " ";
|
|
7
|
+
}
|
|
8
|
+
function N(e) {
|
|
9
|
+
return e === "." || e === "," || e === " " || e === "";
|
|
10
|
+
}
|
|
11
|
+
class V {
|
|
6
12
|
// ========================================================================
|
|
7
13
|
// Read Operations
|
|
8
14
|
// ========================================================================
|
|
@@ -42,7 +48,7 @@ class C {
|
|
|
42
48
|
return !1;
|
|
43
49
|
try {
|
|
44
50
|
const t = i.getNodeConfig();
|
|
45
|
-
return
|
|
51
|
+
return A(t);
|
|
46
52
|
} catch {
|
|
47
53
|
return !1;
|
|
48
54
|
}
|
|
@@ -77,8 +83,8 @@ class C {
|
|
|
77
83
|
* @returns The new complete configuration
|
|
78
84
|
*/
|
|
79
85
|
static updateConfig(i, t, o, n) {
|
|
80
|
-
const
|
|
81
|
-
return this.saveConfig(i, t,
|
|
86
|
+
const c = this.getConfig(t), u = this.deepMerge(c, o);
|
|
87
|
+
return this.saveConfig(i, t, u, n), u;
|
|
82
88
|
}
|
|
83
89
|
/**
|
|
84
90
|
* Initialize configuration for a new block
|
|
@@ -95,7 +101,7 @@ class C {
|
|
|
95
101
|
*/
|
|
96
102
|
static initializeConfig(i, t, o) {
|
|
97
103
|
const n = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
|
|
98
|
-
return this.saveConfig(i, t, n, "Initialize recommendation block"),
|
|
104
|
+
return this.saveConfig(i, t, n, "Initialize recommendation block"), D({
|
|
99
105
|
currentNode: t,
|
|
100
106
|
documentModifier: i.getDocumentModifier(),
|
|
101
107
|
currency: n.currency
|
|
@@ -112,9 +118,9 @@ class C {
|
|
|
112
118
|
*/
|
|
113
119
|
static saveConfig(i, t, o, n) {
|
|
114
120
|
try {
|
|
115
|
-
i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new
|
|
116
|
-
} catch (
|
|
117
|
-
console.warn("[RecommendationConfigService] Failed to save config:",
|
|
121
|
+
i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new h(n));
|
|
122
|
+
} catch (c) {
|
|
123
|
+
console.warn("[RecommendationConfigService] Failed to save config:", c);
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
// ========================================================================
|
|
@@ -125,23 +131,53 @@ class C {
|
|
|
125
131
|
*
|
|
126
132
|
* Reads existing data-attributes and creates a proper node config.
|
|
127
133
|
* Used when loading templates created before node config was implemented.
|
|
134
|
+
*
|
|
135
|
+
* Sources, in priority order (later overrides earlier):
|
|
136
|
+
* 1. `esd-ext-config` JSON blob — emitted by the recommendation migrator and
|
|
137
|
+
* by hand-authored new templates. Carries the full RecommendationNodeConfig
|
|
138
|
+
* (strategy, language, currency, filters, productIds, etc.) which the
|
|
139
|
+
* discrete data-* attrs below cannot capture.
|
|
140
|
+
* 2. Discrete `data-*` attributes — runtime source of truth for
|
|
141
|
+
* layout/composition/spacing; controls keep these in sync as the user
|
|
142
|
+
* edits, so we let them override the JSON blob if they disagree.
|
|
143
|
+
* 3. `currency-*` attributes — durable currency source on the block element.
|
|
128
144
|
* @param api - Stripo extension API with document modifier
|
|
129
145
|
* @param node - The block node to migrate
|
|
130
146
|
* @returns The migrated configuration
|
|
131
147
|
*/
|
|
132
148
|
static migrateFromDataAttributes(i, t) {
|
|
133
149
|
const o = {
|
|
134
|
-
configVersion:
|
|
150
|
+
configVersion: l
|
|
135
151
|
};
|
|
136
152
|
if ("getAttribute" in t && typeof t.getAttribute == "function") {
|
|
137
|
-
const n = t.getAttribute("
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
c
|
|
153
|
+
const n = t.getAttribute("esd-ext-config");
|
|
154
|
+
if (n)
|
|
155
|
+
try {
|
|
156
|
+
const s = JSON.parse(n);
|
|
157
|
+
s && typeof s == "object" && (Object.assign(o, s), o.configVersion = l);
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
const c = t.getAttribute("data-layout");
|
|
161
|
+
c === "list" || c === "horizontal" ? o.layout = "list" : (c === "grid" || c === "vertical") && (o.layout = "grid");
|
|
162
|
+
const u = t.getAttribute("data-card-composition");
|
|
163
|
+
u && (o.composition = u.split(",").filter(Boolean));
|
|
164
|
+
const p = t.getAttribute("data-column-spacing");
|
|
165
|
+
p && (o.columnSpacing = parseInt(p) || r.columnSpacing);
|
|
166
|
+
const b = t.getAttribute("data-row-spacing");
|
|
167
|
+
if (b && (o.rowSpacing = parseInt(b) || r.rowSpacing), !o.currency) {
|
|
168
|
+
const s = t.getAttribute("currency"), y = t.getAttribute("currency-symbol"), d = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
|
|
169
|
+
if (s || y || d || f || g || m) {
|
|
170
|
+
const a = r.currency, C = m ? parseInt(m) : NaN;
|
|
171
|
+
o.currency = {
|
|
172
|
+
code: s ?? a.code,
|
|
173
|
+
symbol: y ?? a.symbol,
|
|
174
|
+
alignment: d === "0" ? "before" : "after",
|
|
175
|
+
decimalCount: Number.isFinite(C) ? C : a.decimalCount,
|
|
176
|
+
decimalSeparator: S(g) ? g : a.decimalSeparator,
|
|
177
|
+
thousandSeparator: N(f) ? f : a.thousandSeparator
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
145
181
|
}
|
|
146
182
|
return this.initializeConfig(i, t, o);
|
|
147
183
|
}
|
|
@@ -151,7 +187,7 @@ class C {
|
|
|
151
187
|
* @returns True if migration is needed
|
|
152
188
|
*/
|
|
153
189
|
static needsMigration(i) {
|
|
154
|
-
return i ? this.hasConfig(i) ? this.getConfigVersion(i) <
|
|
190
|
+
return i ? this.hasConfig(i) ? this.getConfigVersion(i) < l : !0 : !1;
|
|
155
191
|
}
|
|
156
192
|
// ========================================================================
|
|
157
193
|
// Internal Helpers
|
|
@@ -161,12 +197,12 @@ class C {
|
|
|
161
197
|
*/
|
|
162
198
|
static cloneDefaults() {
|
|
163
199
|
return {
|
|
164
|
-
...
|
|
165
|
-
currency: { ...
|
|
166
|
-
omnibusPrice: { ...
|
|
167
|
-
omnibusDiscount: { ...
|
|
168
|
-
composition: [...
|
|
169
|
-
visibility: { ...
|
|
200
|
+
...r,
|
|
201
|
+
currency: { ...r.currency },
|
|
202
|
+
omnibusPrice: { ...r.omnibusPrice },
|
|
203
|
+
omnibusDiscount: { ...r.omnibusDiscount },
|
|
204
|
+
composition: [...r.composition],
|
|
205
|
+
visibility: { ...r.visibility },
|
|
170
206
|
filters: [],
|
|
171
207
|
productIds: [],
|
|
172
208
|
recommendationId: 0
|
|
@@ -236,5 +272,5 @@ class C {
|
|
|
236
272
|
}
|
|
237
273
|
}
|
|
238
274
|
export {
|
|
239
|
-
|
|
275
|
+
V as RecommendationConfigService
|
|
240
276
|
};
|
|
@@ -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
|
};
|