@useinsider/guido 3.19.0-beta.d04f200 → 3.19.0-beta.e110e88
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/@types/config/schemas.js +91 -104
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +74 -79
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +3 -4
- package/dist/composables/useHttp.js +54 -64
- package/dist/composables/useLegacyStrategyConversion.js +19 -23
- package/dist/composables/useStripo.js +20 -24
- package/dist/composables/useToaster.js +15 -17
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/config/migrator/index.js +13 -14
- package/dist/enums/extensions/recommendationBlock.js +29 -30
- package/dist/extensions/Blocks/Recommendation/block.js +22 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -97
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +49 -72
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +91 -67
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -21
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +55 -16
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -5
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useHttp.d.ts +0 -2
- package/dist/src/config/migrator/index.d.ts +1 -2
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +13 -2
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
- package/dist/src/stores/config.d.ts +0 -20
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -9
- package/package.json +1 -1
- package/dist/components/organisms/base/AuthErrorModal.vue.js +0 -18
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +0 -42
- package/dist/composables/useAuthError.js +0 -52
- package/dist/config/migrator/recommendationPartnerMigrator.js +0 -50
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +0 -25
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +0 -2
- package/dist/src/composables/useAuthError.d.ts +0 -12
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +0 -19
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +0 -33
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { provideGuidoActions as
|
|
5
|
-
import { useGuidoStateBridge as
|
|
6
|
-
import { usePartner as
|
|
7
|
-
import { useStripo as
|
|
8
|
-
import { useTimerClone as
|
|
9
|
-
import { migrate as
|
|
10
|
-
import { ModuleFolderDefaults as
|
|
11
|
-
import { RIBBON_SELECTOR as
|
|
1
|
+
import { defineComponent as re, defineAsyncComponent as m, ref as O, computed as u, watch as x, onMounted as se, onUnmounted as ae } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as ie } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { useEditorLock as ce } from "../composables/useEditorLock.js";
|
|
4
|
+
import { provideGuidoActions as de } from "../composables/useGuidoActions.js";
|
|
5
|
+
import { useGuidoStateBridge as me } from "../composables/useGuidoStateBridge.js";
|
|
6
|
+
import { usePartner as le } from "../composables/usePartner.js";
|
|
7
|
+
import { useStripo as ue } from "../composables/useStripo.js";
|
|
8
|
+
import { useTimerClone as pe } from "../composables/useTimerClone.js";
|
|
9
|
+
import { migrate as W } from "../config/migrator/index.js";
|
|
10
|
+
import { ModuleFolderDefaults as G } from "../enums/defaults.js";
|
|
11
|
+
import { RIBBON_SELECTOR as fe } from "../enums/onboarding.js";
|
|
12
12
|
import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import ve from "./organisms/
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
const rt = /* @__PURE__ */ ae({
|
|
13
|
+
import ye from "./organisms/AutoSaveController.vue.js";
|
|
14
|
+
import ge from "./organisms/base/Toaster.vue.js";
|
|
15
|
+
import ve from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
16
|
+
import Se from "./organisms/header/HeaderWrapper.vue.js";
|
|
17
|
+
import be from "./organisms/LoadingWrapper.vue.js";
|
|
18
|
+
import he from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
19
|
+
import Ee from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
20
|
+
import { useStripoApi as we } from "../services/stripoApi.js";
|
|
21
|
+
import { useConfigStore as Ce } from "../stores/config.js";
|
|
22
|
+
import { useDynamicContentStore as De } from "../stores/dynamic-content.js";
|
|
23
|
+
import { useEditorStore as H } from "../stores/editor.js";
|
|
24
|
+
import { usePreviewStore as ke } from "../stores/preview.js";
|
|
25
|
+
import { useTemplateStore as Te } from "../stores/template.js";
|
|
26
|
+
import { useUnsubscribeStore as Fe } from "../stores/unsubscribe.js";
|
|
27
|
+
import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
|
|
28
|
+
const tt = /* @__PURE__ */ re({
|
|
30
29
|
__name: "Guido",
|
|
31
30
|
props: {
|
|
32
31
|
config: null,
|
|
33
32
|
ready: { type: Boolean, default: !0 }
|
|
34
33
|
},
|
|
35
34
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
36
|
-
setup(
|
|
37
|
-
const
|
|
35
|
+
setup(z, { expose: q, emit: r }) {
|
|
36
|
+
const a = z, K = m(
|
|
38
37
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
39
|
-
),
|
|
38
|
+
), V = m(
|
|
40
39
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
41
|
-
),
|
|
40
|
+
), j = m(
|
|
42
41
|
() => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
|
|
43
|
-
),
|
|
42
|
+
), J = m(
|
|
44
43
|
() => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
|
|
45
|
-
),
|
|
44
|
+
), Q = m(
|
|
46
45
|
() => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
|
|
47
|
-
), E =
|
|
48
|
-
|
|
49
|
-
const c =
|
|
46
|
+
), E = O(), p = O(), f = De(), w = Fe(), o = Ce();
|
|
47
|
+
a.ready && o.init(a.config);
|
|
48
|
+
const c = H(), X = ke(), l = u(() => c.hasChanges), { isTestPartner: Y } = le(), C = () => {
|
|
50
49
|
var t;
|
|
51
50
|
return (t = E.value) == null ? void 0 : t.handleSave(!0);
|
|
52
51
|
}, D = (t) => {
|
|
53
52
|
c.loadingStatus = t;
|
|
54
53
|
};
|
|
55
|
-
|
|
54
|
+
ie(), me();
|
|
56
55
|
const y = () => {
|
|
57
56
|
var t, e;
|
|
58
57
|
return {
|
|
@@ -60,18 +59,18 @@ const rt = /* @__PURE__ */ ae({
|
|
|
60
59
|
userId: o.userId,
|
|
61
60
|
username: o.username,
|
|
62
61
|
partnerName: o.partnerName,
|
|
63
|
-
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) ||
|
|
64
|
-
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) ||
|
|
62
|
+
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
|
|
63
|
+
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
|
|
65
64
|
};
|
|
66
|
-
}, { initPlugin: k, preloadRuntime:
|
|
65
|
+
}, { initPlugin: k, preloadRuntime: T } = ue(), { runExclusive: F, beginMount: M, isCurrentMount: R } = ce();
|
|
67
66
|
let g = 0;
|
|
68
|
-
const { getDefaultTemplate: I } =
|
|
67
|
+
const { getDefaultTemplate: I } = we(), { cloneTimersOnSave: L, hasTimerBlocks: B } = pe(), Z = u(() => {
|
|
69
68
|
var t;
|
|
70
69
|
return !((t = o.ui) != null && t.showHeader);
|
|
71
|
-
}),
|
|
70
|
+
}), ee = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), te = u(
|
|
72
71
|
() => !!h().recommendationConfigs.strategyId
|
|
73
72
|
);
|
|
74
|
-
|
|
73
|
+
de({
|
|
75
74
|
onBack: () => {
|
|
76
75
|
console.debug("guido:back"), r("back");
|
|
77
76
|
},
|
|
@@ -86,84 +85,80 @@ const rt = /* @__PURE__ */ ae({
|
|
|
86
85
|
console.debug("guido:test-email:click"), r("test-email:click");
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
|
-
const
|
|
88
|
+
const U = (t) => {
|
|
90
89
|
console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
91
|
-
},
|
|
90
|
+
}, A = () => {
|
|
92
91
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
x(() => l.value, () => {
|
|
95
94
|
r("on-change", l.value);
|
|
96
95
|
});
|
|
97
|
-
const
|
|
98
|
-
const e = t, { attribute:
|
|
99
|
-
console.debug("dynamic-content:open", e.detail), r("dynamic-content:open",
|
|
96
|
+
const v = (t) => {
|
|
97
|
+
const e = t, { attribute: s, position: d } = e.detail;
|
|
98
|
+
console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
|
|
100
99
|
};
|
|
101
100
|
let i = null;
|
|
102
|
-
const
|
|
101
|
+
const S = () => {
|
|
103
102
|
var e;
|
|
104
|
-
const t = document.querySelector(
|
|
103
|
+
const t = document.querySelector(fe);
|
|
105
104
|
(e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
106
105
|
}, b = async () => {
|
|
107
106
|
var t;
|
|
108
107
|
try {
|
|
109
|
-
o.initialized || o.init(
|
|
110
|
-
const e = o.template,
|
|
108
|
+
o.initialized || o.init(a.config), c.templateId = o.templateId;
|
|
109
|
+
const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
111
110
|
w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
112
|
-
const
|
|
113
|
-
partnerName: o.partnerName,
|
|
114
|
-
campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
|
|
115
|
-
rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
|
|
116
|
-
};
|
|
111
|
+
const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, N = o.isFeatureEnabled("linkTrackingIds");
|
|
117
112
|
let n = {
|
|
118
|
-
html:
|
|
113
|
+
html: s && await W(s, _),
|
|
119
114
|
css: d
|
|
120
115
|
};
|
|
121
|
-
n.html || (n = await I(), n.html = await
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
preselectedDynamicContentList:
|
|
116
|
+
n.html || (n = await I(), n.html = await W(n.html, _));
|
|
117
|
+
const oe = N ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
|
|
118
|
+
B(n.html) && (n.html = await L(n.html)), N && (c.trackIdSessionFloor = Math.max(oe, $(n.html)));
|
|
119
|
+
const ne = {
|
|
120
|
+
preselectedDynamicContentList: P,
|
|
126
121
|
onReady: () => {
|
|
127
122
|
console.debug("guido:ready"), r("ready");
|
|
128
123
|
}
|
|
129
124
|
};
|
|
130
|
-
g =
|
|
125
|
+
g = M(), await k(n, y(), ne), f.selectedDynamicContentList = P;
|
|
131
126
|
} catch (e) {
|
|
132
127
|
console.error("Failed to initialize Stripo editor:", e);
|
|
133
128
|
}
|
|
134
129
|
};
|
|
135
130
|
return se(async () => {
|
|
136
131
|
var e;
|
|
137
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(),
|
|
132
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), H().$reset(), Te().$reset(), S();
|
|
138
133
|
const t = (e = p.value) == null ? void 0 : e.parentElement;
|
|
139
|
-
if (t && (i = new ResizeObserver(
|
|
134
|
+
if (t && (i = new ResizeObserver(S), i.observe(t)), T(), a.ready)
|
|
140
135
|
await b();
|
|
141
136
|
else {
|
|
142
|
-
const
|
|
143
|
-
d && (
|
|
137
|
+
const s = x(() => a.ready, (d) => {
|
|
138
|
+
d && (s(), b());
|
|
144
139
|
});
|
|
145
140
|
}
|
|
146
|
-
document.addEventListener("dynamic-content:open",
|
|
147
|
-
}),
|
|
148
|
-
i == null || i.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
149
|
-
if (
|
|
141
|
+
document.addEventListener("dynamic-content:open", v);
|
|
142
|
+
}), ae(() => {
|
|
143
|
+
i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), h().disposeStrategyPageReturn(), F(async () => {
|
|
144
|
+
if (R(g))
|
|
150
145
|
try {
|
|
151
146
|
window.UIEditor.removeEditor();
|
|
152
147
|
} catch {
|
|
153
148
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
154
149
|
}
|
|
155
150
|
}), o.reset();
|
|
156
|
-
}),
|
|
151
|
+
}), q({
|
|
157
152
|
dynamicContent: {
|
|
158
|
-
insert:
|
|
159
|
-
close:
|
|
153
|
+
insert: U,
|
|
154
|
+
close: A
|
|
160
155
|
},
|
|
161
156
|
hasChanges: l,
|
|
162
157
|
saveSilent: C,
|
|
163
158
|
setLoading: D
|
|
164
|
-
}), { __sfc: !0, PreviewContainer:
|
|
159
|
+
}), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, LegacyStrategyUpdatedModal: Q, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: a, configStore: o, editorStore: c, previewStore: X, hasChanges: l, isTestPartner: Y, saveSilent: C, setLoading: D, emit: r, buildMetadata: y, initPlugin: k, preloadRuntime: T, runExclusive: F, beginMount: M, isCurrentMount: R, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: B, noHeader: Z, isRrsEnabled: ee, hasAssignedStrategy: te, insertDynamicContent: U, closeDynamicContent: A, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: b, AutoSaveController: ye, Toaster: ge, FilterSelectionDrawer: ve, HeaderWrapper: Se, LoadingWrapper: be, SaveAsTemplateDrawer: he, UnsubscribeWrapper: Ee };
|
|
165
160
|
}
|
|
166
161
|
});
|
|
167
162
|
export {
|
|
168
|
-
|
|
163
|
+
tt as default
|
|
169
164
|
};
|
|
@@ -2,7 +2,7 @@ import r from "./WpModal.vue2.js";
|
|
|
2
2
|
import s from "../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var i = function() {
|
|
4
4
|
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
5
|
-
return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size,
|
|
5
|
+
return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
|
|
6
6
|
return e.emit("close");
|
|
7
7
|
}, onCloseEvent: function(n) {
|
|
8
8
|
return e.emit("close");
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { defineComponent as e } from "vue";
|
|
2
2
|
import { InModalV2 as o } from "@useinsider/design-system-vue";
|
|
3
|
-
const
|
|
3
|
+
const u = /* @__PURE__ */ e({
|
|
4
4
|
__name: "WpModal",
|
|
5
5
|
props: {
|
|
6
6
|
id: null,
|
|
7
7
|
title: null,
|
|
8
8
|
description: { default: "" },
|
|
9
|
-
state: { default: "default" },
|
|
10
9
|
size: { default: "small" },
|
|
11
10
|
footerButtonOptions: { default: void 0 },
|
|
12
11
|
closeButtonStatus: { type: Boolean, default: !0 },
|
|
@@ -14,10 +13,10 @@ const n = /* @__PURE__ */ e({
|
|
|
14
13
|
footerStatus: { type: Boolean, default: !0 }
|
|
15
14
|
},
|
|
16
15
|
emits: ["close", "primary-action", "secondary-action"],
|
|
17
|
-
setup(
|
|
16
|
+
setup(l, { emit: t }) {
|
|
18
17
|
return { __sfc: !0, emit: t, InModalV2: o };
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
20
|
export {
|
|
22
|
-
|
|
21
|
+
u as default
|
|
23
22
|
};
|
|
@@ -1,98 +1,88 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const f = T(!1), n = T(null), c = T(null), b = w(() => f.value), y = w(() => n.value !== null), E = {
|
|
1
|
+
import { getCsrfToken as O } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as m, computed as T } from "vue";
|
|
3
|
+
const X = (b = {}) => {
|
|
4
|
+
const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
|
|
6
5
|
baseURL: "",
|
|
7
6
|
timeout: 1e4,
|
|
8
7
|
retry: 0,
|
|
9
8
|
retryDelay: 1e3,
|
|
10
9
|
headers: {
|
|
11
10
|
"Content-Type": "application/json",
|
|
12
|
-
"X-CSRF-TOKEN":
|
|
11
|
+
"X-CSRF-TOKEN": O(),
|
|
13
12
|
Accept: "application/json",
|
|
14
|
-
// Without this a guest fetch gets a 302 to the login page, never an auth status.
|
|
15
13
|
"X-Requested-With": "XMLHttpRequest"
|
|
16
14
|
},
|
|
17
|
-
...
|
|
18
|
-
},
|
|
15
|
+
...b
|
|
16
|
+
}, w = (e, s) => {
|
|
19
17
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
20
18
|
return e;
|
|
21
|
-
const t =
|
|
19
|
+
const t = s || v.baseURL || "";
|
|
22
20
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
23
|
-
},
|
|
21
|
+
}, P = (e) => new Promise((s, t) => {
|
|
24
22
|
setTimeout(() => {
|
|
25
23
|
t(new Error("Request timeout"));
|
|
26
24
|
}, e);
|
|
27
|
-
}),
|
|
28
|
-
setTimeout(
|
|
29
|
-
}), i = async (e,
|
|
30
|
-
|
|
31
|
-
const
|
|
25
|
+
}), x = (e) => new Promise((s) => {
|
|
26
|
+
setTimeout(s, e);
|
|
27
|
+
}), i = async (e, s, t, L = {}) => {
|
|
28
|
+
a.value = null, p.value = !0, u.value = new AbortController();
|
|
29
|
+
const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
|
|
32
30
|
method: e,
|
|
33
|
-
headers: { ...
|
|
34
|
-
signal:
|
|
35
|
-
...
|
|
31
|
+
headers: { ...n.headers },
|
|
32
|
+
signal: u.value.signal,
|
|
33
|
+
...n
|
|
36
34
|
};
|
|
37
|
-
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete
|
|
38
|
-
const
|
|
39
|
-
if (window.isSessionExpired) {
|
|
40
|
-
n.value = { message: "Session expired", authReported: !0 };
|
|
41
|
-
const o = new Error("Session expired");
|
|
42
|
-
throw o.authReported = !0, o;
|
|
43
|
-
}
|
|
35
|
+
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
36
|
+
const E = async (h = 0) => {
|
|
44
37
|
try {
|
|
45
|
-
const o = [fetch(
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
const H = `HTTP Error: ${
|
|
50
|
-
throw
|
|
51
|
-
s.status,
|
|
52
|
-
O,
|
|
53
|
-
new URL(p, window.location.href).href
|
|
54
|
-
)).catch(() => {
|
|
55
|
-
}), l;
|
|
38
|
+
const o = [fetch(D, c)];
|
|
39
|
+
n.timeout && o.push(P(n.timeout));
|
|
40
|
+
const r = await Promise.race(o);
|
|
41
|
+
if (!r.ok) {
|
|
42
|
+
const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
|
|
43
|
+
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
56
44
|
}
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
return
|
|
60
|
-
data:
|
|
61
|
-
status:
|
|
62
|
-
statusText:
|
|
63
|
-
headers:
|
|
45
|
+
let f;
|
|
46
|
+
const l = r.headers.get("content-type");
|
|
47
|
+
return l != null && l.includes("application/json") ? f = await r.json() : l != null && l.includes("text/") ? f = await r.text() : f = await r.blob(), {
|
|
48
|
+
data: f,
|
|
49
|
+
status: r.status,
|
|
50
|
+
statusText: r.statusText,
|
|
51
|
+
headers: r.headers
|
|
64
52
|
};
|
|
65
53
|
} catch (o) {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
return await
|
|
69
|
-
throw o instanceof Error ? o.name === "AbortError" ?
|
|
54
|
+
const r = o instanceof Error && o.name === "AbortError";
|
|
55
|
+
if (h < (n.retry || 0) && !r)
|
|
56
|
+
return await x(n.retryDelay || 1e3), E(h + 1);
|
|
57
|
+
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
70
58
|
}
|
|
71
59
|
};
|
|
72
60
|
try {
|
|
73
|
-
return await
|
|
61
|
+
return await E();
|
|
74
62
|
} finally {
|
|
75
|
-
|
|
63
|
+
p.value = !1, u.value = null;
|
|
76
64
|
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
65
|
+
}, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
|
|
66
|
+
u.value && u.value.abort(e);
|
|
67
|
+
}, W = () => {
|
|
68
|
+
a.value = null;
|
|
81
69
|
};
|
|
82
70
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
// State
|
|
72
|
+
loading: g,
|
|
73
|
+
error: T(() => a.value),
|
|
85
74
|
hasError: y,
|
|
75
|
+
// Methods
|
|
86
76
|
request: i,
|
|
87
|
-
get:
|
|
88
|
-
post:
|
|
89
|
-
put:
|
|
90
|
-
patch:
|
|
91
|
-
delete:
|
|
92
|
-
cancel:
|
|
93
|
-
clearError:
|
|
77
|
+
get: C,
|
|
78
|
+
post: R,
|
|
79
|
+
put: $,
|
|
80
|
+
patch: q,
|
|
81
|
+
delete: A,
|
|
82
|
+
cancel: U,
|
|
83
|
+
clearError: W
|
|
94
84
|
};
|
|
95
85
|
};
|
|
96
86
|
export {
|
|
97
|
-
|
|
87
|
+
X as useHttp
|
|
98
88
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { useToaster as
|
|
1
|
+
import { useRecommendation as I } from "./useRecommendation.js";
|
|
2
|
+
import { useToaster as C } from "./useToaster.js";
|
|
3
3
|
import { useTranslations as v } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
6
|
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
7
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
-
import { resolveMigrationTarget as
|
|
9
|
-
import { commitBlockChangeOutsidePanel as
|
|
10
|
-
import { useConfigStore as
|
|
8
|
+
import { resolveMigrationTarget as R, buildLegacyMigrationPayload as T } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
|
+
import { commitBlockChangeOutsidePanel as h } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
|
+
import { useConfigStore as k } from "../stores/config.js";
|
|
11
11
|
const F = () => {
|
|
12
|
-
const e = b(), r =
|
|
12
|
+
const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
14
|
const t = e.currentRecommendationId;
|
|
15
15
|
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s =
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = R({
|
|
18
18
|
campaignId: r.campaignId,
|
|
19
19
|
templateLibraryId: r.templateLibraryId
|
|
20
|
-
}), S =
|
|
20
|
+
}), S = T({
|
|
21
21
|
blockId: t,
|
|
22
22
|
url: m(String(t)),
|
|
23
23
|
campaignId: r.campaignId,
|
|
@@ -29,34 +29,30 @@ const F = () => {
|
|
|
29
29
|
let o;
|
|
30
30
|
try {
|
|
31
31
|
o = await e.convertLegacyStrategy(S, s);
|
|
32
|
-
} catch (
|
|
33
|
-
return console.error("[useLegacyStrategyConversion] migration failed",
|
|
32
|
+
} catch (n) {
|
|
33
|
+
return console.error("[useLegacyStrategyConversion] migration failed", n), i({
|
|
34
34
|
type: g.Error,
|
|
35
|
-
message:
|
|
36
|
-
actionButton: {
|
|
37
|
-
text: a("ds-steps.create-recommendation-strategy"),
|
|
38
|
-
onClick: () => e.openStrategyCreation()
|
|
39
|
-
}
|
|
35
|
+
message: c("email-editor.legacy-strategy-update-failed")
|
|
40
36
|
}), "";
|
|
41
37
|
}
|
|
42
38
|
try {
|
|
43
39
|
await e.fetchStrategyProductsForBlock(t);
|
|
44
|
-
} catch (
|
|
45
|
-
console.error("[useLegacyStrategyConversion] product refetch failed",
|
|
40
|
+
} catch (n) {
|
|
41
|
+
console.error("[useLegacyStrategyConversion] product refetch failed", n);
|
|
46
42
|
}
|
|
47
|
-
const
|
|
48
|
-
return
|
|
43
|
+
const a = e.blockStates[t];
|
|
44
|
+
return a ? h(
|
|
49
45
|
t,
|
|
50
46
|
{
|
|
51
47
|
strategyId: o,
|
|
52
|
-
size:
|
|
48
|
+
size: a.recommendationConfigs.size,
|
|
53
49
|
configVersion: L
|
|
54
50
|
},
|
|
55
|
-
|
|
51
|
+
a.recommendationProducts,
|
|
56
52
|
"Converted legacy recommendation strategy"
|
|
57
|
-
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f),
|
|
53
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
|
|
58
54
|
type: g.Error,
|
|
59
|
-
message:
|
|
55
|
+
message: c("email-editor.legacy-strategy-update-failed")
|
|
60
56
|
}), "") : o;
|
|
61
57
|
} };
|
|
62
58
|
};
|
|
@@ -17,21 +17,21 @@ import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../ut
|
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
19
|
const he = () => {
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled:
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = O(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
|
-
|
|
23
|
+
i();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const o = Z.guido,
|
|
27
|
-
e.id = "UiEditorScript", e.type = "module", e.src =
|
|
28
|
-
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${
|
|
26
|
+
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
|
|
27
|
+
e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
|
|
28
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
|
|
29
29
|
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
|
-
}), n), D = async (
|
|
32
|
+
}), n), D = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e = k(), { html: d, css: R } =
|
|
34
|
+
const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
35
35
|
w().importCss(), await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
@@ -45,7 +45,7 @@ const he = () => {
|
|
|
45
45
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
46
46
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
47
47
|
codeEditorButtonSelector: "#guido__code-button",
|
|
48
|
-
customAppearanceMergetags: !
|
|
48
|
+
customAppearanceMergetags: !m("liquidSyntax"),
|
|
49
49
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
50
50
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
51
51
|
customViewStyles: Q,
|
|
@@ -53,7 +53,7 @@ const he = () => {
|
|
|
53
53
|
customConditionsEnabled: S,
|
|
54
54
|
enableXSSSecurity: !0,
|
|
55
55
|
modulesDisabled: U,
|
|
56
|
-
syncModulesEnabled:
|
|
56
|
+
syncModulesEnabled: r,
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
59
59
|
displayHiddenPreheader: !1,
|
|
@@ -74,16 +74,16 @@ const he = () => {
|
|
|
74
74
|
entries: W(
|
|
75
75
|
o.preselectedDynamicContentList,
|
|
76
76
|
Y((C = u.value) == null ? void 0 : C.dynamicContentList),
|
|
77
|
-
|
|
77
|
+
m("liquidSyntax")
|
|
78
78
|
)
|
|
79
79
|
}
|
|
80
80
|
],
|
|
81
81
|
async onTokenRefreshRequest(t) {
|
|
82
82
|
try {
|
|
83
|
-
const l = await
|
|
83
|
+
const l = await M();
|
|
84
84
|
t(l);
|
|
85
85
|
} catch (l) {
|
|
86
|
-
|
|
86
|
+
p(l, "Failed to refresh token");
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
@@ -93,7 +93,7 @@ const he = () => {
|
|
|
93
93
|
e.hasChanges = !1;
|
|
94
94
|
}, 1e3);
|
|
95
95
|
} catch (t) {
|
|
96
|
-
|
|
96
|
+
p(t, "Failed to load custom interface appearance");
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
onCodeEditorVisibilityChanged(t) {
|
|
@@ -111,31 +111,27 @@ const he = () => {
|
|
|
111
111
|
onEvent: F,
|
|
112
112
|
onModuleAdd: A,
|
|
113
113
|
notifications: _(),
|
|
114
|
-
// Stripo deselects the block on any click outside the canvas, so every surface
|
|
115
|
-
// that belongs to the block's own flow has to be listed here (SD-153273).
|
|
116
114
|
ignoreClickOutsideSelectors: [
|
|
117
115
|
"#guido-dynamic-content-modal",
|
|
118
116
|
".in-on-board-wrapper",
|
|
119
|
-
".in-drawer__container"
|
|
120
|
-
".in-modal-v2-wrapper",
|
|
121
|
-
".in-toasts-wrapper"
|
|
117
|
+
".in-drawer__container"
|
|
122
118
|
],
|
|
123
119
|
extensions: P,
|
|
124
120
|
localePatch: J
|
|
125
121
|
}
|
|
126
122
|
);
|
|
127
123
|
};
|
|
128
|
-
return { initPlugin: async (
|
|
124
|
+
return { initPlugin: async (i, s, o) => {
|
|
129
125
|
const a = k();
|
|
130
126
|
try {
|
|
131
127
|
await f();
|
|
132
|
-
const [
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
const [r, e] = await Promise.all([
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
135
131
|
]);
|
|
136
|
-
a.syncModulesEnabled = e, await D(
|
|
132
|
+
a.syncModulesEnabled = e, await D(i, s, o, r, e);
|
|
137
133
|
} catch {
|
|
138
|
-
a.loadingStatus = !1,
|
|
134
|
+
a.loadingStatus = !1, B({
|
|
139
135
|
type: X.Error,
|
|
140
136
|
message: b["An error has occurred. Please report the error code to support."],
|
|
141
137
|
actionButton: {
|