@useinsider/guido 3.2.0-beta.78d83bd → 3.2.0-beta.7fb9b70

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 (118) hide show
  1. package/README.md +117 -1
  2. package/dist/@types/config/schemas.js +153 -95
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +90 -88
  5. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  6. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  7. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  8. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  9. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  10. package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
  11. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  12. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  13. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  14. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  15. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  16. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  17. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  18. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  19. package/dist/composables/useAutoSave.js +71 -0
  20. package/dist/composables/useRecommendation.js +46 -26
  21. package/dist/composables/useRibbonOffset.js +21 -0
  22. package/dist/composables/useSave.js +19 -16
  23. package/dist/composables/useStripo.js +14 -16
  24. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  25. package/dist/config/compiler/recommendationCompilerRules.js +25 -25
  26. package/dist/config/compiler/utils/recommendationCompilerUtils.js +104 -71
  27. package/dist/config/migrator/index.js +9 -9
  28. package/dist/config/migrator/radioButtonMigrator.js +64 -44
  29. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  30. package/dist/config/migrator/recommendation/extractors.js +27 -0
  31. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  32. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  33. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  34. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  35. package/dist/config/migrator/recommendationMigrator.js +74 -290
  36. package/dist/enums/extensions/recommendationBlock.js +2 -1
  37. package/dist/enums/onboarding.js +7 -2
  38. package/dist/extensions/Blocks/Items/template.js +48 -46
  39. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  40. package/dist/extensions/Blocks/Recommendation/block.js +35 -32
  41. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  42. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -24
  43. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
  44. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  45. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -90
  46. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +19 -10
  47. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  48. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -15
  49. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  50. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  51. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  52. package/dist/guido.css +1 -1
  53. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +259 -235
  54. package/dist/node_modules/valibot/dist/index.js +450 -235
  55. package/dist/package.json.js +1 -1
  56. package/dist/services/templateLibraryApi.js +5 -4
  57. package/dist/src/@types/config/defaults.d.ts +5 -1
  58. package/dist/src/@types/config/index.d.ts +3 -3
  59. package/dist/src/@types/config/schemas.d.ts +217 -0
  60. package/dist/src/@types/config/types.d.ts +9 -1
  61. package/dist/src/components/Guido.vue.d.ts +1 -1
  62. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  63. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  64. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  65. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  66. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  67. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  68. package/dist/src/composables/useAutoSave.d.ts +3 -0
  69. package/dist/src/composables/useConfig.d.ts +58 -0
  70. package/dist/src/composables/useRecommendation.d.ts +10 -1
  71. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  72. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  73. package/dist/src/composables/useSave.d.ts +1 -1
  74. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  75. package/dist/src/config/migrator/index.d.ts +2 -1
  76. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  77. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  78. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  79. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  80. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  81. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  82. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  83. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  84. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  85. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  86. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  87. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  88. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  89. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  90. package/dist/src/enums/onboarding.d.ts +6 -0
  91. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  92. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  93. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  94. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  95. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  96. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  97. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  98. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  99. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  100. package/dist/src/library.d.ts +1 -1
  101. package/dist/src/stores/autosave.d.ts +12 -0
  102. package/dist/src/stores/config.d.ts +522 -0
  103. package/dist/src/stores/editor.d.ts +23 -0
  104. package/dist/src/stores/onboarding.d.ts +4 -0
  105. package/dist/src/utils/htmlEscape.d.ts +5 -0
  106. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  107. package/dist/src/utils/timeUtil.d.ts +8 -0
  108. package/dist/stores/autosave.js +17 -0
  109. package/dist/stores/editor.js +3 -1
  110. package/dist/stores/onboarding.js +4 -0
  111. package/dist/utils/htmlEscape.js +13 -0
  112. package/dist/utils/pairProductVariables.js +89 -88
  113. package/dist/utils/templatePreparation.js +72 -32
  114. package/dist/utils/timeUtil.js +19 -0
  115. package/package.json +7 -3
  116. package/dist/enums/displayConditions.js +0 -80
  117. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  118. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Internal types for the legacy Recommendation block migrator.
3
+ *
4
+ * The legacy block stores its full state as a JSON blob inside the
5
+ * `esd-dev-product-config` HTML attribute. These interfaces describe
6
+ * the subset of that schema we depend on. All fields are optional —
7
+ * legacy data is heterogeneous and we use defensive optional chaining
8
+ * everywhere downstream.
9
+ */
10
+ /** Per-side numeric values used by border / padding theme fields. */
11
+ export interface LegacySides<T = number> {
12
+ left?: T;
13
+ right?: T;
14
+ top?: T;
15
+ bottom?: T;
16
+ }
17
+ /** Padding shape used for both desktop and mobile in legacy theme. */
18
+ export interface LegacyPaddingViewport {
19
+ all?: number;
20
+ top?: number;
21
+ right?: number;
22
+ bottom?: number;
23
+ left?: number;
24
+ }
25
+ /** Padding object covering both desktop and mobile breakpoints. */
26
+ export interface LegacyPadding {
27
+ desktop?: LegacyPaddingViewport;
28
+ mobile?: LegacyPaddingViewport;
29
+ }
30
+ /** Border-radius shape — observed in two flavours: shorthand or per-corner. */
31
+ export interface LegacyBorderRadius {
32
+ /** Single shorthand value (e.g. `radius: 4`). */
33
+ radius?: number;
34
+ /** Per-corner: top-left / top-right / bottom-right / bottom-left (in px). */
35
+ lt?: number;
36
+ rt?: number;
37
+ rb?: number;
38
+ lb?: number;
39
+ }
40
+ /** Theme attached to text-like variables (name, prices, omnibus, custom-attr). */
41
+ export interface LegacyTextTheme {
42
+ textStyle?: {
43
+ 'font-family'?: string;
44
+ 'font-size'?: string;
45
+ 'font-weight'?: string;
46
+ 'font-style'?: string;
47
+ };
48
+ textColor?: {
49
+ color?: string;
50
+ };
51
+ textBackgroundColor?: {
52
+ color?: string;
53
+ };
54
+ textPadding?: LegacyPadding;
55
+ textLineSpacing?: {
56
+ lineSpacing?: string;
57
+ 'font-lineSpacing'?: string;
58
+ };
59
+ textAlign?: {
60
+ align?: string;
61
+ };
62
+ textTrimming?: boolean;
63
+ }
64
+ /** Theme attached to image variables. */
65
+ export interface LegacyImageTheme {
66
+ imageSize?: {
67
+ width?: number;
68
+ height?: number;
69
+ };
70
+ }
71
+ /** Theme attached to the button variable. */
72
+ export interface LegacyButtonTheme {
73
+ buttonStyle?: {
74
+ 'font-family'?: string;
75
+ 'font-size'?: string;
76
+ 'font-weight'?: string;
77
+ 'font-style'?: string;
78
+ };
79
+ buttonStretch?: {
80
+ stretched?: boolean;
81
+ };
82
+ buttonInternalPadding?: LegacyPadding;
83
+ buttonExternalPadding?: LegacyPadding;
84
+ buttonText?: {
85
+ text?: string;
86
+ };
87
+ buttonColor?: {
88
+ color?: string;
89
+ };
90
+ textButtonColor?: {
91
+ color?: string;
92
+ };
93
+ buttonBorder?: {
94
+ width?: LegacySides<number>;
95
+ style?: LegacySides<string>;
96
+ color?: LegacySides<string>;
97
+ };
98
+ buttonBorderRadius?: LegacyBorderRadius;
99
+ buttonAlign?: {
100
+ align?: string;
101
+ };
102
+ }
103
+ /** Block-level theme. */
104
+ export interface LegacyBlockTheme {
105
+ blockAdapt?: {
106
+ adapt?: boolean;
107
+ };
108
+ blockPadding?: LegacyPadding;
109
+ }
110
+ /** Single composition.variable entry from `esd-dev-product-config`. */
111
+ export interface LegacyVariable {
112
+ /** e.g. `p_name`, `p_button`, `p_attribute_<ts>`. */
113
+ variable?: string;
114
+ /** Marker that distinguishes custom product attributes (`'p_attribute'`). */
115
+ variableType?: string;
116
+ /** Selector legacy used to address this element in the HTML. */
117
+ visibilityAreaSelector?: string;
118
+ /** Custom-attribute value (e.g. `product_attribute.brand`). */
119
+ value?: string;
120
+ /** Whether the element is hidden in the legacy block. */
121
+ hidden?: boolean;
122
+ /** Sort order across composition entries (lower = earlier). */
123
+ positionIdx?: number;
124
+ /** Element-kind-specific theme bag. */
125
+ theme?: LegacyTextTheme & LegacyImageTheme & LegacyButtonTheme;
126
+ /** Custom attribute marker. */
127
+ custom?: boolean;
128
+ }
129
+ /** Full decoded `esd-dev-product-config` shape. */
130
+ export interface LegacyProductConfig {
131
+ rowCount?: number;
132
+ totalCount?: number;
133
+ orientation?: string;
134
+ composition?: {
135
+ variables?: LegacyVariable[];
136
+ };
137
+ theme?: LegacyBlockTheme;
138
+ }
139
+ /** Element kind dispatched from a legacy `variable` value. */
140
+ export type ElementKind = 'image' | 'text' | 'button' | 'custom' | 'title';
141
+ /** Mapping output from a single legacy variable. */
142
+ export interface MappedVariable {
143
+ /** Composition key (`productName`, `customAttr:brand`, …) or `__title__` for titles. */
144
+ key: string;
145
+ kind: ElementKind;
146
+ hidden: boolean;
147
+ positionIdx: number;
148
+ /** Original legacy variable (kept for downstream theme mapping). */
149
+ legacy: LegacyVariable;
150
+ /** For custom attrs: bare attribute name (e.g. `brand`). */
151
+ customAttrName?: string;
152
+ /** For custom attrs: full `product-attr` value (e.g. `product_attribute.brand`). */
153
+ customAttrValue?: string;
154
+ }
155
+ /** CSS style strings + attributes resolved from a single text-like theme. */
156
+ export interface MappedTextStyle {
157
+ /** Inline CSS for outer `<td>` (background, padding). */
158
+ tdStyle: string;
159
+ /** Inline CSS for inner `<p>` (typography, color, line-height, text-align). */
160
+ pStyle: string;
161
+ /** Value for `<td align>` attribute, if any. */
162
+ align?: string;
163
+ /** Whether to wrap content in `<strong>`. */
164
+ wrapBold: boolean;
165
+ /** Whether to wrap content in `<em>`. */
166
+ wrapItalic: boolean;
167
+ /** True if `textTrimming: true` in theme. */
168
+ textTrimming: boolean;
169
+ }
170
+ /** Resolved button styles. */
171
+ export interface MappedButtonStyle {
172
+ /** Inline CSS for outer `<td>` (external padding). */
173
+ tdStyle: string;
174
+ /** Value for `<td align>`, if any. */
175
+ align?: string;
176
+ /** Inline CSS for `<span class="es-button-border">`. */
177
+ spanStyle: string;
178
+ /** Inline CSS for `<a class="es-button">`. */
179
+ aStyle: string;
180
+ /** Button label text. */
181
+ text?: string;
182
+ }
183
+ /** Resolved image styles. */
184
+ export interface MappedImageStyle {
185
+ /** Width in pixels (number form) — applied as both `width=` attr and CSS. */
186
+ width?: number;
187
+ /** Height in pixels. */
188
+ height?: number;
189
+ }
190
+ /** Per-variable mapped style bag, keyed by composition key. */
191
+ export type PerElementStyles = Record<string, MappedTextStyle | MappedButtonStyle | MappedImageStyle | undefined>;
192
+ /** Composition mapper output. */
193
+ export interface MappedComposition {
194
+ composition: string[];
195
+ visibility: Record<string, boolean>;
196
+ customAttributes: string[];
197
+ /** Mapping of customAttr key → full `product-attr` value. */
198
+ customAttrValues: Record<string, string>;
199
+ /** Title variable, if present (for separate title rendering). */
200
+ titleVariable?: LegacyVariable;
201
+ /** Resolved styles per composition key. */
202
+ perElementStyles: PerElementStyles;
203
+ /** Whether *any* element had `textTrimming: true`. */
204
+ anyTextTrimming: boolean;
205
+ }
@@ -1 +1,13 @@
1
- export declare function migrateRecommendation(html: string): string;
1
+ /**
2
+ * Idempotent: the selector matches only blocks that have
3
+ * `esd-dev-product-config` AND lack `recommendation-block-v2`, so
4
+ * re-running on a migrated template is a no-op.
5
+ */
6
+ import type { LegacyRecommendationConfig } from '@@/Types/config';
7
+ /**
8
+ * Migrate all legacy Recommendation Blocks in the given HTML string.
9
+ * @param html - Full template HTML.
10
+ * @param recommendationConfigs - Map of campaign-id → legacy config (`Record<string, LegacyRecommendationConfig>`).
11
+ * @returns Migrated HTML, or the original HTML if no legacy blocks exist.
12
+ */
13
+ export declare function migrateRecommendation(html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>): string;
@@ -3,3 +3,9 @@ export declare const UI_EDITOR_SELECTOR = "ui-editor";
3
3
  export declare const CARD_COMPOSITION_TAB_SELECTOR = "button[role=\"tab\"][aria-label=\"Card Composition\"]";
4
4
  export declare const SETTINGS_TAB_SELECTOR = "button[role=\"tab\"][aria-label=\"Settings\"]";
5
5
  export declare const RIBBON_SELECTOR = ".in-ribbons-wrapper";
6
+ export declare const DYNAMIC_CONTENT_BUTTON_SELECTOR = "#guido__btn-add-dynamic-content";
7
+ export declare const AMP_TOGGLE_BUTTON_SELECTOR = ".guido__amp-toggle-html";
8
+ export declare const AMP_TOGGLE_WRAPPER_SELECTOR = ".in-segments-wrapper";
9
+ export declare const HEADER_SELECTOR = "[data-testid=\"guido-header\"]";
10
+ export declare const POPOVER_LEFT_OFFSET = 158;
11
+ export declare const POPOVER_TOP_GAP = 10;
@@ -1,4 +1,4 @@
1
- declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;>\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
1
+ declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
2
2
  /**
3
3
  * @returns The template for the default checkbox block
4
4
  */
@@ -119,6 +119,16 @@ export declare class RecommendationConfigService {
119
119
  *
120
120
  * Reads existing data-attributes and creates a proper node config.
121
121
  * Used when loading templates created before node config was implemented.
122
+ *
123
+ * Sources, in priority order (later overrides earlier):
124
+ * 1. `esd-ext-config` JSON blob — emitted by the recommendation migrator and
125
+ * by hand-authored new templates. Carries the full RecommendationNodeConfig
126
+ * (strategy, language, currency, filters, productIds, etc.) which the
127
+ * discrete data-* attrs below cannot capture.
128
+ * 2. Discrete `data-*` attributes — runtime source of truth for
129
+ * layout/composition/spacing; controls keep these in sync as the user
130
+ * edits, so we let them override the JSON blob if they disagree.
131
+ * 3. `currency-*` attributes — durable currency source on the block element.
122
132
  * @param api - Stripo extension API with document modifier
123
133
  * @param node - The block node to migrate
124
134
  * @returns The migrated configuration
@@ -36,6 +36,25 @@ interface PerBlockState {
36
36
  /** Snapshot of filters taken when the drawer opens, used to revert on cancel */
37
37
  filterSnapshot: Filter[] | null;
38
38
  }
39
+ /**
40
+ * Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
41
+ * `recommendationConfigs` from a node-config JSON blob without coupling the
42
+ * caller to the full `RecommendationNodeConfig` shape. Separator strings are
43
+ * narrowed at the seed boundary.
44
+ */
45
+ export interface PerBlockUrlConfig {
46
+ strategy: string;
47
+ language: string;
48
+ size: string;
49
+ productIds: string[];
50
+ filters: Filter[];
51
+ shuffleProducts: boolean;
52
+ currencyCode: string;
53
+ currencyAlignment: 'before' | 'after';
54
+ currencyDecimalCount: number;
55
+ currencyDecimalSeparator: string;
56
+ currencyThousandSeparator: string;
57
+ }
39
58
  interface StoreState {
40
59
  recommendationCampaignUrls: Record<string, string>;
41
60
  activePredictiveAlgorithms: number[];
@@ -202,6 +221,21 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
202
221
  * Automatically cleaned up when removeBlockState deletes the block entry.
203
222
  */
204
223
  markBlockInitialized(id: number): void;
224
+ /**
225
+ * Seeds the URL-relevant fields of a block from a persisted node config.
226
+ *
227
+ * Used at save-time to ensure the campaign URL is built from the
228
+ * persisted truth (the `esd-ext-config` blob in the raw HTML) even when
229
+ * the user never selected the block in this editor session — without
230
+ * this seed, `_syncNodeConfigToStore` would never have run for that
231
+ * block and the store would hold default values (USD/en_US/mostPopular)
232
+ * instead of the real config.
233
+ *
234
+ * Creates the block entry if missing; otherwise patches only the URL-
235
+ * relevant subset and leaves runtime fields (e.g., `recommendedProducts`,
236
+ * `isInitialized`) alone.
237
+ */
238
+ seedBlockUrlConfig(id: number, config: PerBlockUrlConfig): void;
205
239
  /**
206
240
  * Patches the current block's recommendationConfigs.
207
241
  * Replaces `store.$patch({ recommendationConfigs: { ... } })` pattern.
@@ -24,7 +24,7 @@ export interface CurrencyConfig {
24
24
  /** Number of decimal places (-1 for no formatting) */
25
25
  decimalCount: number;
26
26
  /** Character used for decimal separation */
27
- decimalSeparator: '.' | ',';
27
+ decimalSeparator: '.' | ',' | ' ';
28
28
  /** Character used for thousands separation */
29
29
  thousandSeparator: '.' | ',' | ' ' | '';
30
30
  }
@@ -0,0 +1,21 @@
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
+ *
12
+ * Used at two boundaries:
13
+ * 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
14
+ * the new key.
15
+ * 2. The algorithm dropdown control, so already-saved blocks that still carry
16
+ * a legacy key resolve to a matching dropdown option.
17
+ *
18
+ * Unknown values pass through untouched so a future-added algorithm doesn't
19
+ * silently default.
20
+ */
21
+ export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
@@ -1,6 +1,3 @@
1
- /**
2
- * Utility for preserving text styling when updating innerHTML
3
- */
4
1
  import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
5
2
  /**
6
3
  * Preserves existing style tags when updating text content
@@ -1,5 +1,5 @@
1
1
  export { default as Guido } from './components/Guido.vue';
2
- export type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, DynamicContent, EmailHeader, DefaultBlockType, CustomBlockType, ValidationResult, ValidationError, } from './@types/config';
2
+ export type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, TemplateMigrationConfig, LegacyRecommendationConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, DynamicContent, EmailHeader, DefaultBlockType, CustomBlockType, ValidationResult, ValidationError, } from './@types/config';
3
3
  export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidationErrors, MessageType, ProductType, } from './@types/config';
4
4
  export type { StripoEventType } from './@types/events';
5
5
  export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
@@ -0,0 +1,12 @@
1
+ export declare const AUTOSAVE_STATUS: {
2
+ readonly IDLE: "idle";
3
+ readonly SAVING: "saving";
4
+ readonly SAVED: "saved";
5
+ readonly ERROR: "error";
6
+ };
7
+ export type AutosaveStatus = typeof AUTOSAVE_STATUS[keyof typeof AUTOSAVE_STATUS];
8
+ export declare const useAutosaveStore: import("pinia").StoreDefinition<"guidoAutosave", {
9
+ isOn: boolean;
10
+ lastSavedAt: Date | null;
11
+ status: AutosaveStatus;
12
+ }, {}, {}>;