@useinsider/guido 3.2.0-beta.a49c53c → 3.2.0-beta.a961c72

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 (63) hide show
  1. package/dist/@types/config/schemas.js +150 -94
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +88 -87
  4. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  5. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  6. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  7. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  8. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  9. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  10. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  11. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  12. package/dist/composables/useRibbonOffset.js +21 -0
  13. package/dist/composables/useStripo.js +39 -37
  14. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  15. package/dist/config/migrator/index.js +9 -9
  16. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  17. package/dist/config/migrator/recommendation/extractors.js +27 -0
  18. package/dist/config/migrator/recommendation/htmlBuilder.js +478 -0
  19. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  20. package/dist/config/migrator/recommendation/settingsMapper.js +78 -0
  21. package/dist/config/migrator/recommendation/themeMapper.js +89 -0
  22. package/dist/config/migrator/recommendationMigrator.js +60 -290
  23. package/dist/enums/extensions/recommendationBlock.js +2 -1
  24. package/dist/enums/onboarding.js +7 -2
  25. package/dist/enums/unsubscribe.js +34 -27
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  27. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  28. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  29. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  30. package/dist/guido.css +1 -1
  31. package/dist/node_modules/valibot/dist/index.js +450 -235
  32. package/dist/package.json.js +7 -0
  33. package/dist/src/@types/config/defaults.d.ts +5 -1
  34. package/dist/src/@types/config/index.d.ts +3 -3
  35. package/dist/src/@types/config/schemas.d.ts +213 -0
  36. package/dist/src/@types/config/types.d.ts +9 -1
  37. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  38. package/dist/src/composables/useConfig.d.ts +56 -0
  39. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  40. package/dist/src/config/migrator/index.d.ts +2 -1
  41. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +18 -0
  42. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  43. package/dist/src/config/migrator/recommendation/extractors.d.ts +23 -0
  44. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +31 -0
  45. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +28 -0
  46. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  47. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +29 -0
  48. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  49. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +28 -0
  50. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  51. package/dist/src/config/migrator/recommendation/types.d.ts +209 -0
  52. package/dist/src/config/migrator/recommendationMigrator.d.ts +28 -1
  53. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  54. package/dist/src/enums/onboarding.d.ts +6 -0
  55. package/dist/src/enums/unsubscribe.d.ts +5 -0
  56. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  57. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  58. package/dist/src/stores/config.d.ts +504 -0
  59. package/dist/src/stores/onboarding.d.ts +4 -0
  60. package/dist/static/templates/empty/style.css.js +1 -0
  61. package/dist/stores/onboarding.js +4 -0
  62. package/package.json +6 -2
  63. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
@@ -0,0 +1,7 @@
1
+ const o = { stripo: { version: "2.62.0" } }, s = {
2
+ guido: o
3
+ };
4
+ export {
5
+ s as default,
6
+ o as guido
7
+ };
@@ -5,11 +5,15 @@
5
5
  * These are applied during validation when values are not provided.
6
6
  * @module @types/config/defaults
7
7
  */
8
- import type { TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, EmailHeader } from './types';
8
+ import type { TemplateConfig, TemplateMigrationConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, EmailHeader } from './types';
9
9
  /**
10
10
  * Default email header values
11
11
  */
12
12
  export declare const DEFAULT_EMAIL_HEADER: EmailHeader;
13
+ /**
14
+ * Default template migration configuration
15
+ */
16
+ export declare const DEFAULT_TEMPLATE_MIGRATION: TemplateMigrationConfig;
13
17
  /**
14
18
  * Default template configuration
15
19
  */
@@ -7,8 +7,8 @@
7
7
  * - Default values for optional configuration
8
8
  * - Validation utilities
9
9
  */
10
- export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
11
- export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, FallbackFont, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
12
- export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
10
+ export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, TemplateMigrationSchema, LegacyRecommendationConfigSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
11
+ export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, FallbackFont, TemplateConfig, TemplateConfigInput, TemplateMigrationConfig, TemplateMigrationConfigInput, LegacyRecommendationConfig, LegacyRecommendationConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
12
+ export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_TEMPLATE_MIGRATION, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
13
13
  export { validateConfig, parseConfig, parseConfigSafe, getValidationErrors, isValidConfig, validateIdentity, validatePartner, } from './validator';
14
14
  export type { ValidationResult, ValidationError, } from './validator';
@@ -86,6 +86,117 @@ export declare const DynamicContentSchema: v.ObjectSchema<{
86
86
  readonly value: v.StringSchema<undefined>;
87
87
  }, undefined>, undefined>;
88
88
  }, undefined>;
89
+ /**
90
+ * Legacy recommendation block config (v1 format) keyed by block ID.
91
+ *
92
+ * Used by the recommendation migrator to enrich migrated blocks with
93
+ * filter, strategy, currency, language, and layout data that cannot be
94
+ * fully recovered from the legacy HTML alone.
95
+ *
96
+ * `looseObject` is used because legacy partner data shapes vary
97
+ * (e.g. some entries carry `verticalResponsiveness`, others `blockType`,
98
+ * `orientation`, `size`). Unknown keys are preserved and forwarded to
99
+ * the migrator unchanged.
100
+ */
101
+ export declare const LegacyRecommendationConfigSchema: v.LooseObjectSchema<{
102
+ /** Block ID (matches the dictionary key and the legacy HTML element id) */
103
+ readonly id: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
104
+ /** Decimal places for price display (legacy data may use string or number) */
105
+ readonly decimalCount: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
106
+ /** Pinned product IDs (empty array when filter-driven) */
107
+ readonly productIds: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
108
+ /** Whether the block requested live products at send time */
109
+ readonly sendProductRequestFlag: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
110
+ /** Whether to randomize product order */
111
+ readonly shuffleProducts: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
112
+ /** Filter rules driving product selection */
113
+ readonly filters: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
114
+ /** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
115
+ readonly currency: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
116
+ /** Currency display settings (separators, alignment, decimals) */
117
+ readonly currencySettings: v.OptionalSchema<v.UnknownSchema, undefined>;
118
+ /** Locale (e.g. 'nl_NL') */
119
+ readonly language: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
120
+ /** Recommendation strategy key (e.g. 'newArrivals') */
121
+ readonly strategy: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
122
+ /** Snapshot of products as rendered by the legacy block */
123
+ readonly recommendedProducts: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
124
+ /** Number of product cards per row */
125
+ readonly cardsInRow: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
126
+ /** Mobile-only padding (right) */
127
+ readonly mobileRightPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
128
+ /** Mobile-only padding (left) */
129
+ readonly mobileLeftPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
130
+ /** Disable responsive scaling */
131
+ readonly unresponsive: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
132
+ /** Layout orientation ('vertical' | 'horizontal') */
133
+ readonly orientation: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
134
+ /** Whether long text is trimmed */
135
+ readonly textTrimming: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
136
+ /** Block type marker used by some legacy variants */
137
+ readonly blockType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
138
+ /** Size variant marker (legacy data may use string or number) */
139
+ readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
140
+ /** Vertical responsiveness flag (legacy size=1 variants) */
141
+ readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
142
+ }, undefined>;
143
+ /**
144
+ * Migration-only inputs scoped to this template.
145
+ *
146
+ * These fields are consumed by template migrators when upgrading
147
+ * legacy block formats to current versions. They have no effect on
148
+ * editor behavior once the template is in the current format.
149
+ */
150
+ export declare const TemplateMigrationSchema: v.ObjectSchema<{
151
+ /**
152
+ * Legacy recommendation block configs keyed by block ID.
153
+ * Pass this when loading a template authored with the v1
154
+ * recommendation block so the migrator can preserve filters,
155
+ * strategy, currency, locale, and layout data.
156
+ */
157
+ readonly recommendationConfigs: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.LooseObjectSchema<{
158
+ /** Block ID (matches the dictionary key and the legacy HTML element id) */
159
+ readonly id: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
160
+ /** Decimal places for price display (legacy data may use string or number) */
161
+ readonly decimalCount: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
162
+ /** Pinned product IDs (empty array when filter-driven) */
163
+ readonly productIds: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
164
+ /** Whether the block requested live products at send time */
165
+ readonly sendProductRequestFlag: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
166
+ /** Whether to randomize product order */
167
+ readonly shuffleProducts: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
168
+ /** Filter rules driving product selection */
169
+ readonly filters: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
170
+ /** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
171
+ readonly currency: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
172
+ /** Currency display settings (separators, alignment, decimals) */
173
+ readonly currencySettings: v.OptionalSchema<v.UnknownSchema, undefined>;
174
+ /** Locale (e.g. 'nl_NL') */
175
+ readonly language: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
176
+ /** Recommendation strategy key (e.g. 'newArrivals') */
177
+ readonly strategy: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
178
+ /** Snapshot of products as rendered by the legacy block */
179
+ readonly recommendedProducts: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
180
+ /** Number of product cards per row */
181
+ readonly cardsInRow: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
182
+ /** Mobile-only padding (right) */
183
+ readonly mobileRightPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
184
+ /** Mobile-only padding (left) */
185
+ readonly mobileLeftPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
186
+ /** Disable responsive scaling */
187
+ readonly unresponsive: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
188
+ /** Layout orientation ('vertical' | 'horizontal') */
189
+ readonly orientation: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
190
+ /** Whether long text is trimmed */
191
+ readonly textTrimming: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
192
+ /** Block type marker used by some legacy variants */
193
+ readonly blockType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
194
+ /** Size variant marker (legacy data may use string or number) */
195
+ readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
196
+ /** Vertical responsiveness flag (legacy size=1 variants) */
197
+ readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
198
+ }, undefined>, undefined>, {}>;
199
+ }, undefined>;
89
200
  /**
90
201
  * Template configuration - initial content and preselected values
91
202
  */
@@ -114,6 +225,57 @@ export declare const TemplateSchema: v.ObjectSchema<{
114
225
  readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
115
226
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
116
227
  readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
228
+ /** Migration-only inputs (legacy block configs) */
229
+ readonly migration: v.OptionalSchema<v.ObjectSchema<{
230
+ /**
231
+ * Legacy recommendation block configs keyed by block ID.
232
+ * Pass this when loading a template authored with the v1
233
+ * recommendation block so the migrator can preserve filters,
234
+ * strategy, currency, locale, and layout data.
235
+ */
236
+ readonly recommendationConfigs: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.LooseObjectSchema<{
237
+ /** Block ID (matches the dictionary key and the legacy HTML element id) */
238
+ readonly id: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
239
+ /** Decimal places for price display (legacy data may use string or number) */
240
+ readonly decimalCount: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
241
+ /** Pinned product IDs (empty array when filter-driven) */
242
+ readonly productIds: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
243
+ /** Whether the block requested live products at send time */
244
+ readonly sendProductRequestFlag: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
245
+ /** Whether to randomize product order */
246
+ readonly shuffleProducts: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
247
+ /** Filter rules driving product selection */
248
+ readonly filters: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
249
+ /** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
250
+ readonly currency: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
251
+ /** Currency display settings (separators, alignment, decimals) */
252
+ readonly currencySettings: v.OptionalSchema<v.UnknownSchema, undefined>;
253
+ /** Locale (e.g. 'nl_NL') */
254
+ readonly language: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
255
+ /** Recommendation strategy key (e.g. 'newArrivals') */
256
+ readonly strategy: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
257
+ /** Snapshot of products as rendered by the legacy block */
258
+ readonly recommendedProducts: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
259
+ /** Number of product cards per row */
260
+ readonly cardsInRow: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
261
+ /** Mobile-only padding (right) */
262
+ readonly mobileRightPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
263
+ /** Mobile-only padding (left) */
264
+ readonly mobileLeftPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
265
+ /** Disable responsive scaling */
266
+ readonly unresponsive: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
267
+ /** Layout orientation ('vertical' | 'horizontal') */
268
+ readonly orientation: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
269
+ /** Whether long text is trimmed */
270
+ readonly textTrimming: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
271
+ /** Block type marker used by some legacy variants */
272
+ readonly blockType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
273
+ /** Size variant marker (legacy data may use string or number) */
274
+ readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
275
+ /** Vertical responsiveness flag (legacy size=1 variants) */
276
+ readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
277
+ }, undefined>, undefined>, {}>;
278
+ }, undefined>, {}>;
117
279
  }, undefined>;
118
280
  /**
119
281
  * Email header configuration (sender name and subject)
@@ -452,6 +614,57 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
452
614
  readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
453
615
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
454
616
  readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
617
+ /** Migration-only inputs (legacy block configs) */
618
+ readonly migration: v.OptionalSchema<v.ObjectSchema<{
619
+ /**
620
+ * Legacy recommendation block configs keyed by block ID.
621
+ * Pass this when loading a template authored with the v1
622
+ * recommendation block so the migrator can preserve filters,
623
+ * strategy, currency, locale, and layout data.
624
+ */
625
+ readonly recommendationConfigs: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.LooseObjectSchema<{
626
+ /** Block ID (matches the dictionary key and the legacy HTML element id) */
627
+ readonly id: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
628
+ /** Decimal places for price display (legacy data may use string or number) */
629
+ readonly decimalCount: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
630
+ /** Pinned product IDs (empty array when filter-driven) */
631
+ readonly productIds: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
632
+ /** Whether the block requested live products at send time */
633
+ readonly sendProductRequestFlag: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
634
+ /** Whether to randomize product order */
635
+ readonly shuffleProducts: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
636
+ /** Filter rules driving product selection */
637
+ readonly filters: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
638
+ /** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
639
+ readonly currency: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
640
+ /** Currency display settings (separators, alignment, decimals) */
641
+ readonly currencySettings: v.OptionalSchema<v.UnknownSchema, undefined>;
642
+ /** Locale (e.g. 'nl_NL') */
643
+ readonly language: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
644
+ /** Recommendation strategy key (e.g. 'newArrivals') */
645
+ readonly strategy: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
646
+ /** Snapshot of products as rendered by the legacy block */
647
+ readonly recommendedProducts: v.OptionalSchema<v.ArraySchema<v.UnknownSchema, undefined>, undefined>;
648
+ /** Number of product cards per row */
649
+ readonly cardsInRow: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
650
+ /** Mobile-only padding (right) */
651
+ readonly mobileRightPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
652
+ /** Mobile-only padding (left) */
653
+ readonly mobileLeftPadding: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
654
+ /** Disable responsive scaling */
655
+ readonly unresponsive: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
656
+ /** Layout orientation ('vertical' | 'horizontal') */
657
+ readonly orientation: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
658
+ /** Whether long text is trimmed */
659
+ readonly textTrimming: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
660
+ /** Block type marker used by some legacy variants */
661
+ readonly blockType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
662
+ /** Size variant marker (legacy data may use string or number) */
663
+ readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
664
+ /** Vertical responsiveness flag (legacy size=1 variants) */
665
+ readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
666
+ }, undefined>, undefined>, {}>;
667
+ }, undefined>, {}>;
455
668
  }, undefined>, {}>;
456
669
  /** Editor settings */
457
670
  readonly editor: v.OptionalSchema<v.ObjectSchema<{
@@ -5,7 +5,7 @@
5
5
  * This ensures type definitions are always in sync with validation.
6
6
  * @module @types/config/types
7
7
  */
8
- import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, FallbackFontSchema, ExternalValidationHandler } from './schemas';
8
+ import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, TemplateMigrationSchema, LegacyRecommendationConfigSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, FallbackFontSchema, ExternalValidationHandler } from './schemas';
9
9
  import type * as v from 'valibot';
10
10
  /**
11
11
  * Complete validated Guido configuration.
@@ -33,6 +33,10 @@ export type PartnerConfig = v.InferOutput<typeof PartnerSchema>;
33
33
  export type FallbackFont = v.InferOutput<typeof FallbackFontSchema>;
34
34
  /** Template configuration (html, css, dynamic content, unsubscribe pages) */
35
35
  export type TemplateConfig = v.InferOutput<typeof TemplateSchema>;
36
+ /** Migration-only inputs scoped to a template */
37
+ export type TemplateMigrationConfig = v.InferOutput<typeof TemplateMigrationSchema>;
38
+ /** Legacy v1 recommendation block config (keyed by block ID in `recommendationConfigs`) */
39
+ export type LegacyRecommendationConfig = v.InferOutput<typeof LegacyRecommendationConfigSchema>;
36
40
  /** Editor configuration (locale, translations, migration date, email header) */
37
41
  export type EditorConfig = v.InferOutput<typeof EditorSchema>;
38
42
  /** UI configuration (showHeader, backButtonLabel) */
@@ -81,6 +85,10 @@ export type IdentityConfigInput = v.InferInput<typeof IdentitySchema>;
81
85
  export type PartnerConfigInput = v.InferInput<typeof PartnerSchema>;
82
86
  /** Input type for template configuration */
83
87
  export type TemplateConfigInput = v.InferInput<typeof TemplateSchema>;
88
+ /** Input type for template migration configuration */
89
+ export type TemplateMigrationConfigInput = v.InferInput<typeof TemplateMigrationSchema>;
90
+ /** Input type for a single legacy recommendation block config */
91
+ export type LegacyRecommendationConfigInput = v.InferInput<typeof LegacyRecommendationConfigSchema>;
84
92
  /** Input type for editor configuration */
85
93
  export type EditorConfigInput = v.InferInput<typeof EditorSchema>;
86
94
  /** Input type for UI configuration */
@@ -32,8 +32,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
32
32
  closeOnOutsideClick: boolean;
33
33
  footerStatus: boolean;
34
34
  }>>>, {
35
- description: string;
36
35
  size: "X-small" | "small" | "medium" | "large";
36
+ description: string;
37
37
  closeOnOutsideClick: boolean;
38
38
  footerButtonOptions: FooterButtonGroup;
39
39
  closeButtonStatus: boolean;
@@ -37,6 +37,34 @@ export declare const useConfig: () => {
37
37
  customFieldAttributes: string[];
38
38
  selectedUnsubscribePages: number[];
39
39
  forceRecreate: boolean;
40
+ migration: {
41
+ recommendationConfigs: {
42
+ [x: string]: {
43
+ id?: number | undefined;
44
+ decimalCount?: string | number | undefined;
45
+ productIds?: unknown[] | undefined;
46
+ sendProductRequestFlag?: boolean | undefined;
47
+ shuffleProducts?: boolean | undefined;
48
+ filters?: unknown[] | undefined;
49
+ currency?: string | undefined;
50
+ currencySettings?: unknown;
51
+ language?: string | undefined;
52
+ strategy?: string | undefined;
53
+ recommendedProducts?: unknown[] | undefined;
54
+ cardsInRow?: number | undefined;
55
+ mobileRightPadding?: number | undefined;
56
+ mobileLeftPadding?: number | undefined;
57
+ unresponsive?: boolean | undefined;
58
+ orientation?: string | undefined;
59
+ textTrimming?: boolean | undefined;
60
+ blockType?: string | undefined;
61
+ size?: string | number | undefined;
62
+ verticalResponsiveness?: boolean | undefined;
63
+ } & {
64
+ [key: string]: unknown;
65
+ };
66
+ };
67
+ };
40
68
  };
41
69
  editor: {
42
70
  locale: string;
@@ -134,6 +162,34 @@ export declare const useConfig: () => {
134
162
  customFieldAttributes: string[];
135
163
  selectedUnsubscribePages: number[];
136
164
  forceRecreate: boolean;
165
+ migration: {
166
+ recommendationConfigs: {
167
+ [x: string]: {
168
+ id?: number | undefined;
169
+ decimalCount?: string | number | undefined;
170
+ productIds?: unknown[] | undefined;
171
+ sendProductRequestFlag?: boolean | undefined;
172
+ shuffleProducts?: boolean | undefined;
173
+ filters?: unknown[] | undefined;
174
+ currency?: string | undefined;
175
+ currencySettings?: unknown;
176
+ language?: string | undefined;
177
+ strategy?: string | undefined;
178
+ recommendedProducts?: unknown[] | undefined;
179
+ cardsInRow?: number | undefined;
180
+ mobileRightPadding?: number | undefined;
181
+ mobileLeftPadding?: number | undefined;
182
+ unresponsive?: boolean | undefined;
183
+ orientation?: string | undefined;
184
+ textTrimming?: boolean | undefined;
185
+ blockType?: string | undefined;
186
+ size?: string | number | undefined;
187
+ verticalResponsiveness?: boolean | undefined;
188
+ } & {
189
+ [key: string]: unknown;
190
+ };
191
+ };
192
+ };
137
193
  } | null>;
138
194
  editor: import("vue").ComputedRef<{
139
195
  locale: string;
@@ -0,0 +1,4 @@
1
+ export declare const useRibbonOffset: () => {
2
+ ribbonOffset: import("vue").Ref<number>;
3
+ getTopPosition: (baseTop: number) => string;
4
+ };
@@ -1 +1,2 @@
1
- export declare const migrate: (html: string) => Promise<string>;
1
+ import type { LegacyRecommendationConfig } from '@@/Types/config';
2
+ export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>) => Promise<string>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Map the legacy `composition.variables[]` array to:
3
+ * - the new block's composition order (`string[]`),
4
+ * - per-key visibility flags,
5
+ * - per-key resolved styles (delegated to `themeMapper`),
6
+ * - the title variable (extracted separately, not part of composition),
7
+ * - the list of custom attribute names (and their full `product-attr` values).
8
+ *
9
+ * Sorting rule: ascending by `positionIdx`. Ties broken by the canonical
10
+ * order in `DEFAULT_COMPOSITION` so ambiguous templates produce a
11
+ * stable, predictable layout.
12
+ */
13
+ import { type LegacyVariable, type MappedComposition } from './types';
14
+ /**
15
+ * Build the composition / visibility / per-element-style triple from
16
+ * a legacy variables array.
17
+ */
18
+ export declare function mapComposition(variables: LegacyVariable[] | undefined): MappedComposition;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * DOM-side extractors for legacy block content that the structured config
3
+ * doesn't capture (title text, card background color).
4
+ *
5
+ * These are best-effort: missing values fall back to sensible defaults.
6
+ */
7
+ /**
8
+ * Extract the title text from the legacy block's `.ext-recommendation-title`
9
+ * element. Returns `'You May Also Like!'` when absent.
10
+ *
11
+ * Theme styles for the title come from the `p_recommendation_title`
12
+ * variable's theme, NOT this DOM scrape — we only need the text here.
13
+ */
14
+ export declare function extractTitleText(block: Element): string;
15
+ /**
16
+ * Extract the card background color. Legacy templates apply card-level
17
+ * background to either the block itself (`bgcolor`/`style`) or to the
18
+ * per-card cells (`.product-card`).
19
+ *
20
+ * Returns an empty string when no background is set — the caller treats
21
+ * an empty value as "no segment background".
22
+ */
23
+ export declare function extractCardBgColor(block: Element): string;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Build the migrated Recommendation block HTML from the mapped settings,
3
+ * composition, and per-element styles.
4
+ *
5
+ * The output structure matches what the new block expects (`recommendation-block-v2`
6
+ * class, `data-card-composition`, `data-custom-attributes`, currency-* attrs,
7
+ * and an `esd-ext-config` JSON blob — Stripo's serialization of the node
8
+ * config so `node.getNodeConfig()` returns it directly on first load).
9
+ *
10
+ * Per-element styles are inlined onto the rendered `<td>` / `<p>` / `<span>` /
11
+ * `<a>` elements so the new block's controls (which read CSS via Stripo's
12
+ * `*BuiltInControl` classes) pick them up unchanged.
13
+ */
14
+ import type { MappedComposition } from './types';
15
+ import type { RecommendationNodeConfig } from '@@/Extensions/Blocks/Recommendation/types/nodeConfig';
16
+ /**
17
+ * Build the full HTML for the migrated block as a single `<td>...</td>` string.
18
+ *
19
+ * The caller replaces the legacy `<td>` element with the parsed result.
20
+ */
21
+ export declare function buildBlockHtml(params: {
22
+ nodeConfig: RecommendationNodeConfig;
23
+ composition: MappedComposition;
24
+ cardBg: string;
25
+ titleText: string;
26
+ extraClasses?: string;
27
+ /** Legacy `id` attribute to propagate onto the new block (for callers that anchor on it). */
28
+ legacyId?: string;
29
+ /** Legacy `bgcolor` attribute to propagate onto the new block (also applied as segment style). */
30
+ legacyBgColor?: string;
31
+ }): string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Decode the `esd-dev-product-config` HTML attribute on a legacy block.
3
+ *
4
+ * The attribute is double-HTML-encoded JSON: serialization escapes once
5
+ * to embed inside the attribute, and Stripo's templating layer escapes
6
+ * a second time when round-tripping through its renderer. We unescape
7
+ * twice and then JSON.parse.
8
+ */
9
+ import type { LegacyProductConfig } from './types';
10
+ /**
11
+ * Reads `esd-dev-product-config` from the given block, decodes the
12
+ * double-encoded JSON, and returns the parsed object.
13
+ *
14
+ * Returns `null` when the attribute is missing or unable to be parsed —
15
+ * the caller treats either case as an abort condition.
16
+ */
17
+ export declare function parseLegacyConfig(block: Element): LegacyProductConfig | null;
18
+ /**
19
+ * Reads the legacy recommendation campaign ID. Tries the canonical
20
+ * `ins-recommendation-v3-campaign-id` attribute first, then falls back
21
+ * to extracting the digits from the `ins-recommendation-v3-block-<id>`
22
+ * class name (older legacy templates omitted the campaign-id attribute
23
+ * but always included this class).
24
+ *
25
+ * Returns `null` if neither source yields a numeric ID — that is the
26
+ * abort signal for the migrator.
27
+ */
28
+ export declare function parseRecommendationId(block: Element): number | null;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Map a legacy recommendation block's runtime config (from Guido Config)
3
+ * plus the parsed `esd-dev-product-config` JSON to the settings half of
4
+ * the new `RecommendationNodeConfig`.
5
+ *
6
+ * "Settings" here covers everything the user picks via dropdowns / inputs
7
+ * (algorithm, locale, currency, filters, layout dimensions). Per-element
8
+ * styles are handled by `themeMapper`. Composition is handled by
9
+ * `compositionMapper`.
10
+ */
11
+ import type { LegacyProductConfig } from './types';
12
+ import type { CurrencyConfig, RecommendationNodeConfig } from '@@/Extensions/Blocks/Recommendation/types/nodeConfig';
13
+ import type { LegacyRecommendationConfig } from '@@/Types/config';
14
+ /**
15
+ * Build a `CurrencyConfig` from a legacy `currencySettings` object.
16
+ *
17
+ * Defensive: legacy data is `looseObject` so any field may be missing
18
+ * or malformed. Defaults are applied per-field, not whole-object.
19
+ */
20
+ export declare function mapCurrency(legacy: unknown): CurrencyConfig;
21
+ /** All settings-related fields of `RecommendationNodeConfig`. */
22
+ export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'configVersion'>;
23
+ /**
24
+ * Build the settings half of a new node config from a legacy block.
25
+ * @param recCfg - The matching `recommendationConfigs[id]` entry.
26
+ * @param parsed - The decoded `esd-dev-product-config` JSON.
27
+ * @param id - The recommendation campaign ID.
28
+ */
29
+ export declare function mapSettings(recCfg: LegacyRecommendationConfig, parsed: LegacyProductConfig, id: number): SettingsPartial;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Convert legacy theme objects (`composition.variables[i].theme`) to the
3
+ * inline CSS strings + HTML attributes that the new Recommendation block
4
+ * controls read directly from the DOM.
5
+ *
6
+ * Three element kinds — text-like (name/price/old-price/omnibus/custom),
7
+ * button, and image — each have their own theme shape and CSS targets.
8
+ * Every accessor is optional-chained: legacy data is heterogeneous and
9
+ * a missing field never aborts a migration, it just emits no CSS for
10
+ * that property.
11
+ */
12
+ import type { LegacyButtonTheme, LegacyImageTheme, LegacyTextTheme, MappedButtonStyle, MappedImageStyle, MappedTextStyle } from './types';
13
+ /** Map a text-like theme (used by name, prices, omnibus, custom-attr). */
14
+ export declare function mapTextTheme(theme: LegacyTextTheme | undefined): MappedTextStyle;
15
+ /**
16
+ * Map a button theme. Buttons distribute styles across three elements:
17
+ * the wrapping `<td>` (external padding + alignment), the
18
+ * `<span class="es-button-border">` (border + background + radius), and
19
+ * the `<a class="es-button">` (typography + foreground + internal padding).
20
+ */
21
+ export declare function mapButtonTheme(theme: LegacyButtonTheme | undefined): MappedButtonStyle;
22
+ /** Map an image theme — only `imageSize.{width,height}` are observed. */
23
+ export declare function mapImageTheme(theme: LegacyImageTheme | undefined): MappedImageStyle;
24
+ /**
25
+ * Append a CSS declaration onto an existing `style="..."` string, joining
26
+ * with `; ` if the existing value is non-empty. Safe for empty inputs.
27
+ */
28
+ export declare function appendStyle(existing: string | undefined, addition: string | undefined): string;