@useinsider/guido 3.12.0-beta.975e966 → 3.12.0-beta.aa6f9ba

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 (62) hide show
  1. package/dist/@types/config/schemas.js +13 -8
  2. package/dist/components/Guido.vue.js +6 -6
  3. package/dist/components/Guido.vue2.js +50 -49
  4. package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +36 -0
  5. package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +244 -0
  6. package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
  7. package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
  8. package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
  9. package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
  10. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
  11. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
  12. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
  13. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
  14. package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
  15. package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
  16. package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
  17. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
  18. package/dist/composables/useRecommendation.js +82 -51
  19. package/dist/composables/useStrategyFilters.js +16 -0
  20. package/dist/config/migrator/recommendationMigrator.js +7 -4
  21. package/dist/enums/date.js +4 -3
  22. package/dist/enums/extensions/filteringV2.js +8 -0
  23. package/dist/enums/extensions/recommendationBlock.js +28 -22
  24. package/dist/enums/extensions/strategyDetail.js +148 -0
  25. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
  26. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +123 -109
  27. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +146 -0
  28. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +1 -1
  29. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +256 -102
  30. package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
  31. package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +10 -0
  32. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -12
  33. package/dist/guido.css +1 -1
  34. package/dist/services/recommendationApi.js +72 -29
  35. package/dist/src/@types/config/schemas.d.ts +10 -0
  36. package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
  37. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
  38. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
  39. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
  40. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
  41. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
  42. package/dist/src/composables/useConfig.d.ts +2 -0
  43. package/dist/src/composables/useRecommendation.d.ts +2 -0
  44. package/dist/src/composables/useStrategyFilters.d.ts +24 -0
  45. package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
  46. package/dist/src/enums/extensions/recommendationBlock.d.ts +10 -0
  47. package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
  48. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +61 -0
  50. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +606 -1
  51. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
  52. package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
  53. package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
  54. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +3 -1
  55. package/dist/src/services/recommendationApi.d.ts +7 -1
  56. package/dist/src/stores/config.d.ts +18 -0
  57. package/dist/src/utils/genericUtil.d.ts +9 -0
  58. package/dist/static/styles/base.css.js +15 -0
  59. package/dist/utils/dateUtil.js +23 -10
  60. package/dist/utils/genericUtil.js +10 -1
  61. package/dist/utils/templatePreparation.js +62 -58
  62. package/package.json +2 -2
@@ -0,0 +1,146 @@
1
+ var g = Object.defineProperty;
2
+ var d = (o, s, t) => s in o ? g(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
+ var r = (o, s, t) => d(o, typeof s != "symbol" ? s + "" : s, t);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as c } from "../../../common-control.js";
6
+ import { RecommendationConfigService as a } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as S } from "../../store/recommendation.js";
8
+ const m = "recommendation-strategy-control", e = {
9
+ STRATEGY: "strategyId",
10
+ DETAILS_BUTTON: "strategyDetails",
11
+ MESSAGE: "strategyMessage"
12
+ }, h = "guido__btn-strategy-details";
13
+ class E extends c {
14
+ constructor() {
15
+ super(...arguments);
16
+ // Store is used ONLY for API-fetched data (strategy list), not for config
17
+ r(this, "store", S());
18
+ r(this, "detailsListener", () => {
19
+ });
20
+ r(this, "detailsButton", null);
21
+ }
22
+ getId() {
23
+ return m;
24
+ }
25
+ getTemplate() {
26
+ return `
27
+ <div class="strategy-control-container">
28
+ ${this._GuTwoColumns([
29
+ this._GuLabel({ text: this.api.translate("Recommendation Strategy") }),
30
+ `<div class="strategy-control__select-row">
31
+ ${this._GuSelect({
32
+ name: e.STRATEGY,
33
+ placeholder: this.api.translate("Select Recommendation Strategy"),
34
+ options: this.store.getStrategyOptions
35
+ })}
36
+ ${this._GuIconButton({
37
+ name: e.DETAILS_BUTTON,
38
+ icon: "strategy-details-icon",
39
+ className: h
40
+ })}
41
+ </div>`
42
+ ])}
43
+ ${this._GuOnPageMessage({ name: e.MESSAGE, icon: "migration-info-icon" })}
44
+ </div>
45
+ `;
46
+ }
47
+ onRender() {
48
+ this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates(), this._setupDetailsButtonListener(), this._refreshSelectionState();
49
+ }
50
+ onDestroy() {
51
+ var t;
52
+ (t = this.detailsButton) == null || t.removeEventListener("click", this.detailsListener);
53
+ }
54
+ onTemplateNodeUpdated(t) {
55
+ super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues(), this._refreshSelectionState();
56
+ }
57
+ _setFormValues() {
58
+ const t = a.getConfig(this.currentNode);
59
+ this.api.updateValues({ [e.STRATEGY]: t.strategyId });
60
+ }
61
+ _initializeSelectItems() {
62
+ var i;
63
+ const t = (i = this.store) == null ? void 0 : i.getStrategyOptions;
64
+ if (t != null && t.length)
65
+ try {
66
+ this.api.setUIEAttribute(
67
+ e.STRATEGY,
68
+ l.SELECTPICKER.items,
69
+ t
70
+ );
71
+ } catch (n) {
72
+ console.warn("[StrategyControl] Failed to set strategy options:", n);
73
+ }
74
+ }
75
+ /**
76
+ * Reconciles the panel with the strategy listing: loading, empty, and
77
+ * deleted-strategy states.
78
+ *
79
+ * A strategy the partner deleted in Smart Recommender still lives in this
80
+ * block's saved config. The id is deliberately left in place and surfaced
81
+ * instead of being cleared — silently dropping it would make a template that
82
+ * compiles a broken feed URL look correctly configured.
83
+ *
84
+ * ponytail: one message element, three texts. Severity styling (warning vs
85
+ * info) is not drawn in Figma and pending design sign-off — see open question
86
+ * 4 in the handoff. Vary `type` once that lands.
87
+ */
88
+ _refreshSelectionState() {
89
+ const t = !!this.store.getStrategyOptions.length, { strategyId: i } = a.getConfig(this.currentNode);
90
+ if (this._setDisabled(e.STRATEGY, this.store.strategiesLoading || !t), this._setDisabled(e.DETAILS_BUTTON, !this.store.getSelectedStrategy), this.store.strategiesLoading) {
91
+ this._showMessage(this.api.translate("Loading recommendation strategies..."));
92
+ return;
93
+ }
94
+ if (!t) {
95
+ this._showMessage(this.api.translate(
96
+ "No recommendation strategies are available for email. Create one in Smart Recommender, then reopen this block."
97
+ ));
98
+ return;
99
+ }
100
+ if (this.store.hasMissingStrategy) {
101
+ this._showMessage(this.api.translate(
102
+ `The selected strategy (${i}) is no longer available. Pick another one, otherwise this block will not load products.`
103
+ ));
104
+ return;
105
+ }
106
+ this._hideMessage();
107
+ }
108
+ _setDisabled(t, i) {
109
+ try {
110
+ this.api.setUIEAttribute(t, l.SELECTPICKER.disabled, i);
111
+ } catch (n) {
112
+ console.warn(`[StrategyControl] Failed to set disabled on ${t}:`, n);
113
+ }
114
+ }
115
+ _showMessage(t) {
116
+ this._setInfoMessageValue(e.MESSAGE, t);
117
+ }
118
+ _hideMessage() {
119
+ const t = this.getContainer().querySelector(`[data-info-message="${e.MESSAGE}"]`);
120
+ t && (t.style.display = "none");
121
+ }
122
+ _onDetailsClick() {
123
+ this.store.openStrategyDrawer();
124
+ }
125
+ _setupDetailsButtonListener() {
126
+ var t;
127
+ this.detailsListener = this._onDetailsClick.bind(this), this.detailsButton = this.getContainer().querySelector(`.${h}`), (t = this.detailsButton) == null || t.addEventListener("click", this.detailsListener);
128
+ }
129
+ _onStrategyChange(t) {
130
+ !this.currentNode || a.getConfig(this.currentNode).strategyId === t || (a.updateConfig(
131
+ this.api,
132
+ this.currentNode,
133
+ { strategyId: t },
134
+ `Changed recommendation strategy to ${t}`
135
+ ), this.store.patchCurrentBlockConfig({ strategyId: t }), this.store.fetchStrategyUrlTemplate(t), this._refreshSelectionState());
136
+ }
137
+ _listenToFormUpdates() {
138
+ this.api.onValueChanged(e.STRATEGY, (t) => {
139
+ this._onStrategyChange(t);
140
+ });
141
+ }
142
+ }
143
+ export {
144
+ m as STRATEGY_CONTROL_ID,
145
+ E as StrategyControl
146
+ };
@@ -74,7 +74,7 @@ class h extends C {
74
74
  <path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
75
75
  stroke-width="2" fill="none"/>
76
76
  </svg>
77
- `, t["migration-info-icon"] = r;
77
+ `, t["migration-info-icon"] = r, t["strategy-details-icon"] = r;
78
78
  }
79
79
  }
80
80
  export {