@useinsider/guido 3.24.0-beta.0abeefe → 3.24.0-beta.172ae7a

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 (97) hide show
  1. package/README.md +15 -2
  2. package/dist/@types/config/schemas.js +37 -37
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +80 -82
  5. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
  6. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
  7. package/dist/composables/useActionsApi.js +2 -2
  8. package/dist/composables/useBlocksConfig.js +20 -31
  9. package/dist/composables/useEditorTrackingIds.js +49 -0
  10. package/dist/composables/useHtmlCompiler.js +2 -0
  11. package/dist/composables/useModuleRepair.js +32 -23
  12. package/dist/composables/useStripo.js +70 -70
  13. package/dist/composables/useTranslations.js +1 -2
  14. package/dist/config/compiler/htmlCompilerRules.js +14 -6
  15. package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
  16. package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
  17. package/dist/config/migrator/index.js +10 -9
  18. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
  19. package/dist/enums/academy.js +2 -2
  20. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -8
  21. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +28 -24
  22. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +23 -22
  23. package/dist/guido.css +1 -1
  24. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  25. package/dist/node_modules/valibot/dist/index.js +261 -297
  26. package/dist/package.json.js +6 -6
  27. package/dist/services/templateLibraryApi.js +39 -36
  28. package/dist/src/@types/config/schemas.d.ts +4 -4
  29. package/dist/src/composables/useConfig.d.ts +2 -2
  30. package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
  31. package/dist/src/composables/useModuleRepair.d.ts +2 -11
  32. package/dist/src/composables/useStripo.d.ts +1 -1
  33. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
  34. package/dist/src/enums/academy.d.ts +1 -1
  35. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  36. package/dist/src/stores/config.d.ts +20 -167
  37. package/dist/src/stores/editor.d.ts +27 -0
  38. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
  39. package/dist/src/utils/linkTrackingIds.d.ts +24 -22
  40. package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
  41. package/dist/stores/config.js +6 -13
  42. package/dist/stores/editor.js +1 -0
  43. package/dist/utils/legacyUnsubscribeConversion.js +49 -0
  44. package/dist/utils/linkTrackingIds.js +72 -72
  45. package/dist/utils/pairProductVariables.js +29 -30
  46. package/dist/utils/templatePreparation.js +59 -72
  47. package/dist/utils/trimHrefWhitespace.js +10 -0
  48. package/package.json +1 -1
  49. package/dist/@types/display-condition.js +0 -25
  50. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -17
  51. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
  52. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  53. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
  54. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +0 -17
  55. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +0 -45
  56. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -36
  57. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
  58. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  59. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  60. package/dist/composables/useDisplayConditions.js +0 -117
  61. package/dist/enums/display-condition.js +0 -12
  62. package/dist/extensions/DisplayConditions/bridge.js +0 -25
  63. package/dist/extensions/DisplayConditions/constants.js +0 -26
  64. package/dist/extensions/DisplayConditions/control.js +0 -215
  65. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -226
  66. package/dist/extensions/DisplayConditions/extension.js +0 -28
  67. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  68. package/dist/extensions/DisplayConditions/library.js +0 -30
  69. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  70. package/dist/extensions/LinkTracking/extension.js +0 -17
  71. package/dist/extensions/LinkTracking/writer.js +0 -41
  72. package/dist/services/displayConditionApi.js +0 -39
  73. package/dist/src/@types/display-condition.d.ts +0 -60
  74. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  75. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +0 -18
  76. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  77. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  78. package/dist/src/composables/useDisplayConditions.d.ts +0 -18
  79. package/dist/src/enums/display-condition.d.ts +0 -15
  80. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
  81. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -23
  82. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
  83. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  84. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  85. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  86. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  87. package/dist/src/extensions/LinkTracking/extension.d.ts +0 -2
  88. package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
  89. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  90. package/dist/src/services/displayConditionApi.d.ts +0 -8
  91. package/dist/src/stores/display-condition.d.ts +0 -84
  92. package/dist/src/utils/displayCondition.d.ts +0 -11
  93. package/dist/src/utils/protectTableText.d.ts +0 -2
  94. package/dist/stores/display-condition.js +0 -29
  95. package/dist/utils/displayCondition.js +0 -26
  96. package/dist/utils/protectTableText.js +0 -22
  97. /package/dist/src/components/organisms/{display-conditions/DisplayConditionCreateDrawer.vue.d.ts → unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
- const e = "3.24.0-beta.0abeefe", o = { stripo: { version: "2.83.1" } }, s = {
2
- version: e,
3
- guido: o
1
+ const o = "3.24.0-beta.172ae7a", s = { stripo: { version: "2.83.1" } }, a = {
2
+ version: o,
3
+ guido: s
4
4
  };
5
5
  export {
6
- s as default,
7
- o as guido,
8
- e as version
6
+ a as default,
7
+ s as guido,
8
+ o as version
9
9
  };
@@ -1,60 +1,63 @@
1
- import { useActionsApi as h } from "../composables/useActionsApi.js";
1
+ import { useActionsApi as A } from "../composables/useActionsApi.js";
2
2
  import { useConfig as S } from "../composables/useConfig.js";
3
- import { useHttp as v } from "../composables/useHttp.js";
3
+ import { useHttp as E } from "../composables/useHttp.js";
4
4
  import { useToaster as x } from "../composables/useToaster.js";
5
- import { useTranslations as A } from "../composables/useTranslations.js";
6
- import { useHtmlDocumentCountValidator as E } from "../composables/validators/useHtmlDocumentCountValidator.js";
5
+ import { useTranslations as P } from "../composables/useTranslations.js";
6
+ import { useHtmlDocumentCountValidator as L } from "../composables/validators/useHtmlDocumentCountValidator.js";
7
7
  import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
8
8
  import { EditorType as H } from "../enums/defaults.js";
9
- import { ToasterTypeOptions as P } from "../enums/toaster.js";
9
+ import { ToasterTypeOptions as T } from "../enums/toaster.js";
10
10
  import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
- import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
11
+ import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
12
12
  import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
13
- import { isPlainObject as q } from "../utils/genericUtil.js";
13
+ import { isPlainObject as w } from "../utils/genericUtil.js";
14
14
  import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
15
15
  const Z = () => {
16
- const { get: n, post: m } = v(), { handleError: s, showToaster: l } = x(), { config: c, isFeatureEnabled: p } = S(), { validateLiquidSyntax: T } = N(), { validateSingleHtmlDocument: w } = E(), { getTemplateData: b } = h(), u = A();
16
+ const { get: l, post: c } = E(), { handleError: o, showToaster: i } = x(), { config: p, isFeatureEnabled: u } = S(), { validateLiquidSyntax: b } = N(), { validateSingleHtmlDocument: C } = L(), { getTemplateData: h } = A(), n = P();
17
17
  return {
18
18
  getCategories: async () => {
19
19
  try {
20
- const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
21
- return e;
20
+ const { data: e } = await l("/newsletter/template-library/get-template-categories");
21
+ return Array.isArray(e) ? e : ((!w(e) || e.type !== "alert") && console.error("[TEMPLATE_LIBRARY_API] Unexpected get-template-categories response", e), i({
22
+ message: n("newsletter.template-library-service-error"),
23
+ type: T.Error
24
+ }), []);
22
25
  } catch (e) {
23
- return s(e, "Failed to fetch template categories"), [];
26
+ return o(e, "Failed to fetch template categories"), [];
24
27
  }
25
28
  },
26
29
  checkTemplateNameAvailability: async (e) => {
27
- const { data: { status: t = !1 } } = await n(
30
+ const { data: { status: t = !1 } } = await l(
28
31
  `/newsletter/template-library/template-name-exists?name=${e}`
29
32
  );
30
33
  return !t;
31
34
  },
32
35
  createCategory: async (e) => {
33
36
  try {
34
- const { data: { id: t } } = await m(
37
+ const { data: { id: t } } = await c(
35
38
  "/newsletter/template-library/create-category",
36
39
  { name: e }
37
40
  );
38
41
  return t.toString();
39
42
  } catch (t) {
40
- return s(t, "Failed to create category"), "";
43
+ return o(t, "Failed to create category"), "";
41
44
  }
42
45
  },
43
46
  createTemplate: async () => {
44
47
  var e, t, d, y;
45
48
  try {
46
- const { prepareTemplateDetails: i } = F(), o = L(), g = await b();
47
- if (!w(g.html))
49
+ const { prepareTemplateDetails: m } = F(), s = q(), g = await h();
50
+ if (!C(g.html))
48
51
  return !1;
49
- const a = await i(g);
50
- if (p("liquidSyntax") && !await T(a.compiledHtml))
52
+ const a = await m(g);
53
+ if (u("liquidSyntax") && !await b(a.compiledHtml))
51
54
  return !1;
52
- const C = {
53
- name: o.getTemplateName,
54
- categories: o.getSelectedCategoryIds,
55
- productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
55
+ const v = {
56
+ name: s.getTemplateName,
57
+ categories: s.getSelectedCategoryIds,
58
+ productId: ((t = (e = p.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
56
59
  editorType: H,
57
- messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
60
+ messageType: ((y = (d = p.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
58
61
  content: r(a.compiledHtml),
59
62
  css: r(a.css),
60
63
  unsubscriptionPreferencePageStatus: !1,
@@ -65,34 +68,34 @@ const Z = () => {
65
68
  recommendationConfigs: r({}),
66
69
  isGuido: !0,
67
70
  // eslint-disable-next-line camelcase
68
- template_engine: p("liquidSyntax") ? 1 : 0,
71
+ template_engine: u("liquidSyntax") ? 1 : 0,
69
72
  stripoConfig: r({
70
73
  editor: "stripo",
71
74
  html: a.rawHtml,
72
75
  css: a.css,
73
76
  dynamicContentList: a.dynamicContentList
74
77
  })
75
- }, { data: f } = await m(
78
+ }, { data: f } = await c(
76
79
  "/newsletter/template-library/create-template",
77
- C
80
+ v
78
81
  );
79
- if (!q(f))
82
+ if (!w(f))
80
83
  throw new Error("Unexpected create-template response");
81
- return f.type === "alert" ? (l({
82
- message: u(
84
+ return f.type === "alert" ? (i({
85
+ message: n(
83
86
  "newsletter.template-library-save-alert",
84
- { templateName: o.getTemplateName }
87
+ { templateName: s.getTemplateName }
85
88
  ),
86
- type: P.Error
87
- }), !1) : (l({
88
- message: u(
89
+ type: T.Error
90
+ }), !1) : (i({
91
+ message: n(
89
92
  "newsletter.template-library-save-success",
90
- { templateName: o.getTemplateName }
93
+ { templateName: s.getTemplateName }
91
94
  ),
92
95
  type: "success"
93
96
  }), !0);
94
- } catch (i) {
95
- return s(i, "Failed to create template"), !1;
97
+ } catch (m) {
98
+ return o(m, "Failed to create template"), !1;
96
99
  }
97
100
  }
98
101
  };
@@ -384,8 +384,6 @@ export declare const UISchema: v.ObjectSchema<{
384
384
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
385
385
  /** Custom label for back button (if shown) */
386
386
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
387
- /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
388
- readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
389
387
  }, undefined>;
390
388
  /**
391
389
  * Features configuration - enable/disable editor features
@@ -417,6 +415,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
417
415
  /** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
418
416
  readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
419
417
  readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
418
+ /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
419
+ readonly legacyUnsubscribeConversion: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
420
420
  }, undefined>;
421
421
  /**
422
422
  * Default block types available in Stripo
@@ -807,8 +807,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
807
807
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
808
808
  /** Custom label for back button (if shown) */
809
809
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
810
- /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
811
- readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
812
810
  }, undefined>, {}>;
813
811
  /** Feature toggles */
814
812
  readonly features: v.OptionalSchema<v.ObjectSchema<{
@@ -838,6 +836,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
838
836
  /** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
839
837
  readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
840
838
  readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
839
+ /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
840
+ readonly legacyUnsubscribeConversion: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
841
841
  }, undefined>, {}>;
842
842
  /** Block configuration */
843
843
  readonly blocks: v.OptionalSchema<v.ObjectSchema<{
@@ -89,7 +89,6 @@ export declare const useConfig: () => {
89
89
  ui: {
90
90
  showHeader: boolean;
91
91
  backButtonLabel?: string | undefined;
92
- externalDisplayConditions: boolean;
93
92
  };
94
93
  features: {
95
94
  dynamicContent: boolean;
@@ -106,6 +105,7 @@ export declare const useConfig: () => {
106
105
  linkTrackingIds: boolean;
107
106
  allowSaveWithErrors: boolean;
108
107
  reusableRecommendationStrategy: boolean;
108
+ legacyUnsubscribeConversion: boolean;
109
109
  };
110
110
  blocks: {
111
111
  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")[];
@@ -230,7 +230,6 @@ export declare const useConfig: () => {
230
230
  ui: import("vue").ComputedRef<{
231
231
  showHeader: boolean;
232
232
  backButtonLabel?: string | undefined;
233
- externalDisplayConditions: boolean;
234
233
  } | null>;
235
234
  features: import("vue").ComputedRef<{
236
235
  dynamicContent: boolean;
@@ -247,6 +246,7 @@ export declare const useConfig: () => {
247
246
  linkTrackingIds: boolean;
248
247
  allowSaveWithErrors: boolean;
249
248
  reusableRecommendationStrategy: boolean;
249
+ legacyUnsubscribeConversion: boolean;
250
250
  } | null>;
251
251
  blocks: import("vue").ComputedRef<{
252
252
  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")[];
@@ -0,0 +1,7 @@
1
+ export interface EditorTrackingIdsResult {
2
+ changed: boolean;
3
+ nextSeq: number;
4
+ }
5
+ export declare const useEditorTrackingIds: () => {
6
+ writeTrackingIds: (floor: number) => EditorTrackingIdsResult;
7
+ };
@@ -1,17 +1,8 @@
1
1
  import type { ModuleAddData, ModuleModifier } from '@@/Types/stripo';
2
2
  export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
3
3
  /**
4
- * Repairs saved modules as they are dropped or copied into the editor, in one pass
5
- * over the module HTML. Two independent repairs run through a single write-back:
6
- *
7
- * - Dynamic content: saved modules serialize merge-tag chips by their display label
8
- * (`{{ Phone Number }}`); this maps them back to their canonical token
9
- * (`{{phone_number}}`) using the account's dynamic-content list.
10
- * - Items currency: v2 Items blocks can carry price `data-curency` /
11
- * `data-currency_symbol` attrs that drifted from their `esd-ext-config`; these are
12
- * healed from config (the export contract reads those exact attrs).
13
- *
14
- * Wired into Stripo via the `onModuleAdd` init callback (see `useStripo`).
4
+ * Repairs dropped/copied saved modules (items currency, linkless legacy unsubscribe → text block,
5
+ * dynamic-content labels → tokens) in one write-back; wired via Stripo's `onModuleAdd` (see `useStripo`).
15
6
  */
16
7
  export declare const useModuleRepair: () => {
17
8
  handleModuleAdd: (data: ModuleAddData, modifier: ModuleModifier) => void;
@@ -1,6 +1,6 @@
1
1
  import type { EditorOpenMetrics } from '@@/Composables/useEditorOpenMetrics';
2
2
  import type { Metadata, Options, Template } from '@@/Types/stripo';
3
3
  export declare const useStripo: (openMetrics: EditorOpenMetrics) => {
4
- initPlugin: (template: Template, metadata: Metadata, options: Options) => Promise<void>;
4
+ initPlugin: (template: Template, metadata: Metadata, options: Options, htmlChanged?: boolean) => Promise<void>;
5
5
  preloadRuntime: () => void;
6
6
  };
@@ -0,0 +1 @@
1
+ export declare const migrateLegacyUnsubscribeText: (html: string) => string;
@@ -8,7 +8,7 @@ export declare const ACADEMY_LINKS: {
8
8
  readonly EMAIL_EDITOR: "https://academy.insiderone.com/docs/email-drag-and-drop-editor";
9
9
  readonly GLOBAL_UNSUBSCRIBE: "https://academy.insiderone.com/docs/global-unsubscribe-preference-center";
10
10
  readonly AMP_FOR_EMAILS: "https://academy.insiderone.com/docs/amp-for-emails";
11
- readonly EMAIL_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
12
11
  readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
12
+ readonly LEGACY_UNSUBSCRIBE_MODULE: "https://academy.insiderone.com/docs/new-editor-add-unsubscribe-pages-into-emails";
13
13
  };
14
14
  export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
@@ -57,6 +57,7 @@ interface PerBlockState {
57
57
  legacyConversionLoading: boolean;
58
58
  configVersion: number;
59
59
  adoptedSizeVersion: number;
60
+ drawnProducts: RecommendationProduct[] | null;
60
61
  }
61
62
  /**
62
63
  * Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
@@ -491,6 +492,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
491
492
  * (SD-149916).
492
493
  */
493
494
  cloneBlockState(sourceId: number, newId: number): void;
495
+ markProductsDrawn(id: number, products: RecommendationProduct[]): void;
494
496
  /**
495
497
  * Marks a block as initialized (initial API data has been fetched).
496
498
  * Automatically cleaned up when removeBlockState deletes the block entry.