@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.
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -65
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
- package/dist/composables/useCustomInterfaceAppearance.js +46 -56
- package/dist/composables/useHtmlValidator.js +79 -84
- package/dist/composables/useRecommendation.js +35 -40
- package/dist/composables/useStripo.js +30 -30
- package/dist/config/migrator/itemsBlockMigrator.js +225 -163
- package/dist/enums/extensions/recommendationBlock.js +31 -38
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +212 -201
- package/dist/extensions/Blocks/Recommendation/block.js +39 -43
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +58 -63
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -84
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -222
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -75
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/stores/onboarding.d.ts +0 -377
- package/dist/static/styles/components/recommendation-strategy.css.js +4 -34
- package/dist/stores/onboarding.js +36 -41
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/templatePreparation.js +49 -49
- package/package.json +1 -1
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -47
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/static/styles/components/skeleton.css.js +0 -23
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ACADEMY_LINKS as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
r(this, "storeUnsubscription", () => {
|
|
11
|
+
o(this, "store", u());
|
|
12
|
+
o(this, "storeUnsubscription", () => {
|
|
17
13
|
});
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
o(this, "listeners", []);
|
|
15
|
+
o(this, "lastPaintedState", null);
|
|
20
16
|
}
|
|
21
17
|
getId() {
|
|
22
|
-
return
|
|
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
|
|
31
|
-
<
|
|
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
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
73
|
-
|
|
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
|
-
|
|
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.
|
|
87
|
+
this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
107
88
|
this._renderState();
|
|
108
|
-
}), this.store.recommendationConfigs.strategyId && !this.store.
|
|
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.
|
|
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,
|
|
136
|
-
const
|
|
137
|
-
|
|
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-
|
|
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
|
|
143
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
144
|
-
if (
|
|
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
|
|
147
|
-
if (!
|
|
114
|
+
const n = this.getContainer();
|
|
115
|
+
if (!n)
|
|
148
116
|
return;
|
|
149
|
-
const
|
|
150
|
-
!
|
|
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
|
-
|
|
155
|
-
|
|
122
|
+
p as STRATEGY_CONTROL_ID,
|
|
123
|
+
f as StrategyControl
|
|
156
124
|
};
|