@useinsider/guido 1.4.4 → 2.0.0-beta.087a24f
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 +231 -0
- package/dist/@types/config/validator.js +56 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +64 -86
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- 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/useActionsApi.js +42 -25
- 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 +55 -56
- package/dist/composables/useTimerClone.js +53 -0
- package/dist/composables/useTranslations.js +3 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +283 -0
- package/dist/enums/defaults.js +4 -67
- package/dist/enums/unsubscribe.js +23 -20
- package/dist/extensions/Blocks/Items/block.js +39 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +296 -123
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
- package/dist/extensions/Blocks/common-control.js +64 -53
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
- package/dist/node_modules/valibot/dist/index.js +476 -103
- package/dist/services/stripoApi.js +13 -14
- 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 +509 -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/useActionsApi.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +186 -2
- package/dist/src/composables/usePartner.d.ts +8 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/enums/defaults.d.ts +5 -6
- package/dist/src/enums/unsubscribe.d.ts +5 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
- package/dist/src/library.d.ts +3 -1
- package/dist/src/stores/config.d.ts +1564 -102
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +141 -9
- package/package.json +3 -3
- 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
- package/dist/package.json.js +0 -7
|
@@ -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;
|
|
@@ -5,4 +5,6 @@ export declare const useActionsApi: () => {
|
|
|
5
5
|
getTemplateData: () => Promise<TemplateData>;
|
|
6
6
|
activateCustomViewStyles: (isActive?: boolean) => void;
|
|
7
7
|
getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
|
|
8
|
+
updateTimerInClonedTemplate: () => Promise<string | null>;
|
|
9
|
+
updateHtmlAndCss: (html: string, css: string) => void;
|
|
8
10
|
};
|
|
@@ -1,4 +1,188 @@
|
|
|
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
|
+
modulesDisabled: boolean;
|
|
56
|
+
};
|
|
57
|
+
blocks: {
|
|
58
|
+
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")[];
|
|
59
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
60
|
+
};
|
|
61
|
+
compiler: {
|
|
62
|
+
customRules: ({
|
|
63
|
+
type: "replace";
|
|
64
|
+
search: string;
|
|
65
|
+
replacement: string;
|
|
66
|
+
replaceAll?: boolean | undefined;
|
|
67
|
+
id: string;
|
|
68
|
+
description?: string | undefined;
|
|
69
|
+
priority: number;
|
|
70
|
+
} | {
|
|
71
|
+
type: "regex";
|
|
72
|
+
pattern: string;
|
|
73
|
+
replacement: string;
|
|
74
|
+
flags?: string | undefined;
|
|
75
|
+
id: string;
|
|
76
|
+
description?: string | undefined;
|
|
77
|
+
priority: number;
|
|
78
|
+
} | {
|
|
79
|
+
type: "remove";
|
|
80
|
+
targets: string[];
|
|
81
|
+
id: string;
|
|
82
|
+
description?: string | undefined;
|
|
83
|
+
priority: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "custom";
|
|
86
|
+
processor: (html: string) => string;
|
|
87
|
+
id: string;
|
|
88
|
+
description?: string | undefined;
|
|
89
|
+
priority: number;
|
|
90
|
+
})[];
|
|
91
|
+
ignoreDefaultRules: boolean;
|
|
92
|
+
};
|
|
93
|
+
} | null>;
|
|
94
|
+
initialized: import("vue").Ref<boolean>;
|
|
95
|
+
identity: import("vue").ComputedRef<{
|
|
96
|
+
templateId: string;
|
|
97
|
+
userId: string;
|
|
98
|
+
variationId?: string | undefined;
|
|
99
|
+
} | null>;
|
|
100
|
+
partner: import("vue").ComputedRef<{
|
|
101
|
+
name: string;
|
|
102
|
+
productType: 60 | 49 | 97;
|
|
103
|
+
messageType: 1 | 2;
|
|
104
|
+
username: string;
|
|
105
|
+
} | null>;
|
|
106
|
+
template: import("vue").ComputedRef<{
|
|
107
|
+
html: string;
|
|
108
|
+
css: string;
|
|
109
|
+
preselectedDynamicContent: {
|
|
110
|
+
text: string;
|
|
111
|
+
value: string;
|
|
112
|
+
fallback?: string | undefined;
|
|
113
|
+
format?: {
|
|
114
|
+
key: string;
|
|
115
|
+
value: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
}[];
|
|
118
|
+
selectedUnsubscribePages: number[];
|
|
119
|
+
} | null>;
|
|
120
|
+
editor: import("vue").ComputedRef<{
|
|
121
|
+
locale: string;
|
|
122
|
+
translationsPath: string;
|
|
123
|
+
migrationDate: number;
|
|
124
|
+
emailHeader: {
|
|
125
|
+
senderName: string;
|
|
126
|
+
subject: string;
|
|
127
|
+
};
|
|
128
|
+
} | null>;
|
|
129
|
+
ui: import("vue").ComputedRef<{
|
|
130
|
+
showHeader: boolean;
|
|
131
|
+
backButtonLabel?: string | undefined;
|
|
132
|
+
} | null>;
|
|
133
|
+
features: import("vue").ComputedRef<{
|
|
134
|
+
dynamicContent: boolean;
|
|
135
|
+
saveAsTemplate: boolean;
|
|
136
|
+
versionHistory: boolean;
|
|
137
|
+
testMessage: boolean;
|
|
138
|
+
displayConditions: boolean;
|
|
139
|
+
unsubscribe: boolean;
|
|
140
|
+
modulesDisabled: boolean;
|
|
141
|
+
} | null>;
|
|
142
|
+
blocks: import("vue").ComputedRef<{
|
|
143
|
+
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")[];
|
|
144
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
145
|
+
} | null>;
|
|
146
|
+
compiler: import("vue").ComputedRef<{
|
|
147
|
+
customRules: ({
|
|
148
|
+
type: "replace";
|
|
149
|
+
search: string;
|
|
150
|
+
replacement: string;
|
|
151
|
+
replaceAll?: boolean | undefined;
|
|
152
|
+
id: string;
|
|
153
|
+
description?: string | undefined;
|
|
154
|
+
priority: number;
|
|
155
|
+
} | {
|
|
156
|
+
type: "regex";
|
|
157
|
+
pattern: string;
|
|
158
|
+
replacement: string;
|
|
159
|
+
flags?: string | undefined;
|
|
160
|
+
id: string;
|
|
161
|
+
description?: string | undefined;
|
|
162
|
+
priority: number;
|
|
163
|
+
} | {
|
|
164
|
+
type: "remove";
|
|
165
|
+
targets: string[];
|
|
166
|
+
id: string;
|
|
167
|
+
description?: string | undefined;
|
|
168
|
+
priority: number;
|
|
169
|
+
} | {
|
|
170
|
+
type: "custom";
|
|
171
|
+
processor: (html: string) => string;
|
|
172
|
+
id: string;
|
|
173
|
+
description?: string | undefined;
|
|
174
|
+
priority: number;
|
|
175
|
+
})[];
|
|
176
|
+
ignoreDefaultRules: boolean;
|
|
177
|
+
} | null>;
|
|
178
|
+
templateId: import("vue").ComputedRef<string>;
|
|
179
|
+
userId: import("vue").ComputedRef<string>;
|
|
180
|
+
variationId: import("vue").ComputedRef<string>;
|
|
181
|
+
partnerName: import("vue").ComputedRef<string>;
|
|
182
|
+
productType: import("vue").ComputedRef<number>;
|
|
183
|
+
messageType: import("vue").ComputedRef<number>;
|
|
184
|
+
username: import("vue").ComputedRef<string>;
|
|
185
|
+
showHeader: import("vue").ComputedRef<boolean>;
|
|
186
|
+
getConfig: () => GuidoConfig | null;
|
|
187
|
+
isFeatureEnabled: (feature: keyof FeaturesConfig) => boolean;
|
|
4
188
|
};
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const useTimerClone: () => {
|
|
2
|
+
hasTimerBlocks: (html: string) => boolean;
|
|
3
|
+
cloneTimersInHtml: (html: string, authToken: string) => Promise<string | null>;
|
|
4
|
+
cloneTimersOnSave: (html: string) => Promise<string>;
|
|
5
|
+
updateTimersOnLoad: (getTokenFn: () => Promise<string>) => Promise<void>;
|
|
6
|
+
};
|
|
@@ -1,12 +1,11 @@
|
|
|
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;
|
|
10
|
+
export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
|
|
11
11
|
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: {
|
|
@@ -9,7 +9,7 @@ export declare class PriceOrientationControl extends CommonControl {
|
|
|
9
9
|
onRender(): void;
|
|
10
10
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
11
11
|
_onPriceOrientationChange(value: string): void;
|
|
12
|
-
private _updateHorizontalLayout;
|
|
13
12
|
private _updateVerticalLayout;
|
|
13
|
+
private _updateHorizontalLayout;
|
|
14
14
|
_getPriceOrientation(): string;
|
|
15
15
|
}
|
|
@@ -31,10 +31,6 @@ export declare class ItemsBlockControl extends CommonControl {
|
|
|
31
31
|
_updatePrice(price: string): void;
|
|
32
32
|
_updateOriginalPrice(originalPrice: string): void;
|
|
33
33
|
_updateQuantity(quantity: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* @todo Optimize template reordering for performance.
|
|
36
|
-
* @description Reorders the template structure based on current orientation and visibility settings.
|
|
37
|
-
*/
|
|
38
34
|
_reOrderTemplate(): void;
|
|
39
35
|
_updateDataTypeAttributes(itemsType: ProductType): void;
|
|
40
36
|
_updateDataNumberAttributes(itemId: string): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ItemsBlockConfig } from './utils/nodeConfigUtils';
|
|
1
2
|
declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
|
|
2
3
|
type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
|
|
3
4
|
type OrientationType = 'vertical' | 'horizontal';
|
|
5
|
+
type PriceOrientationType = 'vertical' | 'horizontal';
|
|
4
6
|
type TemplateParameters = {
|
|
5
7
|
orientation: OrientationType;
|
|
6
8
|
itemsType: ProductType;
|
|
@@ -8,6 +10,23 @@ type TemplateParameters = {
|
|
|
8
10
|
currencySymbol?: string;
|
|
9
11
|
currencyLocation?: string;
|
|
10
12
|
formattedPrice?: boolean;
|
|
13
|
+
migrate?: boolean;
|
|
14
|
+
/** Legacy config format (data-* attributes from esd-config-block) */
|
|
15
|
+
configBlockAttributes?: Record<string, string>;
|
|
16
|
+
/** New config format (Stripo V2 nodeConfig from esd-ext-config) */
|
|
17
|
+
nodeConfig?: Partial<ItemsBlockConfig>;
|
|
18
|
+
/** Extracted styles from a[product-attr="name"] for migration */
|
|
19
|
+
nameStyles?: string;
|
|
20
|
+
/** Extracted styles from a.es-button for migration */
|
|
21
|
+
buttonStyles?: string;
|
|
22
|
+
/** Extracted styles from p[product-attr="price"] for migration */
|
|
23
|
+
priceStyles?: string;
|
|
24
|
+
/** Extracted styles from p[product-attr="originalPrice"] for migration */
|
|
25
|
+
originalPriceStyles?: string;
|
|
26
|
+
/** Extracted styles from p[product-attr="quantity"] for migration */
|
|
27
|
+
quantityStyles?: string;
|
|
28
|
+
/** Price orientation within the card ('vertical' = stacked, 'horizontal' = side-by-side) */
|
|
29
|
+
priceOrientation?: PriceOrientationType;
|
|
11
30
|
};
|
|
12
31
|
/**
|
|
13
32
|
* Generates the default template for the Items Block.
|
|
@@ -20,5 +39,5 @@ type TemplateParameters = {
|
|
|
20
39
|
* @param params.formattedPrice - Whether to use formatted price display
|
|
21
40
|
* @returns HTML template string for the Items Block
|
|
22
41
|
*/
|
|
23
|
-
export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, formattedPrice, }: TemplateParameters): string;
|
|
42
|
+
export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, migrate, formattedPrice, configBlockAttributes, nodeConfig, nameStyles, buttonStyles, priceStyles, originalPriceStyles, quantityStyles, priceOrientation, }: TemplateParameters): string;
|
|
24
43
|
export default migrationTemplate;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { OrientationType, ProductType } from '@@/Types/extensions/items';
|
|
2
|
+
import { ImmutableHtmlNode, ImmutableHtmlElementNode, ControlApi, BlockApi } from '@stripoinc/ui-editor-extensions';
|
|
3
|
+
/**
|
|
4
|
+
* Typed configuration object for Items Block.
|
|
5
|
+
* Replaces the deprecated esd-config-block data-* attributes approach.
|
|
6
|
+
* Configuration is stored directly on the block node using Stripo V2's getNodeConfig/setNodeConfig API.
|
|
7
|
+
*/
|
|
8
|
+
export interface ItemsBlockConfig {
|
|
9
|
+
initialized: boolean;
|
|
10
|
+
blockInstanceId: string;
|
|
11
|
+
source: ProductType;
|
|
12
|
+
type: ProductType;
|
|
13
|
+
itemsSelectValue: string;
|
|
14
|
+
orientation: OrientationType;
|
|
15
|
+
nameTrimming: boolean;
|
|
16
|
+
nameControlEnabled: boolean;
|
|
17
|
+
priceHideDiscount: boolean;
|
|
18
|
+
priceFormatted: boolean;
|
|
19
|
+
priceCurrencySymbol: string;
|
|
20
|
+
priceCurrencyLocation: string;
|
|
21
|
+
priceControlOpened: boolean;
|
|
22
|
+
priceOrientation: 'vertical' | 'horizontal';
|
|
23
|
+
quantityControlEnabled: boolean;
|
|
24
|
+
buttonLink: string;
|
|
25
|
+
imageLink: string;
|
|
26
|
+
buttonLabel: string;
|
|
27
|
+
imageVisible: boolean;
|
|
28
|
+
nameVisible: boolean;
|
|
29
|
+
quantityVisible: boolean;
|
|
30
|
+
priceVisible: boolean;
|
|
31
|
+
originalPriceVisible: boolean;
|
|
32
|
+
buttonVisible: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generates a unique block instance ID.
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateBlockInstanceId(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Returns default ItemsBlockConfig values.
|
|
40
|
+
* These are used when initializing a new block or when migrating from legacy format.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getDefaultItemsBlockConfig(): ItemsBlockConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the Items block container element from the current node.
|
|
45
|
+
* The container is identified by the `.items-block-v2` class (new) or `.esd-cart-items-block` (legacy).
|
|
46
|
+
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
47
|
+
* @returns The container element or null if not found
|
|
48
|
+
*/
|
|
49
|
+
export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the node configuration from the Items block.
|
|
52
|
+
* Uses Stripo V2's getNodeConfig() API.
|
|
53
|
+
* Falls back to migrating from legacy esd-config-block if nodeConfig is empty.
|
|
54
|
+
* @param currentNode - The current node from the control
|
|
55
|
+
* @returns The ItemsBlockConfig object or null if not found
|
|
56
|
+
*/
|
|
57
|
+
export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined): ItemsBlockConfig | null;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the node configuration on the Items block.
|
|
60
|
+
* Uses Stripo V2's setNodeConfig() API.
|
|
61
|
+
* @param currentNode - The current node from the control
|
|
62
|
+
* @param api - The API object (ControlApi or BlockApi)
|
|
63
|
+
* @param config - The configuration to set (partial update supported)
|
|
64
|
+
*/
|
|
65
|
+
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the block instance ID from the node config.
|
|
68
|
+
* @param currentNode - The current node from the control
|
|
69
|
+
* @returns The block instance ID or null if not found
|
|
70
|
+
*/
|
|
71
|
+
export declare function getBlockInstanceIdFromConfig(currentNode: ImmutableHtmlNode | undefined): string | null;
|
|
@@ -56,25 +56,30 @@ export declare abstract class CommonControl extends Control {
|
|
|
56
56
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
57
57
|
onDestroy(): void;
|
|
58
58
|
/**
|
|
59
|
-
* Gets the
|
|
59
|
+
* Gets the Items block container element from the current node.
|
|
60
|
+
* @returns The container element or null if not found
|
|
61
|
+
*/
|
|
62
|
+
protected getItemsBlockContainer(): ImmutableHtmlElementNode | null;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the config block element from the current node (legacy support).
|
|
65
|
+
* @deprecated Use getNodeConfig() from nodeConfigUtils instead for Stripo V2
|
|
60
66
|
* @returns The config block element or null if not found
|
|
61
67
|
*/
|
|
62
68
|
protected getConfigBlock(): ImmutableHtmlElementNode | null;
|
|
63
69
|
/**
|
|
64
|
-
* Gets the current block instance ID from the config block.
|
|
65
|
-
* @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
|
|
70
|
+
* Gets the current block instance ID from the node config (Stripo V2) or legacy config block.
|
|
66
71
|
* @returns The block instance ID or null if not found
|
|
67
72
|
*/
|
|
68
|
-
protected getBlockInstanceId(
|
|
73
|
+
protected getBlockInstanceId(): string | null;
|
|
69
74
|
/**
|
|
70
75
|
* Handles block instance change detection and syncing.
|
|
71
|
-
* This is a helper method for controls that need to sync
|
|
72
|
-
*
|
|
76
|
+
* This is a helper method for controls that need to sync config when switching between block instances.
|
|
77
|
+
* Uses Stripo V2 nodeConfig API for block instance tracking.
|
|
78
|
+
* @param syncFunction - Function to call when block instance changes (to sync from node config)
|
|
73
79
|
* @param updateUI - Function to call to update the UI (called both on change and when same block)
|
|
74
|
-
* @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
|
|
75
80
|
* @returns true if block instance changed, false otherwise
|
|
76
81
|
*/
|
|
77
|
-
protected handleBlockInstanceChange(syncFunction: (node: ImmutableHtmlNode) => void, updateUI: () => void
|
|
82
|
+
protected handleBlockInstanceChange(syncFunction: (node: ImmutableHtmlNode) => void, updateUI: () => void): boolean;
|
|
78
83
|
_GuLabel({ text, name, position }: LabelProps): string;
|
|
79
84
|
_GuToggle(name: string): string;
|
|
80
85
|
_GuSelectItem({ text, value }: {
|