@useinsider/guido 3.17.0-beta.24a776b → 3.17.0-beta.2ff8586

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 (54) hide show
  1. package/README.md +5 -6
  2. package/dist/@types/config/schemas.js +6 -12
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +63 -66
  5. package/dist/composables/useConfig.js +30 -37
  6. package/dist/composables/useCustomInterfaceAppearance.js +38 -52
  7. package/dist/composables/useRecommendation.js +41 -49
  8. package/dist/config/migrator/recommendation/settingsMapper.js +17 -19
  9. package/dist/config/migrator/recommendationMigrator.js +37 -56
  10. package/dist/enums/academy.js +1 -2
  11. package/dist/enums/date.js +3 -4
  12. package/dist/enums/extensions/recommendationBlock.js +1 -4
  13. package/dist/extensions/Blocks/Recommendation/block.js +21 -26
  14. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -36
  15. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
  16. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +154 -151
  17. package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
  18. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +109 -248
  19. package/dist/extensions/Blocks/common-control.js +19 -22
  20. package/dist/guido.css +1 -1
  21. package/dist/services/recommendationApi.js +30 -72
  22. package/dist/src/@types/config/schemas.d.ts +0 -12
  23. package/dist/src/composables/useConfig.d.ts +0 -3
  24. package/dist/src/composables/useRecommendation.d.ts +0 -1
  25. package/dist/src/enums/academy.d.ts +0 -1
  26. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  27. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -7
  28. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  29. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -9
  30. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -204
  31. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
  32. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  33. package/dist/src/services/recommendationApi.d.ts +1 -4
  34. package/dist/src/stores/config.d.ts +0 -18
  35. package/dist/src/stores/template.d.ts +0 -14
  36. package/dist/src/utils/liquidDynamicContent.d.ts +18 -0
  37. package/dist/stores/template.js +8 -13
  38. package/dist/utils/dateUtil.js +10 -23
  39. package/dist/utils/genericUtil.js +49 -38
  40. package/dist/utils/liquidDynamicContent.js +9 -0
  41. package/dist/utils/templatePreparation.js +34 -37
  42. package/package.json +2 -3
  43. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
  44. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -65
  45. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -136
  46. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -29
  48. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -63
  49. package/dist/src/utils/strategyInfoBox.d.ts +0 -18
  50. package/dist/static/assets/icons/line-change.svg.js +0 -5
  51. package/dist/static/assets/icons/line-delete.svg.js +0 -5
  52. package/dist/static/assets/icons/line-plus.svg.js +0 -5
  53. package/dist/static/styles/components/recommendation-strategy.css.js +0 -172
  54. package/dist/utils/strategyInfoBox.js +0 -37
@@ -1,19 +1,10 @@
1
- import { DEFAULT_LOCALE as n, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
2
- const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 && !Number.isNaN(Number(t)) ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
1
+ import { DEFAULT_LOCALE as r, DEFAULT as o } from "../enums/date.js";
2
+ const c = () => {
3
3
  const t = window.l10n;
4
- return (t == null ? void 0 : t.locale) === a ? n : (t == null ? void 0 : t.locale) || n;
5
- }, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
6
- const t = window.l10n;
7
- return (t == null ? void 0 : t.timezone) || u || c;
8
- }, D = (t, e = s(), r = f()) => {
9
- const o = {
10
- year: "numeric",
11
- month: "2-digit",
12
- day: "2-digit",
13
- timeZone: r
14
- }, i = m(t);
15
- return new Intl.DateTimeFormat(e, o).format(i);
16
- }, T = (t) => {
4
+ return (t == null ? void 0 : t.locale) === o ? r : (t == null ? void 0 : t.locale) || r;
5
+ };
6
+ new Intl.DateTimeFormat().resolvedOptions().timeZone;
7
+ const i = (t) => {
17
8
  if (!t)
18
9
  return "";
19
10
  const e = new Date(t);
@@ -25,13 +16,9 @@ const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length ===
25
16
  second: "2-digit",
26
17
  hour12: !1
27
18
  }).format(e);
28
- }, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
19
+ }, m = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
29
20
  export {
30
- m as convertToDateObject,
31
- T as formatPatchDate,
32
- D as formatShortDate,
33
- h as isAfterDate,
34
- u as localTz,
35
- s as locale,
36
- f as timezone
21
+ i as formatPatchDate,
22
+ m as isAfterDate,
23
+ c as locale
37
24
  };
@@ -1,68 +1,79 @@
1
- const o = (l) => {
2
- const a = l.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((t) => t.trim()), [c] = a, r = {
3
- text: l.label,
4
- value: c || ""
1
+ import { formatToLiquidFilter as o, liquidFilterToFormat as v } from "./liquidDynamicContent.js";
2
+ const b = (t) => {
3
+ if (!t.includes("="))
4
+ return null;
5
+ const [u, a] = t.split("=");
6
+ return { key: u.trim(), value: a.trim() };
7
+ }, k = (t) => {
8
+ const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [e] = a, n = {
9
+ text: t.label,
10
+ value: e || ""
5
11
  };
6
12
  if (a.length >= 2) {
7
- const [, t, e] = a;
8
- if (t.startsWith("default:")) {
9
- let n = t.slice(8).trim();
10
- n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
13
+ const [, l, r] = a;
14
+ if (l.startsWith("default:")) {
15
+ let c = l.slice(8).trim();
16
+ c.startsWith('"') && c.endsWith('"') && (c = c.slice(1, -1)), n.fallback = c;
11
17
  } else {
12
- const n = t.includes("=") ? { key: t.split("=")[0].trim(), value: t.split("=")[1].trim() } : null;
13
- n ? r.format = n : e || (r.fallback = t), e && (r.fallback = e);
18
+ const c = v(l) ?? b(l);
19
+ c ? n.format = c : r || (n.fallback = l), r && (n.fallback = r);
14
20
  }
15
21
  }
16
- return r;
17
- }, f = (l, s = !1) => l.map((a) => {
18
- if (a.format)
19
- return {
22
+ return n;
23
+ }, f = (t, u = !1) => t.map((a) => {
24
+ if (a.format) {
25
+ const e = u ? o(a.format) : null;
26
+ return e ? {
27
+ label: `${a.text} | ${e}`,
28
+ value: `{{ ${a.value} | ${e} }}`
29
+ } : {
20
30
  label: `${a.text} | ${a.format.key}=${a.format.value}`,
21
31
  value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
22
32
  };
23
- if (s) {
33
+ }
34
+ if (u) {
24
35
  if (!a.fallback)
25
36
  return {
26
37
  label: a.text,
27
38
  value: `{{ ${a.value} }}`
28
39
  };
29
- const r = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
40
+ const n = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
30
41
  return {
31
42
  label: `${a.text} | ${a.fallback}`,
32
- value: `{{ ${a.value} | default: ${r} }}`
43
+ value: `{{ ${a.value} | default: ${n} }}`
33
44
  };
34
45
  }
35
46
  return {
36
47
  label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
37
48
  value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
38
49
  };
39
- }), b = (l) => {
40
- const s = [], a = /* @__PURE__ */ new Set(), c = (t) => {
41
- Array.isArray(t) && t.forEach((e) => {
42
- const n = [...e.children ?? [], ...e.select_items ?? []];
43
- if (n.length > 0) {
44
- c(n);
50
+ }), $ = (t) => {
51
+ const u = [], a = /* @__PURE__ */ new Set(), e = (l) => {
52
+ Array.isArray(l) && l.forEach((r) => {
53
+ const c = [...r.children ?? [], ...r.select_items ?? []];
54
+ if (c.length > 0) {
55
+ e(c);
45
56
  return;
46
57
  }
47
- const u = e.text || e.tag_text;
48
- u && e.value && !a.has(e.value) && (a.add(e.value), s.push({ text: u, value: e.value }));
58
+ const s = r.text || r.tag_text;
59
+ s && r.value && !a.has(r.value) && (a.add(r.value), u.push({ text: s, value: r.value }));
49
60
  });
50
- }, [r] = Object.values(l ?? {});
51
- return c(r), s;
52
- }, v = (l, s, a = !1) => {
53
- const c = new Set(l.map((t) => t.value)), r = s.filter((t) => c.has(t.value) ? !1 : (c.add(t.value), !0));
61
+ }, [n] = Object.values(t ?? {});
62
+ return e(n), u;
63
+ }, h = (t, u, a = !1) => {
64
+ const e = new Set(t.map((l) => l.value)), n = u.filter((l) => e.has(l.value) ? !1 : (e.add(l.value), !0));
54
65
  return [
55
- ...f(l, a),
56
- ...f(r, a)
66
+ ...f(t, a),
67
+ ...f(n, a)
57
68
  ];
58
- }, i = () => {
59
- var l;
60
- return ((l = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : l.getAttribute("content")) ?? "";
69
+ }, d = () => {
70
+ var t;
71
+ return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
61
72
  };
62
73
  export {
63
- v as buildMergeTagEntries,
74
+ h as buildMergeTagEntries,
64
75
  f as dynamicContentToMergeTags,
65
- b as flattenDynamicContentList,
66
- i as getCsrfToken,
67
- o as mergeTagToDynamicContent
76
+ $ as flattenDynamicContentList,
77
+ d as getCsrfToken,
78
+ k as mergeTagToDynamicContent
68
79
  };
@@ -0,0 +1,9 @@
1
+ const n = "time-format", l = "date", o = new RegExp(`^${l}\\s*:\\s*"([^"]*)"$`), E = (t) => t.key === n && t.value ? `${l}: "${t.value}"` : null, s = (t) => {
2
+ const [, e] = t.match(o) ?? [];
3
+ return e ? { key: n, value: e } : null;
4
+ };
5
+ export {
6
+ n as TIME_FORMAT_KEY,
7
+ E as formatToLiquidFilter,
8
+ s as liquidFilterToFormat
9
+ };
@@ -1,7 +1,7 @@
1
1
  import { useActionsApi as k } from "../composables/useActionsApi.js";
2
2
  import { useConfig as U } from "../composables/useConfig.js";
3
3
  import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
4
- import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
5
  import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
6
  import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
7
7
  import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
@@ -11,20 +11,20 @@ import { useEditorStore as z } from "../stores/editor.js";
11
11
  import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
12
12
  import { assignTrackingIds as v } from "./linkTrackingIds.js";
13
13
  function O(m) {
14
- const i = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
- return i.forEach((s) => {
16
- const o = s.getAttribute(A.PAGE_LIST);
14
+ const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
+ return n.forEach((i) => {
16
+ const o = i.getAttribute(A.PAGE_LIST);
17
17
  o && t.push(...R(o));
18
18
  }), [...new Set(t)];
19
19
  }
20
20
  async function M(m) {
21
- const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
- if (n.length === 0)
21
+ const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
+ if (a.length === 0)
23
23
  return;
24
- const i = C();
25
- n.forEach((t) => {
24
+ const n = C();
25
+ a.forEach((t) => {
26
26
  var r, l, g, f, c;
27
- const s = t.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
27
+ const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
28
28
  if (!Number.isFinite(o))
29
29
  return;
30
30
  const p = t.getAttribute("esd-ext-config");
@@ -42,27 +42,24 @@ async function M(m) {
42
42
  // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
43
43
  // already-saved blocks that never re-run the migrator don't emit a
44
44
  // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
45
- strategy: L(e.strategy) || a.strategy,
46
- // esd-ext-config is the source of truth for the assigned RRS —
47
- // a strategy-backed block must survive save/reopen from it alone.
48
- strategyId: e.strategyId ?? a.strategyId,
49
- language: e.language ?? a.language,
50
- size: e.size ?? a.size,
45
+ strategy: L(e.strategy) || s.strategy,
46
+ language: e.language ?? s.language,
47
+ size: e.size ?? s.size,
51
48
  // Spread the default arrays so each block gets a fresh reference
52
49
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
53
- productIds: e.productIds ?? [...a.productIds],
54
- filters: e.filters ?? [...a.filters],
55
- shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
50
+ productIds: e.productIds ?? [...s.productIds],
51
+ filters: e.filters ?? [...s.filters],
52
+ shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
56
53
  currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
57
54
  currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
58
55
  currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
59
56
  currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
60
57
  currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
61
58
  };
62
- i.seedBlockUrlConfig(o, h);
59
+ n.seedBlockUrlConfig(o, h);
63
60
  });
64
61
  try {
65
- await i.fetchRecommendationCreateData();
62
+ await n.fetchRecommendationCreateData();
66
63
  } catch (t) {
67
64
  console.warn(
68
65
  "Recommendation reference data pre-load failed; validator will skip the availability check.",
@@ -71,39 +68,39 @@ async function M(m) {
71
68
  }
72
69
  }
73
70
  const Z = () => {
74
- const m = N(), u = z(), n = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
71
+ const m = N(), u = z(), a = _(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
75
72
  return {
76
73
  prepareTemplateDetails: async () => {
77
74
  let { html: r, css: l, syncModulesIds: g = [] } = await t();
78
75
  if (e("linkTrackingIds"))
79
76
  try {
80
- const { html: S, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
81
- u.trackIdSessionFloor = H, F && (r = S, await s(S, l));
82
- } catch (S) {
83
- console.error("Tracking-id step failed, saving anyway:", S);
77
+ const { html: y, changed: H, nextSeq: I } = v(r, u.trackIdSessionFloor);
78
+ u.trackIdSessionFloor = I, H && (r = y, await i(y, l));
79
+ } catch (y) {
80
+ console.error("Tracking-id step failed, saving anyway:", y);
84
81
  }
85
- const { html: f, ampHtml: c = "", ampErrors: T = [] } = await i({
82
+ const { html: f, ampHtml: c = "", ampErrors: T = [] } = await n({
86
83
  minimize: !0,
87
84
  resetDataSavedFlag: !1
88
85
  });
89
- n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
90
- const { compiledHtml: I, stats: y, appliedRules: w } = o(f), D = c && p(c).compiledHtml, E = m.getSelectedDynamicContentList, P = C(), b = O(r);
86
+ a.selectedUnsubscribePages.length && await a.fetchTemplates(), await M(r);
87
+ const { compiledHtml: w, stats: S, appliedRules: D } = o(f), E = c && p(c).compiledHtml, P = m.getSelectedDynamicContentList, F = C(), b = O(r);
91
88
  return console.debug("HTML Compilation Stats:", {
92
- originalSize: y.originalSize,
93
- compiledSize: y.compiledSize,
94
- reduction: `${y.reductionPercentage.toFixed(2)}%`,
95
- appliedRules: w,
96
- executionTime: `${y.executionTime.toFixed(2)}ms`
89
+ originalSize: S.originalSize,
90
+ compiledSize: S.compiledSize,
91
+ reduction: `${S.reductionPercentage.toFixed(2)}%`,
92
+ appliedRules: D,
93
+ executionTime: `${S.executionTime.toFixed(2)}ms`
97
94
  }), {
98
- dynamicContentList: E,
99
- compiledHtml: I,
95
+ dynamicContentList: P,
96
+ compiledHtml: w,
100
97
  rawHtml: r,
101
98
  css: l,
102
- ampHtml: D,
99
+ ampHtml: E,
103
100
  ampErrors: T,
104
101
  modules: g.map(Number),
105
102
  recommendation: {
106
- campaignUrls: P.recommendationCampaignUrls,
103
+ campaignUrls: F.recommendationCampaignUrls,
107
104
  configs: {}
108
105
  },
109
106
  unsubscribe: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.17.0-beta.24a776b",
3
+ "version": "3.17.0-beta.2ff8586",
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",
@@ -25,7 +25,7 @@
25
25
  "start": "vite",
26
26
  "build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
27
27
  "preview": "vite preview",
28
- "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
28
+ "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
29
29
  "lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
30
30
  "lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
31
31
  "lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
@@ -48,7 +48,6 @@
48
48
  "license": "ISC",
49
49
  "dependencies": {
50
50
  "@stripoinc/ui-editor-extensions": "3.9.0",
51
- "@useinsider/design-system-organisms": "0.0.3-beta.fc2c160",
52
51
  "@useinsider/design-system-vue": "1.5.0",
53
52
  "@vueuse/core": "11.3.0",
54
53
  "lodash-es": "4.17.21",
@@ -1,18 +0,0 @@
1
- import a from "./AssignStrategyDrawer.vue2.js";
2
- /* empty css */
3
- import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
5
- var s = this, e = s._self._c, t = s._self._setupProxy;
6
- return e(t.WpDrawer, { attrs: { id: "assign-strategy-drawer", "description-status": "", size: "medium", "description-text": t.drawerDescription, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.assignStrategyDrawerStatus, "title-text": t.trans("gpt-app-builder.assign-recommendation-strategy") }, on: { cancelOrBackButtonEvent: t.closeDrawer, onCloseEvent: t.closeDrawer, primaryButtonEvent: t.assignStrategy } }, [t.store.assignStrategyDrawerStatus ? e("div", { staticClass: "assign-strategy-drawer-content d-f f-d-c gap-16" }, [e(t.InSelect, { staticClass: "assign-strategy-select", attrs: { id: "assign-strategy-select", "search-status": "", "static-child-position": "bottom right", "button-status": !1, "dynamic-child-position": !1, "label-text": t.trans("ds-steps.recommendation-strategy"), options: t.strategyOptions, "placeholder-text": t.trans("ds-steps.select-strategy"), "skeleton-sizing": { width: 240, height: 42 }, "skeleton-status": t.store.strategiesLoading, state: t.showSelectionError ? "error" : "default", "state-message": t.showSelectionError ? t.trans("ds-steps.select-strategy-tooltip") : "", value: t.selectValue }, on: { select: t.onSelect } }), t.selectedStrategy ? e("div", { key: String(t.selectedStrategy.strategy_id), staticClass: "assign-strategy-detail" }, [e(t.OrgStrategyDetailModal, { attrs: { show: "", "campaign-details-tab-status": t.campaignTabSupported, "footer-status": !1, strategy: t.selectedStrategy } })], 1) : s._e()], 1) : s._e()]);
7
- }, n = [], i = /* @__PURE__ */ r(
8
- a,
9
- o,
10
- n,
11
- !1,
12
- null,
13
- "baee7af0"
14
- );
15
- const p = i.exports;
16
- export {
17
- p as default
18
- };
@@ -1,65 +0,0 @@
1
- import { defineComponent as d, ref as c, computed as o, watch as S } from "vue";
2
- import "@useinsider/design-system-organisms/style";
3
- import v from "../../../wrappers/WpDrawer.vue.js";
4
- import { useToaster as w } from "../../../../composables/useToaster.js";
5
- import { useTranslations as _ } from "../../../../composables/useTranslations.js";
6
- import { URLS as T } from "../../../../enums/extensions/recommendationBlock.js";
7
- import { ToasterTypeOptions as u } from "../../../../enums/toaster.js";
8
- import { useRecommendationExtensionStore as D } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { buildStrategyInfoBoxProps as E } from "../../../../utils/strategyInfoBox.js";
10
- import { OrgStrategyDetailModal as x } from "@useinsider/design-system-organisms";
11
- import { InSelect as A } from "@useinsider/design-system-vue";
12
- const V = /* @__PURE__ */ d({
13
- __name: "AssignStrategyDrawer",
14
- setup(B) {
15
- const r = _(), e = D(), { showToaster: n } = w(), s = c(null), a = c(!1), l = c(!1), m = o(() => e.assignStrategyDrawerStatus ? r("email-editor.assign-strategy-description", { url: T.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
16
- S(() => e.assignStrategyDrawerStatus, (t) => {
17
- if (!t)
18
- return;
19
- const { strategyId: i } = e.recommendationConfigs;
20
- s.value = i || null, a.value = !1, l.value = !!window.l10n, e.fetchStrategies().catch(() => {
21
- n({
22
- type: u.Error,
23
- message: r("discovery-strategy.error-description")
24
- });
25
- });
26
- });
27
- const p = o(() => e.strategies.map((t) => ({
28
- text: t.name,
29
- value: t.strategy_id,
30
- infoBoxProps: E(t)
31
- }))), y = o(() => [{ value: s.value }]), g = o(() => {
32
- const t = e.strategies.find((i) => String(i.strategy_id) === String(s.value ?? ""));
33
- return t ? { ...t, fallback_config: null } : null;
34
- }), f = o(() => ({
35
- primaryButton: {
36
- styling: "solid",
37
- type: "primary",
38
- labelText: r("products.assign-btn")
39
- },
40
- cancelOrBackButton: {
41
- styling: "ghost",
42
- type: "secondary",
43
- labelText: r("products.cancel")
44
- }
45
- }));
46
- return { __sfc: !0, trans: r, store: e, showToaster: n, selectedStrategyId: s, showSelectionError: a, campaignTabSupported: l, drawerDescription: m, strategyOptions: p, selectValue: y, selectedStrategy: g, footerButtonGroupOptions: f, closeDrawer: () => {
47
- e.closeAssignStrategyDrawer();
48
- }, assignStrategy: () => {
49
- const t = g.value;
50
- if (!t) {
51
- a.value = !0;
52
- return;
53
- }
54
- e.assignStrategy(t), n({
55
- type: u.Success,
56
- message: r("email-editor.strategy-assigned-success", { strategyName: t.name })
57
- }), e.closeAssignStrategyDrawer();
58
- }, onSelect: (t) => {
59
- s.value = t.value, a.value = !1;
60
- }, WpDrawer: v, OrgStrategyDetailModal: x, InSelect: A };
61
- }
62
- });
63
- export {
64
- V as default
65
- };
@@ -1,136 +0,0 @@
1
- var g = Object.defineProperty;
2
- var d = (n, s, t) => s in n ? g(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
3
- var i = (n, s, t) => d(n, typeof s != "symbol" ? s + "" : s, t);
4
- import { ACADEMY_LINKS as l } from "../../../../../enums/academy.js";
5
- import { CommonControl as y } from "../../../common-control.js";
6
- import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
7
- const h = "recommendation-strategy-control";
8
- class v extends y {
9
- constructor() {
10
- super(...arguments);
11
- i(this, "store", m());
12
- i(this, "storeUnsubscription", () => {
13
- });
14
- i(this, "listeners", []);
15
- }
16
- getId() {
17
- return h;
18
- }
19
- getTemplate() {
20
- const t = this.api.translate(
21
- "You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
22
- ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
23
- return `
24
- <div class="strategy-control-container">
25
- <div class="strategy-control-header">
26
- <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
27
- </div>
28
- <div class="strategy-control-description-row">
29
- <p class="strategy-control-description">
30
- ${t}
31
- ${e}
32
- <a
33
- href="${l.EMAIL_RECOMMENDATION_BLOCK}"
34
- target="_blank"
35
- rel="noopener noreferrer">${a}</a>.
36
- </p>
37
- </div>
38
- <div data-strategy-empty-state>
39
- ${this._GuTwoColumns([
40
- this._GuButton({
41
- name: "assignStrategy",
42
- label: this.api.translate("Assign Strategy"),
43
- id: "guido__btn-assign-strategy",
44
- className: "strategy-control-cta accent"
45
- }),
46
- // Create round-trip ships with SD-149916; until then the CTA
47
- // stays inert at full contrast, as the design draws it.
48
- this._GuButton({
49
- name: "createStrategy",
50
- label: this.api.translate("Create New Strategy"),
51
- id: "guido__btn-create-strategy",
52
- className: "strategy-control-cta primary",
53
- disabled: !0
54
- })
55
- ], "strategy-control-cta-row")}
56
- </div>
57
- <div data-strategy-assigned-state style="display: none;">
58
- <div class="strategy-control-name-band">
59
- <span class="strategy-control-name" data-strategy-name></span>
60
- </div>
61
- <div class="strategy-control-actions">
62
- ${this._strategyAction({
63
- id: "guido__btn-change-strategy",
64
- label: this.api.translate("Change"),
65
- modifier: "change"
66
- })}
67
- ${this._strategyAction({
68
- id: "guido__btn-remove-strategy",
69
- label: this.api.translate("Remove"),
70
- modifier: "remove"
71
- })}
72
- </div>
73
- </div>
74
- </div>
75
- `;
76
- }
77
- /**
78
- * Change / Remove are icon+text actions in the design, not buttons — and
79
- * `ue-button` cannot pair a caption with an arbitrary icon, so these are
80
- * plain elements. Click wiring is by id, which works on any element.
81
- *
82
- * The icon is a CSS mask, not inline SVG: Stripo re-creates the control's
83
- * markup through Angular, which rebuilds `<svg>` outside the SVG namespace
84
- * (the view-box attribute comes back lowercased) and it never paints.
85
- */
86
- _strategyAction({ id: t, label: e, modifier: a }) {
87
- return `
88
- <button
89
- id="${t}"
90
- type="button"
91
- class="strategy-control-action strategy-control-action--${a}">
92
- <span>${e}</span>
93
- </button>
94
- `;
95
- }
96
- onRender() {
97
- this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
98
- this._renderState();
99
- }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
100
- });
101
- }
102
- onDestroy() {
103
- this._teardown();
104
- }
105
- _teardown() {
106
- this.storeUnsubscription(), this.storeUnsubscription = () => {
107
- }, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
108
- }
109
- _setupButtonListeners() {
110
- const t = this.getContainer();
111
- if (!t)
112
- return;
113
- const e = (a, o) => {
114
- const r = t.querySelector(a);
115
- r && (r.addEventListener("click", o), this.listeners.push({ element: r, handler: o }));
116
- };
117
- e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.removeStrategy());
118
- }
119
- /**
120
- * Toggles empty vs assigned state from the store's current block config.
121
- * Display name comes from the listing; falls back to the raw id while the
122
- * listing loads (or when the strategy is no longer listed).
123
- */
124
- _renderState() {
125
- var c;
126
- const t = this.getContainer();
127
- if (!t)
128
- return;
129
- const e = t.querySelector("[data-strategy-empty-state]"), a = t.querySelector("[data-strategy-assigned-state]"), o = t.querySelector("[data-strategy-name]"), { strategyId: r } = this.store.recommendationConfigs;
130
- !e || !a || (e.style.display = r ? "none" : "", a.style.display = r ? "" : "none", o && r && (o.textContent = ((c = this.store.assignedStrategy) == null ? void 0 : c.name) ?? `#${r}`));
131
- }
132
- }
133
- export {
134
- h as STRATEGY_CONTROL_ID,
135
- v as StrategyControl
136
- };
@@ -1,3 +0,0 @@
1
- import '@useinsider/design-system-organisms/style';
2
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
3
- export default _default;
@@ -1,29 +0,0 @@
1
- import { CommonControl } from '../../../common-control';
2
- export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
3
- export declare class StrategyControl extends CommonControl {
4
- private store;
5
- private storeUnsubscription;
6
- private listeners;
7
- getId(): string;
8
- getTemplate(): string;
9
- /**
10
- * Change / Remove are icon+text actions in the design, not buttons — and
11
- * `ue-button` cannot pair a caption with an arbitrary icon, so these are
12
- * plain elements. Click wiring is by id, which works on any element.
13
- *
14
- * The icon is a CSS mask, not inline SVG: Stripo re-creates the control's
15
- * markup through Angular, which rebuilds `<svg>` outside the SVG namespace
16
- * (the view-box attribute comes back lowercased) and it never paints.
17
- */
18
- private _strategyAction;
19
- onRender(): void;
20
- onDestroy(): void;
21
- private _teardown;
22
- private _setupButtonListeners;
23
- /**
24
- * Toggles empty vs assigned state from the store's current block config.
25
- * Display name comes from the listing; falls back to the raw id while the
26
- * listing loads (or when the strategy is no longer listed).
27
- */
28
- private _renderState;
29
- }
@@ -1,63 +0,0 @@
1
- export declare const MOCK_RRS_STRATEGIES: ({
2
- strategy_id: number;
3
- name: string;
4
- status: string;
5
- suitable_channels: string;
6
- suitable_page_types: string;
7
- algorithm: string;
8
- algorithm_used: string;
9
- method: string;
10
- size: number;
11
- filters: string;
12
- shuffle: number;
13
- attribute_affinity: number;
14
- exclude_view: number;
15
- exclude_purchase: number;
16
- exclude_cart: number;
17
- manual_merchandising_products: string;
18
- fallback_config: null;
19
- channelNames: string;
20
- campaignCount: {
21
- active: number;
22
- passive: number;
23
- test: number;
24
- };
25
- created_at: string;
26
- updated_at: string;
27
- last_updated_by: string;
28
- mixed_strategies?: undefined;
29
- exclude_view_duration?: undefined;
30
- exclude_view_duration_type?: undefined;
31
- } | {
32
- strategy_id: number;
33
- name: string;
34
- status: string;
35
- suitable_channels: string;
36
- suitable_page_types: string;
37
- algorithm: string;
38
- algorithm_used: string;
39
- mixed_strategies: string;
40
- method: string;
41
- size: number;
42
- filters: string;
43
- shuffle: number;
44
- attribute_affinity: number;
45
- exclude_view: number;
46
- exclude_view_duration: number;
47
- exclude_view_duration_type: string;
48
- exclude_purchase: number;
49
- exclude_cart: number;
50
- manual_merchandising_products: string;
51
- fallback_config: null;
52
- channelNames: string;
53
- campaignCount: {
54
- active: number;
55
- passive: number;
56
- test: number;
57
- };
58
- created_at: string;
59
- updated_at: string;
60
- last_updated_by: string;
61
- })[];
62
- declare const _default: import("msw").HttpHandler[];
63
- export default _default;