@useinsider/guido 3.23.0-beta.86bed27 → 3.23.0-beta.9f6bfbf

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 (88) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +17 -15
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +58 -56
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  7. package/dist/composables/useModuleRepair.js +14 -12
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  9. package/dist/config/migrator/index.js +16 -15
  10. package/dist/config/migrator/itemsPriceFormatMigrator.js +20 -0
  11. package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
  12. package/dist/config/migrator/recommendation/extractors.js +100 -40
  13. package/dist/config/migrator/recommendation/htmlBuilder.js +285 -207
  14. package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
  15. package/dist/config/migrator/recommendation/themeMapper.js +53 -41
  16. package/dist/config/migrator/recommendationMigrator.js +68 -61
  17. package/dist/extensions/Blocks/Items/block.js +115 -77
  18. package/dist/extensions/Blocks/Items/constants/currency.js +59 -14
  19. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
  20. package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
  21. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
  22. package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
  23. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +40 -30
  24. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +63 -53
  25. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +31 -31
  26. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
  27. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
  28. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -32
  29. package/dist/extensions/Blocks/Items/controls/priceFormat.js +145 -0
  30. package/dist/extensions/Blocks/Items/controls/settingsControl.js +160 -144
  31. package/dist/extensions/Blocks/Items/enums/controlEnums.js +1 -1
  32. package/dist/extensions/Blocks/Items/extension.js +9 -8
  33. package/dist/extensions/Blocks/Items/items.css.js +19 -0
  34. package/dist/extensions/Blocks/Items/settingsPanel.js +34 -25
  35. package/dist/extensions/Blocks/Items/template.js +250 -212
  36. package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +185 -0
  37. package/dist/extensions/Blocks/Recommendation/block.js +33 -24
  38. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  39. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +27 -26
  40. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  41. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +165 -175
  42. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  43. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  44. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  46. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  47. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  48. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  49. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  50. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  51. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  52. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
  53. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +1 -0
  54. package/dist/extensions/Blocks/common-control.js +62 -55
  55. package/dist/guido.css +1 -1
  56. package/dist/package.json.js +2 -2
  57. package/dist/src/@types/config/schemas.d.ts +4 -0
  58. package/dist/src/composables/useConfig.d.ts +2 -0
  59. package/dist/src/config/migrator/index.d.ts +4 -1
  60. package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +1 -0
  61. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
  62. package/dist/src/config/migrator/recommendation/extractors.d.ts +35 -6
  63. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +3 -1
  64. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +3 -1
  65. package/dist/src/config/migrator/recommendation/types.d.ts +11 -1
  66. package/dist/src/extensions/Blocks/Items/block.d.ts +6 -9
  67. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +32 -0
  68. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
  69. package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +23 -0
  70. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +1 -0
  71. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  72. package/dist/src/extensions/Blocks/Items/template.d.ts +4 -1
  73. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +3 -0
  74. package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +61 -0
  75. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -10
  77. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  78. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  79. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
  80. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +12 -0
  81. package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
  82. package/dist/src/stores/config.d.ts +20 -0
  83. package/dist/src/stores/unsubscribe.d.ts +10 -0
  84. package/dist/src/utils/itemsCurrencyRepair.d.ts +5 -1
  85. package/dist/stores/unsubscribe.js +33 -29
  86. package/dist/utils/itemsCurrencyRepair.js +29 -24
  87. package/dist/utils/pairProductVariables.js +119 -99
  88. package/package.json +2 -2
@@ -0,0 +1,61 @@
1
+ import { type ItemsPriceFormat } from '../constants/currency';
2
+ import { type ItemsBlockConfig } from './nodeConfigUtils';
3
+ export type PriceParagraphKind = 'price' | 'originalPrice';
4
+ export declare const PRICE_PARAGRAPH_SELECTOR = "p[product-attr=\"price\"], p[product-attr=\"originalPrice\"]";
5
+ type AttrMap = Record<string, string | null | undefined>;
6
+ export interface PriceParagraphSnapshot {
7
+ kind: PriceParagraphKind;
8
+ attrs: AttrMap;
9
+ text: string;
10
+ }
11
+ export interface PriceFormatSnapshot {
12
+ rootAttrs: AttrMap;
13
+ paragraphs: PriceParagraphSnapshot[];
14
+ config: Partial<ItemsBlockConfig> | null;
15
+ }
16
+ export interface PriceTexts {
17
+ price: string;
18
+ originalPrice: string;
19
+ }
20
+ export interface PriceFormatOps {
21
+ rootSet: Record<string, string>;
22
+ paragraphRemove: string[];
23
+ configPatch: Partial<ItemsBlockConfig> | null;
24
+ texts: PriceTexts | null;
25
+ changed: boolean;
26
+ }
27
+ export interface PlanPriceFormatOptions {
28
+ convertLegacy: boolean;
29
+ }
30
+ export interface FormatDummyPriceInput {
31
+ amount: string | number;
32
+ format: ItemsPriceFormat;
33
+ symbol: string | null | undefined;
34
+ alignment: string | null | undefined;
35
+ }
36
+ export declare function paragraphKindOf(productAttr: string | null | undefined): PriceParagraphKind | null;
37
+ export declare function resolvePriceDummyAmounts(config: Pick<Partial<ItemsBlockConfig>, 'type' | 'priceSinglePrice'> | null | undefined): PriceTexts;
38
+ export declare function formatItemsDummyPrice({ amount, format, symbol, alignment }: FormatDummyPriceInput): string;
39
+ export declare function priceTextsFromConfig(config: Partial<ItemsBlockConfig> | null | undefined): PriceTexts;
40
+ /** `text` is decoded DOM text, `html` the rendered markup text (entities allowed). */
41
+ export declare function samePriceText(text: string | null | undefined, html: string | null | undefined): boolean;
42
+ /** Swaps the whole price text inside the paragraph markup, keeping the style wrappers around it. */
43
+ export declare function replacePriceText(innerHtml: string, currentText: string, newText: string): string;
44
+ export declare function planPriceFormatOps(snapshot: PriceFormatSnapshot, { convertLegacy }: PlanPriceFormatOptions): PriceFormatOps;
45
+ export interface PriceParagraphSource {
46
+ kind: PriceParagraphKind;
47
+ attr(name: string): string | null | undefined;
48
+ text: string;
49
+ }
50
+ export interface PriceFormatSnapshotSource {
51
+ rootAttr(name: string): string | null | undefined;
52
+ paragraphs: PriceParagraphSource[];
53
+ config: Partial<ItemsBlockConfig> | null;
54
+ }
55
+ /** Shared snapshot builder so DOM (migrator, repair) and Stripo-node callers read the same attrs. */
56
+ export declare function buildPriceFormatSnapshot(source: PriceFormatSnapshotSource): PriceFormatSnapshot;
57
+ export declare function readPersistedConfigAttribute(root: Element): Partial<ItemsBlockConfig> | null;
58
+ export declare function snapshotPriceFormatFromElement(root: Element): PriceFormatSnapshot;
59
+ /** DOM applier for parsed HTML (migrator, module repair). Returns whether anything was written. */
60
+ export declare function applyPriceFormatOpsToElement(root: Element, ops: PriceFormatOps): boolean;
61
+ export {};
@@ -65,6 +65,7 @@ export declare class RecommendationBlock extends Block {
65
65
  */
66
66
  onDelete(node: ImmutableHtmlNode): void;
67
67
  private _ensureMobileFitRule;
68
+ private _ensureTextTrimCss;
68
69
  private _syncHeightBound;
69
70
  /**
70
71
  * Warns (dark advisory toaster) when the design holds more than one live
@@ -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(): Promise<void>;
45
+ onRender(): void;
46
46
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
47
47
  onDestroy(): void;
48
48
  /**
@@ -50,6 +50,7 @@ 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;
53
54
  /**
54
55
  * Syncs persisted node config into the Pinia store's block state.
55
56
  *
@@ -115,20 +116,14 @@ export declare class RecommendationBlockControl extends CommonControl {
115
116
  * 2. Smart defaults for new blocks (currency, algorithm) — sequential
116
117
  * 3. Product data with correct defaults — sequential
117
118
  *
118
- * Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
119
+ * Called from onTemplateNodeUpdated() once the node config is synced.
119
120
  * Marks the block as initialized to prevent redundant fetches on re-selection.
120
121
  */
121
122
  private _fetchBlockData;
122
123
  private _isPanelOn;
123
124
  /**
124
- * Applies smart defaults for newly dropped blocks.
125
- *
126
- * For new blocks (config still matches hardcoded defaults), validates that
127
- * the default currency and algorithm are available from the API response.
128
- * If not, falls back to the first available option.
129
- *
130
- * Saved templates with user-customized config are left unchanged because
131
- * their values won't match the hardcoded defaults.
125
+ * Falls back to the first available option when the block's currency or locale is not offered (a new block on
126
+ * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
132
127
  */
133
128
  private _applySmartDefaults;
134
129
  /**
@@ -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;
@@ -14,6 +14,18 @@ export interface FormatPriceOptions {
14
14
  /** Currency configuration */
15
15
  currency: CurrencyConfig;
16
16
  }
17
+ export interface FormatNumberOptions {
18
+ thousandSeparator: string;
19
+ decimalSeparator: string;
20
+ decimalCount: number;
21
+ }
22
+ /**
23
+ * Formats a number with custom thousand and decimal separators
24
+ * @param value - The numeric value to format
25
+ * @param options - Formatting options
26
+ * @returns Formatted number string
27
+ */
28
+ export declare function formatNumber(value: number, options: FormatNumberOptions): string;
17
29
  /**
18
30
  * Formats a numeric price according to currency settings
19
31
  * @example
@@ -67,12 +67,14 @@ 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;
70
71
  abstract getId(): string;
71
72
  abstract getTemplate(): string;
72
73
  abstract onRender(): Promise<void> | void;
73
74
  getContainer(): ShadowRoot;
74
75
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
75
76
  onDestroy(): void;
77
+ protected forgetLastPanelNode(): void;
76
78
  /**
77
79
  * Gets the Items block container element from the current node.
78
80
  * @returns The container element or null if not found
@@ -109,6 +109,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
109
109
  linkTrackingIds: boolean;
110
110
  allowSaveWithErrors: boolean;
111
111
  reusableRecommendationStrategy: boolean;
112
+ itemsPriceFormatting: boolean;
112
113
  };
113
114
  blocks: {
114
115
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -254,6 +255,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
254
255
  linkTrackingIds: boolean;
255
256
  allowSaveWithErrors: boolean;
256
257
  reusableRecommendationStrategy: boolean;
258
+ itemsPriceFormatting: boolean;
257
259
  };
258
260
  blocks: {
259
261
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -399,6 +401,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
399
401
  linkTrackingIds: boolean;
400
402
  allowSaveWithErrors: boolean;
401
403
  reusableRecommendationStrategy: boolean;
404
+ itemsPriceFormatting: boolean;
402
405
  };
403
406
  blocks: {
404
407
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -544,6 +547,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
544
547
  linkTrackingIds: boolean;
545
548
  allowSaveWithErrors: boolean;
546
549
  reusableRecommendationStrategy: boolean;
550
+ itemsPriceFormatting: boolean;
547
551
  };
548
552
  blocks: {
549
553
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -689,6 +693,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
689
693
  linkTrackingIds: boolean;
690
694
  allowSaveWithErrors: boolean;
691
695
  reusableRecommendationStrategy: boolean;
696
+ itemsPriceFormatting: boolean;
692
697
  };
693
698
  blocks: {
694
699
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -834,6 +839,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
834
839
  linkTrackingIds: boolean;
835
840
  allowSaveWithErrors: boolean;
836
841
  reusableRecommendationStrategy: boolean;
842
+ itemsPriceFormatting: boolean;
837
843
  };
838
844
  blocks: {
839
845
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -979,6 +985,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
979
985
  linkTrackingIds: boolean;
980
986
  allowSaveWithErrors: boolean;
981
987
  reusableRecommendationStrategy: boolean;
988
+ itemsPriceFormatting: boolean;
982
989
  };
983
990
  blocks: {
984
991
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1124,6 +1131,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1124
1131
  linkTrackingIds: boolean;
1125
1132
  allowSaveWithErrors: boolean;
1126
1133
  reusableRecommendationStrategy: boolean;
1134
+ itemsPriceFormatting: boolean;
1127
1135
  };
1128
1136
  blocks: {
1129
1137
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1269,6 +1277,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1269
1277
  linkTrackingIds: boolean;
1270
1278
  allowSaveWithErrors: boolean;
1271
1279
  reusableRecommendationStrategy: boolean;
1280
+ itemsPriceFormatting: boolean;
1272
1281
  };
1273
1282
  blocks: {
1274
1283
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1414,6 +1423,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1414
1423
  linkTrackingIds: boolean;
1415
1424
  allowSaveWithErrors: boolean;
1416
1425
  reusableRecommendationStrategy: boolean;
1426
+ itemsPriceFormatting: boolean;
1417
1427
  };
1418
1428
  blocks: {
1419
1429
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1559,6 +1569,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1559
1569
  linkTrackingIds: boolean;
1560
1570
  allowSaveWithErrors: boolean;
1561
1571
  reusableRecommendationStrategy: boolean;
1572
+ itemsPriceFormatting: boolean;
1562
1573
  };
1563
1574
  blocks: {
1564
1575
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1704,6 +1715,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1704
1715
  linkTrackingIds: boolean;
1705
1716
  allowSaveWithErrors: boolean;
1706
1717
  reusableRecommendationStrategy: boolean;
1718
+ itemsPriceFormatting: boolean;
1707
1719
  };
1708
1720
  blocks: {
1709
1721
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1849,6 +1861,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1849
1861
  linkTrackingIds: boolean;
1850
1862
  allowSaveWithErrors: boolean;
1851
1863
  reusableRecommendationStrategy: boolean;
1864
+ itemsPriceFormatting: boolean;
1852
1865
  };
1853
1866
  blocks: {
1854
1867
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -1994,6 +2007,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1994
2007
  linkTrackingIds: boolean;
1995
2008
  allowSaveWithErrors: boolean;
1996
2009
  reusableRecommendationStrategy: boolean;
2010
+ itemsPriceFormatting: boolean;
1997
2011
  };
1998
2012
  blocks: {
1999
2013
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -2139,6 +2153,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2139
2153
  linkTrackingIds: boolean;
2140
2154
  allowSaveWithErrors: boolean;
2141
2155
  reusableRecommendationStrategy: boolean;
2156
+ itemsPriceFormatting: boolean;
2142
2157
  };
2143
2158
  blocks: {
2144
2159
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -2284,6 +2299,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2284
2299
  linkTrackingIds: boolean;
2285
2300
  allowSaveWithErrors: boolean;
2286
2301
  reusableRecommendationStrategy: boolean;
2302
+ itemsPriceFormatting: boolean;
2287
2303
  };
2288
2304
  blocks: {
2289
2305
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -2429,6 +2445,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2429
2445
  linkTrackingIds: boolean;
2430
2446
  allowSaveWithErrors: boolean;
2431
2447
  reusableRecommendationStrategy: boolean;
2448
+ itemsPriceFormatting: boolean;
2432
2449
  };
2433
2450
  blocks: {
2434
2451
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -2586,6 +2603,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2586
2603
  linkTrackingIds: boolean;
2587
2604
  allowSaveWithErrors: boolean;
2588
2605
  reusableRecommendationStrategy: boolean;
2606
+ itemsPriceFormatting: boolean;
2589
2607
  };
2590
2608
  blocks: {
2591
2609
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -2731,6 +2749,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2731
2749
  linkTrackingIds: boolean;
2732
2750
  allowSaveWithErrors: boolean;
2733
2751
  reusableRecommendationStrategy: boolean;
2752
+ itemsPriceFormatting: boolean;
2734
2753
  };
2735
2754
  blocks: {
2736
2755
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -2878,6 +2897,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2878
2897
  linkTrackingIds: boolean;
2879
2898
  allowSaveWithErrors: boolean;
2880
2899
  reusableRecommendationStrategy: boolean;
2900
+ itemsPriceFormatting: boolean;
2881
2901
  };
2882
2902
  blocks: {
2883
2903
  excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
@@ -26,6 +26,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
26
26
  createdAt: string;
27
27
  updatedAt: string;
28
28
  status: number;
29
+ isDefault?: boolean | undefined;
29
30
  }[];
30
31
  selectedTemplates: Record<number, number>;
31
32
  selectedUnsubscribePages: number[];
@@ -51,6 +52,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
51
52
  createdAt: string;
52
53
  updatedAt: string;
53
54
  status: number;
55
+ isDefault?: boolean | undefined;
54
56
  }[];
55
57
  selectedTemplates: Record<number, number>;
56
58
  selectedUnsubscribePages: number[];
@@ -76,6 +78,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
76
78
  createdAt: string;
77
79
  updatedAt: string;
78
80
  status: number;
81
+ isDefault?: boolean | undefined;
79
82
  }[];
80
83
  selectedTemplates: Record<number, number>;
81
84
  selectedUnsubscribePages: number[];
@@ -99,6 +102,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
99
102
  createdAt: string;
100
103
  updatedAt: string;
101
104
  status: number;
105
+ isDefault?: boolean | undefined;
102
106
  }[];
103
107
  getThumbnailByTemplateId: (state: {
104
108
  templates: {
@@ -113,6 +117,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
113
117
  createdAt: string;
114
118
  updatedAt: string;
115
119
  status: number;
120
+ isDefault?: boolean | undefined;
116
121
  }[];
117
122
  selectedTemplates: Record<number, number>;
118
123
  selectedUnsubscribePages: number[];
@@ -138,6 +143,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
138
143
  createdAt: string;
139
144
  updatedAt: string;
140
145
  status: number;
146
+ isDefault?: boolean | undefined;
141
147
  }[];
142
148
  selectedTemplates: Record<number, number>;
143
149
  selectedUnsubscribePages: number[];
@@ -163,6 +169,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
163
169
  createdAt: string;
164
170
  updatedAt: string;
165
171
  status: number;
172
+ isDefault?: boolean | undefined;
166
173
  }[];
167
174
  selectedTemplates: Record<number, number>;
168
175
  selectedUnsubscribePages: number[];
@@ -188,6 +195,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
188
195
  createdAt: string;
189
196
  updatedAt: string;
190
197
  status: number;
198
+ isDefault?: boolean | undefined;
191
199
  }[];
192
200
  selectedTemplates: Record<number, number>;
193
201
  selectedUnsubscribePages: number[];
@@ -213,6 +221,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
213
221
  createdAt: string;
214
222
  updatedAt: string;
215
223
  status: number;
224
+ isDefault?: boolean | undefined;
216
225
  }[];
217
226
  selectedTemplates: Record<number, number>;
218
227
  selectedUnsubscribePages: number[];
@@ -238,6 +247,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
238
247
  createdAt: string;
239
248
  updatedAt: string;
240
249
  status: number;
250
+ isDefault?: boolean | undefined;
241
251
  }[];
242
252
  selectedTemplates: Record<number, number>;
243
253
  selectedUnsubscribePages: number[];
@@ -1,3 +1,7 @@
1
+ export interface ItemsCurrencyRepairOptions {
2
+ /** Convert legacy-model blocks to the root price-format contract (itemsPriceFormatting). */
3
+ convertToPriceFormat?: boolean;
4
+ }
1
5
  /**
2
6
  * Heals stale price currency attributes on every v2 Items block inside a dropped
3
7
  * saved module, driving `data-curency` / `data-currency_symbol` from each block's
@@ -14,4 +18,4 @@
14
18
  * recommendationMigrator wraps). If the wrap fails to capture the blocks (non-`<td>`
15
19
  * root foster-parented out), it bails to the original string.
16
20
  */
17
- export declare function repairItemsCurrencyAttributes(html: string): string;
21
+ export declare function repairItemsCurrencyAttributes(html: string, { convertToPriceFormat }?: ItemsCurrencyRepairOptions): string;
@@ -1,23 +1,27 @@
1
- import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
1
+ import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
2
2
  import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
3
  import { defineStore as u } from "pinia";
4
- let o = null;
5
- const r = () => ({
4
+ let a = null;
5
+ const p = () => ({
6
6
  templates: [],
7
7
  selectedTemplates: {},
8
8
  selectedUnsubscribePages: [],
9
- selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
10
- activeType: p.GLOBAL_UNSUBSCRIBE,
9
+ selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
10
+ activeType: r.GLOBAL_UNSUBSCRIBE,
11
11
  pageSelectionUpdateStatus: !1,
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
15
  isSubscriptionPreferencesCenterDisabled: !1,
16
16
  pendingBlockId: null
17
- }), b = u("guidoUnsubscribe", {
18
- state: () => r(),
17
+ });
18
+ function h(e) {
19
+ return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
20
+ }
21
+ const f = u("guidoUnsubscribe", {
22
+ state: () => p(),
19
23
  getters: {
20
- getSelectedCollection: (e) => i[e.selectedCollectionType],
24
+ getSelectedCollection: (e) => c[e.selectedCollectionType],
21
25
  getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
22
26
  getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
23
27
  getThumbnailByTemplateId: (e) => (t) => {
@@ -25,31 +29,31 @@ const r = () => ({
25
29
  return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
26
30
  },
27
31
  getSelectedUnsubscribePagesByCollection: (e) => (t) => {
28
- const l = i[t];
32
+ const l = c[t];
29
33
  if (!l)
30
34
  return [];
31
35
  const s = /* @__PURE__ */ new Map();
32
36
  e.templates.forEach((n) => {
33
37
  s.set(n.id, n.type);
34
38
  });
35
- const c = new Set(l);
39
+ const i = new Set(l);
36
40
  return e.selectedUnsubscribePages.filter((n) => {
37
- const a = s.get(n);
38
- return a !== void 0 && c.has(a);
41
+ const o = s.get(n);
42
+ return o !== void 0 && i.has(o);
39
43
  });
40
44
  },
41
45
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType] ?? [];
46
+ const t = c[e.selectedCollectionType] ?? [];
43
47
  return e.activeType === t[0];
44
48
  },
45
49
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType] ?? [];
50
+ const t = c[e.selectedCollectionType] ?? [];
47
51
  return e.activeType === t[t.length - 1];
48
52
  },
49
53
  hasTemplatesByCollectionType: (e) => {
50
54
  const t = {};
51
- return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
- t[s] = e.templates.some((c) => c.type === s);
55
+ return (c[e.selectedCollectionType] ?? []).forEach((s) => {
56
+ t[s] = e.templates.some((i) => i.type === s);
53
57
  }), t;
54
58
  },
55
59
  unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
@@ -58,36 +62,36 @@ const r = () => ({
58
62
  $reset() {
59
63
  const { templates: e, selectedUnsubscribePages: t } = this;
60
64
  Object.assign(this, {
61
- ...r(),
65
+ ...p(),
62
66
  templates: e,
63
67
  selectedUnsubscribePages: t
64
68
  });
65
69
  },
66
70
  async fetchTemplates(e = !1) {
67
- !e && this.templates.length || ((e || !o) && (o = (async () => {
71
+ !e && this.templates.length || ((e || !a) && (a = (async () => {
68
72
  const { getUnsubscribePages: t } = d();
69
- this.templates = await t();
73
+ this.templates = h(await t());
70
74
  })().finally(() => {
71
- o = null;
72
- })), await o);
75
+ a = null;
76
+ })), await a);
73
77
  },
74
78
  setCollection(e) {
75
79
  this.selectedCollectionType = e;
76
- const t = i[e];
80
+ const t = c[e];
77
81
  if (t && t.length > 0) {
78
82
  [this.activeType] = t;
79
83
  const l = { ...this.selectedTemplates };
80
84
  t.forEach((s) => {
81
85
  if (!l[s]) {
82
- const c = this.templates.find((n) => n.type === s);
83
- c && (l[s] = c.id);
86
+ const i = this.templates.filter((o) => o.type === s), n = i.find((o) => o.isDefault) ?? i[0];
87
+ n && (l[s] = n.id);
84
88
  }
85
89
  }), this.selectedTemplates = l;
86
90
  }
87
91
  },
88
92
  setCollectionWithoutAutoSelection(e) {
89
93
  this.selectedCollectionType = e;
90
- const t = i[e];
94
+ const t = c[e];
91
95
  t && t.length > 0 && ([this.activeType] = t);
92
96
  },
93
97
  setSelectedTemplate(e) {
@@ -107,12 +111,12 @@ const r = () => ({
107
111
  loadSelectedTemplates(e) {
108
112
  const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
109
113
  e.forEach((s) => {
110
- const c = t.get(s);
111
- c !== void 0 && (l[c] = s);
114
+ const i = t.get(s);
115
+ i !== void 0 && (l[i] = s);
112
116
  }), this.selectedTemplates = l;
113
117
  },
114
118
  getSelectedTemplatesByCollection(e) {
115
- const t = i[e], l = [];
119
+ const t = c[e], l = [];
116
120
  return t.forEach((s) => {
117
121
  this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
118
122
  }), l;
@@ -129,5 +133,5 @@ const r = () => ({
129
133
  }
130
134
  });
131
135
  export {
132
- b as useUnsubscribeStore
136
+ f as useUnsubscribeStore
133
137
  };