@useinsider/guido 3.2.0-beta.4345b1b → 3.2.0-beta.44889a0
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/useFullStoryBridge.js +14 -0
- package/dist/composables/useStripo.js +44 -42
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +33 -30
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/package.json +3 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const c = "https://email-static.useinsider.com/guido/guido-fs.js", u = () => ({ injectFullStory: () => {
|
|
2
|
+
var n;
|
|
3
|
+
const s = window;
|
|
4
|
+
if (typeof s._fs_org != "string" || !s._fs_org)
|
|
5
|
+
return;
|
|
6
|
+
const r = document.querySelector("ui-editor"), o = (n = r == null ? void 0 : r.shadowRoot) == null ? void 0 : n.querySelector("iframe"), e = o == null ? void 0 : o.contentDocument;
|
|
7
|
+
if (!e || e.querySelector('script[data-fullstory-bridge="true"]'))
|
|
8
|
+
return;
|
|
9
|
+
const t = e.createElement("script");
|
|
10
|
+
t.src = c, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", e.head.appendChild(t);
|
|
11
|
+
} });
|
|
12
|
+
export {
|
|
13
|
+
u as useFullStoryBridge
|
|
14
|
+
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
1
|
+
import { useActionsApi as D } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as I } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as P } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
|
+
import { useToaster as x } from "./useToaster.js";
|
|
8
|
+
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
|
+
import { displayConditions as O } from "../enums/displayConditions.js";
|
|
10
|
+
import { useStripoApi as j } from "../services/stripoApi.js";
|
|
11
|
+
import L from "../static/styles/customEditorStyle.css.js";
|
|
11
12
|
import { useEditorStore as C } from "../stores/editor.js";
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const { features:
|
|
16
|
-
var g,
|
|
17
|
-
const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await
|
|
13
|
+
import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
|
|
14
|
+
import z from "../package.json.js";
|
|
15
|
+
const ae = (E, l) => {
|
|
16
|
+
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
17
|
+
var g, S, y;
|
|
18
|
+
const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
19
|
window.UIEditor.initEditor(
|
|
19
20
|
document.querySelector("#guido-editor"),
|
|
20
21
|
{
|
|
21
22
|
metadata: E,
|
|
22
23
|
html: p,
|
|
23
24
|
css: a,
|
|
24
|
-
forceRecreate:
|
|
25
|
+
forceRecreate: v,
|
|
25
26
|
locale: "en",
|
|
26
27
|
undoButtonSelector: "#guido__undo-button",
|
|
27
28
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -31,45 +32,46 @@ const ie = (E, c) => {
|
|
|
31
32
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
32
33
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
34
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
35
|
+
customViewStyles: L,
|
|
35
36
|
conditionsEnabled: f,
|
|
36
37
|
customConditionsEnabled: f,
|
|
37
|
-
conditionCategories:
|
|
38
|
+
conditionCategories: O,
|
|
38
39
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
40
|
-
syncModulesEnabled:
|
|
40
|
+
modulesDisabled: F,
|
|
41
|
+
syncModulesEnabled: s,
|
|
41
42
|
messageSettingsEnabled: !0,
|
|
42
43
|
displayGmailAnnotations: !0,
|
|
43
44
|
displayHiddenPreheader: !1,
|
|
44
45
|
displayTitle: !1,
|
|
45
46
|
displayUTM: !1,
|
|
46
47
|
selectElementAfterDrop: !0,
|
|
48
|
+
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
47
49
|
...o ? { baseBlocks: o } : {},
|
|
48
50
|
editorFonts: {
|
|
49
51
|
showDefaultStandardFonts: !0,
|
|
50
52
|
showDefaultNotStandardFonts: !0,
|
|
51
|
-
customFonts:
|
|
53
|
+
customFonts: r
|
|
52
54
|
},
|
|
53
55
|
mergeTags: [
|
|
54
56
|
{
|
|
55
|
-
entries:
|
|
56
|
-
|
|
57
|
+
entries: $(
|
|
58
|
+
l.preselectedDynamicContentList,
|
|
57
59
|
u("liquidSyntax")
|
|
58
60
|
)
|
|
59
61
|
}
|
|
60
62
|
],
|
|
61
63
|
async onTokenRefreshRequest(t) {
|
|
62
64
|
try {
|
|
63
|
-
const
|
|
64
|
-
t(
|
|
65
|
-
} catch (
|
|
66
|
-
m(
|
|
65
|
+
const n = await w();
|
|
66
|
+
t(n);
|
|
67
|
+
} catch (n) {
|
|
68
|
+
m(n, "Failed to refresh token");
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
onTemplateLoaded() {
|
|
70
72
|
try {
|
|
71
|
-
const { importCss: t } =
|
|
72
|
-
t(),
|
|
73
|
+
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
|
|
74
|
+
t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
73
75
|
e.hasChanges = !1;
|
|
74
76
|
}, 1e3);
|
|
75
77
|
} catch (t) {
|
|
@@ -88,39 +90,39 @@ const ie = (E, c) => {
|
|
|
88
90
|
onDataChanged() {
|
|
89
91
|
e.hasChanges = !0;
|
|
90
92
|
},
|
|
91
|
-
onEvent:
|
|
93
|
+
onEvent: B,
|
|
92
94
|
ignoreClickOutsideSelectors: [
|
|
93
95
|
"#guido-dynamic-content-modal",
|
|
94
96
|
".in-on-board-wrapper",
|
|
95
97
|
".in-drawer__container"
|
|
96
98
|
],
|
|
97
99
|
extensions: d,
|
|
98
|
-
localePatch:
|
|
100
|
+
localePatch: H
|
|
99
101
|
}
|
|
100
102
|
);
|
|
101
|
-
},
|
|
103
|
+
}, _ = (i) => new Promise((r, s) => {
|
|
102
104
|
var d;
|
|
103
105
|
if (document.getElementById("UiEditorScript")) {
|
|
104
|
-
i(),
|
|
106
|
+
i(), r();
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
|
-
const e =
|
|
109
|
+
const e = z.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
108
110
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
109
|
-
i(),
|
|
111
|
+
i(), r();
|
|
110
112
|
}, o.onerror = () => {
|
|
111
|
-
|
|
113
|
+
s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
112
114
|
}, document.body.appendChild(o);
|
|
113
115
|
});
|
|
114
116
|
return { initPlugin: async (i) => {
|
|
115
|
-
await
|
|
116
|
-
const
|
|
117
|
-
|
|
117
|
+
await _(async () => {
|
|
118
|
+
const r = C(), [s, e] = await Promise.all([
|
|
119
|
+
b(),
|
|
118
120
|
k()
|
|
119
121
|
]);
|
|
120
|
-
|
|
122
|
+
r.syncModulesEnabled = e, await V(i, s, e);
|
|
121
123
|
});
|
|
122
124
|
} };
|
|
123
125
|
};
|
|
124
126
|
export {
|
|
125
|
-
|
|
127
|
+
ae as useStripo
|
|
126
128
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
1
|
+
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as y, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as h } from "../../enums/recommendation.js";
|
|
3
3
|
import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
|
|
4
4
|
const w = [
|
|
5
5
|
{
|
|
@@ -8,7 +8,7 @@ const w = [
|
|
|
8
8
|
type: "custom",
|
|
9
9
|
processor: (c) => {
|
|
10
10
|
let e = c;
|
|
11
|
-
return Object.entries(
|
|
11
|
+
return Object.entries(y).forEach(([, l]) => {
|
|
12
12
|
Object.entries(l).forEach(([n, s]) => {
|
|
13
13
|
e = e.replaceAll(s, `{{${n}}}`);
|
|
14
14
|
});
|
|
@@ -30,13 +30,13 @@ const w = [
|
|
|
30
30
|
description: "Adding recommendation unresponsive css",
|
|
31
31
|
type: "custom",
|
|
32
32
|
processor: (c) => {
|
|
33
|
-
const { calculateCardWidth: e, getRecommendationCampaignData: l } =
|
|
33
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: l } = N();
|
|
34
34
|
let n = c;
|
|
35
35
|
const s = n.match(T.ID);
|
|
36
36
|
if (s) {
|
|
37
37
|
const a = [];
|
|
38
38
|
if (s.forEach((i) => {
|
|
39
|
-
const
|
|
39
|
+
const u = /recommendation-id="(.*?)"/i.exec(i), _ = u ? u[1].trim() : "", R = l(_);
|
|
40
40
|
R.textTrimming && R.orientation === M && a.push(e(R));
|
|
41
41
|
}), a.length) {
|
|
42
42
|
const i = `width:${Math.min(...a)}px!important;`;
|
|
@@ -60,25 +60,25 @@ const w = [
|
|
|
60
60
|
type: "custom",
|
|
61
61
|
processor: (c) => {
|
|
62
62
|
let e = c;
|
|
63
|
-
const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } =
|
|
63
|
+
const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = N();
|
|
64
64
|
return l !== null && l.forEach((s) => {
|
|
65
65
|
const a = s.match(T.CUSTOM_FIELD);
|
|
66
66
|
if (!a)
|
|
67
67
|
return;
|
|
68
|
-
const [i] = a,
|
|
69
|
-
if (!
|
|
68
|
+
const [i] = a, u = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
69
|
+
if (!u || !_ || !R)
|
|
70
70
|
return;
|
|
71
|
-
const [S] =
|
|
71
|
+
const [S] = u, [b] = _, [d] = R, o = b.substring(1, b.length - 2), r = d.match(T.COMPOSITION) !== null;
|
|
72
72
|
let t = i;
|
|
73
73
|
if (r) {
|
|
74
|
-
const I = S.substring(2, S.length - 3),
|
|
75
|
-
o === A.OMNIBUS_PRICE && (
|
|
74
|
+
const I = S.substring(2, S.length - 3), m = n(I);
|
|
75
|
+
o === A.OMNIBUS_PRICE && (m.priceBeforeTextValue && (t = `${m.priceBeforeTextValue}${t}`), m.priceAfterTextValue && (t = `${t}${m.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (m.discountBeforeTextValue && (t = `${m.discountBeforeTextValue}${t}`), m.discountAfterTextValue && (t = `${t}${m.discountAfterTextValue}`));
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const p = S.substring(2);
|
|
78
78
|
let f = "";
|
|
79
|
-
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${
|
|
80
|
-
const $ = `${
|
|
81
|
-
e = e.replace(s,
|
|
79
|
+
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${p}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${p}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${p}${A.OMNIBUS_PRICE}`));
|
|
80
|
+
const $ = `${d}${t}${h.PARAGRAPH_END_TAG}`, C = `${f}${r ? $ : s}${g.ELSE}${d}${h.PARAGRAPH_END_TAG}${g.END_IF}`;
|
|
81
|
+
e = e.replace(s, C);
|
|
82
82
|
}), e;
|
|
83
83
|
},
|
|
84
84
|
priority: 53
|
|
@@ -136,7 +136,7 @@ const w = [
|
|
|
136
136
|
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
137
137
|
(l, n) => {
|
|
138
138
|
const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
139
|
-
return s.every((
|
|
139
|
+
return s.every((u) => a.test(u)) ? "" : l;
|
|
140
140
|
}
|
|
141
141
|
)), e;
|
|
142
142
|
},
|
|
@@ -151,7 +151,7 @@ const w = [
|
|
|
151
151
|
/<a\b[^>]*\bes-button\b[^>]*>/g,
|
|
152
152
|
(o) => o.replace(
|
|
153
153
|
/([;"]color:)([^;"]+)/g,
|
|
154
|
-
(r, t,
|
|
154
|
+
(r, t, p) => p.includes("!important") ? r : `${t}${p} !important`
|
|
155
155
|
)
|
|
156
156
|
), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
|
|
157
157
|
let a = l.exec(e);
|
|
@@ -163,12 +163,12 @@ const w = [
|
|
|
163
163
|
}
|
|
164
164
|
n.lastIndex = 0, a = l.exec(e);
|
|
165
165
|
}
|
|
166
|
-
const i = /* @__PURE__ */ new Map(),
|
|
166
|
+
const i = /* @__PURE__ */ new Map(), u = [];
|
|
167
167
|
let _ = 0;
|
|
168
168
|
if (s.forEach((o, r) => {
|
|
169
169
|
if (o >= 6) {
|
|
170
|
-
const t = `rc${_++}
|
|
171
|
-
i.set(r, t),
|
|
170
|
+
const t = `rc${_++}`, p = r.endsWith(";") ? r : `${r};`;
|
|
171
|
+
i.set(r, t), u.push(`.${t}{${p}}`);
|
|
172
172
|
}
|
|
173
173
|
}), i.size === 0) {
|
|
174
174
|
let o = e;
|
|
@@ -182,23 +182,23 @@ const w = [
|
|
|
182
182
|
caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
|
-
let
|
|
186
|
-
return
|
|
185
|
+
let d = e.replace("</style>", `${u.join("")}</style>`);
|
|
186
|
+
return d = d.replace(
|
|
187
187
|
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
188
188
|
(o, r) => {
|
|
189
189
|
let t = r;
|
|
190
|
-
return i.forEach((
|
|
190
|
+
return i.forEach((p, f) => {
|
|
191
191
|
const $ = b.get(f);
|
|
192
192
|
t = t.replace(
|
|
193
193
|
$.caseA,
|
|
194
|
-
(
|
|
194
|
+
(C, I, m) => S(I, p) + m
|
|
195
195
|
), t = t.replace(
|
|
196
196
|
$.caseB,
|
|
197
|
-
(
|
|
198
|
-
), t = t.replaceAll(` style="${f}"`, ` class="${
|
|
197
|
+
(C, I, m) => I + S(m, p)
|
|
198
|
+
), t = t.replaceAll(` style="${f}"`, ` class="${p}"`);
|
|
199
199
|
}), t;
|
|
200
200
|
}
|
|
201
|
-
),
|
|
201
|
+
), d = d.replaceAll("<!--REC_START-->", ""), d = d.replaceAll("<!--REC_END-->", ""), d;
|
|
202
202
|
},
|
|
203
203
|
priority: 58
|
|
204
204
|
}
|
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as p, LINK_TYPES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import { useDynamicContentStore as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
|
|
1
|
+
import { usePartner as U } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as p, PRODUCT_TYPE_URL_SEGMENTS as R, LINK_TYPES as _, INSIDER_ID as m, URLS as y } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as N } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as C } from "../../stores/config.js";
|
|
5
|
+
import { useDynamicContentStore as L } from "../../stores/dynamic-content.js";
|
|
6
|
+
import { useUnsubscribeStore as P } from "../../stores/unsubscribe.js";
|
|
7
|
+
import { ProductType as B } from "../../@types/config/schemas.js";
|
|
8
|
+
import "../../@types/config/defaults.js";
|
|
9
|
+
const F = [
|
|
8
10
|
{
|
|
9
11
|
id: "add-unsubscribe-link-values",
|
|
10
12
|
description: "Adding unsubscribe link values",
|
|
11
13
|
type: "custom",
|
|
12
|
-
processor: (
|
|
13
|
-
const { getPartnerName: i } =
|
|
14
|
-
if (!
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
processor: (s) => {
|
|
15
|
+
const { getPartnerName: i } = U(), n = C(), t = L(), E = P(), c = n.variationId;
|
|
16
|
+
if (!c)
|
|
17
|
+
return s;
|
|
18
|
+
const r = R[n.productType] ?? R[B.EMAIL];
|
|
19
|
+
let e = s;
|
|
20
|
+
const d = `/${i()}/${r}/${c}?user={{iid}}`, f = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
|
|
21
|
+
let a = !1, l = !1;
|
|
22
|
+
return f.forEach((g) => {
|
|
23
|
+
var S;
|
|
24
|
+
const u = g.getAttribute("data-unsubscribe-page-list");
|
|
22
25
|
if (!u)
|
|
23
26
|
return;
|
|
24
|
-
const
|
|
25
|
-
(
|
|
27
|
+
const I = N(u), b = ((S = E.templates) == null ? void 0 : S.filter(
|
|
28
|
+
(o) => I.includes(o.id)
|
|
26
29
|
)) ?? [];
|
|
27
|
-
|
|
28
|
-
}), (
|
|
30
|
+
a = a || b.some((o) => o.type === _.UNSUBSCRIBE_LINK_TYPE), l = l || b.some((o) => o.type === _.PREFERENCES_LINK_TYPE);
|
|
31
|
+
}), (a || l) && (t.selectedDynamicContentList.some((u) => u.value === m) || t.selectedDynamicContentList.push({
|
|
29
32
|
text: m,
|
|
30
33
|
value: m,
|
|
31
34
|
fallback: ""
|
|
32
|
-
})),
|
|
35
|
+
})), a && (e = e.replace(
|
|
33
36
|
p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
34
|
-
|
|
37
|
+
y.UNSUBSCRIBE_URL + d
|
|
35
38
|
)), l && (e = e.replace(
|
|
36
39
|
p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
37
|
-
|
|
38
|
-
)),
|
|
40
|
+
y.PREFERENCES_URL + d
|
|
41
|
+
)), f.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
|
|
39
42
|
},
|
|
40
43
|
priority: 60
|
|
41
44
|
},
|
|
@@ -52,25 +55,25 @@ const G = [
|
|
|
52
55
|
id: "format-comment-braces",
|
|
53
56
|
description: "Adding spaces around comment braces for proper formatting",
|
|
54
57
|
type: "custom",
|
|
55
|
-
processor: (
|
|
58
|
+
processor: (s) => s.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
56
59
|
priority: 62
|
|
57
60
|
},
|
|
58
61
|
{
|
|
59
62
|
id: "add-universal-link-flags",
|
|
60
63
|
description: "Adding universal link flags",
|
|
61
64
|
type: "custom",
|
|
62
|
-
processor: (
|
|
63
|
-
let i =
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
if (
|
|
65
|
+
processor: (s) => {
|
|
66
|
+
let i = s;
|
|
67
|
+
const n = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
68
|
+
return n && n.forEach((t) => {
|
|
69
|
+
if (t.includes("insEmail=1"))
|
|
67
70
|
return;
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
return
|
|
71
|
+
if (t.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
72
|
+
const c = t.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
|
|
73
|
+
const e = r.slice(6, r.length - 1).trim();
|
|
74
|
+
return r.includes("?") || r.includes("#") ? e.slice(-1) === "&" ? r.replace(e, `${e}insEmail=1`) : r.replace(e, `${e}&insEmail=1`) : r.replace(e, `${e}?insEmail=1`);
|
|
72
75
|
});
|
|
73
|
-
i = i.replace(
|
|
76
|
+
i = i.replace(t, c);
|
|
74
77
|
}
|
|
75
78
|
}), i;
|
|
76
79
|
},
|
|
@@ -78,5 +81,5 @@ const G = [
|
|
|
78
81
|
}
|
|
79
82
|
];
|
|
80
83
|
export {
|
|
81
|
-
|
|
84
|
+
F as unsubscribeCompilerRules
|
|
82
85
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useConfig as S } from "../../../composables/useConfig.js";
|
|
2
2
|
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { useRecommendationExtensionStore as d } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
3
4
|
function y(e, u, r, o, s = "") {
|
|
4
5
|
const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
|
|
5
6
|
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function m(e, u, r, o, s, n) {
|
|
8
9
|
switch (u) {
|
|
9
10
|
case "productImage": {
|
|
10
11
|
const t = e.querySelector("img");
|
|
@@ -69,67 +70,69 @@ function p(e, u, r, o, s, n) {
|
|
|
69
70
|
default: {
|
|
70
71
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
71
72
|
if (t) {
|
|
72
|
-
const c = t.getAttribute("product-attr"),
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
73
|
+
const c = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
74
|
+
if (a) {
|
|
75
|
+
const i = a.querySelector("strong") || a;
|
|
76
|
+
i.textContent = `{{${n}${r}_${o}_${c}}}`;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
break;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function q(e, u, r, o) {
|
|
83
84
|
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
84
|
-
n.querySelectorAll("[data-attribute-type]").forEach((
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
p
|
|
88
|
-
}) :
|
|
85
|
+
n.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
86
|
+
const i = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
|
|
87
|
+
l.length > 0 ? l.forEach((p) => {
|
|
88
|
+
m(p, i, u, t, r, o);
|
|
89
|
+
}) : m(a, i, u, t, r, o);
|
|
89
90
|
});
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function g(e, u, r, o) {
|
|
93
94
|
const s = e.querySelectorAll(".recommendation-product-row");
|
|
94
95
|
if (!s.length)
|
|
95
96
|
return;
|
|
96
97
|
const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
97
|
-
s.forEach((
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const A =
|
|
102
|
-
|
|
98
|
+
s.forEach((a, i) => {
|
|
99
|
+
a.querySelectorAll("[data-attribute-type]").forEach((p) => {
|
|
100
|
+
const b = p.getAttribute("data-attribute-type") || "";
|
|
101
|
+
p.querySelectorAll(".attribute-cell").forEach((f, $) => {
|
|
102
|
+
const A = i * c + $;
|
|
103
|
+
m(f, b, u, A, r, o);
|
|
103
104
|
});
|
|
104
105
|
});
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function h(e, u, r, o) {
|
|
108
109
|
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
109
|
-
|
|
110
|
+
g(n, u, r, o);
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function C(e, u, r) {
|
|
113
114
|
const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
|
|
114
|
-
o === "list" ?
|
|
115
|
+
o === "list" ? q(e, u, s, r) : h(e, u, s, r);
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function E(e, u) {
|
|
117
118
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
118
119
|
return (r ? `${r[0]}
|
|
119
120
|
` : "") + u.documentElement.outerHTML;
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
+
function T(e) {
|
|
122
123
|
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
123
124
|
if (!o.length)
|
|
124
125
|
return e;
|
|
125
|
-
const { buildCampaignUrl: s } = _(),
|
|
126
|
+
const { buildCampaignUrl: s } = _(), n = d();
|
|
127
|
+
n.recommendationCampaignUrls = {};
|
|
128
|
+
const { isFeatureEnabled: t } = S(), c = t("liquidSyntax") ? "reco_" : "";
|
|
126
129
|
return o.forEach((i) => {
|
|
127
|
-
var
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
}),
|
|
130
|
+
var p, b;
|
|
131
|
+
const l = i.getAttribute("recommendation-id");
|
|
132
|
+
l && ((p = i.parentNode) == null || p.insertBefore(r.createComment("REC_START"), i), (b = i.parentNode) == null || b.insertBefore(r.createComment("REC_END"), i.nextSibling), s(l), C(i, l, c));
|
|
133
|
+
}), E(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
131
134
|
}
|
|
132
135
|
export {
|
|
133
136
|
y as formatPriceVariable,
|
|
134
|
-
|
|
137
|
+
T as prepareRecommendationBlocks
|
|
135
138
|
};
|
|
@@ -13,7 +13,7 @@ class B {
|
|
|
13
13
|
migrate(e) {
|
|
14
14
|
try {
|
|
15
15
|
const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
|
|
16
|
-
'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
|
|
16
|
+
'td.ins-recommendation-v3-block-1:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"]:not(.recommendation-block-v2)'
|
|
17
17
|
);
|
|
18
18
|
return w().$patch((i) => {
|
|
19
19
|
i.migrations = { ...i.migrations, [S]: s.length };
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { useTranslations as R } from "../composables/useTranslations.js";
|
|
2
|
+
import { ProductType as s } from "../@types/config/schemas.js";
|
|
3
|
+
import "../@types/config/defaults.js";
|
|
4
|
+
import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
|
|
5
|
+
const B = {
|
|
4
6
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
7
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
8
|
+
}, i = {
|
|
7
9
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
10
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
11
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
12
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
}, n =
|
|
13
|
+
}, n = S(), C = {
|
|
12
14
|
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
13
15
|
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
14
|
-
},
|
|
16
|
+
}, U = {
|
|
17
|
+
[s.EMAIL]: "email",
|
|
18
|
+
[s.ARCHITECT]: "journey",
|
|
19
|
+
[s.UNSUBSCRIBE_PAGES]: "email"
|
|
20
|
+
}, t = "iid", o = {
|
|
15
21
|
name: "Global Unsubscribe",
|
|
16
22
|
sendGridId: "G"
|
|
17
|
-
},
|
|
23
|
+
}, c = "/email/unsubscribe-pages", E = {
|
|
18
24
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
19
25
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
20
26
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
27
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
28
|
RESUBSCRIBE: 5
|
|
23
|
-
},
|
|
29
|
+
}, u = {
|
|
24
30
|
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
31
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
26
|
-
},
|
|
32
|
+
}, T = {
|
|
27
33
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
28
34
|
E.GLOBAL_UNSUBSCRIBE,
|
|
29
35
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -33,30 +39,31 @@ const _ = {
|
|
|
33
39
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
34
40
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
35
41
|
]
|
|
36
|
-
},
|
|
37
|
-
const
|
|
42
|
+
}, b = () => {
|
|
43
|
+
const e = R();
|
|
38
44
|
return {
|
|
39
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
40
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
41
|
-
[E.RESUBSCRIBE]:
|
|
42
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
43
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
45
|
+
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
46
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
47
|
+
[E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
|
|
48
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
49
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
44
50
|
};
|
|
45
|
-
},
|
|
51
|
+
}, P = {
|
|
46
52
|
default: "{{ins-unsubscribe-link}}",
|
|
47
53
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
48
54
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
49
55
|
};
|
|
50
56
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
o as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
58
|
+
t as INSIDER_ID,
|
|
59
|
+
i as LINK_REGEXES,
|
|
60
|
+
B as LINK_TYPES,
|
|
61
|
+
P as MERGE_TAGS,
|
|
56
62
|
E as PAGE_TYPES,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
U as PRODUCT_TYPE_URL_SEGMENTS,
|
|
64
|
+
T as TYPE_COLLECTIONS,
|
|
65
|
+
c as UNSUBSCRIBE_PAGES_LINK,
|
|
66
|
+
u as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
67
|
+
C as URLS,
|
|
68
|
+
b as getTypeTranslations
|
|
62
69
|
};
|