@useinsider/guido 3.1.1-beta.e00a22b → 3.1.1-beta.e4aa789

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 (28) hide show
  1. package/dist/components/Guido.vue.js +4 -4
  2. package/dist/components/Guido.vue2.js +91 -81
  3. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  4. package/dist/components/organisms/header/EditorActions.vue2.js +20 -15
  5. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  6. package/dist/composables/useRecommendation.js +2 -2
  7. package/dist/composables/useStripo.js +6 -6
  8. package/dist/config/compiler/recommendationCompilerRules.js +158 -44
  9. package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
  10. package/dist/enums/displayConditions.js +82 -78
  11. package/dist/enums/extensions/recommendationBlock.js +96 -39
  12. package/dist/enums/recommendation.js +2 -2
  13. package/dist/enums/unsubscribe.js +17 -16
  14. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  15. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  16. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -3
  17. package/dist/guido.css +1 -1
  18. package/dist/services/recommendationApi.js +12 -14
  19. package/dist/services/templateLibraryApi.js +48 -46
  20. package/dist/src/@types/save-as-template.d.ts +1 -0
  21. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  22. package/dist/src/enums/displayConditions.d.ts +5 -1
  23. package/dist/src/enums/extensions/recommendationBlock.d.ts +8 -1
  24. package/dist/src/enums/unsubscribe.d.ts +8 -3
  25. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  26. package/dist/static/styles/base.css.js +7 -2
  27. package/dist/utils/templatePreparation.js +34 -25
  28. package/package.json +1 -2
@@ -1,14 +1,15 @@
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 { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
- import { useSaveAsTemplateStore as v } from "../stores/save-as-template.js";
8
- import { base64EncodeWithSpecialChars as a } from "../utils/base64.js";
9
- import { useTemplatePreparation as S } from "../utils/templatePreparation.js";
10
- const R = () => {
11
- const { get: n, post: c } = f(), { handleError: o, showToaster: i } = w(), { config: l } = T(), p = b();
1
+ import { useConfig as w } from "../composables/useConfig.js";
2
+ import { useHttp as b } from "../composables/useHttp.js";
3
+ import { useToaster as h } from "../composables/useToaster.js";
4
+ import { useTranslations as C } from "../composables/useTranslations.js";
5
+ import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
6
+ import { EditorType as v } from "../enums/defaults.js";
7
+ import { useRecommendationExtensionStore as N } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { useSaveAsTemplateStore as x } from "../stores/save-as-template.js";
9
+ import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
10
+ import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
11
+ const $ = () => {
12
+ const { get: n, post: m } = b(), { handleError: o, showToaster: l } = h(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = C();
12
13
  return {
13
14
  getCategories: async () => {
14
15
  try {
@@ -26,7 +27,7 @@ const R = () => {
26
27
  },
27
28
  createCategory: async (e) => {
28
29
  try {
29
- const { data: { id: t } } = await c(
30
+ const { data: { id: t } } = await m(
30
31
  "/newsletter/template-library/create-category",
31
32
  { name: e }
32
33
  );
@@ -36,55 +37,56 @@ const R = () => {
36
37
  }
37
38
  },
38
39
  createTemplate: async () => {
39
- var e, t, g, y;
40
+ var e, t, d, y;
40
41
  try {
41
- const { prepareTemplateDetails: m } = S(), r = v(), s = await m(), u = {
42
- name: r.getTemplateName,
43
- categories: r.getSelectedCategoryIds,
44
- productId: ((t = (e = l.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
45
- editorType: h,
46
- messageType: ((y = (g = l.value) == null ? void 0 : g.partner) == null ? void 0 : y.messageType) || 0,
47
- content: a(s.compiledHtml),
48
- css: a(s.css),
42
+ const { prepareTemplateDetails: i } = A(), s = x(), a = await i();
43
+ if (p("liquidSyntax") && !await g(a.compiledHtml))
44
+ return !1;
45
+ const f = {
46
+ name: s.getTemplateName,
47
+ categories: s.getSelectedCategoryIds,
48
+ productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
49
+ editorType: v,
50
+ messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
51
+ content: r(a.compiledHtml),
52
+ css: r(a.css),
49
53
  unsubscriptionPreferencePageStatus: !1,
50
54
  unsubscriptionPreferencePages: [],
51
- recommendationCampaignUrls: a(
52
- C().recommendationCampaignUrls
55
+ recommendationCampaignUrls: r(
56
+ N().recommendationCampaignUrls
53
57
  ),
54
- recommendationConfigs: a({}),
58
+ recommendationConfigs: r({}),
55
59
  isGuido: !0,
56
- stripoConfig: a({
60
+ // eslint-disable-next-line camelcase
61
+ template_engine: p("liquidSyntax") ? 1 : 0,
62
+ stripoConfig: r({
57
63
  editor: "stripo",
58
- html: s.rawHtml,
59
- css: s.css
64
+ html: a.rawHtml,
65
+ css: a.css
60
66
  })
61
- }, { data: { type: d } } = await c(
67
+ }, { data: { type: T } } = await m(
62
68
  "/newsletter/template-library/create-template",
63
- u
69
+ f
64
70
  );
65
- if (d === "alert") {
66
- i({
67
- message: p(
68
- "newsletter.template-library-save-alert",
69
- { templateName: r.getTemplateName }
70
- ),
71
- type: "alert"
72
- });
73
- return;
74
- }
75
- i({
76
- message: p(
71
+ return T === "alert" ? (l({
72
+ message: u(
73
+ "newsletter.template-library-save-alert",
74
+ { templateName: s.getTemplateName }
75
+ ),
76
+ type: "alert"
77
+ }), !1) : (l({
78
+ message: u(
77
79
  "newsletter.template-library-save-success",
78
- { templateName: r.getTemplateName }
80
+ { templateName: s.getTemplateName }
79
81
  ),
80
82
  type: "success"
81
- });
82
- } catch (m) {
83
- o(m, "Failed to create template");
83
+ }), !0);
84
+ } catch (i) {
85
+ return o(i, "Failed to create template"), !1;
84
86
  }
85
87
  }
86
88
  };
87
89
  };
88
90
  export {
89
- R as useTemplateLibraryApi
91
+ $ as useTemplateLibraryApi
90
92
  };
@@ -26,4 +26,5 @@ export interface CreateTemplateRequest {
26
26
  unsubscriptionPreferencePages: number[];
27
27
  unsubscriptionPreferencePageStatus: boolean;
28
28
  isGuido: boolean;
29
+ template_engine: number;
29
30
  }
@@ -6,7 +6,7 @@
6
6
  * @param alignment - Currency alignment from block config: 'before' or 'after'
7
7
  * @returns Formatted price string with currency variable in correct position
8
8
  */
9
- export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string): string;
9
+ export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string, prefix?: string): string;
10
10
  /**
11
11
  * Transforms recommendation block HTML by replacing product data with
12
12
  * template variables.
@@ -1,2 +1,6 @@
1
1
  import type { ConditionCategories } from '@@/Types/condition-categories';
2
- export declare const displayConditions: ConditionCategories;
2
+ /**
3
+ * Get display conditions lazily so translations resolve at access time.
4
+ * Must be called within a Vue component context or after Pinia is initialized.
5
+ */
6
+ export declare const getDisplayConditions: () => ConditionCategories;
@@ -3,7 +3,14 @@ import type { RecommendationFeedItem } from '@@/Types/recommendation';
3
3
  export declare const URLS: {
4
4
  RECOMMENDATION_API_URL: string;
5
5
  };
6
- export declare const RecommendationFeedSourceMaps: RecommendationFeedItem[];
6
+ export declare const QUERY_PARAMS: {
7
+ CLIENT_ID: string;
8
+ };
9
+ /**
10
+ * Get recommendation feed source maps lazily so translated names resolve at access time.
11
+ * Must be called within a Vue component context or after Pinia is initialized.
12
+ */
13
+ export declare const getRecommendationFeedSourceMaps: () => RecommendationFeedItem[];
7
14
  export declare const PriceAttributes: string[];
8
15
  export declare const currencyLocationMaps: TextValueObject[];
9
16
  export declare const currencyOperators: TextValueObject[];
@@ -13,9 +13,14 @@ export declare const URLS: {
13
13
  PREFERENCES_URL: string;
14
14
  };
15
15
  export declare const INSIDER_ID = "iid";
16
- export declare const DEFAULT_UNSUBSCRIBE_GROUP: {
17
- readonly name: "Global Unsubscribe";
18
- readonly sendGridId: "G";
16
+ export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
17
+ /**
18
+ * Get the default unsubscribe group lazily so the translated name resolves at access time.
19
+ * Must be called within a Vue component context or after Pinia is initialized.
20
+ */
21
+ export declare const getDefaultUnsubscribeGroup: () => {
22
+ name: string;
23
+ sendGridId: string;
19
24
  };
20
25
  export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
21
26
  export declare const PAGE_TYPES: {
@@ -3,5 +3,5 @@ export declare const useTemplateLibraryApi: () => {
3
3
  getCategories: () => Promise<Category[]>;
4
4
  checkTemplateNameAvailability: (value: string) => Promise<boolean>;
5
5
  createCategory: (category: string) => Promise<string>;
6
- createTemplate: () => Promise<void>;
6
+ createTemplate: () => Promise<boolean>;
7
7
  };
@@ -1,11 +1,16 @@
1
- const t = `.amp-input-list,
1
+ const n = `.amp-input-list,
2
2
  .button,
3
3
  .base-input,
4
4
  ue-stripe-thumb,
5
5
  .ue-stripe-thumb {
6
6
  transition: all .5s ease;
7
7
  }
8
+
9
+ :host {
10
+ height: 100% !important;
11
+ min-height: 0 !important;
12
+ }
8
13
  `;
9
14
  export {
10
- t as default
15
+ n as default
11
16
  };
@@ -1,44 +1,53 @@
1
- import { useActionsApi as S } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as f } from "../composables/useHtmlCompiler.js";
3
- import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { useDynamicContentStore as T } from "../stores/dynamic-content.js";
5
- import { useUnsubscribeStore as x } from "../stores/unsubscribe.js";
6
- const h = () => {
7
- const o = T(), e = x(), { getCompiledEmail: i, getTemplateData: s } = S(), { compileHtml: n } = f();
1
+ import { useActionsApi as T } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as P } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { DATA_ATTRIBUTES as l } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
5
+ import { parsePageList as h } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
6
+ import { useDynamicContentStore as C } from "../stores/dynamic-content.js";
7
+ import { useUnsubscribeStore as D } from "../stores/unsubscribe.js";
8
+ function x(i, e) {
9
+ const r = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${l.PAGE_LIST}]`), n = [];
10
+ return r.forEach((t) => {
11
+ const o = t.getAttribute(l.PAGE_LIST);
12
+ o && n.push(...h(o));
13
+ }), e.filter((t) => n.includes(t));
14
+ }
15
+ const I = () => {
16
+ const i = C(), e = D(), { getCompiledEmail: a, getTemplateData: m } = T(), { compileHtml: r } = P();
8
17
  return {
9
18
  prepareTemplateDetails: async () => {
10
- const { html: a, ampHtml: m = "", ampErrors: r = [] } = await i({
19
+ const { html: t, ampHtml: o = "", ampErrors: p = [] } = await a({
11
20
  minimize: !0,
12
21
  resetDataSavedFlag: !1
13
- }), { html: c, css: l, syncModulesIds: p = [] } = await s();
22
+ }), { html: u, css: d, syncModulesIds: g = [] } = await m();
14
23
  e.selectedUnsubscribePages.length && await e.fetchTemplates();
15
- const { compiledHtml: u, stats: t, appliedRules: d } = n(a), g = o.getSelectedDynamicContentList, b = C();
24
+ const { compiledHtml: c, stats: s, appliedRules: S } = r(t), b = i.getSelectedDynamicContentList, f = A();
16
25
  return console.debug("HTML Compilation Stats:", {
17
- originalSize: t.originalSize,
18
- compiledSize: t.compiledSize,
19
- reduction: `${t.reductionPercentage.toFixed(2)}%`,
20
- appliedRules: d,
21
- executionTime: `${t.executionTime.toFixed(2)}ms`
26
+ originalSize: s.originalSize,
27
+ compiledSize: s.compiledSize,
28
+ reduction: `${s.reductionPercentage.toFixed(2)}%`,
29
+ appliedRules: S,
30
+ executionTime: `${s.executionTime.toFixed(2)}ms`
22
31
  }), {
23
- dynamicContentList: g,
24
- compiledHtml: u,
25
- rawHtml: c,
26
- css: l,
27
- ampHtml: m,
28
- ampErrors: r,
29
- modules: p.map(Number),
32
+ dynamicContentList: b,
33
+ compiledHtml: c,
34
+ rawHtml: u,
35
+ css: d,
36
+ ampHtml: o,
37
+ ampErrors: p,
38
+ modules: g.map(Number),
30
39
  recommendation: {
31
- campaignUrls: b.recommendationCampaignUrls,
40
+ campaignUrls: f.recommendationCampaignUrls,
32
41
  configs: {}
33
42
  },
34
43
  unsubscribe: {
35
44
  status: e.unsubscribePagesStatus,
36
- config: e.selectedUnsubscribePages
45
+ config: x(c, e.selectedUnsubscribePages)
37
46
  }
38
47
  };
39
48
  }
40
49
  };
41
50
  };
42
51
  export {
43
- h as useTemplatePreparation
52
+ I as useTemplatePreparation
44
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.1.1-beta.e00a22b",
3
+ "version": "3.1.1-beta.e4aa789",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -34,7 +34,6 @@
34
34
  "dependencies": {
35
35
  "@stripoinc/ui-editor-extensions": "3.5.0",
36
36
  "@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
37
- "@useinsider/guido": "3.1.1-beta.22d798c",
38
37
  "@vueuse/core": "11.3.0",
39
38
  "lodash-es": "4.17.21",
40
39
  "pinia": "2.3.1",