@useinsider/guido 3.18.1-beta.5cddb72 → 3.18.1-beta.636c82d

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 +1 -1
  2. package/dist/components/Guido.vue2.js +46 -52
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +72 -56
  5. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  6. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  7. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
  8. package/dist/composables/useActionsApi.js +20 -24
  9. package/dist/composables/useCortexBlueprintBridge.js +54 -113
  10. package/dist/composables/useEmailTemplateApplier.js +50 -93
  11. package/dist/composables/useTranslations.js +8 -15
  12. package/dist/enums/extensions/recommendationBlock.js +38 -31
  13. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +35 -31
  14. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +129 -68
  15. package/dist/guido.css +1 -1
  16. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  17. package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -4
  18. package/dist/src/composables/useEmailTemplateApplier.d.ts +2 -22
  19. package/dist/src/composables/useTranslations.d.ts +0 -5
  20. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  21. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -0
  22. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +49 -0
  23. package/dist/src/stores/guido-email-editor.d.ts +7 -29
  24. package/dist/src/stores/onboarding.d.ts +377 -0
  25. package/dist/static/styles/components/recommendation-strategy.css.js +21 -4
  26. package/dist/stores/guido-email-editor.js +1 -5
  27. package/dist/stores/onboarding.js +41 -36
  28. package/package.json +1 -1
@@ -1,21 +1,17 @@
1
1
  import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
2
2
  import { useToaster as y } from "./useToaster.js";
3
- const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
4
- const c = setTimeout(
5
- () => s(new Error(`${n} did not report completion within ${l}ms`)),
3
+ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
4
+ const w = setTimeout(
5
+ () => m(new Error(`${n} did not report completion within ${l}ms`)),
6
6
  l
7
- ), d = (r) => (t) => {
8
- clearTimeout(c), r(t);
7
+ ), p = (A) => (t) => {
8
+ clearTimeout(w), A(t);
9
9
  };
10
- try {
11
- w(d(A), d(s));
12
- } catch (r) {
13
- clearTimeout(c), s(r instanceof Error ? r : new Error(String(r)));
14
- }
10
+ u(p(T), p(m));
15
11
  }), I = () => {
16
- const { handleError: n } = y(), l = (t = {}) => p(
12
+ const { handleError: n } = y(), l = (t = {}) => s(
17
13
  "compileEmail",
18
- T,
14
+ d,
19
15
  (e, a) => {
20
16
  const o = { ...{
21
17
  minimize: !0,
@@ -36,9 +32,9 @@ const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
36
32
  forceAmp: !1,
37
33
  resetDataSavedFlag: !1,
38
34
  disableLineHeightsReplace: !0
39
- }, ...t }, u = {
40
- callback: (m, C, f, S, g) => {
41
- m ? a(m) : e({
35
+ }, ...t }, c = {
36
+ callback: (r, C, f, S, g) => {
37
+ r ? a(r) : e({
42
38
  html: C,
43
39
  ampHtml: f,
44
40
  ampErrors: v(S ?? []),
@@ -47,22 +43,22 @@ const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
47
43
  },
48
44
  ...o
49
45
  };
50
- window.StripoEditorApi.actionsApi.compileEmail(u);
46
+ window.StripoEditorApi.actionsApi.compileEmail(c);
51
47
  }
52
48
  );
53
49
  return {
54
50
  getCompiledEmail: l,
55
- getTemplateData: () => p(
51
+ getTemplateData: () => s(
56
52
  "getTemplateData",
57
- T,
53
+ d,
58
54
  (t) => {
59
- const e = ({ html: a, css: i, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
55
+ const e = ({ html: a, css: i, width: o, height: E, utmParams: c, syncModulesIds: r }) => t({
60
56
  html: a,
61
57
  css: i,
62
58
  width: o,
63
59
  height: E,
64
- utmParams: u,
65
- syncModulesIds: m
60
+ utmParams: c,
61
+ syncModulesIds: r
66
62
  });
67
63
  window.StripoEditorApi.actionsApi.getTemplateData(e);
68
64
  }
@@ -109,13 +105,13 @@ const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
109
105
  }),
110
106
  updateHtmlAndCss: (t, e) => {
111
107
  const { actionsApi: a } = window.StripoEditorApi;
112
- return p("updateHtmlAndCss", D, (i) => {
108
+ return s("updateHtmlAndCss", D, (i) => {
113
109
  a.updateHtmlAndCss(t, e, () => i());
114
110
  });
115
111
  },
116
- editorSave: () => p(
112
+ editorSave: () => s(
117
113
  "save",
118
- T,
114
+ d,
119
115
  (t) => {
120
116
  window.StripoEditorApi.actionsApi.save((e) => {
121
117
  if (e) {
@@ -1,129 +1,70 @@
1
- import { useEmailTemplateApplier as Y, resetEmailTemplateApplier as N } from "./useEmailTemplateApplier.js";
2
- import { useToaster as X } from "./useToaster.js";
3
- import { useTranslationWithFallback as j } from "./useTranslations.js";
4
- import { ToasterTypeOptions as z } from "../enums/toaster.js";
5
- import { useGuidoEmailEditorStore as J } from "../stores/guido-email-editor.js";
6
- import { getActivePinia as Q } from "pinia";
7
- import { onUnmounted as V, watch as W } from "vue";
8
- const Z = "email_template", tt = "chat", et = "guido:debug:ai", rt = 2, nt = 500, ot = (A, p) => `${A}:${p ?? 1}`;
9
- let S = null;
10
- const it = () => {
1
+ import { useEmailTemplateApplier as w, resetEmailTemplateApplier as _ } from "./useEmailTemplateApplier.js";
2
+ import { useToaster as I } from "./useToaster.js";
3
+ import { useTranslations as P } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as S } from "../enums/toaster.js";
5
+ import { getActivePinia as v } from "pinia";
6
+ import { watch as B, onUnmounted as D } from "vue";
7
+ const x = "email_template", L = "chat", M = "guido:debug:ai", R = () => {
11
8
  if (typeof window > "u")
12
9
  return !1;
13
10
  try {
14
- return window.localStorage.getItem(et) === "1";
11
+ return window.localStorage.getItem(M) === "1";
15
12
  } catch {
16
13
  return !1;
17
14
  }
18
- }, ft = () => {
19
- const A = Q();
20
- if (!A)
15
+ }, H = () => {
16
+ const c = v();
17
+ if (!c)
21
18
  return;
22
- const p = J(), _ = Symbol("cortexBlueprintBridge");
23
- S = _, p.$patch((t) => {
24
- t.bridgeActive = !0;
25
- });
26
- const { markPending: R, applyTemplate: q, applyTemplateDebounced: x } = Y(), { showToaster: C } = X(), H = j(), h = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), M = it();
27
- let T = null, b = null, f;
28
- const O = (t, e) => {
29
- M && console.debug(`[guido:cortex] msg=${t ?? "?"} type=${(e == null ? void 0 : e.type) ?? "?"}`, e);
30
- }, G = () => new Set((f == null ? void 0 : f.appliedBlueprintKeys) ?? []), K = (t) => t instanceof Error ? t.message : String(t), g = (t, e, o, r) => {
31
- const n = p.applyAcks[t], l = Math.max(Date.now(), ((n == null ? void 0 : n.ackAt) ?? 0) + 1), a = { status: e, requestedAt: o, ackAt: l };
32
- r !== void 0 && (a.error = K(r)), p.$patch((c) => {
33
- c.applyAcks = { ...c.applyAcks, [t]: a };
34
- });
35
- }, D = (t) => (d.get(t) ?? 0) > 0, m = async (t, e, o, r) => {
36
- var c, i, L;
37
- const n = ((c = o.blueprintData) == null ? void 0 : c.html) ?? "", l = ((i = o.blueprintData) == null ? void 0 : i.css) ?? "", a = o.applyRequestedAt ?? 0;
38
- d.set(t, (d.get(t) ?? 0) + 1);
39
- try {
40
- const s = r === "debounced" ? await x(e, { html: n, css: l }) : await q(e, { html: n, css: l });
41
- if (s.status === "superseded")
42
- return;
43
- if (s.status === "applied") {
44
- h.set(e, n), u.delete(t), g(t, "applied", a);
45
- return;
46
- }
47
- const w = u.get(t);
48
- u.set(t, { html: n, count: (w == null ? void 0 : w.html) === n ? w.count + 1 : 1 }), g(t, "failed", a, s.error);
49
- } finally {
50
- d.set(t, (d.get(t) ?? 1) - 1);
51
- const s = E.get(t);
52
- s && !D(t) && (E.delete(t), (((L = s.blueprintData) == null ? void 0 : L.html) ?? "") !== n && m(t, e, s, r));
53
- }
54
- }, U = (t) => {
55
- var c;
56
- if (t.blueprintType !== Z)
57
- return;
58
- const { blueprintId: e } = t, o = (c = t.blueprintData) == null ? void 0 : c.html;
59
- if (!e || !o)
19
+ const l = c._s, p = l == null ? void 0 : l.get(L);
20
+ if (!p)
21
+ return;
22
+ const { markPending: d, applyTemplate: f, applyTemplateDebounced: T } = w(), { showToaster: E } = I(), h = P(), y = (r, t) => {
23
+ const e = h(r);
24
+ return e === r ? t : e;
25
+ }, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), u = R(), A = (r, t) => {
26
+ u && console.debug(`[guido:cortex] msg=${r ?? "?"} type=${(t == null ? void 0 : t.type) ?? "?"}`, t);
27
+ }, b = (r) => {
28
+ if (r.blueprintType !== x)
60
29
  return;
61
- if (!t.applyRequested) {
62
- R(e);
30
+ const t = r.blueprintId, e = r.blueprintData;
31
+ if (!t || !(e != null && e.html))
63
32
  return;
64
- }
65
- const r = ot(e, t.version), n = t.applyRequestedAt ?? 0, l = v.get(r);
66
- if (l === void 0 || n > l) {
67
- const i = l === void 0;
68
- if (v.set(r, n), u.delete(r), i && G().has(r)) {
69
- h.set(e, o);
70
- return;
71
- }
72
- m(r, e, t, "immediate");
33
+ if (!r.applyRequested) {
34
+ d(t);
73
35
  return;
74
36
  }
75
- const a = h.get(e);
76
- if (a !== o) {
77
- if (a === void 0) {
78
- if (D(r)) {
79
- E.set(r, t);
80
- return;
81
- }
82
- const i = u.get(r);
83
- if ((i == null ? void 0 : i.html) === o && i.count >= rt)
84
- return;
85
- m(r, e, t, "immediate");
86
- return;
87
- }
88
- m(r, e, t, "debounced");
89
- }
90
- }, B = (t) => t === void 0 || y.has(t) ? !1 : (y.add(t), C({
91
- type: z.Error,
92
- message: H("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
93
- }), !0), k = (t) => {
94
- Array.isArray(t) && t.forEach((e) => {
95
- const o = e == null ? void 0 : e.id;
96
- (e == null ? void 0 : e.isError) === !0 && B(o) && M && console.debug(`[guido:cortex] message-level error id=${o}`, e);
97
- const r = e == null ? void 0 : e.segments;
98
- Array.isArray(r) && r.forEach((n) => {
99
- if (n)
100
- switch (O(o, n), n.type) {
101
- case "blueprint":
102
- U(n);
103
- break;
104
- case "error":
105
- B(o);
106
- break;
107
- }
37
+ const o = i.get(t);
38
+ o === void 0 ? (i.set(t, e.html), f(t, e)) : o !== e.html && (i.set(t, e.html), T(t, e));
39
+ }, s = (r) => r === void 0 || a.has(r) ? !1 : (a.add(r), E({
40
+ type: S.Error,
41
+ message: y("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
42
+ }), !0), m = B(
43
+ () => p.messages,
44
+ (r) => {
45
+ Array.isArray(r) && r.forEach((t) => {
46
+ const e = t == null ? void 0 : t.id;
47
+ (t == null ? void 0 : t.isError) === !0 && s(e) && u && console.debug(`[guido:cortex] message-level error id=${e}`, t);
48
+ const o = t == null ? void 0 : t.segments;
49
+ Array.isArray(o) && o.forEach((n) => {
50
+ if (n)
51
+ switch (A(e, n), n.type) {
52
+ case "blueprint":
53
+ b(n);
54
+ break;
55
+ case "error":
56
+ s(e);
57
+ break;
58
+ }
59
+ });
108
60
  });
109
- });
110
- }, P = () => {
111
- T !== null && (clearInterval(T), T = null);
112
- }, $ = () => {
113
- var t;
114
- return (t = A._s) == null ? void 0 : t.get(tt);
115
- }, F = (t) => {
116
- f = t, b = W(() => t.messages, k, { deep: !0, immediate: !0 });
117
- }, I = $();
118
- I ? F(I) : T = setInterval(() => {
119
- const t = $();
120
- t && (P(), F(t));
121
- }, nt), V(() => {
122
- P(), b == null || b(), f = void 0, h.clear(), v.clear(), u.clear(), d.clear(), E.clear(), y.clear(), S === _ && (S = null, p.$patch((t) => {
123
- t.bridgeActive = !1, t.applyAcks = {};
124
- }), N());
61
+ },
62
+ { deep: !0, immediate: !0 }
63
+ );
64
+ D(() => {
65
+ m(), i.clear(), a.clear(), _();
125
66
  });
126
67
  };
127
68
  export {
128
- ft as useCortexBlueprintBridge
69
+ H as useCortexBlueprintBridge
129
70
  };
@@ -1,102 +1,59 @@
1
- import { useActionsApi as Q } from "./useActionsApi.js";
2
- import { useConfig as x } from "./useConfig.js";
3
- import { useEditorLock as z } from "./useEditorLock.js";
4
- import { useToaster as F } from "./useToaster.js";
5
- import { useTranslationWithFallback as N } from "./useTranslations.js";
6
- import { ToasterTypeOptions as h } from "../enums/toaster.js";
7
- import { useDynamicContentStore as q } from "../stores/dynamic-content.js";
8
- import { useEditorStore as R } from "../stores/editor.js";
9
- import { flattenDynamicContentList as G } from "../utils/genericUtil.js";
10
- import { extractUsedDynamicContent as W } from "../utils/registerUsedDynamicContent.js";
11
- import { ref as $, watch as j } from "vue";
12
- const J = 250, D = 12e4, c = { status: "superseded" }, S = { status: "failed", error: new Error("Blueprint has no html to apply") }, i = $({}), v = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), ie = () => {
13
- const { updateHtmlAndCss: a } = Q(), { runExclusive: M } = z(), { showToaster: d } = F(), y = N(), { template: U } = x(), A = q(), T = R(), E = (e, t) => {
14
- u.get(e) !== t && (u.set(e, t), d({
15
- type: h.Error,
16
- message: y("newsletter.ai-template-failed-apply", "Failed to apply template")
17
- }));
18
- }, O = () => {
19
- var e, t;
20
- return T.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
21
- }, P = (e) => {
22
- i.value[e] === void 0 && (i.value = { ...i.value, [e]: "pending" });
23
- }, m = (e, t) => {
24
- i.value = { ...i.value, [e]: t };
25
- }, _ = (e) => {
26
- var t;
1
+ import { useActionsApi as C } from "./useActionsApi.js";
2
+ import { useConfig as h } from "./useConfig.js";
3
+ import { useToaster as D } from "./useToaster.js";
4
+ import { useTranslations as E } from "./useTranslations.js";
5
+ import { ToasterTypeOptions as f } from "../enums/toaster.js";
6
+ import { useDynamicContentStore as A } from "../stores/dynamic-content.js";
7
+ import { flattenDynamicContentList as w } from "../utils/genericUtil.js";
8
+ import { extractUsedDynamicContent as S } from "../utils/registerUsedDynamicContent.js";
9
+ import { ref as O } from "vue";
10
+ const U = 250, o = O({}), s = {}, u = /* @__PURE__ */ new Map(), z = () => {
11
+ const { updateHtmlAndCss: r } = C(), { showToaster: m } = D(), y = E(), { template: T } = h(), d = A(), g = (e, t) => {
12
+ const a = y(e);
13
+ return a === e ? t : a;
14
+ }, v = (e) => {
15
+ o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
16
+ }, l = (e, t, a) => {
17
+ var c;
18
+ o.value = { ...o.value, [e]: "applying" };
27
19
  try {
28
- const o = G((t = U.value) == null ? void 0 : t.dynamicContentList), s = W(e, o);
29
- s.length > 0 && A.registerDynamicContent(s);
30
- } catch {
31
- }
32
- }, k = (e, t) => {
33
- u.delete(e), v.get(e) !== t && (v.set(e, t), d({
34
- type: h.Success,
35
- message: y("newsletter.ai-template-applied", "Template applied to the editor")
36
- }));
37
- }, g = async (e, t, o) => {
38
- const s = (l.get(e) ?? 0) + 1;
39
- l.set(e, s), m(e, "applying");
40
- try {
41
- await M(() => a(t, o));
20
+ r(t, a).catch((n) => {
21
+ console.warn("Editor did not acknowledge the template apply.", n);
22
+ }), o.value = { ...o.value, [e]: "applied" };
23
+ try {
24
+ const n = w((c = T.value) == null ? void 0 : c.dynamicContentList), i = S(t, n);
25
+ i.length > 0 && d.registerDynamicContent(i);
26
+ } catch {
27
+ }
28
+ u.get(e) !== t && (u.set(e, t), m({
29
+ type: f.Success,
30
+ message: g("newsletter.ai-template-applied", "Template applied to the editor")
31
+ }));
42
32
  } catch (n) {
43
- return l.get(e) !== s ? c : (console.error("[guido:apply] editor did not acknowledge the template apply", n), m(e, "failed"), E(e, t), { status: "failed", error: n });
44
- }
45
- return l.get(e) !== s ? c : (m(e, "applied"), _(t), k(e, t), { status: "applied" });
46
- }, H = (e) => {
47
- const t = r.get(e);
48
- t && (clearTimeout(t.timer), r.delete(e), t.settle(c));
49
- }, w = (e) => {
50
- const t = p.get(e);
51
- t && (clearTimeout(t.timer), p.delete(e), t.settle(c));
52
- }, B = (e, t, o) => new Promise((s) => {
53
- H(e);
54
- const n = setTimeout(() => {
55
- r.delete(e), m(e, "failed"), E(e, t), s({
56
- status: "failed",
57
- error: new Error(`Editor did not become ready within ${D}ms`)
33
+ o.value = { ...o.value, [e]: "failed" }, m({
34
+ type: f.Error,
35
+ message: n instanceof Error ? n.message : "Failed to apply template"
58
36
  });
59
- }, D);
60
- r.set(e, { html: t, css: o, timer: n, settle: s }), m(e, "applying");
61
- }), C = (e, t, o) => O() ? g(e, t, o) : B(e, t, o), L = async () => {
62
- if (r.size === 0)
63
- return;
64
- const e = [...r.entries()];
65
- r.clear(), e.forEach(([, n]) => clearTimeout(n.timer));
66
- const t = e.pop();
67
- if (e.forEach(([n, f]) => {
68
- m(n, "pending"), f.settle(c);
69
- }), !t)
70
- return;
71
- const [o, s] = t;
72
- s.settle(await g(o, s.html, s.css));
37
+ }
38
+ }, p = (e) => {
39
+ const t = s[e];
40
+ t && (clearTimeout(t), delete s[e]);
73
41
  };
74
- return j(() => T.isStripoInitialized, (e) => {
75
- e && L();
76
- }, { immediate: !0 }), { applyStatus: i, markPending: P, applyTemplate: (e, t) => {
77
- const { html: o } = t;
78
- return o ? (w(e), C(e, o, t.css ?? "")) : Promise.resolve(S);
42
+ return { applyStatus: o, markPending: v, applyTemplate: (e, t) => {
43
+ t.html && (p(e), l(e, t.html, t.css ?? ""));
79
44
  }, applyTemplateDebounced: (e, t) => {
80
- const { html: o } = t;
81
- if (!o)
82
- return Promise.resolve(S);
83
- const s = t.css ?? "";
84
- return new Promise((n) => {
85
- w(e);
86
- const f = setTimeout(() => {
87
- p.delete(e), C(e, o, s).then(n);
88
- }, J);
89
- p.set(e, { timer: f, settle: n });
90
- });
45
+ if (!t.html)
46
+ return;
47
+ p(e);
48
+ const { html: a } = t, c = t.css ?? "";
49
+ s[e] = setTimeout(() => {
50
+ delete s[e], l(e, a, c);
51
+ }, U);
91
52
  } };
92
- }, ce = () => {
93
- p.forEach((a) => {
94
- clearTimeout(a.timer), a.settle(c);
95
- }), p.clear(), r.forEach((a) => {
96
- clearTimeout(a.timer), a.settle(c);
97
- }), r.clear(), l.clear(), u.clear(), i.value = {};
53
+ }, G = () => {
54
+ Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((r) => delete s[r]), o.value = {};
98
55
  };
99
56
  export {
100
- ce as resetEmailTemplateApplier,
101
- ie as useEmailTemplateApplier
57
+ G as resetEmailTemplateApplier,
58
+ z as useEmailTemplateApplier
102
59
  };
@@ -4,26 +4,19 @@ import memoize from "../node_modules/lodash-es/memoize.js";
4
4
  import { ref } from "vue";
5
5
  import { useConfig } from "./useConfig.js";
6
6
  const useTranslations = () => {
7
- var o, r;
8
- const { config } = useConfig(), translationsPath = ((r = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : r.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (n, t) => {
9
- const s = translations.value[n];
10
- return s ? t ? Object.entries(t).reduce(
11
- (e, [a, i]) => e.replace(new RegExp(`{${a}}`, "g"), String(i)),
12
- s
13
- ) : s : (console.warn(`Translation key not found: ${n}`), n);
7
+ var o, e;
8
+ const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
9
+ const r = translations.value[t];
10
+ return r ? n ? Object.entries(n).reduce(
11
+ (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
12
+ r
13
+ ) : r : (console.warn(`Translation key not found: ${t}`), t);
14
14
  };
15
15
  return memoize(
16
16
  trans,
17
- (n, t) => !t || Object.keys(t).length === 0 ? n : JSON.stringify({ key: n, params: t })
17
+ (t, n) => !n || Object.keys(n).length === 0 ? t : JSON.stringify({ key: t, params: n })
18
18
  );
19
- }, useTranslationWithFallback = () => {
20
- const o = useTranslations();
21
- return (r, n) => {
22
- const t = o(r);
23
- return t === r ? n : t;
24
- };
25
19
  };
26
20
  export {
27
- useTranslationWithFallback,
28
21
  useTranslations
29
22
  };
@@ -1,14 +1,20 @@
1
- import { useTranslations as r } from "../../composables/useTranslations.js";
2
- const l = {
1
+ import { useTranslations as n } from "../../composables/useTranslations.js";
2
+ const o = {
3
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
5
  PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
6
  RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
- RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
8
- }, c = {
7
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
8
+ // Smart Recommender hides the Email channel unless the URL asks for it, so a strategy created
9
+ // without this flag can never be Email-suitable and would never reach the editor's list.
10
+ RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
11
+ }, d = (e) => {
12
+ const { RECOMMENDATION_STRATEGIES_PANEL_PATH: r } = o;
13
+ return `${r}/${e}/edit`;
14
+ }, m = {
9
15
  CLIENT_ID: "clientId"
10
- }, d = () => {
11
- const e = r();
16
+ }, p = () => {
17
+ const e = n();
12
18
  return [
13
19
  {
14
20
  id: 11,
@@ -71,14 +77,14 @@ const l = {
71
77
  path: "top-sellers"
72
78
  }
73
79
  ];
74
- }, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
80
+ }, v = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], h = [
75
81
  { text: "before the amount", value: "0" },
76
82
  { text: "after the amount", value: "1" }
77
- ], v = [
83
+ ], x = [
78
84
  { text: "dot(.)", value: "." },
79
85
  { text: "comma(,)", value: "," },
80
86
  { text: "space( )", value: " " }
81
- ], h = [
87
+ ], b = [
82
88
  { text: "0", value: "0" },
83
89
  { text: "1", value: "1" },
84
90
  { text: "2", value: "2" },
@@ -90,54 +96,55 @@ const l = {
90
96
  { text: "contains", value: "~" },
91
97
  { text: "does not contain", value: "!~" },
92
98
  { text: "any of", value: a }
93
- ], n = [
99
+ ], s = [
94
100
  { text: "is exactly", value: "=" },
95
101
  { text: "is not exactly", value: "!==" },
96
102
  { text: "contains", value: "~" },
97
103
  { text: "does not contain", value: "!~" },
98
104
  { text: "any of", value: a }
99
- ], o = [
105
+ ], i = [
100
106
  { text: "is equal to", value: "=" },
101
107
  { text: "is greater than", value: ">" },
102
108
  { text: "is less than", value: "<" }
103
- ], s = [
109
+ ], u = [
104
110
  { text: "is equal to", value: "=" },
105
111
  { text: "after", value: ">" },
106
112
  { text: "before", value: "<" }
107
- ], i = [
113
+ ], c = [
108
114
  { text: "true", value: "==" },
109
115
  { text: "false", value: "!=" }
110
- ], x = (e) => {
116
+ ], g = (e) => {
111
117
  if (!e)
112
118
  return t;
113
119
  switch (e) {
114
120
  case "Boolean":
115
- return i;
121
+ return c;
116
122
  case "Date":
117
- return s;
123
+ return u;
118
124
  case "Number":
119
- return o;
125
+ return i;
120
126
  case "String":
121
127
  return t;
122
128
  case "Strings":
123
- return n;
129
+ return s;
124
130
  default:
125
131
  return t;
126
132
  }
127
133
  };
128
134
  export {
129
135
  a as OP_ANY_OF,
130
- m as PriceAttributes,
131
- c as QUERY_PARAMS,
132
- l as URLS,
133
- h as currencyDecimalCounts,
134
- p as currencyLocationMaps,
135
- v as currencyOperators,
136
- x as getOperatorOptions,
137
- d as getRecommendationFeedSourceMaps,
138
- n as operatorOptionsForArrayOfStrings,
139
- i as operatorOptionsForBooleans,
140
- s as operatorOptionsForDates,
141
- o as operatorOptionsForNumbers,
142
- t as operatorOptionsForStrings
136
+ v as PriceAttributes,
137
+ m as QUERY_PARAMS,
138
+ o as URLS,
139
+ b as currencyDecimalCounts,
140
+ h as currencyLocationMaps,
141
+ x as currencyOperators,
142
+ g as getOperatorOptions,
143
+ p as getRecommendationFeedSourceMaps,
144
+ s as operatorOptionsForArrayOfStrings,
145
+ c as operatorOptionsForBooleans,
146
+ u as operatorOptionsForDates,
147
+ i as operatorOptionsForNumbers,
148
+ t as operatorOptionsForStrings,
149
+ d as strategyEditPath
143
150
  };