@useinsider/guido 3.21.2-beta.4c14c74 → 3.21.2-beta.5a809f7

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 (44) hide show
  1. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  2. package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
  3. package/dist/config/migrator/recommendation/extractors.js +74 -26
  4. package/dist/config/migrator/recommendation/htmlBuilder.js +279 -202
  5. package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
  6. package/dist/config/migrator/recommendationMigrator.js +65 -59
  7. package/dist/extensions/Blocks/Items/controls/button/link.js +17 -14
  8. package/dist/extensions/Blocks/Items/controls/cardComposition.js +17 -14
  9. package/dist/extensions/Blocks/Items/controls/image/link.js +17 -14
  10. package/dist/extensions/Blocks/Items/controls/name/trimming.js +10 -9
  11. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  12. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +13 -12
  13. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -29
  14. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +16 -15
  15. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +26 -25
  16. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +28 -27
  17. package/dist/extensions/Blocks/Items/controls/settingsControl.js +80 -75
  18. package/dist/extensions/Blocks/Recommendation/block.js +33 -24
  19. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  20. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +27 -26
  21. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +216 -236
  23. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  24. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  25. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  26. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  27. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  28. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  29. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  30. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  31. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  32. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  33. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
  34. package/dist/extensions/Blocks/common-control.js +55 -62
  35. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
  36. package/dist/src/config/migrator/recommendation/extractors.d.ts +26 -0
  37. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +1 -0
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +4 -11
  40. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  41. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  42. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
  43. package/dist/src/extensions/Blocks/common-control.d.ts +0 -2
  44. package/package.json +1 -1
@@ -42,7 +42,7 @@ export declare class RecommendationBlockControl extends CommonControl {
42
42
  private get _subControls();
43
43
  getTemplate(): string;
44
44
  private _showControlsForBlock;
45
- onRender(): void;
45
+ onRender(): Promise<void>;
46
46
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
47
47
  onDestroy(): void;
48
48
  /**
@@ -50,7 +50,6 @@ export declare class RecommendationBlockControl extends CommonControl {
50
50
  * Each sub-control manages its own form values and event listeners
51
51
  */
52
52
  private _initializeSubControls;
53
- private _renderWithPanelNode;
54
53
  /**
55
54
  * Syncs persisted node config into the Pinia store's block state.
56
55
  *
@@ -116,20 +115,14 @@ export declare class RecommendationBlockControl extends CommonControl {
116
115
  * 2. Smart defaults for new blocks (currency, algorithm) — sequential
117
116
  * 3. Product data with correct defaults — sequential
118
117
  *
119
- * Called from onTemplateNodeUpdated() once the node config is synced.
118
+ * Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
120
119
  * Marks the block as initialized to prevent redundant fetches on re-selection.
121
120
  */
122
121
  private _fetchBlockData;
123
122
  private _isPanelOn;
124
123
  /**
125
- * Applies smart defaults for newly dropped blocks.
126
- *
127
- * For new blocks (config still matches hardcoded defaults), validates that
128
- * the default currency and algorithm are available from the API response.
129
- * If not, falls back to the first available option.
130
- *
131
- * Saved templates with user-customized config are left unchanged because
132
- * their values won't match the hardcoded defaults.
124
+ * Falls back to the first available option when the block's currency or locale is not offered (a new block on
125
+ * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
133
126
  */
134
127
  private _applySmartDefaults;
135
128
  /**
@@ -1,6 +1,7 @@
1
1
  import type { CurrencyConfig } from '../types/nodeConfig';
2
2
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
3
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
+ export { resolveInlinePriceOrder } from '../utils/inlinePriceOrder';
4
5
  type PriceKey = 'price' | 'original_price' | 'discount';
5
6
  /**
6
7
  * Current currency configuration from the store, in CurrencyConfig shape.
@@ -22,18 +23,6 @@ export declare function isSamePrice(product: RecommendationProduct): boolean;
22
23
  * e.g., "rating_star" → "Rating Star"
23
24
  */
24
25
  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
26
  /**
38
27
  * Reduces a raw product-attribute value to a displayable scalar string.
39
28
  * Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
@@ -328,4 +317,3 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
328
317
  * @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
329
318
  */
330
319
  export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
331
- export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves the inline price layout from the composition order: `anchor` is whichever price comes first (the merged
3
+ * cell renders there), `skip` is the other; `originalFirst` puts the original price on the left.
4
+ */
5
+ export declare function resolveInlinePriceOrder(composition: string[]): {
6
+ originalFirst: boolean;
7
+ anchor: string;
8
+ skip: string;
9
+ };
@@ -1,22 +1,5 @@
1
1
  /**
2
- * Maps legacy algorithm strategy keys (used by templates authored against the
3
- * old recommendation system) to the new keys used by `RecommendationFeedSourceMaps`.
4
- *
5
- * Renames are matched by feed-source id:
6
- * - `viewedTogether` → `similarViewed` (id 11, path `viewed-together`)
7
- * - `purchasedTogether` → `similarBought` (id 12, path `purchased-together`)
8
- * - `trending` → `trendingProducts` (id 40, path `trending`)
9
- * - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
10
- * - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
11
- * - `mostViewed` → `mostPopular` (id 61, path `most-popular`)
12
- *
13
- * Used at two boundaries:
14
- * 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
15
- * the new key.
16
- * 2. The algorithm dropdown control, so already-saved blocks that still carry
17
- * a legacy key resolve to a matching dropdown option.
18
- *
19
- * Unknown values pass through untouched so a future-added algorithm doesn't
20
- * silently default.
2
+ * Maps legacy strategy keys to `RecommendationFeedSourceMaps` keys; product-bound ones (ids 11, 12, excluded from the
3
+ * dropdown) become `mostPopular`. Unknown keys pass through so a future algorithm is not silently defaulted.
21
4
  */
22
5
  export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
@@ -67,14 +67,12 @@ interface ButtonProps {
67
67
  export declare abstract class CommonControl extends Control {
68
68
  currentNode?: ImmutableHtmlNode;
69
69
  protected lastBlockInstanceId: string | null;
70
- protected isAwaitingPanelNode: boolean;
71
70
  abstract getId(): string;
72
71
  abstract getTemplate(): string;
73
72
  abstract onRender(): Promise<void> | void;
74
73
  getContainer(): ShadowRoot;
75
74
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
76
75
  onDestroy(): void;
77
- protected forgetLastPanelNode(): void;
78
76
  /**
79
77
  * Gets the Items block container element from the current node.
80
78
  * @returns The container element or null if not found
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.2-beta.4c14c74",
3
+ "version": "3.21.2-beta.5a809f7",
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",