@useinsider/guido 2.1.0 → 2.2.0-beta.39b37ff
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/FilterSelectionDrawer.vue2.js +15 -14
- 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 +2 -2
- 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 +66 -0
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +22 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -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 +92 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +102 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +209 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +52 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +250 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +70 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +160 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +67 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +307 -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 +222 -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 +254 -207
- 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 +9 -9
- 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/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/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 +49 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +41 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +35 -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 +79 -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 +221 -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 +83 -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 +138 -468
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +41 -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 +166 -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/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 +39 -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 +2 -2
- 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/templateUtils.d.ts +0 -44
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency Settings Control
|
|
3
|
+
*
|
|
4
|
+
* Handles all currency-related configuration for recommendation products:
|
|
5
|
+
* - Currency type
|
|
6
|
+
* - Currency location (before/after)
|
|
7
|
+
* - Currency symbol
|
|
8
|
+
* - Thousand separator
|
|
9
|
+
* - Decimal separator
|
|
10
|
+
* - Decimal count
|
|
11
|
+
*
|
|
12
|
+
* Configuration is stored via node config (persists with template).
|
|
13
|
+
* Currency options are fetched from API and cached in Pinia store.
|
|
14
|
+
*/
|
|
15
|
+
import type { CurrencyConfig } from '../../types/nodeConfig';
|
|
16
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
17
|
+
import { CommonControl } from '../../../common-control';
|
|
18
|
+
export declare const CURRENCY_CONTROL_ID = "recommendation-currency-control";
|
|
19
|
+
/**
|
|
20
|
+
* Control for managing currency display settings in recommendation blocks
|
|
21
|
+
*/
|
|
22
|
+
export declare class CurrencyControl extends CommonControl {
|
|
23
|
+
private store;
|
|
24
|
+
private storeUnsubscription;
|
|
25
|
+
getId(): string;
|
|
26
|
+
getTemplate(): string;
|
|
27
|
+
onRender(): void;
|
|
28
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
29
|
+
onDestroy(): void;
|
|
30
|
+
_setFormValues(): void;
|
|
31
|
+
_initializeSelectItems(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Applies currency updates to node config, HTML attributes, Pinia store, and DOM.
|
|
34
|
+
* @param updates - Partial currency config to merge
|
|
35
|
+
* @param triggerRefetch - Whether to trigger a product API refetch.
|
|
36
|
+
* true for currency code changes (different prices from API),
|
|
37
|
+
* false for display-only changes (symbol, separators, alignment, decimal count).
|
|
38
|
+
*/
|
|
39
|
+
_updateCurrency(updates: Partial<CurrencyConfig>, triggerRefetch?: boolean): void;
|
|
40
|
+
_onCurrencyChange(value: string): void;
|
|
41
|
+
_onCurrencyLocationChange(value: string): void;
|
|
42
|
+
_onCurrencySymbolChange(value: string): void;
|
|
43
|
+
_onThousandSeparatorChange(value: string): void;
|
|
44
|
+
_onDecimalSeparatorChange(value: string): void;
|
|
45
|
+
_onDecimalCountChange(value: string): void;
|
|
46
|
+
_listenToFormUpdates(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Subscribe to store changes to update currency selects when API data arrives
|
|
49
|
+
* This handles the case where the control renders before currency list is loaded
|
|
50
|
+
*/
|
|
51
|
+
_subscribeToStoreChanges(): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters Control
|
|
3
|
+
*
|
|
4
|
+
* Handles the filter selection UI for recommendation products
|
|
5
|
+
* Opens filter selection drawer when button is clicked
|
|
6
|
+
*/
|
|
7
|
+
import { CommonControl } from '../../../common-control';
|
|
8
|
+
export declare const FILTERS_CONTROL_ID = "recommendation-filters-control";
|
|
9
|
+
/**
|
|
10
|
+
* Control for managing recommendation product filters
|
|
11
|
+
*/
|
|
12
|
+
export declare class FiltersControl extends CommonControl {
|
|
13
|
+
private store;
|
|
14
|
+
private addFilterListener;
|
|
15
|
+
private addFilterButton;
|
|
16
|
+
getId(): string;
|
|
17
|
+
getTemplate(): string;
|
|
18
|
+
onRender(): void;
|
|
19
|
+
onDestroy(): void;
|
|
20
|
+
_onFilterSelectClick(): void;
|
|
21
|
+
_setupButtonListener(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { CommonControl } from '../../../common-control';
|
|
3
|
+
import { AlgorithmControl, ALGORITHM_CONTROL_ID } from './algorithm';
|
|
4
|
+
import { CurrencyControl, CURRENCY_CONTROL_ID } from './currency';
|
|
5
|
+
import { FiltersControl, FILTERS_CONTROL_ID } from './filters';
|
|
6
|
+
import { LocaleControl, LOCALE_CONTROL_ID } from './locale';
|
|
7
|
+
import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
|
|
8
|
+
import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
|
|
9
|
+
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
10
|
+
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, };
|
|
11
|
+
export * from './utils';
|
|
12
|
+
/**
|
|
13
|
+
* Main recommendation block control that composes all sub-controls
|
|
14
|
+
* Registered in the Settings tab of the block's settings panel
|
|
15
|
+
*/
|
|
16
|
+
export declare class RecommendationBlockControl extends CommonControl {
|
|
17
|
+
private store;
|
|
18
|
+
private storeUnsubscription;
|
|
19
|
+
private algorithmControl;
|
|
20
|
+
private localeControl;
|
|
21
|
+
private currencyControl;
|
|
22
|
+
private productLayoutControl;
|
|
23
|
+
private filtersControl;
|
|
24
|
+
private shuffleControl;
|
|
25
|
+
getId(): string;
|
|
26
|
+
getTemplate(): string;
|
|
27
|
+
onRender(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Immediately regenerate products with styles (no debounce)
|
|
30
|
+
* Used for initial load after fetch completes
|
|
31
|
+
*/
|
|
32
|
+
private _regenerateWithProducts;
|
|
33
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
34
|
+
onDestroy(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Initialize all sub-controls with the shared API context
|
|
37
|
+
* Each sub-control manages its own form values and event listeners
|
|
38
|
+
*/
|
|
39
|
+
_initializeSubControls(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Syncs persisted node config into the Pinia store's block state.
|
|
42
|
+
*
|
|
43
|
+
* setCurrentBlock() creates a default entry (USD, en_US, mostPopular).
|
|
44
|
+
* For saved templates, the real config lives in the node (e.g., TRY, tr_TR).
|
|
45
|
+
* This method reads it and patches the store so fetchRecommendationProducts()
|
|
46
|
+
* uses the correct values.
|
|
47
|
+
*
|
|
48
|
+
* Uses triggerRefetch: false because the fetch hasn't happened yet —
|
|
49
|
+
* values are being prepared for the upcoming initial fetch.
|
|
50
|
+
*/
|
|
51
|
+
private _syncNodeConfigToStore;
|
|
52
|
+
/**
|
|
53
|
+
* Fetches initial data for a block (filters, algorithms, products).
|
|
54
|
+
* Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
|
|
55
|
+
* Marks the block as initialized to prevent redundant fetches on re-selection.
|
|
56
|
+
*/
|
|
57
|
+
private _fetchBlockData;
|
|
58
|
+
/**
|
|
59
|
+
* Reads the recommendation-id attribute from the block element within the node
|
|
60
|
+
*/
|
|
61
|
+
private _getRecommendationIdFromNode;
|
|
62
|
+
/**
|
|
63
|
+
* Debounced product fetch to prevent rapid API calls during config changes
|
|
64
|
+
*/
|
|
65
|
+
private _debouncedFetchProducts;
|
|
66
|
+
/**
|
|
67
|
+
* Debounced regeneration when products arrive from API
|
|
68
|
+
* Tries in-place update first to preserve styles, falls back to full regeneration
|
|
69
|
+
*/
|
|
70
|
+
private _debouncedRegenerateWithProducts;
|
|
71
|
+
/**
|
|
72
|
+
* Listen to store changes that require product refresh or regeneration.
|
|
73
|
+
*
|
|
74
|
+
* Uses configVersion counter (incremented only by patchCurrentBlockConfig)
|
|
75
|
+
* to distinguish user-initiated config changes from internal mutations
|
|
76
|
+
* (e.g., fetchRecommendationCreateData setting preferred currency).
|
|
77
|
+
*/
|
|
78
|
+
_listenStateUpdates(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale Selection Control
|
|
3
|
+
*
|
|
4
|
+
* Handles locale/language selection for recommendation products.
|
|
5
|
+
* Configuration is stored via node config (persists with template).
|
|
6
|
+
* Language options are fetched from API and cached in Pinia store.
|
|
7
|
+
*/
|
|
8
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
9
|
+
import { CommonControl } from '../../../common-control';
|
|
10
|
+
export declare const LOCALE_CONTROL_ID = "recommendation-locale-control";
|
|
11
|
+
/**
|
|
12
|
+
* Control for selecting recommendation content locale/language
|
|
13
|
+
*/
|
|
14
|
+
export declare class LocaleControl extends CommonControl {
|
|
15
|
+
private store;
|
|
16
|
+
getId(): string;
|
|
17
|
+
getTemplate(): string;
|
|
18
|
+
onRender(): void;
|
|
19
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
20
|
+
_setFormValues(): void;
|
|
21
|
+
_initializeSelectItems(): void;
|
|
22
|
+
_onLocaleChange(value: string): void;
|
|
23
|
+
_listenToFormUpdates(): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product Layout Control
|
|
3
|
+
*
|
|
4
|
+
* Handles product display configuration:
|
|
5
|
+
* - Number of products to show
|
|
6
|
+
* - Products per row on desktop (hidden for list layout)
|
|
7
|
+
* - Products per row on mobile (hidden for list layout)
|
|
8
|
+
* - Triggers product row regeneration on changes
|
|
9
|
+
*
|
|
10
|
+
* Desktop/mobile counters swap visibility based on editor mode
|
|
11
|
+
* (detected via Stripo's EditorStatePropertyType.previewDeviceMode).
|
|
12
|
+
*
|
|
13
|
+
* Configuration is stored via node config (persists with template).
|
|
14
|
+
*/
|
|
15
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
16
|
+
import { CommonControl } from '../../../common-control';
|
|
17
|
+
export declare const PRODUCT_LAYOUT_CONTROL_ID = "recommendation-product-layout-control";
|
|
18
|
+
/**
|
|
19
|
+
* Control for configuring product count and layout density
|
|
20
|
+
* Includes both desktop and mobile "products per row" counters
|
|
21
|
+
*/
|
|
22
|
+
export declare class ProductLayoutControl extends CommonControl {
|
|
23
|
+
private store;
|
|
24
|
+
private storeUnsubscription;
|
|
25
|
+
getId(): string;
|
|
26
|
+
getTemplate(): string;
|
|
27
|
+
onRender(): void;
|
|
28
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
29
|
+
onDestroy(): void;
|
|
30
|
+
_setFormValues(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the editor is currently in mobile preview mode
|
|
33
|
+
* using Stripo's EditorStatePropertyType API.
|
|
34
|
+
*/
|
|
35
|
+
_isMobileMode(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Updates counter visibility based on layout orientation and editor mode.
|
|
38
|
+
* - List layout: hide both counters (products always full-width)
|
|
39
|
+
* - Grid + desktop mode: show desktop counter, hide mobile counter
|
|
40
|
+
* - Grid + mobile mode: show mobile counter, hide desktop counter
|
|
41
|
+
*/
|
|
42
|
+
_updateProductsInRowVisibility(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Subscribes to editor preview mode changes via Stripo API.
|
|
45
|
+
* When the user switches between desktop/mobile preview, toggles
|
|
46
|
+
* which "Products in One Row" counter is visible.
|
|
47
|
+
*/
|
|
48
|
+
_subscribeToEditorModeChanges(): void;
|
|
49
|
+
_onProductCountChange(value: string): void;
|
|
50
|
+
_onProductsInRowChange(value: number): void;
|
|
51
|
+
_onMobileCardsInRowChange(value: number): void;
|
|
52
|
+
_regenerateProductRows(): void;
|
|
53
|
+
_debouncedRegenerateProductRows: import("@vueuse/shared").PromisifyFn<() => void>;
|
|
54
|
+
_listenToFormUpdates(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to store changes to update visibility when layout changes
|
|
57
|
+
* This is still needed because layout changes come from LayoutControl
|
|
58
|
+
*/
|
|
59
|
+
_listenStateUpdates(): void;
|
|
60
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shuffle Products Control
|
|
3
|
+
*
|
|
4
|
+
* Handles the toggle for shuffling/randomizing recommended products.
|
|
5
|
+
* Configuration is stored via node config (persists with template).
|
|
6
|
+
*/
|
|
7
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
8
|
+
import { CommonControl } from '../../../common-control';
|
|
9
|
+
export declare const SHUFFLE_CONTROL_ID = "recommendation-shuffle-control";
|
|
10
|
+
/**
|
|
11
|
+
* Control for toggling product shuffle/randomization
|
|
12
|
+
*/
|
|
13
|
+
export declare class ShuffleControl extends CommonControl {
|
|
14
|
+
private store;
|
|
15
|
+
getId(): string;
|
|
16
|
+
getTemplate(): string;
|
|
17
|
+
onRender(): void;
|
|
18
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
19
|
+
_setFormValues(): void;
|
|
20
|
+
_initializeToggle(): void;
|
|
21
|
+
_onShuffleChange(value: boolean): void;
|
|
22
|
+
_listenToFormUpdates(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for Recommendation block controls
|
|
3
|
+
*
|
|
4
|
+
* Provides common functionality used across multiple controls:
|
|
5
|
+
* - Layout detection from DOM
|
|
6
|
+
* - Card composition retrieval
|
|
7
|
+
* - Product row regeneration
|
|
8
|
+
* - Spacing reapplication
|
|
9
|
+
* - In-place content updates (style-preserving)
|
|
10
|
+
*/
|
|
11
|
+
import type { CurrencyConfig } from '../../types/nodeConfig';
|
|
12
|
+
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
13
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
14
|
+
import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
15
|
+
import { type Orientation } from '../../templates';
|
|
16
|
+
/**
|
|
17
|
+
* Type for document modifier returned by api.getDocumentModifier()
|
|
18
|
+
*
|
|
19
|
+
* Uses `any` for the modifyHtml return type because:
|
|
20
|
+
* 1. Stripo's actual API uses complex generics (TemplateModifier<HtmlNodeModifier, CssNodeModifier>)
|
|
21
|
+
* 2. Multiple files define their own DocumentModifier with different methods
|
|
22
|
+
* 3. The methods (setStyle, setInnerHtml, setAttribute) chain and return the same object
|
|
23
|
+
*
|
|
24
|
+
* The actual chaining like modifier.modifyHtml(node).setStyle(...).setAttribute(...).apply()
|
|
25
|
+
* works correctly at runtime - this is just a TypeScript compatibility issue.
|
|
26
|
+
*/
|
|
27
|
+
interface DocumentModifier {
|
|
28
|
+
modifyHtml: (node: ImmutableHtmlNode) => any;
|
|
29
|
+
apply: (description: ModificationDescription) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the block element from the current node
|
|
33
|
+
* The currentNode could BE the block element or contain it
|
|
34
|
+
* @param currentNode - The current template node
|
|
35
|
+
* @returns The block element or null if not found
|
|
36
|
+
*/
|
|
37
|
+
export declare function getBlockElement(currentNode: ImmutableHtmlNode | null | undefined): ImmutableHtmlNode | null;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the current layout orientation from the block's data attribute
|
|
40
|
+
* Supports both old (horizontal/vertical) and new (list/grid) values for backward compatibility
|
|
41
|
+
* @param currentNode - The current template node
|
|
42
|
+
* @returns The layout value ('grid' or 'list'), defaults to 'grid'
|
|
43
|
+
*/
|
|
44
|
+
export declare function getCurrentLayout(currentNode: ImmutableHtmlNode | null | undefined): Orientation;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the current card composition from block data attribute or use default
|
|
47
|
+
* @param currentNode - The current template node
|
|
48
|
+
* @returns Array of card element types in order
|
|
49
|
+
*/
|
|
50
|
+
export declare function getCardComposition(currentNode: ImmutableHtmlNode | null | undefined): string[];
|
|
51
|
+
export interface RegenerateProductRowsOptions {
|
|
52
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
53
|
+
documentModifier: DocumentModifier;
|
|
54
|
+
afterRegenerate?: () => void;
|
|
55
|
+
/** Optional: pass products directly instead of reading from store */
|
|
56
|
+
products?: RecommendationProduct[];
|
|
57
|
+
/** Optional: pass layout directly to avoid stale DOM reads after setAttribute */
|
|
58
|
+
layout?: Orientation;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Regenerates only the mobile product container rows.
|
|
62
|
+
* Used when mobile-specific settings change (mobileCardsInRow)
|
|
63
|
+
* or when the desktop container is regenerated (to keep both in sync).
|
|
64
|
+
*/
|
|
65
|
+
export declare function regenerateMobileProductRows(options: Omit<RegenerateProductRowsOptions, 'afterRegenerate'>): void;
|
|
66
|
+
/**
|
|
67
|
+
* Regenerates product rows in the desktop container based on current store configuration.
|
|
68
|
+
* Also regenerates the mobile container to keep both in sync.
|
|
69
|
+
* Reads products, layout, and composition from store/DOM and rebuilds the HTML.
|
|
70
|
+
* @param options - Configuration options for regeneration
|
|
71
|
+
*/
|
|
72
|
+
export declare function regenerateProductRows(options: RegenerateProductRowsOptions): void;
|
|
73
|
+
export interface ReapplySpacingOptions {
|
|
74
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
75
|
+
documentModifier: DocumentModifier;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Reapplies spacing values from data attributes after product regeneration
|
|
79
|
+
* This ensures spacing persists when products are regenerated
|
|
80
|
+
* @param options - Configuration options
|
|
81
|
+
*/
|
|
82
|
+
export declare function reapplySpacing(options: ReapplySpacingOptions): void;
|
|
83
|
+
export interface RegenerateWithStylesOptions extends Omit<RegenerateProductRowsOptions, 'products' | 'layout'> {
|
|
84
|
+
/** Skip style capture/restore if styles were already handled externally */
|
|
85
|
+
skipStylePreservation?: boolean;
|
|
86
|
+
/** Optional: pass products directly instead of reading from store */
|
|
87
|
+
products?: RecommendationProduct[];
|
|
88
|
+
/** Optional: pass layout directly to avoid stale DOM reads after setAttribute */
|
|
89
|
+
layout?: Orientation;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Regenerates product rows while preserving user-applied styles
|
|
93
|
+
*
|
|
94
|
+
* This unified function handles the complete regeneration flow:
|
|
95
|
+
* 1. Captures existing styles (fonts, colors, button styles, etc.)
|
|
96
|
+
* 2. Regenerates HTML with new products/layout
|
|
97
|
+
* 3. Restores captured styles to new elements
|
|
98
|
+
* 4. Reapplies spacing from data attributes
|
|
99
|
+
*
|
|
100
|
+
* NOTE: Style restoration is temporarily disabled due to Stripo selection bug.
|
|
101
|
+
* Multiple apply() calls (setInnerHtml + restoreStyles + reapplySpacing) cause
|
|
102
|
+
* Stripo's internal cursor/selection tracking to lose node references, resulting in
|
|
103
|
+
* "Cannot read properties of undefined (reading 'textContent')" errors.
|
|
104
|
+
*
|
|
105
|
+
* Use this instead of `regenerateProductRows` when styles must be preserved.
|
|
106
|
+
* @example
|
|
107
|
+
* // When products change (API response, count change, layout change)
|
|
108
|
+
* regenerateProductRowsWithStyles({
|
|
109
|
+
* currentNode: this.currentNode,
|
|
110
|
+
* documentModifier: this.api.getDocumentModifier(),
|
|
111
|
+
* });
|
|
112
|
+
* @param options - Configuration options for regeneration
|
|
113
|
+
*/
|
|
114
|
+
export declare function regenerateProductRowsWithStyles(options: RegenerateWithStylesOptions): void;
|
|
115
|
+
type PriceKey = 'price' | 'original_price' | 'discount';
|
|
116
|
+
/**
|
|
117
|
+
* Formats a product price using current currency settings
|
|
118
|
+
* @param product - The product containing price data
|
|
119
|
+
* @param priceKey - Which price to use ('price', 'original_price', or 'discount')
|
|
120
|
+
* @returns Formatted price string
|
|
121
|
+
*/
|
|
122
|
+
export declare function formatProductPrice(product: RecommendationProduct, priceKey?: PriceKey): string;
|
|
123
|
+
interface UpdateSingleProductContentOptions {
|
|
124
|
+
documentModifier: DocumentModifier;
|
|
125
|
+
product: RecommendationProduct;
|
|
126
|
+
imageEl: ImmutableHtmlNode | null;
|
|
127
|
+
nameEl: ImmutableHtmlNode | null;
|
|
128
|
+
priceEl: ImmutableHtmlNode | null;
|
|
129
|
+
oldPriceEl: ImmutableHtmlNode | null;
|
|
130
|
+
omnibusPriceEl: ImmutableHtmlNode | null;
|
|
131
|
+
omnibusDiscountEl: ImmutableHtmlNode | null;
|
|
132
|
+
buttonEl: ImmutableHtmlNode | null;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Updates a single product's dynamic content (image, name, prices, button URL)
|
|
136
|
+
* without touching the styled container elements.
|
|
137
|
+
*
|
|
138
|
+
* Uses setText() on text nodes instead of setInnerHtml() to preserve Stripo's
|
|
139
|
+
* internal node references and avoid cursor/selection tracking issues.
|
|
140
|
+
* @returns true if any modifications were made
|
|
141
|
+
*/
|
|
142
|
+
export declare function updateSingleProductContent(options: UpdateSingleProductContentOptions): boolean;
|
|
143
|
+
export interface UpdateProductContentInPlaceOptions {
|
|
144
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
145
|
+
documentModifier: DocumentModifier;
|
|
146
|
+
products: RecommendationProduct[];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Updates product content in-place without regenerating HTML structure.
|
|
150
|
+
* Preserves all user-applied styles by only touching dynamic content.
|
|
151
|
+
*
|
|
152
|
+
* This is the preferred method when:
|
|
153
|
+
* - Product data changed but count remains the same
|
|
154
|
+
* - Currency/locale changed (prices need reformatting)
|
|
155
|
+
*
|
|
156
|
+
* Uses setText() on text nodes instead of setInnerHtml() to preserve
|
|
157
|
+
* Stripo's internal node references and avoid cursor/selection tracking issues.
|
|
158
|
+
*
|
|
159
|
+
* Falls back to false when:
|
|
160
|
+
* - Product count changed (need to add/remove elements)
|
|
161
|
+
* - Cannot find required elements
|
|
162
|
+
* @param options - Configuration options
|
|
163
|
+
* @returns true if in-place update was successful, false to fall back to full regeneration
|
|
164
|
+
*/
|
|
165
|
+
export declare function updateProductContentInPlace(options: UpdateProductContentInPlaceOptions): boolean;
|
|
166
|
+
export interface UpdatePricesInPlaceOptions {
|
|
167
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
168
|
+
documentModifier: DocumentModifier;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Updates only price displays in-place (for currency changes).
|
|
172
|
+
* This is a lightweight update when only formatting changes, not product data.
|
|
173
|
+
*
|
|
174
|
+
* Perfect for:
|
|
175
|
+
* - Currency symbol change
|
|
176
|
+
* - Currency alignment change
|
|
177
|
+
* - Decimal/thousand separator changes
|
|
178
|
+
*
|
|
179
|
+
* Uses setText() on text nodes instead of setInnerHtml() to preserve
|
|
180
|
+
* Stripo's internal node references and avoid cursor/selection tracking issues.
|
|
181
|
+
* @param options - Configuration options
|
|
182
|
+
* @returns true if update was successful, false otherwise
|
|
183
|
+
*/
|
|
184
|
+
export declare function updatePricesInPlace(options: UpdatePricesInPlaceOptions): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Gets current card background color from existing elements
|
|
187
|
+
* Checks both grid (.product-card-segment) and list (.product-card-wrapper) selectors
|
|
188
|
+
* @param currentNode - The current template node
|
|
189
|
+
* @returns Background color string or null if not found
|
|
190
|
+
*/
|
|
191
|
+
export declare function getCurrentCardBackgroundColor(currentNode: ImmutableHtmlNode | null | undefined): string | null;
|
|
192
|
+
export interface ApplyCardBackgroundColorOptions {
|
|
193
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
194
|
+
documentModifier: DocumentModifier;
|
|
195
|
+
bgColor: string | null;
|
|
196
|
+
layout: Orientation;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Applies card background color to appropriate elements based on layout
|
|
200
|
+
* @param options - Configuration options
|
|
201
|
+
*/
|
|
202
|
+
export declare function applyCardBackgroundColor(options: ApplyCardBackgroundColorOptions): void;
|
|
203
|
+
export interface SetCurrencyAttributesOptions {
|
|
204
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
205
|
+
documentModifier: DocumentModifier;
|
|
206
|
+
currency: CurrencyConfig;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Sets currency configuration as HTML attributes on the block element
|
|
210
|
+
* These attributes are read by the HTML compiler at runtime to format prices
|
|
211
|
+
* @param options - Configuration options
|
|
212
|
+
*/
|
|
213
|
+
export declare function setCurrencyAttributes(options: SetCurrencyAttributesOptions): void;
|
|
214
|
+
/**
|
|
215
|
+
* Reads currency configuration from block HTML attributes
|
|
216
|
+
* Used to restore settings when loading a template
|
|
217
|
+
* @param currentNode - The current template node
|
|
218
|
+
* @returns CurrencyConfig or null if attributes not found
|
|
219
|
+
*/
|
|
220
|
+
export declare function getCurrencyAttributesFromBlock(currentNode: ImmutableHtmlNode | null | undefined): Partial<CurrencyConfig> | null;
|
|
221
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS rules for mobile grid layout visibility switching
|
|
3
|
+
*
|
|
4
|
+
* Follows the modifyCss pattern from textTrim control.
|
|
5
|
+
* Rules are injected into the document's stylesheet via modifyCss
|
|
6
|
+
* so they appear in the compiled HTML export.
|
|
7
|
+
*/
|
|
8
|
+
import type { ImmutableCssNode } from '@stripoinc/ui-editor-extensions';
|
|
9
|
+
import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
10
|
+
/** CSS class for desktop product container */
|
|
11
|
+
export declare const CSS_CLASS_DESKTOP_CONTAINER = "ins-recommendation-desktop-container";
|
|
12
|
+
/** CSS class for mobile product container */
|
|
13
|
+
export declare const CSS_CLASS_MOBILE_CONTAINER = "ins-recommendation-mobile-container";
|
|
14
|
+
interface CssModifierApi {
|
|
15
|
+
getDocumentRootCssNode: () => ImmutableCssNode | null;
|
|
16
|
+
getDocumentModifier: () => {
|
|
17
|
+
modifyCss: (node: ImmutableCssNode) => {
|
|
18
|
+
appendRule: (rule: string) => void;
|
|
19
|
+
};
|
|
20
|
+
apply: (desc: ModificationDescription) => void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Ensures mobile layout CSS rules exist in the document stylesheet.
|
|
25
|
+
* Only adds rules if they don't already exist (prevents duplicates across multiple blocks).
|
|
26
|
+
* Follows the same pattern as textTrim's _ensureCssRulesExist().
|
|
27
|
+
*/
|
|
28
|
+
export declare function ensureMobileCssRulesExist(api: CssModifierApi): void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name Element Controls
|
|
3
|
+
*
|
|
4
|
+
* Controls for styling the product name element in recommendation cards.
|
|
5
|
+
*/
|
|
6
|
+
import { NameTextTrimControl } from './textTrim';
|
|
7
|
+
/**
|
|
8
|
+
* Grouped Name Controls
|
|
9
|
+
* Use this object for cleaner imports in extension.ts
|
|
10
|
+
*/
|
|
11
|
+
export declare const NameControls: {
|
|
12
|
+
readonly align: {
|
|
13
|
+
new (): {
|
|
14
|
+
getId(): string;
|
|
15
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
16
|
+
getParentControlId(): string;
|
|
17
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
18
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
19
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
20
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
21
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly color: {
|
|
25
|
+
new (): {
|
|
26
|
+
getId(): string;
|
|
27
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
28
|
+
getParentControlId(): string;
|
|
29
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
30
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
31
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
32
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
33
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly size: {
|
|
37
|
+
new (): {
|
|
38
|
+
getId(): string;
|
|
39
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
40
|
+
getParentControlId(): string;
|
|
41
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
42
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
43
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
44
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
45
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly style: {
|
|
49
|
+
new (): {
|
|
50
|
+
getId(): string;
|
|
51
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
52
|
+
getParentControlId(): string;
|
|
53
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
54
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
55
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
56
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
57
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly fontFamily: {
|
|
61
|
+
new (): {
|
|
62
|
+
getId(): string;
|
|
63
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
64
|
+
getParentControlId(): string;
|
|
65
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
66
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
67
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
68
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
69
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
readonly background: {
|
|
73
|
+
new (): {
|
|
74
|
+
getId(): string;
|
|
75
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
76
|
+
getParentControlId(): string;
|
|
77
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
78
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
79
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
80
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
81
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
readonly paddings: {
|
|
85
|
+
new (): {
|
|
86
|
+
getId(): string;
|
|
87
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
88
|
+
getParentControlId(): string;
|
|
89
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
90
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
91
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
92
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
93
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
readonly textTrim: typeof NameTextTrimControl;
|
|
97
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ImmutableCssNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { CommonControl } from '../../../common-control';
|
|
3
|
+
/**
|
|
4
|
+
* Control for enabling/disabling text trimming on product names
|
|
5
|
+
* When enabled, adds a CSS class that applies text-overflow: ellipsis
|
|
6
|
+
* and injects the required CSS rules into the document stylesheet
|
|
7
|
+
*/
|
|
8
|
+
export declare class NameTextTrimControl extends CommonControl {
|
|
9
|
+
getId(): string;
|
|
10
|
+
getTemplate(): string;
|
|
11
|
+
onRender(): void;
|
|
12
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
13
|
+
_setFormValues(): void;
|
|
14
|
+
_getCurrentTrimState(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Finds an existing CSS rule in the document stylesheet by exact query
|
|
17
|
+
* @param query - The CSS query to search for (uses Stripo's CSS query syntax)
|
|
18
|
+
* @returns The CSS rule node if found, undefined otherwise
|
|
19
|
+
*/
|
|
20
|
+
_findCssRule(query: string): ImmutableCssNode | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Finds the .text-trim-enabled p rule by searching all text-trim rules and comparing selectors
|
|
23
|
+
* This is needed because Stripo's CSS query syntax interprets spaces as path separators
|
|
24
|
+
* @returns true if the rule exists
|
|
25
|
+
*/
|
|
26
|
+
_hasParagraphRule(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Ensures the text-trim CSS rules exist in the document stylesheet
|
|
29
|
+
* Only adds rules if they don't already exist (prevents duplicates across multiple blocks)
|
|
30
|
+
*/
|
|
31
|
+
_ensureCssRulesExist(): void;
|
|
32
|
+
_onTextTrimChange(enabled: boolean): void;
|
|
33
|
+
_listenToFormUpdates(): void;
|
|
34
|
+
}
|