@useinsider/guido 1.4.4 → 2.0.0

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 (85) hide show
  1. package/README.md +295 -664
  2. package/dist/@types/config/defaults.js +44 -0
  3. package/dist/@types/config/schemas.js +229 -0
  4. package/dist/@types/config/validator.js +56 -0
  5. package/dist/components/Guido.vue.js +1 -1
  6. package/dist/components/Guido.vue2.js +64 -86
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
  8. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
  9. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
  10. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
  12. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  13. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
  14. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
  15. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
  16. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  17. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
  18. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
  19. package/dist/composables/useActionsApi.js +42 -25
  20. package/dist/composables/useBlocksConfig.js +23 -20
  21. package/dist/composables/useConfig.js +51 -5
  22. package/dist/composables/useHtmlCompiler.js +20 -19
  23. package/dist/composables/useHtmlValidator.js +41 -41
  24. package/dist/composables/usePartner.js +19 -9
  25. package/dist/composables/useStripo.js +32 -32
  26. package/dist/composables/useTimerClone.js +53 -0
  27. package/dist/composables/useTranslations.js +3 -2
  28. package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
  29. package/dist/enums/defaults.js +4 -67
  30. package/dist/enums/unsubscribe.js +23 -20
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
  32. package/dist/guido.css +1 -1
  33. package/dist/library.js +12 -2
  34. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
  35. package/dist/node_modules/valibot/dist/index.js +476 -103
  36. package/dist/services/stripoApi.js +13 -14
  37. package/dist/services/templateLibraryApi.js +18 -18
  38. package/dist/src/@types/config/defaults.d.ts +68 -0
  39. package/dist/src/@types/config/index.d.ts +14 -0
  40. package/dist/src/@types/config/schemas.d.ts +505 -0
  41. package/dist/src/@types/config/types.d.ts +142 -0
  42. package/dist/src/@types/config/validator.d.ts +119 -0
  43. package/dist/src/@types/generic.d.ts +4 -45
  44. package/dist/src/components/Guido.vue.d.ts +13 -12
  45. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  46. package/dist/src/composables/useActionsApi.d.ts +2 -0
  47. package/dist/src/composables/useConfig.d.ts +184 -2
  48. package/dist/src/composables/usePartner.d.ts +8 -0
  49. package/dist/src/composables/useTimerClone.d.ts +6 -0
  50. package/dist/src/enums/defaults.d.ts +5 -6
  51. package/dist/src/enums/unsubscribe.d.ts +5 -1
  52. package/dist/src/library.d.ts +3 -1
  53. package/dist/src/stores/config.d.ts +1547 -102
  54. package/dist/stores/config.js +141 -9
  55. package/package.json +1 -1
  56. package/dist/node_modules/lodash-es/_apply.js +0 -16
  57. package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
  58. package/dist/node_modules/lodash-es/_assignValue.js +0 -10
  59. package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
  60. package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
  61. package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
  62. package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
  63. package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
  64. package/dist/node_modules/lodash-es/_baseRest.js +0 -9
  65. package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
  66. package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  67. package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
  68. package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  69. package/dist/node_modules/lodash-es/_copyArray.js +0 -9
  70. package/dist/node_modules/lodash-es/_copyObject.js +0 -14
  71. package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
  72. package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
  73. package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
  74. package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
  75. package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
  76. package/dist/node_modules/lodash-es/_overRest.js +0 -15
  77. package/dist/node_modules/lodash-es/_safeGet.js +0 -7
  78. package/dist/node_modules/lodash-es/_setToString.js +0 -6
  79. package/dist/node_modules/lodash-es/_shortOut.js +0 -16
  80. package/dist/node_modules/lodash-es/constant.js +0 -8
  81. package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
  82. package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
  83. package/dist/node_modules/lodash-es/keysIn.js +0 -9
  84. package/dist/node_modules/lodash-es/merge.js +0 -8
  85. package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
@@ -1,7 +1,8 @@
1
- import { useHttp as a } from "../composables/useHttp.js";
2
- import { useToaster as s } from "../composables/useToaster.js";
3
- const m = () => {
4
- const { get: r } = a(), { handleError: o } = s();
1
+ import { useHttp as m } from "../composables/useHttp.js";
2
+ import { useToaster as u } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as i } from "../enums/defaults.js";
4
+ const y = () => {
5
+ const { get: r } = m(), { handleError: o } = u();
5
6
  return {
6
7
  getToken: async () => {
7
8
  try {
@@ -29,15 +30,13 @@ const m = () => {
29
30
  forceRecreate: !0
30
31
  };
31
32
  try {
32
- const { data: e } = await r("/stripo/default-template/0");
33
- try {
34
- return {
35
- ...JSON.parse(e),
36
- forceRecreate: !0
37
- };
38
- } catch {
39
- return t;
40
- }
33
+ const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= i ? s : 0, { data: n } = await r(
34
+ `/stripo/default-template/${l}`
35
+ ), a = typeof n == "string" ? JSON.parse(n) : n;
36
+ return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : {
37
+ ...a,
38
+ forceRecreate: !0
39
+ };
41
40
  } catch (e) {
42
41
  return o(e, "Failed to fetch default template"), t;
43
42
  }
@@ -45,5 +44,5 @@ const m = () => {
45
44
  };
46
45
  };
47
46
  export {
48
- m as useStripoApi
47
+ y as useStripoApi
49
48
  };
@@ -1,13 +1,13 @@
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";
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";
7
7
  import { base64EncodeWithSpecialChars as a } from "../utils/base64.js";
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();
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();
11
11
  return {
12
12
  getCategories: async () => {
13
13
  try {
@@ -35,14 +35,14 @@ const I = () => {
35
35
  }
36
36
  },
37
37
  createTemplate: async () => {
38
- var e, t;
38
+ var e, t, g, y;
39
39
  try {
40
- const { prepareTemplateDetails: c } = h(), r = b(), s = await c(), g = {
40
+ const { prepareTemplateDetails: c } = v(), r = C(), s = await c(), u = {
41
41
  name: r.getTemplateName,
42
42
  categories: r.getSelectedCategoryIds,
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,
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,
46
46
  content: a(s.compiledHtml),
47
47
  css: a(s.css),
48
48
  unsubscriptionPreferencePageStatus: !1,
@@ -55,11 +55,11 @@ const I = () => {
55
55
  html: s.rawHtml,
56
56
  css: s.css
57
57
  })
58
- }, { data: { type: y } } = await n(
58
+ }, { data: { type: d } } = await n(
59
59
  "/newsletter/template-library/create-template",
60
- g
60
+ u
61
61
  );
62
- if (y === "alert") {
62
+ if (d === "alert") {
63
63
  i({
64
64
  message: p(
65
65
  "newsletter.template-library-save-alert",
@@ -83,5 +83,5 @@ const I = () => {
83
83
  };
84
84
  };
85
85
  export {
86
- I as useTemplateLibraryApi
86
+ L as useTemplateLibraryApi
87
87
  };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Guido Configuration Defaults
3
+ *
4
+ * Default values for optional configuration sections.
5
+ * These are applied during validation when values are not provided.
6
+ * @module @types/config/defaults
7
+ */
8
+ import type { TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, EmailHeader } from './types';
9
+ /**
10
+ * Default email header values
11
+ */
12
+ export declare const DEFAULT_EMAIL_HEADER: EmailHeader;
13
+ /**
14
+ * Default template configuration
15
+ */
16
+ export declare const DEFAULT_TEMPLATE: TemplateConfig;
17
+ /**
18
+ * Default editor configuration
19
+ */
20
+ export declare const DEFAULT_EDITOR: EditorConfig;
21
+ /**
22
+ * Default UI configuration
23
+ */
24
+ export declare const DEFAULT_UI: UIConfig;
25
+ /**
26
+ * Default features configuration (all enabled)
27
+ */
28
+ export declare const DEFAULT_FEATURES: FeaturesConfig;
29
+ /**
30
+ * Default blocks configuration
31
+ */
32
+ export declare const DEFAULT_BLOCKS: BlocksConfig;
33
+ /**
34
+ * Default compiler configuration
35
+ */
36
+ export declare const DEFAULT_COMPILER: CompilerConfig;
37
+ /**
38
+ * Default product type (Email)
39
+ */
40
+ export declare const DEFAULT_PRODUCT_TYPE: 60;
41
+ /**
42
+ * Default message type (Promotional)
43
+ */
44
+ export declare const DEFAULT_MESSAGE_TYPE: 1;
45
+ /**
46
+ * Default username
47
+ */
48
+ export declare const DEFAULT_USERNAME = "Guido User";
49
+ /**
50
+ * Re-export message type constants
51
+ */
52
+ export { MessageType } from './schemas';
53
+ /**
54
+ * Re-export product type constants
55
+ */
56
+ export { ProductType } from './schemas';
57
+ /**
58
+ * Stripo editor type identifier
59
+ */
60
+ export declare const EDITOR_TYPE = 2;
61
+ /**
62
+ * Test partner names for development/QA
63
+ */
64
+ export declare const TEST_PARTNERS: readonly ["alfredtesting", "electio", "eurekatest", "gachapontestpart", "gluautomation1", "gluautomation2", "gluautomation3", "gluautomation4", "inone", "inshoppingcart", "krakentest", "leeroy", "newsletteruat", "ozaspava", "piratesquad", "qaautomation1", "qaautomation2", "qaautomation3", "qaautomation4", "roiautomation", "seleniumautomation", "seleniumautomation1", "seleniumautomation2", "seleniumautomation3", "shopbagg", "shopifytest", "singlepageqa", "testqa", "vikingsankara", "stripoeditorlivetest"];
65
+ /**
66
+ * Check if a partner is a test partner
67
+ */
68
+ export declare function isTestPartner(partnerName: string): boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Guido Configuration Module
3
+ *
4
+ * This module provides a complete configuration system for Guido with:
5
+ * - Valibot schemas for runtime validation
6
+ * - TypeScript types inferred from schemas
7
+ * - Default values for optional configuration
8
+ * - Validation utilities
9
+ */
10
+ export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
11
+ export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
12
+ export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
13
+ export { validateConfig, parseConfig, parseConfigSafe, getValidationErrors, isValidConfig, validateIdentity, validatePartner, } from './validator';
14
+ export type { ValidationResult, ValidationError, } from './validator';