@useinsider/guido 1.4.4-beta.b4adc85 → 1.4.4

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 (80) hide show
  1. package/README.md +664 -295
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +89 -63
  4. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
  5. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
  6. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
  7. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  8. package/dist/components/organisms/header/LeftSlot.vue2.js +15 -18
  9. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  10. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +19 -22
  11. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
  12. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
  13. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  14. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
  15. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
  16. package/dist/composables/useBlocksConfig.js +20 -23
  17. package/dist/composables/useConfig.js +5 -51
  18. package/dist/composables/useHtmlCompiler.js +19 -20
  19. package/dist/composables/useHtmlValidator.js +41 -41
  20. package/dist/composables/usePartner.js +9 -19
  21. package/dist/composables/useStripo.js +11 -11
  22. package/dist/composables/useTranslations.js +2 -3
  23. package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
  24. package/dist/enums/defaults.js +67 -3
  25. package/dist/enums/unsubscribe.js +20 -23
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +11 -12
  27. package/dist/guido.css +1 -1
  28. package/dist/library.js +2 -12
  29. package/dist/node_modules/lodash-es/_apply.js +16 -0
  30. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
  31. package/dist/node_modules/lodash-es/_assignMergeValue.js +8 -0
  32. package/dist/node_modules/lodash-es/_assignValue.js +10 -0
  33. package/dist/node_modules/lodash-es/_baseAssignValue.js +12 -0
  34. package/dist/node_modules/lodash-es/_baseCreate.js +17 -0
  35. package/dist/node_modules/lodash-es/_baseKeysIn.js +15 -0
  36. package/dist/node_modules/lodash-es/_baseMerge.js +20 -0
  37. package/dist/node_modules/lodash-es/_baseMergeDeep.js +31 -0
  38. package/dist/node_modules/lodash-es/_baseRest.js +9 -0
  39. package/dist/node_modules/lodash-es/_baseSetToString.js +14 -0
  40. package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  41. package/dist/node_modules/lodash-es/_cloneBuffer.js +9 -0
  42. package/dist/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  43. package/dist/node_modules/lodash-es/_copyArray.js +9 -0
  44. package/dist/node_modules/lodash-es/_copyObject.js +14 -0
  45. package/dist/node_modules/lodash-es/_createAssigner.js +15 -0
  46. package/dist/node_modules/lodash-es/_defineProperty.js +11 -0
  47. package/dist/node_modules/lodash-es/_getPrototype.js +5 -0
  48. package/dist/node_modules/lodash-es/_initCloneObject.js +9 -0
  49. package/dist/node_modules/lodash-es/_nativeKeysIn.js +10 -0
  50. package/dist/node_modules/lodash-es/_overRest.js +15 -0
  51. package/dist/node_modules/lodash-es/_safeGet.js +7 -0
  52. package/dist/node_modules/lodash-es/_setToString.js +6 -0
  53. package/dist/node_modules/lodash-es/_shortOut.js +16 -0
  54. package/dist/node_modules/lodash-es/constant.js +8 -0
  55. package/dist/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  56. package/dist/node_modules/lodash-es/isPlainObject.js +16 -0
  57. package/dist/node_modules/lodash-es/keysIn.js +9 -0
  58. package/dist/node_modules/lodash-es/merge.js +8 -0
  59. package/dist/node_modules/lodash-es/toPlainObject.js +8 -0
  60. package/dist/node_modules/valibot/dist/index.js +103 -476
  61. package/dist/services/templateLibraryApi.js +18 -18
  62. package/dist/src/@types/generic.d.ts +45 -4
  63. package/dist/src/components/Guido.vue.d.ts +12 -13
  64. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  65. package/dist/src/composables/useConfig.d.ts +2 -184
  66. package/dist/src/composables/usePartner.d.ts +0 -8
  67. package/dist/src/enums/defaults.d.ts +6 -4
  68. package/dist/src/enums/unsubscribe.d.ts +1 -5
  69. package/dist/src/library.d.ts +1 -3
  70. package/dist/src/stores/config.d.ts +102 -1547
  71. package/dist/stores/config.js +9 -141
  72. package/package.json +1 -1
  73. package/dist/@types/config/defaults.js +0 -44
  74. package/dist/@types/config/schemas.js +0 -229
  75. package/dist/@types/config/validator.js +0 -56
  76. package/dist/src/@types/config/defaults.d.ts +0 -68
  77. package/dist/src/@types/config/index.d.ts +0 -14
  78. package/dist/src/@types/config/schemas.d.ts +0 -505
  79. package/dist/src/@types/config/types.d.ts +0 -142
  80. package/dist/src/@types/config/validator.d.ts +0 -119
@@ -1,505 +0,0 @@
1
- /**
2
- * Guido Configuration Schemas
3
- *
4
- * Valibot schemas for validating and transforming Guido configuration.
5
- * All types are inferred from these schemas to ensure single source of truth.
6
- * @module @types/config/schemas
7
- */
8
- import * as v from 'valibot';
9
- /**
10
- * Message type constants for email templates
11
- */
12
- export declare const MessageType: {
13
- /** Promotional/marketing emails */
14
- readonly PROMOTIONAL: 1;
15
- /** Transactional/system emails */
16
- readonly TRANSACTIONAL: 2;
17
- };
18
- /**
19
- * Product type constants for different Insider products
20
- */
21
- export declare const ProductType: {
22
- /** Standard email campaigns */
23
- readonly EMAIL: 60;
24
- /** Architect journey builder */
25
- readonly ARCHITECT: 49;
26
- /** Unsubscribe page builder */
27
- readonly UNSUBSCRIBE_PAGES: 97;
28
- };
29
- /**
30
- * Identity configuration - identifies the template and user
31
- */
32
- export declare const IdentitySchema: v.ObjectSchema<{
33
- /** Unique identifier for the template being edited */
34
- readonly templateId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "templateId is required">]>;
35
- /** Unique identifier for the user editing the template */
36
- readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "userId is required">]>;
37
- /** Optional variation ID for A/B testing */
38
- readonly variationId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
39
- }, undefined>;
40
- /**
41
- * Partner configuration - organization and product context
42
- */
43
- export declare const PartnerSchema: v.ObjectSchema<{
44
- /** Partner/organization name (required) */
45
- readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "partner.name is required">]>;
46
- /** Product type identifier */
47
- readonly productType: v.OptionalSchema<v.PicklistSchema<[60, 49, 97], undefined>, 60>;
48
- /** Message type (promotional or transactional) */
49
- readonly messageType: v.OptionalSchema<v.PicklistSchema<[1, 2], undefined>, 1>;
50
- /** Display name for the current user */
51
- readonly username: v.OptionalSchema<v.StringSchema<undefined>, "Guido User">;
52
- }, undefined>;
53
- /**
54
- * Dynamic content item schema
55
- */
56
- export declare const DynamicContentSchema: v.ObjectSchema<{
57
- /** Display text for the dynamic content */
58
- readonly text: v.StringSchema<undefined>;
59
- /** Template variable value (e.g., {{username}}) */
60
- readonly value: v.StringSchema<undefined>;
61
- /** Fallback value if variable is empty */
62
- readonly fallback: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
63
- /** Optional formatting options */
64
- readonly format: v.OptionalSchema<v.ObjectSchema<{
65
- readonly key: v.StringSchema<undefined>;
66
- readonly value: v.StringSchema<undefined>;
67
- }, undefined>, undefined>;
68
- }, undefined>;
69
- /**
70
- * Template configuration - initial content and preselected values
71
- */
72
- export declare const TemplateSchema: v.ObjectSchema<{
73
- /** Initial HTML content */
74
- readonly html: v.OptionalSchema<v.StringSchema<undefined>, "">;
75
- /** Initial CSS content */
76
- readonly css: v.OptionalSchema<v.StringSchema<undefined>, "">;
77
- /** Preselected dynamic content items */
78
- readonly preselectedDynamicContent: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
79
- /** Display text for the dynamic content */
80
- readonly text: v.StringSchema<undefined>;
81
- /** Template variable value (e.g., {{username}}) */
82
- readonly value: v.StringSchema<undefined>;
83
- /** Fallback value if variable is empty */
84
- readonly fallback: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
85
- /** Optional formatting options */
86
- readonly format: v.OptionalSchema<v.ObjectSchema<{
87
- readonly key: v.StringSchema<undefined>;
88
- readonly value: v.StringSchema<undefined>;
89
- }, undefined>, undefined>;
90
- }, undefined>, undefined>, readonly []>;
91
- /** Selected unsubscribe page IDs */
92
- readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
93
- }, undefined>;
94
- /**
95
- * Email header configuration (sender name and subject)
96
- */
97
- export declare const EmailHeaderSchema: v.ObjectSchema<{
98
- /** Sender display name */
99
- readonly senderName: v.OptionalSchema<v.StringSchema<undefined>, "">;
100
- /** Email subject line */
101
- readonly subject: v.OptionalSchema<v.StringSchema<undefined>, "">;
102
- }, undefined>;
103
- /**
104
- * Editor configuration - core editor settings
105
- */
106
- export declare const EditorSchema: v.ObjectSchema<{
107
- /** Locale for the editor UI */
108
- readonly locale: v.OptionalSchema<v.StringSchema<undefined>, "en">;
109
- /** Path to translations object */
110
- readonly translationsPath: v.OptionalSchema<v.StringSchema<undefined>, "window.trans.en">;
111
- /** Migration date for template compatibility */
112
- readonly migrationDate: v.OptionalSchema<v.NumberSchema<undefined>, 1759696858>;
113
- /** Email header settings */
114
- readonly emailHeader: v.OptionalSchema<v.ObjectSchema<{
115
- /** Sender display name */
116
- readonly senderName: v.OptionalSchema<v.StringSchema<undefined>, "">;
117
- /** Email subject line */
118
- readonly subject: v.OptionalSchema<v.StringSchema<undefined>, "">;
119
- }, undefined>, {
120
- readonly senderName: "";
121
- readonly subject: "";
122
- }>;
123
- }, undefined>;
124
- /**
125
- * UI configuration - visual elements and layout
126
- */
127
- export declare const UISchema: v.ObjectSchema<{
128
- /** Whether to show the header bar */
129
- readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
130
- /** Custom label for back button (if shown) */
131
- readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
132
- }, undefined>;
133
- /**
134
- * Features configuration - enable/disable editor features
135
- */
136
- export declare const FeaturesSchema: v.ObjectSchema<{
137
- /** Enable dynamic content insertion */
138
- readonly dynamicContent: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
139
- /** Enable save as template functionality */
140
- readonly saveAsTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
141
- /** Enable version history */
142
- readonly versionHistory: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
143
- /** Enable test message sending */
144
- readonly testMessage: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
145
- /** Enable display conditions */
146
- readonly displayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
147
- /** Enable unsubscribe block */
148
- readonly unsubscribe: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
149
- }, undefined>;
150
- /**
151
- * Default block types available in Stripo
152
- */
153
- export declare const DefaultBlockTypeSchema: v.PicklistSchema<["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"], undefined>;
154
- /**
155
- * Custom block types added by Guido
156
- */
157
- export declare const CustomBlockTypeSchema: v.PicklistSchema<["dynamic-content", "checkbox-block", "radio-button-block", "recommendation-block", "unsubscribe-block", "coupon-block", "items-block"], undefined>;
158
- /**
159
- * Blocks configuration - include/exclude specific blocks
160
- */
161
- export declare const BlocksSchema: v.ObjectSchema<{
162
- /** Default blocks to exclude from the editor */
163
- readonly excludeDefaults: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["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"], undefined>, undefined>, readonly []>;
164
- /** Custom blocks to include in the editor */
165
- readonly includeCustoms: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["dynamic-content", "checkbox-block", "radio-button-block", "recommendation-block", "unsubscribe-block", "coupon-block", "items-block"], undefined>, undefined>, readonly []>;
166
- }, undefined>;
167
- /**
168
- * Compiler rule types
169
- */
170
- export declare const CompilerRuleTypeSchema: v.PicklistSchema<["replace", "regex", "remove", "custom"], undefined>;
171
- /**
172
- * Replace rule - simple string replacement
173
- */
174
- export declare const ReplaceRuleSchema: v.ObjectSchema<{
175
- readonly type: v.LiteralSchema<"replace", undefined>;
176
- /** String to search for */
177
- readonly search: v.StringSchema<undefined>;
178
- /** Replacement string */
179
- readonly replacement: v.StringSchema<undefined>;
180
- /** Replace all occurrences (default: false) */
181
- readonly replaceAll: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
182
- /** Unique identifier for the rule */
183
- readonly id: v.StringSchema<undefined>;
184
- /** Human-readable description */
185
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
186
- /** Priority for rule ordering (lower = earlier) */
187
- readonly priority: v.NumberSchema<undefined>;
188
- }, undefined>;
189
- /**
190
- * Regex rule - regular expression replacement
191
- */
192
- export declare const RegexRuleSchema: v.ObjectSchema<{
193
- readonly type: v.LiteralSchema<"regex", undefined>;
194
- /** Regex pattern string */
195
- readonly pattern: v.StringSchema<undefined>;
196
- /** Replacement string (supports $1, $2, etc.) */
197
- readonly replacement: v.StringSchema<undefined>;
198
- /** Regex flags (e.g., 'gi') */
199
- readonly flags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
200
- /** Unique identifier for the rule */
201
- readonly id: v.StringSchema<undefined>;
202
- /** Human-readable description */
203
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
204
- /** Priority for rule ordering (lower = earlier) */
205
- readonly priority: v.NumberSchema<undefined>;
206
- }, undefined>;
207
- /**
208
- * Remove rule - remove matching content
209
- */
210
- export declare const RemoveRuleSchema: v.ObjectSchema<{
211
- readonly type: v.LiteralSchema<"remove", undefined>;
212
- /** Strings or patterns to remove */
213
- readonly targets: v.ArraySchema<v.StringSchema<undefined>, undefined>;
214
- /** Unique identifier for the rule */
215
- readonly id: v.StringSchema<undefined>;
216
- /** Human-readable description */
217
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
218
- /** Priority for rule ordering (lower = earlier) */
219
- readonly priority: v.NumberSchema<undefined>;
220
- }, undefined>;
221
- /**
222
- * Custom rule - custom processing function
223
- * Note: Functions cannot be validated at runtime, this is for type safety
224
- */
225
- export declare const CustomRuleSchema: v.ObjectSchema<{
226
- readonly type: v.LiteralSchema<"custom", undefined>;
227
- /** Custom processor function */
228
- readonly processor: v.CustomSchema<(html: string) => string, v.ErrorMessage<v.CustomIssue> | undefined>;
229
- /** Unique identifier for the rule */
230
- readonly id: v.StringSchema<undefined>;
231
- /** Human-readable description */
232
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
233
- /** Priority for rule ordering (lower = earlier) */
234
- readonly priority: v.NumberSchema<undefined>;
235
- }, undefined>;
236
- /**
237
- * Union of all compiler rule types
238
- */
239
- export declare const CompilerRuleSchema: v.VariantSchema<"type", [v.ObjectSchema<{
240
- readonly type: v.LiteralSchema<"replace", undefined>;
241
- /** String to search for */
242
- readonly search: v.StringSchema<undefined>;
243
- /** Replacement string */
244
- readonly replacement: v.StringSchema<undefined>;
245
- /** Replace all occurrences (default: false) */
246
- readonly replaceAll: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
247
- /** Unique identifier for the rule */
248
- readonly id: v.StringSchema<undefined>;
249
- /** Human-readable description */
250
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
251
- /** Priority for rule ordering (lower = earlier) */
252
- readonly priority: v.NumberSchema<undefined>;
253
- }, undefined>, v.ObjectSchema<{
254
- readonly type: v.LiteralSchema<"regex", undefined>;
255
- /** Regex pattern string */
256
- readonly pattern: v.StringSchema<undefined>;
257
- /** Replacement string (supports $1, $2, etc.) */
258
- readonly replacement: v.StringSchema<undefined>;
259
- /** Regex flags (e.g., 'gi') */
260
- readonly flags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
261
- /** Unique identifier for the rule */
262
- readonly id: v.StringSchema<undefined>;
263
- /** Human-readable description */
264
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
265
- /** Priority for rule ordering (lower = earlier) */
266
- readonly priority: v.NumberSchema<undefined>;
267
- }, undefined>, v.ObjectSchema<{
268
- readonly type: v.LiteralSchema<"remove", undefined>;
269
- /** Strings or patterns to remove */
270
- readonly targets: v.ArraySchema<v.StringSchema<undefined>, undefined>;
271
- /** Unique identifier for the rule */
272
- readonly id: v.StringSchema<undefined>;
273
- /** Human-readable description */
274
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
275
- /** Priority for rule ordering (lower = earlier) */
276
- readonly priority: v.NumberSchema<undefined>;
277
- }, undefined>, v.ObjectSchema<{
278
- readonly type: v.LiteralSchema<"custom", undefined>;
279
- /** Custom processor function */
280
- readonly processor: v.CustomSchema<(html: string) => string, v.ErrorMessage<v.CustomIssue> | undefined>;
281
- /** Unique identifier for the rule */
282
- readonly id: v.StringSchema<undefined>;
283
- /** Human-readable description */
284
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
285
- /** Priority for rule ordering (lower = earlier) */
286
- readonly priority: v.NumberSchema<undefined>;
287
- }, undefined>], undefined>;
288
- /**
289
- * Compiler configuration - HTML compilation settings
290
- */
291
- export declare const CompilerSchema: v.ObjectSchema<{
292
- /** Custom compiler rules to apply */
293
- readonly customRules: v.OptionalSchema<v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
294
- readonly type: v.LiteralSchema<"replace", undefined>;
295
- /** String to search for */
296
- readonly search: v.StringSchema<undefined>;
297
- /** Replacement string */
298
- readonly replacement: v.StringSchema<undefined>;
299
- /** Replace all occurrences (default: false) */
300
- readonly replaceAll: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
301
- /** Unique identifier for the rule */
302
- readonly id: v.StringSchema<undefined>;
303
- /** Human-readable description */
304
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
305
- /** Priority for rule ordering (lower = earlier) */
306
- readonly priority: v.NumberSchema<undefined>;
307
- }, undefined>, v.ObjectSchema<{
308
- readonly type: v.LiteralSchema<"regex", undefined>;
309
- /** Regex pattern string */
310
- readonly pattern: v.StringSchema<undefined>;
311
- /** Replacement string (supports $1, $2, etc.) */
312
- readonly replacement: v.StringSchema<undefined>;
313
- /** Regex flags (e.g., 'gi') */
314
- readonly flags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
315
- /** Unique identifier for the rule */
316
- readonly id: v.StringSchema<undefined>;
317
- /** Human-readable description */
318
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
319
- /** Priority for rule ordering (lower = earlier) */
320
- readonly priority: v.NumberSchema<undefined>;
321
- }, undefined>, v.ObjectSchema<{
322
- readonly type: v.LiteralSchema<"remove", undefined>;
323
- /** Strings or patterns to remove */
324
- readonly targets: v.ArraySchema<v.StringSchema<undefined>, undefined>;
325
- /** Unique identifier for the rule */
326
- readonly id: v.StringSchema<undefined>;
327
- /** Human-readable description */
328
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
329
- /** Priority for rule ordering (lower = earlier) */
330
- readonly priority: v.NumberSchema<undefined>;
331
- }, undefined>, v.ObjectSchema<{
332
- readonly type: v.LiteralSchema<"custom", undefined>;
333
- /** Custom processor function */
334
- readonly processor: v.CustomSchema<(html: string) => string, v.ErrorMessage<v.CustomIssue> | undefined>;
335
- /** Unique identifier for the rule */
336
- readonly id: v.StringSchema<undefined>;
337
- /** Human-readable description */
338
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
339
- /** Priority for rule ordering (lower = earlier) */
340
- readonly priority: v.NumberSchema<undefined>;
341
- }, undefined>], undefined>, undefined>, readonly []>;
342
- /** Skip default compiler rules */
343
- readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
344
- }, undefined>;
345
- /**
346
- * Complete Guido configuration schema
347
- *
348
- * Organized by domain:
349
- * - identity: Who is editing what
350
- * - partner: Organization context
351
- * - template: Initial content
352
- * - editor: Core editor settings
353
- * - ui: Visual elements
354
- * - features: Feature toggles
355
- * - blocks: Block configuration
356
- * - compiler: HTML compilation
357
- */
358
- export declare const GuidoConfigSchema: v.ObjectSchema<{
359
- /** Identity configuration (required) */
360
- readonly identity: v.ObjectSchema<{
361
- /** Unique identifier for the template being edited */
362
- readonly templateId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "templateId is required">]>;
363
- /** Unique identifier for the user editing the template */
364
- readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "userId is required">]>;
365
- /** Optional variation ID for A/B testing */
366
- readonly variationId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
367
- }, undefined>;
368
- /** Partner configuration (required) */
369
- readonly partner: v.ObjectSchema<{
370
- /** Partner/organization name (required) */
371
- readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "partner.name is required">]>;
372
- /** Product type identifier */
373
- readonly productType: v.OptionalSchema<v.PicklistSchema<[60, 49, 97], undefined>, 60>;
374
- /** Message type (promotional or transactional) */
375
- readonly messageType: v.OptionalSchema<v.PicklistSchema<[1, 2], undefined>, 1>;
376
- /** Display name for the current user */
377
- readonly username: v.OptionalSchema<v.StringSchema<undefined>, "Guido User">;
378
- }, undefined>;
379
- /** Template content and presets */
380
- readonly template: v.OptionalSchema<v.ObjectSchema<{
381
- /** Initial HTML content */
382
- readonly html: v.OptionalSchema<v.StringSchema<undefined>, "">;
383
- /** Initial CSS content */
384
- readonly css: v.OptionalSchema<v.StringSchema<undefined>, "">;
385
- /** Preselected dynamic content items */
386
- readonly preselectedDynamicContent: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
387
- /** Display text for the dynamic content */
388
- readonly text: v.StringSchema<undefined>;
389
- /** Template variable value (e.g., {{username}}) */
390
- readonly value: v.StringSchema<undefined>;
391
- /** Fallback value if variable is empty */
392
- readonly fallback: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
393
- /** Optional formatting options */
394
- readonly format: v.OptionalSchema<v.ObjectSchema<{
395
- readonly key: v.StringSchema<undefined>;
396
- readonly value: v.StringSchema<undefined>;
397
- }, undefined>, undefined>;
398
- }, undefined>, undefined>, readonly []>;
399
- /** Selected unsubscribe page IDs */
400
- readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
401
- }, undefined>, {}>;
402
- /** Editor settings */
403
- readonly editor: v.OptionalSchema<v.ObjectSchema<{
404
- /** Locale for the editor UI */
405
- readonly locale: v.OptionalSchema<v.StringSchema<undefined>, "en">;
406
- /** Path to translations object */
407
- readonly translationsPath: v.OptionalSchema<v.StringSchema<undefined>, "window.trans.en">;
408
- /** Migration date for template compatibility */
409
- readonly migrationDate: v.OptionalSchema<v.NumberSchema<undefined>, 1759696858>;
410
- /** Email header settings */
411
- readonly emailHeader: v.OptionalSchema<v.ObjectSchema<{
412
- /** Sender display name */
413
- readonly senderName: v.OptionalSchema<v.StringSchema<undefined>, "">;
414
- /** Email subject line */
415
- readonly subject: v.OptionalSchema<v.StringSchema<undefined>, "">;
416
- }, undefined>, {
417
- readonly senderName: "";
418
- readonly subject: "";
419
- }>;
420
- }, undefined>, {}>;
421
- /** UI configuration */
422
- readonly ui: v.OptionalSchema<v.ObjectSchema<{
423
- /** Whether to show the header bar */
424
- readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
425
- /** Custom label for back button (if shown) */
426
- readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
427
- }, undefined>, {}>;
428
- /** Feature toggles */
429
- readonly features: v.OptionalSchema<v.ObjectSchema<{
430
- /** Enable dynamic content insertion */
431
- readonly dynamicContent: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
432
- /** Enable save as template functionality */
433
- readonly saveAsTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
434
- /** Enable version history */
435
- readonly versionHistory: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
436
- /** Enable test message sending */
437
- readonly testMessage: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
438
- /** Enable display conditions */
439
- readonly displayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
440
- /** Enable unsubscribe block */
441
- readonly unsubscribe: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
442
- }, undefined>, {}>;
443
- /** Block configuration */
444
- readonly blocks: v.OptionalSchema<v.ObjectSchema<{
445
- /** Default blocks to exclude from the editor */
446
- readonly excludeDefaults: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["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"], undefined>, undefined>, readonly []>;
447
- /** Custom blocks to include in the editor */
448
- readonly includeCustoms: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["dynamic-content", "checkbox-block", "radio-button-block", "recommendation-block", "unsubscribe-block", "coupon-block", "items-block"], undefined>, undefined>, readonly []>;
449
- }, undefined>, {}>;
450
- /** Compiler configuration */
451
- readonly compiler: v.OptionalSchema<v.ObjectSchema<{
452
- /** Custom compiler rules to apply */
453
- readonly customRules: v.OptionalSchema<v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
454
- readonly type: v.LiteralSchema<"replace", undefined>;
455
- /** String to search for */
456
- readonly search: v.StringSchema<undefined>;
457
- /** Replacement string */
458
- readonly replacement: v.StringSchema<undefined>;
459
- /** Replace all occurrences (default: false) */
460
- readonly replaceAll: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
461
- /** Unique identifier for the rule */
462
- readonly id: v.StringSchema<undefined>;
463
- /** Human-readable description */
464
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
465
- /** Priority for rule ordering (lower = earlier) */
466
- readonly priority: v.NumberSchema<undefined>;
467
- }, undefined>, v.ObjectSchema<{
468
- readonly type: v.LiteralSchema<"regex", undefined>;
469
- /** Regex pattern string */
470
- readonly pattern: v.StringSchema<undefined>;
471
- /** Replacement string (supports $1, $2, etc.) */
472
- readonly replacement: v.StringSchema<undefined>;
473
- /** Regex flags (e.g., 'gi') */
474
- readonly flags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
475
- /** Unique identifier for the rule */
476
- readonly id: v.StringSchema<undefined>;
477
- /** Human-readable description */
478
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
479
- /** Priority for rule ordering (lower = earlier) */
480
- readonly priority: v.NumberSchema<undefined>;
481
- }, undefined>, v.ObjectSchema<{
482
- readonly type: v.LiteralSchema<"remove", undefined>;
483
- /** Strings or patterns to remove */
484
- readonly targets: v.ArraySchema<v.StringSchema<undefined>, undefined>;
485
- /** Unique identifier for the rule */
486
- readonly id: v.StringSchema<undefined>;
487
- /** Human-readable description */
488
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
489
- /** Priority for rule ordering (lower = earlier) */
490
- readonly priority: v.NumberSchema<undefined>;
491
- }, undefined>, v.ObjectSchema<{
492
- readonly type: v.LiteralSchema<"custom", undefined>;
493
- /** Custom processor function */
494
- readonly processor: v.CustomSchema<(html: string) => string, v.ErrorMessage<v.CustomIssue> | undefined>;
495
- /** Unique identifier for the rule */
496
- readonly id: v.StringSchema<undefined>;
497
- /** Human-readable description */
498
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
499
- /** Priority for rule ordering (lower = earlier) */
500
- readonly priority: v.NumberSchema<undefined>;
501
- }, undefined>], undefined>, undefined>, readonly []>;
502
- /** Skip default compiler rules */
503
- readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
504
- }, undefined>, {}>;
505
- }, undefined>;
@@ -1,142 +0,0 @@
1
- /**
2
- * Guido Configuration Types
3
- *
4
- * TypeScript types inferred from Valibot schemas.
5
- * This ensures type definitions are always in sync with validation.
6
- * @module @types/config/types
7
- */
8
- import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema } from './schemas';
9
- import type * as v from 'valibot';
10
- /**
11
- * Complete validated Guido configuration.
12
- *
13
- * This is the type returned by `parseConfig()` after validation and default application.
14
- * All optional fields have their defaults applied.
15
- * @example
16
- * ```typescript
17
- * const config: GuidoConfig = parseConfig({
18
- * identity: { templateId: 'tpl-1', userId: 'usr-1' },
19
- * partner: { name: 'acme-corp' },
20
- * });
21
- *
22
- * // Access validated config
23
- * config.features.dynamicContent; // true (default)
24
- * config.ui.showHeader; // true (default)
25
- * ```
26
- */
27
- export type GuidoConfig = v.InferOutput<typeof GuidoConfigSchema>;
28
- /** Identity configuration (templateId, userId, variationId) */
29
- export type IdentityConfig = v.InferOutput<typeof IdentitySchema>;
30
- /** Partner configuration (name, productType, messageType, username) */
31
- export type PartnerConfig = v.InferOutput<typeof PartnerSchema>;
32
- /** Template configuration (html, css, dynamic content, unsubscribe pages) */
33
- export type TemplateConfig = v.InferOutput<typeof TemplateSchema>;
34
- /** Editor configuration (locale, translations, migration date, email header) */
35
- export type EditorConfig = v.InferOutput<typeof EditorSchema>;
36
- /** UI configuration (showHeader, backButtonLabel) */
37
- export type UIConfig = v.InferOutput<typeof UISchema>;
38
- /** Features configuration (feature toggles) */
39
- export type FeaturesConfig = v.InferOutput<typeof FeaturesSchema>;
40
- /** Blocks configuration (exclude defaults, include customs) */
41
- export type BlocksConfig = v.InferOutput<typeof BlocksSchema>;
42
- /** Compiler configuration (custom rules, ignore defaults) */
43
- export type CompilerConfig = v.InferOutput<typeof CompilerSchema>;
44
- /** Email header configuration (senderName, subject) */
45
- export type EmailHeader = v.InferOutput<typeof EmailHeaderSchema>;
46
- /** Dynamic content item */
47
- export type DynamicContent = v.InferOutput<typeof DynamicContentSchema>;
48
- /**
49
- * Input type for Guido configuration (allows partials).
50
- *
51
- * This is the type you use when passing config to the `<Guido>` component.
52
- * Optional sections can be omitted - defaults will be applied during validation.
53
- * @example
54
- * ```typescript
55
- * // Minimal config (only required fields)
56
- * const minimalConfig: GuidoConfigInput = {
57
- * identity: { templateId: 'tpl-1', userId: 'usr-1' },
58
- * partner: { name: 'acme-corp' },
59
- * };
60
- *
61
- * // Full config with overrides
62
- * const fullConfig: GuidoConfigInput = {
63
- * identity: { templateId: 'tpl-1', userId: 'usr-1', variationId: 'v-a' },
64
- * partner: { name: 'acme-corp', productType: 60, messageType: 1 },
65
- * template: { html: '<p>Hello</p>', css: '' },
66
- * features: { dynamicContent: true, versionHistory: false },
67
- * blocks: { includeCustoms: ['recommendation-block'] },
68
- * };
69
- * ```
70
- */
71
- export type GuidoConfigInput = v.InferInput<typeof GuidoConfigSchema>;
72
- /** Input type for identity configuration */
73
- export type IdentityConfigInput = v.InferInput<typeof IdentitySchema>;
74
- /** Input type for partner configuration */
75
- export type PartnerConfigInput = v.InferInput<typeof PartnerSchema>;
76
- /** Input type for template configuration */
77
- export type TemplateConfigInput = v.InferInput<typeof TemplateSchema>;
78
- /** Input type for editor configuration */
79
- export type EditorConfigInput = v.InferInput<typeof EditorSchema>;
80
- /** Input type for UI configuration */
81
- export type UIConfigInput = v.InferInput<typeof UISchema>;
82
- /** Input type for features configuration */
83
- export type FeaturesConfigInput = v.InferInput<typeof FeaturesSchema>;
84
- /** Input type for blocks configuration */
85
- export type BlocksConfigInput = v.InferInput<typeof BlocksSchema>;
86
- /** Input type for compiler configuration */
87
- export type CompilerConfigInput = v.InferInput<typeof CompilerSchema>;
88
- /** Default Stripo block types */
89
- export type DefaultBlockType = v.InferOutput<typeof DefaultBlockTypeSchema>;
90
- /** Custom Guido block types */
91
- export type CustomBlockType = v.InferOutput<typeof CustomBlockTypeSchema>;
92
- /** All available block types */
93
- export type BlockType = DefaultBlockType | CustomBlockType;
94
- /**
95
- * Union type for all compiler rules.
96
- * @example
97
- * ```typescript
98
- * const rules: CompilerRule[] = [
99
- * // Replace rule - simple string replacement
100
- * {
101
- * id: 'replace-domain',
102
- * type: 'replace',
103
- * search: 'old-domain.com',
104
- * replacement: 'new-domain.com',
105
- * priority: 10,
106
- * },
107
- * // Regex rule - pattern matching
108
- * {
109
- * id: 'remove-comments',
110
- * type: 'regex',
111
- * pattern: '<!--.*?-->',
112
- * replacement: '',
113
- * flags: 'gs',
114
- * priority: 20,
115
- * },
116
- * // Custom rule - processor function
117
- * {
118
- * id: 'add-tracking',
119
- * type: 'custom',
120
- * processor: (html) => html.replace('</body>', '<img src="track.gif"/></body>'),
121
- * priority: 30,
122
- * },
123
- * ];
124
- * ```
125
- */
126
- export type CompilerRule = v.InferOutput<typeof CompilerRuleSchema>;
127
- /** Replace rule - simple string replacement */
128
- export type ReplaceRule = v.InferOutput<typeof ReplaceRuleSchema>;
129
- /** Regex rule - regular expression pattern matching */
130
- export type RegexRule = v.InferOutput<typeof RegexRuleSchema>;
131
- /** Remove rule - remove matching content */
132
- export type RemoveRule = v.InferOutput<typeof RemoveRuleSchema>;
133
- /** Custom rule - custom processor function */
134
- export type CustomRule = v.InferOutput<typeof CustomRuleSchema>;
135
- /** Deep partial type for config sections */
136
- export type DeepPartial<T> = {
137
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
138
- };
139
- /** Config override type for presets */
140
- export type ConfigOverrides = DeepPartial<Omit<GuidoConfig, 'identity' | 'partner'>>;
141
- /** Feature name type */
142
- export type FeatureName = keyof FeaturesConfig;