@useinsider/guido 3.19.0-beta.c8d2be8 → 3.19.0-beta.cd25cc8
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/@types/config/schemas.js +104 -91
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +96 -85
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +11 -11
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHttp.js +48 -49
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useStripo.js +24 -20
- package/dist/composables/useToaster.js +17 -15
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/itemsBlockMigrator.js +236 -248
- package/dist/config/migrator/recommendationMigrator.js +28 -21
- package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
- package/dist/enums/extensions/recommendationBlock.js +30 -29
- 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 +219 -204
- package/dist/extensions/Blocks/Recommendation/block.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +117 -93
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -96
- package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -21
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +40 -17
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
- package/dist/src/composables/useGuidoActions.d.ts +2 -0
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
- 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/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +16 -2
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
- package/dist/src/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/stores/config.d.ts +20 -0
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +61 -85
- package/package.json +2 -1
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (
|
|
4
|
-
import { useLegacyStrategyConversion as
|
|
5
|
-
import { ACADEMY_LINKS as
|
|
6
|
-
import { useOnboardingStore as
|
|
7
|
-
import { CommonControl as
|
|
8
|
-
import { RRS_CONFIG_VERSION as
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
const
|
|
12
|
-
class
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var N = (l, o, t) => o in l ? w(l, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[o] = t;
|
|
3
|
+
var i = (l, o, t) => N(l, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { useLegacyStrategyConversion as L } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as $ } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as A } from "../../../../../stores/onboarding.js";
|
|
7
|
+
import { CommonControl as R } from "../../../common-control.js";
|
|
8
|
+
import { RRS_CONFIG_VERSION as E } from "../../constants/defaultConfig.js";
|
|
9
|
+
import { RecommendationConfigService as C } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as O } from "../../store/recommendation.js";
|
|
11
|
+
const I = "recommendation-strategy-control";
|
|
12
|
+
class P extends R {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
i(this, "store",
|
|
16
|
-
i(this, "onboardingStore",
|
|
17
|
-
i(this, "legacyConversion",
|
|
15
|
+
i(this, "store", O());
|
|
16
|
+
i(this, "onboardingStore", A());
|
|
17
|
+
i(this, "legacyConversion", L());
|
|
18
18
|
i(this, "storeUnsubscription", () => {
|
|
19
19
|
});
|
|
20
20
|
i(this, "listeners", []);
|
|
21
21
|
i(this, "lastPaintedState", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return I;
|
|
25
25
|
}
|
|
26
26
|
getTemplate() {
|
|
27
27
|
const t = this.api.translate(
|
|
28
28
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
29
|
-
), e = this.api.translate("For more information, you can"),
|
|
29
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), r = this.api.translate("Legacy Strategy"), s = this.api.translate(
|
|
30
30
|
"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."
|
|
31
|
+
), g = this.api.translate(
|
|
32
|
+
"The recommendation strategy used in the recommendation block is no longer available. You can assign a different strategy to it."
|
|
31
33
|
);
|
|
32
34
|
return `
|
|
33
35
|
<div class="strategy-control-container">
|
|
@@ -52,9 +54,9 @@ class M extends A {
|
|
|
52
54
|
${t}
|
|
53
55
|
${e}
|
|
54
56
|
<a
|
|
55
|
-
href="${
|
|
57
|
+
href="${$.EMAIL_RECOMMENDATION_BLOCK}"
|
|
56
58
|
target="_blank"
|
|
57
|
-
rel="noopener noreferrer">${
|
|
59
|
+
rel="noopener noreferrer">${a}</a>.
|
|
58
60
|
</p>
|
|
59
61
|
</div>
|
|
60
62
|
<div data-strategy-empty-state style="display: none;">
|
|
@@ -71,16 +73,37 @@ class M extends A {
|
|
|
71
73
|
id: "guido__btn-create-strategy",
|
|
72
74
|
className: "strategy-control-cta primary"
|
|
73
75
|
})
|
|
76
|
+
], "strategy-control-cta-row")}
|
|
77
|
+
</div>
|
|
78
|
+
<div data-strategy-unavailable-state style="display: none;">
|
|
79
|
+
<div class="strategy-control-notice-row">
|
|
80
|
+
<div class="strategy-control-notice strategy-control-notice--error" role="alert">
|
|
81
|
+
<p class="strategy-control-notice-text">${g}</p>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
${this._GuTwoColumns([
|
|
85
|
+
this._GuButton({
|
|
86
|
+
name: "assignUnavailableStrategy",
|
|
87
|
+
label: this.api.translate("Assign Strategy"),
|
|
88
|
+
id: "guido__btn-assign-unavailable-strategy",
|
|
89
|
+
className: "strategy-control-cta on"
|
|
90
|
+
}),
|
|
91
|
+
this._GuButton({
|
|
92
|
+
name: "createUnavailableStrategy",
|
|
93
|
+
label: this.api.translate("Create New Strategy"),
|
|
94
|
+
id: "guido__btn-create-unavailable-strategy",
|
|
95
|
+
className: "strategy-control-cta primary"
|
|
96
|
+
})
|
|
74
97
|
], "strategy-control-cta-row")}
|
|
75
98
|
</div>
|
|
76
99
|
<div data-strategy-legacy-state style="display: none;">
|
|
77
100
|
<div class="strategy-control-notice-row">
|
|
78
101
|
<div class="strategy-control-notice">
|
|
79
|
-
<p class="strategy-control-notice-text">${
|
|
102
|
+
<p class="strategy-control-notice-text">${s}</p>
|
|
80
103
|
</div>
|
|
81
104
|
</div>
|
|
82
105
|
<div class="strategy-control-name-band">
|
|
83
|
-
<span class="strategy-control-name">${
|
|
106
|
+
<span class="strategy-control-name">${r}</span>
|
|
84
107
|
${this._strategyAction({
|
|
85
108
|
id: "guido__btn-update-legacy-strategy",
|
|
86
109
|
label: this.api.translate("Update"),
|
|
@@ -123,12 +146,12 @@ class M extends A {
|
|
|
123
146
|
</div>
|
|
124
147
|
`;
|
|
125
148
|
}
|
|
126
|
-
_strategyAction({ id: t, label: e, modifier:
|
|
149
|
+
_strategyAction({ id: t, label: e, modifier: a }) {
|
|
127
150
|
return `
|
|
128
151
|
<button
|
|
129
152
|
id="${t}"
|
|
130
153
|
type="button"
|
|
131
|
-
class="strategy-control-action strategy-control-action--${
|
|
154
|
+
class="strategy-control-action strategy-control-action--${a}">
|
|
132
155
|
<span>${e}</span>
|
|
133
156
|
</button>
|
|
134
157
|
`;
|
|
@@ -136,8 +159,8 @@ class M extends A {
|
|
|
136
159
|
onRender() {
|
|
137
160
|
this._teardown(), this.store.strategyPanelOpen = !0, this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
138
161
|
this._renderState();
|
|
139
|
-
}), this.store.recommendationConfigs.strategyId && !this.store.
|
|
140
|
-
});
|
|
162
|
+
}), this.store.recommendationConfigs.strategyId && !this.store.strategiesLoading && (this.store.invalidateStrategies(), this.store.fetchStrategies().catch(() => {
|
|
163
|
+
}));
|
|
141
164
|
}
|
|
142
165
|
/**
|
|
143
166
|
* Whether the document itself says this block has no strategy.
|
|
@@ -147,10 +170,10 @@ class M extends A {
|
|
|
147
170
|
* strategyId) for an assigned block.
|
|
148
171
|
*/
|
|
149
172
|
_isNodeUnassigned() {
|
|
150
|
-
if (!
|
|
173
|
+
if (!C.hasConfig(this.currentNode))
|
|
151
174
|
return !1;
|
|
152
|
-
const t =
|
|
153
|
-
return !t.strategyId && (t.configVersion ?? 0) >=
|
|
175
|
+
const t = C.getConfig(this.currentNode);
|
|
176
|
+
return !t.strategyId && (t.configVersion ?? 0) >= E;
|
|
154
177
|
}
|
|
155
178
|
onDestroy() {
|
|
156
179
|
this._teardown();
|
|
@@ -163,37 +186,37 @@ class M extends A {
|
|
|
163
186
|
const t = this.getContainer();
|
|
164
187
|
if (!t)
|
|
165
188
|
return;
|
|
166
|
-
const e = (
|
|
167
|
-
const
|
|
168
|
-
|
|
189
|
+
const e = (a, r) => {
|
|
190
|
+
const s = t.querySelector(a);
|
|
191
|
+
s && (s.addEventListener("click", r), this.listeners.push({ element: s, handler: r }));
|
|
169
192
|
};
|
|
170
|
-
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-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", () => {
|
|
193
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-assign-unavailable-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-unavailable-strategy", () => this.store.openStrategyCreation()), 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", () => {
|
|
171
194
|
this.legacyConversion.convertLegacyStrategy();
|
|
172
195
|
});
|
|
173
196
|
}
|
|
174
197
|
_renderState() {
|
|
175
|
-
var
|
|
176
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
177
|
-
if (
|
|
198
|
+
var f;
|
|
199
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((f = this.store.assignedStrategy) == null ? void 0 : f.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), r = !!t && !e && !a && this.store.strategiesFetched, s = this.store.legacyConversionLoading, g = this.store.isLegacyStrategyBlock, p = [t, e, a, r, s, g].join("\0");
|
|
200
|
+
if (p === this.lastPaintedState)
|
|
178
201
|
return;
|
|
179
|
-
const
|
|
180
|
-
if (!
|
|
202
|
+
const n = this.getContainer();
|
|
203
|
+
if (!n)
|
|
181
204
|
return;
|
|
182
|
-
const
|
|
183
|
-
if (!
|
|
205
|
+
const y = n.querySelector("[data-strategy-empty-state]"), u = n.querySelector("[data-strategy-assigned-state]"), c = n.querySelector("[data-strategy-legacy-state]"), h = n.querySelector("[data-strategy-unavailable-state]"), v = n.querySelector("[data-strategy-loading-state]"), b = n.querySelector("[data-strategy-content]"), m = n.querySelector("[data-strategy-name]"), _ = n.querySelector("[data-strategy-name-skeleton]");
|
|
206
|
+
if (!y || !u || !c || !h)
|
|
184
207
|
return;
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
[
|
|
188
|
-
|
|
189
|
-
}),
|
|
190
|
-
|
|
191
|
-
}),
|
|
208
|
+
v && (v.style.display = "none"), b && (b.style.display = "");
|
|
209
|
+
const k = t ? r ? h : u : g ? c : y;
|
|
210
|
+
[y, u, c, h].forEach((d) => {
|
|
211
|
+
d.style.display = d === k ? "" : "none";
|
|
212
|
+
}), c.querySelectorAll("button").forEach((d) => {
|
|
213
|
+
d.disabled = s;
|
|
214
|
+
}), c.classList.toggle("is-converting", s), !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding");
|
|
192
215
|
const S = this.store.currentRecommendationId;
|
|
193
|
-
|
|
216
|
+
g && S !== null && this.store.blockStates[S] && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding"), m && (m.style.display = a ? "none" : "", t && !a && (m.textContent = e || `#${t}`)), _ && (_.style.display = a ? "block" : "none"), this.lastPaintedState = p;
|
|
194
217
|
}
|
|
195
218
|
}
|
|
196
219
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
220
|
+
I as STRATEGY_CONTROL_ID,
|
|
221
|
+
P as StrategyControl
|
|
199
222
|
};
|