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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +41 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +55 -53
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -49
  7. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  8. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  9. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  11. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  12. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  13. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  14. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
  15. package/dist/composables/useCustomInterfaceAppearance.js +46 -42
  16. package/dist/composables/useGuidoStateBridge.js +29 -24
  17. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  18. package/dist/composables/useStripo.js +7 -7
  19. package/dist/enums/extensions/recommendationBlock.js +40 -31
  20. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +4 -4
  21. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +77 -76
  22. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -28
  23. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
  24. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +6 -3
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +110 -46
  26. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  27. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  28. package/dist/guido.css +1 -1
  29. package/dist/library.js +15 -13
  30. package/dist/package.json.js +1 -1
  31. package/dist/public/editorState.js +4 -0
  32. package/dist/services/recommendationApi.js +46 -37
  33. package/dist/src/@types/config/schemas.d.ts +16 -0
  34. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  35. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  36. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  37. package/dist/src/composables/useConfig.d.ts +4 -0
  38. package/dist/src/composables/useGuidoStateBridge.d.ts +11 -7
  39. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  40. package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +70 -1
  44. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  45. package/dist/src/library.d.ts +2 -0
  46. package/dist/src/public/editorState.d.ts +14 -0
  47. package/dist/src/public/trackingIds.d.ts +6 -2
  48. package/dist/src/services/recommendationApi.d.ts +2 -1
  49. package/dist/src/stores/config.d.ts +322 -0
  50. package/dist/src/stores/editor.d.ts +25 -0
  51. package/dist/src/stores/guido-email-editor.d.ts +27 -27
  52. package/dist/src/stores/onboarding.d.ts +808 -10
  53. package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
  54. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  55. package/dist/static/assets/icons/line-info.svg.js +5 -0
  56. package/dist/static/styles/components/recommendation-strategy.css.js +70 -5
  57. package/dist/stores/config.js +74 -60
  58. package/dist/stores/editor.js +4 -0
  59. package/dist/stores/guido-email-editor.js +0 -4
  60. package/dist/stores/onboarding.js +46 -36
  61. package/dist/utils/genericUtil.js +64 -61
  62. package/dist/utils/liquidDynamicContent.js +15 -0
  63. package/package.json +10 -6
@@ -1,54 +1,59 @@
1
- import { useActionsApi as b } from "./useActionsApi.js";
2
- import { useEditorLock as v } from "./useEditorLock.js";
1
+ import { useActionsApi as v } from "./useActionsApi.js";
2
+ import { useEditorLock as C } from "./useEditorLock.js";
3
3
  import { useConfigStore as T } from "../stores/config.js";
4
4
  import { useEditorStore as w } from "../stores/editor.js";
5
5
  import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
6
- import { watch as a, onUnmounted as B } from "vue";
7
- const C = 500, L = () => {
8
- const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
9
- let o = null, s = !1;
10
- const n = () => {
6
+ import { watch as c, onUnmounted as z } from "vue";
7
+ const B = 500, G = () => {
8
+ const i = w(), u = y(), d = T(), { getTemplateData: l } = v(), { runExclusive: m, isEditorBusy: p } = C();
9
+ let o = null, n = !1;
10
+ const r = () => {
11
11
  o && (clearTimeout(o), o = null);
12
- }, c = (t) => {
13
- n(), o = setTimeout(() => {
12
+ }, a = (t) => {
13
+ r(), o = setTimeout(() => {
14
14
  o = null, t();
15
- }, C);
15
+ }, B);
16
16
  }, e = async () => {
17
- var t, r;
18
- if (!(s || !i.isStripoInitialized)) {
17
+ var t, s;
18
+ if (!(n || !i.isStripoInitialized)) {
19
19
  if (p()) {
20
- c(() => void e());
20
+ a(() => void e());
21
21
  return;
22
22
  }
23
23
  try {
24
- const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
25
- if (s)
24
+ const { html: E, css: I } = await m(l), b = ((s = (t = d.config) == null ? void 0 : t.identity) == null ? void 0 : s.templateId) ?? "";
25
+ if (n)
26
26
  return;
27
27
  u.$patch({
28
28
  html: E ?? "",
29
- css: g ?? "",
30
- templateId: I,
29
+ css: I ?? "",
30
+ templateId: b,
31
31
  lastUpdatedAt: Date.now()
32
32
  });
33
33
  } catch {
34
34
  }
35
35
  }
36
- }, f = () => c(() => void e()), h = a(
36
+ }, f = () => a(() => void e()), h = c(
37
37
  () => i.isStripoInitialized,
38
38
  (t) => {
39
39
  t && e();
40
40
  },
41
41
  { immediate: !0 }
42
- ), S = a(
42
+ ), S = c(
43
+ () => i.changeSeq,
44
+ () => {
45
+ i.isStripoInitialized && f();
46
+ }
47
+ ), g = c(
43
48
  () => i.hasChanges,
44
- (t, r) => {
45
- i.isStripoInitialized && (t ? f() : r && (n(), e()));
49
+ (t, s) => {
50
+ !t && s && i.isStripoInitialized && (r(), e());
46
51
  }
47
52
  );
48
- B(() => {
49
- s = !0, n(), h(), S();
53
+ z(() => {
54
+ n = !0, r(), h(), S(), g();
50
55
  });
51
56
  };
52
57
  export {
53
- L as useGuidoStateBridge
58
+ G as useGuidoStateBridge
54
59
  };
@@ -0,0 +1,61 @@
1
+ import { useRecommendation as I } from "./useRecommendation.js";
2
+ import { useToaster as C } from "./useToaster.js";
3
+ import { useTranslations as v } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as g } from "../enums/toaster.js";
5
+ import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
+ import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
+ import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { resolveMigrationTarget as R, buildLegacyMigrationPayload as T } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
+ import { commitBlockChangeOutsidePanel as h } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
+ import { useConfigStore as k } from "../stores/config.js";
11
+ const F = () => {
12
+ const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
13
+ return { convertLegacyStrategy: async () => {
14
+ const t = e.currentRecommendationId;
15
+ if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
16
+ return "";
17
+ const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = R({
18
+ campaignId: r.campaignId,
19
+ templateLibraryId: r.templateLibraryId
20
+ }), S = T({
21
+ blockId: t,
22
+ url: m(String(t)),
23
+ campaignId: r.campaignId,
24
+ variationId: r.variationId,
25
+ strategy: d,
26
+ productIds: y,
27
+ target: s
28
+ });
29
+ let o;
30
+ try {
31
+ o = await e.convertLegacyStrategy(S, s);
32
+ } catch (n) {
33
+ return console.error("[useLegacyStrategyConversion] migration failed", n), i({
34
+ type: g.Error,
35
+ message: c("email-editor.legacy-strategy-update-failed")
36
+ }), "";
37
+ }
38
+ try {
39
+ await e.fetchStrategyProductsForBlock(t);
40
+ } catch (n) {
41
+ console.error("[useLegacyStrategyConversion] product refetch failed", n);
42
+ }
43
+ const a = e.blockStates[t];
44
+ return a ? h(
45
+ t,
46
+ {
47
+ strategyId: o,
48
+ size: a.recommendationConfigs.size,
49
+ configVersion: L
50
+ },
51
+ a.recommendationProducts,
52
+ "Converted legacy recommendation strategy"
53
+ ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
54
+ type: g.Error,
55
+ message: c("email-editor.legacy-strategy-update-failed")
56
+ }), "") : o;
57
+ } };
58
+ };
59
+ export {
60
+ F as useLegacyStrategyConversion
61
+ };
@@ -1,6 +1,6 @@
1
- import { useActionsApi as L } from "./useActionsApi.js";
2
- import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
- import { useConfig as q } from "./useConfig.js";
1
+ import { useActionsApi as x } from "./useActionsApi.js";
2
+ import { useBlocksConfig as L } from "./useBlocksConfig.js";
3
+ import { useConfig as O } from "./useConfig.js";
4
4
  import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
5
5
  import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
6
6
  import { useModuleRepair as j } from "./useModuleRepair.js";
@@ -17,7 +17,7 @@ import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../ut
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
19
  const Ce = () => {
20
- const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
20
+ const { features: c, template: u, isFeatureEnabled: m } = O(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = L(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  i();
@@ -88,8 +88,8 @@ const Ce = () => {
88
88
  },
89
89
  onTemplateLoaded() {
90
90
  try {
91
- const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
92
- t(), l(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
91
+ const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = x(), { injectFullStory: q } = N();
92
+ t(), l(), q(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
@@ -106,7 +106,7 @@ const Ce = () => {
106
106
  e.isVersionHistoryOpen = t;
107
107
  },
108
108
  onDataChanged() {
109
- e.hasChanges = !0;
109
+ e.hasChanges = !0, e.changeSeq += 1;
110
110
  },
111
111
  onEvent: v,
112
112
  onModuleAdd: F,
@@ -1,14 +1,22 @@
1
- import { useTranslations as r } from "../../composables/useTranslations.js";
2
- const l = {
1
+ import { useTranslations as n } from "../../composables/useTranslations.js";
2
+ const a = {
3
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
5
  PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
6
  RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
- RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
7
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
8
+ NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations",
9
+ MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/migrate-strategies",
10
+ // The template route narrows the recommendations resource before the action: the id
11
+ // travels in the body, not the path.
12
+ TEMPLATE_MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/template/migrate-strategies"
8
13
  }, c = {
14
+ campaign: a.MIGRATE_STRATEGIES_PATH,
15
+ template: a.TEMPLATE_MIGRATE_STRATEGIES_PATH
16
+ }, d = {
9
17
  CLIENT_ID: "clientId"
10
- }, d = () => {
11
- const e = r();
18
+ }, m = () => {
19
+ const e = n();
12
20
  return [
13
21
  {
14
22
  id: 11,
@@ -71,73 +79,74 @@ const l = {
71
79
  path: "top-sellers"
72
80
  }
73
81
  ];
74
- }, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
82
+ }, p = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], T = [
75
83
  { text: "before the amount", value: "0" },
76
84
  { text: "after the amount", value: "1" }
77
85
  ], v = [
78
86
  { text: "dot(.)", value: "." },
79
87
  { text: "comma(,)", value: "," },
80
88
  { text: "space( )", value: " " }
81
- ], h = [
89
+ ], A = [
82
90
  { text: "0", value: "0" },
83
91
  { text: "1", value: "1" },
84
92
  { text: "2", value: "2" },
85
93
  { text: "3", value: "3" },
86
94
  { text: "4", value: "4" },
87
95
  { text: "5", value: "5" }
88
- ], a = "||", t = [
96
+ ], r = "||", t = [
89
97
  { text: "is exactly", value: "=" },
90
98
  { text: "contains", value: "~" },
91
99
  { text: "does not contain", value: "!~" },
92
- { text: "any of", value: a }
93
- ], n = [
100
+ { text: "any of", value: r }
101
+ ], o = [
94
102
  { text: "is exactly", value: "=" },
95
103
  { text: "is not exactly", value: "!==" },
96
104
  { text: "contains", value: "~" },
97
105
  { text: "does not contain", value: "!~" },
98
- { text: "any of", value: a }
99
- ], o = [
106
+ { text: "any of", value: r }
107
+ ], s = [
100
108
  { text: "is equal to", value: "=" },
101
109
  { text: "is greater than", value: ">" },
102
110
  { text: "is less than", value: "<" }
103
- ], s = [
111
+ ], i = [
104
112
  { text: "is equal to", value: "=" },
105
113
  { text: "after", value: ">" },
106
114
  { text: "before", value: "<" }
107
- ], i = [
115
+ ], u = [
108
116
  { text: "true", value: "==" },
109
117
  { text: "false", value: "!=" }
110
- ], x = (e) => {
118
+ ], E = (e) => {
111
119
  if (!e)
112
120
  return t;
113
121
  switch (e) {
114
122
  case "Boolean":
115
- return i;
123
+ return u;
116
124
  case "Date":
117
- return s;
125
+ return i;
118
126
  case "Number":
119
- return o;
127
+ return s;
120
128
  case "String":
121
129
  return t;
122
130
  case "Strings":
123
- return n;
131
+ return o;
124
132
  default:
125
133
  return t;
126
134
  }
127
135
  };
128
136
  export {
129
- a as OP_ANY_OF,
130
- m as PriceAttributes,
131
- c as QUERY_PARAMS,
132
- l as URLS,
133
- h as currencyDecimalCounts,
134
- p as currencyLocationMaps,
137
+ c as MIGRATION_PATHS,
138
+ r as OP_ANY_OF,
139
+ p as PriceAttributes,
140
+ d as QUERY_PARAMS,
141
+ a as URLS,
142
+ A as currencyDecimalCounts,
143
+ T as currencyLocationMaps,
135
144
  v as currencyOperators,
136
- x as getOperatorOptions,
137
- d as getRecommendationFeedSourceMaps,
138
- n as operatorOptionsForArrayOfStrings,
139
- i as operatorOptionsForBooleans,
140
- s as operatorOptionsForDates,
141
- o as operatorOptionsForNumbers,
145
+ E as getOperatorOptions,
146
+ m as getRecommendationFeedSourceMaps,
147
+ o as operatorOptionsForArrayOfStrings,
148
+ u as operatorOptionsForBooleans,
149
+ i as operatorOptionsForDates,
150
+ s as operatorOptionsForNumbers,
142
151
  t as operatorOptionsForStrings
143
152
  };
@@ -67,7 +67,7 @@ class se extends ut {
67
67
  (d, c) => `
68
68
  <div data-reorder-icon-key="${P}${c}" style="display: none;">
69
69
  <${_.BUTTON}
70
- class="drag-handle-btn flat-inline flat-white"
70
+ class="guido-drag-handle-btn flat-inline flat-white"
71
71
  ${O.BUTTON.name}="${P}${c}"
72
72
  >
73
73
  <${_.ICON}
@@ -328,7 +328,7 @@ class se extends ut {
328
328
  _createBuiltInItemHtml(t, e) {
329
329
  return `
330
330
  <div class="orderable-item" draggable="true" data-key="${t.key}">
331
- <span class="drag-handle" data-reorder-icon-slot="${e}"></span>
331
+ <span class="guido-drag-handle" data-reorder-icon-slot="${e}"></span>
332
332
  <span class="item-label">${this.api.translate(t.label)}</span>
333
333
  <div class="item-action" data-action-for="${t.key}"></div>
334
334
  </div>
@@ -353,7 +353,7 @@ class se extends ut {
353
353
  <div class="orderable-item price-group-item" draggable="true"
354
354
  data-key="${C}" data-group="prices">
355
355
  <div class="price-group-header">
356
- <span class="drag-handle" data-reorder-icon-slot="${t}"></span>
356
+ <span class="guido-drag-handle" data-reorder-icon-slot="${t}"></span>
357
357
  <span class="item-label">${this.api.translate("Product Prices")}</span>
358
358
  <div class="item-action" data-action-for="${C}"></div>
359
359
  </div>
@@ -365,7 +365,7 @@ class se extends ut {
365
365
  return `
366
366
  <div class="orderable-item" draggable="true"
367
367
  data-key="${t}" data-custom-index="${e}">
368
- <span class="drag-handle" data-reorder-icon-slot="${r}"></span>
368
+ <span class="guido-drag-handle" data-reorder-icon-slot="${r}"></span>
369
369
  <div class="custom-attr-select-wrap"
370
370
  data-custom-select-slot="${e}"></div>
371
371
  <div class="item-action"