@useinsider/guido 2.1.0-beta.42f5dfa → 2.1.0-beta.4bcb91b
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 +3 -1
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +14 -15
- package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
- package/dist/composables/useHtmlValidator.js +84 -106
- package/dist/composables/useRecommendation.js +21 -54
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +58 -54
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +33 -0
- package/dist/config/compiler/recommendationCompilerRules.js +39 -45
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/enums/extensions/recommendationBlock.js +1 -1
- package/dist/enums/recommendation.js +15 -16
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Recommendation/block.js +9 -130
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
- package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
- package/dist/extensions/Blocks/Recommendation/control.js +336 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
- package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +193 -230
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +15 -26
- package/dist/extensions/Blocks/controlFactories.js +93 -125
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +169 -223
- package/dist/services/recommendationApi.js +9 -10
- package/dist/services/stripoApi.js +50 -14
- package/dist/services/templateLibraryApi.js +13 -16
- package/dist/src/@types/events.d.ts +34 -2
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -67
- package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
- package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +468 -131
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/static/styles/components/notification.css.js +1 -0
- package/dist/static/styles/components/version-history.css.js +10 -2
- package/dist/static/styles/components/wide-panel.css.js +18 -2
- package/dist/static/styles/customEditorStyle.css.js +2 -25
- package/dist/stores/editor.js +2 -1
- package/dist/utils/pairProductVariables.js +56 -57
- package/dist/utils/templatePreparation.js +14 -15
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +0 -116
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -65
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -20
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -92
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -209
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -217
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -110
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -67
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -286
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -108
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
- package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -240
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -233
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -69
- package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -174
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -122
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +0 -17
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -52
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -68
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -42
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -214
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -34
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -39
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -57
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -160
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
|
|
3
|
-
export type Orientation = 'list' | 'grid';
|
|
4
|
-
/**
|
|
5
|
-
* Options for prepareProductRows unified function
|
|
6
|
-
*/
|
|
7
|
-
export interface PrepareProductRowsOptions {
|
|
8
|
-
/** Number of products per row (only for grid layout, defaults to 3) */
|
|
9
|
-
productsPerRow?: number;
|
|
10
|
-
/** Array defining order of card elements */
|
|
11
|
-
composition?: string[];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Element renderer interface for product card elements
|
|
15
|
-
* Keys are ATTR_PRODUCT_* constants for consistent naming
|
|
16
|
-
*/
|
|
17
|
-
export interface ElementRenderer {
|
|
18
|
-
[ATTR_PRODUCT_IMAGE]: (product: RecommendationProduct) => string;
|
|
19
|
-
[ATTR_PRODUCT_NAME]: (product: RecommendationProduct) => string;
|
|
20
|
-
[ATTR_PRODUCT_PRICE]: (product: RecommendationProduct) => string;
|
|
21
|
-
[ATTR_PRODUCT_OLD_PRICE]: (product: RecommendationProduct) => string;
|
|
22
|
-
[ATTR_PRODUCT_OMNIBUS_PRICE]: (product: RecommendationProduct) => string;
|
|
23
|
-
[ATTR_PRODUCT_OMNIBUS_DISCOUNT]: (product: RecommendationProduct) => string;
|
|
24
|
-
[ATTR_PRODUCT_BUTTON]: (product: RecommendationProduct) => string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Product card getter function type
|
|
28
|
-
* Used by prepareProductRows to generate individual product cards
|
|
29
|
-
*/
|
|
30
|
-
export type ProductCardGetter = (product: RecommendationProduct, composition?: string[]) => string;
|
|
31
|
-
export declare const DEFAULTS: {
|
|
32
|
-
TITLE: string;
|
|
33
|
-
DESCRIPTION: string;
|
|
34
|
-
};
|
|
35
|
-
export declare const DEFAULT_CARD_COMPOSITION: string[];
|
|
36
|
-
export declare const DEFAULT_CARD_VISIBILITY: Record<string, boolean>;
|
|
37
|
-
export declare const spacer = "\n <tr>\n <td class=\"spacer\" style=\"height: 10px;\"></td>\n </tr>\n";
|
|
38
|
-
export declare const PLACEHOLDER_IMAGE = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
39
|
-
/**
|
|
40
|
-
* Sanitizes product image URLs for consistent rendering
|
|
41
|
-
* - Converts http:// to https:// to avoid mixed content issues
|
|
42
|
-
* - Returns placeholder for invalid/empty URLs
|
|
43
|
-
* @param url - The image URL to sanitize
|
|
44
|
-
* @returns Sanitized HTTPS URL or placeholder
|
|
45
|
-
*/
|
|
46
|
-
export declare function sanitizeImageUrl(url: string | undefined | null): string;
|
|
47
|
-
export declare function getDefaultProducts(): RecommendationProduct[];
|
|
48
|
-
/**
|
|
49
|
-
* Creates the block template wrapper HTML for recommendation blocks.
|
|
50
|
-
* The template includes title placeholder and product container.
|
|
51
|
-
* @param layout - The layout orientation ('list' or 'grid')
|
|
52
|
-
* @param instanceClass - Optional instance-specific class (e.g., 'ins-recommendation-v3-block-1')
|
|
53
|
-
* for CSS scoping per block instance. Must be included in the initial template HTML because
|
|
54
|
-
* Stripo's Angular rendering manages the class attribute and overwrites dynamic setAttribute changes.
|
|
55
|
-
* @returns HTML template string with {-{-TITLE-}-} and {-{-PRODUCT_ROWS-}-} placeholders
|
|
56
|
-
*/
|
|
57
|
-
export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recommendation Extension Types
|
|
3
|
-
*
|
|
4
|
-
* This module re-exports all type definitions for the Recommendation extension.
|
|
5
|
-
*/
|
|
6
|
-
export type { RecommendationNodeConfig, CurrencyConfig, OmnibusTextConfig, PartialNodeConfig, DeepPartialNodeConfig, } from './nodeConfig';
|
|
7
|
-
export { isValidNodeConfig, hasMinimalConfig, } from './nodeConfig';
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node Configuration Types for Recommendation Block
|
|
3
|
-
*
|
|
4
|
-
* This module defines the TypeScript interfaces for configuration data
|
|
5
|
-
* stored via Stripo's `setNodeConfig`/`getNodeConfig` APIs.
|
|
6
|
-
*
|
|
7
|
-
* The configuration persists with the template HTML, solving:
|
|
8
|
-
* - Configuration loss on save/reload
|
|
9
|
-
* - Multi-block independence
|
|
10
|
-
* - Undo/redo integration
|
|
11
|
-
* @see https://plugin.stripo.email/extensions/reference/blocks/Block
|
|
12
|
-
*/
|
|
13
|
-
import type { Filter } from '@@/Types/recommendation';
|
|
14
|
-
/**
|
|
15
|
-
* Currency display and formatting settings
|
|
16
|
-
*/
|
|
17
|
-
export interface CurrencyConfig {
|
|
18
|
-
/** Currency code (e.g., 'USD', 'EUR', 'TRY') */
|
|
19
|
-
code: string;
|
|
20
|
-
/** Currency symbol (e.g., '$', '€', '₺') */
|
|
21
|
-
symbol: string;
|
|
22
|
-
/** Symbol position relative to price */
|
|
23
|
-
alignment: 'before' | 'after';
|
|
24
|
-
/** Number of decimal places (-1 for no formatting) */
|
|
25
|
-
decimalCount: number;
|
|
26
|
-
/** Character used for decimal separation */
|
|
27
|
-
decimalSeparator: '.' | ',';
|
|
28
|
-
/** Character used for thousands separation */
|
|
29
|
-
thousandSeparator: '.' | ',' | ' ' | '';
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Configuration for omnibus price/discount text wrappers
|
|
33
|
-
* Used to display EU Omnibus Directive compliant pricing
|
|
34
|
-
*/
|
|
35
|
-
export interface OmnibusTextConfig {
|
|
36
|
-
/** Text to prepend (e.g., 'Lowest 30-day price: ') */
|
|
37
|
-
textBefore: string;
|
|
38
|
-
/** Text to append */
|
|
39
|
-
textAfter: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Complete configuration schema for Recommendation Block
|
|
43
|
-
*
|
|
44
|
-
* This interface combines:
|
|
45
|
-
* - Legacy `esd-dev-product-config` structure patterns
|
|
46
|
-
* - Current data-attribute based settings
|
|
47
|
-
* - Campaign data that was previously in Pinia store
|
|
48
|
-
*
|
|
49
|
-
* All properties are persisted with the template via `setNodeConfig`.
|
|
50
|
-
*/
|
|
51
|
-
export interface RecommendationNodeConfig {
|
|
52
|
-
/**
|
|
53
|
-
* Recommendation algorithm/strategy
|
|
54
|
-
* @example 'mostPopular', 'complementaryItems', 'manualMerchandising'
|
|
55
|
-
*/
|
|
56
|
-
strategy: string;
|
|
57
|
-
/**
|
|
58
|
-
* Product IDs for manual merchandising strategy
|
|
59
|
-
* Only used when strategy === 'manualMerchandising'
|
|
60
|
-
*/
|
|
61
|
-
productIds: string[];
|
|
62
|
-
/**
|
|
63
|
-
* Number of products to fetch from API
|
|
64
|
-
* Stored as string for consistency with API params
|
|
65
|
-
*/
|
|
66
|
-
size: string;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to randomize product order on each load
|
|
69
|
-
*/
|
|
70
|
-
shuffleProducts: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Locale/language for product data
|
|
73
|
-
* @example 'en_US', 'tr_TR', 'de_DE'
|
|
74
|
-
*/
|
|
75
|
-
language: string;
|
|
76
|
-
/**
|
|
77
|
-
* Currency display and formatting configuration
|
|
78
|
-
*/
|
|
79
|
-
currency: CurrencyConfig;
|
|
80
|
-
/**
|
|
81
|
-
* Product filters for narrowing recommendations
|
|
82
|
-
* Uses existing Filter interface from recommendation types
|
|
83
|
-
*/
|
|
84
|
-
filters: Filter[];
|
|
85
|
-
/**
|
|
86
|
-
* Layout orientation
|
|
87
|
-
* - 'grid': Products in a grid, attributes aligned across products
|
|
88
|
-
* - 'list': Products in rows, each product is a full-width card
|
|
89
|
-
*/
|
|
90
|
-
layout: 'grid' | 'list';
|
|
91
|
-
/**
|
|
92
|
-
* Number of products per row (grid layout only)
|
|
93
|
-
*/
|
|
94
|
-
cardsInRow: number;
|
|
95
|
-
/**
|
|
96
|
-
* Horizontal spacing between product cards in pixels (grid layout only)
|
|
97
|
-
*/
|
|
98
|
-
columnSpacing: number;
|
|
99
|
-
/**
|
|
100
|
-
* Vertical spacing between product rows in pixels
|
|
101
|
-
*/
|
|
102
|
-
rowSpacing: number;
|
|
103
|
-
/**
|
|
104
|
-
* Order of card elements from top to bottom
|
|
105
|
-
* Array of ATTR_PRODUCT_* constants
|
|
106
|
-
* @example ['productImage', 'productName', 'productPrice', 'productButton']
|
|
107
|
-
*/
|
|
108
|
-
composition: string[];
|
|
109
|
-
/**
|
|
110
|
-
* Visibility flags for each card element
|
|
111
|
-
* Keys are ATTR_PRODUCT_* constants
|
|
112
|
-
*/
|
|
113
|
-
visibility: Record<string, boolean>;
|
|
114
|
-
/**
|
|
115
|
-
* Omnibus price text configuration
|
|
116
|
-
* For EU Omnibus Directive compliance
|
|
117
|
-
*/
|
|
118
|
-
omnibusPrice: OmnibusTextConfig;
|
|
119
|
-
/**
|
|
120
|
-
* Omnibus discount text configuration
|
|
121
|
-
* For EU Omnibus Directive compliance
|
|
122
|
-
*/
|
|
123
|
-
omnibusDiscount: OmnibusTextConfig;
|
|
124
|
-
/**
|
|
125
|
-
* Whether to trim long product names with ellipsis
|
|
126
|
-
*/
|
|
127
|
-
textTrimming: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Configuration version for future migrations
|
|
130
|
-
* Increment when making breaking changes to schema
|
|
131
|
-
*/
|
|
132
|
-
configVersion: number;
|
|
133
|
-
/**
|
|
134
|
-
* Unique identifier for this recommendation block instance
|
|
135
|
-
* Used to isolate per-block state in the Pinia store
|
|
136
|
-
* 0 = not yet assigned (default for new/migrating blocks)
|
|
137
|
-
*/
|
|
138
|
-
recommendationId: number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Partial configuration for updates
|
|
142
|
-
* All fields are optional to support partial updates via `updateConfig`
|
|
143
|
-
*/
|
|
144
|
-
export type PartialNodeConfig = Partial<RecommendationNodeConfig>;
|
|
145
|
-
/**
|
|
146
|
-
* Deep partial for nested objects
|
|
147
|
-
*/
|
|
148
|
-
export type DeepPartialNodeConfig = {
|
|
149
|
-
[K in keyof RecommendationNodeConfig]?: RecommendationNodeConfig[K] extends object ? Partial<RecommendationNodeConfig[K]> : RecommendationNodeConfig[K];
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Check if an object is a valid RecommendationNodeConfig
|
|
153
|
-
* Used for migration detection and validation
|
|
154
|
-
*/
|
|
155
|
-
export declare function isValidNodeConfig(obj: unknown): obj is RecommendationNodeConfig;
|
|
156
|
-
/**
|
|
157
|
-
* Check if a node config has the minimum required fields
|
|
158
|
-
* Used to detect legacy templates that need migration
|
|
159
|
-
*/
|
|
160
|
-
export declare function hasMinimalConfig(obj: unknown): boolean;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Price Formatting Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides functions for formatting prices according to currency settings.
|
|
5
|
-
* Used to format prices displayed in recommendation product cards.
|
|
6
|
-
*/
|
|
7
|
-
import type { CurrencyConfig } from '../types/nodeConfig';
|
|
8
|
-
/**
|
|
9
|
-
* Options for formatting a price
|
|
10
|
-
*/
|
|
11
|
-
export interface FormatPriceOptions {
|
|
12
|
-
/** The numeric price value */
|
|
13
|
-
price: number;
|
|
14
|
-
/** Currency configuration */
|
|
15
|
-
currency: CurrencyConfig;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Formats a numeric price according to currency settings
|
|
19
|
-
* @example
|
|
20
|
-
* // Returns: "$ 1,999.99"
|
|
21
|
-
* formatPrice({ price: 1999.99, currency: currencyConfig })
|
|
22
|
-
* @param options - Formatting options
|
|
23
|
-
* @returns Formatted price string
|
|
24
|
-
*/
|
|
25
|
-
export declare function formatPrice(options: FormatPriceOptions): string;
|
|
26
|
-
/**
|
|
27
|
-
* Parses a formatted price string back to a number
|
|
28
|
-
* Useful for extracting numeric values from formatted price displays
|
|
29
|
-
* @param formattedPrice - The formatted price string
|
|
30
|
-
* @param currency - Currency configuration for parsing
|
|
31
|
-
* @returns Parsed numeric value or NaN if parsing fails
|
|
32
|
-
*/
|
|
33
|
-
export declare function parseFormattedPrice(formattedPrice: string, currency: CurrencyConfig): number;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Style Preserver Utility
|
|
3
|
-
*
|
|
4
|
-
* Captures and restores element styles during block regeneration.
|
|
5
|
-
* This ensures user styling is preserved when:
|
|
6
|
-
* - Layout changes (grid <-> list)
|
|
7
|
-
* - Cards per row changes
|
|
8
|
-
* - Composition order changes
|
|
9
|
-
*
|
|
10
|
-
* Works with the node config system to provide complete style persistence.
|
|
11
|
-
*/
|
|
12
|
-
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
13
|
-
import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
14
|
-
/**
|
|
15
|
-
* Style properties that can be captured for text elements
|
|
16
|
-
*/
|
|
17
|
-
export interface TextElementStyles {
|
|
18
|
-
fontSize?: string;
|
|
19
|
-
fontFamily?: string;
|
|
20
|
-
fontWeight?: string;
|
|
21
|
-
fontStyle?: string;
|
|
22
|
-
color?: string;
|
|
23
|
-
textAlign?: string;
|
|
24
|
-
lineHeight?: string;
|
|
25
|
-
textDecoration?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Style properties for button elements
|
|
29
|
-
*/
|
|
30
|
-
export interface ButtonElementStyles extends TextElementStyles {
|
|
31
|
-
backgroundColor?: string;
|
|
32
|
-
borderRadius?: string;
|
|
33
|
-
border?: string;
|
|
34
|
-
padding?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Style properties for image elements
|
|
38
|
-
*/
|
|
39
|
-
export interface ImageElementStyles {
|
|
40
|
-
width?: string;
|
|
41
|
-
height?: string;
|
|
42
|
-
maxWidth?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Complete captured styles for a recommendation block
|
|
46
|
-
*/
|
|
47
|
-
export interface CapturedStyles {
|
|
48
|
-
/** Product name text styles */
|
|
49
|
-
name: TextElementStyles;
|
|
50
|
-
/** Current price text styles */
|
|
51
|
-
price: TextElementStyles;
|
|
52
|
-
/** Original/old price text styles */
|
|
53
|
-
oldPrice: TextElementStyles;
|
|
54
|
-
/** Omnibus price text styles */
|
|
55
|
-
omnibusPrice: TextElementStyles;
|
|
56
|
-
/** Omnibus discount text styles */
|
|
57
|
-
omnibusDiscount: TextElementStyles;
|
|
58
|
-
/** CTA button styles */
|
|
59
|
-
button: ButtonElementStyles;
|
|
60
|
-
/** Product image styles */
|
|
61
|
-
image: ImageElementStyles;
|
|
62
|
-
/** Card background color */
|
|
63
|
-
cardBackgroundColor: string | null;
|
|
64
|
-
/** Column spacing in pixels */
|
|
65
|
-
columnSpacing: number;
|
|
66
|
-
/** Row spacing in pixels */
|
|
67
|
-
rowSpacing: number;
|
|
68
|
-
/** Element composition order */
|
|
69
|
-
composition: string[];
|
|
70
|
-
/** Element visibility flags */
|
|
71
|
-
visibility: Record<string, boolean>;
|
|
72
|
-
}
|
|
73
|
-
type DocumentModifier = {
|
|
74
|
-
modifyHtml: (node: ImmutableHtmlNode) => {
|
|
75
|
-
setStyle: (prop: string, value: string) => DocumentModifier;
|
|
76
|
-
};
|
|
77
|
-
apply: (description: ModificationDescription) => void;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Capture all styles from a recommendation block
|
|
81
|
-
*
|
|
82
|
-
* Call this BEFORE any operation that regenerates the block HTML.
|
|
83
|
-
* The captured styles can then be restored after regeneration.
|
|
84
|
-
* @example
|
|
85
|
-
* // Before layout change
|
|
86
|
-
* const styles = captureStyles(this.currentNode);
|
|
87
|
-
*
|
|
88
|
-
* // ... regenerate block HTML ...
|
|
89
|
-
*
|
|
90
|
-
* // After regeneration
|
|
91
|
-
* restoreStyles(this.currentNode, this.api.getDocumentModifier(), styles);
|
|
92
|
-
* @param node - The block node to capture styles from
|
|
93
|
-
* @returns Complete captured styles object
|
|
94
|
-
*/
|
|
95
|
-
export declare function captureStyles(node: ImmutableHtmlNode | null | undefined): CapturedStyles;
|
|
96
|
-
/**
|
|
97
|
-
* Restore captured styles to a regenerated block
|
|
98
|
-
*
|
|
99
|
-
* Call this AFTER regenerating block HTML to reapply user styling.
|
|
100
|
-
* @example
|
|
101
|
-
* restoreStyles(this.currentNode, this.api.getDocumentModifier(), capturedStyles);
|
|
102
|
-
* @param node - The block node to restore styles to
|
|
103
|
-
* @param modifier - Document modifier for applying changes
|
|
104
|
-
* @param styles - Previously captured styles
|
|
105
|
-
*/
|
|
106
|
-
export declare function restoreStyles(node: ImmutableHtmlNode | null | undefined, modifier: DocumentModifier, styles: CapturedStyles): void;
|
|
107
|
-
/**
|
|
108
|
-
* Check if styles have meaningful content worth restoring
|
|
109
|
-
* @param styles - Captured styles to check
|
|
110
|
-
* @returns True if styles contain restorable content
|
|
111
|
-
*/
|
|
112
|
-
export declare function hasRestorableStyles(styles: CapturedStyles): boolean;
|
|
113
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node Type Guards and Tag Name Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe utilities for working with ImmutableHtmlNode.
|
|
5
|
-
* Handles both standard DOM properties and Stripo's custom methods.
|
|
6
|
-
*/
|
|
7
|
-
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
8
|
-
/** Interface for nodes with standard tagName property */
|
|
9
|
-
interface NodeWithTagName {
|
|
10
|
-
tagName: string;
|
|
11
|
-
}
|
|
12
|
-
/** Interface for nodes with getStyle method */
|
|
13
|
-
export interface NodeWithGetStyle {
|
|
14
|
-
getStyle: (property: string) => string | null | undefined;
|
|
15
|
-
}
|
|
16
|
-
/** Interface for nodes with parent method */
|
|
17
|
-
export interface NodeWithParent {
|
|
18
|
-
parent: () => ImmutableHtmlNode | null;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Type guard to check if a node has getStyle method
|
|
22
|
-
* @param node - The node to check
|
|
23
|
-
*/
|
|
24
|
-
export declare function hasGetStyle(node: unknown): node is NodeWithGetStyle;
|
|
25
|
-
/**
|
|
26
|
-
* Type guard to check if a node has parent method
|
|
27
|
-
* @param node - The node to check
|
|
28
|
-
*/
|
|
29
|
-
export declare function hasParent(node: unknown): node is NodeWithParent;
|
|
30
|
-
/**
|
|
31
|
-
* Type guard to check if a node is a TD element
|
|
32
|
-
* @param node - The node to check
|
|
33
|
-
*/
|
|
34
|
-
export declare function isTdNode(node: unknown): node is ImmutableHtmlNode & NodeWithTagName;
|
|
35
|
-
/**
|
|
36
|
-
* Safely retrieves a style value from a node
|
|
37
|
-
* @param node - The node to get the style from
|
|
38
|
-
* @param property - The CSS property name
|
|
39
|
-
* @returns The style value or null if not accessible
|
|
40
|
-
*/
|
|
41
|
-
export declare function safeGetStyle(node: ImmutableHtmlNode | null, property: string): string | null | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Safely retrieves the parent element of a node
|
|
44
|
-
* @param node - The node to get the parent from
|
|
45
|
-
* @returns The parent node or null if not accessible
|
|
46
|
-
*/
|
|
47
|
-
export declare function safeGetParent(node: ImmutableHtmlNode | null): ImmutableHtmlNode | null;
|
|
48
|
-
/**
|
|
49
|
-
* Safely retrieves the tag name from a node.
|
|
50
|
-
* Handles both standard DOM tagName property and Stripo's getTagName() method.
|
|
51
|
-
* @param node - The node to get the tag name from
|
|
52
|
-
* @param defaultValue - Default value if tag name cannot be determined (default: 'UNKNOWN')
|
|
53
|
-
* @returns The uppercase tag name
|
|
54
|
-
*/
|
|
55
|
-
export declare function getTagName(node: ImmutableHtmlNode | null | undefined, defaultValue?: string): string;
|
|
56
|
-
/**
|
|
57
|
-
* Checks if a tag name represents a table cell element.
|
|
58
|
-
* Includes standard TD and Stripo's custom block types (BLOCK_IMAGE, BLOCK_BUTTON).
|
|
59
|
-
* @param tagName - The tag name to check (case-insensitive)
|
|
60
|
-
* @returns True if the tag represents a table cell
|
|
61
|
-
*/
|
|
62
|
-
export declare function isTableCellTag(tagName: string): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Checks if a node is a table cell element.
|
|
65
|
-
* Combines getTagName and isTableCellTag for convenience.
|
|
66
|
-
* @param node - The node to check
|
|
67
|
-
* @returns True if the node is a table cell element
|
|
68
|
-
*/
|
|
69
|
-
export declare function isTableCellNode(node: ImmutableHtmlNode | null | undefined): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Gets the appropriate CSS display value for showing a table element.
|
|
72
|
-
* Table cells use 'table-cell', table rows use 'table-row'.
|
|
73
|
-
* @param node - The table element node
|
|
74
|
-
* @returns The CSS display value ('table-cell' or 'table-row')
|
|
75
|
-
*/
|
|
76
|
-
export declare function getTableDisplayValue(node: ImmutableHtmlNode | null | undefined): 'table-cell' | 'table-row';
|
|
77
|
-
export {};
|