@useinsider/guido 3.18.1-beta.cb31236 → 3.18.1-beta.d0bc5f3

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 (41) hide show
  1. package/dist/@types/config/schemas.js +51 -59
  2. package/dist/components/Guido.vue.js +4 -4
  3. package/dist/components/Guido.vue2.js +70 -72
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +9 -7
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +76 -87
  6. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +22 -24
  7. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +26 -28
  8. package/dist/composables/useCustomInterfaceAppearance.js +42 -46
  9. package/dist/enums/extensions/recommendationBlock.js +29 -25
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +71 -72
  11. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +37 -68
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -45
  13. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +119 -105
  14. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  15. package/dist/guido.css +1 -1
  16. package/dist/services/recommendationApi.js +84 -93
  17. package/dist/src/@types/config/schemas.d.ts +0 -16
  18. package/dist/src/composables/useConfig.d.ts +0 -4
  19. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -3
  20. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -1
  21. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -4
  22. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +45 -54
  23. package/dist/src/services/recommendationApi.d.ts +1 -2
  24. package/dist/src/stores/config.d.ts +0 -322
  25. package/dist/src/stores/onboarding.d.ts +0 -421
  26. package/dist/static/styles/components/recommendation-strategy.css.js +41 -74
  27. package/dist/stores/config.js +60 -74
  28. package/dist/stores/onboarding.js +1 -6
  29. package/package.json +1 -1
  30. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
  31. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
  32. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +0 -21
  33. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +0 -46
  34. package/dist/composables/useLegacyStrategyConversion.js +0 -58
  35. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -72
  36. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
  37. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +0 -2
  38. package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
  39. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -44
  40. package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
  41. package/dist/static/assets/icons/line-info.svg.js +0 -5
@@ -1,6 +1,6 @@
1
1
  var m = Object.defineProperty;
2
- var C = (g, l, t) => l in g ? m(g, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[l] = t;
3
- var r = (g, l, t) => C(g, typeof l != "symbol" ? l + "" : l, 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";
@@ -12,9 +12,9 @@ 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
- import { FILTERS_CONTROL_ID as ht } from "./filters.js";
17
+ import { FILTERS_CONTROL_ID as ft } from "./filters.js";
18
18
  import { LayoutOrientationControl as O } from "./layoutOrientation.js";
19
19
  import { LAYOUT_ORIENTATION_CONTROL_ID as Ct } from "./layoutOrientation.js";
20
20
  import { LocaleControl as L } from "./locale.js";
@@ -29,38 +29,38 @@ import { ShuffleControl as F } from "./shuffle.js";
29
29
  import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
30
30
  import { StrategyControl as w } from "./strategy.js";
31
31
  import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
32
- import { setCurrencyAttributes as A, getBlockElement as B, isPartnerManagedBlock as v, updateProductContentInPlace as x, regenerateProductRowsWithStyles as U } from "./utils.js";
33
- import { adjustProductsToSize as kt, formatProductPrice as Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as Bt, updatePricesInPlace as vt, updateSingleProductContent as xt } from "./utils.js";
34
- import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
32
+ import { setCurrencyAttributes as A, getBlockElement as v, isPartnerManagedBlock as x, updateProductContentInPlace as B, regenerateProductRowsWithStyles as U } from "./utils.js";
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 g } from "../../../../../node_modules/@vueuse/shared/index.js";
35
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", f(async () => {
63
+ n(this, "_debouncedFetchProducts", g(async () => {
64
64
  try {
65
65
  await this.store.fetchRecommendationProducts();
66
66
  } finally {
@@ -78,16 +78,16 @@ 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", f(() => {
81
+ n(this, "_debouncedRegenerateWithProducts", g(() => {
82
82
  const t = this.store.recommendationProducts;
83
83
  if (!this.currentNode || !this.api)
84
84
  return;
85
85
  const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
86
- if (v(this.currentNode)) {
86
+ if (x(this.currentNode)) {
87
87
  o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
88
88
  return;
89
89
  }
90
- x({
90
+ B({
91
91
  currentNode: this.currentNode,
92
92
  documentModifier: e,
93
93
  products: t
@@ -142,14 +142,14 @@ 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 : c.getConfig(t), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _), s = this.rrsEnabled && !!o && !n;
146
- e.classList.toggle("strategy-block", n), e.classList.toggle("legacy-strategy-block", s);
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;
150
150
  b(this.api);
151
151
  const t = this._getRecommendationIdFromNode(this.currentNode), e = t ?? this.store.currentRecommendationId;
152
- if (e !== null && this.store.setCurrentBlock(e), t !== null && this._syncNodeConfigIfChanged(t), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
152
+ if (e !== null && this.store.setCurrentBlock(e), t !== null && this._syncNodeConfigIfChanged(t), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), t !== null && this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender()), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
153
153
  this._initializeSubControls();
154
154
  return;
155
155
  }
@@ -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) => {
165
- var s;
166
- n != null && n.api && (n.currentNode = t, (s = n.onTemplateNodeUpdated) == null || s.call(n, t));
164
+ }), this._subControls.forEach((r) => {
165
+ var i;
166
+ r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
167
167
  });
168
168
  }
169
169
  onDestroy() {
@@ -210,11 +210,11 @@ class at extends N {
210
210
  const t = this.store.currentRecommendationId;
211
211
  if (!this.currentNode || !this.api || t === null)
212
212
  return;
213
- const { filters: e, strategyId: o, size: n, nodeConfigVersion: s } = this.store.recommendationConfigs;
213
+ const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
214
214
  this.pendingNodeConfigWrite = {
215
215
  blockId: t,
216
216
  node: this.currentNode,
217
- updates: { filters: e, strategyId: o, size: n, configVersion: s }
217
+ updates: { filters: e, strategyId: o, size: r }
218
218
  };
219
219
  }
220
220
  /**
@@ -257,12 +257,11 @@ class at extends N {
257
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");
258
258
  }
259
259
  _syncNodeConfigToStore() {
260
- var n;
261
- const t = c.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);
262
262
  this.store.patchCurrentBlockConfig({
263
263
  strategy: t.strategy,
264
264
  strategyId: t.strategyId,
265
- nodeConfigVersion: t.configVersion,
266
265
  language: t.language,
267
266
  size: t.size,
268
267
  productIds: t.productIds,
@@ -301,8 +300,8 @@ class at extends N {
301
300
  t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
302
301
  this.store.fetchRecommendationCreateData(),
303
302
  this.store.fetchRecommendationFilters()
304
- ])).forEach((o, n) => {
305
- 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);
306
305
  }), this._applySmartDefaults();
307
306
  try {
308
307
  await this.store.fetchRecommendationProducts();
@@ -324,30 +323,30 @@ class at extends N {
324
323
  if (!this.currentNode || !this.api)
325
324
  return;
326
325
  const t = c.getConfig(this.currentNode), e = {};
327
- let o = null, n = null, s = null;
326
+ let o = null, r = null, i = null;
328
327
  if (t.currency.code === a.currency.code) {
329
- const { currencyList: i } = this.store;
330
- i.length > 0 && (i.some(
328
+ const { currencyList: s } = this.store;
329
+ s.length > 0 && (s.some(
331
330
  (d) => d.value === `price.${a.currency.code}`
332
- ) || (o = i[0].value.replace("price.", ""), e.currency = {
331
+ ) || (o = s[0].value.replace("price.", ""), e.currency = {
333
332
  ...a.currency,
334
333
  code: o,
335
334
  symbol: o
336
335
  }));
337
336
  }
338
337
  if (t.strategy === a.strategy) {
339
- const i = this.store.getActivePredictiveAlgorithms;
340
- i.length > 0 && (i.some(
338
+ const s = this.store.getActivePredictiveAlgorithms;
339
+ s.length > 0 && (s.some(
341
340
  (d) => d.value === a.strategy
342
- ) || (n = i[0].value, e.strategy = n));
341
+ ) || (r = s[0].value, e.strategy = r));
343
342
  }
344
343
  if (t.language === a.language) {
345
- const i = this.store.getLanguages;
346
- i.length > 0 && (i.some(
344
+ const s = this.store.getLanguages;
345
+ s.length > 0 && (s.some(
347
346
  (d) => d.value === a.language
348
- ) || (s = i[0].value, e.language = s));
347
+ ) || (i = s[0].value, e.language = i));
349
348
  }
350
- !o && !n && !s || (c.updateConfig(
349
+ !o && !r && !i || (c.updateConfig(
351
350
  this.api,
352
351
  this.currentNode,
353
352
  e,
@@ -368,22 +367,22 @@ class at extends N {
368
367
  thousandSeparator: a.currency.thousandSeparator
369
368
  }
370
369
  } : {},
371
- ...n ? { strategy: n } : {},
372
- ...s ? { language: s } : {}
370
+ ...r ? { strategy: r } : {},
371
+ ...i ? { language: i } : {}
373
372
  }, { triggerRefetch: !1 }));
374
373
  }
375
374
  /**
376
375
  * Reads the recommendation-id attribute from the block element within the node
377
376
  */
378
377
  _getRecommendationIdFromNode(t) {
379
- const e = B(t);
378
+ const e = v(t);
380
379
  if (!e || !("getAttribute" in e))
381
380
  return null;
382
381
  const o = e.getAttribute(I);
383
382
  if (!o)
384
383
  return null;
385
- const n = parseInt(o);
386
- return Number.isNaN(n) ? null : n;
384
+ const r = parseInt(o);
385
+ return Number.isNaN(r) ? null : r;
387
386
  }
388
387
  /**
389
388
  * Listen to store changes that require product refresh or regeneration.
@@ -400,17 +399,17 @@ class at extends N {
400
399
  */
401
400
  _listenStateUpdates() {
402
401
  const { store: t } = this;
403
- let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
402
+ let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
404
403
  this.storeUnsubscription = t.$subscribe(() => {
405
- const s = t.currentRecommendationId;
406
- if (s !== n) {
407
- n = s, e = t.recommendationProducts, o = t.$state.configVersion;
404
+ const i = t.currentRecommendationId;
405
+ if (i !== r) {
406
+ r = i, e = t.recommendationProducts, o = t.$state.configVersion;
408
407
  return;
409
408
  }
410
- const i = t.$state.configVersion;
411
- i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
412
- const u = t.recommendationProducts, d = u !== e, h = Array.isArray(u) && u.length > 0;
413
- d && h && (e = u, this._debouncedRegenerateWithProducts());
409
+ const s = t.$state.configVersion;
410
+ s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
411
+ const u = t.recommendationProducts, d = u !== e, f = Array.isArray(u) && u.length > 0;
412
+ d && f && (e = u, this._debouncedRegenerateWithProducts());
414
413
  });
415
414
  }
416
415
  }
@@ -418,9 +417,9 @@ export {
418
417
  ut as ALGORITHM_CONTROL_ID,
419
418
  T as AlgorithmControl,
420
419
  $ as CONTROL_BLOCK_ID,
421
- gt as CURRENCY_CONTROL_ID,
420
+ ht as CURRENCY_CONTROL_ID,
422
421
  P as CurrencyControl,
423
- ht as FILTERS_CONTROL_ID,
422
+ ft as FILTERS_CONTROL_ID,
424
423
  S as FiltersControl,
425
424
  Ct as LAYOUT_ORIENTATION_CONTROL_ID,
426
425
  yt as LOCALE_CONTROL_ID,
@@ -439,15 +438,15 @@ export {
439
438
  w as StrategyControl,
440
439
  kt as adjustProductsToSize,
441
440
  Dt as formatProductPrice,
442
- B as getBlockElement,
441
+ v as getBlockElement,
443
442
  Ft as getCardComposition,
444
443
  wt as getCurrentLayout,
445
444
  At as getMainContainerTbody,
446
- v as isPartnerManagedBlock,
447
- Bt as regenerateMobileProductRows,
445
+ x as isPartnerManagedBlock,
446
+ vt as regenerateMobileProductRows,
448
447
  U as regenerateProductRowsWithStyles,
449
448
  A as setCurrencyAttributes,
450
- vt as updatePricesInPlace,
451
- x as updateProductContentInPlace,
452
- xt as updateSingleProductContent
449
+ xt as updatePricesInPlace,
450
+ B as updateProductContentInPlace,
451
+ Bt as updateSingleProductContent
453
452
  };
@@ -1,32 +1,28 @@
1
- var p = Object.defineProperty;
2
- var v = (i, s, t) => s in i ? p(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
3
- var r = (i, s, t) => v(i, typeof s != "symbol" ? s + "" : s, t);
4
- import { useLegacyStrategyConversion as _ } from "../../../../../composables/useLegacyStrategyConversion.js";
5
- import { ACADEMY_LINKS as b } from "../../../../../enums/academy.js";
1
+ var h = Object.defineProperty;
2
+ var p = (o, n, t) => n in o ? h(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
+ var r = (o, n, t) => p(o, typeof n != "symbol" ? n + "" : n, t);
4
+ import { ACADEMY_LINKS as u } from "../../../../../enums/academy.js";
6
5
  import { useOnboardingStore as S } from "../../../../../stores/onboarding.js";
7
- import { CommonControl as f } from "../../../common-control.js";
8
- import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
9
- const C = "recommendation-strategy-control";
10
- class N extends f {
6
+ import { CommonControl as _ } from "../../../common-control.js";
7
+ import { useRecommendationExtensionStore as b } from "../../store/recommendation.js";
8
+ const v = "recommendation-strategy-control";
9
+ class A extends _ {
11
10
  constructor() {
12
11
  super(...arguments);
13
- r(this, "store", $());
12
+ r(this, "store", b());
14
13
  r(this, "onboardingStore", S());
15
- r(this, "legacyConversion", _());
16
14
  r(this, "storeUnsubscription", () => {
17
15
  });
18
16
  r(this, "listeners", []);
19
17
  r(this, "lastPaintedState", null);
20
18
  }
21
19
  getId() {
22
- return C;
20
+ return v;
23
21
  }
24
22
  getTemplate() {
25
23
  const t = this.api.translate(
26
24
  "You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
27
- ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), o = this.api.translate("Legacy Strategy"), n = this.api.translate(
28
- "Note that this is an older version of the Recommendation Strategy. We recommend you update it to the new Recommendation Strategy for an improved experience."
29
- );
25
+ ), e = this.api.translate("For more information, you can"), s = this.api.translate("visit Academy");
30
26
  return `
31
27
  <div class="strategy-control-container">
32
28
  <div class="strategy-control-header">
@@ -37,12 +33,12 @@ class N extends f {
37
33
  ${t}
38
34
  ${e}
39
35
  <a
40
- href="${b.EMAIL_RECOMMENDATION_BLOCK}"
36
+ href="${u.EMAIL_RECOMMENDATION_BLOCK}"
41
37
  target="_blank"
42
- rel="noopener noreferrer">${a}</a>.
38
+ rel="noopener noreferrer">${s}</a>.
43
39
  </p>
44
40
  </div>
45
- <div data-strategy-empty-state>
41
+ <div data-strategy-empty-state style="display: none;">
46
42
  ${this._GuTwoColumns([
47
43
  this._GuButton({
48
44
  name: "assignStrategy",
@@ -54,41 +50,23 @@ class N extends f {
54
50
  name: "createStrategy",
55
51
  label: this.api.translate("Create New Strategy"),
56
52
  id: "guido__btn-create-strategy",
57
- className: "strategy-control-cta primary",
58
- disabled: !0
53
+ className: "strategy-control-cta primary"
59
54
  })
60
55
  ], "strategy-control-cta-row")}
61
56
  </div>
62
- <div data-strategy-legacy-state style="display: none;">
63
- <div class="strategy-control-notice-row">
64
- <div class="strategy-control-notice">
65
- <p class="strategy-control-notice-text">${n}</p>
66
- </div>
67
- </div>
57
+ <div data-strategy-loading-state>
68
58
  <div class="strategy-control-name-band">
69
- <span class="strategy-control-name">${o}</span>
70
- ${this._strategyAction({
71
- id: "guido__btn-update-legacy-strategy",
72
- label: this.api.translate("Update"),
73
- modifier: "update"
74
- })}
59
+ <span class="guido-skeleton guido-skeleton--strategy-name"></span>
75
60
  </div>
76
61
  <div class="strategy-control-actions">
77
- ${this._strategyAction({
78
- id: "guido__btn-change-legacy-strategy",
79
- label: this.api.translate("Change"),
80
- modifier: "change"
81
- })}
82
- ${this._strategyAction({
83
- id: "guido__btn-remove-legacy-strategy",
84
- label: this.api.translate("Remove"),
85
- modifier: "remove"
86
- })}
62
+ <span class="guido-skeleton guido-skeleton--strategy-action"></span>
63
+ <span class="guido-skeleton guido-skeleton--strategy-action"></span>
87
64
  </div>
88
65
  </div>
89
66
  <div data-strategy-assigned-state style="display: none;">
90
67
  <div class="strategy-control-name-band">
91
68
  <span class="strategy-control-name" data-strategy-name></span>
69
+ <span class="guido-skeleton guido-skeleton--strategy-name" data-strategy-name-skeleton></span>
92
70
  </div>
93
71
  <div class="strategy-control-actions">
94
72
  ${this._strategyAction({
@@ -106,12 +84,12 @@ class N extends f {
106
84
  </div>
107
85
  `;
108
86
  }
109
- _strategyAction({ id: t, label: e, modifier: a }) {
87
+ _strategyAction({ id: t, label: e, modifier: s }) {
110
88
  return `
111
89
  <button
112
90
  id="${t}"
113
91
  type="button"
114
- class="strategy-control-action strategy-control-action--${a}">
92
+ class="strategy-control-action strategy-control-action--${s}">
115
93
  <span>${e}</span>
116
94
  </button>
117
95
  `;
@@ -121,8 +99,8 @@ class N extends f {
121
99
  this._renderState();
122
100
  }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
123
101
  });
124
- const t = this.store.currentRecommendationId, e = t !== null && !!this.store.blockStates[t], a = this.store.isLegacyStrategyBlock;
125
- e && !this.store.recommendationConfigs.strategyId && !a && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding"), e && a && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding");
102
+ const t = this.store.currentRecommendationId;
103
+ t !== null && !!this.store.blockStates[t] && !this.store.recommendationConfigs.strategyId && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding");
126
104
  }
127
105
  onDestroy() {
128
106
  this._teardown();
@@ -135,34 +113,25 @@ class N extends f {
135
113
  const t = this.getContainer();
136
114
  if (!t)
137
115
  return;
138
- const e = (a, o) => {
139
- const n = t.querySelector(a);
140
- n && (n.addEventListener("click", o), this.listeners.push({ element: n, handler: o }));
116
+ const e = (s, i) => {
117
+ const a = t.querySelector(s);
118
+ a && (a.addEventListener("click", i), this.listeners.push({ element: a, handler: i }));
141
119
  };
142
- e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
143
- this.legacyConversion.convertLegacyStrategy();
144
- });
120
+ e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
145
121
  }
146
122
  _renderState() {
147
- var h;
148
- const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((h = this.store.assignedStrategy) == null ? void 0 : h.name) ?? "" : "", a = this.store.legacyConversionLoading, o = this.store.isLegacyStrategyBlock, n = `${t}\0${e}\0${a}\0${o}`;
149
- if (n === this.lastPaintedState)
150
- return;
151
- const c = this.getContainer();
152
- if (!c)
123
+ var m;
124
+ const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((m = this.store.assignedStrategy) == null ? void 0 : m.name) ?? "" : "", s = !!t && !e && this.store.strategiesLoading, i = `${t}\0${e}\0${s}`;
125
+ if (i === this.lastPaintedState)
153
126
  return;
154
- const d = c.querySelector("[data-strategy-empty-state]"), y = c.querySelector("[data-strategy-assigned-state]"), g = c.querySelector("[data-strategy-legacy-state]"), m = c.querySelector("[data-strategy-name]");
155
- if (!d || !y || !g)
127
+ const a = this.getContainer();
128
+ if (!a)
156
129
  return;
157
- const u = t ? y : o ? g : d;
158
- [d, y, g].forEach((l) => {
159
- l.style.display = l === u ? "" : "none";
160
- }), g.querySelectorAll("button").forEach((l) => {
161
- l.disabled = a;
162
- }), g.classList.toggle("is-converting", a), m && t && (m.textContent = e || `#${t}`), this.lastPaintedState = n;
130
+ const l = a.querySelector("[data-strategy-empty-state]"), d = a.querySelector("[data-strategy-assigned-state]"), g = a.querySelector("[data-strategy-loading-state]"), c = a.querySelector("[data-strategy-name]"), y = a.querySelector("[data-strategy-name-skeleton]");
131
+ !l || !d || (g && (g.style.display = "none"), l.style.display = t ? "none" : "", d.style.display = t ? "" : "none", c && (c.style.display = s ? "none" : "", t && !s && (c.textContent = e || `#${t}`)), y && (y.style.display = s ? "" : "none"), this.lastPaintedState = i);
163
132
  }
164
133
  }
165
134
  export {
166
- C as STRATEGY_CONTROL_ID,
167
- N as StrategyControl
135
+ v as STRATEGY_CONTROL_ID,
136
+ A as StrategyControl
168
137
  };