@useinsider/guido 3.18.2-beta.eedafd2 → 3.18.2-beta.fc246a7

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 (65) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +26 -28
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +51 -53
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  10. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  11. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  12. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  13. package/dist/composables/useHtmlCompiler.js +26 -37
  14. package/dist/composables/useHtmlValidator.js +0 -2
  15. package/dist/composables/useHttp.js +22 -24
  16. package/dist/composables/useSave.js +45 -90
  17. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  18. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  19. package/dist/config/migrator/itemsBlockMigrator.js +257 -167
  20. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  21. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  22. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  23. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  24. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  25. package/dist/extensions/Blocks/Items/template.js +219 -204
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +36 -43
  27. package/dist/guido.css +1 -1
  28. package/dist/services/templateLibraryApi.js +14 -17
  29. package/dist/src/@types/config/schemas.d.ts +0 -4
  30. package/dist/src/components/Guido.vue.d.ts +1 -17
  31. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  32. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  33. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  34. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  35. package/dist/src/composables/useConfig.d.ts +0 -2
  36. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  37. package/dist/src/composables/useSave.d.ts +1 -6
  38. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  39. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  40. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  41. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  42. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  44. package/dist/src/stores/config.d.ts +0 -30
  45. package/dist/src/utils/genericUtil.d.ts +0 -6
  46. package/dist/src/utils/templatePreparation.d.ts +0 -30
  47. package/dist/stores/config.js +22 -39
  48. package/dist/utils/genericUtil.js +54 -63
  49. package/dist/utils/pairProductVariables.js +71 -71
  50. package/dist/utils/templatePreparation.js +45 -49
  51. package/package.json +1 -1
  52. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  53. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  54. package/dist/composables/useSaveValidation.js +0 -279
  55. package/dist/composables/useSaveValidationRollout.js +0 -9
  56. package/dist/enums/save-validation.js +0 -4
  57. package/dist/src/@types/save-validation.d.ts +0 -19
  58. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
  59. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  60. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  61. package/dist/src/enums/save-validation.d.ts +0 -27
  62. package/dist/src/stores/save-validation.d.ts +0 -22
  63. package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
  64. package/dist/stores/save-validation.js +0 -30
  65. package/dist/utils/liquidDynamicContent.js +0 -15
@@ -104,7 +104,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
104
104
  autosave: boolean;
105
105
  allowlistEnabled: boolean;
106
106
  linkTrackingIds: boolean;
107
- allowSaveWithErrors: boolean;
108
107
  reusableRecommendationStrategy: boolean;
109
108
  };
110
109
  blocks: {
@@ -246,7 +245,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
246
245
  autosave: boolean;
247
246
  allowlistEnabled: boolean;
248
247
  linkTrackingIds: boolean;
249
- allowSaveWithErrors: boolean;
250
248
  reusableRecommendationStrategy: boolean;
251
249
  };
252
250
  blocks: {
@@ -388,7 +386,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
388
386
  autosave: boolean;
389
387
  allowlistEnabled: boolean;
390
388
  linkTrackingIds: boolean;
391
- allowSaveWithErrors: boolean;
392
389
  reusableRecommendationStrategy: boolean;
393
390
  };
394
391
  blocks: {
@@ -530,7 +527,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
530
527
  autosave: boolean;
531
528
  allowlistEnabled: boolean;
532
529
  linkTrackingIds: boolean;
533
- allowSaveWithErrors: boolean;
534
530
  reusableRecommendationStrategy: boolean;
535
531
  };
536
532
  blocks: {
@@ -672,7 +668,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
672
668
  autosave: boolean;
673
669
  allowlistEnabled: boolean;
674
670
  linkTrackingIds: boolean;
675
- allowSaveWithErrors: boolean;
676
671
  reusableRecommendationStrategy: boolean;
677
672
  };
678
673
  blocks: {
@@ -814,7 +809,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
814
809
  autosave: boolean;
815
810
  allowlistEnabled: boolean;
816
811
  linkTrackingIds: boolean;
817
- allowSaveWithErrors: boolean;
818
812
  reusableRecommendationStrategy: boolean;
819
813
  };
820
814
  blocks: {
@@ -956,7 +950,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
956
950
  autosave: boolean;
957
951
  allowlistEnabled: boolean;
958
952
  linkTrackingIds: boolean;
959
- allowSaveWithErrors: boolean;
960
953
  reusableRecommendationStrategy: boolean;
961
954
  };
962
955
  blocks: {
@@ -1098,7 +1091,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1098
1091
  autosave: boolean;
1099
1092
  allowlistEnabled: boolean;
1100
1093
  linkTrackingIds: boolean;
1101
- allowSaveWithErrors: boolean;
1102
1094
  reusableRecommendationStrategy: boolean;
1103
1095
  };
1104
1096
  blocks: {
@@ -1240,7 +1232,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1240
1232
  autosave: boolean;
1241
1233
  allowlistEnabled: boolean;
1242
1234
  linkTrackingIds: boolean;
1243
- allowSaveWithErrors: boolean;
1244
1235
  reusableRecommendationStrategy: boolean;
1245
1236
  };
1246
1237
  blocks: {
@@ -1382,7 +1373,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1382
1373
  autosave: boolean;
1383
1374
  allowlistEnabled: boolean;
1384
1375
  linkTrackingIds: boolean;
1385
- allowSaveWithErrors: boolean;
1386
1376
  reusableRecommendationStrategy: boolean;
1387
1377
  };
1388
1378
  blocks: {
@@ -1524,7 +1514,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1524
1514
  autosave: boolean;
1525
1515
  allowlistEnabled: boolean;
1526
1516
  linkTrackingIds: boolean;
1527
- allowSaveWithErrors: boolean;
1528
1517
  reusableRecommendationStrategy: boolean;
1529
1518
  };
1530
1519
  blocks: {
@@ -1666,7 +1655,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1666
1655
  autosave: boolean;
1667
1656
  allowlistEnabled: boolean;
1668
1657
  linkTrackingIds: boolean;
1669
- allowSaveWithErrors: boolean;
1670
1658
  reusableRecommendationStrategy: boolean;
1671
1659
  };
1672
1660
  blocks: {
@@ -1808,7 +1796,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1808
1796
  autosave: boolean;
1809
1797
  allowlistEnabled: boolean;
1810
1798
  linkTrackingIds: boolean;
1811
- allowSaveWithErrors: boolean;
1812
1799
  reusableRecommendationStrategy: boolean;
1813
1800
  };
1814
1801
  blocks: {
@@ -1950,7 +1937,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1950
1937
  autosave: boolean;
1951
1938
  allowlistEnabled: boolean;
1952
1939
  linkTrackingIds: boolean;
1953
- allowSaveWithErrors: boolean;
1954
1940
  reusableRecommendationStrategy: boolean;
1955
1941
  };
1956
1942
  blocks: {
@@ -2092,7 +2078,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2092
2078
  autosave: boolean;
2093
2079
  allowlistEnabled: boolean;
2094
2080
  linkTrackingIds: boolean;
2095
- allowSaveWithErrors: boolean;
2096
2081
  reusableRecommendationStrategy: boolean;
2097
2082
  };
2098
2083
  blocks: {
@@ -2136,18 +2121,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2136
2121
  };
2137
2122
  } | null;
2138
2123
  } & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
2139
- /**
2140
- * Transactional campaigns keep the hard save block. Reactive getter, so
2141
- * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
2142
- */
2143
- isTransactional(): boolean;
2144
- /**
2145
- * Soft-save policy: may the editor persist a template with validation errors?
2146
- * Default true (host sets features.allowSaveWithErrors=false for transactional +
2147
- * unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
2148
- * floor to false pre-init and momentarily hide the soft-save option (SD-147430).
2149
- */
2150
- allowSaveWithErrors(): boolean;
2151
2124
  /**
2152
2125
  * Get the username
2153
2126
  */
@@ -2246,7 +2219,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2246
2219
  autosave: boolean;
2247
2220
  allowlistEnabled: boolean;
2248
2221
  linkTrackingIds: boolean;
2249
- allowSaveWithErrors: boolean;
2250
2222
  reusableRecommendationStrategy: boolean;
2251
2223
  };
2252
2224
  blocks: {
@@ -2388,7 +2360,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2388
2360
  autosave: boolean;
2389
2361
  allowlistEnabled: boolean;
2390
2362
  linkTrackingIds: boolean;
2391
- allowSaveWithErrors: boolean;
2392
2363
  reusableRecommendationStrategy: boolean;
2393
2364
  };
2394
2365
  blocks: {
@@ -2532,7 +2503,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2532
2503
  autosave: boolean;
2533
2504
  allowlistEnabled: boolean;
2534
2505
  linkTrackingIds: boolean;
2535
- allowSaveWithErrors: boolean;
2536
2506
  reusableRecommendationStrategy: boolean;
2537
2507
  };
2538
2508
  blocks: {
@@ -30,9 +30,3 @@ export declare const replaceString: (string?: string, values?: Record<string, st
30
30
  * a string nor a number becomes ''.
31
31
  */
32
32
  export declare const asText: (value: unknown) => string;
33
- /**
34
- * Narrows an unknown API value to a plain JSON object. Arrays and exotic
35
- * objects (Blob, Date, FormData) are rejected, so a response body that useHttp
36
- * parsed as text or blob can never be read as a JSON payload.
37
- */
38
- export declare const isPlainObject: <T>(value: T) => value is T & Record<string, unknown>;
@@ -15,36 +15,6 @@ import type { SavedTemplateDetails } from '@@/Types/stripo';
15
15
  * same source), so it is reliably present regardless of how the block was added.
16
16
  */
17
17
  export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
18
- /**
19
- * Hydrates the recommendation extension store from the persisted `esd-ext-config`
20
- * JSON blob on each `.recommendation-block-v2` element in the raw editor HTML.
21
- *
22
- * Why this runs before `compileHtml`:
23
- * The HTML compiler's `prepareRecommendationBlocks` rule asks
24
- * `useRecommendation.buildCampaignUrl(id)` to assemble each block's API URL
25
- * from `blockStates[id].recommendationConfigs`. That Pinia entry is normally
26
- * populated by `RecommendationBlockControl._syncNodeConfigToStore`, which
27
- * only fires when the user *selects* the block. Saving without ever
28
- * selecting a migrated block would otherwise build the URL from empty/
29
- * default state and the campaign URL would not be saved.
30
- *
31
- * Why we read raw HTML, not compiled HTML:
32
- * Stripo's `compileEmail()` strips editor-only attributes (`esd-*`) from the
33
- * compiled output, so `esd-ext-config` is gone by the time the compiler
34
- * pipeline sees the HTML. The raw HTML from `getTemplateData()` preserves
35
- * the attribute as the migrator wrote it.
36
- *
37
- * Reference data pre-load:
38
- * When the template has recommendation blocks, this also pre-loads the
39
- * shared reference data (languages / currency list) so the save-time
40
- * required-fields validator can check each block's locale and currency
41
- * against the partner's real options. Best-effort — on a fetch failure the
42
- * validator degrades to its empty-list guard (`requiredFields.ts`) instead
43
- * of blocking the save or stranding the Save button.
44
- */
45
- declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
46
18
  export declare const useTemplatePreparation: () => {
47
19
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
- hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
49
20
  };
50
- export {};
@@ -1,8 +1,8 @@
1
- import { MessageType as r } from "../@types/config/schemas.js";
1
+ import "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
3
  import { parseConfig as o } from "../@types/config/validator.js";
4
- import { defineStore as a } from "pinia";
5
- const u = a("guido-config", {
4
+ import { defineStore as r } from "pinia";
5
+ const f = r("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -75,74 +75,57 @@ const u = a("guido-config", {
75
75
  * Get the template ID
76
76
  */
77
77
  templateId: (i) => {
78
- var e, t;
79
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateId) ?? "";
78
+ var e, n;
79
+ return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.templateId) ?? "";
80
80
  },
81
81
  /**
82
82
  * Get the user ID
83
83
  */
84
84
  userId: (i) => {
85
- var e, t;
86
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.userId) ?? "";
85
+ var e, n;
86
+ return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.userId) ?? "";
87
87
  },
88
88
  /**
89
89
  * Get the variation ID
90
90
  */
91
91
  variationId: (i) => {
92
- var e, t;
93
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.variationId) ?? "";
92
+ var e, n;
93
+ return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.variationId) ?? "";
94
94
  },
95
95
  /**
96
96
  * Get the partner name
97
97
  */
98
98
  partnerName: (i) => {
99
- var e, t;
100
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.name) ?? "";
99
+ var e, n;
100
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.name) ?? "";
101
101
  },
102
102
  /**
103
103
  * Get the product type
104
104
  */
105
105
  productType: (i) => {
106
- var e, t;
107
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.productType) ?? 60;
106
+ var e, n;
107
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.productType) ?? 60;
108
108
  },
109
109
  /**
110
110
  * Get the message type
111
111
  */
112
112
  messageType: (i) => {
113
- var e, t;
114
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) ?? 1;
115
- },
116
- /**
117
- * Transactional campaigns keep the hard save block. Reactive getter, so
118
- * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
119
- */
120
- isTransactional() {
121
- return this.messageType === r.TRANSACTIONAL;
122
- },
123
- /**
124
- * Soft-save policy: may the editor persist a template with validation errors?
125
- * Default true (host sets features.allowSaveWithErrors=false for transactional +
126
- * unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
127
- * floor to false pre-init and momentarily hide the soft-save option (SD-147430).
128
- */
129
- allowSaveWithErrors() {
130
- var i;
131
- return ((i = this.features) == null ? void 0 : i.allowSaveWithErrors) ?? !0;
113
+ var e, n;
114
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
132
115
  },
133
116
  /**
134
117
  * Get the username
135
118
  */
136
119
  username: (i) => {
137
- var e, t;
138
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.username) ?? "Guido User";
120
+ var e, n;
121
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.username) ?? "Guido User";
139
122
  },
140
123
  /**
141
124
  * Check if header should be shown
142
125
  */
143
126
  showHeader: (i) => {
144
- var e, t;
145
- return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
127
+ var e, n;
128
+ return ((n = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : n.showHeader) ?? !0;
146
129
  },
147
130
  /**
148
131
  * Check if a specific feature is enabled.
@@ -151,8 +134,8 @@ const u = a("guido-config", {
151
134
  */
152
135
  // eslint-disable-next-line @stylistic/max-len
153
136
  isFeatureEnabled: (i) => (e) => {
154
- var t, n;
155
- return ((n = (t = i.config) == null ? void 0 : t.features) == null ? void 0 : n[e]) ?? !1;
137
+ var n, t;
138
+ return ((t = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : t[e]) ?? !1;
156
139
  }
157
140
  },
158
141
  actions: {
@@ -172,5 +155,5 @@ const u = a("guido-config", {
172
155
  }
173
156
  });
174
157
  export {
175
- u as useConfigStore
158
+ f as useConfigStore
176
159
  };
@@ -1,78 +1,69 @@
1
- import { formatToLiquidFilter as b, quoteArgument as y, liquidFilterToFormat as h } from "./liquidDynamicContent.js";
2
- const g = (t) => {
3
- if (!t.includes("="))
4
- return null;
5
- const [r, e] = t.split("=");
6
- return { key: r.trim(), value: e.trim() };
7
- }, c = "default:", f = (t) => {
8
- if (!t.startsWith(c))
9
- return t;
10
- const r = t.slice(c.length).trim(), e = (l) => r.length >= 2 && r.startsWith(l) && r.endsWith(l);
11
- return e('"') || e("'") ? r.slice(1, -1) : r;
12
- }, k = (t) => {
13
- const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [l] = e, s = {
1
+ const o = (t) => {
2
+ const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
14
3
  text: t.label,
15
- value: l || ""
4
+ value: s || ""
16
5
  };
17
- if (e.length >= 2) {
18
- const [, a, n] = e;
19
- if (a.startsWith(c))
20
- s.fallback = f(a);
21
- else {
22
- const o = h(a) ?? g(a);
23
- o ? s.format = o : n || (s.fallback = a), n && (s.fallback = f(n));
6
+ if (a.length >= 2) {
7
+ const [, l, e] = a;
8
+ if (l.startsWith("default:")) {
9
+ let n = l.slice(8).trim();
10
+ n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
11
+ } else {
12
+ const n = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
13
+ n ? r.format = n : e || (r.fallback = l), e && (r.fallback = e);
24
14
  }
25
15
  }
26
- return s;
27
- }, p = (t) => {
28
- const e = !Number.isNaN(Number(t)) && t.trim() !== "" ? t : y(t);
29
- return e === null ? null : `${c} ${e}`;
30
- }, v = (t) => {
31
- const r = t.format ? b(t.format) : null, e = t.fallback ? p(t.fallback) : null, l = [t.value, r, e].filter(Boolean);
16
+ return r;
17
+ }, f = (t, c = !1) => t.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 (c) {
24
+ if (!a.fallback)
25
+ return {
26
+ label: a.text,
27
+ value: `{{ ${a.value} }}`
28
+ };
29
+ const r = !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: ${r} }}`
33
+ };
34
+ }
32
35
  return {
33
- label: [t.text, r, e && t.fallback].filter(Boolean).join(" | "),
34
- value: `{{ ${l.join(" | ")} }}`
36
+ label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
37
+ value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
35
38
  };
36
- }, i = (t, r = !1) => t.map((e) => r ? v(e) : e.format ? {
37
- label: `${e.text} | ${e.format.key}=${e.format.value}`,
38
- value: `{{${e.value}|${e.format.key}=${e.format.value}}}`
39
- } : {
40
- label: e.fallback ? `${e.text} | ${e.fallback}` : e.text,
41
- value: e.fallback ? `{{${e.value}|${e.fallback}}}` : `{{${e.value}}}`
42
- }), $ = (t) => {
43
- const r = [], e = /* @__PURE__ */ new Set(), l = (a) => {
44
- Array.isArray(a) && a.forEach((n) => {
45
- const o = [...n.children ?? [], ...n.select_items ?? []];
46
- if (o.length > 0) {
47
- l(o);
39
+ }), b = (t) => {
40
+ const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
41
+ Array.isArray(l) && l.forEach((e) => {
42
+ const n = [...e.children ?? [], ...e.select_items ?? []];
43
+ if (n.length > 0) {
44
+ s(n);
48
45
  return;
49
46
  }
50
- const u = n.text || n.tag_text;
51
- u && n.value && !e.has(n.value) && (e.add(n.value), r.push({ text: u, value: n.value }));
47
+ const u = e.text || e.tag_text;
48
+ u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
52
49
  });
53
- }, [s] = Object.values(t ?? {});
54
- return l(s), r;
55
- }, d = (t, r, e = !1) => {
56
- const l = new Set(t.map((a) => a.value)), s = r.filter((a) => l.has(a.value) ? !1 : (l.add(a.value), !0));
50
+ }, [r] = Object.values(t ?? {});
51
+ return s(r), c;
52
+ }, i = (t, c, a = !1) => {
53
+ const s = new Set(t.map((l) => l.value)), r = c.filter((l) => s.has(l.value) ? !1 : (s.add(l.value), !0));
57
54
  return [
58
- ...i(t, e),
59
- ...i(s, e)
55
+ ...f(t, a),
56
+ ...f(r, a)
60
57
  ];
61
- }, F = () => {
58
+ }, v = () => {
62
59
  var t;
63
60
  return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
64
- }, T = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", x = (t) => {
65
- if (t === null || typeof t != "object" || Array.isArray(t))
66
- return !1;
67
- const r = Object.getPrototypeOf(t);
68
- return r === Object.prototype || r === null;
69
- };
61
+ }, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
70
62
  export {
71
- T as asText,
72
- d as buildMergeTagEntries,
73
- i as dynamicContentToMergeTags,
74
- $ as flattenDynamicContentList,
75
- F as getCsrfToken,
76
- x as isPlainObject,
77
- k as mergeTagToDynamicContent
63
+ k as asText,
64
+ i as buildMergeTagEntries,
65
+ f as dynamicContentToMergeTags,
66
+ b as flattenDynamicContentList,
67
+ v as getCsrfToken,
68
+ o as mergeTagToDynamicContent
78
69
  };