@useinsider/guido 3.1.1-beta.e2f9e0a → 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 (42) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +9 -7
  3. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  4. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  5. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  6. package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
  7. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  8. package/dist/composables/useHtmlCompiler.js +18 -16
  9. package/dist/composables/useRecommendation.js +2 -2
  10. package/dist/composables/useSave.js +23 -17
  11. package/dist/composables/useStripo.js +44 -41
  12. package/dist/composables/validators/useLiquidValidator.js +42 -0
  13. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  14. package/dist/config/compiler/recommendationCompilerRules.js +158 -44
  15. package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
  16. package/dist/enums/displayConditions.js +82 -78
  17. package/dist/enums/extensions/recommendationBlock.js +96 -39
  18. package/dist/enums/recommendation.js +2 -2
  19. package/dist/enums/unsubscribe.js +17 -16
  20. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  21. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  22. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  23. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -3
  24. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  25. package/dist/guido.css +1 -1
  26. package/dist/services/recommendationApi.js +12 -14
  27. package/dist/services/templateLibraryApi.js +48 -46
  28. package/dist/src/@types/config/schemas.d.ts +4 -0
  29. package/dist/src/@types/save-as-template.d.ts +1 -0
  30. package/dist/src/composables/useConfig.d.ts +2 -0
  31. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  32. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  33. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  34. package/dist/src/enums/displayConditions.d.ts +5 -1
  35. package/dist/src/enums/extensions/recommendationBlock.d.ts +8 -1
  36. package/dist/src/enums/unsubscribe.d.ts +8 -3
  37. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  38. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  39. package/dist/src/stores/config.d.ts +18 -0
  40. package/dist/src/utils/genericUtil.d.ts +1 -1
  41. package/dist/utils/genericUtil.js +42 -20
  42. package/package.json +1 -1
@@ -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
  };
@@ -176,6 +176,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
176
176
  readonly unsubscribe: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
177
177
  /** Disable modules panel in the editor */
178
178
  readonly modulesDisabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
179
+ /** Enable Liquid template syntax */
180
+ readonly liquidSyntax: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
179
181
  }, undefined>;
180
182
  /**
181
183
  * Default block types available in Stripo
@@ -497,6 +499,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
497
499
  readonly unsubscribe: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
498
500
  /** Disable modules panel in the editor */
499
501
  readonly modulesDisabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
502
+ /** Enable Liquid template syntax */
503
+ readonly liquidSyntax: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
500
504
  }, undefined>, {}>;
501
505
  /** Block configuration */
502
506
  readonly blocks: v.OptionalSchema<v.ObjectSchema<{
@@ -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
  }
@@ -61,6 +61,7 @@ export declare const useConfig: () => {
61
61
  displayConditions: boolean;
62
62
  unsubscribe: boolean;
63
63
  modulesDisabled: boolean;
64
+ liquidSyntax: boolean;
64
65
  };
65
66
  blocks: {
66
67
  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")[];
@@ -157,6 +158,7 @@ export declare const useConfig: () => {
157
158
  displayConditions: boolean;
158
159
  unsubscribe: boolean;
159
160
  modulesDisabled: boolean;
161
+ liquidSyntax: boolean;
160
162
  } | null>;
161
163
  blocks: import("vue").ComputedRef<{
162
164
  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,3 @@
1
+ export declare const useLiquidValidator: () => {
2
+ validateLiquidSyntax: (compiledHtml: string) => Promise<boolean>;
3
+ };
@@ -0,0 +1,2 @@
1
+ import type { CompilerRule } from '@@/Types/html-compiler';
2
+ export declare const liquidCompilerRules: CompilerRule[];
@@ -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: {
@@ -1,3 +1,5 @@
1
+ export declare const COUPON_PLACEHOLDER_DEFAULT = "{@COUPON_CODE}";
2
+ export declare const COUPON_PLACEHOLDER_LIQUID = "{{ins_coupon_code}}";
1
3
  declare const migrationTemplate = "\n <td\n class=\"coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block\"\n esd-extension-block-id=\"coupon-block\"\n >\n <p class=\"ins-title\" contenteditable=\"false\">{@COUPON_CODE}</p>\n </td>\n";
2
4
  export declare function getDefaultTemplate(): string;
3
5
  export default migrationTemplate;
@@ -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
  };
@@ -66,6 +66,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
66
66
  displayConditions: boolean;
67
67
  unsubscribe: boolean;
68
68
  modulesDisabled: boolean;
69
+ liquidSyntax: boolean;
69
70
  };
70
71
  blocks: {
71
72
  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")[];
@@ -168,6 +169,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
168
169
  displayConditions: boolean;
169
170
  unsubscribe: boolean;
170
171
  modulesDisabled: boolean;
172
+ liquidSyntax: boolean;
171
173
  };
172
174
  blocks: {
173
175
  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")[];
@@ -270,6 +272,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
270
272
  displayConditions: boolean;
271
273
  unsubscribe: boolean;
272
274
  modulesDisabled: boolean;
275
+ liquidSyntax: boolean;
273
276
  };
274
277
  blocks: {
275
278
  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")[];
@@ -372,6 +375,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
372
375
  displayConditions: boolean;
373
376
  unsubscribe: boolean;
374
377
  modulesDisabled: boolean;
378
+ liquidSyntax: boolean;
375
379
  };
376
380
  blocks: {
377
381
  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")[];
@@ -474,6 +478,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
474
478
  displayConditions: boolean;
475
479
  unsubscribe: boolean;
476
480
  modulesDisabled: boolean;
481
+ liquidSyntax: boolean;
477
482
  };
478
483
  blocks: {
479
484
  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")[];
@@ -576,6 +581,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
576
581
  displayConditions: boolean;
577
582
  unsubscribe: boolean;
578
583
  modulesDisabled: boolean;
584
+ liquidSyntax: boolean;
579
585
  };
580
586
  blocks: {
581
587
  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")[];
@@ -678,6 +684,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
678
684
  displayConditions: boolean;
679
685
  unsubscribe: boolean;
680
686
  modulesDisabled: boolean;
687
+ liquidSyntax: boolean;
681
688
  };
682
689
  blocks: {
683
690
  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")[];
@@ -780,6 +787,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
780
787
  displayConditions: boolean;
781
788
  unsubscribe: boolean;
782
789
  modulesDisabled: boolean;
790
+ liquidSyntax: boolean;
783
791
  };
784
792
  blocks: {
785
793
  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")[];
@@ -882,6 +890,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
882
890
  displayConditions: boolean;
883
891
  unsubscribe: boolean;
884
892
  modulesDisabled: boolean;
893
+ liquidSyntax: boolean;
885
894
  };
886
895
  blocks: {
887
896
  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")[];
@@ -984,6 +993,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
984
993
  displayConditions: boolean;
985
994
  unsubscribe: boolean;
986
995
  modulesDisabled: boolean;
996
+ liquidSyntax: boolean;
987
997
  };
988
998
  blocks: {
989
999
  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")[];
@@ -1086,6 +1096,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1086
1096
  displayConditions: boolean;
1087
1097
  unsubscribe: boolean;
1088
1098
  modulesDisabled: boolean;
1099
+ liquidSyntax: boolean;
1089
1100
  };
1090
1101
  blocks: {
1091
1102
  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")[];
@@ -1188,6 +1199,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1188
1199
  displayConditions: boolean;
1189
1200
  unsubscribe: boolean;
1190
1201
  modulesDisabled: boolean;
1202
+ liquidSyntax: boolean;
1191
1203
  };
1192
1204
  blocks: {
1193
1205
  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")[];
@@ -1290,6 +1302,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1290
1302
  displayConditions: boolean;
1291
1303
  unsubscribe: boolean;
1292
1304
  modulesDisabled: boolean;
1305
+ liquidSyntax: boolean;
1293
1306
  };
1294
1307
  blocks: {
1295
1308
  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")[];
@@ -1392,6 +1405,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1392
1405
  displayConditions: boolean;
1393
1406
  unsubscribe: boolean;
1394
1407
  modulesDisabled: boolean;
1408
+ liquidSyntax: boolean;
1395
1409
  };
1396
1410
  blocks: {
1397
1411
  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")[];
@@ -1494,6 +1508,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1494
1508
  displayConditions: boolean;
1495
1509
  unsubscribe: boolean;
1496
1510
  modulesDisabled: boolean;
1511
+ liquidSyntax: boolean;
1497
1512
  };
1498
1513
  blocks: {
1499
1514
  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")[];
@@ -1596,6 +1611,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1596
1611
  displayConditions: boolean;
1597
1612
  unsubscribe: boolean;
1598
1613
  modulesDisabled: boolean;
1614
+ liquidSyntax: boolean;
1599
1615
  };
1600
1616
  blocks: {
1601
1617
  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")[];
@@ -1698,6 +1714,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1698
1714
  displayConditions: boolean;
1699
1715
  unsubscribe: boolean;
1700
1716
  modulesDisabled: boolean;
1717
+ liquidSyntax: boolean;
1701
1718
  };
1702
1719
  blocks: {
1703
1720
  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")[];
@@ -1800,6 +1817,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1800
1817
  displayConditions: boolean;
1801
1818
  unsubscribe: boolean;
1802
1819
  modulesDisabled: boolean;
1820
+ liquidSyntax: boolean;
1803
1821
  };
1804
1822
  blocks: {
1805
1823
  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")[];
@@ -1,6 +1,6 @@
1
1
  import type { DynamicContent, MergeTag } from '@@/Types/generic';
2
2
  export declare const mergeTagToDynamicContent: (mergeTag: MergeTag) => DynamicContent;
3
- export declare const dynamicContentToMergeTags: (dynamicContentList: DynamicContent[]) => MergeTag[];
3
+ export declare const dynamicContentToMergeTags: (dynamicContentList: DynamicContent[], liquidSyntax?: boolean) => MergeTag[];
4
4
  export declare const getCsrfToken: () => string;
5
5
  /**
6
6
  * URL Parameter utilities
@@ -1,25 +1,47 @@
1
- const f = (t) => {
2
- const n = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [r] = n, e = {
3
- text: t.label,
4
- value: r || ""
1
+ const s = (e) => {
2
+ const a = e.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [n] = a, c = {
3
+ text: e.label,
4
+ value: n || ""
5
5
  };
6
- if (n.length >= 2) {
7
- const [, l, o] = n, c = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
8
- c ? e.format = c : o || (e.fallback = l), o && (e.fallback = o);
6
+ if (a.length >= 2) {
7
+ const [, l, r] = a;
8
+ if (l.startsWith("default:")) {
9
+ let t = l.slice(8).trim();
10
+ t.startsWith('"') && t.endsWith('"') && (t = t.slice(1, -1)), c.fallback = t;
11
+ } else {
12
+ const t = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
13
+ t ? c.format = t : r || (c.fallback = l), r && (c.fallback = r);
14
+ }
9
15
  }
10
- return e;
11
- }, s = (t) => t.map((a) => a.format ? {
12
- label: `${a.text} | ${a.format.key}=${a.format.value}`,
13
- value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
14
- } : {
15
- label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
16
- value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
17
- }), u = () => {
18
- var t;
19
- return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
16
+ return c;
17
+ }, u = (e, f = !1) => e.map((a) => {
18
+ if (a.format)
19
+ return {
20
+ label: `${a.text} | ${a.format.key}=${a.format.value}`,
21
+ value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
22
+ };
23
+ if (f) {
24
+ if (!a.fallback)
25
+ return {
26
+ label: a.text,
27
+ value: `{{ ${a.value} }}`
28
+ };
29
+ const c = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
30
+ return {
31
+ label: `${a.text} | ${a.fallback}`,
32
+ value: `{{ ${a.value} | default: ${c} }}`
33
+ };
34
+ }
35
+ return {
36
+ label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
37
+ value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
38
+ };
39
+ }), o = () => {
40
+ var e;
41
+ return ((e = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : e.getAttribute("content")) ?? "";
20
42
  };
21
43
  export {
22
- s as dynamicContentToMergeTags,
23
- u as getCsrfToken,
24
- f as mergeTagToDynamicContent
44
+ u as dynamicContentToMergeTags,
45
+ o as getCsrfToken,
46
+ s as mergeTagToDynamicContent
25
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.1.1-beta.e2f9e0a",
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",