@useinsider/guido 3.18.3-beta.ec88281 → 3.19.0-beta.f02eaa1

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 (63) hide show
  1. package/README.md +41 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +55 -53
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -49
  7. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  8. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  9. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  11. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  12. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  13. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  14. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
  15. package/dist/composables/useCustomInterfaceAppearance.js +46 -42
  16. package/dist/composables/useGuidoStateBridge.js +29 -24
  17. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  18. package/dist/composables/useStripo.js +7 -7
  19. package/dist/enums/extensions/recommendationBlock.js +40 -31
  20. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +4 -4
  21. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +77 -76
  22. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -28
  23. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
  24. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +6 -3
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +110 -46
  26. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  27. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  28. package/dist/guido.css +1 -1
  29. package/dist/library.js +15 -13
  30. package/dist/package.json.js +1 -1
  31. package/dist/public/editorState.js +4 -0
  32. package/dist/services/recommendationApi.js +46 -37
  33. package/dist/src/@types/config/schemas.d.ts +16 -0
  34. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  35. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  36. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  37. package/dist/src/composables/useConfig.d.ts +4 -0
  38. package/dist/src/composables/useGuidoStateBridge.d.ts +11 -7
  39. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  40. package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +70 -1
  44. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  45. package/dist/src/library.d.ts +2 -0
  46. package/dist/src/public/editorState.d.ts +14 -0
  47. package/dist/src/public/trackingIds.d.ts +6 -2
  48. package/dist/src/services/recommendationApi.d.ts +2 -1
  49. package/dist/src/stores/config.d.ts +322 -0
  50. package/dist/src/stores/editor.d.ts +25 -0
  51. package/dist/src/stores/guido-email-editor.d.ts +27 -27
  52. package/dist/src/stores/onboarding.d.ts +808 -10
  53. package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
  54. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  55. package/dist/static/assets/icons/line-info.svg.js +5 -0
  56. package/dist/static/styles/components/recommendation-strategy.css.js +70 -5
  57. package/dist/stores/config.js +74 -60
  58. package/dist/stores/editor.js +4 -0
  59. package/dist/stores/guido-email-editor.js +0 -4
  60. package/dist/stores/onboarding.js +46 -36
  61. package/dist/utils/genericUtil.js +64 -61
  62. package/dist/utils/liquidDynamicContent.js +15 -0
  63. package/package.json +10 -6
@@ -1,75 +1,78 @@
1
- const o = (a) => {
2
- const t = a.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((e) => e.trim()), [s] = t, r = {
3
- text: a.label,
4
- value: s || ""
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 = {
14
+ text: t.label,
15
+ value: l || ""
5
16
  };
6
- if (t.length >= 2) {
7
- const [, e, l] = t;
8
- if (e.startsWith("default:")) {
9
- let n = e.slice(8).trim();
10
- n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
11
- } else {
12
- const n = e.includes("=") ? { key: e.split("=")[0].trim(), value: e.split("=")[1].trim() } : null;
13
- n ? r.format = n : l || (r.fallback = e), l && (r.fallback = l);
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));
14
24
  }
15
25
  }
16
- return r;
17
- }, u = (a, c = !1) => a.map((t) => {
18
- if (t.format)
19
- return {
20
- label: `${t.text} | ${t.format.key}=${t.format.value}`,
21
- value: `{{${t.value}|${t.format.key}=${t.format.value}}}`
22
- };
23
- if (c) {
24
- if (!t.fallback)
25
- return {
26
- label: t.text,
27
- value: `{{ ${t.value} }}`
28
- };
29
- const r = !Number.isNaN(Number(t.fallback)) && t.fallback.trim() !== "" ? t.fallback : `"${t.fallback}"`;
30
- return {
31
- label: `${t.text} | ${t.fallback}`,
32
- value: `{{ ${t.value} | default: ${r} }}`
33
- };
34
- }
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);
35
32
  return {
36
- label: t.fallback ? `${t.text} | ${t.fallback}` : t.text,
37
- value: t.fallback ? `{{${t.value}|${t.fallback}}}` : `{{${t.value}}}`
33
+ label: [t.text, r, e && t.fallback].filter(Boolean).join(" | "),
34
+ value: `{{ ${l.join(" | ")} }}`
38
35
  };
39
- }), b = (a) => {
40
- const c = [], t = /* @__PURE__ */ new Set(), s = (e) => {
41
- Array.isArray(e) && e.forEach((l) => {
42
- const n = [...l.children ?? [], ...l.select_items ?? []];
43
- if (n.length > 0) {
44
- s(n);
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);
45
48
  return;
46
49
  }
47
- const f = l.text || l.tag_text;
48
- f && l.value && !t.has(l.value) && (t.add(l.value), c.push({ text: f, value: l.value }));
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 }));
49
52
  });
50
- }, [r] = Object.values(a ?? {});
51
- return s(r), c;
52
- }, i = (a, c, t = !1) => {
53
- const s = new Set(a.map((e) => e.value)), r = c.filter((e) => s.has(e.value) ? !1 : (s.add(e.value), !0));
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));
54
57
  return [
55
- ...u(a, t),
56
- ...u(r, t)
58
+ ...i(t, e),
59
+ ...i(s, e)
57
60
  ];
58
- }, k = () => {
59
- var a;
60
- return ((a = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : a.getAttribute("content")) ?? "";
61
- }, v = (a) => typeof a == "string" ? a : typeof a == "number" ? String(a) : "", y = (a) => {
62
- if (a === null || typeof a != "object" || Array.isArray(a))
61
+ }, F = () => {
62
+ var t;
63
+ 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))
63
66
  return !1;
64
- const c = Object.getPrototypeOf(a);
65
- return c === Object.prototype || c === null;
67
+ const r = Object.getPrototypeOf(t);
68
+ return r === Object.prototype || r === null;
66
69
  };
67
70
  export {
68
- v as asText,
69
- i as buildMergeTagEntries,
70
- u as dynamicContentToMergeTags,
71
- b as flattenDynamicContentList,
72
- k as getCsrfToken,
73
- y as isPlainObject,
74
- o as mergeTagToDynamicContent
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
75
78
  };
@@ -0,0 +1,15 @@
1
+ const E = "time-format", r = "date", u = new RegExp(`^${r}\\s*:\\s*(?:"([^"]*)"|'([^']*)')$`), s = /%[-_0^#]?\d*[a-zA-Z%]/, c = new RegExp(s, "g"), l = /\b(?:Y{2,4}|M{2,4}|D{1,4}|d{3,4}|H{2}|h{2}|m{2}|s{2}|S{1,3}|A|a)\b/, T = (t) => t.includes('"') ? t.includes("'") ? null : `'${t}'` : `"${t}"`, i = (t) => s.test(t) && !l.test(t.replace(c, "")), R = (t) => {
2
+ if (t.key !== E || !i(t.value ?? ""))
3
+ return null;
4
+ const n = T(t.value);
5
+ return n === null ? null : `${r}: ${n}`;
6
+ }, _ = (t) => {
7
+ const [, n, o] = t.match(u) ?? [], e = n ?? o;
8
+ return e ? { key: E, value: e } : null;
9
+ };
10
+ export {
11
+ E as TIME_FORMAT_KEY,
12
+ R as formatToLiquidFilter,
13
+ _ as liquidFilterToFormat,
14
+ T as quoteArgument
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.18.3-beta.ec88281",
3
+ "version": "3.19.0-beta.f02eaa1",
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",
@@ -18,6 +18,10 @@
18
18
  "types": "./dist/src/public/trackingIds.d.ts",
19
19
  "import": "./dist/public/trackingIds.js"
20
20
  },
21
+ "./editor-state": {
22
+ "types": "./dist/src/public/editorState.d.ts",
23
+ "import": "./dist/public/editorState.js"
24
+ },
21
25
  "./style": "./dist/guido.css"
22
26
  },
23
27
  "scripts": {
@@ -77,7 +81,7 @@
77
81
  "@typescript-eslint/parser": "7.18.0",
78
82
  "@useinsider/eslint-config": "1.5.3",
79
83
  "@vitejs/plugin-vue2": "2.3.1",
80
- "@vitest/coverage-v8": "2.1.9",
84
+ "@vitest/coverage-v8": "4.1.11",
81
85
  "eslint": "8.57.1",
82
86
  "eslint-config-airbnb-base": "15.0.0",
83
87
  "eslint-config-airbnb-typescript": "18.0.0",
@@ -90,17 +94,17 @@
90
94
  "happy-dom": "15.11.7",
91
95
  "husky": "9.1.7",
92
96
  "msw": "2.10.3",
93
- "nyc": "17.1.0",
97
+ "nyc": "18.0.0",
94
98
  "sass": "1.69.7",
95
99
  "typescript": "5.5.4",
96
100
  "typescript-eslint": "8.26.0",
97
101
  "vite-plugin-dts": "4.5.4",
98
102
  "vite-plugin-istanbul": "7.0.0",
99
- "vitest": "2.1.9",
103
+ "vitest": "4.1.11",
100
104
  "vue-tsc": "2.2.10"
101
105
  },
102
106
  "overrides": {
103
- "axios": "1.8.2",
107
+ "axios": "1.20.0",
104
108
  "flatted": "3.4.2",
105
109
  "micromatch": "4.0.8",
106
110
  "path-to-regexp": "6.3.0"
@@ -118,7 +122,7 @@
118
122
  },
119
123
  "guido": {
120
124
  "stripo": {
121
- "version": "2.76.0"
125
+ "version": "2.77.0"
122
126
  }
123
127
  }
124
128
  }