@useinsider/guido 3.6.0-beta.6807430 → 3.6.0-beta.6c3407e
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 +15 -16
- package/dist/composables/useHtmlCompiler.js +22 -40
- package/dist/enums/toaster.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +35 -16
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +16 -0
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +9 -0
- package/dist/src/composables/useHtmlCompiler.d.ts +0 -1
- package/dist/src/enums/toaster.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/useRecommendationBlockWarning.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +28 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +1 -0
- package/dist/utils/templatePreparation.js +53 -53
- package/package.json +1 -1
- package/dist/src/utils/ampErrorFilter.d.ts +0 -2
- package/dist/utils/ampErrorFilter.js +0 -8
- /package/dist/src/{utils/ampErrorFilter.test.d.ts → extensions/Blocks/Recommendation/block.test.d.ts} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const { handleError: n } = A(), s = (t = {}) => new Promise((e, a) => {
|
|
1
|
+
import { useToaster as w } from "./useToaster.js";
|
|
2
|
+
const v = () => {
|
|
3
|
+
const { handleError: n } = w(), m = (t = {}) => new Promise((e, a) => {
|
|
5
4
|
const o = { ...{
|
|
6
5
|
minimize: !0,
|
|
7
6
|
utmEntity: {
|
|
@@ -21,29 +20,29 @@ const D = () => {
|
|
|
21
20
|
forceAmp: !1,
|
|
22
21
|
resetDataSavedFlag: !1,
|
|
23
22
|
disableLineHeightsReplace: !0
|
|
24
|
-
}, ...t },
|
|
25
|
-
callback: (
|
|
26
|
-
|
|
23
|
+
}, ...t }, s = {
|
|
24
|
+
callback: (l, p, d, c, u) => {
|
|
25
|
+
l ? a(l) : e({
|
|
27
26
|
html: p,
|
|
28
27
|
ampHtml: d,
|
|
29
|
-
ampErrors:
|
|
28
|
+
ampErrors: c,
|
|
30
29
|
displayConditions: u
|
|
31
30
|
});
|
|
32
31
|
},
|
|
33
32
|
...o
|
|
34
33
|
};
|
|
35
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
34
|
+
window.StripoEditorApi.actionsApi.compileEmail(s);
|
|
36
35
|
});
|
|
37
36
|
return {
|
|
38
|
-
getCompiledEmail:
|
|
37
|
+
getCompiledEmail: m,
|
|
39
38
|
getTemplateData: () => new Promise((t) => {
|
|
40
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
39
|
+
const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
|
|
41
40
|
html: a,
|
|
42
41
|
css: i,
|
|
43
42
|
width: o,
|
|
44
|
-
height:
|
|
45
|
-
utmParams:
|
|
46
|
-
syncModulesIds:
|
|
43
|
+
height: r,
|
|
44
|
+
utmParams: s,
|
|
45
|
+
syncModulesIds: l
|
|
47
46
|
});
|
|
48
47
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
49
48
|
}),
|
|
@@ -57,7 +56,7 @@ const D = () => {
|
|
|
57
56
|
displayConditions: a,
|
|
58
57
|
ampHtml: i = "",
|
|
59
58
|
ampErrors: o = []
|
|
60
|
-
} = await
|
|
59
|
+
} = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
61
60
|
return {
|
|
62
61
|
html: e,
|
|
63
62
|
ampHtml: i,
|
|
@@ -102,5 +101,5 @@ const D = () => {
|
|
|
102
101
|
};
|
|
103
102
|
};
|
|
104
103
|
export {
|
|
105
|
-
|
|
104
|
+
v as useActionsApi
|
|
106
105
|
};
|
|
@@ -1,48 +1,30 @@
|
|
|
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
|
-
|
|
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,
|
|
1
|
+
import { defaultHtmlCompilerRules as c } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as R } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
|
|
5
|
+
import { recommendationCompilerRules as d } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
+
import { socialCompilerRules as b } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { useConfig as v } from "./useConfig.js";
|
|
10
|
+
const w = () => {
|
|
11
|
+
var l, m, r;
|
|
12
|
+
const { compiler: e, isFeatureEnabled: t, partner: i } = v(), s = ((l = e.value) == null ? void 0 : l.customRules) || [], u = [
|
|
13
|
+
...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : c,
|
|
14
|
+
...d,
|
|
34
15
|
...g,
|
|
16
|
+
...f,
|
|
17
|
+
...C,
|
|
35
18
|
...b,
|
|
36
|
-
...
|
|
37
|
-
...a
|
|
38
|
-
...u.map((o, f) => ({
|
|
19
|
+
...t("liquidSyntax") ? R : [],
|
|
20
|
+
...s.map((o, a) => ({
|
|
39
21
|
...o,
|
|
40
|
-
priority: o.priority + 1e3 +
|
|
22
|
+
priority: o.priority + 1e3 + a
|
|
41
23
|
// Ensure additional rules run after default rules
|
|
42
24
|
}))
|
|
43
|
-
], p =
|
|
44
|
-
return { compileHtml: (o) => p.compile(o, void 0,
|
|
25
|
+
], p = H(u), n = (r = i.value) == null ? void 0 : r.fallbackFont;
|
|
26
|
+
return { compileHtml: (o) => p.compile(o, void 0, n) };
|
|
45
27
|
};
|
|
46
28
|
export {
|
|
47
|
-
|
|
29
|
+
w as useHtmlCompiler
|
|
48
30
|
};
|
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))(c || {});
|
|
1
|
+
var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r.Dark = "dark", r))(c || {});
|
|
2
2
|
export {
|
|
3
3
|
c as ToasterTypeOptions
|
|
4
4
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
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 B = (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) => B(a, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { BlockId as R } from "../../../enums/block.js";
|
|
5
|
+
import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
+
import { Block as D, 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
|
-
|
|
12
|
+
import { useRecommendationBlockWarning as M } from "./useRecommendationBlockWarning.js";
|
|
13
|
+
const I = R.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
|
|
14
|
+
let _ = !1;
|
|
15
|
+
class H extends D {
|
|
15
16
|
constructor() {
|
|
16
17
|
super();
|
|
17
18
|
/**
|
|
@@ -21,7 +22,7 @@ class q extends R {
|
|
|
21
22
|
d(this, "_pendingBlockId", null);
|
|
22
23
|
}
|
|
23
24
|
getId() {
|
|
24
|
-
return
|
|
25
|
+
return I;
|
|
25
26
|
}
|
|
26
27
|
getIcon() {
|
|
27
28
|
return "recommendation-icon";
|
|
@@ -38,8 +39,8 @@ class q extends R {
|
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
41
|
getSettingsPanelTitleHtml() {
|
|
41
|
-
return
|
|
42
|
-
|
|
42
|
+
return y(
|
|
43
|
+
I,
|
|
43
44
|
this.api.translate("Recommendation Block"),
|
|
44
45
|
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.")
|
|
45
46
|
);
|
|
@@ -95,7 +96,7 @@ class q extends R {
|
|
|
95
96
|
documentModifier: this.api.getDocumentModifier()
|
|
96
97
|
}));
|
|
97
98
|
}
|
|
98
|
-
s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
99
|
+
s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
|
|
99
100
|
}
|
|
100
101
|
/**
|
|
101
102
|
* Called when the document changes or template is loaded
|
|
@@ -117,7 +118,7 @@ class q extends R {
|
|
|
117
118
|
}
|
|
118
119
|
this._healLingeringDuplicate(t), c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
119
120
|
try {
|
|
120
|
-
|
|
121
|
+
_ || (p(this.api), _ = !0);
|
|
121
122
|
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
122
123
|
if (i) {
|
|
123
124
|
const n = !e.mobileLayoutEnabled;
|
|
@@ -137,6 +138,24 @@ class q extends R {
|
|
|
137
138
|
const e = this._getRecommendationId(t);
|
|
138
139
|
e && g().removeBlockState(e);
|
|
139
140
|
}
|
|
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. `onCreated` also runs
|
|
146
|
+
* for a reco block that arrives inside a saved structure (SD-143028), so this
|
|
147
|
+
* covers that case too — no separate `module_dropped` handling is needed.
|
|
148
|
+
*
|
|
149
|
+
* Counting lives in `useRecommendationBlockWarning`, whose DOM-based logic
|
|
150
|
+
* ignores the empty shells deletions leave behind (SD-143028). Wrapped in
|
|
151
|
+
* try/catch because the document root may be unavailable during initial load.
|
|
152
|
+
*/
|
|
153
|
+
_warnIfMultipleBlocks() {
|
|
154
|
+
try {
|
|
155
|
+
M().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
}
|
|
140
159
|
/**
|
|
141
160
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
142
161
|
* in the document and finding the maximum existing ID + 1.
|
|
@@ -209,7 +228,7 @@ class q extends R {
|
|
|
209
228
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
210
229
|
_handleDuplicate(t, e) {
|
|
211
230
|
const i = this._reassignDuplicateId(t, e), n = g();
|
|
212
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i);
|
|
231
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i), this._warnIfMultipleBlocks();
|
|
213
232
|
}
|
|
214
233
|
/**
|
|
215
234
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -291,6 +310,6 @@ class q extends R {
|
|
|
291
310
|
}
|
|
292
311
|
}
|
|
293
312
|
export {
|
|
294
|
-
|
|
295
|
-
|
|
313
|
+
I as BLOCK_ID,
|
|
314
|
+
H as RecommendationBlock
|
|
296
315
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
};
|
|
@@ -55,6 +55,19 @@ 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. `onCreated` also runs
|
|
63
|
+
* for a reco block that arrives inside a saved structure (SD-143028), so this
|
|
64
|
+
* covers that case too — no separate `module_dropped` handling is needed.
|
|
65
|
+
*
|
|
66
|
+
* Counting lives in `useRecommendationBlockWarning`, whose DOM-based logic
|
|
67
|
+
* ignores the empty shells deletions leave behind (SD-143028). Wrapped in
|
|
68
|
+
* try/catch because the document root may be unavailable during initial load.
|
|
69
|
+
*/
|
|
70
|
+
private _warnIfMultipleBlocks;
|
|
58
71
|
/**
|
|
59
72
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
60
73
|
* in the document and finding the maximum existing ID + 1.
|
|
@@ -0,0 +1,12 @@
|
|
|
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. Driven from the block
|
|
5
|
+
* lifecycle (`onCreated` for direct drop / duplicate, counting the editor's
|
|
6
|
+
* document root). `onCreated` also fires for a reco block that arrives inside a
|
|
7
|
+
* saved structure (SD-143028), so that case is covered without a separate
|
|
8
|
+
* `module_dropped` re-check.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useRecommendationBlockWarning: () => {
|
|
11
|
+
warnIfMultipleBlocks: (root: QueryableRoot) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 (the `onCreated` drop / duplicate
|
|
25
|
+
* paths) and on any DOM-like root exposing `querySelectorAll`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function countLiveRecommendationBlocks(root: QueryableRoot): number;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
1
|
+
import { useActionsApi as C } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as T } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } 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 D } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
7
|
+
import { useDynamicContentStore as P } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
|
|
9
|
+
function E(i, o) {
|
|
10
|
+
const t = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), c = [];
|
|
11
|
+
return t.forEach((r) => {
|
|
12
|
+
const a = r.getAttribute(S.PAGE_LIST);
|
|
13
|
+
a && c.push(...D(a));
|
|
14
|
+
}), o.filter((r) => c.includes(r));
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
17
|
-
const m = new DOMParser().parseFromString(
|
|
16
|
+
async function U(i) {
|
|
17
|
+
const m = new DOMParser().parseFromString(i, "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
|
|
23
|
-
const
|
|
24
|
-
if (!Number.isFinite(
|
|
22
|
+
var g, f, u, n, y;
|
|
23
|
+
const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
|
|
24
|
+
if (!Number.isFinite(r))
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const a = t.getAttribute("esd-ext-config");
|
|
27
|
+
if (!a)
|
|
28
28
|
return;
|
|
29
29
|
let e;
|
|
30
30
|
try {
|
|
31
|
-
e = JSON.parse(
|
|
31
|
+
e = JSON.parse(a);
|
|
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 p = {
|
|
38
|
+
strategy: e.strategy ?? s.strategy,
|
|
39
|
+
language: e.language ?? s.language,
|
|
40
|
+
size: e.size ?? s.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 ?? [...s.productIds],
|
|
44
|
+
filters: e.filters ?? [...s.filters],
|
|
45
|
+
shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
|
|
46
|
+
currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
|
|
47
|
+
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
|
|
48
|
+
currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? d.decimalCount,
|
|
49
|
+
currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? d.decimalSeparator,
|
|
50
|
+
currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? d.thousandSeparator
|
|
51
51
|
};
|
|
52
|
-
l.seedBlockUrlConfig(
|
|
52
|
+
l.seedBlockUrlConfig(r, p);
|
|
53
53
|
});
|
|
54
54
|
try {
|
|
55
55
|
await l.fetchRecommendationCreateData();
|
|
@@ -60,42 +60,42 @@ async function F(s) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const _ = () => {
|
|
64
|
+
const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
|
|
65
65
|
return {
|
|
66
66
|
prepareTemplateDetails: async () => {
|
|
67
|
-
const { html:
|
|
67
|
+
const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
|
|
68
68
|
minimize: !0,
|
|
69
69
|
resetDataSavedFlag: !1
|
|
70
|
-
}), { html:
|
|
71
|
-
|
|
72
|
-
const { compiledHtml:
|
|
70
|
+
}), { html: p, css: g, syncModulesIds: f = [] } = await l();
|
|
71
|
+
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await U(p);
|
|
72
|
+
const { compiledHtml: u, stats: n, appliedRules: y } = t(r), h = i.getSelectedDynamicContentList, A = b();
|
|
73
73
|
return console.debug("HTML Compilation Stats:", {
|
|
74
|
-
originalSize:
|
|
75
|
-
compiledSize:
|
|
76
|
-
reduction: `${
|
|
77
|
-
appliedRules:
|
|
78
|
-
executionTime: `${
|
|
74
|
+
originalSize: n.originalSize,
|
|
75
|
+
compiledSize: n.compiledSize,
|
|
76
|
+
reduction: `${n.reductionPercentage.toFixed(2)}%`,
|
|
77
|
+
appliedRules: y,
|
|
78
|
+
executionTime: `${n.executionTime.toFixed(2)}ms`
|
|
79
79
|
}), {
|
|
80
|
-
dynamicContentList:
|
|
81
|
-
compiledHtml:
|
|
82
|
-
rawHtml:
|
|
80
|
+
dynamicContentList: h,
|
|
81
|
+
compiledHtml: u,
|
|
82
|
+
rawHtml: p,
|
|
83
83
|
css: g,
|
|
84
|
-
ampHtml:
|
|
85
|
-
ampErrors:
|
|
84
|
+
ampHtml: a,
|
|
85
|
+
ampErrors: e,
|
|
86
86
|
modules: f.map(Number),
|
|
87
87
|
recommendation: {
|
|
88
|
-
campaignUrls:
|
|
88
|
+
campaignUrls: A.recommendationCampaignUrls,
|
|
89
89
|
configs: {}
|
|
90
90
|
},
|
|
91
91
|
unsubscribe: {
|
|
92
|
-
status:
|
|
93
|
-
config:
|
|
92
|
+
status: o.unsubscribePagesStatus,
|
|
93
|
+
config: E(u, o.selectedUnsubscribePages)
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
_ 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.6c3407e",
|
|
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",
|
|
File without changes
|