@useinsider/guido 3.19.0-beta.4b9be3a → 3.19.0-beta.4e3e6c4
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 +21 -3
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +84 -87
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +29 -0
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useActionsApi.js +44 -43
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +54 -120
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +51 -96
- package/dist/composables/useHtmlValidator.js +87 -82
- package/dist/composables/useHttp.js +61 -54
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/useToaster.js +18 -22
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/enums/extensions/recommendationBlock.js +49 -33
- package/dist/extensions/Blocks/Recommendation/block.js +61 -42
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +100 -94
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +130 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +273 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -4
- package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -26
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/guido-email-editor.d.ts +10 -32
- package/dist/src/stores/onboarding.d.ts +808 -10
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +104 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/config.js +74 -60
- package/dist/stores/guido-email-editor.js +1 -3
- package/dist/stores/onboarding.js +46 -36
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +55 -55
- package/package.json +2 -1
|
@@ -1,88 +1,95 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { getCsrfToken as D } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as T, computed as w } from "vue";
|
|
3
|
+
import { isPanelOrigin as j, reportAuthError as X } from "./useAuthError.js";
|
|
4
|
+
const k = [401, 403, 419], _ = (g = {}) => {
|
|
5
|
+
const h = T(!1), n = T(null), c = T(null), b = w(() => h.value), y = w(() => n.value !== null), E = {
|
|
5
6
|
baseURL: "",
|
|
6
7
|
timeout: 1e4,
|
|
7
8
|
retry: 0,
|
|
8
9
|
retryDelay: 1e3,
|
|
9
10
|
headers: {
|
|
10
11
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
12
|
+
"X-CSRF-TOKEN": D(),
|
|
12
13
|
Accept: "application/json",
|
|
14
|
+
// Without this a guest fetch gets a 302 to the login page, never an auth status.
|
|
13
15
|
"X-Requested-With": "XMLHttpRequest"
|
|
14
16
|
},
|
|
15
|
-
...
|
|
16
|
-
},
|
|
17
|
+
...g
|
|
18
|
+
}, x = (e, r) => {
|
|
17
19
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
18
20
|
return e;
|
|
19
|
-
const t =
|
|
21
|
+
const t = r || E.baseURL || "";
|
|
20
22
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
21
|
-
}, P = (e) => new Promise((
|
|
23
|
+
}, P = (e) => new Promise((r, t) => {
|
|
22
24
|
setTimeout(() => {
|
|
23
25
|
t(new Error("Request timeout"));
|
|
24
26
|
}, e);
|
|
25
|
-
}),
|
|
26
|
-
setTimeout(
|
|
27
|
-
}), i = async (e,
|
|
28
|
-
|
|
29
|
-
const
|
|
27
|
+
}), R = (e) => new Promise((r) => {
|
|
28
|
+
setTimeout(r, e);
|
|
29
|
+
}), i = async (e, r, t, W = {}) => {
|
|
30
|
+
n.value = null, h.value = !0, c.value = new AbortController();
|
|
31
|
+
const a = { ...E, ...W }, p = x(r, a.baseURL), f = {
|
|
30
32
|
method: e,
|
|
31
|
-
headers: { ...
|
|
32
|
-
signal:
|
|
33
|
-
...
|
|
33
|
+
headers: { ...a.headers },
|
|
34
|
+
signal: c.value.signal,
|
|
35
|
+
...a
|
|
34
36
|
};
|
|
35
|
-
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete
|
|
36
|
-
const
|
|
37
|
+
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete f.headers["Content-Type"], f.body = t) : f.body = JSON.stringify(t));
|
|
38
|
+
const v = async (m = 0) => {
|
|
39
|
+
if (window.isSessionExpired)
|
|
40
|
+
throw n.value = { message: "Session expired" }, new Error("Session expired");
|
|
37
41
|
try {
|
|
38
|
-
const o = [fetch(
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const H = `HTTP Error: ${
|
|
43
|
-
throw
|
|
42
|
+
const o = [fetch(p, f)];
|
|
43
|
+
a.timeout && o.push(P(a.timeout));
|
|
44
|
+
const s = await Promise.race(o);
|
|
45
|
+
if (!s.ok) {
|
|
46
|
+
const H = `HTTP Error: ${s.status} ${s.statusText}`, u = new Error(H);
|
|
47
|
+
throw u.status = s.status, u.statusText = s.statusText, u.response = s, u.authReported = k.includes(s.status) && j(p), u.authReported && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((O) => X(
|
|
48
|
+
s.status,
|
|
49
|
+
O,
|
|
50
|
+
new URL(p, window.location.href).href
|
|
51
|
+
)).catch(() => {
|
|
52
|
+
}), u;
|
|
44
53
|
}
|
|
45
|
-
let
|
|
46
|
-
const l =
|
|
47
|
-
return l != null && l.includes("application/json") ?
|
|
48
|
-
data:
|
|
49
|
-
status:
|
|
50
|
-
statusText:
|
|
51
|
-
headers:
|
|
54
|
+
let d;
|
|
55
|
+
const l = s.headers.get("content-type");
|
|
56
|
+
return l != null && l.includes("application/json") ? d = await s.json() : l != null && l.includes("text/") ? d = await s.text() : d = await s.blob(), {
|
|
57
|
+
data: d,
|
|
58
|
+
status: s.status,
|
|
59
|
+
statusText: s.statusText,
|
|
60
|
+
headers: s.headers
|
|
52
61
|
};
|
|
53
62
|
} catch (o) {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
return await
|
|
57
|
-
throw o instanceof Error ? o.name === "AbortError" ?
|
|
63
|
+
const s = o instanceof Error && o.name === "AbortError";
|
|
64
|
+
if (m < (a.retry || 0) && !s)
|
|
65
|
+
return await R(a.retryDelay || 1e3), v(m + 1);
|
|
66
|
+
throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
|
|
58
67
|
}
|
|
59
68
|
};
|
|
60
69
|
try {
|
|
61
|
-
return await
|
|
70
|
+
return await v();
|
|
62
71
|
} finally {
|
|
63
|
-
|
|
72
|
+
h.value = !1, c.value = null;
|
|
64
73
|
}
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
74
|
+
}, A = (e, r) => i("GET", e, void 0, r), S = (e, r, t) => i("POST", e, r, t), U = (e, r, t) => i("PUT", e, r, t), C = (e, r, t) => i("PATCH", e, r, t), $ = (e, r) => i("DELETE", e, void 0, r), q = (e) => {
|
|
75
|
+
c.value && c.value.abort(e);
|
|
76
|
+
}, L = () => {
|
|
77
|
+
n.value = null;
|
|
69
78
|
};
|
|
70
79
|
return {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
error: T(() => a.value),
|
|
80
|
+
loading: b,
|
|
81
|
+
error: w(() => n.value),
|
|
74
82
|
hasError: y,
|
|
75
|
-
// Methods
|
|
76
83
|
request: i,
|
|
77
|
-
get:
|
|
78
|
-
post:
|
|
79
|
-
put:
|
|
80
|
-
patch:
|
|
81
|
-
delete:
|
|
82
|
-
cancel:
|
|
83
|
-
clearError:
|
|
84
|
+
get: A,
|
|
85
|
+
post: S,
|
|
86
|
+
put: U,
|
|
87
|
+
patch: C,
|
|
88
|
+
delete: $,
|
|
89
|
+
cancel: q,
|
|
90
|
+
clearError: L
|
|
84
91
|
};
|
|
85
92
|
};
|
|
86
93
|
export {
|
|
87
|
-
|
|
94
|
+
_ as useHttp
|
|
88
95
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useRecommendation as I } from "./useRecommendation.js";
|
|
2
|
+
import { useToaster as C } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as v } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
|
+
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
|
+
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
|
+
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
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
|
+
const F = () => {
|
|
12
|
+
const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
|
|
13
|
+
return { convertLegacyStrategy: async () => {
|
|
14
|
+
const t = e.currentRecommendationId;
|
|
15
|
+
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
|
+
return "";
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = R({
|
|
18
|
+
campaignId: r.campaignId,
|
|
19
|
+
templateLibraryId: r.templateLibraryId
|
|
20
|
+
}), S = T({
|
|
21
|
+
blockId: t,
|
|
22
|
+
url: m(String(t)),
|
|
23
|
+
campaignId: r.campaignId,
|
|
24
|
+
variationId: r.variationId,
|
|
25
|
+
strategy: d,
|
|
26
|
+
productIds: y,
|
|
27
|
+
target: s
|
|
28
|
+
});
|
|
29
|
+
let o;
|
|
30
|
+
try {
|
|
31
|
+
o = await e.convertLegacyStrategy(S, s);
|
|
32
|
+
} catch (n) {
|
|
33
|
+
return console.error("[useLegacyStrategyConversion] migration failed", n), i({
|
|
34
|
+
type: g.Error,
|
|
35
|
+
message: c("email-editor.legacy-strategy-update-failed")
|
|
36
|
+
}), "";
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
await e.fetchStrategyProductsForBlock(t);
|
|
40
|
+
} catch (n) {
|
|
41
|
+
console.error("[useLegacyStrategyConversion] product refetch failed", n);
|
|
42
|
+
}
|
|
43
|
+
const a = e.blockStates[t];
|
|
44
|
+
return a ? h(
|
|
45
|
+
t,
|
|
46
|
+
{
|
|
47
|
+
strategyId: o,
|
|
48
|
+
size: a.recommendationConfigs.size,
|
|
49
|
+
configVersion: L
|
|
50
|
+
},
|
|
51
|
+
a.recommendationProducts,
|
|
52
|
+
"Converted legacy recommendation strategy"
|
|
53
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
|
|
54
|
+
type: g.Error,
|
|
55
|
+
message: c("email-editor.legacy-strategy-update-failed")
|
|
56
|
+
}), "") : o;
|
|
57
|
+
} };
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
F as useLegacyStrategyConversion
|
|
61
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
3
|
+
import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
5
|
import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
6
|
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
7
|
import { useConfigStore as P } from "../stores/config.js";
|
|
8
8
|
const B = () => ({
|
|
9
9
|
calculateCardWidth: ({
|
|
10
|
-
mobileLeftPadding:
|
|
10
|
+
mobileLeftPadding: s,
|
|
11
11
|
mobileRightPadding: c,
|
|
12
|
-
cardsInRow:
|
|
13
|
-
unresponsive:
|
|
12
|
+
cardsInRow: o,
|
|
13
|
+
unresponsive: a
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return (C - e) /
|
|
15
|
+
const i = a ? o : 1, e = s + c + (i - 1) * R;
|
|
16
|
+
return (C - e) / i;
|
|
17
17
|
},
|
|
18
|
-
getRecommendationCampaignData: (
|
|
19
|
-
const c =
|
|
20
|
-
if (!
|
|
18
|
+
getRecommendationCampaignData: (s) => {
|
|
19
|
+
const c = g(), o = Number(s), a = c.blockStates[o];
|
|
20
|
+
if (!a)
|
|
21
21
|
return {
|
|
22
22
|
textTrimming: !1,
|
|
23
23
|
orientation: "vertical",
|
|
@@ -30,54 +30,59 @@ const B = () => ({
|
|
|
30
30
|
discountBeforeTextValue: "",
|
|
31
31
|
discountAfterTextValue: ""
|
|
32
32
|
};
|
|
33
|
-
const { recommendationConfigs:
|
|
33
|
+
const { recommendationConfigs: i } = a, e = i.orientation === "grid" ? "vertical" : "horizontal";
|
|
34
34
|
return {
|
|
35
|
-
textTrimming:
|
|
35
|
+
textTrimming: i.textTrimming,
|
|
36
36
|
orientation: e,
|
|
37
37
|
mobileLeftPadding: 0,
|
|
38
38
|
mobileRightPadding: 0,
|
|
39
|
-
cardsInRow:
|
|
40
|
-
unresponsive:
|
|
39
|
+
cardsInRow: i.cardsInRow,
|
|
40
|
+
unresponsive: i.unresponsive,
|
|
41
41
|
priceBeforeTextValue: "",
|
|
42
42
|
priceAfterTextValue: "",
|
|
43
43
|
discountBeforeTextValue: "",
|
|
44
44
|
discountAfterTextValue: ""
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
|
-
buildCampaignUrl: (
|
|
48
|
-
var
|
|
49
|
-
const
|
|
47
|
+
buildCampaignUrl: (s, c) => {
|
|
48
|
+
var l;
|
|
49
|
+
const o = g(), a = P(), i = Number(s);
|
|
50
50
|
let e;
|
|
51
51
|
if (c)
|
|
52
52
|
e = c;
|
|
53
53
|
else {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const r = o.blockStates[i];
|
|
55
|
+
if (!r)
|
|
56
56
|
return "";
|
|
57
|
-
const { recommendationConfigs:
|
|
57
|
+
const { recommendationConfigs: n } = r;
|
|
58
58
|
e = {
|
|
59
|
-
strategy:
|
|
60
|
-
strategyId:
|
|
61
|
-
language:
|
|
62
|
-
currencyCode:
|
|
63
|
-
size:
|
|
64
|
-
productIds:
|
|
65
|
-
filters:
|
|
66
|
-
shuffleProducts:
|
|
59
|
+
strategy: n.strategy,
|
|
60
|
+
strategyId: n.strategyId,
|
|
61
|
+
language: n.language,
|
|
62
|
+
currencyCode: n.currencySettings.value,
|
|
63
|
+
size: n.size,
|
|
64
|
+
productIds: n.productIds,
|
|
65
|
+
filters: n.filters,
|
|
66
|
+
shuffleProducts: n.shuffleProducts
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
if (e.strategyId &&
|
|
70
|
-
return
|
|
69
|
+
if (e.strategyId && a.isFeatureEnabled("reusableRecommendationStrategy"))
|
|
70
|
+
return o.recommendationCampaignUrls[s] = {
|
|
71
71
|
strategyId: e.strategyId,
|
|
72
72
|
locale: e.language,
|
|
73
73
|
currency: e.currencyCode
|
|
74
74
|
}, "";
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const d = ((l = y().find((r) => r.key === e.strategy)) == null ? void 0 : l.path) || "";
|
|
76
|
+
if (!d) {
|
|
77
|
+
const r = { ...o.recommendationCampaignUrls };
|
|
78
|
+
return delete r[s], o.recommendationCampaignUrls = r, "";
|
|
79
|
+
}
|
|
80
|
+
const t = new URLSearchParams();
|
|
81
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
82
|
+
const f = e.filters.filter((r) => r.isValid), m = b(f);
|
|
83
|
+
m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
|
|
84
|
+
const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
|
|
85
|
+
return o.recommendationCampaignUrls[s] = u, u;
|
|
81
86
|
}
|
|
82
87
|
});
|
|
83
88
|
export {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
1
|
+
import { useActionsApi as L } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as O } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as H } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
6
6
|
import { useModuleRepair as j } from "./useModuleRepair.js";
|
|
7
7
|
import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
|
|
8
8
|
import { useStripoNotifications as $ } from "./useStripoNotifications.js";
|
|
9
9
|
import { useToaster as G } from "./useToaster.js";
|
|
10
10
|
import { localePatch as J } from "../config/i18n/index.js";
|
|
11
|
-
import { en as
|
|
11
|
+
import { en as b } from "../config/i18n/en/index.js";
|
|
12
12
|
import { ToasterTypeOptions as X } from "../enums/toaster.js";
|
|
13
13
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
14
14
|
import Q from "../static/styles/customEditorStyle.css.js";
|
|
15
|
-
import { useEditorStore as
|
|
15
|
+
import { useEditorStore as k } from "../stores/editor.js";
|
|
16
16
|
import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
|
-
const
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } =
|
|
19
|
+
const he = () => {
|
|
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();
|
|
@@ -29,16 +29,16 @@ const Ce = () => {
|
|
|
29
29
|
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
|
-
}), n),
|
|
32
|
+
}), n), D = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e =
|
|
35
|
-
await window.UIEditor.initEditor(
|
|
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
|
+
w().importCss(), await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
39
|
html: d,
|
|
40
|
-
css:
|
|
41
|
-
forceRecreate:
|
|
40
|
+
css: R,
|
|
41
|
+
forceRecreate: I,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
44
44
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -52,7 +52,7 @@ const Ce = () => {
|
|
|
52
52
|
conditionsEnabled: S,
|
|
53
53
|
customConditionsEnabled: S,
|
|
54
54
|
enableXSSSecurity: !0,
|
|
55
|
-
modulesDisabled:
|
|
55
|
+
modulesDisabled: U,
|
|
56
56
|
syncModulesEnabled: r,
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
@@ -62,7 +62,7 @@ const Ce = () => {
|
|
|
62
62
|
displayUTM: !1,
|
|
63
63
|
selectElementAfterDrop: !0,
|
|
64
64
|
sameFontSizeForOutlook: !0,
|
|
65
|
-
allowedScriptSourceDomains:
|
|
65
|
+
allowedScriptSourceDomains: q,
|
|
66
66
|
...g ? { baseBlocks: g } : {},
|
|
67
67
|
editorFonts: {
|
|
68
68
|
showDefaultStandardFonts: !0,
|
|
@@ -80,7 +80,7 @@ const Ce = () => {
|
|
|
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");
|
|
@@ -88,8 +88,8 @@ const Ce = () => {
|
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const {
|
|
92
|
-
|
|
91
|
+
const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = L(), { injectFullStory: x } = N();
|
|
92
|
+
w().importCss(), t(), x(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
93
|
e.hasChanges = !1;
|
|
94
94
|
}, 1e3);
|
|
95
95
|
} catch (t) {
|
|
@@ -108,34 +108,34 @@ const Ce = () => {
|
|
|
108
108
|
onDataChanged() {
|
|
109
109
|
e.hasChanges = !0, e.changeSeq += 1;
|
|
110
110
|
},
|
|
111
|
-
onEvent:
|
|
112
|
-
onModuleAdd:
|
|
113
|
-
notifications:
|
|
111
|
+
onEvent: F,
|
|
112
|
+
onModuleAdd: A,
|
|
113
|
+
notifications: _(),
|
|
114
114
|
ignoreClickOutsideSelectors: [
|
|
115
115
|
"#guido-dynamic-content-modal",
|
|
116
116
|
".in-on-board-wrapper",
|
|
117
117
|
".in-drawer__container"
|
|
118
118
|
],
|
|
119
|
-
extensions:
|
|
119
|
+
extensions: P,
|
|
120
120
|
localePatch: J
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
return { initPlugin: async (i, s, o) => {
|
|
125
|
-
const a =
|
|
125
|
+
const a = k();
|
|
126
126
|
try {
|
|
127
127
|
await f();
|
|
128
128
|
const [r, e] = await Promise.all([
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
131
131
|
]);
|
|
132
|
-
a.syncModulesEnabled = e, await
|
|
132
|
+
a.syncModulesEnabled = e, await D(i, s, o, r, e);
|
|
133
133
|
} catch {
|
|
134
|
-
a.loadingStatus = !1,
|
|
134
|
+
a.loadingStatus = !1, B({
|
|
135
135
|
type: X.Error,
|
|
136
|
-
message:
|
|
136
|
+
message: b["An error has occurred. Please report the error code to support."],
|
|
137
137
|
actionButton: {
|
|
138
|
-
text:
|
|
138
|
+
text: b["Reload page"],
|
|
139
139
|
onClick: () => window.location.reload()
|
|
140
140
|
}
|
|
141
141
|
});
|
|
@@ -146,5 +146,5 @@ const Ce = () => {
|
|
|
146
146
|
} };
|
|
147
147
|
};
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
he as useStripo
|
|
150
150
|
};
|
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
|
-
import { useToasterStore as
|
|
3
|
-
import {
|
|
4
|
-
const p = () => {
|
|
5
|
-
const o =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
t && (clearTimeout(t), t = null);
|
|
2
|
+
import { useToasterStore as u } from "../stores/toaster.js";
|
|
3
|
+
import { nextTick as c } from "vue";
|
|
4
|
+
const s = /* @__PURE__ */ new WeakMap(), p = () => {
|
|
5
|
+
const t = u(), o = () => {
|
|
6
|
+
const e = s.get(t);
|
|
7
|
+
e && (clearTimeout(e), s.delete(t));
|
|
9
8
|
};
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
function i(e = { message: "" }) {
|
|
10
|
+
o(), t.hideToaster(), c(() => {
|
|
11
|
+
t.showToaster(e), t.shouldAutoHide && s.set(t, setTimeout(() => {
|
|
12
|
+
t.hideToaster(), o();
|
|
13
|
+
}, 6e3));
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
16
|
+
function n() {
|
|
17
|
+
o(), t.hideToaster();
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function a(e, r) {
|
|
20
|
+
if (e != null && e.authReported)
|
|
21
|
+
return;
|
|
19
22
|
const m = e instanceof Error ? e.message : String(e);
|
|
20
|
-
|
|
23
|
+
i({ type: T.Error, message: `${r}: ${m}` });
|
|
21
24
|
}
|
|
22
|
-
return
|
|
23
|
-
() => o.shouldAutoHide,
|
|
24
|
-
(e) => {
|
|
25
|
-
s(), e && (t = setTimeout(() => {
|
|
26
|
-
o.hideToaster(), s();
|
|
27
|
-
}, 6e3));
|
|
28
|
-
}
|
|
29
|
-
), { showToaster: r, hideToaster: i, handleError: n };
|
|
25
|
+
return { showToaster: i, hideToaster: n, handleError: a };
|
|
30
26
|
};
|
|
31
27
|
export {
|
|
32
28
|
p as useToaster
|
|
@@ -6,9 +6,10 @@ import { useConfig } from "./useConfig.js";
|
|
|
6
6
|
const useTranslations = () => {
|
|
7
7
|
var o, e;
|
|
8
8
|
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
-
|
|
9
|
+
var s;
|
|
10
|
+
const r = (s = translations.value) == null ? void 0 : s[t];
|
|
10
11
|
return r ? n ? Object.entries(n).reduce(
|
|
11
|
-
(
|
|
12
|
+
(i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
|
|
12
13
|
r
|
|
13
14
|
) : r : (console.warn(`Translation key not found: ${t}`), t);
|
|
14
15
|
};
|
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
import { ToasterTypeOptions as t } from "../enums/toaster.js";
|
|
2
|
-
import { useVersionHistoryStore as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useVersionHistoryStore as m } from "../stores/version-history.js";
|
|
3
|
+
import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
|
|
4
|
+
import { useToaster as V } from "./useToaster.js";
|
|
5
|
+
const d = () => {
|
|
6
|
+
const n = m(), { showToaster: i } = V(), o = (e) => {
|
|
7
|
+
var s;
|
|
8
|
+
const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
|
|
9
|
+
if (!r) {
|
|
10
|
+
i({ type: t.Error, message: y });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
e(r);
|
|
14
|
+
}, p = (e) => {
|
|
15
|
+
n.$reset(), n.updateState(e);
|
|
16
|
+
}, a = () => {
|
|
17
|
+
n.$reset();
|
|
9
18
|
};
|
|
10
19
|
return {
|
|
11
20
|
openVersionHistory: () => {
|
|
12
|
-
|
|
21
|
+
o((e) => e.openVersionHistory(p, a));
|
|
13
22
|
},
|
|
14
23
|
closeVersionHistory: () => {
|
|
15
|
-
|
|
24
|
+
o((e) => e.closeVersionHistory());
|
|
16
25
|
},
|
|
17
26
|
switchToDesktopPreview: () => {
|
|
18
|
-
|
|
27
|
+
o((e) => e.switchToDesktopPreview());
|
|
19
28
|
},
|
|
20
29
|
switchToMobilePreview: () => {
|
|
21
|
-
|
|
30
|
+
o((e) => e.switchToMobilePreview());
|
|
22
31
|
},
|
|
23
32
|
previewVersion: (e) => {
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
o((r) => r.previewVersion(e, (s) => {
|
|
34
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
35
|
+
i({
|
|
27
36
|
type: t.Error,
|
|
28
|
-
message: `Error compiling email: ${
|
|
37
|
+
message: `Error compiling email: ${c}`
|
|
29
38
|
});
|
|
30
|
-
});
|
|
39
|
+
}));
|
|
31
40
|
},
|
|
32
41
|
restoreVersion: (e) => {
|
|
33
|
-
|
|
42
|
+
o((r) => r.restoreVersion(
|
|
34
43
|
e,
|
|
35
44
|
() => {
|
|
36
|
-
|
|
45
|
+
i({
|
|
37
46
|
type: t.Success,
|
|
38
47
|
message: "Your version has been restored successfully."
|
|
39
48
|
});
|
|
40
49
|
},
|
|
41
|
-
(
|
|
42
|
-
const
|
|
43
|
-
|
|
50
|
+
(s) => {
|
|
51
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
52
|
+
i({
|
|
44
53
|
type: t.Error,
|
|
45
|
-
message: `Error compiling email: ${
|
|
54
|
+
message: `Error compiling email: ${c}`
|
|
46
55
|
});
|
|
47
56
|
}
|
|
48
|
-
);
|
|
57
|
+
));
|
|
49
58
|
}
|
|
50
59
|
};
|
|
51
60
|
};
|
|
52
61
|
export {
|
|
53
|
-
|
|
62
|
+
d as useVersionHistoryApi
|
|
54
63
|
};
|