@useinsider/guido 2.1.0 → 2.2.0-beta.071f000
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 +36 -0
- package/dist/@types/config/schemas.js +71 -66
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +69 -58
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +37 -23
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
- package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useActionsApi.js +15 -13
- package/dist/composables/useBlocksConfig.js +26 -16
- package/dist/composables/useHtmlValidator.js +114 -104
- package/dist/composables/useRecommendation.js +54 -21
- package/dist/composables/useStripo.js +25 -23
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/recommendationCompilerRules.js +45 -39
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -0
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +7 -0
- package/dist/config/i18n/en/toasters.json.js +56 -0
- package/dist/config/i18n/en/tooltips.json.js +82 -0
- package/dist/config/i18n/index.js +7 -0
- package/dist/config/migrator/itemsBlockMigrator.js +142 -120
- package/dist/config/migrator/recommendationMigrator.js +3 -3
- package/dist/enums/defaults.js +8 -4
- package/dist/enums/extensions/recommendationBlock.js +1 -1
- package/dist/enums/recommendation.js +16 -15
- package/dist/extensions/Blocks/Items/block.js +19 -28
- package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +137 -89
- package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +35 -47
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +49 -54
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +42 -51
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -36
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -60
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
- package/dist/extensions/Blocks/Items/template.js +181 -175
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
- package/dist/extensions/Blocks/Recommendation/block.js +133 -9
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +69 -0
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +24 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +23 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +104 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +102 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +207 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +52 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +340 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +70 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +168 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +67 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +381 -0
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +108 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +346 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -43
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
- package/dist/extensions/Blocks/Recommendation/services/configService.js +240 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +128 -72
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +353 -219
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +228 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +66 -0
- package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +169 -0
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +134 -0
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +12 -12
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +36 -0
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/extensions/Blocks/common-control.js +91 -92
- package/dist/extensions/Blocks/controlFactories.js +125 -93
- package/dist/extensions/ModulesTabIcons/extension.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +317 -198
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +11 -8
- package/dist/services/stripoApi.js +20 -17
- package/dist/services/templateLibraryApi.js +16 -13
- package/dist/src/@types/config/schemas.d.ts +10 -2
- package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
- package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
- package/dist/src/config/i18n/en/index.d.ts +1 -0
- package/dist/src/config/i18n/index.d.ts +16 -0
- package/dist/src/enums/defaults.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +67 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +19 -11
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +55 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +45 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +42 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +25 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +24 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +52 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +107 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +60 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +234 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +116 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +60 -0
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +155 -468
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +43 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +66 -0
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +174 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -5
- package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/static/styles/components/notification.css.js +19 -0
- package/dist/static/styles/components/tools.css.js +6 -2
- package/dist/static/styles/components/version-history.css.js +10 -2
- package/dist/static/styles/components/wide-panel.css.js +18 -6
- package/dist/static/styles/customEditorStyle.css.js +66 -2
- package/dist/static/styles/variables.css.js +2 -0
- package/dist/static/templates/empty/index.html.js +74 -0
- package/dist/static/templates/empty/style.css.js +779 -0
- package/dist/stores/unsubscribe.js +37 -34
- package/dist/utils/pairProductVariables.js +57 -56
- package/dist/utils/templatePreparation.js +15 -14
- package/package.json +3 -3
- package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -103
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -5
- package/dist/extensions/Blocks/Recommendation/control.js +0 -306
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/image/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -160
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -152
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -180
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -28
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -44
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var n = Object.defineProperty;
|
|
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
|
+
import { CommonControl as s } from "../../../common-control.js";
|
|
5
|
+
import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
|
|
6
|
+
const d = "recommendation-filters-control", a = {
|
|
7
|
+
FILTERS: "filterStatus"
|
|
8
|
+
};
|
|
9
|
+
class h extends s {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
r(this, "store", l());
|
|
13
|
+
r(this, "addFilterListener", () => {
|
|
14
|
+
});
|
|
15
|
+
r(this, "addFilterButton", null);
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return d;
|
|
19
|
+
}
|
|
20
|
+
getTemplate() {
|
|
21
|
+
return `
|
|
22
|
+
<div class="filters-control-container">
|
|
23
|
+
${this._GuTwoColumns([
|
|
24
|
+
this._GuLabel({ text: "Filters" }),
|
|
25
|
+
this._GuButton({
|
|
26
|
+
name: a.FILTERS,
|
|
27
|
+
label: "Add Filter",
|
|
28
|
+
id: "guido__btn-add-filter"
|
|
29
|
+
})
|
|
30
|
+
])}
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
onRender() {
|
|
35
|
+
this._setupButtonListener();
|
|
36
|
+
}
|
|
37
|
+
onDestroy() {
|
|
38
|
+
var t;
|
|
39
|
+
(t = this.addFilterButton) == null || t.removeEventListener("click", this.addFilterListener);
|
|
40
|
+
}
|
|
41
|
+
_onFilterSelectClick() {
|
|
42
|
+
this.store.openFilterDrawer();
|
|
43
|
+
}
|
|
44
|
+
_setupButtonListener() {
|
|
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);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
d as FILTERS_CONTROL_ID,
|
|
51
|
+
h as FiltersControl
|
|
52
|
+
};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var C = (d, c, t) => c in d ? g(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
|
|
3
|
+
var i = (d, c, t) => C(d, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
import { CommonControl as p } from "../../../common-control.js";
|
|
5
|
+
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
|
+
import { RecommendationConfigService as m } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
|
+
import { AlgorithmControl as R } from "./algorithm.js";
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as H } from "./algorithm.js";
|
|
10
|
+
import { CurrencyControl as N } from "./currency.js";
|
|
11
|
+
import { CURRENCY_CONTROL_ID as K } from "./currency.js";
|
|
12
|
+
import { FiltersControl as b } from "./filters.js";
|
|
13
|
+
import { FILTERS_CONTROL_ID as J } from "./filters.js";
|
|
14
|
+
import { LocaleControl as _ } from "./locale.js";
|
|
15
|
+
import { LOCALE_CONTROL_ID as X } from "./locale.js";
|
|
16
|
+
import { ProductLayoutControl as I } from "./productLayout.js";
|
|
17
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as tt } from "./productLayout.js";
|
|
18
|
+
import { ShuffleControl as S } from "./shuffle.js";
|
|
19
|
+
import { SHUFFLE_CONTROL_ID as ot } from "./shuffle.js";
|
|
20
|
+
import { getBlockElement as P, updateProductContentInPlace as T, regenerateProductRowsWithStyles as L } from "./utils.js";
|
|
21
|
+
import { adjustProductsToSize as nt, formatProductPrice as st, getCardComposition as it, getCurrentLayout as at, reapplySpacing as ct, regenerateMobileProductRows as lt, regenerateProductRows as ut, setCurrencyAttributes as dt, updatePricesInPlace as mt, updateSingleProductContent as ht } from "./utils.js";
|
|
22
|
+
import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
23
|
+
const k = "recommendation-id", D = "ui-elements-recommendation-block";
|
|
24
|
+
class W extends p {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
i(this, "store", y());
|
|
28
|
+
i(this, "storeUnsubscription", () => {
|
|
29
|
+
});
|
|
30
|
+
// Sub-control instances for lifecycle management
|
|
31
|
+
i(this, "algorithmControl", null);
|
|
32
|
+
i(this, "localeControl", null);
|
|
33
|
+
i(this, "currencyControl", null);
|
|
34
|
+
i(this, "productLayoutControl", null);
|
|
35
|
+
i(this, "filtersControl", null);
|
|
36
|
+
i(this, "shuffleControl", null);
|
|
37
|
+
/**
|
|
38
|
+
* Debounced product fetch to prevent rapid API calls during config changes
|
|
39
|
+
*/
|
|
40
|
+
i(this, "_debouncedFetchProducts", h(() => {
|
|
41
|
+
this.store.fetchRecommendationProducts();
|
|
42
|
+
}, 500));
|
|
43
|
+
/**
|
|
44
|
+
* Debounced content update when products arrive from API.
|
|
45
|
+
*
|
|
46
|
+
* Tries in-place update first (preserves user-applied styles) — this succeeds
|
|
47
|
+
* when the product count matches the DOM (algorithm/locale/currency changes).
|
|
48
|
+
*
|
|
49
|
+
* Falls back to full regeneration when product count differs from DOM — this
|
|
50
|
+
* happens after "Number of Products" changes where the DOM still has the old
|
|
51
|
+
* count. The store pads products to the configured size, so in-place only
|
|
52
|
+
* fails when the size actually changed.
|
|
53
|
+
*/
|
|
54
|
+
i(this, "_debouncedRegenerateWithProducts", h(() => {
|
|
55
|
+
const t = this.store.recommendationProducts;
|
|
56
|
+
if (!this.currentNode || !this.api)
|
|
57
|
+
return;
|
|
58
|
+
const e = this.api.getDocumentModifier();
|
|
59
|
+
T({
|
|
60
|
+
currentNode: this.currentNode,
|
|
61
|
+
documentModifier: e,
|
|
62
|
+
products: t
|
|
63
|
+
}) || L({
|
|
64
|
+
currentNode: this.currentNode,
|
|
65
|
+
documentModifier: e,
|
|
66
|
+
products: t
|
|
67
|
+
});
|
|
68
|
+
}, 100));
|
|
69
|
+
}
|
|
70
|
+
getId() {
|
|
71
|
+
return D;
|
|
72
|
+
}
|
|
73
|
+
getTemplate() {
|
|
74
|
+
return this.algorithmControl = new R(), this.localeControl = new _(), this.currencyControl = new N(), this.productLayoutControl = new I(), this.filtersControl = new b(), this.shuffleControl = new S(), `
|
|
75
|
+
<div class="recommendation-controls-container">
|
|
76
|
+
${this.algorithmControl.getTemplate()}
|
|
77
|
+
${this.localeControl.getTemplate()}
|
|
78
|
+
${this.currencyControl.getTemplate()}
|
|
79
|
+
${this.filtersControl.getTemplate()}
|
|
80
|
+
${this.productLayoutControl.getTemplate()}
|
|
81
|
+
${this.shuffleControl.getTemplate()}
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
async onRender() {
|
|
86
|
+
var e;
|
|
87
|
+
const t = this._getRecommendationIdFromNode(this.currentNode) ?? this.store.currentRecommendationId;
|
|
88
|
+
if (t !== null && this.store.setCurrentBlock(t), this._listenStateUpdates(), t !== null && ((e = this.store.blockStates[t]) != null && e.isInitialized)) {
|
|
89
|
+
this._initializeSubControls();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
await this._fetchBlockData(t), this._initializeSubControls();
|
|
93
|
+
}
|
|
94
|
+
onTemplateNodeUpdated(t) {
|
|
95
|
+
var r;
|
|
96
|
+
super.onTemplateNodeUpdated(t);
|
|
97
|
+
const e = this._getRecommendationIdFromNode(t);
|
|
98
|
+
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e), [
|
|
99
|
+
this.algorithmControl,
|
|
100
|
+
this.localeControl,
|
|
101
|
+
this.currencyControl,
|
|
102
|
+
this.productLayoutControl,
|
|
103
|
+
this.filtersControl,
|
|
104
|
+
this.shuffleControl
|
|
105
|
+
].forEach((n) => {
|
|
106
|
+
var s;
|
|
107
|
+
n != null && n.api && (n.currentNode = t, (s = n.onTemplateNodeUpdated) == null || s.call(n, t));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
onDestroy() {
|
|
111
|
+
this.storeUnsubscription(), [
|
|
112
|
+
this.algorithmControl,
|
|
113
|
+
this.localeControl,
|
|
114
|
+
this.currencyControl,
|
|
115
|
+
this.productLayoutControl,
|
|
116
|
+
this.filtersControl,
|
|
117
|
+
this.shuffleControl
|
|
118
|
+
].forEach((e) => {
|
|
119
|
+
var o;
|
|
120
|
+
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Initialize all sub-controls with the shared API context
|
|
125
|
+
* Each sub-control manages its own form values and event listeners
|
|
126
|
+
*/
|
|
127
|
+
_initializeSubControls() {
|
|
128
|
+
[
|
|
129
|
+
this.algorithmControl,
|
|
130
|
+
this.localeControl,
|
|
131
|
+
this.currencyControl,
|
|
132
|
+
this.productLayoutControl,
|
|
133
|
+
this.filtersControl,
|
|
134
|
+
this.shuffleControl
|
|
135
|
+
].forEach((e) => {
|
|
136
|
+
var o;
|
|
137
|
+
e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Syncs persisted node config into the Pinia store's block state.
|
|
142
|
+
*
|
|
143
|
+
* setCurrentBlock() creates a default entry (USD, en_US, mostPopular).
|
|
144
|
+
* For saved templates, the real config lives in the node (e.g., TRY, tr_TR).
|
|
145
|
+
* This method reads it and patches the store so fetchRecommendationProducts()
|
|
146
|
+
* uses the correct values.
|
|
147
|
+
*
|
|
148
|
+
* Uses triggerRefetch: false because the fetch hasn't happened yet —
|
|
149
|
+
* values are being prepared for the upcoming initial fetch.
|
|
150
|
+
*/
|
|
151
|
+
_syncNodeConfigToStore() {
|
|
152
|
+
var r;
|
|
153
|
+
const t = m.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
154
|
+
this.store.patchCurrentBlockConfig({
|
|
155
|
+
strategy: t.strategy,
|
|
156
|
+
language: t.language,
|
|
157
|
+
size: t.size,
|
|
158
|
+
productIds: t.productIds,
|
|
159
|
+
// Only sync filters from node config during initial load.
|
|
160
|
+
// After initialization, the Pinia store is the source of truth
|
|
161
|
+
// for filters (edited via the filter drawer).
|
|
162
|
+
...o ? {} : { filters: t.filters },
|
|
163
|
+
shuffleProducts: t.shuffleProducts,
|
|
164
|
+
currencySettings: {
|
|
165
|
+
name: t.currency.code,
|
|
166
|
+
value: t.currency.code,
|
|
167
|
+
symbol: t.currency.symbol,
|
|
168
|
+
alignment: t.currency.alignment === "before" ? "0" : "1",
|
|
169
|
+
decimalCount: t.currency.decimalCount.toString(),
|
|
170
|
+
decimalSeparator: t.currency.decimalSeparator,
|
|
171
|
+
thousandSeparator: t.currency.thousandSeparator
|
|
172
|
+
}
|
|
173
|
+
}, { triggerRefetch: !1 });
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Fetches initial data for a block in three phases:
|
|
177
|
+
* 1. Shared reference data (algorithms, currencies, filters) — parallel
|
|
178
|
+
* 2. Smart defaults for new blocks (currency, algorithm) — sequential
|
|
179
|
+
* 3. Product data with correct defaults — sequential
|
|
180
|
+
*
|
|
181
|
+
* Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
|
|
182
|
+
* Marks the block as initialized to prevent redundant fetches on re-selection.
|
|
183
|
+
*/
|
|
184
|
+
async _fetchBlockData(t) {
|
|
185
|
+
t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
|
|
186
|
+
this.store.fetchRecommendationCreateData(),
|
|
187
|
+
this.store.fetchRecommendationFilters()
|
|
188
|
+
])).forEach((o, r) => {
|
|
189
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
|
|
190
|
+
}), this._applySmartDefaults();
|
|
191
|
+
try {
|
|
192
|
+
await this.store.fetchRecommendationProducts();
|
|
193
|
+
} catch (o) {
|
|
194
|
+
console.warn("Recommendation block: fetchRecommendationProducts failed", o);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Applies smart defaults for newly dropped blocks.
|
|
199
|
+
*
|
|
200
|
+
* For new blocks (config still matches hardcoded defaults), validates that
|
|
201
|
+
* the default currency and algorithm are available from the API response.
|
|
202
|
+
* If not, falls back to the first available option.
|
|
203
|
+
*
|
|
204
|
+
* Saved templates with user-customized config are left unchanged because
|
|
205
|
+
* their values won't match the hardcoded defaults.
|
|
206
|
+
*/
|
|
207
|
+
_applySmartDefaults() {
|
|
208
|
+
if (!this.currentNode || !this.api)
|
|
209
|
+
return;
|
|
210
|
+
const t = m.getConfig(this.currentNode), e = {};
|
|
211
|
+
let o = null, r = null, n = null;
|
|
212
|
+
if (t.currency.code === a.currency.code) {
|
|
213
|
+
const { currencyList: s } = this.store;
|
|
214
|
+
s.length > 0 && (s.some(
|
|
215
|
+
(u) => u.value === `price.${a.currency.code}`
|
|
216
|
+
) || (o = s[0].value.replace("price.", ""), e.currency = {
|
|
217
|
+
...a.currency,
|
|
218
|
+
code: o,
|
|
219
|
+
symbol: o
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
if (t.strategy === a.strategy) {
|
|
223
|
+
const s = this.store.getActivePredictiveAlgorithms;
|
|
224
|
+
s.length > 0 && (s.some(
|
|
225
|
+
(u) => u.value === a.strategy
|
|
226
|
+
) || (r = s[0].value, e.strategy = r));
|
|
227
|
+
}
|
|
228
|
+
if (t.language === a.language) {
|
|
229
|
+
const s = this.store.getLanguages;
|
|
230
|
+
s.length > 0 && (s.some(
|
|
231
|
+
(u) => u.value === a.language
|
|
232
|
+
) || (n = s[0].value, e.language = n));
|
|
233
|
+
}
|
|
234
|
+
!o && !r && !n || (m.updateConfig(
|
|
235
|
+
this.api,
|
|
236
|
+
this.currentNode,
|
|
237
|
+
e,
|
|
238
|
+
"Applied smart defaults"
|
|
239
|
+
), this.store.patchCurrentBlockConfig({
|
|
240
|
+
...o ? {
|
|
241
|
+
currencySettings: {
|
|
242
|
+
name: o,
|
|
243
|
+
value: o,
|
|
244
|
+
symbol: o,
|
|
245
|
+
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
246
|
+
decimalCount: a.currency.decimalCount.toString(),
|
|
247
|
+
decimalSeparator: a.currency.decimalSeparator,
|
|
248
|
+
thousandSeparator: a.currency.thousandSeparator
|
|
249
|
+
}
|
|
250
|
+
} : {},
|
|
251
|
+
...r ? { strategy: r } : {},
|
|
252
|
+
...n ? { language: n } : {}
|
|
253
|
+
}, { triggerRefetch: !1 }));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Reads the recommendation-id attribute from the block element within the node
|
|
257
|
+
*/
|
|
258
|
+
_getRecommendationIdFromNode(t) {
|
|
259
|
+
const e = P(t);
|
|
260
|
+
if (!e || !("getAttribute" in e))
|
|
261
|
+
return null;
|
|
262
|
+
const o = e.getAttribute(k);
|
|
263
|
+
if (!o)
|
|
264
|
+
return null;
|
|
265
|
+
const r = parseInt(o);
|
|
266
|
+
return Number.isNaN(r) ? null : r;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Listen to store changes that require product refresh or regeneration.
|
|
270
|
+
*
|
|
271
|
+
* Uses configVersion counter (incremented only by patchCurrentBlockConfig)
|
|
272
|
+
* to distinguish user-initiated config changes from internal mutations
|
|
273
|
+
* (e.g., fetchRecommendationCreateData setting preferred currency).
|
|
274
|
+
*
|
|
275
|
+
* Tracks currentRecommendationId to detect block switches. When the user
|
|
276
|
+
* selects a different recommendation block, the proxy getters (e.g.,
|
|
277
|
+
* recommendationProducts) return the new block's data — a different array
|
|
278
|
+
* reference that would be falsely detected as "new products arrived".
|
|
279
|
+
* We skip that tick and update tracking references instead.
|
|
280
|
+
*/
|
|
281
|
+
_listenStateUpdates() {
|
|
282
|
+
const { store: t } = this;
|
|
283
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
|
|
284
|
+
this.storeUnsubscription = t.$subscribe(() => {
|
|
285
|
+
const n = t.currentRecommendationId;
|
|
286
|
+
if (n !== r) {
|
|
287
|
+
r = n, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const s = t.$state.configVersion;
|
|
291
|
+
s !== o && (o = s, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
292
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
293
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Persists the current filter state from Pinia store to the Stripo node config.
|
|
298
|
+
* This ensures filters survive template save/reload cycles.
|
|
299
|
+
*/
|
|
300
|
+
_persistFiltersToNodeConfig() {
|
|
301
|
+
if (!this.currentNode || !this.api)
|
|
302
|
+
return;
|
|
303
|
+
const { filters: t } = this.store.recommendationConfigs;
|
|
304
|
+
m.updateConfig(
|
|
305
|
+
this.api,
|
|
306
|
+
this.currentNode,
|
|
307
|
+
{ filters: t },
|
|
308
|
+
"Update recommendation filters"
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
export {
|
|
313
|
+
H as ALGORITHM_CONTROL_ID,
|
|
314
|
+
R as AlgorithmControl,
|
|
315
|
+
D as CONTROL_BLOCK_ID,
|
|
316
|
+
K as CURRENCY_CONTROL_ID,
|
|
317
|
+
N as CurrencyControl,
|
|
318
|
+
J as FILTERS_CONTROL_ID,
|
|
319
|
+
b as FiltersControl,
|
|
320
|
+
X as LOCALE_CONTROL_ID,
|
|
321
|
+
_ as LocaleControl,
|
|
322
|
+
tt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
323
|
+
I as ProductLayoutControl,
|
|
324
|
+
W as RecommendationBlockControl,
|
|
325
|
+
ot as SHUFFLE_CONTROL_ID,
|
|
326
|
+
S as ShuffleControl,
|
|
327
|
+
nt as adjustProductsToSize,
|
|
328
|
+
st as formatProductPrice,
|
|
329
|
+
P as getBlockElement,
|
|
330
|
+
it as getCardComposition,
|
|
331
|
+
at as getCurrentLayout,
|
|
332
|
+
ct as reapplySpacing,
|
|
333
|
+
lt as regenerateMobileProductRows,
|
|
334
|
+
ut as regenerateProductRows,
|
|
335
|
+
L as regenerateProductRowsWithStyles,
|
|
336
|
+
dt as setCurrencyAttributes,
|
|
337
|
+
mt as updatePricesInPlace,
|
|
338
|
+
T as updateProductContentInPlace,
|
|
339
|
+
ht as updateSingleProductContent
|
|
340
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var r = (o, t, e) => t in o ? s(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var a = (o, t, e) => r(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
+
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as g } from "../../store/recommendation.js";
|
|
8
|
+
const m = "recommendation-locale-control", n = {
|
|
9
|
+
LOCALE: "language"
|
|
10
|
+
};
|
|
11
|
+
class E extends c {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
// Store is used ONLY for API-fetched data (language options), not for config
|
|
15
|
+
a(this, "store", g());
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return m;
|
|
19
|
+
}
|
|
20
|
+
getTemplate() {
|
|
21
|
+
return `
|
|
22
|
+
<div class="locale-control-container">
|
|
23
|
+
${this._GuTwoColumns([
|
|
24
|
+
this._GuLabel({ text: "Recommendation Locale" }),
|
|
25
|
+
this._GuSelect({
|
|
26
|
+
name: n.LOCALE,
|
|
27
|
+
placeholder: "Select Recommendation Locale",
|
|
28
|
+
options: this.store.getLanguages
|
|
29
|
+
})
|
|
30
|
+
])}
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
onRender() {
|
|
35
|
+
this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
|
|
36
|
+
}
|
|
37
|
+
onTemplateNodeUpdated(e) {
|
|
38
|
+
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
39
|
+
}
|
|
40
|
+
_setFormValues() {
|
|
41
|
+
const e = i.getConfig(this.currentNode);
|
|
42
|
+
this.api.updateValues({
|
|
43
|
+
[n.LOCALE]: e.language
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
_initializeSelectItems() {
|
|
47
|
+
this.api.setUIEAttribute(
|
|
48
|
+
n.LOCALE,
|
|
49
|
+
l.SELECTPICKER.items,
|
|
50
|
+
this.store.getLanguages
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
_onLocaleChange(e) {
|
|
54
|
+
!this.currentNode || i.getConfig(this.currentNode).language === e || (i.updateConfig(
|
|
55
|
+
this.api,
|
|
56
|
+
this.currentNode,
|
|
57
|
+
{ language: e },
|
|
58
|
+
`Changed language to ${e}`
|
|
59
|
+
), this.store.patchCurrentBlockConfig({ language: e }));
|
|
60
|
+
}
|
|
61
|
+
_listenToFormUpdates() {
|
|
62
|
+
this.api.onValueChanged(n.LOCALE, (e) => {
|
|
63
|
+
this._onLocaleChange(e);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
m as LOCALE_CONTROL_ID,
|
|
69
|
+
E as LocaleControl
|
|
70
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var _ = (n, r, t) => r in n ? u(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
|
|
3
|
+
var a = (n, r, t) => _(n, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { EditorStatePropertyType as c, PreviewDeviceMode as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as R } from "../../../common-control.js";
|
|
6
|
+
import { MAX_PRODUCT_COUNT as h, MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as g, DEFAULT_COLUMN_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as O } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
|
|
9
|
+
import { ensureMobileCssRulesExist as I } from "../mobileLayout/cssRules.js";
|
|
10
|
+
import { getCurrentLayout as N, regenerateMobileProductRows as f, adjustProductsToSize as b, regenerateProductRowsWithStyles as P } from "./utils.js";
|
|
11
|
+
import { useDebounceFn as L } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
|
+
const M = "recommendation-product-layout-control", e = {
|
|
13
|
+
PRODUCT_COUNT: "size",
|
|
14
|
+
PRODUCT_IN_ROW: "cardsInRow",
|
|
15
|
+
PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
|
|
16
|
+
MOBILE_CARDS_IN_ROW: "mobileCardsInRow",
|
|
17
|
+
MOBILE_CARDS_IN_ROW_LABEL: "mobileCardsInRowLabel"
|
|
18
|
+
};
|
|
19
|
+
class V extends R {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
// Store is used for backward compatibility with product fetching and regeneration
|
|
23
|
+
a(this, "store", l());
|
|
24
|
+
a(this, "storeUnsubscription", () => {
|
|
25
|
+
});
|
|
26
|
+
a(this, "_debouncedRegenerateProductRows", L(() => {
|
|
27
|
+
this._regenerateProductRows();
|
|
28
|
+
}, 500));
|
|
29
|
+
}
|
|
30
|
+
getId() {
|
|
31
|
+
return M;
|
|
32
|
+
}
|
|
33
|
+
getTemplate() {
|
|
34
|
+
return `
|
|
35
|
+
<div class="product-layout-control-container">
|
|
36
|
+
${this._GuTwoColumns([
|
|
37
|
+
this._GuLabel({ text: "Number of Products" }),
|
|
38
|
+
this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: h }),
|
|
39
|
+
this._GuLabel({
|
|
40
|
+
text: "Products in One Row on Desktop",
|
|
41
|
+
name: e.PRODUCT_IN_ROW_LABEL
|
|
42
|
+
}),
|
|
43
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: p }),
|
|
44
|
+
this._GuLabel({
|
|
45
|
+
text: "Products in One Row on Mobile",
|
|
46
|
+
name: e.MOBILE_CARDS_IN_ROW_LABEL
|
|
47
|
+
}),
|
|
48
|
+
this._GuCounter({
|
|
49
|
+
name: e.MOBILE_CARDS_IN_ROW,
|
|
50
|
+
maxValue: g
|
|
51
|
+
})
|
|
52
|
+
])}
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
onRender() {
|
|
57
|
+
this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates(), this._subscribeToEditorModeChanges();
|
|
58
|
+
}
|
|
59
|
+
onTemplateNodeUpdated(t) {
|
|
60
|
+
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
|
|
61
|
+
}
|
|
62
|
+
onDestroy() {
|
|
63
|
+
this.storeUnsubscription();
|
|
64
|
+
}
|
|
65
|
+
_setFormValues() {
|
|
66
|
+
const t = i.getConfig(this.currentNode);
|
|
67
|
+
this.api.updateValues({
|
|
68
|
+
[e.PRODUCT_COUNT]: t.size,
|
|
69
|
+
[e.PRODUCT_IN_ROW]: t.cardsInRow,
|
|
70
|
+
[e.MOBILE_CARDS_IN_ROW]: t.mobileCardsInRow
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the editor is currently in mobile preview mode
|
|
75
|
+
* using Stripo's EditorStatePropertyType API.
|
|
76
|
+
*/
|
|
77
|
+
_isMobileMode() {
|
|
78
|
+
return this.api.getEditorState()[c.previewDeviceMode] === C.MOBILE;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Updates counter visibility based on layout orientation and editor mode.
|
|
82
|
+
* - List layout: hide both counters (products always full-width)
|
|
83
|
+
* - Grid + desktop mode: show desktop counter, hide mobile counter
|
|
84
|
+
* - Grid + mobile mode: show mobile counter, hide desktop counter
|
|
85
|
+
*/
|
|
86
|
+
_updateProductsInRowVisibility() {
|
|
87
|
+
const o = (i.getConfig(this.currentNode).layout || N(this.currentNode)) === "grid", d = this._isMobileMode();
|
|
88
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, o && !d), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, o && !d), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, o && d), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, o && d);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Subscribes to editor preview mode changes via Stripo API.
|
|
92
|
+
* When the user switches between desktop/mobile preview, toggles
|
|
93
|
+
* which "Products in One Row" counter is visible.
|
|
94
|
+
*/
|
|
95
|
+
_subscribeToEditorModeChanges() {
|
|
96
|
+
this.api.onEditorStatePropUpdated(
|
|
97
|
+
c.previewDeviceMode,
|
|
98
|
+
() => {
|
|
99
|
+
this._updateProductsInRowVisibility();
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
_onProductCountChange(t) {
|
|
104
|
+
!this.currentNode || i.getConfig(this.currentNode).size === t || (i.updateConfig(
|
|
105
|
+
this.api,
|
|
106
|
+
this.currentNode,
|
|
107
|
+
{ size: t },
|
|
108
|
+
`Changed product count to ${t}`
|
|
109
|
+
), this.store.patchCurrentBlockConfig({ size: t }));
|
|
110
|
+
}
|
|
111
|
+
_onProductsInRowChange(t) {
|
|
112
|
+
if (!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t)
|
|
113
|
+
return;
|
|
114
|
+
const o = t === 1 ? 0 : m;
|
|
115
|
+
i.updateConfig(
|
|
116
|
+
this.api,
|
|
117
|
+
this.currentNode,
|
|
118
|
+
{ cardsInRow: t, columnSpacing: o },
|
|
119
|
+
`Changed products per row to ${t}`
|
|
120
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
|
|
121
|
+
}
|
|
122
|
+
_onMobileCardsInRowChange(t) {
|
|
123
|
+
if (!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t)
|
|
124
|
+
return;
|
|
125
|
+
const o = t === 1 ? 0 : O;
|
|
126
|
+
i.updateConfig(
|
|
127
|
+
this.api,
|
|
128
|
+
this.currentNode,
|
|
129
|
+
{ mobileCardsInRow: t, mobileColumnSpacing: o },
|
|
130
|
+
`Changed mobile products per row to ${t}`
|
|
131
|
+
), I(this.api), f({
|
|
132
|
+
currentNode: this.currentNode,
|
|
133
|
+
documentModifier: this.api.getDocumentModifier()
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
_regenerateProductRows() {
|
|
137
|
+
const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o = b(this.store.recommendationProducts, s);
|
|
138
|
+
P({
|
|
139
|
+
currentNode: this.currentNode,
|
|
140
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
141
|
+
products: o
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
_listenToFormUpdates() {
|
|
145
|
+
this.api.onValueChanged(e.PRODUCT_COUNT, (t) => {
|
|
146
|
+
this._onProductCountChange(t.toString());
|
|
147
|
+
}), this.api.onValueChanged(e.PRODUCT_IN_ROW, (t) => {
|
|
148
|
+
this._onProductsInRowChange(Number(t));
|
|
149
|
+
}), this.api.onValueChanged(e.MOBILE_CARDS_IN_ROW, (t) => {
|
|
150
|
+
this._onMobileCardsInRowChange(Number(t));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Subscribe to store changes to update visibility when layout changes
|
|
155
|
+
* This is still needed because layout changes come from LayoutControl
|
|
156
|
+
*/
|
|
157
|
+
_listenStateUpdates() {
|
|
158
|
+
let t = this.store.recommendationConfigs.orientation;
|
|
159
|
+
this.storeUnsubscription = this.store.$subscribe(() => {
|
|
160
|
+
const s = this.store.recommendationConfigs.orientation;
|
|
161
|
+
s !== t && (t = s, this._updateProductsInRowVisibility());
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export {
|
|
166
|
+
M as PRODUCT_LAYOUT_CONTROL_ID,
|
|
167
|
+
V as ProductLayoutControl
|
|
168
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var f = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var n = (o, t, e) => f(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
6
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
8
|
+
const h = "recommendation-shuffle-control", i = {
|
|
9
|
+
SHUFFLE_PRODUCTS: "shuffleProducts"
|
|
10
|
+
};
|
|
11
|
+
class S extends l {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
// Store is used for backward compatibility with product fetching
|
|
15
|
+
n(this, "store", d());
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return h;
|
|
19
|
+
}
|
|
20
|
+
getTemplate() {
|
|
21
|
+
return `
|
|
22
|
+
<div class="shuffle-control-container">
|
|
23
|
+
${this._GuTwoColumns([
|
|
24
|
+
this._GuLabel({ text: "Shuffle Recommended Products" }),
|
|
25
|
+
this._GuToggle(i.SHUFFLE_PRODUCTS)
|
|
26
|
+
])}
|
|
27
|
+
</div>
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
onRender() {
|
|
31
|
+
this._initializeToggle(), this._setFormValues(), this._listenToFormUpdates();
|
|
32
|
+
}
|
|
33
|
+
onTemplateNodeUpdated(e) {
|
|
34
|
+
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
35
|
+
}
|
|
36
|
+
_setFormValues() {
|
|
37
|
+
const e = s.getConfig(this.currentNode);
|
|
38
|
+
this.api.updateValues({
|
|
39
|
+
[i.SHUFFLE_PRODUCTS]: e.shuffleProducts
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
_initializeToggle() {
|
|
43
|
+
const e = s.getConfig(this.currentNode);
|
|
44
|
+
this.api.setUIEAttribute(
|
|
45
|
+
i.SHUFFLE_PRODUCTS,
|
|
46
|
+
u.SELECTPICKER.items,
|
|
47
|
+
e.shuffleProducts
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
_onShuffleChange(e) {
|
|
51
|
+
!this.currentNode || s.getConfig(this.currentNode).shuffleProducts === e || (s.updateConfig(
|
|
52
|
+
this.api,
|
|
53
|
+
this.currentNode,
|
|
54
|
+
{ shuffleProducts: e },
|
|
55
|
+
`${e ? "Enabled" : "Disabled"} product shuffle`
|
|
56
|
+
), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
|
|
57
|
+
}
|
|
58
|
+
_listenToFormUpdates() {
|
|
59
|
+
this.api.onValueChanged(i.SHUFFLE_PRODUCTS, (e) => {
|
|
60
|
+
this._onShuffleChange(!!e);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
h as SHUFFLE_CONTROL_ID,
|
|
66
|
+
S as ShuffleControl
|
|
67
|
+
};
|