@useinsider/guido 3.17.0-beta.3e9d6e7 → 3.17.0-beta.3ff6ea0

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 (111) hide show
  1. package/README.md +0 -1
  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 +61 -63
  5. package/dist/composables/useCustomInterfaceAppearance.js +16 -19
  6. package/dist/composables/useRecommendation.js +34 -41
  7. package/dist/composables/useStripo.js +14 -14
  8. package/dist/config/migrator/index.js +9 -8
  9. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  10. package/dist/config/migrator/recommendation/extractors.js +29 -24
  11. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  12. package/dist/config/migrator/recommendationMigrator.js +16 -15
  13. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  14. package/dist/enums/date.js +3 -4
  15. package/dist/enums/extensions/recommendationBlock.js +23 -25
  16. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  17. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  18. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
  19. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +34 -28
  20. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +306 -238
  21. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +95 -122
  22. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  23. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  24. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  25. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +53 -199
  27. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  28. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  29. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  30. package/dist/extensions/Blocks/common-control.js +19 -22
  31. package/dist/guido.css +1 -1
  32. package/dist/services/recommendationApi.js +28 -77
  33. package/dist/src/@types/config/schemas.d.ts +0 -12
  34. package/dist/src/composables/useConfig.d.ts +0 -2
  35. package/dist/src/composables/useRecommendation.d.ts +0 -1
  36. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  37. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  38. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  39. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  40. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  41. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  42. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  43. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  44. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +10 -0
  45. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -12
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  48. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  49. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -210
  50. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  51. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
  52. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  53. package/dist/src/services/recommendationApi.d.ts +1 -4
  54. package/dist/src/stores/config.d.ts +0 -18
  55. package/dist/static/styles/customEditorStyle.css.js +3 -1
  56. package/dist/utils/dateUtil.js +10 -23
  57. package/dist/utils/templatePreparation.js +34 -37
  58. package/package.json +1 -2
  59. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
  60. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -67
  61. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +0 -20
  62. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +0 -55
  63. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -132
  64. package/dist/node_modules/@useinsider/design-system-organisms/dist/index-Dc9AygoZ.js +0 -526
  65. package/dist/node_modules/@useinsider/design-system-organisms/dist/index.js +0 -9345
  66. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InAccordion.js +0 -174
  67. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InBasicTextInput.js +0 -381
  68. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InBox.js +0 -236
  69. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InBulkActions.js +0 -70
  70. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InButton.js +0 -350
  71. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InButtonV2.js +0 -371
  72. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InCheckBox.js +0 -152
  73. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InChips.js +0 -141
  74. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InCustomDropDown.js +0 -1047
  75. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDataTableV2.js +0 -96050
  76. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDatePicker.js +0 -2042
  77. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDrawer.js +0 -166
  78. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDropDown.js +0 -1098
  79. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InIcons.js +0 -55
  80. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InInfoBox.js +0 -265
  81. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InLinks.js +0 -184
  82. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InLoading.js +0 -50
  83. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InModals.js +0 -453
  84. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InNoData.js +0 -145
  85. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InOnPageMessage.js +0 -176
  86. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InProgress.js +0 -266
  87. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InRadioButton.js +0 -114
  88. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InSegments.js +0 -200
  89. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InSelect.js +0 -451
  90. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InSkeleton.js +0 -49
  91. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InStatusText.js +0 -119
  92. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTabs.js +0 -4309
  93. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTagsText.js +0 -129
  94. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTextInput.js +0 -503
  95. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InToasts.js +0 -253
  96. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InToggle.js +0 -107
  97. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTooltip.js +0 -134
  98. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTooltipV2.js +0 -464
  99. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/_commonjsHelpers.BItOPCY9.js +0 -28
  100. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/_plugin-vue2_normalizer.WQT2Fc8L.js +0 -23
  101. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/clickOutside.qP9M0QCm.js +0 -29
  102. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/helpers.CgHNyjAJ.js +0 -109
  103. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/index.Bw_06igr.js +0 -2339
  104. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/localLocalesMixin.DYMhydo2.js +0 -16
  105. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/useLocalLocales.Ckuhy7d-.js +0 -17
  106. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/vue-property-decorator.BtlM7Epa.js +0 -188
  107. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
  108. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +0 -24
  109. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -37
  110. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -43
  111. package/dist/static/styles/components/recommendation-strategy.css.js +0 -171
@@ -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.3e9d6e7",
3
+ "version": "3.17.0-beta.3ff6ea0",
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",
@@ -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 n = 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" }, [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, 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
- }, o = [], i = /* @__PURE__ */ r(
8
- a,
9
- n,
10
- o,
11
- !1,
12
- null,
13
- "2fb85559"
14
- );
15
- const p = i.exports;
16
- export {
17
- p as default
18
- };
@@ -1,67 +0,0 @@
1
- import { defineComponent as v, ref as l, computed as o, watch as _ } from "vue";
2
- /* empty css */
3
- import w from "../../../wrappers/WpDrawer.vue.js";
4
- import { useToaster as D } from "../../../../composables/useToaster.js";
5
- import { useTranslations as T } from "../../../../composables/useTranslations.js";
6
- import { ToasterTypeOptions as b } from "../../../../enums/toaster.js";
7
- import { useRecommendationExtensionStore as h } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
8
- import { OrgStrategyDetailModal as x } from "../../../../node_modules/@useinsider/design-system-organisms/dist/index.js";
9
- import { InSelect as B } from "@useinsider/design-system-vue";
10
- import O from "./StrategyInfoBox.vue.js";
11
- const $ = /* @__PURE__ */ v({
12
- __name: "AssignStrategyDrawer",
13
- setup(A) {
14
- const c = "/discovery/recommendation-strategies", s = T(), e = h(), { showToaster: g, handleError: u } = D(), r = l(null), a = l(!1), m = l(!1), d = o(() => e.assignStrategyDrawerStatus ? s("email-editor.assign-strategy-description", { url: c }) : "");
15
- _(() => e.assignStrategyDrawerStatus, (t) => {
16
- if (!t)
17
- return;
18
- const { strategyId: i } = e.recommendationConfigs;
19
- r.value = i || null, m.value = !!window.l10n, e.fetchStrategies().catch((S) => {
20
- u(S, s("discovery-strategy.error-description"));
21
- });
22
- });
23
- const p = o(() => e.strategies.map((t) => ({
24
- text: t.name,
25
- value: t.strategy_id,
26
- infoBoxProps: {
27
- id: `strategy-info-${t.strategy_id}`,
28
- theme: "light",
29
- variant: "information",
30
- className: "assign-strategy-info-box",
31
- slot: O,
32
- slotProps: { strategy: t }
33
- }
34
- }))), y = o(() => [{ value: r.value }]), n = o(() => {
35
- const t = e.strategies.find((i) => String(i.strategy_id) === String(r.value ?? ""));
36
- return t ? { ...t, fallback_config: null } : null;
37
- }), f = o(() => ({
38
- primaryButton: {
39
- styling: "solid",
40
- type: "primary",
41
- labelText: s("products.assign-btn"),
42
- loadingStatus: a.value,
43
- disabledStatus: !n.value
44
- },
45
- cancelOrBackButton: {
46
- styling: "ghost",
47
- type: "secondary",
48
- labelText: s("products.cancel"),
49
- disabledStatus: a.value
50
- }
51
- }));
52
- return { __sfc: !0, RRS_PANEL_PATH: c, trans: s, store: e, showToaster: g, handleError: u, selectedStrategyId: r, isAssigning: a, campaignTabSupported: m, drawerDescription: d, strategyOptions: p, selectValue: y, selectedStrategy: n, footerButtonGroupOptions: f, closeDrawer: () => {
53
- e.closeAssignStrategyDrawer();
54
- }, assignStrategy: () => {
55
- const t = n.value;
56
- t && (a.value = !0, e.assignStrategy(t), g({
57
- type: b.Success,
58
- message: s("email-editor.strategy-assigned-success", { strategyName: t.name })
59
- }), e.closeAssignStrategyDrawer(), a.value = !1);
60
- }, onSelect: (t) => {
61
- r.value = t.value;
62
- }, WpDrawer: w, OrgStrategyDetailModal: x, InSelect: B };
63
- }
64
- });
65
- export {
66
- $ as default
67
- };
@@ -1,20 +0,0 @@
1
- import _ from "./StrategyInfoBox.vue2.js";
2
- /* empty css */
3
- import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var r = function() {
5
- var t = this, s = t._self._c, a = t._self._setupProxy;
6
- return s("div", { staticClass: "strategy-info-box" }, [s("div", { staticClass: "strategy-info-box__name" }, [t._v(" " + t._s(t.strategy.name) + " ")]), a.lastUpdated ? s("div", { staticClass: "strategy-info-box__updated" }, [t._v(" " + t._s(a.lastUpdated) + " ")]) : t._e(), s("div", { staticClass: "strategy-info-box__rows" }, t._l(a.rows, function(e) {
7
- return s("div", { key: e.label, staticClass: "strategy-info-box__row" }, [s("div", { staticClass: "strategy-info-box__label" }, [t._v(" " + t._s(e.label) + " ")]), s("div", { staticClass: "strategy-info-box__value" }, [t._v(" " + t._s(e.value) + " ")])]);
8
- }), 0)]);
9
- }, i = [], n = /* @__PURE__ */ o(
10
- _,
11
- r,
12
- i,
13
- !1,
14
- null,
15
- "fe4491e6"
16
- );
17
- const d = n.exports;
18
- export {
19
- d as default
20
- };
@@ -1,55 +0,0 @@
1
- import { defineComponent as v, computed as s } from "vue";
2
- import { useTranslations as h } from "../../../../composables/useTranslations.js";
3
- import { formatShortDate as f } from "../../../../utils/dateUtil.js";
4
- const A = /* @__PURE__ */ v({
5
- __name: "StrategyInfoBox",
6
- props: {
7
- strategy: null
8
- },
9
- setup(g) {
10
- const t = g, r = h(), n = (e) => e == null ? "" : String(e), y = s(() => {
11
- const e = n(t.strategy.updated_at || t.strategy.created_at);
12
- return e ? r("recommendation-strategy.last-updated-on", { value: f(e) }) : "";
13
- }), c = s(() => {
14
- const e = n(t.strategy.algorithm) === "MIXED" ? r("discovery-strategy.mixed-algorithm") : r("discovery-strategy.single-algorithm"), a = n(t.strategy.algorithm_used).split(",").map((o) => o.trim()).filter(Boolean).map((o) => r(`recommendation-algorithm-names.${o.replaceAll("_", "-").toLowerCase()}`));
15
- return a.length ? `${e} · ${a.join(", ")}` : e;
16
- }), u = s(() => [
17
- [t.strategy.exclude_view, "discovery-strategy.exclude-recently-view-items"],
18
- [t.strategy.exclude_purchase, "discovery-strategy.exclude-recently-purchased-items"],
19
- [t.strategy.exclude_cart, "discovery-strategy.exclude-recently-added-cart-items"]
20
- ].filter(([a]) => Number(a) === 1).map(([, a]) => r(a)).join(", ")), d = s(() => n(
21
- t.strategy.manual_merchandising || t.strategy.manual_merchandising_products
22
- ).trim()), i = s(() => {
23
- const e = t.strategy.filters;
24
- if (!e)
25
- return 0;
26
- try {
27
- const a = typeof e == "string" ? JSON.parse(e) : e;
28
- return Array.isArray(a) ? a.reduce((o, m) => o + (Array.isArray(m) ? m.length : 1), 0) : 0;
29
- } catch {
30
- return 0;
31
- }
32
- }), l = s(() => r("recommendation-strategy.none")), p = s(() => [
33
- {
34
- label: r("gpt-app-builder.algorithms-and-method"),
35
- value: c.value
36
- },
37
- {
38
- label: r("gpt-app-builder.exclusions"),
39
- value: u.value || l.value
40
- },
41
- {
42
- label: r("discovery-strategy.filters"),
43
- value: i.value ? String(i.value) : l.value
44
- },
45
- {
46
- label: r("action-builder.manual-merchandising"),
47
- value: d.value || l.value
48
- }
49
- ]);
50
- return { __sfc: !0, props: t, trans: r, asText: n, lastUpdated: y, algorithmsAndMethod: c, exclusions: u, manualMerchandising: d, filterCount: i, none: l, rows: p };
51
- }
52
- });
53
- export {
54
- A as default
55
- };
@@ -1,132 +0,0 @@
1
- var d = Object.defineProperty;
2
- var l = (n, a, t) => a in n ? d(n, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[a] = t;
3
- var o = (n, a, t) => l(n, typeof a != "symbol" ? a + "" : a, t);
4
- import { CommonControl as g } from "../../../common-control.js";
5
- import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
6
- const h = "recommendation-strategy-control", m = "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
7
- class b extends g {
8
- constructor() {
9
- super(...arguments);
10
- o(this, "store", y());
11
- o(this, "storeUnsubscription", () => {
12
- });
13
- o(this, "listeners", []);
14
- }
15
- getId() {
16
- return h;
17
- }
18
- getTemplate() {
19
- const t = this.api.translate(
20
- "You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
21
- ), e = this.api.translate("For more information, you can"), s = this.api.translate("visit Academy");
22
- return `
23
- <div class="strategy-control-container">
24
- <!-- A section heading, not a field label: the ue-label element renders
25
- the panel's 13px field styling and the design asks for a 16px/600
26
- heading. Kept outside a .container so the editor draws no rule. -->
27
- <div class="strategy-control-header">
28
- <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
29
- </div>
30
- <div class="strategy-control-description-row">
31
- <p class="strategy-control-description">
32
- ${t}
33
- ${e}
34
- <!-- cspell:disable-next-line -->
35
- <a href="${m}" target="_blank" rel="noopener noreferrer">${s}</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 in a later phase. Disabled, not dimmed:
47
- // the design keeps it at full contrast.
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
- <!-- The name band bleeds to the panel edges, so it is a sibling of the
59
- actions row rather than sharing its 16px inset. -->
60
- <div class="strategy-control-name-band">
61
- <span class="strategy-control-name" data-strategy-name></span>
62
- </div>
63
- <div class="strategy-control-actions">
64
- ${this._strategyAction({
65
- id: "guido__btn-change-strategy",
66
- label: this.api.translate("Change"),
67
- modifier: "change"
68
- })}
69
- ${this._strategyAction({
70
- id: "guido__btn-remove-strategy",
71
- label: this.api.translate("Remove"),
72
- modifier: "remove"
73
- })}
74
- </div>
75
- </div>
76
- </div>
77
- `;
78
- }
79
- /**
80
- * Change / Remove are icon+text actions in the design, not buttons — and
81
- * `ue-button` cannot pair a caption with an arbitrary icon, so these are
82
- * plain elements. Click wiring is by id, which works on any element.
83
- *
84
- * The icon is a CSS mask, not inline SVG: Stripo re-creates the control's
85
- * markup through Angular, which rebuilds `<svg>` outside the SVG namespace
86
- * (the view-box attribute comes back lowercased) and it never paints.
87
- */
88
- _strategyAction({ id: t, label: e, modifier: s }) {
89
- return `
90
- <button
91
- id="${t}"
92
- type="button"
93
- class="strategy-control-action strategy-control-action--${s}">
94
- <span>${e}</span>
95
- </button>
96
- `;
97
- }
98
- onRender() {
99
- this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
100
- this._renderState();
101
- }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
102
- });
103
- }
104
- onDestroy() {
105
- this._teardown();
106
- }
107
- _teardown() {
108
- this.storeUnsubscription(), this.storeUnsubscription = () => {
109
- }, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
110
- }
111
- _setupButtonListeners() {
112
- const t = (e, s) => {
113
- const r = this.getContainer().querySelector(e);
114
- r && (r.addEventListener("click", s), this.listeners.push({ element: r, handler: s }));
115
- };
116
- t("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), t("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), t("#guido__btn-remove-strategy", () => this.store.removeStrategy());
117
- }
118
- /**
119
- * Toggles empty vs assigned state from the store's current block config.
120
- * Display name comes from the listing; falls back to the raw id while the
121
- * listing loads (or when the strategy is no longer listed).
122
- */
123
- _renderState() {
124
- var c;
125
- const t = this.getContainer(), e = t.querySelector("[data-strategy-empty-state]"), s = t.querySelector("[data-strategy-assigned-state]"), r = t.querySelector("[data-strategy-name]"), { strategyId: i } = this.store.recommendationConfigs;
126
- !e || !s || (e.style.display = i ? "none" : "", s.style.display = i ? "" : "none", r && i && (r.textContent = ((c = this.store.assignedStrategy) == null ? void 0 : c.name) ?? `#${i}`));
127
- }
128
- }
129
- export {
130
- h as STRATEGY_CONTROL_ID,
131
- b as StrategyControl
132
- };