@useinsider/guido 3.16.0-beta.0faee0c → 3.16.0-beta.1fe8cea
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 +8 -8
- package/dist/components/Guido.vue2.js +78 -76
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +74 -43
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +46 -23
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +48 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useHtmlValidator.js +1 -0
- package/dist/composables/useSave.js +84 -41
- package/dist/composables/useSaveValidation.js +276 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/useStripo.js +29 -30
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +31 -24
- package/dist/guido.css +1 -1
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/composables/useHtmlValidator.d.ts +14 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/stores/config.d.ts +5 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/stores/config.js +13 -6
- package/dist/stores/save-validation.js +30 -0
- package/dist/utils/templatePreparation.js +28 -25
- package/package.json +1 -1
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../@types/config/schemas.js";
|
|
1
|
+
import { MessageType as o } from "../@types/config/schemas.js";
|
|
2
2
|
import "../@types/config/defaults.js";
|
|
3
|
-
import { parseConfig as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
const
|
|
3
|
+
import { parseConfig as r } from "../@types/config/validator.js";
|
|
4
|
+
import { defineStore as a } from "pinia";
|
|
5
|
+
const g = a("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -113,6 +113,13 @@ const f = r("guido-config", {
|
|
|
113
113
|
var e, n;
|
|
114
114
|
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
|
|
115
115
|
},
|
|
116
|
+
/**
|
|
117
|
+
* Transactional campaigns keep the hard save block. Reactive getter, so
|
|
118
|
+
* consumers stay safe in setup where a raw config read snapshots null (SD-147945).
|
|
119
|
+
*/
|
|
120
|
+
isTransactional() {
|
|
121
|
+
return this.messageType === o.TRANSACTIONAL;
|
|
122
|
+
},
|
|
116
123
|
/**
|
|
117
124
|
* Get the username
|
|
118
125
|
*/
|
|
@@ -143,7 +150,7 @@ const f = r("guido-config", {
|
|
|
143
150
|
* Initialize the config store with validated configuration
|
|
144
151
|
*/
|
|
145
152
|
init(i) {
|
|
146
|
-
const e =
|
|
153
|
+
const e = r(i);
|
|
147
154
|
this.config = e, this.initialized = !0;
|
|
148
155
|
},
|
|
149
156
|
/**
|
|
@@ -155,5 +162,5 @@ const f = r("guido-config", {
|
|
|
155
162
|
}
|
|
156
163
|
});
|
|
157
164
|
export {
|
|
158
|
-
|
|
165
|
+
g as useConfigStore
|
|
159
166
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineStore as n } from "pinia";
|
|
2
|
+
function i(e) {
|
|
3
|
+
const t = /* @__PURE__ */ new Set();
|
|
4
|
+
return e.filter((r) => {
|
|
5
|
+
const s = JSON.stringify([r.message, r.detail ?? ""]);
|
|
6
|
+
return t.has(s) ? !1 : (t.add(s), !0);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
const o = n("guidoSaveValidation", {
|
|
10
|
+
state: () => ({
|
|
11
|
+
errors: [],
|
|
12
|
+
isDrawerOpen: !1,
|
|
13
|
+
intent: null
|
|
14
|
+
}),
|
|
15
|
+
getters: {
|
|
16
|
+
errorCount: (e) => e.errors.length
|
|
17
|
+
},
|
|
18
|
+
actions: {
|
|
19
|
+
open(e, t) {
|
|
20
|
+
this.errors = i(e), this.intent = t, this.isDrawerOpen = !0;
|
|
21
|
+
},
|
|
22
|
+
// Errors are retained so rows don't blank during the ~300ms close animation.
|
|
23
|
+
close() {
|
|
24
|
+
this.isDrawerOpen = !1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
o as useSaveValidationStore
|
|
30
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as R } 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
4
|
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
5
|
+
import { useRecommendationExtensionStore as T } 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";
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { useUnsubscribeStore as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
8
|
+
import { parsePageList as N } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
|
+
import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as _ } from "../stores/editor.js";
|
|
11
|
+
import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
|
|
12
|
+
import { assignTrackingIds as O } from "./linkTrackingIds.js";
|
|
13
|
+
function M(m) {
|
|
14
14
|
const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
15
15
|
return n.forEach((i) => {
|
|
16
16
|
const o = i.getAttribute(A.PAGE_LIST);
|
|
17
|
-
o && t.push(...
|
|
17
|
+
o && t.push(...N(o));
|
|
18
18
|
}), [...new Set(t)];
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
20
|
+
async function C(m) {
|
|
21
21
|
const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
22
|
if (a.length === 0)
|
|
23
23
|
return;
|
|
24
|
-
const n =
|
|
24
|
+
const n = T();
|
|
25
25
|
a.forEach((t) => {
|
|
26
26
|
var r, l, g, f, c;
|
|
27
27
|
const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
|
|
@@ -68,39 +68,39 @@ async function M(m) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
const Z = () => {
|
|
71
|
-
const m =
|
|
71
|
+
const m = z(), u = _(), a = v(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = R(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
72
72
|
return {
|
|
73
73
|
prepareTemplateDetails: async () => {
|
|
74
74
|
let { html: r, css: l, syncModulesIds: g = [] } = await t();
|
|
75
75
|
if (e("linkTrackingIds"))
|
|
76
76
|
try {
|
|
77
|
-
const { html: y, changed:
|
|
78
|
-
u.trackIdSessionFloor =
|
|
77
|
+
const { html: y, changed: I, nextSeq: k } = O(r, u.trackIdSessionFloor);
|
|
78
|
+
u.trackIdSessionFloor = k, I && (r = y, await i(y, l));
|
|
79
79
|
} catch (y) {
|
|
80
80
|
console.error("Tracking-id step failed, saving anyway:", y);
|
|
81
81
|
}
|
|
82
|
-
const { html: f, ampHtml: c = "", ampErrors:
|
|
82
|
+
const { html: f, ampHtml: c = "", ampErrors: w = [] } = await n({
|
|
83
83
|
minimize: !0,
|
|
84
84
|
resetDataSavedFlag: !1
|
|
85
85
|
});
|
|
86
|
-
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await
|
|
87
|
-
const { compiledHtml:
|
|
86
|
+
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await C(r);
|
|
87
|
+
const { compiledHtml: D, stats: S, appliedRules: E } = o(f), P = c && p(c).compiledHtml, F = m.getSelectedDynamicContentList, H = T(), b = M(r);
|
|
88
88
|
return console.debug("HTML Compilation Stats:", {
|
|
89
89
|
originalSize: S.originalSize,
|
|
90
90
|
compiledSize: S.compiledSize,
|
|
91
91
|
reduction: `${S.reductionPercentage.toFixed(2)}%`,
|
|
92
|
-
appliedRules:
|
|
92
|
+
appliedRules: E,
|
|
93
93
|
executionTime: `${S.executionTime.toFixed(2)}ms`
|
|
94
94
|
}), {
|
|
95
|
-
dynamicContentList:
|
|
96
|
-
compiledHtml:
|
|
95
|
+
dynamicContentList: F,
|
|
96
|
+
compiledHtml: D,
|
|
97
97
|
rawHtml: r,
|
|
98
98
|
css: l,
|
|
99
|
-
ampHtml:
|
|
100
|
-
ampErrors:
|
|
99
|
+
ampHtml: P,
|
|
100
|
+
ampErrors: w,
|
|
101
101
|
modules: g.map(Number),
|
|
102
102
|
recommendation: {
|
|
103
|
-
campaignUrls:
|
|
103
|
+
campaignUrls: H.recommendationCampaignUrls,
|
|
104
104
|
configs: {}
|
|
105
105
|
},
|
|
106
106
|
unsubscribe: {
|
|
@@ -108,10 +108,13 @@ const Z = () => {
|
|
|
108
108
|
config: b
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
}
|
|
111
|
+
},
|
|
112
|
+
// Exposed so the back/test validate-only path can seed the reco store the
|
|
113
|
+
// same way a full save does (required-field findings depend on it).
|
|
114
|
+
hydrateRecommendationStore: C
|
|
112
115
|
};
|
|
113
116
|
};
|
|
114
117
|
export {
|
|
115
|
-
|
|
118
|
+
M as getHtmlReferencedUnsubscribePages,
|
|
116
119
|
Z as useTemplatePreparation
|
|
117
120
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.16.0-beta.
|
|
3
|
+
"version": "3.16.0-beta.1fe8cea",
|
|
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",
|