@useinsider/guido 3.6.0-beta.59a5e5f → 3.6.0-beta.6807430
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/composables/useActionsApi.js +16 -15
- package/dist/composables/useHtmlCompiler.js +40 -22
- package/dist/composables/useStripoEventHandler.js +15 -20
- package/dist/enums/toaster.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +16 -35
- package/dist/src/composables/useHtmlCompiler.d.ts +1 -0
- package/dist/src/enums/toaster.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -13
- package/dist/src/utils/ampErrorFilter.d.ts +2 -0
- package/dist/utils/ampErrorFilter.js +8 -0
- package/dist/utils/templatePreparation.js +53 -53
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +0 -16
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +0 -9
- package/dist/src/extensions/Blocks/Recommendation/useRecommendationBlockWarning.d.ts +0 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +0 -28
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +0 -1
- /package/dist/src/{extensions/Blocks/Recommendation/block.test.d.ts → utils/ampErrorFilter.test.d.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { filterAmpErrors as w } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { useToaster as A } from "./useToaster.js";
|
|
3
|
+
const D = () => {
|
|
4
|
+
const { handleError: n } = A(), s = (t = {}) => new Promise((e, a) => {
|
|
4
5
|
const o = { ...{
|
|
5
6
|
minimize: !0,
|
|
6
7
|
utmEntity: {
|
|
@@ -20,29 +21,29 @@ const v = () => {
|
|
|
20
21
|
forceAmp: !1,
|
|
21
22
|
resetDataSavedFlag: !1,
|
|
22
23
|
disableLineHeightsReplace: !0
|
|
23
|
-
}, ...t },
|
|
24
|
-
callback: (
|
|
25
|
-
|
|
24
|
+
}, ...t }, l = {
|
|
25
|
+
callback: (r, p, d, c, u) => {
|
|
26
|
+
r ? a(r) : e({
|
|
26
27
|
html: p,
|
|
27
28
|
ampHtml: d,
|
|
28
|
-
ampErrors: c,
|
|
29
|
+
ampErrors: w(c ?? []),
|
|
29
30
|
displayConditions: u
|
|
30
31
|
});
|
|
31
32
|
},
|
|
32
33
|
...o
|
|
33
34
|
};
|
|
34
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
35
|
+
window.StripoEditorApi.actionsApi.compileEmail(l);
|
|
35
36
|
});
|
|
36
37
|
return {
|
|
37
|
-
getCompiledEmail:
|
|
38
|
+
getCompiledEmail: s,
|
|
38
39
|
getTemplateData: () => new Promise((t) => {
|
|
39
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
40
|
+
const e = ({ html: a, css: i, width: o, height: m, utmParams: l, syncModulesIds: r }) => t({
|
|
40
41
|
html: a,
|
|
41
42
|
css: i,
|
|
42
43
|
width: o,
|
|
43
|
-
height:
|
|
44
|
-
utmParams:
|
|
45
|
-
syncModulesIds:
|
|
44
|
+
height: m,
|
|
45
|
+
utmParams: l,
|
|
46
|
+
syncModulesIds: r
|
|
46
47
|
});
|
|
47
48
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
48
49
|
}),
|
|
@@ -56,7 +57,7 @@ const v = () => {
|
|
|
56
57
|
displayConditions: a,
|
|
57
58
|
ampHtml: i = "",
|
|
58
59
|
ampErrors: o = []
|
|
59
|
-
} = await
|
|
60
|
+
} = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
60
61
|
return {
|
|
61
62
|
html: e,
|
|
62
63
|
ampHtml: i,
|
|
@@ -101,5 +102,5 @@ const v = () => {
|
|
|
101
102
|
};
|
|
102
103
|
};
|
|
103
104
|
export {
|
|
104
|
-
|
|
105
|
+
D as useActionsApi
|
|
105
106
|
};
|
|
@@ -1,30 +1,48 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { liquidCompilerRules as
|
|
4
|
-
import { outlookCompilerRules as
|
|
5
|
-
import { recommendationCompilerRules as
|
|
6
|
-
import { socialCompilerRules as
|
|
7
|
-
import { unsubscribeCompilerRules as
|
|
8
|
-
import { createHtmlCompiler as
|
|
9
|
-
import { useConfig as
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
|
|
5
|
+
import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
+
import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { useConfig as k } from "./useConfig.js";
|
|
10
|
+
const y = /* @__PURE__ */ new Set([
|
|
11
|
+
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
12
|
+
"fix-url-encoding-start",
|
|
13
|
+
"fix-url-encoding-end",
|
|
14
|
+
"fix-tags-start",
|
|
15
|
+
"fix-tags-end",
|
|
16
|
+
// Image domain corrections — plain string replacement.
|
|
17
|
+
"replace-old-image-domain",
|
|
18
|
+
"replace-old-v2-image-domain",
|
|
19
|
+
// Unsubscribe domain — the actual fix: injects the real unsubscribe href in
|
|
20
|
+
// place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
|
|
21
|
+
// unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
|
|
22
|
+
"add-unsubscribe-link-values",
|
|
23
|
+
"remove-data-ogsb-button-styles",
|
|
24
|
+
"format-comment-braces",
|
|
25
|
+
"add-universal-link-flags",
|
|
26
|
+
// Coupon placeholder replacement (only present when liquidSyntax is enabled).
|
|
27
|
+
"liquid-coupon-code"
|
|
28
|
+
]), M = () => {
|
|
29
|
+
var m, t, r;
|
|
30
|
+
const { compiler: e, isFeatureEnabled: a, partner: n } = k(), u = ((m = e.value) == null ? void 0 : m.customRules) || [], l = [
|
|
31
|
+
...!!((t = e.value) != null && t.ignoreDefaultRules) ? [] : R,
|
|
32
|
+
...v,
|
|
33
|
+
...x,
|
|
15
34
|
...g,
|
|
16
|
-
...f,
|
|
17
|
-
...C,
|
|
18
35
|
...b,
|
|
19
|
-
...
|
|
20
|
-
...
|
|
36
|
+
...H,
|
|
37
|
+
...a("liquidSyntax") ? C : [],
|
|
38
|
+
...u.map((o, f) => ({
|
|
21
39
|
...o,
|
|
22
|
-
priority: o.priority + 1e3 +
|
|
40
|
+
priority: o.priority + 1e3 + f
|
|
23
41
|
// Ensure additional rules run after default rules
|
|
24
42
|
}))
|
|
25
|
-
], p =
|
|
26
|
-
return { compileHtml: (o) => p.compile(o, void 0,
|
|
43
|
+
], p = s(l), c = l.filter((o) => y.has(o.id)), d = s(c), i = (r = n.value) == null ? void 0 : r.fallbackFont;
|
|
44
|
+
return { compileHtml: (o) => p.compile(o, void 0, i), compileAmpHtml: (o) => d.compile(o, void 0, i) };
|
|
27
45
|
};
|
|
28
46
|
export {
|
|
29
|
-
|
|
47
|
+
M as useHtmlCompiler
|
|
30
48
|
};
|
|
@@ -1,40 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const { updateSyncModule: r, getSyncModule: c } = m(), { warnIfMultipleBlocks: s } = l(), d = b(), a = f(), i = () => {
|
|
8
|
-
var o, t, n;
|
|
9
|
-
const e = (n = (t = (o = document.querySelector("ui-editor")) == null ? void 0 : o.shadowRoot) == null ? void 0 : t.querySelector("iframe")) == null ? void 0 : n.contentDocument;
|
|
10
|
-
e && s(e);
|
|
11
|
-
}, u = {
|
|
1
|
+
import { useStripoApi as i } from "../services/stripoApi.js";
|
|
2
|
+
import { useEditorStore as u } from "../stores/editor.js";
|
|
3
|
+
import { useOnboardingStore as l } from "../stores/onboarding.js";
|
|
4
|
+
import { useUnsubscribeStore as b } from "../stores/unsubscribe.js";
|
|
5
|
+
const v = () => {
|
|
6
|
+
const { updateSyncModule: d, getSyncModule: r } = i(), n = u(), s = b(), a = {
|
|
12
7
|
block_dropped: ({ blockName: e }) => {
|
|
13
8
|
if (e === "BLOCK_TEXT") {
|
|
14
|
-
const o =
|
|
15
|
-
if (t ||
|
|
9
|
+
const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
|
|
10
|
+
if (t || c)
|
|
16
11
|
return;
|
|
17
12
|
o.start("textBlockOnboarding");
|
|
18
13
|
}
|
|
19
14
|
},
|
|
20
15
|
module_saved: async (e) => {
|
|
21
|
-
|
|
16
|
+
n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
|
|
22
17
|
},
|
|
23
18
|
module_dropped: async (e) => {
|
|
24
|
-
if (
|
|
19
|
+
if (!n.syncModulesEnabled)
|
|
25
20
|
return;
|
|
26
|
-
const { moduleId: o } = e, t = await
|
|
27
|
-
console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await
|
|
21
|
+
const { moduleId: o } = e, t = await r(o);
|
|
22
|
+
console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
|
|
28
23
|
},
|
|
29
24
|
module_updated: async (e) => {
|
|
30
|
-
|
|
25
|
+
n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
|
|
31
26
|
}
|
|
32
27
|
};
|
|
33
28
|
return { handleEvent: async (e, o) => {
|
|
34
|
-
const t =
|
|
29
|
+
const t = a[e];
|
|
35
30
|
console.debug("Stripo Event: ", e, o), t && await t(o);
|
|
36
31
|
} };
|
|
37
32
|
};
|
|
38
33
|
export {
|
|
39
|
-
|
|
34
|
+
v as useStripoEventHandler
|
|
40
35
|
};
|
package/dist/enums/toaster.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r
|
|
1
|
+
var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r))(c || {});
|
|
2
2
|
export {
|
|
3
3
|
c as ToasterTypeOptions
|
|
4
4
|
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
var k = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var d = (a, r, t) =>
|
|
4
|
-
import { BlockId as
|
|
5
|
-
import { getMigrationBannerHtml as
|
|
6
|
-
import { Block as
|
|
2
|
+
var y = (a, r, t) => r in a ? k(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
|
|
3
|
+
var d = (a, r, t) => y(a, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { BlockId as B } from "../../../enums/block.js";
|
|
5
|
+
import { getMigrationBannerHtml as D } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
+
import { Block as R, BlockCompositionType as C, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
7
|
import { regenerateMobileProductRows as b } from "./controls/main/utils.js";
|
|
8
8
|
import { ensureMobileCssRulesExist as p, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
|
|
9
9
|
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
|
|
11
11
|
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class H extends D {
|
|
12
|
+
const _ = B.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
|
|
13
|
+
let I = !1;
|
|
14
|
+
class q extends R {
|
|
16
15
|
constructor() {
|
|
17
16
|
super();
|
|
18
17
|
/**
|
|
@@ -22,7 +21,7 @@ class H extends D {
|
|
|
22
21
|
d(this, "_pendingBlockId", null);
|
|
23
22
|
}
|
|
24
23
|
getId() {
|
|
25
|
-
return
|
|
24
|
+
return _;
|
|
26
25
|
}
|
|
27
26
|
getIcon() {
|
|
28
27
|
return "recommendation-icon";
|
|
@@ -39,8 +38,8 @@ class H extends D {
|
|
|
39
38
|
);
|
|
40
39
|
}
|
|
41
40
|
getSettingsPanelTitleHtml() {
|
|
42
|
-
return
|
|
43
|
-
|
|
41
|
+
return D(
|
|
42
|
+
_,
|
|
44
43
|
this.api.translate("Recommendation Block"),
|
|
45
44
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
|
|
46
45
|
);
|
|
@@ -96,7 +95,7 @@ class H extends D {
|
|
|
96
95
|
documentModifier: this.api.getDocumentModifier()
|
|
97
96
|
}));
|
|
98
97
|
}
|
|
99
|
-
s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 })
|
|
98
|
+
s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
100
99
|
}
|
|
101
100
|
/**
|
|
102
101
|
* Called when the document changes or template is loaded
|
|
@@ -118,7 +117,7 @@ class H extends D {
|
|
|
118
117
|
}
|
|
119
118
|
this._healLingeringDuplicate(t), c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
120
119
|
try {
|
|
121
|
-
|
|
120
|
+
I || (p(this.api), I = !0);
|
|
122
121
|
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
123
122
|
if (i) {
|
|
124
123
|
const n = !e.mobileLayoutEnabled;
|
|
@@ -138,24 +137,6 @@ class H extends D {
|
|
|
138
137
|
const e = this._getRecommendationId(t);
|
|
139
138
|
e && g().removeBlockState(e);
|
|
140
139
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Warns (dark advisory toaster) when the design holds more than one live
|
|
143
|
-
* recommendation block. Triggered from the user-add paths only (fresh drop
|
|
144
|
-
* and duplicate) — never from document-load/migration, so opening a template
|
|
145
|
-
* that already has multiple blocks does not fire it.
|
|
146
|
-
*
|
|
147
|
-
* Counting lives in `useRecommendationBlockWarning` so the same DOM-based
|
|
148
|
-
* logic (which ignores the empty shells deletions leave behind, SD-143028)
|
|
149
|
-
* is shared with the `module_dropped` handler — recommendation blocks can
|
|
150
|
-
* also arrive inside a saved structure. Wrapped in try/catch because the
|
|
151
|
-
* document root may be unavailable during initial load.
|
|
152
|
-
*/
|
|
153
|
-
_warnIfMultipleBlocks() {
|
|
154
|
-
try {
|
|
155
|
-
M().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
156
|
-
} catch {
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
140
|
/**
|
|
160
141
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
161
142
|
* in the document and finding the maximum existing ID + 1.
|
|
@@ -228,7 +209,7 @@ class H extends D {
|
|
|
228
209
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
229
210
|
_handleDuplicate(t, e) {
|
|
230
211
|
const i = this._reassignDuplicateId(t, e), n = g();
|
|
231
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i)
|
|
212
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i);
|
|
232
213
|
}
|
|
233
214
|
/**
|
|
234
215
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -310,6 +291,6 @@ class H extends D {
|
|
|
310
291
|
}
|
|
311
292
|
}
|
|
312
293
|
export {
|
|
313
|
-
|
|
314
|
-
|
|
294
|
+
_ as BLOCK_ID,
|
|
295
|
+
q as RecommendationBlock
|
|
315
296
|
};
|
|
@@ -55,19 +55,6 @@ export declare class RecommendationBlock extends Block {
|
|
|
55
55
|
* @param node - The block node being deleted
|
|
56
56
|
*/
|
|
57
57
|
onDelete(node: ImmutableHtmlNode): void;
|
|
58
|
-
/**
|
|
59
|
-
* Warns (dark advisory toaster) when the design holds more than one live
|
|
60
|
-
* recommendation block. Triggered from the user-add paths only (fresh drop
|
|
61
|
-
* and duplicate) — never from document-load/migration, so opening a template
|
|
62
|
-
* that already has multiple blocks does not fire it.
|
|
63
|
-
*
|
|
64
|
-
* Counting lives in `useRecommendationBlockWarning` so the same DOM-based
|
|
65
|
-
* logic (which ignores the empty shells deletions leave behind, SD-143028)
|
|
66
|
-
* is shared with the `module_dropped` handler — recommendation blocks can
|
|
67
|
-
* also arrive inside a saved structure. Wrapped in try/catch because the
|
|
68
|
-
* document root may be unavailable during initial load.
|
|
69
|
-
*/
|
|
70
|
-
private _warnIfMultipleBlocks;
|
|
71
58
|
/**
|
|
72
59
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
73
60
|
* in the document and finding the maximum existing ID + 1.
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
1
|
+
import { useActionsApi as D } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as P } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as p, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
5
|
import { DATA_ATTRIBUTES as S } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
-
import { parsePageList as
|
|
7
|
-
import { useDynamicContentStore as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
function
|
|
10
|
-
const t = new DOMParser().parseFromString(
|
|
11
|
-
return t.forEach((
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}),
|
|
6
|
+
import { parsePageList as w } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
7
|
+
import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useUnsubscribeStore as H } from "../stores/unsubscribe.js";
|
|
9
|
+
function U(s, r) {
|
|
10
|
+
const t = new DOMParser().parseFromString(s, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), o = [];
|
|
11
|
+
return t.forEach((a) => {
|
|
12
|
+
const n = a.getAttribute(S.PAGE_LIST);
|
|
13
|
+
n && o.push(...w(n));
|
|
14
|
+
}), r.filter((a) => o.includes(a));
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
17
|
-
const m = new DOMParser().parseFromString(
|
|
16
|
+
async function F(s) {
|
|
17
|
+
const m = new DOMParser().parseFromString(s, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
18
18
|
if (m.length === 0)
|
|
19
19
|
return;
|
|
20
20
|
const l = b();
|
|
21
21
|
m.forEach((t) => {
|
|
22
|
-
var g, f,
|
|
23
|
-
const
|
|
24
|
-
if (!Number.isFinite(
|
|
22
|
+
var u, g, f, d, c;
|
|
23
|
+
const o = t.getAttribute("recommendation-id"), a = o ? Number(o) : NaN;
|
|
24
|
+
if (!Number.isFinite(a))
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const n = t.getAttribute("esd-ext-config");
|
|
27
|
+
if (!n)
|
|
28
28
|
return;
|
|
29
29
|
let e;
|
|
30
30
|
try {
|
|
31
|
-
e = JSON.parse(
|
|
31
|
+
e = JSON.parse(n);
|
|
32
32
|
} catch {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
38
|
-
strategy: e.strategy ??
|
|
39
|
-
language: e.language ??
|
|
40
|
-
size: e.size ??
|
|
37
|
+
const y = {
|
|
38
|
+
strategy: e.strategy ?? i.strategy,
|
|
39
|
+
language: e.language ?? i.language,
|
|
40
|
+
size: e.size ?? i.size,
|
|
41
41
|
// Spread the default arrays so each block gets a fresh reference
|
|
42
42
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
43
|
-
productIds: e.productIds ?? [...
|
|
44
|
-
filters: e.filters ?? [...
|
|
45
|
-
shuffleProducts: e.shuffleProducts ??
|
|
46
|
-
currencyCode: ((
|
|
47
|
-
currencyAlignment: ((
|
|
48
|
-
currencyDecimalCount: ((
|
|
49
|
-
currencyDecimalSeparator: ((
|
|
50
|
-
currencyThousandSeparator: ((
|
|
43
|
+
productIds: e.productIds ?? [...i.productIds],
|
|
44
|
+
filters: e.filters ?? [...i.filters],
|
|
45
|
+
shuffleProducts: e.shuffleProducts ?? i.shuffleProducts,
|
|
46
|
+
currencyCode: ((u = e.currency) == null ? void 0 : u.code) ?? p.code,
|
|
47
|
+
currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? p.alignment,
|
|
48
|
+
currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? p.decimalCount,
|
|
49
|
+
currencyDecimalSeparator: ((d = e.currency) == null ? void 0 : d.decimalSeparator) ?? p.decimalSeparator,
|
|
50
|
+
currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? p.thousandSeparator
|
|
51
51
|
};
|
|
52
|
-
l.seedBlockUrlConfig(
|
|
52
|
+
l.seedBlockUrlConfig(a, y);
|
|
53
53
|
});
|
|
54
54
|
try {
|
|
55
55
|
await l.fetchRecommendationCreateData();
|
|
@@ -60,42 +60,42 @@ async function U(i) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const O = () => {
|
|
64
|
+
const s = E(), r = H(), { getCompiledEmail: m, getTemplateData: l } = D(), { compileHtml: t, compileAmpHtml: o } = P();
|
|
65
65
|
return {
|
|
66
66
|
prepareTemplateDetails: async () => {
|
|
67
|
-
const { html:
|
|
67
|
+
const { html: n, ampHtml: e = "", ampErrors: y = [] } = await m({
|
|
68
68
|
minimize: !0,
|
|
69
69
|
resetDataSavedFlag: !1
|
|
70
|
-
}), { html:
|
|
71
|
-
|
|
72
|
-
const { compiledHtml:
|
|
70
|
+
}), { html: u, css: g, syncModulesIds: f = [] } = await l();
|
|
71
|
+
r.selectedUnsubscribePages.length && await r.fetchTemplates(), await F(u);
|
|
72
|
+
const { compiledHtml: d, stats: c, appliedRules: h } = t(n), A = e && o(e).compiledHtml, C = s.getSelectedDynamicContentList, T = b();
|
|
73
73
|
return console.debug("HTML Compilation Stats:", {
|
|
74
|
-
originalSize:
|
|
75
|
-
compiledSize:
|
|
76
|
-
reduction: `${
|
|
77
|
-
appliedRules:
|
|
78
|
-
executionTime: `${
|
|
74
|
+
originalSize: c.originalSize,
|
|
75
|
+
compiledSize: c.compiledSize,
|
|
76
|
+
reduction: `${c.reductionPercentage.toFixed(2)}%`,
|
|
77
|
+
appliedRules: h,
|
|
78
|
+
executionTime: `${c.executionTime.toFixed(2)}ms`
|
|
79
79
|
}), {
|
|
80
|
-
dynamicContentList:
|
|
81
|
-
compiledHtml:
|
|
82
|
-
rawHtml:
|
|
80
|
+
dynamicContentList: C,
|
|
81
|
+
compiledHtml: d,
|
|
82
|
+
rawHtml: u,
|
|
83
83
|
css: g,
|
|
84
|
-
ampHtml:
|
|
85
|
-
ampErrors:
|
|
84
|
+
ampHtml: A,
|
|
85
|
+
ampErrors: y,
|
|
86
86
|
modules: f.map(Number),
|
|
87
87
|
recommendation: {
|
|
88
|
-
campaignUrls:
|
|
88
|
+
campaignUrls: T.recommendationCampaignUrls,
|
|
89
89
|
configs: {}
|
|
90
90
|
},
|
|
91
91
|
unsubscribe: {
|
|
92
|
-
status:
|
|
93
|
-
config:
|
|
92
|
+
status: r.unsubscribePagesStatus,
|
|
93
|
+
config: U(d, r.selectedUnsubscribePages)
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
O as useTemplatePreparation
|
|
101
101
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.6807430",
|
|
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",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useToaster as r } from "../../../composables/useToaster.js";
|
|
2
|
-
import { useTranslations as s } from "../../../composables/useTranslations.js";
|
|
3
|
-
import { ToasterTypeOptions as n } from "../../../enums/toaster.js";
|
|
4
|
-
import { countLiveRecommendationBlocks as i } from "./utils/recommendationBlockCount.js";
|
|
5
|
-
const a = "newsletter.multiple-reco-blocks-warning", f = () => {
|
|
6
|
-
const { showToaster: o } = r(), t = s();
|
|
7
|
-
return { warnIfMultipleBlocks: (e) => {
|
|
8
|
-
i(e) > 1 && o({
|
|
9
|
-
type: n.Dark,
|
|
10
|
-
message: t(a)
|
|
11
|
-
});
|
|
12
|
-
} };
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
f as useRecommendationBlockWarning
|
|
16
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const r = ".recommendation-block-v2", t = ".recommendation-product-row";
|
|
2
|
-
function n(o) {
|
|
3
|
-
return Array.from(o.querySelectorAll(r)).filter((e) => e.querySelector(t)).length;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
r as RECOMMENDATION_BLOCK_SELECTOR,
|
|
7
|
-
t as RECOMMENDATION_PRODUCT_ROW_SELECTOR,
|
|
8
|
-
n as countLiveRecommendationBlocks
|
|
9
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { QueryableRoot } from './utils/recommendationBlockCount';
|
|
2
|
-
/**
|
|
3
|
-
* Advisory shown when a design ends up with more than one recommendation block,
|
|
4
|
-
* since multiple blocks can slow campaign delivery. Shared by the block
|
|
5
|
-
* lifecycle (direct drop / duplicate, counting the editor's document root) and
|
|
6
|
-
* the `module_dropped` event (counting the live editor iframe DOM, so
|
|
7
|
-
* recommendation blocks that arrive inside a saved structure are also covered).
|
|
8
|
-
*/
|
|
9
|
-
export declare const useRecommendationBlockWarning: () => {
|
|
10
|
-
warnIfMultipleBlocks: (root: QueryableRoot) => void;
|
|
11
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Counts *live* recommendation blocks in a document.
|
|
3
|
-
*
|
|
4
|
-
* Deleting a recommendation block strips its inner content but leaves an empty
|
|
5
|
-
* `.recommendation-block-v2` container shell behind — present in every document
|
|
6
|
-
* representation the editor exposes (`getDocumentRoot`, `getDocumentRootHtmlNode`
|
|
7
|
-
* and even `getTemplateData`). A raw class count therefore over-reports after a
|
|
8
|
-
* delete→add cycle (SD-143028). The product row (`.recommendation-product-row`)
|
|
9
|
-
* is present on every live block from drop time (the default template ships
|
|
10
|
-
* product rows, both grid and list layouts) and is removed from a deleted
|
|
11
|
-
* block's leftover shell, so filtering by it cleanly separates live blocks from
|
|
12
|
-
* ghosts without reading any store.
|
|
13
|
-
*/
|
|
14
|
-
export declare const RECOMMENDATION_BLOCK_SELECTOR = ".recommendation-block-v2";
|
|
15
|
-
export declare const RECOMMENDATION_PRODUCT_ROW_SELECTOR = ".recommendation-product-row";
|
|
16
|
-
interface QueryableNode {
|
|
17
|
-
querySelector(selector: string): unknown;
|
|
18
|
-
}
|
|
19
|
-
export interface QueryableRoot {
|
|
20
|
-
querySelectorAll(selector: string): Iterable<QueryableNode>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Counts the live recommendation blocks reachable from `root`. Works on the
|
|
24
|
-
* editor's `ImmutableHtmlNode` document root (drop / duplicate paths) and on a
|
|
25
|
-
* DOM `Document` parsed from `getTemplateData()` HTML (saved-module drop path).
|
|
26
|
-
*/
|
|
27
|
-
export declare function countLiveRecommendationBlocks(root: QueryableRoot): number;
|
|
28
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|