@useinsider/guido 3.17.0-beta.6255bfc → 3.17.0-beta.77567eb
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/README.md +5 -6
- package/dist/@types/config/schemas.js +6 -12
- package/dist/components/Guido.vue.js +2 -2
- package/dist/components/Guido.vue2.js +30 -31
- package/dist/composables/useCustomInterfaceAppearance.js +38 -52
- package/dist/composables/useRecommendation.js +44 -52
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -19
- package/dist/config/migrator/recommendationMigrator.js +4 -6
- package/dist/enums/academy.js +1 -2
- package/dist/enums/date.js +3 -4
- package/dist/enums/extensions/recommendationBlock.js +1 -4
- package/dist/extensions/Blocks/Recommendation/block.js +21 -26
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -36
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +166 -180
- package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +110 -251
- package/dist/extensions/Blocks/common-control.js +19 -22
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +30 -75
- package/dist/src/@types/config/schemas.d.ts +0 -12
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -7
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -15
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -206
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
- package/dist/src/services/recommendationApi.d.ts +1 -4
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/utils/dateUtil.js +10 -29
- package/dist/utils/templatePreparation.js +34 -37
- package/package.json +3 -4
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -66
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -142
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -30
- package/dist/src/mock/api/recommendation-strategies.d.ts +0 -63
- package/dist/src/utils/strategyInfoBox.d.ts +0 -22
- package/dist/static/assets/icons/line-change.svg.js +0 -5
- package/dist/static/assets/icons/line-delete.svg.js +0 -5
- package/dist/static/assets/icons/line-plus.svg.js +0 -5
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -188
- package/dist/utils/strategyInfoBox.js +0 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useActionsApi as k } from "../composables/useActionsApi.js";
|
|
2
2
|
import { useConfig as U } from "../composables/useConfig.js";
|
|
3
3
|
import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
|
|
4
|
-
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as
|
|
4
|
+
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
6
|
import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
7
|
import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
@@ -11,20 +11,20 @@ import { useEditorStore as z } from "../stores/editor.js";
|
|
|
11
11
|
import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
|
|
12
12
|
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
13
13
|
function O(m) {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
const o =
|
|
14
|
+
const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
15
|
+
return n.forEach((i) => {
|
|
16
|
+
const o = i.getAttribute(A.PAGE_LIST);
|
|
17
17
|
o && t.push(...R(o));
|
|
18
18
|
}), [...new Set(t)];
|
|
19
19
|
}
|
|
20
20
|
async function M(m) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
21
|
+
const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (a.length === 0)
|
|
23
23
|
return;
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const n = C();
|
|
25
|
+
a.forEach((t) => {
|
|
26
26
|
var r, l, g, f, c;
|
|
27
|
-
const
|
|
27
|
+
const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
|
|
28
28
|
if (!Number.isFinite(o))
|
|
29
29
|
return;
|
|
30
30
|
const p = t.getAttribute("esd-ext-config");
|
|
@@ -42,27 +42,24 @@ async function M(m) {
|
|
|
42
42
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
43
43
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
44
44
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
45
|
-
strategy: L(e.strategy) ||
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
strategyId: e.strategyId ?? a.strategyId,
|
|
49
|
-
language: e.language ?? a.language,
|
|
50
|
-
size: e.size ?? a.size,
|
|
45
|
+
strategy: L(e.strategy) || s.strategy,
|
|
46
|
+
language: e.language ?? s.language,
|
|
47
|
+
size: e.size ?? s.size,
|
|
51
48
|
// Spread the default arrays so each block gets a fresh reference
|
|
52
49
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
53
|
-
productIds: e.productIds ?? [...
|
|
54
|
-
filters: e.filters ?? [...
|
|
55
|
-
shuffleProducts: e.shuffleProducts ??
|
|
50
|
+
productIds: e.productIds ?? [...s.productIds],
|
|
51
|
+
filters: e.filters ?? [...s.filters],
|
|
52
|
+
shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
|
|
56
53
|
currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
|
|
57
54
|
currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
|
|
58
55
|
currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
|
|
59
56
|
currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
|
|
60
57
|
currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
|
|
61
58
|
};
|
|
62
|
-
|
|
59
|
+
n.seedBlockUrlConfig(o, h);
|
|
63
60
|
});
|
|
64
61
|
try {
|
|
65
|
-
await
|
|
62
|
+
await n.fetchRecommendationCreateData();
|
|
66
63
|
} catch (t) {
|
|
67
64
|
console.warn(
|
|
68
65
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -71,39 +68,39 @@ async function M(m) {
|
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
const Z = () => {
|
|
74
|
-
const m = N(), u = z(),
|
|
71
|
+
const m = N(), u = z(), a = _(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
75
72
|
return {
|
|
76
73
|
prepareTemplateDetails: async () => {
|
|
77
74
|
let { html: r, css: l, syncModulesIds: g = [] } = await t();
|
|
78
75
|
if (e("linkTrackingIds"))
|
|
79
76
|
try {
|
|
80
|
-
const { html:
|
|
81
|
-
u.trackIdSessionFloor =
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
77
|
+
const { html: y, changed: H, nextSeq: I } = v(r, u.trackIdSessionFloor);
|
|
78
|
+
u.trackIdSessionFloor = I, H && (r = y, await i(y, l));
|
|
79
|
+
} catch (y) {
|
|
80
|
+
console.error("Tracking-id step failed, saving anyway:", y);
|
|
84
81
|
}
|
|
85
|
-
const { html: f, ampHtml: c = "", ampErrors: T = [] } = await
|
|
82
|
+
const { html: f, ampHtml: c = "", ampErrors: T = [] } = await n({
|
|
86
83
|
minimize: !0,
|
|
87
84
|
resetDataSavedFlag: !1
|
|
88
85
|
});
|
|
89
|
-
|
|
90
|
-
const { compiledHtml:
|
|
86
|
+
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await M(r);
|
|
87
|
+
const { compiledHtml: w, stats: S, appliedRules: D } = o(f), E = c && p(c).compiledHtml, P = m.getSelectedDynamicContentList, F = C(), b = O(r);
|
|
91
88
|
return console.debug("HTML Compilation Stats:", {
|
|
92
|
-
originalSize:
|
|
93
|
-
compiledSize:
|
|
94
|
-
reduction: `${
|
|
95
|
-
appliedRules:
|
|
96
|
-
executionTime: `${
|
|
89
|
+
originalSize: S.originalSize,
|
|
90
|
+
compiledSize: S.compiledSize,
|
|
91
|
+
reduction: `${S.reductionPercentage.toFixed(2)}%`,
|
|
92
|
+
appliedRules: D,
|
|
93
|
+
executionTime: `${S.executionTime.toFixed(2)}ms`
|
|
97
94
|
}), {
|
|
98
|
-
dynamicContentList:
|
|
99
|
-
compiledHtml:
|
|
95
|
+
dynamicContentList: P,
|
|
96
|
+
compiledHtml: w,
|
|
100
97
|
rawHtml: r,
|
|
101
98
|
css: l,
|
|
102
|
-
ampHtml:
|
|
99
|
+
ampHtml: E,
|
|
103
100
|
ampErrors: T,
|
|
104
101
|
modules: g.map(Number),
|
|
105
102
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
103
|
+
campaignUrls: F.recommendationCampaignUrls,
|
|
107
104
|
configs: {}
|
|
108
105
|
},
|
|
109
106
|
unsubscribe: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.17.0-beta.
|
|
3
|
+
"version": "3.17.0-beta.77567eb",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"start": "vite",
|
|
26
26
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
|
|
27
27
|
"preview": "vite preview",
|
|
28
|
-
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ &&
|
|
28
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
|
|
29
29
|
"lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
|
|
30
30
|
"lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
|
|
31
31
|
"lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"license": "ISC",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@stripoinc/ui-editor-extensions": "3.9.0",
|
|
51
|
-
"@useinsider/design-system-organisms": "0.0.3-beta.fc2c160",
|
|
52
51
|
"@useinsider/design-system-vue": "1.5.0",
|
|
53
52
|
"@vueuse/core": "11.3.0",
|
|
54
53
|
"lodash-es": "4.17.21",
|
|
@@ -118,7 +117,7 @@
|
|
|
118
117
|
},
|
|
119
118
|
"guido": {
|
|
120
119
|
"stripo": {
|
|
121
|
-
"version": "2.
|
|
120
|
+
"version": "2.73.0"
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import a from "./AssignStrategyDrawer.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var o = function() {
|
|
5
|
-
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
6
|
-
return e(t.WpDrawer, { attrs: { id: "assign-strategy-drawer", "description-status": "", size: "medium", "description-text": t.drawerDescription, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.assignStrategyDrawerStatus, "title-text": t.trans("gpt-app-builder.assign-recommendation-strategy") }, on: { cancelOrBackButtonEvent: t.closeDrawer, onCloseEvent: t.closeDrawer, primaryButtonEvent: t.assignStrategy } }, [t.store.assignStrategyDrawerStatus ? e("div", { staticClass: "assign-strategy-drawer-content d-f f-d-c gap-16" }, [e(t.InSelect, { staticClass: "assign-strategy-select", attrs: { id: "assign-strategy-select", "search-status": "", "static-child-position": "bottom right", "button-status": !1, "dynamic-child-position": !1, "label-text": t.trans("ds-steps.recommendation-strategy"), options: t.strategyOptions, "placeholder-text": t.trans("ds-steps.select-strategy"), "skeleton-sizing": { width: 240, height: 42 }, "skeleton-status": t.store.strategiesLoading, state: t.showSelectionError ? "error" : "default", "state-message": t.showSelectionError ? t.trans("ds-steps.select-strategy-tooltip") : "", value: t.selectValue }, on: { select: t.onSelect } }), t.selectedStrategy ? e("div", { key: String(t.selectedStrategy.strategy_id), staticClass: "assign-strategy-detail" }, [e(t.OrgStrategyDetailModal, { attrs: { show: "", "campaign-details-tab-status": t.campaignTabSupported, "footer-status": !1, strategy: t.selectedStrategy } })], 1) : s._e()], 1) : s._e()]);
|
|
7
|
-
}, n = [], i = /* @__PURE__ */ r(
|
|
8
|
-
a,
|
|
9
|
-
o,
|
|
10
|
-
n,
|
|
11
|
-
!1,
|
|
12
|
-
null,
|
|
13
|
-
"afde0449"
|
|
14
|
-
);
|
|
15
|
-
const p = i.exports;
|
|
16
|
-
export {
|
|
17
|
-
p as default
|
|
18
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { defineComponent as S, defineAsyncComponent as w, ref as c, computed as o, watch as v } from "vue";
|
|
2
|
-
import "@useinsider/design-system-organisms/style";
|
|
3
|
-
import _ from "../../../wrappers/WpDrawer.vue.js";
|
|
4
|
-
import { useToaster as D } from "../../../../composables/useToaster.js";
|
|
5
|
-
import { useTranslations as T } from "../../../../composables/useTranslations.js";
|
|
6
|
-
import { URLS as A } from "../../../../enums/extensions/recommendationBlock.js";
|
|
7
|
-
import { ToasterTypeOptions as u } from "../../../../enums/toaster.js";
|
|
8
|
-
import { useRecommendationExtensionStore as E } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
-
import { buildStrategyInfoBoxProps as O } from "../../../../utils/strategyInfoBox.js";
|
|
10
|
-
import { InSelect as x } from "@useinsider/design-system-vue";
|
|
11
|
-
const V = /* @__PURE__ */ S({
|
|
12
|
-
__name: "AssignStrategyDrawer",
|
|
13
|
-
setup(B) {
|
|
14
|
-
const p = w(
|
|
15
|
-
async () => (await import("@useinsider/design-system-organisms")).OrgStrategyDetailModal
|
|
16
|
-
), r = T(), e = E(), { showToaster: n } = D(), s = c(null), a = c(!1), l = c(!1), m = o(() => e.assignStrategyDrawerStatus ? r("email-editor.assign-strategy-description", { url: A.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
|
|
17
|
-
v(() => e.assignStrategyDrawerStatus, (t) => {
|
|
18
|
-
if (!t)
|
|
19
|
-
return;
|
|
20
|
-
const { strategyId: i } = e.recommendationConfigs;
|
|
21
|
-
s.value = i || null, a.value = !1, l.value = !!window.l10n, e.fetchStrategies().catch(() => {
|
|
22
|
-
n({
|
|
23
|
-
type: u.Error,
|
|
24
|
-
message: r("discovery-strategy.error-description")
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
const y = o(() => e.strategies.map((t) => ({
|
|
29
|
-
text: t.name,
|
|
30
|
-
value: t.strategy_id,
|
|
31
|
-
infoBoxProps: O(t, r)
|
|
32
|
-
}))), d = o(() => [{ value: s.value }]), g = o(() => {
|
|
33
|
-
const t = e.strategies.find((i) => String(i.strategy_id) === String(s.value ?? ""));
|
|
34
|
-
return t ? { ...t, fallback_config: null } : null;
|
|
35
|
-
}), f = o(() => ({
|
|
36
|
-
primaryButton: {
|
|
37
|
-
styling: "solid",
|
|
38
|
-
type: "primary",
|
|
39
|
-
labelText: r("products.assign-btn")
|
|
40
|
-
},
|
|
41
|
-
cancelOrBackButton: {
|
|
42
|
-
styling: "ghost",
|
|
43
|
-
type: "secondary",
|
|
44
|
-
labelText: r("products.cancel")
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
return { __sfc: !0, OrgStrategyDetailModal: p, trans: r, store: e, showToaster: n, selectedStrategyId: s, showSelectionError: a, campaignTabSupported: l, drawerDescription: m, strategyOptions: y, selectValue: d, selectedStrategy: g, footerButtonGroupOptions: f, closeDrawer: () => {
|
|
48
|
-
e.closeAssignStrategyDrawer();
|
|
49
|
-
}, assignStrategy: () => {
|
|
50
|
-
const t = g.value;
|
|
51
|
-
if (!t) {
|
|
52
|
-
a.value = !0;
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
e.assignStrategy(t), n({
|
|
56
|
-
type: u.Success,
|
|
57
|
-
message: r("email-editor.strategy-assigned-success", { strategyName: t.name })
|
|
58
|
-
}), e.closeAssignStrategyDrawer();
|
|
59
|
-
}, onSelect: (t) => {
|
|
60
|
-
s.value = t.value, a.value = !1;
|
|
61
|
-
}, WpDrawer: _, InSelect: x };
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
export {
|
|
65
|
-
V as default
|
|
66
|
-
};
|
|
@@ -1,142 +0,0 @@
|
|
|
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 {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
o(this, "store", u());
|
|
12
|
-
o(this, "storeUnsubscription", () => {
|
|
13
|
-
});
|
|
14
|
-
o(this, "listeners", []);
|
|
15
|
-
// The store subscription fires on EVERY mutation of a store six controls
|
|
16
|
-
// share, so the last painted state is kept to skip the DOM work.
|
|
17
|
-
o(this, "lastPaintedState", null);
|
|
18
|
-
}
|
|
19
|
-
getId() {
|
|
20
|
-
return p;
|
|
21
|
-
}
|
|
22
|
-
getTemplate() {
|
|
23
|
-
const t = this.api.translate(
|
|
24
|
-
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
25
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
|
|
26
|
-
return `
|
|
27
|
-
<div class="strategy-control-container">
|
|
28
|
-
<div class="strategy-control-header">
|
|
29
|
-
<h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="strategy-control-description-row">
|
|
32
|
-
<p class="strategy-control-description">
|
|
33
|
-
${t}
|
|
34
|
-
${e}
|
|
35
|
-
<a
|
|
36
|
-
href="${m.EMAIL_RECOMMENDATION_BLOCK}"
|
|
37
|
-
target="_blank"
|
|
38
|
-
rel="noopener noreferrer">${a}</a>.
|
|
39
|
-
</p>
|
|
40
|
-
</div>
|
|
41
|
-
<div data-strategy-empty-state>
|
|
42
|
-
${this._GuTwoColumns([
|
|
43
|
-
this._GuButton({
|
|
44
|
-
name: "assignStrategy",
|
|
45
|
-
label: this.api.translate("Assign Strategy"),
|
|
46
|
-
id: "guido__btn-assign-strategy",
|
|
47
|
-
className: "strategy-control-cta on"
|
|
48
|
-
}),
|
|
49
|
-
// Create round-trip ships with SD-149916; until then the CTA
|
|
50
|
-
// stays inert at full contrast, as the design draws it.
|
|
51
|
-
this._GuButton({
|
|
52
|
-
name: "createStrategy",
|
|
53
|
-
label: this.api.translate("Create New Strategy"),
|
|
54
|
-
id: "guido__btn-create-strategy",
|
|
55
|
-
className: "strategy-control-cta primary",
|
|
56
|
-
disabled: !0
|
|
57
|
-
})
|
|
58
|
-
], "strategy-control-cta-row")}
|
|
59
|
-
</div>
|
|
60
|
-
<div data-strategy-assigned-state style="display: none;">
|
|
61
|
-
<div class="strategy-control-name-band">
|
|
62
|
-
<span class="strategy-control-name" data-strategy-name></span>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="strategy-control-actions">
|
|
65
|
-
${this._strategyAction({
|
|
66
|
-
id: "guido__btn-change-strategy",
|
|
67
|
-
label: this.api.translate("Change"),
|
|
68
|
-
modifier: "change"
|
|
69
|
-
})}
|
|
70
|
-
${this._strategyAction({
|
|
71
|
-
id: "guido__btn-remove-strategy",
|
|
72
|
-
label: this.api.translate("Remove"),
|
|
73
|
-
modifier: "remove"
|
|
74
|
-
})}
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Change / Remove are icon+text actions in the design, not buttons — and
|
|
82
|
-
* `ue-button` cannot pair a caption with an arbitrary icon, so these are
|
|
83
|
-
* plain elements. Click wiring is by id, which works on any element.
|
|
84
|
-
*
|
|
85
|
-
* The icon is a CSS mask, not inline SVG: Stripo re-creates the control's
|
|
86
|
-
* markup through Angular, which rebuilds `<svg>` outside the SVG namespace
|
|
87
|
-
* (the view-box attribute comes back lowercased) and it never paints.
|
|
88
|
-
*/
|
|
89
|
-
_strategyAction({ id: t, label: e, modifier: a }) {
|
|
90
|
-
return `
|
|
91
|
-
<button
|
|
92
|
-
id="${t}"
|
|
93
|
-
type="button"
|
|
94
|
-
class="strategy-control-action strategy-control-action--${a}">
|
|
95
|
-
<span>${e}</span>
|
|
96
|
-
</button>
|
|
97
|
-
`;
|
|
98
|
-
}
|
|
99
|
-
onRender() {
|
|
100
|
-
this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
101
|
-
this._renderState();
|
|
102
|
-
}), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
onDestroy() {
|
|
106
|
-
this._teardown();
|
|
107
|
-
}
|
|
108
|
-
_teardown() {
|
|
109
|
-
this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
110
|
-
}, this.lastPaintedState = null, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
|
|
111
|
-
}
|
|
112
|
-
_setupButtonListeners() {
|
|
113
|
-
const t = this.getContainer();
|
|
114
|
-
if (!t)
|
|
115
|
-
return;
|
|
116
|
-
const e = (a, n) => {
|
|
117
|
-
const i = t.querySelector(a);
|
|
118
|
-
i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
|
|
119
|
-
};
|
|
120
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.removeStrategy());
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Toggles empty vs assigned state from the store's current block config.
|
|
124
|
-
* Display name comes from the listing; falls back to the raw id while the
|
|
125
|
-
* listing loads (or when the strategy is no longer listed).
|
|
126
|
-
*/
|
|
127
|
-
_renderState() {
|
|
128
|
-
var l;
|
|
129
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
|
|
130
|
-
if (a === this.lastPaintedState)
|
|
131
|
-
return;
|
|
132
|
-
const n = this.getContainer();
|
|
133
|
-
if (!n)
|
|
134
|
-
return;
|
|
135
|
-
const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
|
|
136
|
-
!i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export {
|
|
140
|
-
p as STRATEGY_CONTROL_ID,
|
|
141
|
-
f as StrategyControl
|
|
142
|
-
};
|
package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import '@useinsider/design-system-organisms/style';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
3
|
-
export default _default;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CommonControl } from '../../../common-control';
|
|
2
|
-
export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
|
|
3
|
-
export declare class StrategyControl extends CommonControl {
|
|
4
|
-
private store;
|
|
5
|
-
private storeUnsubscription;
|
|
6
|
-
private listeners;
|
|
7
|
-
private lastPaintedState;
|
|
8
|
-
getId(): string;
|
|
9
|
-
getTemplate(): string;
|
|
10
|
-
/**
|
|
11
|
-
* Change / Remove are icon+text actions in the design, not buttons — and
|
|
12
|
-
* `ue-button` cannot pair a caption with an arbitrary icon, so these are
|
|
13
|
-
* plain elements. Click wiring is by id, which works on any element.
|
|
14
|
-
*
|
|
15
|
-
* The icon is a CSS mask, not inline SVG: Stripo re-creates the control's
|
|
16
|
-
* markup through Angular, which rebuilds `<svg>` outside the SVG namespace
|
|
17
|
-
* (the view-box attribute comes back lowercased) and it never paints.
|
|
18
|
-
*/
|
|
19
|
-
private _strategyAction;
|
|
20
|
-
onRender(): void;
|
|
21
|
-
onDestroy(): void;
|
|
22
|
-
private _teardown;
|
|
23
|
-
private _setupButtonListeners;
|
|
24
|
-
/**
|
|
25
|
-
* Toggles empty vs assigned state from the store's current block config.
|
|
26
|
-
* Display name comes from the listing; falls back to the raw id while the
|
|
27
|
-
* listing loads (or when the strategy is no longer listed).
|
|
28
|
-
*/
|
|
29
|
-
private _renderState;
|
|
30
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export declare const MOCK_RRS_STRATEGIES: ({
|
|
2
|
-
strategy_id: number;
|
|
3
|
-
name: string;
|
|
4
|
-
status: string;
|
|
5
|
-
suitable_channels: string;
|
|
6
|
-
suitable_page_types: string;
|
|
7
|
-
algorithm: string;
|
|
8
|
-
algorithm_used: string;
|
|
9
|
-
method: string;
|
|
10
|
-
size: number;
|
|
11
|
-
filters: string;
|
|
12
|
-
shuffle: number;
|
|
13
|
-
attribute_affinity: number;
|
|
14
|
-
exclude_view: number;
|
|
15
|
-
exclude_purchase: number;
|
|
16
|
-
exclude_cart: number;
|
|
17
|
-
manual_merchandising_products: string;
|
|
18
|
-
fallback_config: null;
|
|
19
|
-
channelNames: string;
|
|
20
|
-
campaignCount: {
|
|
21
|
-
active: number;
|
|
22
|
-
passive: number;
|
|
23
|
-
test: number;
|
|
24
|
-
};
|
|
25
|
-
created_at: string;
|
|
26
|
-
updated_at: string;
|
|
27
|
-
last_updated_by: string;
|
|
28
|
-
mixed_strategies?: undefined;
|
|
29
|
-
exclude_view_duration?: undefined;
|
|
30
|
-
exclude_view_duration_type?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
strategy_id: number;
|
|
33
|
-
name: string;
|
|
34
|
-
status: string;
|
|
35
|
-
suitable_channels: string;
|
|
36
|
-
suitable_page_types: string;
|
|
37
|
-
algorithm: string;
|
|
38
|
-
algorithm_used: string;
|
|
39
|
-
mixed_strategies: string;
|
|
40
|
-
method: string;
|
|
41
|
-
size: number;
|
|
42
|
-
filters: string;
|
|
43
|
-
shuffle: number;
|
|
44
|
-
attribute_affinity: number;
|
|
45
|
-
exclude_view: number;
|
|
46
|
-
exclude_view_duration: number;
|
|
47
|
-
exclude_view_duration_type: string;
|
|
48
|
-
exclude_purchase: number;
|
|
49
|
-
exclude_cart: number;
|
|
50
|
-
manual_merchandising_products: string;
|
|
51
|
-
fallback_config: null;
|
|
52
|
-
channelNames: string;
|
|
53
|
-
campaignCount: {
|
|
54
|
-
active: number;
|
|
55
|
-
passive: number;
|
|
56
|
-
test: number;
|
|
57
|
-
};
|
|
58
|
-
created_at: string;
|
|
59
|
-
updated_at: string;
|
|
60
|
-
last_updated_by: string;
|
|
61
|
-
})[];
|
|
62
|
-
declare const _default: import("msw").HttpHandler[];
|
|
63
|
-
export default _default;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { RrsStrategy } from '@@/Types/recommendation';
|
|
2
|
-
import { useTranslations } from '@@/Composables/useTranslations';
|
|
3
|
-
export declare const STRATEGY_INFO_BOX_CLASS = "assign-strategy-info-box";
|
|
4
|
-
/**
|
|
5
|
-
* Props for the design system info box that previews a strategy on hover.
|
|
6
|
-
*
|
|
7
|
-
* The box is InSelect's own per-option feature: the dropdown v-binds this whole
|
|
8
|
-
* object onto `<in-info-box>`, so `titleText`/`descriptionText` are all it takes
|
|
9
|
-
* — no slot component. Both go through the design system's sanitizer, and every
|
|
10
|
-
* partner-supplied value is escaped here before it reaches that markup.
|
|
11
|
-
*
|
|
12
|
-
* `trans` is injectable because callers map this over a whole listing, and
|
|
13
|
-
* `useTranslations()` rebuilds its dictionary and memo cache on every call.
|
|
14
|
-
*/
|
|
15
|
-
export declare const buildStrategyInfoBoxProps: (strategy: RrsStrategy, trans?: ReturnType<typeof useTranslations>) => {
|
|
16
|
-
id: string;
|
|
17
|
-
theme: string;
|
|
18
|
-
variant: string;
|
|
19
|
-
className: string;
|
|
20
|
-
titleText: string;
|
|
21
|
-
descriptionText: string;
|
|
22
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const l = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.768 11.694a1.03 1.03 0 0 1-1.465 0 1.051 1.051 0 0 1 0-1.478L17.51 9H9a1 1 0 1 1 0-2h8.509l-1.206-1.216a1.051 1.051 0 0 1 0-1.478 1.03 1.03 0 0 1 1.465 0l2.929 2.955c.404.408.404 1.07 0 1.478l-2.93 2.955zM3.303 15.261a1.051 1.051 0 0 0 0 1.478l2.93 2.955a1.03 1.03 0 0 0 1.464 0 1.051 1.051 0 0 0 0-1.478L6.49 17H15a1 1 0 1 0 0-2H6.491l1.206-1.216a1.051 1.051 0 0 0 0-1.478 1.03 1.03 0 0 0-1.465 0l-2.929 2.955z"/></svg>
|
|
2
|
-
`;
|
|
3
|
-
export {
|
|
4
|
-
l as default
|
|
5
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const C = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.97 7H16.09C16.3342 7.02199 16.5619 7.13294 16.7296 7.31178C16.8974 7.49062 16.9936 7.72487 17 7.97V8.09L16.24 16.36C16.1547 17.3188 15.7266 18.2147 15.0341 18.8833C14.3416 19.552 13.4312 19.9484 12.47 20L12.26 20.01H7.74C6.77775 20.0102 5.84767 19.6635 5.12033 19.0335C4.39298 18.4035 3.91712 17.5324 3.78 16.58L3.76 16.38L3 8.08C2.9803 7.94999 2.9864 7.81738 3.01796 7.68973C3.04951 7.56207 3.1059 7.44189 3.1839 7.33603C3.34143 7.12224 3.57744 6.97978 3.84 6.94C4.10256 6.90022 4.37018 6.96637 4.58397 7.1239C4.68983 7.2019 4.77929 7.29999 4.84724 7.41256C4.91519 7.52514 4.9603 7.64999 4.98 7.78L5 7.9L5.75 16.17C5.78903 16.644 5.99569 17.0886 6.3329 17.4239C6.67011 17.7593 7.1158 17.9636 7.59 18L7.74 18.01H12.26C12.7328 18.0094 13.1901 17.8413 13.5507 17.5356C13.9113 17.2299 14.152 16.8063 14.23 16.34L14.25 16.19L15 7.92C15.022 7.67577 15.1329 7.44813 15.3118 7.28036C15.4906 7.11258 15.7249 7.01637 15.97 7.01V7ZM8 9C8.24568 8.99822 8.48341 9.08695 8.66785 9.24926C8.85229 9.41157 8.97052 9.63609 9 9.88V15C9.00788 15.1313 8.98982 15.2629 8.94684 15.3873C8.90387 15.5116 8.83682 15.6262 8.74953 15.7247C8.66225 15.8231 8.55643 15.9034 8.43812 15.9609C8.31981 16.0185 8.19132 16.0521 8.06 16.06C7.79478 16.0759 7.53411 15.9858 7.33532 15.8095C7.13653 15.6332 7.01591 15.3852 7 15.12V10C7 9.73478 7.10536 9.48043 7.29289 9.29289C7.48043 9.10536 7.73478 9 8 9ZM12 9C12.2457 8.99822 12.4834 9.08695 12.6679 9.24926C12.8523 9.41157 12.9705 9.63609 13 9.88V15C13.0159 15.2652 12.9258 15.5259 12.7495 15.7247C12.5732 15.9235 12.3252 16.0441 12.06 16.06C11.7948 16.0759 11.5341 15.9858 11.3353 15.8095C11.1365 15.6332 11.0159 15.3852 11 15.12V10C11 9.73478 11.1054 9.48043 11.2929 9.29289C11.4804 9.10536 11.7348 9 12 9ZM3 6C2.73478 6.01591 2.47411 5.92582 2.27532 5.74953C2.07653 5.57325 1.95591 5.32522 1.94 5.06C1.92409 4.79478 2.01418 4.53411 2.19047 4.33532C2.36675 4.13653 2.61478 4.01591 2.88 4H6.23L6.66 2.3C6.8129 1.67693 7.16151 1.11929 7.65466 0.708933C8.14781 0.298574 8.75952 0.0571152 9.4 0.02H10.45C11.0881 0.0203866 11.7094 0.224211 12.2237 0.60186C12.7381 0.979509 13.1186 1.51131 13.31 2.12L13.36 2.28L13.79 3.99H17C17.2652 3.97409 17.5259 4.06418 17.7247 4.24047C17.9235 4.41675 18.0441 4.66478 18.06 4.93C18.0759 5.19522 17.9858 5.45589 17.8095 5.65468C17.6332 5.85347 17.3852 5.97409 17.12 5.99H3V6ZM10.44 2.03H9.57C9.36856 2.0306 9.17199 2.09201 9.00605 2.20621C8.8401 2.32041 8.71252 2.48206 8.64 2.67L8.6 2.78L8.3 4H11.72L11.42 2.78C11.3746 2.60092 11.2805 2.4379 11.1481 2.30905C11.0157 2.18019 10.8502 2.09053 10.67 2.05L10.55 2.03H10.45H10.44Z"/></svg>
|
|
2
|
-
`;
|
|
3
|
-
export {
|
|
4
|
-
C as default
|
|
5
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const C = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 4C10.2457 3.99823 10.4834 4.08695 10.6679 4.24926C10.8523 4.41157 10.9705 4.63609 11 4.88V9H15C15.2652 8.98409 15.5259 9.07418 15.7247 9.25047C15.9235 9.42675 16.0441 9.67478 16.06 9.94C16.0759 10.2052 15.9858 10.4659 15.8095 10.6647C15.6332 10.8635 15.3852 10.9841 15.12 11H11V15C11.0159 15.2652 10.9258 15.5259 10.7495 15.7247C10.5732 15.9235 10.3252 16.0441 10.06 16.06C9.79478 16.0759 9.53411 15.9858 9.33532 15.8095C9.13653 15.6332 9.01591 15.3852 9 15.12V11H5C4.73478 11.0159 4.47411 10.9258 4.27532 10.7495C4.07653 10.5732 3.95591 10.3252 3.94 10.06C3.92409 9.79478 4.01418 9.53411 4.19047 9.33532C4.36675 9.13653 4.61478 9.01591 4.88 9H9V5C9 4.73478 9.10536 4.48043 9.29289 4.29289C9.48043 4.10536 9.73478 4 10 4Z"/></svg>
|
|
2
|
-
`;
|
|
3
|
-
export {
|
|
4
|
-
C as default
|
|
5
|
-
};
|