@useinsider/guido 3.18.1-beta.2e195ed → 3.18.1-beta.3826f39

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.
@@ -1,75 +1,72 @@
1
- import p from "../static/assets/icons/line-change.svg.js";
2
- import s from "../static/assets/icons/line-delete.svg.js";
3
- import a from "../static/assets/icons/line-plus.svg.js";
4
- import c from "../static/styles/base.css.js";
5
- import f from "../static/styles/components/alert-message.css.js";
6
- import C from "../static/styles/components/amp-block.css.js";
7
- import l from "../static/styles/components/base-input.css.js";
8
- import d from "../static/styles/components/button-group.css.js";
1
+ import i from "../static/assets/icons/line-change.svg.js";
2
+ import p from "../static/assets/icons/line-delete.svg.js";
3
+ import s from "../static/assets/icons/line-plus.svg.js";
4
+ import a from "../static/styles/base.css.js";
5
+ import C from "../static/styles/components/alert-message.css.js";
6
+ import c from "../static/styles/components/amp-block.css.js";
7
+ import f from "../static/styles/components/base-input.css.js";
8
+ import l from "../static/styles/components/button-group.css.js";
9
9
  import u from "../static/styles/components/button.css.js";
10
- import h from "../static/styles/components/combobox.css.js";
11
- import g from "../static/styles/components/counter.css.js";
10
+ import d from "../static/styles/components/combobox.css.js";
11
+ import h from "../static/styles/components/counter.css.js";
12
12
  import w from "../static/styles/components/dropdown-menu.css.js";
13
- import y from "../static/styles/components/loader.css.js";
14
- import I from "../static/styles/components/narrow-panel.css.js";
15
- import A from "../static/styles/components/popup.css.js";
16
- import b from "../static/styles/components/recommendation-strategy.css.js";
17
- import B from "../static/styles/components/switcher.css.js";
18
- import D from "../static/styles/components/tabs.css.js";
19
- import $ from "../static/styles/components/tools.css.js";
20
- import P from "../static/styles/components/version-history.css.js";
21
- import R from "../static/styles/components/wide-panel.css.js";
22
- import T from "../static/styles/variables.css.js";
23
- function r(S, o) {
24
- return `--guido-icon-${S}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
13
+ import I from "../static/styles/components/loader.css.js";
14
+ import g from "../static/styles/components/narrow-panel.css.js";
15
+ import y from "../static/styles/components/popup.css.js";
16
+ import A from "../static/styles/components/recommendation-strategy.css.js";
17
+ import b from "../static/styles/components/switcher.css.js";
18
+ import B from "../static/styles/components/tabs.css.js";
19
+ import D from "../static/styles/components/tools.css.js";
20
+ import $ from "../static/styles/components/version-history.css.js";
21
+ import P from "../static/styles/components/wide-panel.css.js";
22
+ import R from "../static/styles/variables.css.js";
23
+ function r(t, o) {
24
+ return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
25
25
  }
26
- const x = `:host {
27
- ${r("line-change", p)}
28
- ${r("line-delete", s)}
29
- ${r("line-plus", a)}
30
- }`, M = [
26
+ const T = `:host {
27
+ ${r("line-change", i)}
28
+ ${r("line-delete", p)}
29
+ ${r("line-plus", s)}
30
+ }`, x = [
31
+ R,
32
+ // Must be on top
31
33
  T,
34
+ a,
32
35
  // Must be on top
33
- x,
36
+ C,
34
37
  c,
35
- // Must be on top
36
38
  f,
37
- C,
38
39
  l,
39
- d,
40
40
  u,
41
+ d,
41
42
  h,
42
- g,
43
43
  w,
44
- y,
45
44
  I,
46
- A,
45
+ g,
46
+ y,
47
+ b,
47
48
  B,
48
49
  D,
49
50
  $,
50
51
  P,
51
- R,
52
- b
52
+ A
53
53
  // Last: overrides button.css / wide-panel.css defaults
54
54
  ].join(`
55
55
 
56
- `), O = 3e4;
57
- let e = null;
58
- function V() {
59
- return e || (e = new CSSStyleSheet(), e.replaceSync(M)), e;
60
- }
61
- const eo = () => ({ importCss: () => {
62
- const o = V(), i = Date.now() + O, m = () => {
63
- var n;
64
- const t = (n = document.querySelector("ui-editor")) == null ? void 0 : n.shadowRoot;
65
- if (t) {
66
- t.adoptedStyleSheets.includes(o) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, o]);
56
+ `), M = 3e4, oo = () => ({ importCss: () => {
57
+ const o = new CSSStyleSheet();
58
+ o.replaceSync(x);
59
+ const n = Date.now() + M, e = () => {
60
+ var S;
61
+ const m = (S = document.querySelector("ui-editor")) == null ? void 0 : S.shadowRoot;
62
+ if (m) {
63
+ m.adoptedStyleSheets = [o];
67
64
  return;
68
65
  }
69
- Date.now() < i && requestAnimationFrame(m);
66
+ Date.now() < n && requestAnimationFrame(e);
70
67
  };
71
- m();
68
+ e();
72
69
  } });
73
70
  export {
74
- eo as useCustomInterfaceAppearance
71
+ oo as useCustomInterfaceAppearance
75
72
  };
@@ -1,23 +1,23 @@
1
- import { useActionsApi as O } from "./useActionsApi.js";
2
- import { useBlocksConfig as q } from "./useBlocksConfig.js";
3
- import { useConfig as H } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
1
+ import { useActionsApi as L } from "./useActionsApi.js";
2
+ import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
+ import { useConfig as q } from "./useConfig.js";
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";
7
7
  import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
8
8
  import { useStripoNotifications as $ } from "./useStripoNotifications.js";
9
9
  import { useToaster as G } from "./useToaster.js";
10
10
  import { localePatch as J } from "../config/i18n/index.js";
11
- import { en as b } from "../config/i18n/en/index.js";
11
+ import { en as w } from "../config/i18n/en/index.js";
12
12
  import { ToasterTypeOptions as X } from "../enums/toaster.js";
13
13
  import { useStripoApi as K } from "../services/stripoApi.js";
14
14
  import Q from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as k } from "../stores/editor.js";
15
+ import { useEditorStore as b } from "../stores/editor.js";
16
16
  import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
19
  const he = () => {
20
- const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = q(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((i, s) => {
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) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  i();
@@ -29,16 +29,16 @@ const he = () => {
29
29
  }, document.body.appendChild(e);
30
30
  }), n.catch(() => {
31
31
  n = null;
32
- }), n), D = async (i, s, o, a = [], r = !1) => {
32
+ }), n), _ = async (i, s, o, a = [], r = !1) => {
33
33
  var y, E, h, C;
34
- const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), x = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
- w().importCss(), await window.UIEditor.initEditor(
34
+ const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), I = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
+ H().importCss(), await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
38
38
  metadata: s,
39
39
  html: d,
40
- css: R,
41
- forceRecreate: I,
40
+ css: D,
41
+ forceRecreate: U,
42
42
  locale: "en",
43
43
  undoButtonSelector: "#guido__undo-button",
44
44
  redoButtonSelector: "#guido__redo-button",
@@ -52,7 +52,7 @@ const he = () => {
52
52
  conditionsEnabled: S,
53
53
  customConditionsEnabled: S,
54
54
  enableXSSSecurity: !0,
55
- modulesDisabled: U,
55
+ modulesDisabled: P,
56
56
  syncModulesEnabled: r,
57
57
  messageSettingsEnabled: !0,
58
58
  displayGmailAnnotations: !0,
@@ -62,7 +62,7 @@ const he = () => {
62
62
  displayUTM: !1,
63
63
  selectElementAfterDrop: !0,
64
64
  sameFontSizeForOutlook: !0,
65
- allowedScriptSourceDomains: x,
65
+ allowedScriptSourceDomains: I,
66
66
  ...g ? { baseBlocks: g } : {},
67
67
  editorFonts: {
68
68
  showDefaultStandardFonts: !0,
@@ -80,7 +80,7 @@ const he = () => {
80
80
  ],
81
81
  async onTokenRefreshRequest(t) {
82
82
  try {
83
- const l = await M();
83
+ const l = await B();
84
84
  t(l);
85
85
  } catch (l) {
86
86
  p(l, "Failed to refresh token");
@@ -88,8 +88,8 @@ const he = () => {
88
88
  },
89
89
  onTemplateLoaded() {
90
90
  try {
91
- const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = O(), { injectFullStory: L } = N();
92
- w().importCss(), t(), L(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
91
+ const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = L(), { injectFullStory: x } = N();
92
+ t(), x(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
@@ -108,34 +108,34 @@ const he = () => {
108
108
  onDataChanged() {
109
109
  e.hasChanges = !0;
110
110
  },
111
- onEvent: F,
112
- onModuleAdd: A,
113
- notifications: _(),
111
+ onEvent: v,
112
+ onModuleAdd: F,
113
+ notifications: V(),
114
114
  ignoreClickOutsideSelectors: [
115
115
  "#guido-dynamic-content-modal",
116
116
  ".in-on-board-wrapper",
117
117
  ".in-drawer__container"
118
118
  ],
119
- extensions: P,
119
+ extensions: R,
120
120
  localePatch: J
121
121
  }
122
122
  );
123
123
  };
124
124
  return { initPlugin: async (i, s, o) => {
125
- const a = k();
125
+ const a = b();
126
126
  try {
127
127
  await f();
128
128
  const [r, e] = await Promise.all([
129
- T(),
130
- v()
129
+ M(),
130
+ T()
131
131
  ]);
132
- a.syncModulesEnabled = e, await D(i, s, o, r, e);
132
+ a.syncModulesEnabled = e, await _(i, s, o, r, e);
133
133
  } catch {
134
- a.loadingStatus = !1, B({
134
+ a.loadingStatus = !1, k({
135
135
  type: X.Error,
136
- message: b["An error has occurred. Please report the error code to support."],
136
+ message: w["An error has occurred. Please report the error code to support."],
137
137
  actionButton: {
138
- text: b["Reload page"],
138
+ text: w["Reload page"],
139
139
  onClick: () => window.location.reload()
140
140
  }
141
141
  });
@@ -1,18 +1,18 @@
1
1
  var m = Object.defineProperty;
2
- var C = (g, c, t) => c in g ? m(g, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[c] = t;
3
- var r = (g, c, t) => C(g, typeof c != "symbol" ? c + "" : c, t);
2
+ var C = (h, l, t) => l in h ? m(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t;
3
+ var n = (h, l, t) => C(h, typeof l != "symbol" ? l + "" : l, t);
4
4
  import { useConfig as p } from "../../../../../composables/useConfig.js";
5
5
  import { ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { CommonControl as N } from "../../../common-control.js";
7
7
  import { CURRENT_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
8
8
  import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
9
- import { RecommendationConfigService as l } from "../../services/configService.js";
9
+ import { RecommendationConfigService as c } from "../../services/configService.js";
10
10
  import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
11
11
  import { registerNodeConfigWriter as b } from "../../utils/nodeConfigWriter.js";
12
12
  import { AlgorithmControl as T } from "./algorithm.js";
13
13
  import { ALGORITHM_CONTROL_ID as ut } from "./algorithm.js";
14
14
  import { CurrencyControl as P } from "./currency.js";
15
- import { CURRENCY_CONTROL_ID as gt } from "./currency.js";
15
+ import { CURRENCY_CONTROL_ID as ht } from "./currency.js";
16
16
  import { FiltersControl as S } from "./filters.js";
17
17
  import { FILTERS_CONTROL_ID as ft } from "./filters.js";
18
18
  import { LayoutOrientationControl as O } from "./layoutOrientation.js";
@@ -31,36 +31,36 @@ import { StrategyControl as w } from "./strategy.js";
31
31
  import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
32
32
  import { setCurrencyAttributes as A, getBlockElement as v, isPartnerManagedBlock as x, updateProductContentInPlace as B, regenerateProductRowsWithStyles as U } from "./utils.js";
33
33
  import { adjustProductsToSize as kt, formatProductPrice as Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
34
- import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
35
- const W = "ui-elements-recommendation-block";
34
+ import { useDebounceFn as g } from "../../../../../node_modules/@vueuse/shared/index.js";
35
+ const $ = "ui-elements-recommendation-block";
36
36
  class at extends N {
37
37
  constructor() {
38
38
  super(...arguments);
39
- r(this, "store", R());
40
- r(this, "storeUnsubscription", () => {
39
+ n(this, "store", R());
40
+ n(this, "storeUnsubscription", () => {
41
41
  });
42
42
  // blockId -> fingerprint of the node config as it looked at the last sync.
43
- r(this, "syncedConfigs", /* @__PURE__ */ new Map());
43
+ n(this, "syncedConfigs", /* @__PURE__ */ new Map());
44
44
  // A config change waiting to reach the node config. Deferred so it can ride the
45
45
  // re-render's single apply() — one user action must cost one undo press.
46
- r(this, "pendingNodeConfigWrite", null);
47
- r(this, "pendingConfigFlushTimer", null);
46
+ n(this, "pendingNodeConfigWrite", null);
47
+ n(this, "pendingConfigFlushTimer", null);
48
48
  // Sub-control instances for lifecycle management
49
- r(this, "algorithmControl", null);
50
- r(this, "localeControl", null);
51
- r(this, "currencyControl", null);
52
- r(this, "productCountControl", null);
53
- r(this, "productLayoutControl", null);
54
- r(this, "filtersControl", null);
55
- r(this, "shuffleControl", null);
56
- r(this, "pricePlacementControl", null);
57
- r(this, "layoutOrientationControl", null);
58
- r(this, "strategyControl", null);
59
- r(this, "rrsEnabled", !1);
49
+ n(this, "algorithmControl", null);
50
+ n(this, "localeControl", null);
51
+ n(this, "currencyControl", null);
52
+ n(this, "productCountControl", null);
53
+ n(this, "productLayoutControl", null);
54
+ n(this, "filtersControl", null);
55
+ n(this, "shuffleControl", null);
56
+ n(this, "pricePlacementControl", null);
57
+ n(this, "layoutOrientationControl", null);
58
+ n(this, "strategyControl", null);
59
+ n(this, "rrsEnabled", !1);
60
60
  /**
61
61
  * Debounced product fetch to prevent rapid API calls during config changes
62
62
  */
63
- r(this, "_debouncedFetchProducts", h(async () => {
63
+ n(this, "_debouncedFetchProducts", g(async () => {
64
64
  try {
65
65
  await this.store.fetchRecommendationProducts();
66
66
  } finally {
@@ -78,7 +78,7 @@ class at extends N {
78
78
  * count. The store pads products to the configured size, so in-place only
79
79
  * fails when the size actually changed.
80
80
  */
81
- r(this, "_debouncedRegenerateWithProducts", h(() => {
81
+ n(this, "_debouncedRegenerateWithProducts", g(() => {
82
82
  const t = this.store.recommendationProducts;
83
83
  if (!this.currentNode || !this.api)
84
84
  return;
@@ -99,7 +99,7 @@ class at extends N {
99
99
  }, 100));
100
100
  }
101
101
  getId() {
102
- return W;
102
+ return $;
103
103
  }
104
104
  get _subControls() {
105
105
  return [
@@ -142,8 +142,8 @@ class at extends N {
142
142
  const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
143
143
  if (!e)
144
144
  return;
145
- const o = this._getRecommendationIdFromNode(t) === null ? null : l.getConfig(t), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
146
- e.classList.toggle("strategy-block", n);
145
+ const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
146
+ e.classList.toggle("strategy-block", r);
147
147
  }
148
148
  async onRender() {
149
149
  var o;
@@ -161,9 +161,9 @@ class at extends N {
161
161
  const e = this._getRecommendationIdFromNode(t);
162
162
  e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && this._syncNodeConfigIfChanged(e), this._showControlsForBlock(t), e !== null && !((o = this.store.blockStates[e]) != null && o.isInitialized) && this._fetchBlockData(e).then(() => {
163
163
  this._initializeSubControls();
164
- }), this._subControls.forEach((n) => {
164
+ }), this._subControls.forEach((r) => {
165
165
  var i;
166
- n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
166
+ r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
167
167
  });
168
168
  }
169
169
  onDestroy() {
@@ -203,23 +203,18 @@ class at extends N {
203
203
  */
204
204
  _syncNodeConfigIfChanged(t) {
205
205
  this.pendingNodeConfigWrite && this.pendingNodeConfigWrite.blockId !== t && this._flushPendingNodeConfig();
206
- const e = JSON.stringify(l.getConfig(this.currentNode)), o = this.syncedConfigs.get(t);
206
+ const e = JSON.stringify(c.getConfig(this.currentNode)), o = this.syncedConfigs.get(t);
207
207
  this.syncedConfigs.set(t, e), o !== e && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
208
208
  }
209
- /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
210
- _isPendingStrategyIdChange() {
211
- const t = this.pendingNodeConfigWrite;
212
- return t ? l.getConfig(this.currentNode).strategyId !== t.updates.strategyId : !1;
213
- }
214
209
  _capturePendingNodeConfigWrite() {
215
210
  const t = this.store.currentRecommendationId;
216
211
  if (!this.currentNode || !this.api || t === null)
217
212
  return;
218
- const { filters: e, strategyId: o, size: n } = this.store.recommendationConfigs;
213
+ const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
219
214
  this.pendingNodeConfigWrite = {
220
215
  blockId: t,
221
216
  node: this.currentNode,
222
- updates: { filters: e, strategyId: o, size: n }
217
+ updates: { filters: e, strategyId: o, size: r }
223
218
  };
224
219
  }
225
220
  /**
@@ -234,7 +229,7 @@ class at extends N {
234
229
  */
235
230
  _stagePendingNodeConfig(t) {
236
231
  const e = this.pendingNodeConfigWrite;
237
- return !e || !this.currentNode ? !1 : (l.stageConfig(t, this.currentNode, e.updates), !0);
232
+ return !e || !this.currentNode ? !1 : (c.stageConfig(t, this.currentNode, e.updates), !0);
238
233
  }
239
234
  /**
240
235
  * Arms the guaranteed fallback write, once the product fetch has settled. The
@@ -258,12 +253,12 @@ class at extends N {
258
253
  const t = this.pendingNodeConfigWrite;
259
254
  if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !t || !this.api)
260
255
  return;
261
- const e = t.blockId === this.store.currentRecommendationId && this.currentNode ? this.currentNode : t.node, o = l.getConfig(e);
262
- JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategyId === t.updates.strategyId && o.size === t.updates.size || l.updateConfig(this.api, e, t.updates, "Update recommendation filters");
256
+ const e = t.blockId === this.store.currentRecommendationId && this.currentNode ? this.currentNode : t.node, o = c.getConfig(e);
257
+ JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategyId === t.updates.strategyId && o.size === t.updates.size || c.updateConfig(this.api, e, t.updates, "Update recommendation filters");
263
258
  }
264
259
  _syncNodeConfigToStore() {
265
- var n;
266
- const t = l.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((n = this.store.blockStates[e]) == null ? void 0 : n.isInitialized);
260
+ var r;
261
+ const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
267
262
  this.store.patchCurrentBlockConfig({
268
263
  strategy: t.strategy,
269
264
  strategyId: t.strategyId,
@@ -305,8 +300,8 @@ class at extends N {
305
300
  t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
306
301
  this.store.fetchRecommendationCreateData(),
307
302
  this.store.fetchRecommendationFilters()
308
- ])).forEach((o, n) => {
309
- o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][n]} failed`, o.reason);
303
+ ])).forEach((o, r) => {
304
+ o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
310
305
  }), this._applySmartDefaults();
311
306
  try {
312
307
  await this.store.fetchRecommendationProducts();
@@ -327,8 +322,8 @@ class at extends N {
327
322
  _applySmartDefaults() {
328
323
  if (!this.currentNode || !this.api)
329
324
  return;
330
- const t = l.getConfig(this.currentNode), e = {};
331
- let o = null, n = null, i = null;
325
+ const t = c.getConfig(this.currentNode), e = {};
326
+ let o = null, r = null, i = null;
332
327
  if (t.currency.code === a.currency.code) {
333
328
  const { currencyList: s } = this.store;
334
329
  s.length > 0 && (s.some(
@@ -343,7 +338,7 @@ class at extends N {
343
338
  const s = this.store.getActivePredictiveAlgorithms;
344
339
  s.length > 0 && (s.some(
345
340
  (d) => d.value === a.strategy
346
- ) || (n = s[0].value, e.strategy = n));
341
+ ) || (r = s[0].value, e.strategy = r));
347
342
  }
348
343
  if (t.language === a.language) {
349
344
  const s = this.store.getLanguages;
@@ -351,7 +346,7 @@ class at extends N {
351
346
  (d) => d.value === a.language
352
347
  ) || (i = s[0].value, e.language = i));
353
348
  }
354
- !o && !n && !i || (l.updateConfig(
349
+ !o && !r && !i || (c.updateConfig(
355
350
  this.api,
356
351
  this.currentNode,
357
352
  e,
@@ -372,7 +367,7 @@ class at extends N {
372
367
  thousandSeparator: a.currency.thousandSeparator
373
368
  }
374
369
  } : {},
375
- ...n ? { strategy: n } : {},
370
+ ...r ? { strategy: r } : {},
376
371
  ...i ? { language: i } : {}
377
372
  }, { triggerRefetch: !1 }));
378
373
  }
@@ -386,8 +381,8 @@ class at extends N {
386
381
  const o = e.getAttribute(I);
387
382
  if (!o)
388
383
  return null;
389
- const n = parseInt(o);
390
- return Number.isNaN(n) ? null : n;
384
+ const r = parseInt(o);
385
+ return Number.isNaN(r) ? null : r;
391
386
  }
392
387
  /**
393
388
  * Listen to store changes that require product refresh or regeneration.
@@ -404,15 +399,15 @@ class at extends N {
404
399
  */
405
400
  _listenStateUpdates() {
406
401
  const { store: t } = this;
407
- let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
402
+ let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
408
403
  this.storeUnsubscription = t.$subscribe(() => {
409
404
  const i = t.currentRecommendationId;
410
- if (i !== n) {
411
- n = i, e = t.recommendationProducts, o = t.$state.configVersion;
405
+ if (i !== r) {
406
+ r = i, e = t.recommendationProducts, o = t.$state.configVersion;
412
407
  return;
413
408
  }
414
409
  const s = t.$state.configVersion;
415
- s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts());
410
+ s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
416
411
  const u = t.recommendationProducts, d = u !== e, f = Array.isArray(u) && u.length > 0;
417
412
  d && f && (e = u, this._debouncedRegenerateWithProducts());
418
413
  });
@@ -421,8 +416,8 @@ class at extends N {
421
416
  export {
422
417
  ut as ALGORITHM_CONTROL_ID,
423
418
  T as AlgorithmControl,
424
- W as CONTROL_BLOCK_ID,
425
- gt as CURRENCY_CONTROL_ID,
419
+ $ as CONTROL_BLOCK_ID,
420
+ ht as CURRENCY_CONTROL_ID,
426
421
  P as CurrencyControl,
427
422
  ft as FILTERS_CONTROL_ID,
428
423
  S as FiltersControl,
@@ -2,17 +2,16 @@ var u = Object.defineProperty;
2
2
  var S = (o, n, t) => n in o ? u(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
3
  var r = (o, n, t) => S(o, typeof n != "symbol" ? n + "" : n, t);
4
4
  import { ACADEMY_LINKS as _ } from "../../../../../enums/academy.js";
5
- import { useOnboardingStore as f } from "../../../../../stores/onboarding.js";
6
- import { CommonControl as v } from "../../../common-control.js";
7
- import { CURRENT_CONFIG_VERSION as b } from "../../constants/defaultConfig.js";
5
+ import { useOnboardingStore as v } from "../../../../../stores/onboarding.js";
6
+ import { CommonControl as f } from "../../../common-control.js";
8
7
  import { RecommendationConfigService as h } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
8
+ import { useRecommendationExtensionStore as b } from "../../store/recommendation.js";
10
9
  const k = "recommendation-strategy-control";
11
- class I extends v {
10
+ class L extends f {
12
11
  constructor() {
13
12
  super(...arguments);
14
- r(this, "store", C());
15
- r(this, "onboardingStore", f());
13
+ r(this, "store", b());
14
+ r(this, "onboardingStore", v());
16
15
  r(this, "storeUnsubscription", () => {
17
16
  });
18
17
  r(this, "listeners", []);
@@ -116,10 +115,7 @@ class I extends v {
116
115
  * strategyId) for an assigned block.
117
116
  */
118
117
  _isNodeUnassigned() {
119
- if (!h.hasConfig(this.currentNode))
120
- return !1;
121
- const t = h.getConfig(this.currentNode);
122
- return !t.strategyId && (t.configVersion ?? 0) >= b;
118
+ return h.hasConfig(this.currentNode) && !h.getConfig(this.currentNode).strategyId;
123
119
  }
124
120
  onDestroy() {
125
121
  this._teardown();
@@ -140,7 +136,7 @@ class I extends v {
140
136
  }
141
137
  _renderState() {
142
138
  var p;
143
- const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((p = this.store.assignedStrategy) == null ? void 0 : p.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), i = `${t}\0${e}\0${a}`;
139
+ const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((p = this.store.assignedStrategy) == null ? void 0 : p.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesFetched), i = `${t}\0${e}\0${a}`;
144
140
  if (i === this.lastPaintedState)
145
141
  return;
146
142
  const s = this.getContainer();
@@ -152,5 +148,5 @@ class I extends v {
152
148
  }
153
149
  export {
154
150
  k as STRATEGY_CONTROL_ID,
155
- I as StrategyControl
151
+ L as StrategyControl
156
152
  };
@@ -1,6 +1,6 @@
1
1
  import { getRecommendationFeedSourceMaps as k, strategyEditPath as G, URLS as D, getOperatorOptions as _, PriceAttributes as L } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import { useRecommendationApi as E } from "../../../../services/recommendationApi.js";
3
- import { useConfigStore as F } from "../../../../stores/config.js";
3
+ import { useConfigStore as P } from "../../../../stores/config.js";
4
4
  import { defineStore as N } from "pinia";
5
5
  import "../constants/selectors.js";
6
6
  import { DEFAULT_MOBILE_CARDS_IN_ROW as U, DEFAULT_CARDS_IN_ROW as A } from "../constants/layout.js";
@@ -14,8 +14,8 @@ import { getInvalidFields as z, isConfigValid as V } from "../validation/require
14
14
  const d = E();
15
15
  let h = null, g = null, S = null, p = null, y = 0;
16
16
  const b = /* @__PURE__ */ new Map();
17
- let l = null;
18
- function P() {
17
+ let u = null;
18
+ function F() {
19
19
  return {
20
20
  cardsInRow: A,
21
21
  currencySettings: {
@@ -41,7 +41,7 @@ function P() {
41
41
  // that default is what reached buildCampaignUrl and baked a most-popular feed URL
42
42
  // for a block the user never configured (SD-149916). Legacy blocks still get their real
43
43
  // algorithm from the node-config sync or the save-time seed.
44
- strategy: F().isFeatureEnabled("reusableRecommendationStrategy") ? "" : "mostPopular",
44
+ strategy: P().isFeatureEnabled("reusableRecommendationStrategy") ? "" : "mostPopular",
45
45
  strategyId: "",
46
46
  textTrimming: !0,
47
47
  unresponsive: !1,
@@ -53,7 +53,7 @@ function P() {
53
53
  }
54
54
  function w() {
55
55
  return {
56
- recommendationConfigs: P(),
56
+ recommendationConfigs: F(),
57
57
  recommendationProducts: [],
58
58
  filterStatus: !1,
59
59
  filterSelectionDrawerStatus: !1,
@@ -74,7 +74,6 @@ const j = () => ({
74
74
  strategiesLoading: !1,
75
75
  strategyUrlTemplates: {},
76
76
  strategiesFetched: !1,
77
- strategiesSettled: !1,
78
77
  blockStates: {},
79
78
  currentRecommendationId: null,
80
79
  strategyPanelOpen: !1,
@@ -90,7 +89,7 @@ const j = () => ({
90
89
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
91
90
  */
92
91
  recommendationConfigs(t) {
93
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : P();
92
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : F();
94
93
  },
95
94
  /**
96
95
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
@@ -353,33 +352,28 @@ const j = () => ({
353
352
  this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !1);
354
353
  },
355
354
  async fetchStrategies() {
356
- for (; p; )
357
- try {
358
- await p;
359
- } catch {
360
- }
361
- if (this.strategiesFetched)
355
+ if (p && await p, this.strategiesFetched)
362
356
  return;
363
- const t = y, e = (async () => {
357
+ const t = y;
358
+ p = (async () => {
364
359
  this.strategiesLoading = !0;
365
360
  try {
366
- const r = await d.fetchRecommendationStrategies();
361
+ const e = await d.fetchRecommendationStrategies();
367
362
  if (t !== y)
368
363
  return;
369
- this.strategies = r, this.strategiesFetched = !0;
364
+ this.strategies = e, this.strategiesFetched = !0;
370
365
  } finally {
371
- this.strategiesLoading = !1, t === y && (this.strategiesSettled = !0);
366
+ this.strategiesLoading = !1;
372
367
  }
373
368
  })();
374
- p = e;
375
369
  try {
376
- await e;
370
+ await p;
377
371
  } finally {
378
372
  p = null;
379
373
  }
380
374
  },
381
375
  invalidateStrategies() {
382
- this.strategiesFetched = !1, this.strategiesSettled = !1, y += 1;
376
+ this.strategiesFetched = !1, y += 1;
383
377
  },
384
378
  /**
385
379
  * Opens a Smart Recommender strategy page in a new tab and refreshes the list every time
@@ -388,24 +382,20 @@ const j = () => ({
388
382
  *
389
383
  * Deliberately NOT one-shot: the strategy tab stays open, so a user can create a second
390
384
  * strategy in it and come back again — a listener that disarmed on the first return would
391
- * leave that one missing from the list. It disarms on the first return AFTER that tab is
392
- * closed instead, so an ordinary alt-tab later in the session costs nothing. Armed only
393
- * once the user actually opens a strategy page, so anyone who never does pays nothing.
385
+ * leave that one missing from the list. Armed only once the user actually opens a strategy
386
+ * page, so anyone who never does pays nothing.
394
387
  */
395
388
  _armStrategyPageReturn(t) {
396
- const e = window.open(t, "_blank");
397
- if (!e)
398
- return;
399
- e.opener = null, l == null || l();
400
- let r = !1;
401
- const n = () => {
402
- document.hidden || r || (e != null && e.closed && (l == null || l()), r = !0, this.invalidateStrategies(), this.fetchStrategies().then(() => this._refreshAssignedStrategyProducts()).catch(() => {
389
+ window.open(t, "_blank", "noopener"), u == null || u();
390
+ let e = !1;
391
+ const r = () => {
392
+ document.hidden || e || (e = !0, this.invalidateStrategies(), this.fetchStrategies().then(() => this._refreshAssignedStrategyProducts()).catch(() => {
403
393
  }).finally(() => {
404
- r = !1;
394
+ e = !1;
405
395
  }));
406
396
  };
407
- document.addEventListener("visibilitychange", n), window.addEventListener("focus", n), l = () => {
408
- document.removeEventListener("visibilitychange", n), window.removeEventListener("focus", n), l = null;
397
+ document.addEventListener("visibilitychange", r), window.addEventListener("focus", r), u = () => {
398
+ document.removeEventListener("visibilitychange", r), window.removeEventListener("focus", r), u = null;
409
399
  };
410
400
  },
411
401
  /**
@@ -422,7 +412,7 @@ const j = () => ({
422
412
  },
423
413
  /** Lets the editor tear the return listeners down when it unmounts. */
424
414
  disposeStrategyPageReturn() {
425
- l == null || l();
415
+ u == null || u();
426
416
  },
427
417
  /**
428
418
  * Opens Smart Recommender's strategy creation page. Every return refreshes the list so the
@@ -601,7 +591,7 @@ const j = () => ({
601
591
  },
602
592
  async _doFetchProducts() {
603
593
  var f;
604
- const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = F();
594
+ const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = P();
605
595
  if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
606
596
  await this._doFetchStrategyProducts(t);
607
597
  return;
@@ -623,13 +613,13 @@ const j = () => ({
623
613
  a,
624
614
  M(n.partnerName, r.strategy)
625
615
  );
626
- let u;
616
+ let l;
627
617
  try {
628
- u = await d.fetchRecommendationProducts(c, a);
618
+ l = await d.fetchRecommendationProducts(c, a);
629
619
  } catch {
630
- u = [];
620
+ l = [];
631
621
  }
632
- this._setBlockProducts(t, u, s);
622
+ this._setBlockProducts(t, l, s);
633
623
  },
634
624
  async _doFetchStrategyProducts(t) {
635
625
  const e = (b.get(t) ?? 0) + 1;
@@ -643,7 +633,7 @@ const j = () => ({
643
633
  );
644
634
  if (i) {
645
635
  s = parseInt(String(i.size ?? "")) || s;
646
- const o = r.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(i, o)).replaceAll("{locale}", r.language).replaceAll("{currency}", o), u = a.indexOf("?"), f = u === -1 ? a : a.slice(0, u), m = (u === -1 ? "" : a.slice(u + 1)).split("&").filter((R) => R && !R.startsWith("user_id=")), I = m.length ? `${f}?${m.join("&")}` : f;
636
+ const o = r.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(i, o)).replaceAll("{locale}", r.language).replaceAll("{currency}", o), l = a.indexOf("?"), f = l === -1 ? a : a.slice(0, l), m = (l === -1 ? "" : a.slice(l + 1)).split("&").filter((R) => R && !R.startsWith("user_id=")), I = m.length ? `${f}?${m.join("&")}` : f;
647
637
  I && (n = await d.fetchRecommendationProductsByUrl(I));
648
638
  }
649
639
  } catch {
@@ -66,8 +66,6 @@ export declare class RecommendationBlockControl extends CommonControl {
66
66
  * edits are never clobbered (SD-141049).
67
67
  */
68
68
  private _syncNodeConfigIfChanged;
69
- /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
70
- private _isPendingStrategyIdChange;
71
69
  private _capturePendingNodeConfigWrite;
72
70
  /**
73
71
  * Accumulates the pending write into `documentModifier` without applying, so the
@@ -72,7 +72,6 @@ interface StoreState {
72
72
  strategiesLoading: boolean;
73
73
  strategyUrlTemplates: Record<string, string>;
74
74
  strategiesFetched: boolean;
75
- strategiesSettled: boolean;
76
75
  blockStates: Record<number, PerBlockState>;
77
76
  currentRecommendationId: number | null;
78
77
  strategyPanelOpen: boolean;
@@ -103,7 +102,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
103
102
  strategiesLoading: boolean;
104
103
  strategyUrlTemplates: Record<string, string>;
105
104
  strategiesFetched: boolean;
106
- strategiesSettled: boolean;
107
105
  blockStates: Record<number, PerBlockState>;
108
106
  currentRecommendationId: number | null;
109
107
  strategyPanelOpen: boolean;
@@ -132,7 +130,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
132
130
  strategiesLoading: boolean;
133
131
  strategyUrlTemplates: Record<string, string>;
134
132
  strategiesFetched: boolean;
135
- strategiesSettled: boolean;
136
133
  blockStates: Record<number, PerBlockState>;
137
134
  currentRecommendationId: number | null;
138
135
  strategyPanelOpen: boolean;
@@ -161,7 +158,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
161
158
  strategiesLoading: boolean;
162
159
  strategyUrlTemplates: Record<string, string>;
163
160
  strategiesFetched: boolean;
164
- strategiesSettled: boolean;
165
161
  blockStates: Record<number, PerBlockState>;
166
162
  currentRecommendationId: number | null;
167
163
  strategyPanelOpen: boolean;
@@ -187,7 +183,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
187
183
  strategiesLoading: boolean;
188
184
  strategyUrlTemplates: Record<string, string>;
189
185
  strategiesFetched: boolean;
190
- strategiesSettled: boolean;
191
186
  blockStates: Record<number, PerBlockState>;
192
187
  currentRecommendationId: number | null;
193
188
  strategyPanelOpen: boolean;
@@ -213,7 +208,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
213
208
  strategiesLoading: boolean;
214
209
  strategyUrlTemplates: Record<string, string>;
215
210
  strategiesFetched: boolean;
216
- strategiesSettled: boolean;
217
211
  blockStates: Record<number, PerBlockState>;
218
212
  currentRecommendationId: number | null;
219
213
  strategyPanelOpen: boolean;
@@ -239,7 +233,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
239
233
  strategiesLoading: boolean;
240
234
  strategyUrlTemplates: Record<string, string>;
241
235
  strategiesFetched: boolean;
242
- strategiesSettled: boolean;
243
236
  blockStates: Record<number, PerBlockState>;
244
237
  currentRecommendationId: number | null;
245
238
  strategyPanelOpen: boolean;
@@ -268,7 +261,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
268
261
  strategiesLoading: boolean;
269
262
  strategyUrlTemplates: Record<string, string>;
270
263
  strategiesFetched: boolean;
271
- strategiesSettled: boolean;
272
264
  blockStates: Record<number, PerBlockState>;
273
265
  currentRecommendationId: number | null;
274
266
  strategyPanelOpen: boolean;
@@ -297,7 +289,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
297
289
  strategiesLoading: boolean;
298
290
  strategyUrlTemplates: Record<string, string>;
299
291
  strategiesFetched: boolean;
300
- strategiesSettled: boolean;
301
292
  blockStates: Record<number, PerBlockState>;
302
293
  currentRecommendationId: number | null;
303
294
  strategyPanelOpen: boolean;
@@ -327,7 +318,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
327
318
  strategiesLoading: boolean;
328
319
  strategyUrlTemplates: Record<string, string>;
329
320
  strategiesFetched: boolean;
330
- strategiesSettled: boolean;
331
321
  blockStates: Record<number, PerBlockState>;
332
322
  currentRecommendationId: number | null;
333
323
  strategyPanelOpen: boolean;
@@ -356,7 +346,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
356
346
  strategiesLoading: boolean;
357
347
  strategyUrlTemplates: Record<string, string>;
358
348
  strategiesFetched: boolean;
359
- strategiesSettled: boolean;
360
349
  blockStates: Record<number, PerBlockState>;
361
350
  currentRecommendationId: number | null;
362
351
  strategyPanelOpen: boolean;
@@ -385,7 +374,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
385
374
  strategiesLoading: boolean;
386
375
  strategyUrlTemplates: Record<string, string>;
387
376
  strategiesFetched: boolean;
388
- strategiesSettled: boolean;
389
377
  blockStates: Record<number, PerBlockState>;
390
378
  currentRecommendationId: number | null;
391
379
  strategyPanelOpen: boolean;
@@ -477,9 +465,8 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
477
465
  *
478
466
  * Deliberately NOT one-shot: the strategy tab stays open, so a user can create a second
479
467
  * strategy in it and come back again — a listener that disarmed on the first return would
480
- * leave that one missing from the list. It disarms on the first return AFTER that tab is
481
- * closed instead, so an ordinary alt-tab later in the session costs nothing. Armed only
482
- * once the user actually opens a strategy page, so anyone who never does pays nothing.
468
+ * leave that one missing from the list. Armed only once the user actually opens a strategy
469
+ * page, so anyone who never does pays nothing.
483
470
  */
484
471
  _armStrategyPageReturn(url: string): void;
485
472
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.18.1-beta.2e195ed",
3
+ "version": "3.18.1-beta.3826f39",
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",