@useinsider/guido 3.7.2-beta.1489585 → 3.7.2-beta.2220fb0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +70 -66
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +100 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +92 -78
- package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/extensions/Blocks/Recommendation/block.js +60 -41
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +369 -288
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +338 -288
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -30
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +217 -155
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -56
- package/dist/extensions/Blocks/Recommendation/templates/index.js +10 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +135 -145
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -43
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +96 -109
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +47 -163
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -216
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* // Or individual imports
|
|
10
10
|
* import { NameAlignControl, ButtonColorControl } from './controls';
|
|
11
11
|
*/
|
|
12
|
-
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, } from './main';
|
|
12
|
+
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, } from './main';
|
|
13
13
|
export * from './main/utils';
|
|
14
14
|
export { NameControls } from './name';
|
|
15
15
|
export { PriceControls } from './price';
|
|
@@ -5,11 +5,12 @@ import { CurrencyControl, CURRENCY_CONTROL_ID } from './currency';
|
|
|
5
5
|
import { FiltersControl, FILTERS_CONTROL_ID } from './filters';
|
|
6
6
|
import { LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID } from './layoutOrientation';
|
|
7
7
|
import { LocaleControl, LOCALE_CONTROL_ID } from './locale';
|
|
8
|
+
import { PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID } from './pricePlacement';
|
|
8
9
|
import { ProductCountControl, PRODUCT_COUNT_CONTROL_ID } from './productCount';
|
|
9
10
|
import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
|
|
10
11
|
import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
|
|
11
12
|
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
12
|
-
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, };
|
|
13
|
+
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, };
|
|
13
14
|
export * from './utils';
|
|
14
15
|
/**
|
|
15
16
|
* Main recommendation block control that composes all sub-controls
|
|
@@ -26,6 +27,7 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
26
27
|
private productLayoutControl;
|
|
27
28
|
private filtersControl;
|
|
28
29
|
private shuffleControl;
|
|
30
|
+
private pricePlacementControl;
|
|
29
31
|
private layoutOrientationControl;
|
|
30
32
|
getId(): string;
|
|
31
33
|
getTemplate(): string;
|
|
@@ -31,8 +31,7 @@ export declare class LayoutOrientationControl extends CommonControl {
|
|
|
31
31
|
* Regenerates product rows based on the selected layout
|
|
32
32
|
* Uses unified style-preserving regeneration to maintain user customizations
|
|
33
33
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
34
|
-
* @param composition - The preserved card composition, incl. customAttr:* entries
|
|
35
34
|
*/
|
|
36
|
-
_regenerateProductRows(layout: Orientation
|
|
35
|
+
_regenerateProductRows(layout: Orientation): void;
|
|
37
36
|
_listenToFormUpdates(): void;
|
|
38
37
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Placement Control
|
|
3
|
+
*
|
|
4
|
+
* Two block-level price settings ported from the legacy product block, shown
|
|
5
|
+
* above the Currency control in the main Settings tab:
|
|
6
|
+
*
|
|
7
|
+
* - "Product Price Orientation" (`priceMovedToNextLine`): a vertical/horizontal
|
|
8
|
+
* icon radio (mirrors the Items block control). `vertical` (default) keeps the
|
|
9
|
+
* price and original price on separate stacked rows (current Guido look);
|
|
10
|
+
* `horizontal` renders them inline on the same line and Card Composition
|
|
11
|
+
* collapses them into a single "Product Prices" entry.
|
|
12
|
+
* - "Hide if same as discounted" (`priceHideIfSameAsDiscounted`): a toggle.
|
|
13
|
+
* When ON, email-service blanks the redundant original price at send time when
|
|
14
|
+
* it equals the sale price (see the `hide-price` block attribute below).
|
|
15
|
+
*
|
|
16
|
+
* Orientation re-renders the rows (it changes the saved template layout).
|
|
17
|
+
* Hide-if-same NEVER touches the template — it only persists config + stamps the
|
|
18
|
+
* `hide-price` attribute; the visual hide is simulated in the preview and applied
|
|
19
|
+
* for real server-side by email-service.
|
|
20
|
+
*/
|
|
21
|
+
import type { RecommendationNodeConfig } from '../../types/nodeConfig';
|
|
22
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
23
|
+
import { CommonControl } from '../../../common-control';
|
|
24
|
+
export declare const PRICE_PLACEMENT_CONTROL_ID = "recommendation-price-placement-control";
|
|
25
|
+
type Orientation = 'vertical' | 'horizontal';
|
|
26
|
+
/**
|
|
27
|
+
* Control for the block-level price orientation radio + hide-if-same toggle.
|
|
28
|
+
*/
|
|
29
|
+
export declare class PricePlacementControl extends CommonControl {
|
|
30
|
+
private store;
|
|
31
|
+
getId(): string;
|
|
32
|
+
getTemplate(): string;
|
|
33
|
+
onRender(): void;
|
|
34
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
35
|
+
_setFormValues(config: RecommendationNodeConfig): void;
|
|
36
|
+
_initializeHideToggle(config: RecommendationNodeConfig): void;
|
|
37
|
+
/**
|
|
38
|
+
* Disables the orientation radio when a price element is hidden via Card
|
|
39
|
+
* Composition — orientation is meaningless without both prices visible.
|
|
40
|
+
* Visibility lives on the attribute rows' `data-visibility` (set by the Card
|
|
41
|
+
* Composition control). Inline mode has no standalone original-price row, so
|
|
42
|
+
* the merged "Product Prices" entry (the price row) governs.
|
|
43
|
+
*/
|
|
44
|
+
_updateOrientationDisabled(): void;
|
|
45
|
+
_onOrientationChange(orientation: Orientation): void;
|
|
46
|
+
_onHideIfSameChange(value: boolean): void;
|
|
47
|
+
/**
|
|
48
|
+
* Mirrors the hide-if-same flag onto the durable `hide-price` block attribute
|
|
49
|
+
* read by email-service at send time.
|
|
50
|
+
*/
|
|
51
|
+
_stampHideIfSameAttr(value: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Rebuilds the product rows so the renderer re-reads the inline/stacked
|
|
54
|
+
* layout flag from the store. Used by the orientation change only.
|
|
55
|
+
*/
|
|
56
|
+
_regenerate(): void;
|
|
57
|
+
_listenToFormUpdates(): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -60,17 +60,39 @@ export interface RegenerateProductRowsOptions {
|
|
|
60
60
|
composition?: string[];
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Regenerates only the mobile product container rows
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* apply-free accumulateMobileProductRows() so the whole rebuild is one commit.
|
|
63
|
+
* Regenerates only the mobile product container rows.
|
|
64
|
+
* Used when mobile-specific settings change (mobileCardsInRow)
|
|
65
|
+
* or when the desktop container is regenerated (to keep both in sync).
|
|
67
66
|
*
|
|
68
|
-
* For list layout
|
|
69
|
-
* For grid layout with mobileLayoutEnabled
|
|
67
|
+
* For list layout: clears the mobile row content (list rows are inherently responsive).
|
|
68
|
+
* For grid layout with mobileLayoutEnabled OFF: clears the mobile row content.
|
|
69
|
+
* For grid layout with mobileLayoutEnabled ON: rebuilds the full mobile row
|
|
70
|
+
* structure (<td><table>...products...</table></td>) in a single operation.
|
|
70
71
|
*/
|
|
71
72
|
export declare function regenerateMobileProductRows(options: Omit<RegenerateProductRowsOptions, 'afterRegenerate'>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Regenerates product rows in the desktop container based on current store configuration.
|
|
75
|
+
* Also regenerates the mobile container to keep both in sync.
|
|
76
|
+
* Reads products, layout, and composition from store/DOM and rebuilds the HTML.
|
|
77
|
+
* @param options - Configuration options for regeneration
|
|
78
|
+
*/
|
|
79
|
+
export declare function regenerateProductRows(options: RegenerateProductRowsOptions): void;
|
|
80
|
+
export interface ReapplySpacingOptions {
|
|
81
|
+
currentNode: ImmutableHtmlNode | null | undefined;
|
|
82
|
+
documentModifier: DocumentModifier;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Reapplies spacing values after product regeneration.
|
|
86
|
+
* Desktop spacing applies only to the desktop container;
|
|
87
|
+
* mobile spacing applies only to the mobile container.
|
|
88
|
+
*
|
|
89
|
+
* Reads values from node config (primary) with data-attribute fallback
|
|
90
|
+
* for backward compatibility with pre-nodeConfig templates.
|
|
91
|
+
* @param options - Configuration options
|
|
92
|
+
*/
|
|
93
|
+
export declare function reapplySpacing(options: ReapplySpacingOptions): void;
|
|
72
94
|
export interface RegenerateWithStylesOptions extends Omit<RegenerateProductRowsOptions, 'products' | 'layout'> {
|
|
73
|
-
/** Skip style capture if styles were already handled externally */
|
|
95
|
+
/** Skip style capture/restore if styles were already handled externally */
|
|
74
96
|
skipStylePreservation?: boolean;
|
|
75
97
|
/** Optional: pass products directly instead of reading from store */
|
|
76
98
|
products?: RecommendationProduct[];
|
|
@@ -78,21 +100,26 @@ export interface RegenerateWithStylesOptions extends Omit<RegenerateProductRowsO
|
|
|
78
100
|
layout?: Orientation;
|
|
79
101
|
}
|
|
80
102
|
/**
|
|
81
|
-
* Regenerates product rows while preserving user-applied styles
|
|
103
|
+
* Regenerates product rows while preserving user-applied styles
|
|
104
|
+
*
|
|
105
|
+
* This unified function handles the complete regeneration flow:
|
|
106
|
+
* 1. Captures existing styles (fonts, colors, button styles, etc.)
|
|
107
|
+
* 2. Regenerates HTML with new products/layout
|
|
108
|
+
* 3. Restores captured styles to new elements
|
|
109
|
+
* 4. Reapplies spacing from data attributes
|
|
82
110
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* baked straight into the generated HTML.
|
|
88
|
-
* 3. Commit everything with ONE apply().
|
|
111
|
+
* NOTE: Style restoration is temporarily disabled due to Stripo selection bug.
|
|
112
|
+
* Multiple apply() calls (setInnerHtml + restoreStyles + reapplySpacing) cause
|
|
113
|
+
* Stripo's internal cursor/selection tracking to lose node references, resulting in
|
|
114
|
+
* "Cannot read properties of undefined (reading 'textContent')" errors.
|
|
89
115
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
116
|
+
* Use this instead of `regenerateProductRows` when styles must be preserved.
|
|
117
|
+
* @example
|
|
118
|
+
* // When products change (API response, count change, layout change)
|
|
119
|
+
* regenerateProductRowsWithStyles({
|
|
120
|
+
* currentNode: this.currentNode,
|
|
121
|
+
* documentModifier: this.api.getDocumentModifier(),
|
|
122
|
+
* });
|
|
96
123
|
* @param options - Configuration options for regeneration
|
|
97
124
|
*/
|
|
98
125
|
export declare function regenerateProductRowsWithStyles(options: RegenerateWithStylesOptions): void;
|
|
@@ -25,6 +25,8 @@ export interface PerBlockConfigs {
|
|
|
25
25
|
unresponsive: boolean;
|
|
26
26
|
size: string;
|
|
27
27
|
customAttributes: string[];
|
|
28
|
+
priceMovedToNextLine: boolean;
|
|
29
|
+
priceHideIfSameAsDiscounted: boolean;
|
|
28
30
|
}
|
|
29
31
|
interface PerBlockState {
|
|
30
32
|
recommendationConfigs: PerBlockConfigs;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
2
|
import { type ElementRenderer } from '../utils';
|
|
2
3
|
/**
|
|
3
4
|
* Grid element renderer
|
|
@@ -24,4 +25,19 @@ export declare const ATTRIBUTE_CELL_CLASS = "attribute-cell";
|
|
|
24
25
|
* card-composition control so both render identical filler markup.
|
|
25
26
|
*/
|
|
26
27
|
export declare function buildFillerCell(columnWidth: string, padding?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Renders the inline price cell used when "Move to next line" is OFF: the sale
|
|
30
|
+
* price and original price sit side by side in a single attribute cell, each
|
|
31
|
+
* keeping its own `esd-extension-block-id` + `product-*` class so the per-element
|
|
32
|
+
* style controls and the compiler keep working.
|
|
33
|
+
*
|
|
34
|
+
* `originalFirst` preserves the card-composition order (original before sale when
|
|
35
|
+
* `productOldPrice` precedes `productPrice` in the composition) so the side-by-side
|
|
36
|
+
* order matches the stacked order.
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderInlineGridPriceCell(product: RecommendationProduct, originalFirst?: boolean): string;
|
|
39
|
+
/**
|
|
40
|
+
* Standalone (stacked) original-price cell.
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderGridOldPriceCell(product: RecommendationProduct): string;
|
|
27
43
|
export declare const gridElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type ElementRenderer, type
|
|
2
|
+
import { type ElementRenderer, type PricePlacementFlags } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates attribute-aligned product rows for grid layout.
|
|
5
5
|
* Creates rows where each row contains one attribute type from all products.
|
|
@@ -9,7 +9,7 @@ import { type ElementRenderer, type RenderOptions } from '../utils';
|
|
|
9
9
|
* @param composition - Array defining order of card elements
|
|
10
10
|
* @returns HTML string for attribute-aligned rows
|
|
11
11
|
*/
|
|
12
|
-
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse,
|
|
12
|
+
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
13
13
|
/**
|
|
14
14
|
* Prepares grid product rows with attribute-aligned structure
|
|
15
15
|
* Groups products into rows, then generates attribute-aligned HTML for each group
|
|
@@ -19,7 +19,7 @@ export declare function prepareGridAttributeRows(products: RecommendationProduct
|
|
|
19
19
|
* @param composition - Array defining order of card elements
|
|
20
20
|
* @returns HTML string for all product rows
|
|
21
21
|
*/
|
|
22
|
-
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse,
|
|
22
|
+
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
23
23
|
/**
|
|
24
24
|
* Prepares grid product rows with attribute-aligned structure.
|
|
25
25
|
* Uses row-based rendering where each attribute type forms a single row across all products.
|
|
@@ -28,6 +28,6 @@ export declare function prepareGridProductRows(products: RecommendationProduct[]
|
|
|
28
28
|
* @param composition - Array defining element order
|
|
29
29
|
* @returns HTML string for product rows
|
|
30
30
|
*/
|
|
31
|
-
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse,
|
|
31
|
+
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
32
32
|
export declare function getDefaultTemplate(recommendationId?: number): string;
|
|
33
33
|
export declare function generateBlockTemplate(products: RecommendationProduct[], productsPerRow: number, title?: string, composition?: string[], mobileProductsPerRow?: number): string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
8
8
|
import { type Orientation, type PrepareProductRowsOptions } from './utils';
|
|
9
|
-
export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter,
|
|
9
|
+
export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, isSamePrice, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, } from './utils';
|
|
10
10
|
/**
|
|
11
11
|
* Unified function to prepare product rows for any layout.
|
|
12
12
|
* Delegates to the appropriate layout-specific implementation.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
2
|
import { type ElementRenderer } from '../utils';
|
|
2
3
|
/**
|
|
3
4
|
* List element renderer
|
|
@@ -5,4 +6,16 @@ import { type ElementRenderer } from '../utils';
|
|
|
5
6
|
* - Name and Prices return `<tr><td>` rows for the info cell table
|
|
6
7
|
* All elements have esd-block-* classes for Stripo selection
|
|
7
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Standalone (stacked) original-price info row.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderListOldPriceRow(product: RecommendationProduct): string;
|
|
13
|
+
/**
|
|
14
|
+
* Inline price info row used when "Move to next line" is OFF: the sale price and
|
|
15
|
+
* original price sit in two cells of one row. Each keeps its block id + class so
|
|
16
|
+
* style controls and the compiler keep working. `originalFirst` preserves the
|
|
17
|
+
* card-composition order (original before sale by default) so it matches the
|
|
18
|
+
* stacked order.
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderInlineListPriceRow(product: RecommendationProduct, originalFirst?: boolean): string;
|
|
8
21
|
export declare const listElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type
|
|
2
|
+
import { type PricePlacementFlags } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates a list product card with 3-column layout
|
|
5
5
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -12,7 +12,7 @@ import { type RenderOptions } from '../utils';
|
|
|
12
12
|
* @param composition - Array defining order of card elements
|
|
13
13
|
* @returns HTML string for a single product card row
|
|
14
14
|
*/
|
|
15
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse,
|
|
15
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
16
16
|
/**
|
|
17
17
|
* Prepares list product rows
|
|
18
18
|
* Each product is a full-width row with 3-column layout
|
|
@@ -20,6 +20,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
20
20
|
* @param composition - Array defining order of card elements
|
|
21
21
|
* @returns HTML string for product rows
|
|
22
22
|
*/
|
|
23
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse,
|
|
23
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
24
24
|
export declare function getDefaultTemplate(): string;
|
|
25
25
|
export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
+
import type { CurrencyConfig } from '../types/nodeConfig';
|
|
1
2
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
3
|
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';
|
|
4
|
+
type PriceKey = 'price' | 'original_price' | 'discount';
|
|
5
|
+
/**
|
|
6
|
+
* Current currency configuration from the store, in CurrencyConfig shape.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCurrentCurrencyConfig(): CurrencyConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Formats a product price using current currency settings. Falls back to the
|
|
11
|
+
* first available currency, then 0, when the active currency has no value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatProductPrice(product: RecommendationProduct, priceKey?: PriceKey): string;
|
|
14
|
+
/**
|
|
15
|
+
* True when the formatted sale price equals the formatted original price.
|
|
16
|
+
* Mirrors the email-service / preview hide-if-same comparison semantics
|
|
17
|
+
* (formatted-string equality, same currency fallback chain).
|
|
18
|
+
*/
|
|
19
|
+
export declare function isSamePrice(product: RecommendationProduct): boolean;
|
|
3
20
|
/**
|
|
4
21
|
* Converts a snake_case attribute name to Title Case display name.
|
|
5
22
|
* e.g., "rating_star" → "Rating Star"
|
|
6
23
|
*/
|
|
7
24
|
export declare function toDisplayName(attrName: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the inline (side-by-side) price layout from the composition order so
|
|
27
|
+
* it matches the stacked order. `anchor` is whichever of price / original price
|
|
28
|
+
* comes first in the composition (the merged cell renders there); `skip` is the
|
|
29
|
+
* other (dropped, since it's merged in); `originalFirst` puts the original price
|
|
30
|
+
* on the left when it precedes the sale price (the default composition order).
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveInlinePriceOrder(composition: string[]): {
|
|
33
|
+
originalFirst: boolean;
|
|
34
|
+
anchor: string;
|
|
35
|
+
skip: string;
|
|
36
|
+
};
|
|
8
37
|
/**
|
|
9
38
|
* Reduces a raw product-attribute value to a displayable scalar string.
|
|
10
39
|
* Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
|
|
@@ -25,20 +54,13 @@ export declare function isDefaultAttribute(attrName: string, filterList: Filters
|
|
|
25
54
|
* - Product attributes → "product_attribute.<name>" (e.g., "product_attribute.rating_star")
|
|
26
55
|
*/
|
|
27
56
|
export declare function resolveProductAttrValue(attrName: string, filterList: FiltersResponse): string;
|
|
28
|
-
/**
|
|
29
|
-
* Reverse of `resolveProductAttrValue`: maps a cell's `product-attr` value back to its
|
|
30
|
-
* `customAttr:<name>` composition key. The resolver only ever emits `<name>` (default
|
|
31
|
-
* attribute) or `product_attribute.<name>` (custom product attribute), so stripping the
|
|
32
|
-
* prefix recovers the attribute name without needing the store's filter list.
|
|
33
|
-
*/
|
|
34
|
-
export declare function toCustomCompositionKey(productAttrValue: string): string;
|
|
35
57
|
/**
|
|
36
58
|
* Callback that generates the cell HTML for a custom product attribute.
|
|
37
59
|
* Layout-specific: grid returns `<td>…`, list returns `<tr><td>…</td></tr>`.
|
|
38
60
|
* @param productAttrValue - The resolved `product-attr` value (e.g., "brand" or "product_attribute.rating_star")
|
|
39
61
|
* @param content - The display content for the cell
|
|
40
62
|
*/
|
|
41
|
-
export type CustomCellHtmlGetter = (productAttrValue: string, content: string
|
|
63
|
+
export type CustomCellHtmlGetter = (productAttrValue: string, content: string) => string;
|
|
42
64
|
/**
|
|
43
65
|
* Symbol key for embedding custom attribute HTML in an ElementRenderer.
|
|
44
66
|
* Grid and list renderers store their custom-attribute cell template under this key
|
|
@@ -62,98 +84,17 @@ export declare const CUSTOM_CELL_HTML: unique symbol;
|
|
|
62
84
|
export declare function buildElementRenderer(baseRenderer: ElementRenderer, composition: string[], filterList?: FiltersResponse): ElementRenderer;
|
|
63
85
|
export type Orientation = 'list' | 'grid';
|
|
64
86
|
/**
|
|
65
|
-
*
|
|
66
|
-
* styling back into regenerated HTML in a SINGLE setInnerHtml/apply pass.
|
|
67
|
-
*
|
|
68
|
-
* Stripo applies inline formats as TAGS (`<strong>`, `<em>`, `<s>`), not CSS, so we
|
|
69
|
-
* preserve the actual wrapper tags around the text — re-emitting `text-decoration`
|
|
70
|
-
* CSS would render a strike that Stripo's own toggle can't detect. `pStyle` carries
|
|
71
|
-
* the `<p>`-level inline CSS (font-size/color/align/etc.).
|
|
72
|
-
*/
|
|
73
|
-
export interface AttributeStyleTemplate {
|
|
74
|
-
/** Raw inline style for the `<p>`, e.g. "font-size: 18px; color: #111;" */
|
|
75
|
-
pStyle?: string;
|
|
76
|
-
/** Opening inline-format tags captured around the text (or button label), e.g. "<strong><em>" */
|
|
77
|
-
openTags?: string;
|
|
78
|
-
/** Matching closing tags in reverse order, e.g. "</em></strong>" */
|
|
79
|
-
closeTags?: string;
|
|
80
|
-
/** Button: inline style of the `<span class="es-button-border">` (background/border/radius). */
|
|
81
|
-
buttonBorderStyle?: string;
|
|
82
|
-
/** Button: inline style of the `<a class="es-button">` (color/background/font/padding/width). */
|
|
83
|
-
buttonAnchorStyle?: string;
|
|
84
|
-
/** Button: whether "Fit to Container" is on (the `es-fw` class on the border span). */
|
|
85
|
-
buttonFitToContainer?: boolean;
|
|
86
|
-
/** Button: the user-edited label text (without wrapper tags), e.g. "Shop Now" instead of "Buy". */
|
|
87
|
-
buttonText?: string;
|
|
88
|
-
/** Image: inline style of the `<img>` (width/height/max-width/border-radius/margin). */
|
|
89
|
-
imgStyle?: string;
|
|
90
|
-
}
|
|
91
|
-
/** Per-attribute style templates keyed by ATTR_PRODUCT_* composition key. */
|
|
92
|
-
export type AttributeStyleTemplates = Record<string, AttributeStyleTemplate>;
|
|
93
|
-
/** Per-attribute "Block Background Color" values keyed by ATTR_PRODUCT_* composition key. */
|
|
94
|
-
export type CellBackgroundColors = Record<string, string>;
|
|
95
|
-
/** Per-attribute text alignment (the cell's `align` attribute) keyed by ATTR_PRODUCT_* composition key. */
|
|
96
|
-
export type CellAlignments = Record<string, string>;
|
|
97
|
-
/** Per-attribute preserved cell classes (padding `es-p*`, margin `es-m*`, text-trim) keyed by attr. */
|
|
98
|
-
export type CellClasses = Record<string, string>;
|
|
99
|
-
/** A user-edited omnibus prefix/suffix, e.g. before = "Lowest 30-day price: ". */
|
|
100
|
-
export interface OmnibusText {
|
|
101
|
-
before?: string;
|
|
102
|
-
after?: string;
|
|
103
|
-
}
|
|
104
|
-
/** Per-attribute omnibus before/after texts keyed by ATTR_PRODUCT_OMNIBUS_* composition key. */
|
|
105
|
-
export type OmnibusTexts = Record<string, OmnibusText>;
|
|
106
|
-
/** Per-attribute visibility (show/hide) keyed by ATTR_PRODUCT_* composition key. */
|
|
107
|
-
export type AttributeVisibility = Record<string, boolean>;
|
|
108
|
-
/**
|
|
109
|
-
* Per-cell rendering context passed to each ElementRenderer function so a single
|
|
110
|
-
* regeneration can bake column spacing and preserved styles directly into the HTML.
|
|
87
|
+
* Options for prepareProductRows unified function
|
|
111
88
|
*/
|
|
112
|
-
export interface CellRenderOptions {
|
|
113
|
-
/** Column-spacing padding for the attribute cell, e.g. "0 7px". Falls back to DEFAULT_CELL_PADDING. */
|
|
114
|
-
cellPadding?: string;
|
|
115
|
-
/** Captured style template for this attribute (preserves user bold/italic/strike + p-style). */
|
|
116
|
-
styleTemplate?: AttributeStyleTemplate;
|
|
117
|
-
/** Card background color baked onto the `.product-card-segment` of every cell. */
|
|
118
|
-
cardBackgroundColor?: string;
|
|
119
|
-
/** This text attribute's "Block Background Color", baked onto its `[esd-extension-block-id]` cell. */
|
|
120
|
-
cellBackgroundColor?: string;
|
|
121
|
-
/** This text attribute's alignment, baked onto its `[esd-extension-block-id]` cell `align` attribute. */
|
|
122
|
-
cellAlignment?: string;
|
|
123
|
-
/** This cell's preserved spacing/text-trim classes, replacing the renderer's hardcoded `es-p*` defaults. */
|
|
124
|
-
cellClasses?: string;
|
|
125
|
-
/** Omnibus cell's user-edited before/after text, replacing the renderer's hardcoded prefix. */
|
|
126
|
-
omnibusText?: OmnibusText;
|
|
127
|
-
}
|
|
128
89
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
90
|
+
* Block-level price placement flags threaded into the row builders.
|
|
91
|
+
* - `priceInline`: render sale + original price on one line (skip the standalone
|
|
92
|
+
* original-price row).
|
|
132
93
|
*/
|
|
133
|
-
export interface
|
|
134
|
-
|
|
135
|
-
cellPadding?: string;
|
|
136
|
-
/** Row-spacing height in px baked into spacer rows between product rows. */
|
|
137
|
-
rowSpacingPx?: number;
|
|
138
|
-
/** Per-attribute captured style templates to preserve user styling across regeneration. */
|
|
139
|
-
styleTemplates?: AttributeStyleTemplates;
|
|
140
|
-
/** Card background color baked into the card containers (`.product-card-segment` / `.product-card-wrapper`). */
|
|
141
|
-
cardBackgroundColor?: string;
|
|
142
|
-
/** Per-attribute "Block Background Color" values baked onto each text cell across regeneration. */
|
|
143
|
-
cellBackgroundColors?: CellBackgroundColors;
|
|
144
|
-
/** Per-attribute text alignment baked onto each text cell's `align` attribute across regeneration. */
|
|
145
|
-
cellAlignments?: CellAlignments;
|
|
146
|
-
/** Per-attribute preserved cell classes (padding/margin/text-trim) re-baked across regeneration. */
|
|
147
|
-
cellClasses?: CellClasses;
|
|
148
|
-
/** Per-attribute omnibus before/after texts re-baked across regeneration. */
|
|
149
|
-
omnibusTexts?: OmnibusTexts;
|
|
150
|
-
/** Per-attribute visibility (show/hide) re-applied across regeneration; falls back to defaults. */
|
|
151
|
-
visibility?: AttributeVisibility;
|
|
94
|
+
export interface PricePlacementFlags {
|
|
95
|
+
priceInline?: boolean;
|
|
152
96
|
}
|
|
153
|
-
|
|
154
|
-
* Options for prepareProductRows unified function
|
|
155
|
-
*/
|
|
156
|
-
export interface PrepareProductRowsOptions extends RenderOptions {
|
|
97
|
+
export interface PrepareProductRowsOptions extends PricePlacementFlags {
|
|
157
98
|
/** Number of products per row (only for grid layout, defaults to 3) */
|
|
158
99
|
productsPerRow?: number;
|
|
159
100
|
/** Number of products per row on mobile (only for grid layout, defaults to 1) */
|
|
@@ -171,15 +112,15 @@ export interface PrepareProductRowsOptions extends RenderOptions {
|
|
|
171
112
|
* for custom attributes — used by `buildElementRenderer` to create custom entries.
|
|
172
113
|
*/
|
|
173
114
|
export interface ElementRenderer {
|
|
174
|
-
[ATTR_PRODUCT_IMAGE]: (product: RecommendationProduct
|
|
175
|
-
[ATTR_PRODUCT_NAME]: (product: RecommendationProduct
|
|
176
|
-
[ATTR_PRODUCT_PRICE]: (product: RecommendationProduct
|
|
177
|
-
[ATTR_PRODUCT_OLD_PRICE]: (product: RecommendationProduct
|
|
178
|
-
[ATTR_PRODUCT_OMNIBUS_PRICE]: (product: RecommendationProduct
|
|
179
|
-
[ATTR_PRODUCT_OMNIBUS_DISCOUNT]: (product: RecommendationProduct
|
|
180
|
-
[ATTR_PRODUCT_BUTTON]: (product: RecommendationProduct
|
|
115
|
+
[ATTR_PRODUCT_IMAGE]: (product: RecommendationProduct) => string;
|
|
116
|
+
[ATTR_PRODUCT_NAME]: (product: RecommendationProduct) => string;
|
|
117
|
+
[ATTR_PRODUCT_PRICE]: (product: RecommendationProduct) => string;
|
|
118
|
+
[ATTR_PRODUCT_OLD_PRICE]: (product: RecommendationProduct) => string;
|
|
119
|
+
[ATTR_PRODUCT_OMNIBUS_PRICE]: (product: RecommendationProduct) => string;
|
|
120
|
+
[ATTR_PRODUCT_OMNIBUS_DISCOUNT]: (product: RecommendationProduct) => string;
|
|
121
|
+
[ATTR_PRODUCT_BUTTON]: (product: RecommendationProduct) => string;
|
|
181
122
|
[CUSTOM_CELL_HTML]?: CustomCellHtmlGetter;
|
|
182
|
-
[key: string]: (product: RecommendationProduct
|
|
123
|
+
[key: string]: (product: RecommendationProduct) => string;
|
|
183
124
|
}
|
|
184
125
|
/**
|
|
185
126
|
* Product card getter function type
|
|
@@ -192,65 +133,7 @@ export declare const DEFAULTS: {
|
|
|
192
133
|
};
|
|
193
134
|
export declare const DEFAULT_CARD_COMPOSITION: string[];
|
|
194
135
|
export declare const DEFAULT_CARD_VISIBILITY: Record<string, boolean>;
|
|
195
|
-
|
|
196
|
-
export declare const DEFAULT_ROW_SPACING_PX = 10;
|
|
197
|
-
/**
|
|
198
|
-
* Builds a spacer row with the given height. Baking row spacing into the HTML lets
|
|
199
|
-
* regeneration use a single setInnerHtml/apply instead of a deferred reapply pass.
|
|
200
|
-
*/
|
|
201
|
-
export declare function buildSpacer(heightPx?: number): string;
|
|
202
|
-
export declare const spacer: string;
|
|
203
|
-
/**
|
|
204
|
-
* Resolves the `<p>` inline style for a text cell. When a captured template exists,
|
|
205
|
-
* it wins (even when empty — meaning the user cleared the style); otherwise the
|
|
206
|
-
* renderer's default style is used.
|
|
207
|
-
*/
|
|
208
|
-
export declare function resolvePStyle(defaultPStyle: string, template?: AttributeStyleTemplate): string;
|
|
209
|
-
/**
|
|
210
|
-
* Renders `<p>…text…</p>` for a text attribute, preserving captured inline-format
|
|
211
|
-
* tags (`<strong>`/`<em>`/`<s>`) and p-style when a template is supplied, or falling
|
|
212
|
-
* back to the renderer defaults. A present-but-empty template faithfully drops the
|
|
213
|
-
* default wrapper (e.g. the user removed bold).
|
|
214
|
-
*/
|
|
215
|
-
export declare function renderStyledParagraph(text: string, defaults: {
|
|
216
|
-
pStyle: string;
|
|
217
|
-
openTags: string;
|
|
218
|
-
closeTags: string;
|
|
219
|
-
}, template?: AttributeStyleTemplate): string;
|
|
220
|
-
/**
|
|
221
|
-
* Builds the inline style for a card container (`.product-card-segment` in grid,
|
|
222
|
-
* `.product-card-wrapper` in list), appending the captured card background color to any
|
|
223
|
-
* base style. Returns '' when there is nothing to set.
|
|
224
|
-
*/
|
|
225
|
-
export declare function resolveSegmentBgStyle(baseStyle: string, cardBackgroundColor?: string): string;
|
|
226
|
-
/**
|
|
227
|
-
* Builds the ` style="background-color: …"` attribute for a text attribute's
|
|
228
|
-
* `[esd-extension-block-id]` cell, baking in the captured "Block Background Color".
|
|
229
|
-
* Returns '' when there is nothing to set (the cell otherwise carries no inline style).
|
|
230
|
-
*/
|
|
231
|
-
export declare function cellBgStyleAttr(cellBackgroundColor?: string): string;
|
|
232
|
-
/** Resolves an omnibus cell's before/after text, falling back to the renderer's defaults. */
|
|
233
|
-
export declare function resolveOmnibusText(captured?: OmnibusText, defaultBefore?: string): Required<OmnibusText>;
|
|
234
|
-
/**
|
|
235
|
-
* Wraps a button label in the captured inline-format tags (bold/italic), or returns it
|
|
236
|
-
* plain. Mirrors text wrapper preservation for the button's `<a>` content.
|
|
237
|
-
*/
|
|
238
|
-
export declare function renderButtonLabel(label: string, template?: AttributeStyleTemplate): string;
|
|
239
|
-
/**
|
|
240
|
-
* Resolves the `<span class="es-button-border">` class, adding `es-fw` (full-width)
|
|
241
|
-
* when the captured template had "Fit to Container" on. Stripo applies fit via this
|
|
242
|
-
* class, not inline width, so we preserve the class across regeneration.
|
|
243
|
-
*/
|
|
244
|
-
export declare function resolveButtonBorderClass(template?: AttributeStyleTemplate): string;
|
|
245
|
-
/** Default inline style for the product image `<img>` (used when nothing is captured). */
|
|
246
|
-
export declare const DEFAULT_IMG_STYLE = "display: block; max-width: 100%; height: auto;";
|
|
247
|
-
/** Default inline style for the button `<span class="es-button-border">`. */
|
|
248
|
-
export declare const DEFAULT_BUTTON_BORDER_STYLE: string;
|
|
249
|
-
/**
|
|
250
|
-
* Default inline style for the button `<a class="es-button">`. The list layout appends its
|
|
251
|
-
* own `padding: 5px 30px;` on top of this shared base.
|
|
252
|
-
*/
|
|
253
|
-
export declare const DEFAULT_BUTTON_ANCHOR_STYLE: string;
|
|
136
|
+
export declare const spacer = "\n <tr>\n <td class=\"spacer\" style=\"height: 10px;\"></td>\n </tr>\n";
|
|
254
137
|
export declare const PLACEHOLDER_IMAGE = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
255
138
|
/**
|
|
256
139
|
* Sanitizes product image URLs for consistent rendering
|
|
@@ -278,3 +161,4 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
|
|
|
278
161
|
* @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
|
|
279
162
|
*/
|
|
280
163
|
export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
|
|
164
|
+
export {};
|
|
@@ -152,6 +152,21 @@ export interface RecommendationNodeConfig {
|
|
|
152
152
|
* Whether to trim long product names with ellipsis
|
|
153
153
|
*/
|
|
154
154
|
textTrimming: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Whether the price and original price render on separate stacked lines.
|
|
157
|
+
* - true (default): each on its own attribute row (current Guido look)
|
|
158
|
+
* - false: both rendered inline on the same line, and Card Composition
|
|
159
|
+
* collapses them into a single "Product Prices" entry
|
|
160
|
+
* Ported from the legacy product block's `isPriceMovedToNextLine`.
|
|
161
|
+
*/
|
|
162
|
+
priceMovedToNextLine: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Whether to hide the redundant original price when it equals the sale
|
|
165
|
+
* price (no real discount). Enforced in the real email via a liquid
|
|
166
|
+
* condition and mirrored in the editor on mock data.
|
|
167
|
+
* Ported from the legacy product block's `isPriceDeletedForZeroSale`.
|
|
168
|
+
*/
|
|
169
|
+
priceHideIfSameAsDiscounted: boolean;
|
|
155
170
|
/**
|
|
156
171
|
* Configuration version for future migrations
|
|
157
172
|
* Increment when making breaking changes to schema
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
/**
|
|
3
|
-
* Extracts the nested inline-format wrapper tags around text content, outermost first.
|
|
4
|
-
*
|
|
5
|
-
* Stripo applies bold/italic/underline/strike as tags (`<strong>/<em>/<u>/<s>`), so to
|
|
6
|
-
* preserve user formatting across a text swap or block regeneration we capture the actual
|
|
7
|
-
* wrapper tags rather than CSS.
|
|
8
|
-
* @example
|
|
9
|
-
* // '<strong><em>Hi</em></strong>' → { openTags: '<strong><em>', closeTags: '</em></strong>' }
|
|
10
|
-
* @param html - The inner HTML to parse
|
|
11
|
-
* @returns The concatenated opening tags and matching closing tags (empty strings if none)
|
|
12
|
-
*/
|
|
13
|
-
export declare function extractWrapperTags(html: string): {
|
|
14
|
-
openTags: string;
|
|
15
|
-
closeTags: string;
|
|
16
|
-
};
|
|
17
2
|
/**
|
|
18
3
|
* Preserves existing style tags when updating text content
|
|
19
4
|
*
|