@useinsider/guido 3.17.0-beta.6b602e7 → 3.17.0-beta.6f780fd

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 (71) hide show
  1. package/dist/@types/config/schemas.js +15 -13
  2. package/dist/components/Guido.vue.js +4 -4
  3. package/dist/components/Guido.vue2.js +46 -48
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
  6. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  7. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +21 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  9. package/dist/components/organisms/header/EditorActions.vue2.js +34 -50
  10. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  11. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +39 -0
  12. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  13. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  14. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  15. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  16. package/dist/components/organisms/header/RightSlot.vue.js +7 -6
  17. package/dist/components/organisms/header/RightSlot.vue2.js +17 -15
  18. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  19. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  20. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +24 -0
  21. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  22. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +18 -0
  23. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +74 -0
  24. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -34
  25. package/dist/composables/useAccessibilityApi.js +31 -0
  26. package/dist/composables/useCustomInterfaceAppearance.js +44 -45
  27. package/dist/config/i18n/en/labels.json.js +28 -4
  28. package/dist/enums/extensions/recommendationBlock.js +1 -2
  29. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +69 -70
  30. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +31 -66
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +49 -90
  32. package/dist/guido.css +1 -1
  33. package/dist/node_modules/@vueuse/core/index.js +102 -0
  34. package/dist/node_modules/@vueuse/shared/index.js +40 -28
  35. package/dist/services/recommendationApi.js +52 -61
  36. package/dist/sprite.svg +6 -0
  37. package/dist/src/@types/config/schemas.d.ts +4 -0
  38. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  39. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  40. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  41. package/dist/src/composables/useAccessibilityApi.d.ts +15 -0
  42. package/dist/src/composables/useActionsApi.d.ts +2 -2
  43. package/dist/src/composables/useConfig.d.ts +2 -0
  44. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -1
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -1
  46. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -54
  47. package/dist/src/services/recommendationApi.d.ts +1 -2
  48. package/dist/src/stores/config.d.ts +18 -0
  49. package/dist/src/stores/editor.d.ts +76 -0
  50. package/dist/src/stores/onboarding.d.ts +377 -0
  51. package/dist/src/stores/version-history.d.ts +1 -1
  52. package/dist/src/utils/timeUtil.d.ts +10 -0
  53. package/dist/static/styles/components/accessibility.css.js +137 -0
  54. package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
  55. package/dist/static/styles/variables.css.js +1 -0
  56. package/dist/stores/editor.js +4 -1
  57. package/dist/stores/onboarding.js +16 -11
  58. package/dist/utils/timeUtil.js +7 -17
  59. package/package.json +1 -1
  60. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
  61. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
  62. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  63. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  64. package/dist/composables/useLegacyStrategyConversion.js +0 -52
  65. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -58
  66. package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
  67. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -39
  68. package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
  69. package/dist/static/assets/icons/line-info.svg.js +0 -5
  70. /package/dist/src/components/organisms/{extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts → header/AutoSaveStatus.vue.d.ts} +0 -0
  71. /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → EditorActionsMenu.vue.d.ts} +0 -0
@@ -26,40 +26,6 @@ const n = `.strategy-control-header {
26
26
  text-decoration: underline;
27
27
  }
28
28
 
29
- .strategy-control-notice-row {
30
- padding: 0 16px 16px;
31
- }
32
-
33
- .strategy-control-notice {
34
- display: flex;
35
- gap: 8px;
36
- align-items: center;
37
- padding: 12px;
38
- border: 1px solid var(--guido-color-border-onpage-message-info);
39
- border-radius: 4px;
40
- background-color: var(--guido-color-background-onpage-message-info);
41
- }
42
-
43
- .strategy-control-notice::before {
44
- content: '';
45
- flex: none;
46
- width: 24px;
47
- height: 24px;
48
- background-color: var(--guido-color-border-onpage-message-info);
49
- mask-image: var(--guido-icon-line-info);
50
- mask-repeat: no-repeat;
51
- mask-position: center;
52
- mask-size: 24px 24px;
53
- }
54
-
55
- .strategy-control-notice-text {
56
- margin: 0;
57
- padding: 4px 0;
58
- color: var(--guido-color-neutral-700);
59
- font-size: 13px;
60
- line-height: 16px;
61
- }
62
-
63
29
  .recommendation-controls-container .container.strategy-control-cta-row {
64
30
  grid-template-columns: repeat(2, minmax(0, 180px));
65
31
  justify-content: start;
@@ -98,14 +64,6 @@ const n = `.strategy-control-header {
98
64
  background-color: var(--guido-color-gray-0);
99
65
  }
100
66
 
101
- /* Figma gives the legacy band a 59px row: 17.5px above and below its 24px content. */
102
- [data-strategy-legacy-state] .strategy-control-name-band {
103
- gap: 8px;
104
- justify-content: space-between;
105
- min-height: auto;
106
- padding: 17.5px 16px;
107
- }
108
-
109
67
  .strategy-control-name {
110
68
  color: var(--guido-color-gray-800);
111
69
  font-size: 15px;
@@ -159,15 +117,6 @@ const n = `.strategy-control-header {
159
117
  mask-image: var(--guido-icon-line-plus);
160
118
  }
161
119
 
162
- .strategy-control-action--update::before {
163
- mask-image: var(--guido-icon-filled-arrow-rising);
164
- }
165
-
166
- .strategy-control-name-band .strategy-control-action > span {
167
- padding: 0 0 0 8px;
168
- }
169
-
170
- .strategy-control-action--update,
171
120
  .strategy-control-action--change {
172
121
  color: var(--guido-color-primary-500);
173
122
  }
@@ -180,38 +129,24 @@ const n = `.strategy-control-header {
180
129
  text-decoration: underline;
181
130
  }
182
131
 
183
- .strategy-control-action:disabled,
184
- .strategy-control-action:disabled:hover {
185
- color: var(--guido-color-gray-700);
186
- text-decoration: none;
187
- cursor: default;
188
- }
189
-
190
- .recommendation-controls-container:not(.strategy-block):not(.legacy-strategy-block) .strategy-control-container,
132
+ .recommendation-controls-container:not(.strategy-block) .strategy-control-container,
191
133
  .recommendation-controls-container.strategy-block .product-count-control-container,
192
134
  .recommendation-controls-container.strategy-block .algorithm-control-container,
193
135
  .recommendation-controls-container.strategy-block .filters-control-container,
194
- .recommendation-controls-container.strategy-block .shuffle-control-container,
195
- .recommendation-controls-container.legacy-strategy-block .product-count-control-container,
196
- .recommendation-controls-container.legacy-strategy-block .algorithm-control-container,
197
- .recommendation-controls-container.legacy-strategy-block .filters-control-container,
198
- .recommendation-controls-container.legacy-strategy-block .shuffle-control-container {
136
+ .recommendation-controls-container.strategy-block .shuffle-control-container {
199
137
  display: none;
200
138
  }
201
139
 
202
- .recommendation-controls-container.strategy-block,
203
- .recommendation-controls-container.legacy-strategy-block {
140
+ .recommendation-controls-container.strategy-block {
204
141
  display: flex;
205
142
  flex-direction: column;
206
143
  }
207
144
 
208
- .recommendation-controls-container.strategy-block .price-placement-control-container,
209
- .recommendation-controls-container.legacy-strategy-block .price-placement-control-container {
145
+ .recommendation-controls-container.strategy-block .price-placement-control-container {
210
146
  order: 1;
211
147
  }
212
148
 
213
- .recommendation-controls-container.strategy-block .product-layout-control-container,
214
- .recommendation-controls-container.legacy-strategy-block .product-layout-control-container {
149
+ .recommendation-controls-container.strategy-block .product-layout-control-container {
215
150
  order: 2;
216
151
  }
217
152
  `;
@@ -16,6 +16,7 @@ const o = `:host {
16
16
  --guido-color-neutral-700: #2C3546;
17
17
  --guido-color-neutral-200: #DCDFE6;
18
18
  --guido-color-neutral-100: #EFF2F4;
19
+ --guido-color-warning-500: #FFBF00;
19
20
  --guido-color-danger-300: #e84342;
20
21
  --guido-color-danger-500: #DC2A2A;
21
22
  --guido-box-shadow: 0 4px 12px 0 rgba(44,53,70,0.15);
@@ -6,6 +6,9 @@ const o = e("guidoEditor", {
6
6
  isSaveAsTemplateDrawerOpen: !1,
7
7
  isVersionHistoryOpen: !1,
8
8
  isPreviewModeOpen: !1,
9
+ isAccessibilityTestingOpen: !1,
10
+ imagesHidden: !1,
11
+ colorVisionDeficiency: "",
9
12
  editorVisualMode: "desktop",
10
13
  hasChanges: !1,
11
14
  isStripoInitialized: !1,
@@ -17,7 +20,7 @@ const o = e("guidoEditor", {
17
20
  }),
18
21
  getters: {
19
22
  // Middle Slot
20
- isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen,
23
+ isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isAccessibilityTestingOpen,
21
24
  isUndoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
22
25
  isRedoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
23
26
  isCodeEditorButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
@@ -1,17 +1,18 @@
1
1
  import { useOnboardingApi as s } from "../services/onboardingApi.js";
2
2
  import { defineStore as e } from "pinia";
3
- const t = () => ({
3
+ const r = () => ({
4
4
  cardIndex: 0,
5
5
  isActive: !1,
6
6
  config: []
7
7
  }), a = () => ({
8
8
  onboardings: {
9
- newVersionPopup: t(),
10
- genericOnboarding: t(),
11
- textBlockOnboarding: t(),
12
- versionHistoryOnboarding: t(),
13
- ampOnboarding: t(),
14
- itemsOnboarding: t()
9
+ newVersionPopup: r(),
10
+ genericOnboarding: r(),
11
+ textBlockOnboarding: r(),
12
+ versionHistoryOnboarding: r(),
13
+ ampOnboarding: r(),
14
+ itemsOnboarding: r(),
15
+ editorTabBarOnboarding: r()
15
16
  },
16
17
  userModalState: {},
17
18
  isFetched: !1
@@ -44,6 +45,10 @@ const t = () => ({
44
45
  const { itemsOnboarding: i } = n.onboardings;
45
46
  return i.config[i.cardIndex];
46
47
  },
48
+ getEditorTabBarCurrentCard: (n) => {
49
+ const { editorTabBarOnboarding: i } = n.onboardings;
50
+ return i.config[i.cardIndex];
51
+ },
47
52
  shouldShowOnboarding: (n) => (i) => {
48
53
  const o = n.userModalState.Guido;
49
54
  return i === "newVersionPopup" && (o != null && o.genericOnboarding) ? !1 : o ? !o[i] : !0;
@@ -72,8 +77,8 @@ const t = () => ({
72
77
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
73
78
  },
74
79
  updateCardPosition(n, i, o) {
75
- const r = this.onboardings[n].config[i];
76
- r && (r.top = o.top, r.position = o.position);
80
+ const t = this.onboardings[n].config[i];
81
+ t && (t.top = o.top, t.position = o.position);
77
82
  },
78
83
  setConfig(n, i) {
79
84
  this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
@@ -101,8 +106,8 @@ const t = () => ({
101
106
  }
102
107
  },
103
108
  async setUserModalState(n, i, o) {
104
- const { setUserModalState: r } = s();
105
- await r(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
109
+ const { setUserModalState: t } = s();
110
+ await t(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
106
111
  }
107
112
  }
108
113
  });
@@ -1,19 +1,9 @@
1
- const r = (t) => {
2
- const e = -t.getTimezoneOffset(), o = e >= 0 ? "+" : "-", n = Math.abs(e), s = Math.floor(n / 60), i = n % 60;
3
- return i === 0 ? `UTC${o}${s}` : `UTC${o}${s}:${String(i).padStart(2, "0")}`;
4
- }, a = () => {
5
- var e;
6
- const { timeZone: t } = new Intl.DateTimeFormat().resolvedOptions();
7
- return ((e = t.split("/").pop()) == null ? void 0 : e.replace(/_/g, " ")) ?? t;
8
- }, c = (t, e = !1) => {
9
- const o = t.toLocaleTimeString([], {
10
- hour: "2-digit",
11
- hour12: !1,
12
- minute: "2-digit",
13
- second: "2-digit"
14
- });
15
- return e ? `${o} (${r(t)} ${a()})` : o;
16
- };
1
+ const a = (t) => String(t).padStart(2, "0"), g = (t, e) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate(), i = (t, e = /* @__PURE__ */ new Date()) => ({
2
+ isToday: g(t, e),
3
+ time: `${a(t.getHours())}:${a(t.getMinutes())}`,
4
+ // Locale-aware order (US reads MM/DD/YYYY, TR reads DD.MM.YYYY) — mirrors formatLocalTime's Intl use.
5
+ date: t.toLocaleDateString([], { day: "2-digit", month: "2-digit", year: "numeric" })
6
+ });
17
7
  export {
18
- c as formatLocalTime
8
+ i as autoSaveTimestamp
19
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.17.0-beta.6b602e7",
3
+ "version": "3.17.0-beta.6f780fd",
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",
@@ -1,18 +0,0 @@
1
- import s from "./LegacyStrategyUpdatedModal.vue2.js";
2
- /* empty css */
3
- import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var r = function() {
5
- var t = this, a = t._self._c, e = t._self._setupProxy;
6
- return e.store.legacyStrategyUpdatedModalStatus ? a("div", { staticClass: "legacy-strategy-updated-modal" }, [a(e.WpModal, { attrs: { id: "guido__legacy-strategy-updated-modal", size: "small", "close-on-outside-click": !1, "footer-button-options": e.footerButtonOptions, title: e.trans("ds-steps.recommendation-strategy-migration-modal-title") }, on: { close: e.close, "primary-action": e.close } }, [a("p", [t._v(t._s(e.messageParts[0])), a("b", [t._v(t._s(e.strategyName))]), t._v(t._s(e.messageParts[1]))])])], 1) : t._e();
7
- }, l = [], n = /* @__PURE__ */ o(
8
- s,
9
- r,
10
- l,
11
- !1,
12
- null,
13
- "da2225a1"
14
- );
15
- const m = n.exports;
16
- export {
17
- m as default
18
- };
@@ -1,25 +0,0 @@
1
- import { defineComponent as i, computed as s } from "vue";
2
- import p from "../../../wrappers/WpModal.vue.js";
3
- import { useTranslations as d } from "../../../../composables/useTranslations.js";
4
- import { useRecommendationExtensionStore as g } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- const M = /* @__PURE__ */ i({
6
- __name: "LegacyStrategyUpdatedModal",
7
- setup(l) {
8
- const e = d(), t = g(), n = s(() => ({
9
- primaryButton: {
10
- type: "primary",
11
- labelText: e("action-builder.ok")
12
- }
13
- })), m = s(() => {
14
- var r;
15
- const { strategyId: a } = t.recommendationConfigs;
16
- return ((r = t.assignedStrategy) == null ? void 0 : r.name) || `#${a}`;
17
- }), o = "__STRATEGY_NAME__", c = s(() => e("email-editor.legacy-strategy-updated-message", { strategyName: o }).split(o));
18
- return { __sfc: !0, trans: e, store: t, footerButtonOptions: n, strategyName: m, NAME_TOKEN: o, messageParts: c, close: () => {
19
- t.closeLegacyStrategyUpdatedModal();
20
- }, WpModal: p };
21
- }
22
- });
23
- export {
24
- M as default
25
- };
@@ -1,22 +0,0 @@
1
- import o from "./AutoSaveToggle.vue2.js";
2
- /* empty css */
3
- import i from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
5
- var e = this, a = e._self._c, t = e._self._setupProxy;
6
- return t.isFeatureEnabled("autosave") ? a("div", { staticClass: "d-f a-i-c mr-3 auto-save-toggle", on: { mouseenter: function(s) {
7
- t.isHovered = !0;
8
- }, mouseleave: function(s) {
9
- t.isHovered = !1;
10
- } } }, [a(t.InToggle, { attrs: { id: "guido__autosave-toggle", name: "guido-autosave-toggle", checked: t.autosaveStore.isOn, disable: t.editorStore.loadingStatus }, on: { click: t.toggle } }), a("span", { staticClass: "ml-2 auto-save-toggle__label t-c-55" }, [e._v(" " + e._s(t.trans("email-editor.auto-save")) + " ")]), t.autosaveStore.status === t.AUTOSAVE_STATUS.SAVING ? a("span", { staticClass: "ml-2 d-f a-i-c f-s-1" }, [a(t.InLoading, { attrs: { "color-class": "i-c-53", size: "16" } }), a("span", { staticClass: "ml-1 t-c-53" }, [e._v(" " + e._s(t.trans("newsletter.saving")) + " ")])], 1) : t.lastSavedLabel ? a("span", { staticClass: "ml-2 f-s-1 t-c-53" }, [e._v(" " + e._s(t.lastSavedLabel) + " ")]) : e._e(), t.isHovered ? a(t.InInfoBox, { staticClass: "auto-save-toggle__info-box", attrs: { id: "guido__autosave-info-box", size: "small", variant: "information", "description-text": t.trans("email-editor.auto-save-description"), "title-text": t.trans("email-editor.auto-save-title") } }) : e._e()], 1) : e._e();
11
- }, l = [], r = /* @__PURE__ */ i(
12
- o,
13
- n,
14
- l,
15
- !1,
16
- null,
17
- "2c964af4"
18
- );
19
- const d = r.exports;
20
- export {
21
- d as default
22
- };
@@ -1,19 +0,0 @@
1
- import { defineComponent as i, ref as f, computed as u } from "vue";
2
- import { useConfig as l } from "../../../composables/useConfig.js";
3
- import { useTranslations as p } from "../../../composables/useTranslations.js";
4
- import { useAutosaveStore as c, AUTOSAVE_STATUS as t } from "../../../stores/autosave.js";
5
- import { useEditorStore as S } from "../../../stores/editor.js";
6
- import { formatLocalTime as d } from "../../../utils/timeUtil.js";
7
- import { InToggle as g, InLoading as _, InInfoBox as A } from "@useinsider/design-system-vue";
8
- const U = /* @__PURE__ */ i({
9
- __name: "AutoSaveToggle",
10
- setup(v) {
11
- const { isFeatureEnabled: e } = l(), r = S(), o = c(), s = p(), n = f(!1), a = u(() => o.status !== t.SAVED || !o.lastSavedAt ? "" : d(o.lastSavedAt));
12
- return { __sfc: !0, isFeatureEnabled: e, editorStore: r, autosaveStore: o, trans: s, isHovered: n, lastSavedLabel: a, toggle: (m) => {
13
- o.isOn = m;
14
- }, AUTOSAVE_STATUS: t, InInfoBox: A, InLoading: _, InToggle: g };
15
- }
16
- });
17
- export {
18
- U as default
19
- };
@@ -1,52 +0,0 @@
1
- import { useRecommendation as l } from "./useRecommendation.js";
2
- import { useToaster as u } from "./useToaster.js";
3
- import { useTranslations as p } from "./useTranslations.js";
4
- import { ToasterTypeOptions as f } from "../enums/toaster.js";
5
- import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
- import { CURRENT_CONFIG_VERSION as S } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
- import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
- import { buildLegacyMigrationPayload as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
- import { commitBlockChangeOutsidePanel as v } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
- import { useConfigStore as I } from "../stores/config.js";
11
- const x = () => {
12
- const t = C(), a = I(), { buildCampaignUrl: n } = l(), { showToaster: i } = u(), c = p();
13
- return { convertLegacyStrategy: async () => {
14
- const e = t.currentRecommendationId;
15
- if (e === null || !t.isLegacyStrategyBlock || t.legacyConversionLoading)
16
- return "";
17
- const { strategy: s, productIds: m, filters: g } = t.recommendationConfigs, d = L({
18
- blockId: e,
19
- url: n(String(e)),
20
- templateId: a.templateId,
21
- variationId: a.variationId,
22
- strategy: s,
23
- productIds: m,
24
- filters: g,
25
- attributes: t.getFilterList
26
- });
27
- let o;
28
- try {
29
- o = await t.convertLegacyStrategy(d);
30
- } catch (r) {
31
- return console.error("[useLegacyStrategyConversion] migration failed", r), i({
32
- type: f.Error,
33
- message: c("email-editor.legacy-strategy-update-failed")
34
- }), "";
35
- }
36
- const { size: y } = t.recommendationConfigs;
37
- try {
38
- await t.fetchRecommendationProducts();
39
- } catch (r) {
40
- console.error("[useLegacyStrategyConversion] product refetch failed", r);
41
- }
42
- return v(
43
- e,
44
- { strategyId: o, size: y, configVersion: S },
45
- t.recommendationProducts,
46
- "Converted legacy recommendation strategy"
47
- ), t.openLegacyStrategyUpdatedModal(), o;
48
- } };
49
- };
50
- export {
51
- x as useLegacyStrategyConversion
52
- };
@@ -1,58 +0,0 @@
1
- import { OP_ANY_OF as u } from "../../../../enums/extensions/recommendationBlock.js";
2
- import "../constants/selectors.js";
3
- import { CURRENT_CONFIG_VERSION as d } from "../constants/defaultConfig.js";
4
- import { parseTagList as m } from "./filterUtil.js";
5
- import { sanitizeProductIds as l } from "./productIds.js";
6
- const I = "String", N = "manualMerchandising";
7
- function _({ strategyId: t, nodeConfigVersion: e }) {
8
- return !t && e < d;
9
- }
10
- const c = (t) => t === "|" ? "or" : "and", b = (t, e) => {
11
- var r;
12
- return {
13
- conditionLogic: c(t.innerGroupOperator),
14
- attribute: {
15
- attributeName: t.attribute,
16
- attributeType: ((r = e.find((o) => o.value === t.attribute)) == null ? void 0 : r.type) || I
17
- },
18
- operator: { operator: t.operator === u ? "=" : t.operator },
19
- value: t.operator === u ? m(t.value).join(u) : t.value
20
- };
21
- };
22
- function f(t, e) {
23
- const r = /* @__PURE__ */ new Map();
24
- return t.filter((o) => o.isValid).forEach((o) => {
25
- r.set(o.filterGroup, [...r.get(o.filterGroup) ?? [], o]);
26
- }), [...r.keys()].sort((o, i) => o - i).map((o) => {
27
- const i = [...r.get(o) ?? []].sort((n, a) => n.filterNumber - a.filterNumber);
28
- return {
29
- groupLogic: c(i[0].outerGroupOperator),
30
- conditionList: i.map((n) => b(n, e))
31
- };
32
- });
33
- }
34
- function A({
35
- blockId: t,
36
- url: e,
37
- templateId: r,
38
- variationId: o,
39
- strategy: i,
40
- productIds: n,
41
- filters: a,
42
- attributes: g
43
- }) {
44
- const p = f(a, g), s = i === N ? l(n).split(",").filter(Boolean) : [];
45
- return {
46
- campaignId: Number.parseInt(r) || 0,
47
- variationId: Number.parseInt(o) || 0,
48
- blockId: String(t),
49
- url: e,
50
- ...p.length ? { filters: p } : {},
51
- ...s.length ? { productIds: s } : {}
52
- };
53
- }
54
- export {
55
- A as buildLegacyMigrationPayload,
56
- _ as isLegacyStrategyConfig,
57
- f as toMigrationFilterGroups
58
- };
@@ -1,3 +0,0 @@
1
- export declare const useLegacyStrategyConversion: () => {
2
- convertLegacyStrategy: () => Promise<string>;
3
- };
@@ -1,39 +0,0 @@
1
- import type { Filter, RrsMigrationFilterGroup, RrsMigrationPayload } from '@@/Types/recommendation';
2
- type FilterAttribute = {
3
- value: string;
4
- type: string;
5
- };
6
- /**
7
- * A block authored before reusable strategies: it still carries a plain feed
8
- * configuration (compiled into a feed URL string) instead of a strategy id.
9
- * Blocks created under RRS stamp `CURRENT_CONFIG_VERSION`, so the version is
10
- * what separates "never converted" from "not assigned yet".
11
- */
12
- export declare function isLegacyStrategyConfig({ strategyId, nodeConfigVersion }: {
13
- strategyId: string;
14
- nodeConfigVersion: number;
15
- }): boolean;
16
- /**
17
- * Groups the block's valid filters the way the feed URL groups them, in the
18
- * shape the migration endpoint validates. The URL's filter DSL states no
19
- * attribute type and cannot express a mixed-operator group, which is exactly
20
- * what this override exists to supply.
21
- */
22
- export declare function toMigrationFilterGroups(filters: Filter[], attributes: FilterAttribute[]): RrsMigrationFilterGroup[];
23
- interface MigrationInputs {
24
- blockId: number;
25
- url: string;
26
- templateId: string;
27
- variationId: string;
28
- strategy: string;
29
- productIds: string[];
30
- filters: Filter[];
31
- attributes: FilterAttribute[];
32
- }
33
- /**
34
- * The server names and de-duplicates the strategy, so nothing here derives a
35
- * name; `campaignId`/`variationId` only feed that name and fall back to 0 for
36
- * templates and modules, which carry no numeric campaign.
37
- */
38
- export declare function buildLegacyMigrationPayload({ blockId, url, templateId, variationId, strategy, productIds, filters, attributes, }: MigrationInputs): RrsMigrationPayload;
39
- export {};
@@ -1,5 +0,0 @@
1
- const C = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.9403 5.51003L17.6328 11.0273C17.8845 11.3769 18.0068 11.8382 17.9997 12.2963L18 12.3333C18 13.2538 17.4627 14 16.8 14H15V15C15 15.5523 14.5523 16 14 16H10C9.44772 16 9 15.5523 9 15V14H7.2C6.53726 14 6 13.2538 6 12.3333L6.00029 12.2963C5.9932 11.8382 6.11551 11.3769 6.36722 11.0273L11.0597 5.51003C11.3182 5.15101 11.6615 4.98153 12 5.00159C12.3386 4.98153 12.6818 5.15101 12.9403 5.51003Z"/><path d="M10 18C9.44772 18 9 18.4477 9 19C9 19.5523 9.44772 20 10 20H14C14.5523 20 15 19.5523 15 19C15 18.4477 14.5523 18 14 18H10Z"/></svg>
2
- `;
3
- export {
4
- C as default
5
- };
@@ -1,5 +0,0 @@
1
- const C = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 4C14.1217 4 16.1566 4.84285 17.6569 6.34315C19.1571 7.84344 20 9.87827 20 12C20 14.1217 19.1571 16.1566 17.6569 17.6569C16.1566 19.1571 14.1217 20 12 20C9.87827 20 7.84344 19.1571 6.34315 17.6569C4.84285 16.1566 4 14.1217 4 12C4 9.87827 4.84285 7.84344 6.34315 6.34315C7.84344 4.84285 9.87827 4 12 4ZM12 5.6C10.3026 5.6 8.67475 6.27428 7.47452 7.47452C6.27428 8.67475 5.6 10.3026 5.6 12C5.6 13.6974 6.27428 15.3253 7.47452 16.5255C8.67475 17.7257 10.3026 18.4 12 18.4C13.6974 18.4 15.3253 17.7257 16.5255 16.5255C17.7257 15.3253 18.4 13.6974 18.4 12C18.4 10.3026 17.7257 8.67475 16.5255 7.47452C15.3253 6.27428 13.6974 5.6 12 5.6ZM11.496 10.448C11.928 10.448 12.264 10.552 12.496 10.768C12.736 10.976 12.848 11.248 12.848 11.584V11.688L12.824 11.944C12.816 12.064 12.8 12.176 12.776 12.28L12.736 12.432L12.288 14.024L12.248 14.152C12.1976 14.376 12.1629 14.6032 12.144 14.832C12.144 15.04 12.192 15.184 12.288 15.264C12.384 15.344 12.544 15.376 12.776 15.376C12.888 15.376 13.016 15.36 13.152 15.32L13.392 15.24L13.448 15.216L13.328 15.712L12.848 15.896L12.584 15.992L12.464 16.032C12.248 16.112 12 16.144 11.72 16.144C11.28 16.144 10.944 16.04 10.696 15.824C10.5803 15.7241 10.488 15.5998 10.4258 15.4602C10.3636 15.3205 10.3329 15.1689 10.336 15.016C10.3355 14.787 10.3624 14.5587 10.416 14.336L10.448 14.176L10.896 12.576L10.936 12.424L11 12.144C11.024 12.008 11.04 11.88 11.04 11.768C11.04 11.56 11 11.424 10.912 11.344C10.832 11.264 10.672 11.224 10.432 11.224C10.312 11.224 10.192 11.24 10.072 11.272L9.856 11.352L9.76 11.376L9.88 10.888L10.168 10.776C10.36 10.696 10.544 10.632 10.728 10.576C11 10.496 11.256 10.448 11.496 10.448ZM12.496 7.536C12.792 7.536 13.04 7.632 13.248 7.832C13.464 8.024 13.568 8.264 13.568 8.544C13.568 8.816 13.464 9.056 13.248 9.248C13.04 9.44 12.792 9.544 12.496 9.544C12.2 9.544 11.944 9.44 11.736 9.248C11.52 9.056 11.416 8.816 11.416 8.544C11.416 8.264 11.52 8.024 11.736 7.824C11.944 7.632 12.2 7.536 12.496 7.536Z"/></svg>
2
- `;
3
- export {
4
- C as default
5
- };