@useinsider/guido 1.3.1-beta.7276301 → 1.3.1-beta.cf510dd
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.
- package/README.md +295 -664
- package/dist/@types/config/defaults.js +44 -0
- package/dist/@types/config/schemas.js +229 -0
- package/dist/@types/config/validator.js +56 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +63 -89
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
- package/dist/composables/useBlocksConfig.js +23 -20
- package/dist/composables/useConfig.js +51 -5
- package/dist/composables/useHtmlCompiler.js +20 -19
- package/dist/composables/useHtmlValidator.js +41 -41
- package/dist/composables/usePartner.js +19 -9
- package/dist/composables/useStripo.js +11 -11
- package/dist/composables/useTranslations.js +3 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
- package/dist/enums/defaults.js +3 -67
- package/dist/enums/unsubscribe.js +23 -20
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -2
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
- package/dist/node_modules/valibot/dist/index.js +476 -103
- package/dist/services/templateLibraryApi.js +18 -18
- package/dist/src/@types/config/defaults.d.ts +68 -0
- package/dist/src/@types/config/index.d.ts +14 -0
- package/dist/src/@types/config/schemas.d.ts +505 -0
- package/dist/src/@types/config/types.d.ts +142 -0
- package/dist/src/@types/config/validator.d.ts +119 -0
- package/dist/src/@types/generic.d.ts +4 -45
- package/dist/src/components/Guido.vue.d.ts +13 -12
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +184 -2
- package/dist/src/composables/usePartner.d.ts +8 -0
- package/dist/src/enums/defaults.d.ts +4 -6
- package/dist/src/enums/unsubscribe.d.ts +5 -1
- package/dist/src/library.d.ts +3 -1
- package/dist/src/stores/config.d.ts +1547 -102
- package/dist/stores/config.js +141 -9
- package/package.json +1 -1
- package/dist/node_modules/lodash-es/_apply.js +0 -16
- package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
- package/dist/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
- package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
- package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- package/dist/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
- package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/lodash-es/_copyArray.js +0 -9
- package/dist/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
- package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
- package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
- package/dist/node_modules/lodash-es/_overRest.js +0 -15
- package/dist/node_modules/lodash-es/_safeGet.js +0 -7
- package/dist/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/lodash-es/_shortOut.js +0 -16
- package/dist/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
- package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
- package/dist/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/lodash-es/merge.js +0 -8
- package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
|
@@ -0,0 +1,142 @@
|
|
|
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;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guido Configuration Validator
|
|
3
|
+
*
|
|
4
|
+
* Utilities for validating and parsing Guido configuration.
|
|
5
|
+
* Provides both throwing and non-throwing validation methods.
|
|
6
|
+
* @module @types/config/validator
|
|
7
|
+
*/
|
|
8
|
+
import type { GuidoConfig, GuidoConfigInput } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Result of config validation
|
|
11
|
+
*/
|
|
12
|
+
export interface ValidationResult {
|
|
13
|
+
/** Whether validation was successful */
|
|
14
|
+
success: boolean;
|
|
15
|
+
/** Validated and transformed config (only if success) */
|
|
16
|
+
data?: GuidoConfig;
|
|
17
|
+
/** Validation error messages (only if failed) */
|
|
18
|
+
errors?: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Formatted validation error with path and message
|
|
22
|
+
*/
|
|
23
|
+
export interface ValidationError {
|
|
24
|
+
/** Dot-notation path to the invalid field */
|
|
25
|
+
path: string;
|
|
26
|
+
/** Error message */
|
|
27
|
+
message: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates configuration input and returns a result object.
|
|
31
|
+
*
|
|
32
|
+
* Use this for non-throwing validation where you want to handle errors yourself.
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const result = validateConfig({
|
|
36
|
+
* identity: { templateId: 'tpl-1', userId: 'usr-1' },
|
|
37
|
+
* partner: { name: 'acme-corp' },
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* if (result.success) {
|
|
41
|
+
* console.log(result.data); // Full GuidoConfig with defaults
|
|
42
|
+
* } else {
|
|
43
|
+
* console.error(result.errors); // ['[identity.templateId] templateId is required']
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
* @param input - Raw configuration input
|
|
47
|
+
* @returns Validation result with success status and data or errors
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateConfig(input: GuidoConfigInput): ValidationResult;
|
|
50
|
+
/**
|
|
51
|
+
* Validates configuration and throws on error.
|
|
52
|
+
*
|
|
53
|
+
* Use this during component initialization where invalid config should halt execution.
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* try {
|
|
57
|
+
* const config = parseConfig({
|
|
58
|
+
* identity: { templateId: 'tpl-1', userId: 'usr-1' },
|
|
59
|
+
* partner: { name: 'acme-corp' },
|
|
60
|
+
* });
|
|
61
|
+
* // config is fully typed GuidoConfig
|
|
62
|
+
* } catch (error) {
|
|
63
|
+
* console.error('Invalid configuration:', error.message);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
* @param input - Raw configuration input
|
|
67
|
+
* @returns Validated GuidoConfig with all defaults applied
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseConfig(input: GuidoConfigInput): GuidoConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Validates configuration with console warnings (non-throwing).
|
|
72
|
+
*
|
|
73
|
+
* Use this when you want to attempt recovery from invalid config.
|
|
74
|
+
* Returns null on failure instead of throwing.
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const config = parseConfigSafe(userInput);
|
|
78
|
+
* if (!config) {
|
|
79
|
+
* // Use fallback configuration
|
|
80
|
+
* return defaultConfig;
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
* @param input - Raw configuration input
|
|
84
|
+
* @returns Validated GuidoConfig or null if validation fails
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseConfigSafe(input: GuidoConfigInput): GuidoConfig | null;
|
|
87
|
+
/**
|
|
88
|
+
* Get structured validation errors for detailed error handling.
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const errors = getValidationErrors(input);
|
|
92
|
+
* errors.forEach(({ path, message }) => {
|
|
93
|
+
* formErrors[path] = message;
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
* @param input - Raw configuration input
|
|
97
|
+
* @returns Array of validation errors with paths, or empty array if valid
|
|
98
|
+
*/
|
|
99
|
+
export declare function getValidationErrors(input: GuidoConfigInput): ValidationError[];
|
|
100
|
+
/**
|
|
101
|
+
* Check if a configuration input is valid without parsing.
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* if (isValidConfig(userInput)) {
|
|
105
|
+
* saveConfig(userInput);
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
* @param input - Raw configuration input
|
|
109
|
+
* @returns True if valid, false otherwise
|
|
110
|
+
*/
|
|
111
|
+
export declare function isValidConfig(input: unknown): input is GuidoConfigInput;
|
|
112
|
+
/**
|
|
113
|
+
* Validate just the identity section
|
|
114
|
+
*/
|
|
115
|
+
export declare function validateIdentity(input: unknown): ValidationResult;
|
|
116
|
+
/**
|
|
117
|
+
* Validate just the partner section
|
|
118
|
+
*/
|
|
119
|
+
export declare function validatePartner(input: unknown): ValidationResult;
|
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Features = {
|
|
6
|
-
dynamicContent?: boolean;
|
|
7
|
-
saveAsTemplate?: boolean;
|
|
8
|
-
versionHistory?: boolean;
|
|
9
|
-
testMessage?: boolean;
|
|
10
|
-
displayConditions?: boolean;
|
|
11
|
-
};
|
|
12
|
-
type Partner = {
|
|
13
|
-
partnerName: string;
|
|
14
|
-
productType: number;
|
|
15
|
-
messageType: number;
|
|
16
|
-
};
|
|
17
|
-
export type GuidoBlockType = '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';
|
|
18
|
-
export type GuidoCustomBlockType = 'dynamic-content' | 'checkbox-block' | 'radio-button-block' | 'recommendation-block' | 'unsubscribe-block' | 'coupon-block' | 'items-block';
|
|
19
|
-
type BlocksConfig = {
|
|
20
|
-
excludeDefaults?: GuidoBlockType[];
|
|
21
|
-
includeCustoms?: GuidoCustomBlockType[];
|
|
22
|
-
};
|
|
23
|
-
export type GuidoConfig = {
|
|
24
|
-
translationsPath: string;
|
|
25
|
-
htmlCompilerRules?: CompilerRule[];
|
|
26
|
-
ignoreDefaultHtmlCompilerRules?: boolean;
|
|
27
|
-
useHeader?: boolean;
|
|
28
|
-
emailHeader: EmailHeader;
|
|
29
|
-
migrationDate: number;
|
|
30
|
-
partner?: Partner;
|
|
31
|
-
extensions?: Extensions;
|
|
32
|
-
features?: Features;
|
|
33
|
-
blocks?: BlocksConfig;
|
|
34
|
-
backButtonLabel?: string;
|
|
35
|
-
};
|
|
36
|
-
export type TemplateConfig = {
|
|
37
|
-
preselectedDynamicContentList?: DynamicContent[];
|
|
38
|
-
selectedUnsubscribePages?: number[];
|
|
39
|
-
variationId?: string;
|
|
40
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Generic types used throughout the application.
|
|
3
|
+
* Note: Configuration types are now in @types/config/
|
|
4
|
+
*/
|
|
41
5
|
export type BaseDynamicContent = {
|
|
42
6
|
value: string;
|
|
43
7
|
fallback?: string;
|
|
@@ -71,10 +35,6 @@ export type MergeTagClickEvent = {
|
|
|
71
35
|
tagValue: string | null;
|
|
72
36
|
tagLabel: string | null;
|
|
73
37
|
};
|
|
74
|
-
export interface EmailHeader {
|
|
75
|
-
senderName: string;
|
|
76
|
-
subject: string;
|
|
77
|
-
}
|
|
78
38
|
export interface TooltipOptions {
|
|
79
39
|
id: string;
|
|
80
40
|
dynamicPosition: boolean;
|
|
@@ -95,4 +55,3 @@ export interface L10n {
|
|
|
95
55
|
timezone?: string;
|
|
96
56
|
time?: number;
|
|
97
57
|
}
|
|
98
|
-
export {};
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import type { DynamicContent,
|
|
1
|
+
import type { DynamicContent, GuidoConfigInput } from '@@/Types/config';
|
|
2
|
+
import type { PositionData } from '@@/Types/generic';
|
|
2
3
|
import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
3
4
|
type __VLS_Props = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
messageType?: number;
|
|
7
|
-
partnerName?: string;
|
|
8
|
-
productType?: number;
|
|
9
|
-
username?: string;
|
|
10
|
-
html?: string;
|
|
11
|
-
css?: string;
|
|
12
|
-
guidoConfig: GuidoConfig;
|
|
13
|
-
templateConfig?: TemplateConfig;
|
|
5
|
+
/** Guido configuration object */
|
|
6
|
+
config: GuidoConfigInput;
|
|
14
7
|
};
|
|
15
8
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
16
9
|
dynamicContent: {
|
|
@@ -20,7 +13,15 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
|
|
|
20
13
|
hasChanges: import("vue").ComputedRef<boolean>;
|
|
21
14
|
saveSilent: () => Promise<SavedTemplateDetails | undefined> | undefined;
|
|
22
15
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
23
|
-
"dynamic-content:open": (detail:
|
|
16
|
+
"dynamic-content:open": (detail: {
|
|
17
|
+
text: string;
|
|
18
|
+
value: string;
|
|
19
|
+
fallback?: string | undefined;
|
|
20
|
+
format?: {
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
} | null, position?: PositionData | undefined) => void;
|
|
24
25
|
back: () => void;
|
|
25
26
|
"save:start": () => void;
|
|
26
27
|
"save:complete": (data: Omit<SavedTemplateDetails, "forceRecreate">) => void;
|
|
@@ -32,8 +32,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
|
|
|
32
32
|
closeOnOutsideClick: boolean;
|
|
33
33
|
footerStatus: boolean;
|
|
34
34
|
}>>>, {
|
|
35
|
-
size: "small" | "medium" | "large";
|
|
36
35
|
description: string;
|
|
36
|
+
size: "small" | "medium" | "large";
|
|
37
37
|
closeOnOutsideClick: boolean;
|
|
38
38
|
footerButtonOptions: FooterButtonGroup;
|
|
39
39
|
closeButtonStatus: boolean;
|
|
@@ -1,4 +1,186 @@
|
|
|
1
|
-
import type { GuidoConfig } from '@@/Types/
|
|
1
|
+
import type { GuidoConfig, FeaturesConfig } from '@@/Types/config';
|
|
2
|
+
/**
|
|
3
|
+
* Composable for accessing Guido configuration
|
|
4
|
+
*
|
|
5
|
+
* Provides access to the validated configuration from the config store.
|
|
6
|
+
* All values are reactive and will update when the config changes.
|
|
7
|
+
*/
|
|
2
8
|
export declare const useConfig: () => {
|
|
3
|
-
config:
|
|
9
|
+
config: import("vue").Ref<{
|
|
10
|
+
identity: {
|
|
11
|
+
templateId: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
variationId?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
partner: {
|
|
16
|
+
name: string;
|
|
17
|
+
productType: 60 | 49 | 97;
|
|
18
|
+
messageType: 1 | 2;
|
|
19
|
+
username: string;
|
|
20
|
+
};
|
|
21
|
+
template: {
|
|
22
|
+
html: string;
|
|
23
|
+
css: string;
|
|
24
|
+
preselectedDynamicContent: {
|
|
25
|
+
text: string;
|
|
26
|
+
value: string;
|
|
27
|
+
fallback?: string | undefined;
|
|
28
|
+
format?: {
|
|
29
|
+
key: string;
|
|
30
|
+
value: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
selectedUnsubscribePages: number[];
|
|
34
|
+
};
|
|
35
|
+
editor: {
|
|
36
|
+
locale: string;
|
|
37
|
+
translationsPath: string;
|
|
38
|
+
migrationDate: number;
|
|
39
|
+
emailHeader: {
|
|
40
|
+
senderName: string;
|
|
41
|
+
subject: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
ui: {
|
|
45
|
+
showHeader: boolean;
|
|
46
|
+
backButtonLabel?: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
features: {
|
|
49
|
+
dynamicContent: boolean;
|
|
50
|
+
saveAsTemplate: boolean;
|
|
51
|
+
versionHistory: boolean;
|
|
52
|
+
testMessage: boolean;
|
|
53
|
+
displayConditions: boolean;
|
|
54
|
+
unsubscribe: boolean;
|
|
55
|
+
};
|
|
56
|
+
blocks: {
|
|
57
|
+
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
58
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
59
|
+
};
|
|
60
|
+
compiler: {
|
|
61
|
+
customRules: ({
|
|
62
|
+
type: "replace";
|
|
63
|
+
search: string;
|
|
64
|
+
replacement: string;
|
|
65
|
+
replaceAll?: boolean | undefined;
|
|
66
|
+
id: string;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
priority: number;
|
|
69
|
+
} | {
|
|
70
|
+
type: "regex";
|
|
71
|
+
pattern: string;
|
|
72
|
+
replacement: string;
|
|
73
|
+
flags?: string | undefined;
|
|
74
|
+
id: string;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
priority: number;
|
|
77
|
+
} | {
|
|
78
|
+
type: "remove";
|
|
79
|
+
targets: string[];
|
|
80
|
+
id: string;
|
|
81
|
+
description?: string | undefined;
|
|
82
|
+
priority: number;
|
|
83
|
+
} | {
|
|
84
|
+
type: "custom";
|
|
85
|
+
processor: (html: string) => string;
|
|
86
|
+
id: string;
|
|
87
|
+
description?: string | undefined;
|
|
88
|
+
priority: number;
|
|
89
|
+
})[];
|
|
90
|
+
ignoreDefaultRules: boolean;
|
|
91
|
+
};
|
|
92
|
+
} | null>;
|
|
93
|
+
initialized: import("vue").Ref<boolean>;
|
|
94
|
+
identity: import("vue").ComputedRef<{
|
|
95
|
+
templateId: string;
|
|
96
|
+
userId: string;
|
|
97
|
+
variationId?: string | undefined;
|
|
98
|
+
} | null>;
|
|
99
|
+
partner: import("vue").ComputedRef<{
|
|
100
|
+
name: string;
|
|
101
|
+
productType: 60 | 49 | 97;
|
|
102
|
+
messageType: 1 | 2;
|
|
103
|
+
username: string;
|
|
104
|
+
} | null>;
|
|
105
|
+
template: import("vue").ComputedRef<{
|
|
106
|
+
html: string;
|
|
107
|
+
css: string;
|
|
108
|
+
preselectedDynamicContent: {
|
|
109
|
+
text: string;
|
|
110
|
+
value: string;
|
|
111
|
+
fallback?: string | undefined;
|
|
112
|
+
format?: {
|
|
113
|
+
key: string;
|
|
114
|
+
value: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}[];
|
|
117
|
+
selectedUnsubscribePages: number[];
|
|
118
|
+
} | null>;
|
|
119
|
+
editor: import("vue").ComputedRef<{
|
|
120
|
+
locale: string;
|
|
121
|
+
translationsPath: string;
|
|
122
|
+
migrationDate: number;
|
|
123
|
+
emailHeader: {
|
|
124
|
+
senderName: string;
|
|
125
|
+
subject: string;
|
|
126
|
+
};
|
|
127
|
+
} | null>;
|
|
128
|
+
ui: import("vue").ComputedRef<{
|
|
129
|
+
showHeader: boolean;
|
|
130
|
+
backButtonLabel?: string | undefined;
|
|
131
|
+
} | null>;
|
|
132
|
+
features: import("vue").ComputedRef<{
|
|
133
|
+
dynamicContent: boolean;
|
|
134
|
+
saveAsTemplate: boolean;
|
|
135
|
+
versionHistory: boolean;
|
|
136
|
+
testMessage: boolean;
|
|
137
|
+
displayConditions: boolean;
|
|
138
|
+
unsubscribe: boolean;
|
|
139
|
+
} | null>;
|
|
140
|
+
blocks: import("vue").ComputedRef<{
|
|
141
|
+
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
142
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
143
|
+
} | null>;
|
|
144
|
+
compiler: import("vue").ComputedRef<{
|
|
145
|
+
customRules: ({
|
|
146
|
+
type: "replace";
|
|
147
|
+
search: string;
|
|
148
|
+
replacement: string;
|
|
149
|
+
replaceAll?: boolean | undefined;
|
|
150
|
+
id: string;
|
|
151
|
+
description?: string | undefined;
|
|
152
|
+
priority: number;
|
|
153
|
+
} | {
|
|
154
|
+
type: "regex";
|
|
155
|
+
pattern: string;
|
|
156
|
+
replacement: string;
|
|
157
|
+
flags?: string | undefined;
|
|
158
|
+
id: string;
|
|
159
|
+
description?: string | undefined;
|
|
160
|
+
priority: number;
|
|
161
|
+
} | {
|
|
162
|
+
type: "remove";
|
|
163
|
+
targets: string[];
|
|
164
|
+
id: string;
|
|
165
|
+
description?: string | undefined;
|
|
166
|
+
priority: number;
|
|
167
|
+
} | {
|
|
168
|
+
type: "custom";
|
|
169
|
+
processor: (html: string) => string;
|
|
170
|
+
id: string;
|
|
171
|
+
description?: string | undefined;
|
|
172
|
+
priority: number;
|
|
173
|
+
})[];
|
|
174
|
+
ignoreDefaultRules: boolean;
|
|
175
|
+
} | null>;
|
|
176
|
+
templateId: import("vue").ComputedRef<string>;
|
|
177
|
+
userId: import("vue").ComputedRef<string>;
|
|
178
|
+
variationId: import("vue").ComputedRef<string>;
|
|
179
|
+
partnerName: import("vue").ComputedRef<string>;
|
|
180
|
+
productType: import("vue").ComputedRef<number>;
|
|
181
|
+
messageType: import("vue").ComputedRef<number>;
|
|
182
|
+
username: import("vue").ComputedRef<string>;
|
|
183
|
+
showHeader: import("vue").ComputedRef<boolean>;
|
|
184
|
+
getConfig: () => GuidoConfig | null;
|
|
185
|
+
isFeatureEnabled: (feature: keyof FeaturesConfig) => boolean;
|
|
4
186
|
};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable for accessing partner information
|
|
3
|
+
*
|
|
4
|
+
* Provides access to partner data from the config store,
|
|
5
|
+
* with fallbacks to URL-based detection for backward compatibility.
|
|
6
|
+
*/
|
|
1
7
|
export declare const usePartner: () => {
|
|
2
8
|
getPartnerName: () => string;
|
|
3
9
|
getProductType: () => number;
|
|
10
|
+
getMessageType: () => number;
|
|
11
|
+
getUsername: () => string;
|
|
4
12
|
isTestPartner: () => boolean;
|
|
5
13
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Default values and constants.
|
|
3
|
+
* Note: Configuration defaults are now in @types/config/defaults.ts
|
|
4
|
+
*/
|
|
3
5
|
export declare const TemplateTypes: {
|
|
4
6
|
promotional: number;
|
|
5
7
|
transactional: number;
|
|
6
8
|
};
|
|
7
|
-
export declare const DefaultProductType = "email";
|
|
8
|
-
export declare const DefaultUsername = "Guido User";
|
|
9
|
-
export declare const DefaultMessageType: number;
|
|
10
9
|
export declare const EditorType: number;
|
|
11
10
|
export declare const ProductIds: Record<string, number>;
|
|
12
|
-
export declare const TEST_PARTNER_LIST: string[];
|
|
@@ -29,7 +29,11 @@ export declare const PAGE_TYPES: {
|
|
|
29
29
|
export declare const TYPE_COLLECTIONS: {
|
|
30
30
|
[x: number]: number[];
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Get type translations lazily to avoid Pinia initialization issues.
|
|
34
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
35
|
+
*/
|
|
36
|
+
export declare const getTypeTranslations: () => {
|
|
33
37
|
[x: number]: string;
|
|
34
38
|
};
|
|
35
39
|
export declare const MERGE_TAGS: {
|
package/dist/src/library.d.ts
CHANGED
|
@@ -1,3 +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';
|
|
3
|
+
export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidationErrors, MessageType, ProductType, } from './@types/config';
|
|
2
4
|
export type { StripoEventType } from './@types/events';
|
|
3
|
-
export type
|
|
5
|
+
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|