@useinsider/guido 2.1.0-beta.42f5dfa → 2.1.0-beta.4bcb91b
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/README.md +3 -1
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +14 -15
- package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
- package/dist/composables/useHtmlValidator.js +84 -106
- package/dist/composables/useRecommendation.js +21 -54
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +58 -54
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +33 -0
- package/dist/config/compiler/recommendationCompilerRules.js +39 -45
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/enums/extensions/recommendationBlock.js +1 -1
- package/dist/enums/recommendation.js +15 -16
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Recommendation/block.js +9 -130
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
- package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
- package/dist/extensions/Blocks/Recommendation/control.js +336 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
- package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +193 -230
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +15 -26
- package/dist/extensions/Blocks/controlFactories.js +93 -125
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +169 -223
- package/dist/services/recommendationApi.js +9 -10
- package/dist/services/stripoApi.js +50 -14
- package/dist/services/templateLibraryApi.js +13 -16
- package/dist/src/@types/events.d.ts +34 -2
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -67
- package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
- package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +468 -131
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/static/styles/components/notification.css.js +1 -0
- package/dist/static/styles/components/version-history.css.js +10 -2
- package/dist/static/styles/components/wide-panel.css.js +18 -2
- package/dist/static/styles/customEditorStyle.css.js +2 -25
- package/dist/stores/editor.js +2 -1
- package/dist/utils/pairProductVariables.js +56 -57
- package/dist/utils/templatePreparation.js +14 -15
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +0 -116
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -65
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -20
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -92
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -209
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -217
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -110
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -67
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -286
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -108
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
- package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -240
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -233
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -69
- package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -174
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -122
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +0 -17
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -52
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -68
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -42
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -214
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -34
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -39
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -57
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -160
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { displayConditions as
|
|
8
|
-
import { useStripoApi as
|
|
9
|
-
import
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { dynamicContentToMergeTags as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
const { features: l, template:
|
|
15
|
-
var
|
|
16
|
-
const
|
|
1
|
+
import { useActionsApi as M } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as A } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as F } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as D } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as I } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as U } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as P } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as R } from "../services/stripoApi.js";
|
|
9
|
+
import H from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as S } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as O } from "../utils/genericUtil.js";
|
|
12
|
+
import q from "../package.json.js";
|
|
13
|
+
const Z = (c) => {
|
|
14
|
+
const { features: l, template: C } = F(), { handleError: u } = U(), { getToken: E, getCustomFonts: h, getSyncModulesStatus: w } = R(), { handleEvent: b } = I(), { getStripoBlocksConfig: k } = A(), T = async (i, n = [], r = !1) => {
|
|
15
|
+
var g, f, y;
|
|
16
|
+
const e = S(), { html: p, css: a } = i, { baseBlocks: t, extensions: d } = await k(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, _ = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1, B = ((y = C.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
17
17
|
window.UIEditor.initEditor(
|
|
18
18
|
document.querySelector("#guido-editor"),
|
|
19
19
|
{
|
|
20
20
|
metadata: c,
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
21
|
+
html: p,
|
|
22
|
+
css: a,
|
|
23
|
+
forceRecreate: B,
|
|
24
24
|
locale: "en",
|
|
25
25
|
undoButtonSelector: "#guido__undo-button",
|
|
26
26
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,19 +30,20 @@ const W = (c) => {
|
|
|
30
30
|
customAppearanceMergetags: !0,
|
|
31
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: H,
|
|
34
|
+
conditionsEnabled: m,
|
|
35
|
+
customConditionsEnabled: m,
|
|
36
|
+
conditionCategories: P,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
|
-
modulesDisabled:
|
|
38
|
+
modulesDisabled: _,
|
|
39
|
+
syncModulesEnabled: r,
|
|
39
40
|
messageSettingsEnabled: !0,
|
|
40
41
|
displayGmailAnnotations: !0,
|
|
41
42
|
displayHiddenPreheader: !1,
|
|
42
43
|
displayTitle: !1,
|
|
43
44
|
displayUTM: !1,
|
|
44
45
|
selectElementAfterDrop: !0,
|
|
45
|
-
...
|
|
46
|
+
...t ? { baseBlocks: t } : {},
|
|
46
47
|
editorFonts: {
|
|
47
48
|
showDefaultStandardFonts: !0,
|
|
48
49
|
showDefaultNotStandardFonts: !0,
|
|
@@ -50,68 +51,71 @@ const W = (c) => {
|
|
|
50
51
|
},
|
|
51
52
|
mergeTags: [
|
|
52
53
|
{
|
|
53
|
-
entries:
|
|
54
|
+
entries: O(c.preselectedDynamicContentList)
|
|
54
55
|
}
|
|
55
56
|
],
|
|
56
|
-
async onTokenRefreshRequest(
|
|
57
|
+
async onTokenRefreshRequest(o) {
|
|
57
58
|
try {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
} catch (
|
|
61
|
-
u(
|
|
59
|
+
const s = await E();
|
|
60
|
+
o(s);
|
|
61
|
+
} catch (s) {
|
|
62
|
+
u(s, "Failed to refresh token");
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
onTemplateLoaded() {
|
|
65
66
|
try {
|
|
66
|
-
const { importCss:
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const { importCss: o } = D(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: v } = M();
|
|
68
|
+
o(), s(), v(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
69
|
+
e.hasChanges = !1;
|
|
69
70
|
}, 1e3);
|
|
70
|
-
} catch (
|
|
71
|
-
u(
|
|
71
|
+
} catch (o) {
|
|
72
|
+
u(o, "Failed to load custom interface appearance");
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
|
-
onCodeEditorVisibilityChanged(
|
|
75
|
-
|
|
75
|
+
onCodeEditorVisibilityChanged(o) {
|
|
76
|
+
e.isCodeEditorOpen = o;
|
|
76
77
|
},
|
|
77
|
-
onEditorVisualModeChanged(
|
|
78
|
-
|
|
78
|
+
onEditorVisualModeChanged(o) {
|
|
79
|
+
e.editorVisualMode = o.toLowerCase();
|
|
79
80
|
},
|
|
80
|
-
onVersionHistoryVisibilityChanged(
|
|
81
|
-
|
|
81
|
+
onVersionHistoryVisibilityChanged(o) {
|
|
82
|
+
e.isVersionHistoryOpen = o;
|
|
82
83
|
},
|
|
83
84
|
onDataChanged() {
|
|
84
|
-
|
|
85
|
+
e.hasChanges = !0;
|
|
85
86
|
},
|
|
86
|
-
onEvent:
|
|
87
|
+
onEvent: b,
|
|
87
88
|
ignoreClickOutsideSelectors: [
|
|
88
89
|
"#guido-dynamic-content-modal",
|
|
89
90
|
".in-on-board-wrapper",
|
|
90
91
|
".in-drawer__container"
|
|
91
92
|
],
|
|
92
|
-
extensions:
|
|
93
|
+
extensions: d
|
|
93
94
|
}
|
|
94
95
|
);
|
|
95
|
-
},
|
|
96
|
-
var
|
|
96
|
+
}, V = (i) => new Promise((n, r) => {
|
|
97
|
+
var d;
|
|
97
98
|
if (document.getElementById("UiEditorScript")) {
|
|
98
99
|
i(), n();
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
const
|
|
102
|
-
t.id = "UiEditorScript", t.type = "module", t.src =
|
|
102
|
+
const e = q.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
103
|
+
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
103
104
|
i(), n();
|
|
104
105
|
}, t.onerror = () => {
|
|
105
|
-
|
|
106
|
+
r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
106
107
|
}, document.body.appendChild(t);
|
|
107
108
|
});
|
|
108
109
|
return { initPlugin: async (i) => {
|
|
109
|
-
await
|
|
110
|
-
const n = await
|
|
111
|
-
|
|
110
|
+
await V(async () => {
|
|
111
|
+
const n = S(), [r, e] = await Promise.all([
|
|
112
|
+
h(),
|
|
113
|
+
w()
|
|
114
|
+
]);
|
|
115
|
+
n.syncModulesEnabled = e, await T(i, r, e);
|
|
112
116
|
});
|
|
113
117
|
} };
|
|
114
118
|
};
|
|
115
119
|
export {
|
|
116
|
-
|
|
120
|
+
Z as useStripo
|
|
117
121
|
};
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 = {
|
|
7
|
+
block_dropped: ({ blockName: e }) => {
|
|
8
|
+
if (e === "BLOCK_TEXT") {
|
|
9
|
+
const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
|
|
10
|
+
if (t || c)
|
|
8
11
|
return;
|
|
9
|
-
|
|
12
|
+
o.start("textBlockOnboarding");
|
|
10
13
|
}
|
|
14
|
+
},
|
|
15
|
+
module_saved: async (e) => {
|
|
16
|
+
n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
|
|
17
|
+
},
|
|
18
|
+
module_dropped: async (e) => {
|
|
19
|
+
if (!n.syncModulesEnabled)
|
|
20
|
+
return;
|
|
21
|
+
const { moduleId: o } = e, t = await r(o);
|
|
22
|
+
console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
|
|
23
|
+
},
|
|
24
|
+
module_updated: async (e) => {
|
|
25
|
+
n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
|
|
11
26
|
}
|
|
12
27
|
};
|
|
13
|
-
return { handleEvent: async (
|
|
14
|
-
const
|
|
15
|
-
o && await o
|
|
28
|
+
return { handleEvent: async (e, o) => {
|
|
29
|
+
const t = a[e];
|
|
30
|
+
console.debug("Stripo Event: ", e, o), t && await t(o);
|
|
16
31
|
} };
|
|
17
32
|
};
|
|
18
33
|
export {
|
|
19
|
-
|
|
34
|
+
v as useStripoEventHandler
|
|
20
35
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as S } from "../enums/unsubscribe.js";
|
|
2
|
+
import { DATA_ATTRIBUTES as a } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
+
import { useEditorStore as d } from "../stores/editor.js";
|
|
4
|
+
const T = ".esd-synchronizable-module", m = '[esd-extension-block-id="unsubscribe-block"]', A = "esd-custom-block-id", M = () => {
|
|
5
|
+
const l = d();
|
|
6
|
+
return { extractSyncModuleUnsubscribeData: (p) => {
|
|
7
|
+
if (!l.syncModulesEnabled)
|
|
8
|
+
return [];
|
|
9
|
+
const E = new DOMParser().parseFromString(p, "text/html").querySelectorAll(T), e = [];
|
|
10
|
+
return E.forEach((r) => {
|
|
11
|
+
const s = r.getAttribute(A);
|
|
12
|
+
if (!s)
|
|
13
|
+
return;
|
|
14
|
+
r.querySelectorAll(m).forEach((o) => {
|
|
15
|
+
const n = o.getAttribute(a.PAGE_LIST), c = o.getAttribute(a.PAGE_TYPE);
|
|
16
|
+
if (!n || !c)
|
|
17
|
+
return;
|
|
18
|
+
const b = parseInt(c), u = S[b];
|
|
19
|
+
if (!u)
|
|
20
|
+
return;
|
|
21
|
+
const i = n.split(",").map((t) => parseInt(t.trim())).filter((t) => !Number.isNaN(t));
|
|
22
|
+
i.length !== 0 && e.push({
|
|
23
|
+
stripoModuleId: s,
|
|
24
|
+
unsubscriptionPreferencePages: i,
|
|
25
|
+
type: u
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}), e;
|
|
29
|
+
} };
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
M as useSyncModuleExtractor
|
|
33
|
+
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as P, REGEX as
|
|
3
|
-
|
|
4
|
-
const G = [
|
|
1
|
+
import { useRecommendation as u } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as P, REGEX as i, CSS as e, CONDITIONS as E, ATTRIBUTES as r, HTML as h } from "../../enums/recommendation.js";
|
|
3
|
+
const H = [
|
|
5
4
|
{
|
|
6
5
|
id: "replace-images-with-variable-names",
|
|
7
6
|
description: "Replacing dummy images with variable names in recommendation module",
|
|
8
7
|
type: "custom",
|
|
9
|
-
processor: (
|
|
10
|
-
let t =
|
|
11
|
-
return Object.entries(P).forEach(([,
|
|
12
|
-
Object.entries(
|
|
13
|
-
t = t.replaceAll(o, `{{${
|
|
8
|
+
processor: (a) => {
|
|
9
|
+
let t = a;
|
|
10
|
+
return Object.entries(P).forEach(([, n]) => {
|
|
11
|
+
Object.entries(n).forEach(([s, o]) => {
|
|
12
|
+
t = t.replaceAll(o, `{{${s}}}`);
|
|
14
13
|
});
|
|
15
14
|
}), t;
|
|
16
15
|
},
|
|
@@ -29,17 +28,17 @@ const G = [
|
|
|
29
28
|
id: "add-recommendation-unresponsive-css",
|
|
30
29
|
description: "Adding recommendation unresponsive css",
|
|
31
30
|
type: "custom",
|
|
32
|
-
processor: (
|
|
33
|
-
const {
|
|
34
|
-
let n =
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
const c = `width:${Math.min(...
|
|
31
|
+
processor: (a) => {
|
|
32
|
+
const { getRecommendationCampaignData: t } = u();
|
|
33
|
+
let n = a;
|
|
34
|
+
const s = n.match(i.ID);
|
|
35
|
+
if (s) {
|
|
36
|
+
const o = [];
|
|
37
|
+
if (s.forEach((c) => {
|
|
38
|
+
const m = c.slice(35, c.length - 1).trim();
|
|
39
|
+
t(m);
|
|
40
|
+
}), o.length) {
|
|
41
|
+
const c = `width:${Math.min(...o)}px!important;`;
|
|
43
42
|
n = n.replace(e.REGULAR_NAME_HEIGHT, `${e.TRIMMED_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.REGULAR_NAME_CONTAINER_HEIGHT, e.TRIMMED_NAME_CONTAINER_CSS).replace(e.RESPONSIVE_NAME_SIZE, `${e.RESPONSIVE_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.RESPONSIVE_NAME_CONTAINER_HEIGHT, e.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
@@ -47,37 +46,32 @@ const G = [
|
|
|
47
46
|
},
|
|
48
47
|
priority: 52
|
|
49
48
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
description: "Replacing product data with template variables in recommendation blocks",
|
|
53
|
-
type: "custom",
|
|
54
|
-
processor: (s) => D(s),
|
|
55
|
-
priority: 48
|
|
56
|
-
},
|
|
49
|
+
// TODO: prepareRecommendations
|
|
50
|
+
// TODO: addRecommendationCustomFields
|
|
57
51
|
{
|
|
58
52
|
id: "add-discount-conditions",
|
|
59
53
|
description: "Adding discount conditions to the recommendation block",
|
|
60
54
|
type: "custom",
|
|
61
|
-
processor: (
|
|
62
|
-
let t =
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
55
|
+
processor: (a) => {
|
|
56
|
+
let t = a;
|
|
57
|
+
const n = t.match(i.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: s } = u();
|
|
58
|
+
return n !== null && n.forEach((o) => {
|
|
59
|
+
const c = o.match(i.CUSTOM_FIELD);
|
|
60
|
+
if (!c)
|
|
67
61
|
return;
|
|
68
|
-
const [
|
|
69
|
-
if (!
|
|
62
|
+
const [m] = c, p = m.match(i.CUSTOM_FIELD_INDEXES_PART), A = m.match(i.CUSTOM_FIELD_NAME_PART), _ = o.match(i.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
63
|
+
if (!p || !A || !_)
|
|
70
64
|
return;
|
|
71
|
-
const [
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
65
|
+
const [l] = p, [T] = A, [d] = _, N = T.substring(1, T.length - 2), R = d.match(i.COMPOSITION) !== null;
|
|
66
|
+
let O = m;
|
|
67
|
+
if (R) {
|
|
68
|
+
const M = l.substring(2, l.length - 3);
|
|
69
|
+
s(M);
|
|
76
70
|
}
|
|
77
|
-
const
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
const
|
|
71
|
+
const I = l.substring(2);
|
|
72
|
+
let S = "";
|
|
73
|
+
N in E.IF && (S = E.IF[N].replaceAll(`{${r.DISCOUNT}}`, `${I}${r.DISCOUNT}`).replaceAll(`{${r.OMNIBUS_DISCOUNT}}`, `${I}${r.OMNIBUS_DISCOUNT}`).replaceAll(`{${r.OMNIBUS_PRICE}}`, `${I}${r.OMNIBUS_PRICE}`));
|
|
74
|
+
const $ = `${d}${O}${h.PARAGRAPH_END_TAG}`, C = `${S}${R ? $ : o}${E.ELSE}${d}${h.PARAGRAPH_END_TAG}${E.END_IF}`;
|
|
81
75
|
t = t.replace(o, C);
|
|
82
76
|
}), t;
|
|
83
77
|
},
|
|
@@ -85,5 +79,5 @@ const G = [
|
|
|
85
79
|
}
|
|
86
80
|
];
|
|
87
81
|
export {
|
|
88
|
-
|
|
82
|
+
H as recommendationCompilerRules
|
|
89
83
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var h = Object.defineProperty;
|
|
2
2
|
var T = (A, e, t) => e in A ? h(A, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : A[e] = t;
|
|
3
3
|
var m = (A, e, t) => T(A, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/
|
|
5
|
-
import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/
|
|
4
|
+
import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/migrationTemplate.js";
|
|
5
|
+
import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/templateUtils.js";
|
|
6
6
|
class w {
|
|
7
7
|
constructor() {
|
|
8
8
|
m(this, "parser");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const s = {
|
|
2
|
-
RECOMMENDATION_API_URL: "
|
|
2
|
+
RECOMMENDATION_API_URL: "http://recommendationv2.api.useinsider.com"
|
|
3
3
|
}, i = [
|
|
4
4
|
{ id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
|
|
5
5
|
{ id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const s = 20, e = 320, t = {
|
|
2
2
|
CART_ABANDONMENT: {
|
|
3
3
|
ins_apr_img_1: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_1.png",
|
|
4
4
|
ins_apr_img_2: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_2.png",
|
|
@@ -15,7 +15,7 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
15
15
|
DISCOUNT: "discount",
|
|
16
16
|
OMNIBUS_DISCOUNT: "omnibus_discount",
|
|
17
17
|
OMNIBUS_PRICE: "omnibus_price"
|
|
18
|
-
},
|
|
18
|
+
}, m = {
|
|
19
19
|
IF: {
|
|
20
20
|
discount: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" %}`,
|
|
21
21
|
omnibus_discount: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" and {${i.OMNIBUS_DISCOUNT}} != "0%" and {${i.OMNIBUS_DISCOUNT}} != "" %}`,
|
|
@@ -23,17 +23,17 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
23
23
|
},
|
|
24
24
|
ELSE: "{% else %}",
|
|
25
25
|
END_IF: "{% endif %}"
|
|
26
|
-
},
|
|
27
|
-
ID: /recommendation-id="(.*?)"/gi,
|
|
28
|
-
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[
|
|
29
|
-
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"
|
|
26
|
+
}, _ = {
|
|
27
|
+
ID: /ins-recommendation-v3-campaign-id="(.*?)"/gi,
|
|
28
|
+
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)">[\S\s]*?<\/p>/gm,
|
|
29
|
+
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)">/gm,
|
|
30
30
|
COMPOSITION: /composition="true"/gm,
|
|
31
31
|
CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
32
|
CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
|
|
33
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
|
-
},
|
|
34
|
+
}, a = {
|
|
35
35
|
PARAGRAPH_END_TAG: "</p>"
|
|
36
|
-
},
|
|
36
|
+
}, n = {
|
|
37
37
|
REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
|
|
38
38
|
TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
|
|
39
39
|
ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
|
|
@@ -46,12 +46,11 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
46
46
|
};
|
|
47
47
|
export {
|
|
48
48
|
i as ATTRIBUTES,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
t as VerticalOrientation
|
|
49
|
+
m as CONDITIONS,
|
|
50
|
+
n as CSS,
|
|
51
|
+
t as DUMMY_IMAGE_MAPPINGS,
|
|
52
|
+
s as DefaultPadding,
|
|
53
|
+
a as HTML,
|
|
54
|
+
e as MinDeviceViewport,
|
|
55
|
+
_ as REGEX
|
|
57
56
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
2
|
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
-
const
|
|
3
|
+
const _ = {
|
|
4
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
5
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
6
|
+
}, I = {
|
|
7
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
},
|
|
12
|
-
UNSUBSCRIBE_URL: `https://mail.${
|
|
13
|
-
PREFERENCES_URL: `https://mail.${
|
|
14
|
-
},
|
|
11
|
+
}, n = R(), r = {
|
|
12
|
+
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
13
|
+
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
14
|
+
}, B = "iid", i = {
|
|
15
15
|
name: "Global Unsubscribe",
|
|
16
16
|
sendGridId: "G"
|
|
17
17
|
}, C = "/email/unsubscribe-pages", E = {
|
|
@@ -20,6 +20,9 @@ const I = {
|
|
|
20
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
22
|
RESUBSCRIBE: 5
|
|
23
|
+
}, U = {
|
|
24
|
+
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
23
26
|
}, t = {
|
|
24
27
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
25
28
|
E.GLOBAL_UNSUBSCRIBE,
|
|
@@ -30,29 +33,30 @@ const I = {
|
|
|
30
33
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
31
34
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
32
35
|
]
|
|
33
|
-
},
|
|
34
|
-
const
|
|
36
|
+
}, c = () => {
|
|
37
|
+
const s = e();
|
|
35
38
|
return {
|
|
36
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
37
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
38
|
-
[E.RESUBSCRIBE]:
|
|
39
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
40
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
39
|
+
[E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
|
|
40
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
41
|
+
[E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
|
|
42
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
|
|
43
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
41
44
|
};
|
|
42
|
-
},
|
|
45
|
+
}, o = {
|
|
43
46
|
default: "{{ins-unsubscribe-link}}",
|
|
44
47
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
45
48
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
46
49
|
};
|
|
47
50
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
i as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
52
|
+
B as INSIDER_ID,
|
|
53
|
+
I as LINK_REGEXES,
|
|
54
|
+
_ as LINK_TYPES,
|
|
55
|
+
o as MERGE_TAGS,
|
|
53
56
|
E as PAGE_TYPES,
|
|
54
57
|
t as TYPE_COLLECTIONS,
|
|
55
58
|
C as UNSUBSCRIBE_PAGES_LINK,
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
U as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
60
|
+
r as URLS,
|
|
61
|
+
c as getTypeTranslations
|
|
58
62
|
};
|