@useinsider/guido 3.8.2-beta.189e91c → 3.8.2-beta.2ed8604

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.
Files changed (47) hide show
  1. package/dist/@types/config/schemas.js +66 -70
  2. package/dist/composables/usePreviewMode.js +14 -15
  3. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  4. package/dist/config/compiler/utils/recommendationCompilerUtils.js +80 -88
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +52 -53
  6. package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
  7. package/dist/extensions/Blocks/Recommendation/block.js +41 -60
  8. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +264 -345
  10. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +22 -21
  11. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +87 -99
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -162
  13. package/dist/extensions/Blocks/Recommendation/extension.js +29 -30
  14. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
  15. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +40 -64
  16. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -3
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +96 -130
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +54 -43
  19. package/dist/extensions/Blocks/Recommendation/templates/index.js +14 -17
  20. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +80 -86
  21. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +40 -31
  22. package/dist/extensions/Blocks/Recommendation/templates/utils.js +102 -155
  23. package/dist/extensions/Blocks/common-control.js +53 -41
  24. package/dist/src/@types/config/schemas.d.ts +0 -16
  25. package/dist/src/composables/useConfig.d.ts +0 -4
  26. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  27. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
  28. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
  29. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +1 -1
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
  32. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
  33. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -13
  34. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  35. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  36. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -10
  37. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  38. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -51
  39. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
  40. package/dist/src/extensions/Blocks/common-control.d.ts +7 -0
  41. package/dist/src/stores/config.d.ts +0 -36
  42. package/package.json +1 -1
  43. package/dist/composables/useRecommendationPreview.js +0 -111
  44. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +0 -16
  45. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
  46. package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
@@ -50,15 +50,6 @@ export declare class RecommendationCardCompositionControl extends CommonControl
50
50
  */
51
51
  private _tryReorderInPlace;
52
52
  private _createBuiltInItemHtml;
53
- /**
54
- * Inline mode: the merged "Product Prices" group item. It moves as a unit in
55
- * the main list (both keys stay adjacent) and contains a nested 2-item drag
56
- * to reorder Product Price ↔ Product Original Price — which flips the inline
57
- * render order via `resolveInlinePriceOrder`. The group keeps a single
58
- * visibility toggle (`data-action-for="productPrice"`). Nested sub-items use a
59
- * plain drag handle (no UE button → untouched by the reorder-icon rescue).
60
- */
61
- private _createPriceGroupItemHtml;
62
53
  private _createCustomItemHtml;
63
54
  /**
64
55
  * Builds select options from the store's filterList.
@@ -114,23 +105,7 @@ export declare class RecommendationCardCompositionControl extends CommonControl
114
105
  */
115
106
  private _rescueReorderIconsToStore;
116
107
  private _setupEventListeners;
117
- /**
118
- * Builds the composition key order from the orderable list, expanding the
119
- * inline "Product Prices" group into its two sub-keys (in nested DOM order)
120
- * so both price keys stay adjacent and in the user-chosen order.
121
- */
122
- private _extractCompositionOrder;
123
108
  private _setupDragAndDrop;
124
- /**
125
- * Wires drag/drop reordering for one item level on the shared list. Both the
126
- * top-level items and the nested price sub-items use this; they never fight
127
- * because each only sets its `dragged` ref when its own `itemSelector` matches
128
- * at dragstart (and the top-level one additionally ignores drags originating
129
- * inside `ignoreSelector`). Every drop re-reads the full composition via
130
- * `_extractCompositionOrder`, so both levels commit through `_onReorder`
131
- * identically.
132
- */
133
- private _registerDragHandlers;
134
109
  private _setupDeleteHandler;
135
110
  private _onAddAttribute;
136
111
  /**
@@ -187,10 +162,9 @@ export declare class RecommendationCardCompositionControl extends CommonControl
187
162
  private _extractSegmentBgFromCard;
188
163
  private _getControlContainer;
189
164
  /**
190
- * Ensures composition reorder is enabled. Both grid and list layouts now
191
- * support reordering top-level items and the nested price sub-items are all
192
- * draggable. (Items render with `draggable="true"`; this just clears any stale
193
- * disabled state.)
165
+ * Adds/removes orderable-disabled class based on layout orientation.
166
+ * List layout hides drag handles via CSS and disables draggable attribute
167
+ * to prevent native browser drag-and-drop from working without the handle.
194
168
  */
195
169
  private _updateOrderableState;
196
170
  /**
@@ -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, PricePlacementControl, PRICE_PLACEMENT_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, } from './main';
13
13
  export * from './main/utils';
14
14
  export { NameControls } from './name';
15
15
  export { PriceControls } from './price';
@@ -24,6 +24,6 @@ export declare class AlgorithmControl extends CommonControl {
24
24
  _initializeSelectItems(): void;
25
25
  _setProductIdsVisibility(strategy?: string): void;
26
26
  _onAlgorithmChange(value: string): void;
27
- _onProductIdsChange(value: string): void;
27
+ _onProductIdsChange(value: string[]): void;
28
28
  _listenToFormUpdates(): void;
29
29
  }
@@ -5,12 +5,11 @@ 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';
9
8
  import { ProductCountControl, PRODUCT_COUNT_CONTROL_ID } from './productCount';
10
9
  import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
11
10
  import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
12
11
  export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
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, };
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, };
14
13
  export * from './utils';
15
14
  /**
16
15
  * Main recommendation block control that composes all sub-controls
@@ -27,7 +26,6 @@ export declare class RecommendationBlockControl extends CommonControl {
27
26
  private productLayoutControl;
28
27
  private filtersControl;
29
28
  private shuffleControl;
30
- private pricePlacementControl;
31
29
  private layoutOrientationControl;
32
30
  getId(): string;
33
31
  getTemplate(): string;
@@ -25,8 +25,6 @@ export interface PerBlockConfigs {
25
25
  unresponsive: boolean;
26
26
  size: string;
27
27
  customAttributes: string[];
28
- priceMovedToNextLine: boolean;
29
- priceHideIfSameAsDiscounted: boolean;
30
28
  }
31
29
  interface PerBlockState {
32
30
  recommendationConfigs: PerBlockConfigs;
@@ -1,5 +1,4 @@
1
- import type { RecommendationProduct } from '@@/Types/recommendation';
2
- import { type ElementRenderer, type CellRenderOptions } from '../utils';
1
+ import { type ElementRenderer } from '../utils';
3
2
  /**
4
3
  * Grid element renderer
5
4
  * Each element returns a `<td>` containing a nested table structure:
@@ -25,15 +24,4 @@ export declare const ATTRIBUTE_CELL_CLASS = "attribute-cell";
25
24
  * card-composition control so both render identical filler markup.
26
25
  */
27
26
  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, priceOptions?: CellRenderOptions, oldPriceOptions?: CellRenderOptions, cardBackgroundColor?: string): string;
39
27
  export declare const gridElementRenderer: ElementRenderer;
@@ -1,5 +1,5 @@
1
1
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
2
- import { type ElementRenderer, type PricePlacementFlags, type RenderOptions } from '../utils';
2
+ import { type ElementRenderer, type RenderOptions } 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 PricePlacementFlags, type RenderOptions } fr
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, renderOptions?: RenderOptions & PricePlacementFlags): string;
12
+ export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): 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, renderOptions?: RenderOptions & PricePlacementFlags): string;
22
+ export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): 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, renderOptions?: RenderOptions & PricePlacementFlags): string;
31
+ export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): 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, isSamePrice, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, type AttributeStyleTemplate, type AttributeStyleTemplates, type CellBackgroundColors, type CellAlignments, type CellClasses, type OmnibusTexts, } from './utils';
9
+ export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, type AttributeStyleTemplate, type AttributeStyleTemplates, type CellBackgroundColors, type CellAlignments, type CellClasses, type OmnibusTexts, } 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,17 +1,8 @@
1
- import type { RecommendationProduct } from '@@/Types/recommendation';
2
- import { type ElementRenderer, type CellRenderOptions } from '../utils';
1
+ import { type ElementRenderer } from '../utils';
3
2
  /**
4
3
  * List element renderer
5
4
  * - Image and Button return `<td>` cells for the 3-column layout
6
5
  * - Name and Prices return `<tr><td>` rows for the info cell table
7
6
  * All elements have esd-block-* classes for Stripo selection
8
7
  */
9
- /**
10
- * Inline price info row used when "Move to next line" is OFF: the sale price and
11
- * original price sit in two cells of one row. Each keeps its block id + class so
12
- * style controls and the compiler keep working. `originalFirst` preserves the
13
- * card-composition order (original before sale by default) so it matches the
14
- * stacked order.
15
- */
16
- export declare function renderInlineListPriceRow(product: RecommendationProduct, originalFirst?: boolean, priceOptions?: CellRenderOptions, oldPriceOptions?: CellRenderOptions): string;
17
8
  export declare const listElementRenderer: ElementRenderer;
@@ -1,5 +1,5 @@
1
1
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
2
- import { type PricePlacementFlags, type RenderOptions } from '../utils';
2
+ import { type RenderOptions } 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 PricePlacementFlags, 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, renderOptions?: RenderOptions & PricePlacementFlags): string;
15
+ export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): 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, renderOptions?: RenderOptions & PricePlacementFlags): string;
23
+ export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): string;
24
24
  export declare function getDefaultTemplate(): string;
25
25
  export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
@@ -1,39 +1,10 @@
1
- import type { CurrencyConfig } from '../types/nodeConfig';
2
1
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
3
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';
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;
20
3
  /**
21
4
  * Converts a snake_case attribute name to Title Case display name.
22
5
  * e.g., "rating_star" → "Rating Star"
23
6
  */
24
7
  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
- };
37
8
  /**
38
9
  * Reduces a raw product-attribute value to a displayable scalar string.
39
10
  * Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
@@ -179,24 +150,10 @@ export interface RenderOptions {
179
150
  /** Per-attribute visibility (show/hide) re-applied across regeneration; falls back to defaults. */
180
151
  visibility?: AttributeVisibility;
181
152
  }
182
- /**
183
- * Builds the per-attribute `CellRenderOptions` for one composition key from the block-level
184
- * `RenderOptions`. Single source for both the stacked per-cell options and the two inline
185
- * (price + old-price) option sets, so style capture → re-bake stays consistent across layouts.
186
- */
187
- export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions): CellRenderOptions;
188
153
  /**
189
154
  * Options for prepareProductRows unified function
190
155
  */
191
- /**
192
- * Block-level price placement flags threaded into the row builders.
193
- * - `priceInline`: render sale + original price on one line (skip the standalone
194
- * original-price row).
195
- */
196
- export interface PricePlacementFlags {
197
- priceInline?: boolean;
198
- }
199
- export interface PrepareProductRowsOptions extends PricePlacementFlags, RenderOptions {
156
+ export interface PrepareProductRowsOptions extends RenderOptions {
200
157
  /** Number of products per row (only for grid layout, defaults to 3) */
201
158
  productsPerRow?: number;
202
159
  /** Number of products per row on mobile (only for grid layout, defaults to 1) */
@@ -266,12 +223,6 @@ export declare function renderStyledParagraph(text: string, defaults: {
266
223
  * base style. Returns '' when there is nothing to set.
267
224
  */
268
225
  export declare function resolveSegmentBgStyle(baseStyle: string, cardBackgroundColor?: string): string;
269
- /**
270
- * The ` background-color: …;` CSS fragment for a captured "Block Background Color", or ''.
271
- * Use this when merging into an existing `style="…"` attribute; use `cellBgStyleAttr` when the
272
- * cell has no other inline style and needs the whole attribute.
273
- */
274
- export declare function bgColorFragment(color?: string): string;
275
226
  /**
276
227
  * Builds the ` style="background-color: …"` attribute for a text attribute's
277
228
  * `[esd-extension-block-id]` cell, baking in the captured "Block Background Color".
@@ -327,4 +278,3 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
327
278
  * @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
328
279
  */
329
280
  export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
330
- export {};
@@ -152,21 +152,6 @@ 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;
170
155
  /**
171
156
  * Configuration version for future migrations
172
157
  * Increment when making breaking changes to schema
@@ -6,6 +6,12 @@ interface TextInputProps {
6
6
  className?: string;
7
7
  disabled?: boolean;
8
8
  }
9
+ interface MultiSelectProps {
10
+ name: string;
11
+ placeholder?: string;
12
+ className?: string;
13
+ disabled?: boolean;
14
+ }
9
15
  interface LabelProps {
10
16
  text: string;
11
17
  name?: string;
@@ -145,5 +151,6 @@ export declare abstract class CommonControl extends Control {
145
151
  value: string;
146
152
  }[]): string;
147
153
  _GuCheckbox(name: string, caption: string): string;
154
+ _GuMultiSelect({ name, placeholder, className, disabled }: MultiSelectProps): string;
148
155
  }
149
156
  export {};
@@ -65,8 +65,6 @@ 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;
70
68
  } & {
71
69
  [key: string]: unknown;
72
70
  };
@@ -199,8 +197,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
199
197
  blockType?: string | undefined;
200
198
  size?: string | number | undefined;
201
199
  verticalResponsiveness?: boolean | undefined;
202
- isPriceMovedToNextLine?: boolean | undefined;
203
- isPriceDeletedForZeroSale?: boolean | undefined;
204
200
  } & {
205
201
  [key: string]: unknown;
206
202
  };
@@ -333,8 +329,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
333
329
  blockType?: string | undefined;
334
330
  size?: string | number | undefined;
335
331
  verticalResponsiveness?: boolean | undefined;
336
- isPriceMovedToNextLine?: boolean | undefined;
337
- isPriceDeletedForZeroSale?: boolean | undefined;
338
332
  } & {
339
333
  [key: string]: unknown;
340
334
  };
@@ -467,8 +461,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
467
461
  blockType?: string | undefined;
468
462
  size?: string | number | undefined;
469
463
  verticalResponsiveness?: boolean | undefined;
470
- isPriceMovedToNextLine?: boolean | undefined;
471
- isPriceDeletedForZeroSale?: boolean | undefined;
472
464
  } & {
473
465
  [key: string]: unknown;
474
466
  };
@@ -601,8 +593,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
601
593
  blockType?: string | undefined;
602
594
  size?: string | number | undefined;
603
595
  verticalResponsiveness?: boolean | undefined;
604
- isPriceMovedToNextLine?: boolean | undefined;
605
- isPriceDeletedForZeroSale?: boolean | undefined;
606
596
  } & {
607
597
  [key: string]: unknown;
608
598
  };
@@ -735,8 +725,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
735
725
  blockType?: string | undefined;
736
726
  size?: string | number | undefined;
737
727
  verticalResponsiveness?: boolean | undefined;
738
- isPriceMovedToNextLine?: boolean | undefined;
739
- isPriceDeletedForZeroSale?: boolean | undefined;
740
728
  } & {
741
729
  [key: string]: unknown;
742
730
  };
@@ -869,8 +857,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
869
857
  blockType?: string | undefined;
870
858
  size?: string | number | undefined;
871
859
  verticalResponsiveness?: boolean | undefined;
872
- isPriceMovedToNextLine?: boolean | undefined;
873
- isPriceDeletedForZeroSale?: boolean | undefined;
874
860
  } & {
875
861
  [key: string]: unknown;
876
862
  };
@@ -1003,8 +989,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1003
989
  blockType?: string | undefined;
1004
990
  size?: string | number | undefined;
1005
991
  verticalResponsiveness?: boolean | undefined;
1006
- isPriceMovedToNextLine?: boolean | undefined;
1007
- isPriceDeletedForZeroSale?: boolean | undefined;
1008
992
  } & {
1009
993
  [key: string]: unknown;
1010
994
  };
@@ -1137,8 +1121,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1137
1121
  blockType?: string | undefined;
1138
1122
  size?: string | number | undefined;
1139
1123
  verticalResponsiveness?: boolean | undefined;
1140
- isPriceMovedToNextLine?: boolean | undefined;
1141
- isPriceDeletedForZeroSale?: boolean | undefined;
1142
1124
  } & {
1143
1125
  [key: string]: unknown;
1144
1126
  };
@@ -1271,8 +1253,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1271
1253
  blockType?: string | undefined;
1272
1254
  size?: string | number | undefined;
1273
1255
  verticalResponsiveness?: boolean | undefined;
1274
- isPriceMovedToNextLine?: boolean | undefined;
1275
- isPriceDeletedForZeroSale?: boolean | undefined;
1276
1256
  } & {
1277
1257
  [key: string]: unknown;
1278
1258
  };
@@ -1405,8 +1385,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1405
1385
  blockType?: string | undefined;
1406
1386
  size?: string | number | undefined;
1407
1387
  verticalResponsiveness?: boolean | undefined;
1408
- isPriceMovedToNextLine?: boolean | undefined;
1409
- isPriceDeletedForZeroSale?: boolean | undefined;
1410
1388
  } & {
1411
1389
  [key: string]: unknown;
1412
1390
  };
@@ -1539,8 +1517,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1539
1517
  blockType?: string | undefined;
1540
1518
  size?: string | number | undefined;
1541
1519
  verticalResponsiveness?: boolean | undefined;
1542
- isPriceMovedToNextLine?: boolean | undefined;
1543
- isPriceDeletedForZeroSale?: boolean | undefined;
1544
1520
  } & {
1545
1521
  [key: string]: unknown;
1546
1522
  };
@@ -1673,8 +1649,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1673
1649
  blockType?: string | undefined;
1674
1650
  size?: string | number | undefined;
1675
1651
  verticalResponsiveness?: boolean | undefined;
1676
- isPriceMovedToNextLine?: boolean | undefined;
1677
- isPriceDeletedForZeroSale?: boolean | undefined;
1678
1652
  } & {
1679
1653
  [key: string]: unknown;
1680
1654
  };
@@ -1807,8 +1781,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1807
1781
  blockType?: string | undefined;
1808
1782
  size?: string | number | undefined;
1809
1783
  verticalResponsiveness?: boolean | undefined;
1810
- isPriceMovedToNextLine?: boolean | undefined;
1811
- isPriceDeletedForZeroSale?: boolean | undefined;
1812
1784
  } & {
1813
1785
  [key: string]: unknown;
1814
1786
  };
@@ -1941,8 +1913,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1941
1913
  blockType?: string | undefined;
1942
1914
  size?: string | number | undefined;
1943
1915
  verticalResponsiveness?: boolean | undefined;
1944
- isPriceMovedToNextLine?: boolean | undefined;
1945
- isPriceDeletedForZeroSale?: boolean | undefined;
1946
1916
  } & {
1947
1917
  [key: string]: unknown;
1948
1918
  };
@@ -2075,8 +2045,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2075
2045
  blockType?: string | undefined;
2076
2046
  size?: string | number | undefined;
2077
2047
  verticalResponsiveness?: boolean | undefined;
2078
- isPriceMovedToNextLine?: boolean | undefined;
2079
- isPriceDeletedForZeroSale?: boolean | undefined;
2080
2048
  } & {
2081
2049
  [key: string]: unknown;
2082
2050
  };
@@ -2209,8 +2177,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2209
2177
  blockType?: string | undefined;
2210
2178
  size?: string | number | undefined;
2211
2179
  verticalResponsiveness?: boolean | undefined;
2212
- isPriceMovedToNextLine?: boolean | undefined;
2213
- isPriceDeletedForZeroSale?: boolean | undefined;
2214
2180
  } & {
2215
2181
  [key: string]: unknown;
2216
2182
  };
@@ -2343,8 +2309,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2343
2309
  blockType?: string | undefined;
2344
2310
  size?: string | number | undefined;
2345
2311
  verticalResponsiveness?: boolean | undefined;
2346
- isPriceMovedToNextLine?: boolean | undefined;
2347
- isPriceDeletedForZeroSale?: boolean | undefined;
2348
2312
  } & {
2349
2313
  [key: string]: unknown;
2350
2314
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.8.2-beta.189e91c",
3
+ "version": "3.8.2-beta.2ed8604",
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",
@@ -1,111 +0,0 @@
1
- import { BLOCK_ROOT_SELECTOR as S, CURRENCY_ATTR as p, CONTAINER_SELECTOR as O } from "../extensions/Blocks/Recommendation/constants/selectors.js";
2
- import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
- import { formatPrice as E } from "../extensions/Blocks/Recommendation/utils/priceFormatter.js";
4
- const f = `${S}[recommendation-id]`, C = ".product-old-price", R = /\{\{(?:reco_)?(\d+_\d+_[a-zA-Z0-9_.]+)\}\}/g, T = new RegExp(
5
- "\\{%\\s*if\\s+([\\s\\S]+?)\\s*%\\}([\\s\\S]*?)(?:\\{%\\s*else\\s*%\\}([\\s\\S]*?))?\\{%\\s*endif\\s*%\\}",
6
- "g"
7
- );
8
- function b(e) {
9
- return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
10
- }
11
- function _(e) {
12
- var s;
13
- const n = (s = e.replace(/[\u0000-\u0020]+/g, "").toLowerCase().match(/^([a-z][a-z0-9+.-]*):/)) == null ? void 0 : s[1];
14
- return n && n !== "http" && n !== "https" && n !== "mailto" ? "" : e;
15
- }
16
- function N(e) {
17
- const t = e.getAttribute(p.CURRENCY) || "USD", n = e.getAttribute(p.DECIMAL_SEPARATOR) || ".", s = e.getAttribute(p.THOUSAND_SEPARATOR) || ",";
18
- return {
19
- code: t,
20
- symbol: e.getAttribute(p.SYMBOL) || t,
21
- alignment: e.getAttribute(p.ALIGNMENT) === "0" ? "before" : "after",
22
- decimalCount: parseInt(e.getAttribute(p.DECIMAL_COUNT) || "2") || 2,
23
- decimalSeparator: n,
24
- thousandSeparator: s
25
- };
26
- }
27
- function g(e, t) {
28
- return (e == null ? void 0 : e[t]) ?? Object.values(e ?? {})[0] ?? 0;
29
- }
30
- function L(e, t) {
31
- const n = g(e.original_price, t), s = g(e.price, t), o = n > 0 ? Math.round((n - s) / n * 100) : 0;
32
- return o > 0 ? `${o}%` : "0%";
33
- }
34
- function P(e, t, n, s, o, a) {
35
- s.forEach((i, c) => {
36
- const r = (m) => `${n}_${c}_${m}`, u = E({ price: g(i.price, o.code), currency: o }), l = E({ price: g(i.original_price, o.code), currency: o }), d = L(i, o.code);
37
- e.set(r("name"), i.name ?? ""), e.set(r("image_url"), _(i.image_url ?? "")), e.set(r("url"), _(i.url ?? "")), e.set(r("item_id"), i.item_id ?? ""), e.set(r("currency"), ""), e.set(r("price"), u), e.set(r("original_price"), l), e.set(r("discount"), d), e.set(r("omnibus_price"), l), e.set(r("omnibus_discount"), d), a && u === l && t.add(`${n}_${c}`), Object.entries(i.product_attributes ?? {}).forEach(([m, A]) => {
38
- e.set(r(`product_attribute.${m}`), String(A)), e.set(r(m), String(A));
39
- });
40
- });
41
- }
42
- function $(e, t) {
43
- const n = e.match(/^(.+?)\s*(!=|==)\s*"([^"]*)"$/);
44
- if (!n)
45
- return !0;
46
- const [, s, o, a] = n, i = t.get(s.trim()) ?? "";
47
- return o === "!=" ? i !== a : i === a;
48
- }
49
- function z(e, t) {
50
- return e.replace(
51
- T,
52
- (n, s, o, a) => s.split(/\s+and\s+/).every((c) => $(c.trim(), t)) ? o : a ?? ""
53
- );
54
- }
55
- function w(e) {
56
- let t = e;
57
- for (; t.children.length === 1; )
58
- [t] = t.children;
59
- return t;
60
- }
61
- function D(e, t) {
62
- var i;
63
- if (!t.size)
64
- return e;
65
- const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), s = new DOMParser().parseFromString(n, "text/html");
66
- s.querySelectorAll(f).forEach((c) => {
67
- const r = Number(c.getAttribute("recommendation-id"));
68
- if (!Number.isFinite(r))
69
- return;
70
- const u = c.querySelectorAll(O);
71
- (u.length ? Array.from(u) : [c]).forEach((d) => {
72
- d.querySelectorAll(C).forEach((m, A) => {
73
- t.has(`${r}_${A}`) && (w(m).textContent = "");
74
- });
75
- });
76
- });
77
- const o = (i = e.match(/<!DOCTYPE[^>]*>/i)) == null ? void 0 : i[0];
78
- return ((o ? `${o}
79
- ` : "") + s.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
80
- }
81
- function I(e) {
82
- if (!e || !e.includes("recommendation-block-v2"))
83
- return e;
84
- const t = h(), n = new DOMParser().parseFromString(e, "text/html"), s = Array.from(n.querySelectorAll(f)), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
85
- if (s.forEach((c) => {
86
- var l;
87
- const r = Number(c.getAttribute("recommendation-id"));
88
- if (!Number.isFinite(r))
89
- return;
90
- const u = ((l = t.blockStates[r]) == null ? void 0 : l.recommendationProducts) ?? [];
91
- u.length && P(
92
- o,
93
- a,
94
- r,
95
- u,
96
- N(c),
97
- c.getAttribute("hide-price") === "true"
98
- );
99
- }), !o.size)
100
- return e;
101
- let i = D(e, a);
102
- return i = i.replace(
103
- R,
104
- (c, r) => o.has(r) ? b(o.get(r)) : c
105
- ), i = z(i, o), i;
106
- }
107
- const q = () => ({ substituteRecommendationPreview: I });
108
- export {
109
- I as substituteRecommendationPreview,
110
- q as useRecommendationPreview
111
- };
@@ -1,16 +0,0 @@
1
- const e = `/*
2
- * Editor-canvas-only styles (ExtensionBuilder.withPreviewStyles).
3
- * Never reaches the exported email HTML — send-time behavior stays in email-service.
4
- */
5
-
6
- /* Hide-if-same: mirror the email-service rule in the canvas. The block-level
7
- \`hide-price\` attr is the toggle; \`data-same-price\` is stamped per old-price
8
- cell by the renderers / in-place price updates. Hiding the <p> (not the td)
9
- keeps inline price columns from collapsing, matching the preview look. */
10
- .recommendation-block-v2[hide-price="true"] .product-old-price[data-same-price="true"] p {
11
- display: none;
12
- }
13
- `;
14
- export {
15
- e as default
16
- };