@useinsider/guido 3.18.1-beta.12053dd → 3.18.1-beta.178a3ec

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 (44) hide show
  1. package/dist/components/Guido.vue.js +3 -3
  2. package/dist/components/Guido.vue2.js +30 -30
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +11 -13
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -65
  5. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
  6. package/dist/composables/useCustomInterfaceAppearance.js +46 -56
  7. package/dist/composables/useHtmlValidator.js +79 -84
  8. package/dist/composables/useRecommendation.js +35 -40
  9. package/dist/composables/useStripo.js +30 -30
  10. package/dist/config/migrator/itemsBlockMigrator.js +225 -163
  11. package/dist/enums/extensions/recommendationBlock.js +31 -38
  12. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  13. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  14. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  15. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  16. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  17. package/dist/extensions/Blocks/Items/template.js +212 -201
  18. package/dist/extensions/Blocks/Recommendation/block.js +39 -43
  19. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
  20. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +58 -63
  21. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -84
  22. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -222
  23. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
  24. package/dist/guido.css +1 -1
  25. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  26. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  27. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  28. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  29. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
  30. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
  32. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -9
  33. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -75
  34. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
  35. package/dist/src/stores/onboarding.d.ts +0 -377
  36. package/dist/static/styles/components/recommendation-strategy.css.js +4 -34
  37. package/dist/stores/onboarding.js +36 -41
  38. package/dist/utils/pairProductVariables.js +71 -71
  39. package/dist/utils/templatePreparation.js +49 -49
  40. package/package.json +1 -1
  41. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
  42. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -47
  43. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
  44. package/dist/static/styles/components/skeleton.css.js +0 -23
@@ -1,25 +1,21 @@
1
- var u = Object.defineProperty;
2
- var S = (o, n, t) => n in o ? u(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
- var r = (o, n, t) => S(o, typeof n != "symbol" ? n + "" : n, t);
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 { RRS_CONFIG_VERSION as b } from "../../constants/defaultConfig.js";
8
- import { RecommendationConfigService as h } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
10
- const k = "recommendation-strategy-control";
11
- class I extends v {
1
+ var d = Object.defineProperty;
2
+ var y = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
+ var o = (r, s, t) => y(r, typeof s != "symbol" ? s + "" : s, t);
4
+ import { ACADEMY_LINKS as m } from "../../../../../enums/academy.js";
5
+ import { CommonControl as h } from "../../../common-control.js";
6
+ import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
7
+ const p = "recommendation-strategy-control";
8
+ class f extends h {
12
9
  constructor() {
13
10
  super(...arguments);
14
- r(this, "store", C());
15
- r(this, "onboardingStore", f());
16
- r(this, "storeUnsubscription", () => {
11
+ o(this, "store", u());
12
+ o(this, "storeUnsubscription", () => {
17
13
  });
18
- r(this, "listeners", []);
19
- r(this, "lastPaintedState", null);
14
+ o(this, "listeners", []);
15
+ o(this, "lastPaintedState", null);
20
16
  }
21
17
  getId() {
22
- return k;
18
+ return p;
23
19
  }
24
20
  getTemplate() {
25
21
  const t = this.api.translate(
@@ -27,34 +23,21 @@ class I extends v {
27
23
  ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
28
24
  return `
29
25
  <div class="strategy-control-container">
30
- <div data-strategy-loading-state>
31
- <div class="strategy-control-header">
32
- <span class="guido-skeleton guido-skeleton--strategy-title"></span>
33
- </div>
34
- <div class="strategy-control-description-row">
35
- <span class="guido-skeleton guido-skeleton--strategy-description"></span>
36
- </div>
37
- <div class="strategy-control-skeleton-row">
38
- <span class="guido-skeleton guido-skeleton--strategy-cta"></span>
39
- <span class="guido-skeleton guido-skeleton--strategy-cta"></span>
40
- </div>
26
+ <div class="strategy-control-header">
27
+ <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
41
28
  </div>
42
- <div data-strategy-content style="display: none;">
43
- <div class="strategy-control-header">
44
- <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
45
- </div>
46
- <div class="strategy-control-description-row">
47
- <p class="strategy-control-description">
48
- ${t}
49
- ${e}
50
- <a
51
- href="${_.EMAIL_RECOMMENDATION_BLOCK}"
52
- target="_blank"
53
- rel="noopener noreferrer">${a}</a>.
54
- </p>
55
- </div>
56
- <div data-strategy-empty-state style="display: none;">
57
- ${this._GuTwoColumns([
29
+ <div class="strategy-control-description-row">
30
+ <p class="strategy-control-description">
31
+ ${t}
32
+ ${e}
33
+ <a
34
+ href="${m.EMAIL_RECOMMENDATION_BLOCK}"
35
+ target="_blank"
36
+ rel="noopener noreferrer">${a}</a>.
37
+ </p>
38
+ </div>
39
+ <div data-strategy-empty-state>
40
+ ${this._GuTwoColumns([
58
41
  this._GuButton({
59
42
  name: "assignStrategy",
60
43
  label: this.api.translate("Assign Strategy"),
@@ -65,28 +48,26 @@ class I extends v {
65
48
  name: "createStrategy",
66
49
  label: this.api.translate("Create New Strategy"),
67
50
  id: "guido__btn-create-strategy",
68
- className: "strategy-control-cta primary"
51
+ className: "strategy-control-cta primary",
52
+ disabled: !0
69
53
  })
70
54
  ], "strategy-control-cta-row")}
55
+ </div>
56
+ <div data-strategy-assigned-state style="display: none;">
57
+ <div class="strategy-control-name-band">
58
+ <span class="strategy-control-name" data-strategy-name></span>
71
59
  </div>
72
- <div data-strategy-assigned-state style="display: none;">
73
- <div class="strategy-control-name-band">
74
- <span class="strategy-control-name" data-strategy-name></span>
75
- <span
76
- class="guido-skeleton guido-skeleton--strategy-name" data-strategy-name-skeleton></span>
77
- </div>
78
- <div class="strategy-control-actions">
79
- ${this._strategyAction({
60
+ <div class="strategy-control-actions">
61
+ ${this._strategyAction({
80
62
  id: "guido__btn-change-strategy",
81
63
  label: this.api.translate("Change"),
82
64
  modifier: "change"
83
65
  })}
84
- ${this._strategyAction({
66
+ ${this._strategyAction({
85
67
  id: "guido__btn-remove-strategy",
86
68
  label: this.api.translate("Remove"),
87
69
  modifier: "remove"
88
70
  })}
89
- </div>
90
71
  </div>
91
72
  </div>
92
73
  </div>
@@ -103,54 +84,41 @@ class I extends v {
103
84
  `;
104
85
  }
105
86
  onRender() {
106
- this._teardown(), this.store.strategyPanelOpen = !0, this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
87
+ this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
107
88
  this._renderState();
108
- }), this.store.recommendationConfigs.strategyId && !this.store.strategiesFetched && this.store.fetchStrategies().catch(() => {
89
+ }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
109
90
  });
110
91
  }
111
- /**
112
- * Whether the document itself says this block has no strategy.
113
- *
114
- * Read the node, not the store: when the main control cannot resolve the block id off the
115
- * node it never syncs the persisted config, so the store still holds defaults (empty
116
- * strategyId) for an assigned block.
117
- */
118
- _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;
123
- }
124
92
  onDestroy() {
125
93
  this._teardown();
126
94
  }
127
95
  _teardown() {
128
- this.store.strategyPanelOpen = !1, this.storeUnsubscription(), this.storeUnsubscription = () => {
96
+ this.storeUnsubscription(), this.storeUnsubscription = () => {
129
97
  }, this.lastPaintedState = null, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
130
98
  }
131
99
  _setupButtonListeners() {
132
100
  const t = this.getContainer();
133
101
  if (!t)
134
102
  return;
135
- const e = (a, i) => {
136
- const s = t.querySelector(a);
137
- s && (s.addEventListener("click", i), this.listeners.push({ element: s, handler: i }));
103
+ const e = (a, n) => {
104
+ const i = t.querySelector(a);
105
+ i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
138
106
  };
139
- 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());
107
+ e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
140
108
  }
141
109
  _renderState() {
142
- 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}`;
144
- if (i === this.lastPaintedState)
110
+ var l;
111
+ const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
112
+ if (a === this.lastPaintedState)
145
113
  return;
146
- const s = this.getContainer();
147
- if (!s)
114
+ const n = this.getContainer();
115
+ if (!n)
148
116
  return;
149
- const c = s.querySelector("[data-strategy-empty-state]"), g = s.querySelector("[data-strategy-assigned-state]"), l = s.querySelector("[data-strategy-loading-state]"), y = s.querySelector("[data-strategy-content]"), d = s.querySelector("[data-strategy-name]"), m = s.querySelector("[data-strategy-name-skeleton]");
150
- !c || !g || (l && (l.style.display = "none"), y && (y.style.display = ""), c.style.display = t ? "none" : "", g.style.display = t ? "" : "none", !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding"), d && (d.style.display = a ? "none" : "", t && !a && (d.textContent = e || `#${t}`)), m && (m.style.display = a ? "block" : "none"), this.lastPaintedState = i);
117
+ const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
118
+ !i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
151
119
  }
152
120
  }
153
121
  export {
154
- k as STRATEGY_CONTROL_ID,
155
- I as StrategyControl
122
+ p as STRATEGY_CONTROL_ID,
123
+ f as StrategyControl
156
124
  };