@useinsider/guido 3.12.0-beta.d2745e7 → 3.12.0-beta.d77b0d2
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 +9 -4
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +50 -49
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +38 -0
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +271 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
- package/dist/composables/useHtmlValidator.js +68 -60
- package/dist/composables/useHttp.js +61 -52
- package/dist/composables/useRecommendation.js +56 -40
- package/dist/composables/useSave.js +22 -22
- package/dist/composables/useStrategyFilters.js +16 -0
- package/dist/config/migrator/recommendationMigrator.js +7 -4
- package/dist/enums/date.js +4 -3
- package/dist/enums/extensions/filteringV2.js +1024 -0
- package/dist/enums/extensions/recommendationBlock.js +45 -24
- package/dist/enums/extensions/strategyDetail.js +149 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +141 -123
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +297 -0
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +16 -2
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +137 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +549 -165
- package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyNavigation.js +8 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +95 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyUrl.js +43 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -10
- package/dist/extensions/Blocks/common-control.js +37 -35
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +127 -33
- package/dist/services/stripoApi.js +18 -18
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +2 -0
- package/dist/src/composables/useStrategyFilters.d.ts +24 -0
- package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +33 -0
- package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +118 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +958 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyNavigation.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyUrl.d.ts +51 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +8 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +5 -2
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +9 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/utils/genericUtil.d.ts +9 -0
- package/dist/static/styles/components/base-input.css.js +6 -7
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +10 -1
- package/dist/utils/templatePreparation.js +70 -57
- package/package.json +1 -1
|
@@ -1,106 +1,119 @@
|
|
|
1
1
|
import { useActionsApi as P } from "../composables/useActionsApi.js";
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { mapLegacyStrategy as
|
|
6
|
-
import { DATA_ATTRIBUTES as
|
|
7
|
-
import { parsePageList as
|
|
8
|
-
import { useDynamicContentStore as
|
|
9
|
-
import { useUnsubscribeStore as
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
}), [...new Set(
|
|
2
|
+
import { useHtmlCompiler as D } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as u, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
4
|
+
import { useRecommendationExtensionStore as w } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { mapLegacyStrategy as I } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
6
|
+
import { DATA_ATTRIBUTES as b } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
7
|
+
import { parsePageList as U } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
|
+
import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
|
|
9
|
+
import { useUnsubscribeStore as H } from "../stores/unsubscribe.js";
|
|
10
|
+
function R(m) {
|
|
11
|
+
const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${b.PAGE_LIST}]`), r = [];
|
|
12
|
+
return a.forEach((t) => {
|
|
13
|
+
const i = t.getAttribute(b.PAGE_LIST);
|
|
14
|
+
i && r.push(...U(i));
|
|
15
|
+
}), [...new Set(r)];
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
17
|
+
async function F(m) {
|
|
18
|
+
const l = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
19
|
+
if (l.length === 0)
|
|
20
20
|
return;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
const
|
|
25
|
-
if (!Number.isFinite(
|
|
21
|
+
const a = w(), r = /* @__PURE__ */ new Set();
|
|
22
|
+
l.forEach((t) => {
|
|
23
|
+
var f, y, d, S, o;
|
|
24
|
+
const i = t.getAttribute("recommendation-id"), g = i ? Number(i) : NaN;
|
|
25
|
+
if (!Number.isFinite(g))
|
|
26
26
|
return;
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
27
|
+
const c = t.getAttribute("esd-ext-config");
|
|
28
|
+
if (!c)
|
|
29
29
|
return;
|
|
30
30
|
let e;
|
|
31
31
|
try {
|
|
32
|
-
e = JSON.parse(
|
|
32
|
+
e = JSON.parse(c);
|
|
33
33
|
} catch {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
37
37
|
return;
|
|
38
|
-
const
|
|
38
|
+
const s = {
|
|
39
39
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
40
40
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
41
41
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
42
|
-
strategy:
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
strategy: I(e.strategy) || n.strategy,
|
|
43
|
+
strategyId: e.strategyId ?? n.strategyId,
|
|
44
|
+
language: e.language ?? n.language,
|
|
45
|
+
size: e.size ?? n.size,
|
|
45
46
|
// Spread the default arrays so each block gets a fresh reference
|
|
46
47
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
47
|
-
productIds: e.productIds ?? [...
|
|
48
|
-
filters: e.filters ?? [...
|
|
49
|
-
shuffleProducts: e.shuffleProducts ??
|
|
50
|
-
currencyCode: ((
|
|
51
|
-
currencyAlignment: ((
|
|
52
|
-
currencyDecimalCount: ((
|
|
53
|
-
currencyDecimalSeparator: ((
|
|
54
|
-
currencyThousandSeparator: ((
|
|
48
|
+
productIds: e.productIds ?? [...n.productIds],
|
|
49
|
+
filters: e.filters ?? [...n.filters],
|
|
50
|
+
shuffleProducts: e.shuffleProducts ?? n.shuffleProducts,
|
|
51
|
+
currencyCode: ((f = e.currency) == null ? void 0 : f.code) ?? u.code,
|
|
52
|
+
currencyAlignment: ((y = e.currency) == null ? void 0 : y.alignment) ?? u.alignment,
|
|
53
|
+
currencyDecimalCount: ((d = e.currency) == null ? void 0 : d.decimalCount) ?? u.decimalCount,
|
|
54
|
+
currencyDecimalSeparator: ((S = e.currency) == null ? void 0 : S.decimalSeparator) ?? u.decimalSeparator,
|
|
55
|
+
currencyThousandSeparator: ((o = e.currency) == null ? void 0 : o.thousandSeparator) ?? u.thousandSeparator
|
|
55
56
|
};
|
|
56
|
-
|
|
57
|
+
a.seedBlockUrlConfig(g, s), r.add(s.strategyId);
|
|
57
58
|
});
|
|
58
59
|
try {
|
|
59
|
-
await
|
|
60
|
+
await a.fetchRecommendationCreateData();
|
|
60
61
|
} catch (t) {
|
|
61
62
|
console.warn(
|
|
62
63
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
63
64
|
t
|
|
64
65
|
);
|
|
65
66
|
}
|
|
67
|
+
if (r.delete(""), !!r.size) {
|
|
68
|
+
try {
|
|
69
|
+
await a.fetchRecommendationStrategies();
|
|
70
|
+
} catch (t) {
|
|
71
|
+
console.warn("Strategy listing pre-load failed; the deleted-strategy save check will be skipped.", t);
|
|
72
|
+
}
|
|
73
|
+
await Promise.all(
|
|
74
|
+
[...r].map((t) => a.fetchStrategyUrlTemplate(t))
|
|
75
|
+
);
|
|
76
|
+
}
|
|
66
77
|
}
|
|
67
78
|
const G = () => {
|
|
68
|
-
const
|
|
79
|
+
const m = E(), p = H(), { getCompiledEmail: l, getTemplateData: a } = P(), { compileHtml: r, compileAmpHtml: t } = D();
|
|
69
80
|
return {
|
|
70
81
|
prepareTemplateDetails: async () => {
|
|
71
|
-
const { html:
|
|
82
|
+
const { html: g, ampHtml: c = "", ampErrors: e = [] } = await l({
|
|
72
83
|
minimize: !0,
|
|
73
84
|
resetDataSavedFlag: !1
|
|
74
|
-
}), { html:
|
|
75
|
-
|
|
76
|
-
const
|
|
85
|
+
}), { html: s, css: f, syncModulesIds: y = [] } = await a();
|
|
86
|
+
p.selectedUnsubscribePages.length && await p.fetchTemplates(), await F(s);
|
|
87
|
+
const d = w();
|
|
88
|
+
await d.awaitPendingStrategyUrls();
|
|
89
|
+
const { compiledHtml: S, stats: o, appliedRules: A } = r(g), C = c && t(c).compiledHtml, T = m.getSelectedDynamicContentList, h = R(s);
|
|
77
90
|
return console.debug("HTML Compilation Stats:", {
|
|
78
|
-
originalSize:
|
|
79
|
-
compiledSize:
|
|
80
|
-
reduction: `${
|
|
91
|
+
originalSize: o.originalSize,
|
|
92
|
+
compiledSize: o.compiledSize,
|
|
93
|
+
reduction: `${o.reductionPercentage.toFixed(2)}%`,
|
|
81
94
|
appliedRules: A,
|
|
82
|
-
executionTime: `${
|
|
95
|
+
executionTime: `${o.executionTime.toFixed(2)}ms`
|
|
83
96
|
}), {
|
|
84
97
|
dynamicContentList: T,
|
|
85
|
-
compiledHtml:
|
|
86
|
-
rawHtml:
|
|
87
|
-
css:
|
|
98
|
+
compiledHtml: S,
|
|
99
|
+
rawHtml: s,
|
|
100
|
+
css: f,
|
|
88
101
|
ampHtml: C,
|
|
89
|
-
ampErrors:
|
|
90
|
-
modules:
|
|
102
|
+
ampErrors: e,
|
|
103
|
+
modules: y.map(Number),
|
|
91
104
|
recommendation: {
|
|
92
|
-
campaignUrls:
|
|
105
|
+
campaignUrls: d.recommendationCampaignUrls,
|
|
93
106
|
configs: {}
|
|
94
107
|
},
|
|
95
108
|
unsubscribe: {
|
|
96
|
-
status:
|
|
97
|
-
config:
|
|
109
|
+
status: h.length > 0,
|
|
110
|
+
config: h
|
|
98
111
|
}
|
|
99
112
|
};
|
|
100
113
|
}
|
|
101
114
|
};
|
|
102
115
|
};
|
|
103
116
|
export {
|
|
104
|
-
|
|
117
|
+
R as getHtmlReferencedUnsubscribePages,
|
|
105
118
|
G as useTemplatePreparation
|
|
106
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.12.0-beta.
|
|
3
|
+
"version": "3.12.0-beta.d77b0d2",
|
|
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",
|