@useinsider/guido 3.7.2-beta.1e8f93e → 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 +90 -82
- package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/extensions/Blocks/Items/block.js +29 -48
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +45 -62
- 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/controls/cardComposition/index.js +369 -288
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +83 -81
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +109 -78
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -30
- package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +78 -61
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +90 -55
- 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/block.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- 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/pricePlacement.d.ts +59 -0
- 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 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +39 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
|
@@ -43,6 +43,15 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
43
43
|
*/
|
|
44
44
|
private _tryReorderInPlace;
|
|
45
45
|
private _createBuiltInItemHtml;
|
|
46
|
+
/**
|
|
47
|
+
* Inline mode: the merged "Product Prices" group item. It moves as a unit in
|
|
48
|
+
* the main list (both keys stay adjacent) and contains a nested 2-item drag
|
|
49
|
+
* to reorder Product Price ↔ Product Original Price — which flips the inline
|
|
50
|
+
* render order via `resolveInlinePriceOrder`. The group keeps a single
|
|
51
|
+
* visibility toggle (`data-action-for="productPrice"`). Nested sub-items use a
|
|
52
|
+
* plain drag handle (no UE button → untouched by the reorder-icon rescue).
|
|
53
|
+
*/
|
|
54
|
+
private _createPriceGroupItemHtml;
|
|
46
55
|
private _createCustomItemHtml;
|
|
47
56
|
/**
|
|
48
57
|
* Builds select options from the store's filterList.
|
|
@@ -98,7 +107,23 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
98
107
|
*/
|
|
99
108
|
private _rescueReorderIconsToStore;
|
|
100
109
|
private _setupEventListeners;
|
|
110
|
+
/**
|
|
111
|
+
* Builds the composition key order from the orderable list, expanding the
|
|
112
|
+
* inline "Product Prices" group into its two sub-keys (in nested DOM order)
|
|
113
|
+
* so both price keys stay adjacent and in the user-chosen order.
|
|
114
|
+
*/
|
|
115
|
+
private _extractCompositionOrder;
|
|
101
116
|
private _setupDragAndDrop;
|
|
117
|
+
/**
|
|
118
|
+
* Wires drag/drop reordering for one item level on the shared list. Both the
|
|
119
|
+
* top-level items and the nested price sub-items use this; they never fight
|
|
120
|
+
* because each only sets its `dragged` ref when its own `itemSelector` matches
|
|
121
|
+
* at dragstart (and the top-level one additionally ignores drags originating
|
|
122
|
+
* inside `ignoreSelector`). Every drop re-reads the full composition via
|
|
123
|
+
* `_extractCompositionOrder`, so both levels commit through `_onReorder`
|
|
124
|
+
* identically.
|
|
125
|
+
*/
|
|
126
|
+
private _registerDragHandlers;
|
|
102
127
|
private _setupDeleteHandler;
|
|
103
128
|
private _onAddAttribute;
|
|
104
129
|
/**
|
|
@@ -155,9 +180,10 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
155
180
|
private _extractSegmentBgFromCard;
|
|
156
181
|
private _getControlContainer;
|
|
157
182
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
183
|
+
* Ensures composition reorder is enabled. Both grid and list layouts now
|
|
184
|
+
* support reordering — top-level items and the nested price sub-items are all
|
|
185
|
+
* draggable. (Items render with `draggable="true"`; this just clears any stale
|
|
186
|
+
* disabled state.)
|
|
161
187
|
*/
|
|
162
188
|
private _updateOrderableState;
|
|
163
189
|
/**
|
|
@@ -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;
|
|
@@ -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 {};
|
|
@@ -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 } from '../utils';
|
|
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 } 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): string;
|
|
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): string;
|
|
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): string;
|
|
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, } from './utils';
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
+
import { type PricePlacementFlags } from '../utils';
|
|
2
3
|
/**
|
|
3
4
|
* Generates a list product card with 3-column layout
|
|
4
5
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -11,7 +12,7 @@ import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommenda
|
|
|
11
12
|
* @param composition - Array defining order of card elements
|
|
12
13
|
* @returns HTML string for a single product card row
|
|
13
14
|
*/
|
|
14
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse): string;
|
|
15
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
15
16
|
/**
|
|
16
17
|
* Prepares list product rows
|
|
17
18
|
* Each product is a full-width row with 3-column layout
|
|
@@ -19,6 +20,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
19
20
|
* @param composition - Array defining order of card elements
|
|
20
21
|
* @returns HTML string for product rows
|
|
21
22
|
*/
|
|
22
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse): string;
|
|
23
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse, flags?: PricePlacementFlags): string;
|
|
23
24
|
export declare function getDefaultTemplate(): string;
|
|
24
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
|
|
@@ -57,7 +86,15 @@ export type Orientation = 'list' | 'grid';
|
|
|
57
86
|
/**
|
|
58
87
|
* Options for prepareProductRows unified function
|
|
59
88
|
*/
|
|
60
|
-
|
|
89
|
+
/**
|
|
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).
|
|
93
|
+
*/
|
|
94
|
+
export interface PricePlacementFlags {
|
|
95
|
+
priceInline?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface PrepareProductRowsOptions extends PricePlacementFlags {
|
|
61
98
|
/** Number of products per row (only for grid layout, defaults to 3) */
|
|
62
99
|
productsPerRow?: number;
|
|
63
100
|
/** Number of products per row on mobile (only for grid layout, defaults to 1) */
|
|
@@ -124,3 +161,4 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
|
|
|
124
161
|
* @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
|
|
125
162
|
*/
|
|
126
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
|
|
@@ -65,6 +65,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
65
65
|
blockType?: string | undefined;
|
|
66
66
|
size?: string | number | undefined;
|
|
67
67
|
verticalResponsiveness?: boolean | undefined;
|
|
68
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
69
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
68
70
|
} & {
|
|
69
71
|
[key: string]: unknown;
|
|
70
72
|
};
|
|
@@ -197,6 +199,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
197
199
|
blockType?: string | undefined;
|
|
198
200
|
size?: string | number | undefined;
|
|
199
201
|
verticalResponsiveness?: boolean | undefined;
|
|
202
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
203
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
200
204
|
} & {
|
|
201
205
|
[key: string]: unknown;
|
|
202
206
|
};
|
|
@@ -329,6 +333,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
329
333
|
blockType?: string | undefined;
|
|
330
334
|
size?: string | number | undefined;
|
|
331
335
|
verticalResponsiveness?: boolean | undefined;
|
|
336
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
337
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
332
338
|
} & {
|
|
333
339
|
[key: string]: unknown;
|
|
334
340
|
};
|
|
@@ -461,6 +467,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
461
467
|
blockType?: string | undefined;
|
|
462
468
|
size?: string | number | undefined;
|
|
463
469
|
verticalResponsiveness?: boolean | undefined;
|
|
470
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
471
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
464
472
|
} & {
|
|
465
473
|
[key: string]: unknown;
|
|
466
474
|
};
|
|
@@ -593,6 +601,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
593
601
|
blockType?: string | undefined;
|
|
594
602
|
size?: string | number | undefined;
|
|
595
603
|
verticalResponsiveness?: boolean | undefined;
|
|
604
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
605
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
596
606
|
} & {
|
|
597
607
|
[key: string]: unknown;
|
|
598
608
|
};
|
|
@@ -725,6 +735,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
725
735
|
blockType?: string | undefined;
|
|
726
736
|
size?: string | number | undefined;
|
|
727
737
|
verticalResponsiveness?: boolean | undefined;
|
|
738
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
739
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
728
740
|
} & {
|
|
729
741
|
[key: string]: unknown;
|
|
730
742
|
};
|
|
@@ -857,6 +869,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
857
869
|
blockType?: string | undefined;
|
|
858
870
|
size?: string | number | undefined;
|
|
859
871
|
verticalResponsiveness?: boolean | undefined;
|
|
872
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
873
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
860
874
|
} & {
|
|
861
875
|
[key: string]: unknown;
|
|
862
876
|
};
|
|
@@ -989,6 +1003,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
989
1003
|
blockType?: string | undefined;
|
|
990
1004
|
size?: string | number | undefined;
|
|
991
1005
|
verticalResponsiveness?: boolean | undefined;
|
|
1006
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1007
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
992
1008
|
} & {
|
|
993
1009
|
[key: string]: unknown;
|
|
994
1010
|
};
|
|
@@ -1121,6 +1137,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1121
1137
|
blockType?: string | undefined;
|
|
1122
1138
|
size?: string | number | undefined;
|
|
1123
1139
|
verticalResponsiveness?: boolean | undefined;
|
|
1140
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1141
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1124
1142
|
} & {
|
|
1125
1143
|
[key: string]: unknown;
|
|
1126
1144
|
};
|
|
@@ -1253,6 +1271,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1253
1271
|
blockType?: string | undefined;
|
|
1254
1272
|
size?: string | number | undefined;
|
|
1255
1273
|
verticalResponsiveness?: boolean | undefined;
|
|
1274
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1275
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1256
1276
|
} & {
|
|
1257
1277
|
[key: string]: unknown;
|
|
1258
1278
|
};
|
|
@@ -1385,6 +1405,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1385
1405
|
blockType?: string | undefined;
|
|
1386
1406
|
size?: string | number | undefined;
|
|
1387
1407
|
verticalResponsiveness?: boolean | undefined;
|
|
1408
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1409
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1388
1410
|
} & {
|
|
1389
1411
|
[key: string]: unknown;
|
|
1390
1412
|
};
|
|
@@ -1517,6 +1539,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1517
1539
|
blockType?: string | undefined;
|
|
1518
1540
|
size?: string | number | undefined;
|
|
1519
1541
|
verticalResponsiveness?: boolean | undefined;
|
|
1542
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1543
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1520
1544
|
} & {
|
|
1521
1545
|
[key: string]: unknown;
|
|
1522
1546
|
};
|
|
@@ -1649,6 +1673,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1649
1673
|
blockType?: string | undefined;
|
|
1650
1674
|
size?: string | number | undefined;
|
|
1651
1675
|
verticalResponsiveness?: boolean | undefined;
|
|
1676
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1677
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1652
1678
|
} & {
|
|
1653
1679
|
[key: string]: unknown;
|
|
1654
1680
|
};
|
|
@@ -1781,6 +1807,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1781
1807
|
blockType?: string | undefined;
|
|
1782
1808
|
size?: string | number | undefined;
|
|
1783
1809
|
verticalResponsiveness?: boolean | undefined;
|
|
1810
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1811
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1784
1812
|
} & {
|
|
1785
1813
|
[key: string]: unknown;
|
|
1786
1814
|
};
|
|
@@ -1913,6 +1941,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1913
1941
|
blockType?: string | undefined;
|
|
1914
1942
|
size?: string | number | undefined;
|
|
1915
1943
|
verticalResponsiveness?: boolean | undefined;
|
|
1944
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1945
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1916
1946
|
} & {
|
|
1917
1947
|
[key: string]: unknown;
|
|
1918
1948
|
};
|
|
@@ -2045,6 +2075,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2045
2075
|
blockType?: string | undefined;
|
|
2046
2076
|
size?: string | number | undefined;
|
|
2047
2077
|
verticalResponsiveness?: boolean | undefined;
|
|
2078
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2079
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2048
2080
|
} & {
|
|
2049
2081
|
[key: string]: unknown;
|
|
2050
2082
|
};
|
|
@@ -2177,6 +2209,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2177
2209
|
blockType?: string | undefined;
|
|
2178
2210
|
size?: string | number | undefined;
|
|
2179
2211
|
verticalResponsiveness?: boolean | undefined;
|
|
2212
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2213
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2180
2214
|
} & {
|
|
2181
2215
|
[key: string]: unknown;
|
|
2182
2216
|
};
|
|
@@ -2309,6 +2343,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2309
2343
|
blockType?: string | undefined;
|
|
2310
2344
|
size?: string | number | undefined;
|
|
2311
2345
|
verticalResponsiveness?: boolean | undefined;
|
|
2346
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2347
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2312
2348
|
} & {
|
|
2313
2349
|
[key: string]: unknown;
|
|
2314
2350
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.7.2-beta.
|
|
3
|
+
"version": "3.7.2-beta.2220fb0",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|