@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,13 +1,13 @@
1
- import { useConfig as T } from "../composables/useConfig.js";
2
- import { useHttp as f } from "../composables/useHttp.js";
3
- import { useToaster as w } from "../composables/useToaster.js";
4
- import { useTranslations as b } from "../composables/useTranslations.js";
5
- import { EditorType as h } from "../enums/defaults.js";
6
- import { useSaveAsTemplateStore as C } from "../stores/save-as-template.js";
1
+ import { useConfig as u } from "../composables/useConfig.js";
2
+ import { useHttp as d } from "../composables/useHttp.js";
3
+ import { useToaster as T } from "../composables/useToaster.js";
4
+ import { useTranslations as f } from "../composables/useTranslations.js";
5
+ import { EditorType as w } from "../enums/defaults.js";
6
+ import { useSaveAsTemplateStore as b } from "../stores/save-as-template.js";
7
7
  import { base64EncodeWithSpecialChars as a } from "../utils/base64.js";
8
- import { useTemplatePreparation as v } from "../utils/templatePreparation.js";
9
- const L = () => {
10
- const { get: m, post: n } = f(), { handleError: o, showToaster: i } = w(), { config: l } = T(), p = b();
8
+ import { useTemplatePreparation as h } from "../utils/templatePreparation.js";
9
+ const I = () => {
10
+ const { get: m, post: n } = d(), { handleError: o, showToaster: i } = T(), { config: l } = u(), p = f();
11
11
  return {
12
12
  getCategories: async () => {
13
13
  try {
@@ -35,14 +35,14 @@ const L = () => {
35
35
  }
36
36
  },
37
37
  createTemplate: async () => {
38
- var e, t, g, y;
38
+ var e, t;
39
39
  try {
40
- const { prepareTemplateDetails: c } = v(), r = C(), s = await c(), u = {
40
+ const { prepareTemplateDetails: c } = h(), r = b(), s = await c(), g = {
41
41
  name: r.getTemplateName,
42
42
  categories: r.getSelectedCategoryIds,
43
- productId: ((t = (e = l.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
44
- editorType: h,
45
- messageType: ((y = (g = l.value) == null ? void 0 : g.partner) == null ? void 0 : y.messageType) || 0,
43
+ productId: ((e = l.partner) == null ? void 0 : e.productType) || 0,
44
+ editorType: w,
45
+ messageType: ((t = l.partner) == null ? void 0 : t.messageType) || 0,
46
46
  content: a(s.compiledHtml),
47
47
  css: a(s.css),
48
48
  unsubscriptionPreferencePageStatus: !1,
@@ -55,11 +55,11 @@ const L = () => {
55
55
  html: s.rawHtml,
56
56
  css: s.css
57
57
  })
58
- }, { data: { type: d } } = await n(
58
+ }, { data: { type: y } } = await n(
59
59
  "/newsletter/template-library/create-template",
60
- u
60
+ g
61
61
  );
62
- if (d === "alert") {
62
+ if (y === "alert") {
63
63
  i({
64
64
  message: p(
65
65
  "newsletter.template-library-save-alert",
@@ -83,5 +83,5 @@ const L = () => {
83
83
  };
84
84
  };
85
85
  export {
86
- L as useTemplateLibraryApi
86
+ I as useTemplateLibraryApi
87
87
  };
@@ -1,7 +1,43 @@
1
- /**
2
- * Generic types used throughout the application.
3
- * Note: Configuration types are now in @types/config/
4
- */
1
+ import type { CompilerRule } from './html-compiler';
2
+ type Extensions = {
3
+ unsubscribe?: boolean;
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
+ };
5
41
  export type BaseDynamicContent = {
6
42
  value: string;
7
43
  fallback?: string;
@@ -35,6 +71,10 @@ export type MergeTagClickEvent = {
35
71
  tagValue: string | null;
36
72
  tagLabel: string | null;
37
73
  };
74
+ export interface EmailHeader {
75
+ senderName: string;
76
+ subject: string;
77
+ }
38
78
  export interface TooltipOptions {
39
79
  id: string;
40
80
  dynamicPosition: boolean;
@@ -55,3 +95,4 @@ export interface L10n {
55
95
  timezone?: string;
56
96
  time?: number;
57
97
  }
98
+ export {};
@@ -1,9 +1,16 @@
1
- import type { DynamicContent, GuidoConfigInput } from '@@/Types/config';
2
- import type { PositionData } from '@@/Types/generic';
1
+ import type { DynamicContent, GuidoConfig, PositionData, TemplateConfig } from '@@/Types/generic';
3
2
  import type { SavedTemplateDetails } from '@@/Types/stripo';
4
3
  type __VLS_Props = {
5
- /** Guido configuration object */
6
- config: GuidoConfigInput;
4
+ templateId: string;
5
+ userId: string;
6
+ messageType?: number;
7
+ partnerName?: string;
8
+ productType?: number;
9
+ username?: string;
10
+ html?: string;
11
+ css?: string;
12
+ guidoConfig: GuidoConfig;
13
+ templateConfig?: TemplateConfig;
7
14
  };
8
15
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
9
16
  dynamicContent: {
@@ -13,15 +20,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
13
20
  hasChanges: import("vue").ComputedRef<boolean>;
14
21
  saveSilent: () => Promise<SavedTemplateDetails | undefined> | undefined;
15
22
  }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
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;
23
+ "dynamic-content:open": (detail: DynamicContent | null, position?: PositionData | undefined) => void;
25
24
  back: () => void;
26
25
  "save:start": () => void;
27
26
  "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
- description: string;
36
35
  size: "small" | "medium" | "large";
36
+ description: string;
37
37
  closeOnOutsideClick: boolean;
38
38
  footerButtonOptions: FooterButtonGroup;
39
39
  closeButtonStatus: boolean;
@@ -1,186 +1,4 @@
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
- */
1
+ import type { GuidoConfig } from '@@/Types/generic';
8
2
  export declare const useConfig: () => {
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;
3
+ config: GuidoConfig;
186
4
  };
@@ -1,13 +1,5 @@
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
- */
7
1
  export declare const usePartner: () => {
8
2
  getPartnerName: () => string;
9
3
  getProductType: () => number;
10
- getMessageType: () => number;
11
- getUsername: () => string;
12
4
  isTestPartner: () => boolean;
13
5
  };
@@ -1,10 +1,12 @@
1
- /**
2
- * Default values and constants.
3
- * Note: Configuration defaults are now in @types/config/defaults.ts
4
- */
1
+ import type { GuidoConfig } from '@@/Types/generic';
2
+ export declare const DefaultGuidoConfig: GuidoConfig;
5
3
  export declare const TemplateTypes: {
6
4
  promotional: number;
7
5
  transactional: number;
8
6
  };
7
+ export declare const DefaultProductType = "email";
8
+ export declare const DefaultUsername = "Guido User";
9
+ export declare const DefaultMessageType: number;
9
10
  export declare const EditorType: number;
10
11
  export declare const ProductIds: Record<string, number>;
12
+ export declare const TEST_PARTNER_LIST: string[];
@@ -29,11 +29,7 @@ export declare const PAGE_TYPES: {
29
29
  export declare const TYPE_COLLECTIONS: {
30
30
  [x: number]: number[];
31
31
  };
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: () => {
32
+ export declare const TYPE_TRANSLATIONS: {
37
33
  [x: number]: string;
38
34
  };
39
35
  export declare const MERGE_TAGS: {
@@ -1,5 +1,3 @@
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';
4
2
  export type { StripoEventType } from './@types/events';
5
- export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
3
+ export type * from './@types/generic';