@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,120 +1,96 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}), [...new Set(t)];
|
|
1
|
+
import { useActionsApi as x } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as E } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { useRecommendationExtensionStore as S } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { toBlockUrlConfig as F } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
6
|
+
import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
7
|
+
import { parsePageList as I } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
|
+
import { useDynamicContentStore as U } from "../stores/dynamic-content.js";
|
|
9
|
+
import { useEditorStore as R } from "../stores/editor.js";
|
|
10
|
+
import { useUnsubscribeStore as L } from "../stores/unsubscribe.js";
|
|
11
|
+
import { isPlainObject as N } from "./genericUtil.js";
|
|
12
|
+
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
13
|
+
function z(n) {
|
|
14
|
+
const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
|
|
15
|
+
return r.forEach((i) => {
|
|
16
|
+
const t = i.getAttribute(g.PAGE_LIST);
|
|
17
|
+
t && e.push(...I(t));
|
|
18
|
+
}), [...new Set(e)];
|
|
20
19
|
}
|
|
21
|
-
async function M(
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
20
|
+
async function M(n) {
|
|
21
|
+
const o = new DOMParser().parseFromString(n, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (o.length === 0)
|
|
24
23
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!Number.isFinite(r))
|
|
24
|
+
const r = S();
|
|
25
|
+
o.forEach((e) => {
|
|
26
|
+
const i = e.getAttribute("recommendation-id"), t = i ? Number(i) : NaN;
|
|
27
|
+
if (!Number.isFinite(t))
|
|
30
28
|
return;
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
29
|
+
const m = e.getAttribute("esd-ext-config");
|
|
30
|
+
if (!m)
|
|
33
31
|
return;
|
|
34
|
-
let
|
|
32
|
+
let a;
|
|
35
33
|
try {
|
|
36
|
-
|
|
34
|
+
a = JSON.parse(m);
|
|
37
35
|
} catch {
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
return;
|
|
42
|
-
const C = !!e.strategyId || (e.configVersion ?? 0) >= U, o = {
|
|
43
|
-
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
44
|
-
// already-saved blocks that never re-run the migrator don't emit a
|
|
45
|
-
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
46
|
-
strategy: x(e.strategy) || (C ? "" : n.strategy),
|
|
47
|
-
strategyId: e.strategyId ?? n.strategyId,
|
|
48
|
-
language: e.language ?? n.language,
|
|
49
|
-
size: e.size ?? n.size,
|
|
50
|
-
// Spread the default arrays so each block gets a fresh reference
|
|
51
|
-
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
52
|
-
productIds: e.productIds ?? [...n.productIds],
|
|
53
|
-
filters: e.filters ?? [...n.filters],
|
|
54
|
-
shuffleProducts: e.shuffleProducts ?? n.shuffleProducts,
|
|
55
|
-
currencyCode: ((d = e.currency) == null ? void 0 : d.code) ?? m.code,
|
|
56
|
-
currencySymbol: ((g = e.currency) == null ? void 0 : g.symbol) ?? m.symbol,
|
|
57
|
-
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? m.alignment,
|
|
58
|
-
currencyDecimalCount: ((c = e.currency) == null ? void 0 : c.decimalCount) ?? m.decimalCount,
|
|
59
|
-
currencyDecimalSeparator: ((y = e.currency) == null ? void 0 : y.decimalSeparator) ?? m.decimalSeparator,
|
|
60
|
-
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? m.thousandSeparator
|
|
61
|
-
};
|
|
62
|
-
i.seedBlockUrlConfig(r, o);
|
|
38
|
+
N(a) && r.seedBlockUrlConfig(t, F(a));
|
|
63
39
|
});
|
|
64
40
|
try {
|
|
65
|
-
await
|
|
66
|
-
} catch (
|
|
41
|
+
await r.fetchRecommendationCreateData();
|
|
42
|
+
} catch (e) {
|
|
67
43
|
console.warn(
|
|
68
44
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
69
|
-
|
|
45
|
+
e
|
|
70
46
|
);
|
|
71
47
|
}
|
|
72
48
|
}
|
|
73
|
-
const
|
|
74
|
-
const
|
|
49
|
+
const Y = () => {
|
|
50
|
+
const n = U(), c = R(), o = L(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = x(), { compileHtml: t, compileAmpHtml: m } = E(), { isFeatureEnabled: a } = D();
|
|
75
51
|
return {
|
|
76
52
|
prepareTemplateDetails: async () => {
|
|
77
|
-
let { html:
|
|
78
|
-
if (
|
|
53
|
+
let { html: s, css: u, syncModulesIds: b = [] } = await e();
|
|
54
|
+
if (a("linkTrackingIds"))
|
|
79
55
|
try {
|
|
80
|
-
const { html:
|
|
81
|
-
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
56
|
+
const { html: d, changed: k, nextSeq: P } = v(s, c.trackIdSessionFloor);
|
|
57
|
+
c.trackIdSessionFloor = P, k && (s = d, await i(d, u));
|
|
58
|
+
} catch (d) {
|
|
59
|
+
console.error("Tracking-id step failed, saving anyway:", d);
|
|
84
60
|
}
|
|
85
|
-
const { html:
|
|
61
|
+
const { html: h, ampHtml: p = "", ampErrors: T = [] } = await r({
|
|
86
62
|
minimize: !0,
|
|
87
63
|
resetDataSavedFlag: !1
|
|
88
64
|
});
|
|
89
|
-
|
|
90
|
-
const { compiledHtml:
|
|
65
|
+
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await M(s);
|
|
66
|
+
const { compiledHtml: y, stats: l, appliedRules: A } = t(h), w = p && m(p).compiledHtml, C = n.getSelectedDynamicContentList, H = S(), f = z(s);
|
|
91
67
|
return console.debug("HTML Compilation Stats:", {
|
|
92
|
-
originalSize:
|
|
93
|
-
compiledSize:
|
|
94
|
-
reduction: `${
|
|
95
|
-
appliedRules:
|
|
96
|
-
executionTime: `${
|
|
68
|
+
originalSize: l.originalSize,
|
|
69
|
+
compiledSize: l.compiledSize,
|
|
70
|
+
reduction: `${l.reductionPercentage.toFixed(2)}%`,
|
|
71
|
+
appliedRules: A,
|
|
72
|
+
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
97
73
|
}), {
|
|
98
|
-
dynamicContentList:
|
|
99
|
-
compiledHtml:
|
|
100
|
-
rawHtml:
|
|
101
|
-
css:
|
|
102
|
-
ampHtml:
|
|
103
|
-
ampErrors:
|
|
104
|
-
modules:
|
|
74
|
+
dynamicContentList: C,
|
|
75
|
+
compiledHtml: y,
|
|
76
|
+
rawHtml: s,
|
|
77
|
+
css: u,
|
|
78
|
+
ampHtml: w,
|
|
79
|
+
ampErrors: T,
|
|
80
|
+
modules: b.map(Number),
|
|
105
81
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
82
|
+
campaignUrls: H.recommendationCampaignUrls,
|
|
107
83
|
configs: {}
|
|
108
84
|
},
|
|
109
85
|
unsubscribe: {
|
|
110
|
-
status:
|
|
111
|
-
config:
|
|
86
|
+
status: f.length > 0,
|
|
87
|
+
config: f
|
|
112
88
|
}
|
|
113
89
|
};
|
|
114
90
|
}
|
|
115
91
|
};
|
|
116
92
|
};
|
|
117
93
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
94
|
+
z as getHtmlReferencedUnsubscribePages,
|
|
95
|
+
Y as useTemplatePreparation
|
|
120
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.19.0-beta.
|
|
3
|
+
"version": "3.19.0-beta.cd25cc8",
|
|
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",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"test:e2e-mutation": "node scripts/e2e-mutation-check.mjs",
|
|
39
39
|
"type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json",
|
|
40
40
|
"test": "vitest run --coverage",
|
|
41
|
+
"test:run": "vitest run",
|
|
41
42
|
"test:watch": "vitest",
|
|
42
43
|
"test:visual-update": "npx playwright test --update-snapshots --reporter html",
|
|
43
44
|
"test:e2e:coverage": "E2E_COVERAGE=true playwright test",
|