@useinsider/guido 3.21.0-beta.f049776 → 3.21.0-beta.ff98fc3
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/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +118 -108
- package/dist/composables/useEditorOpenMetrics.js +159 -0
- package/dist/composables/useStripo.js +86 -80
- package/dist/config/migrator/index.js +9 -10
- package/dist/extensions/Blocks/Recommendation/block.js +209 -139
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +52 -31
- package/dist/guido.css +1 -1
- package/dist/package.json.js +6 -4
- package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +23 -7
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +11 -0
- package/package.json +1 -1
- package/dist/config/migrator/couponBlockAlignmentMigrator.js +0 -43
- package/dist/src/config/migrator/couponBlockAlignmentMigrator.d.ts +0 -1
|
@@ -6,15 +6,15 @@ var t = function() {
|
|
|
6
6
|
return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), r(e.AutoSaveController), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.AuthErrorModal), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isSaveValidationEnabled ? r(e.ValidationErrorDrawer) : a._e(), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
|
|
7
7
|
return e.emit("onboarding:finished");
|
|
8
8
|
} } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
|
|
9
|
-
}, s = [],
|
|
9
|
+
}, s = [], d = /* @__PURE__ */ i(
|
|
10
10
|
o,
|
|
11
11
|
t,
|
|
12
12
|
s,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"1a3ddd48"
|
|
16
16
|
);
|
|
17
|
-
const v =
|
|
17
|
+
const v = d.exports;
|
|
18
18
|
export {
|
|
19
19
|
v as default
|
|
20
20
|
};
|
|
@@ -1,179 +1,189 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import Re from "./organisms/
|
|
21
|
-
import
|
|
22
|
-
import Le from "./organisms/
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
1
|
+
import { defineComponent as de, defineAsyncComponent as l, ref as W, computed as f, watch as G, onMounted as me, onUnmounted as le } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as ue } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { useEditorLock as pe } from "../composables/useEditorLock.js";
|
|
4
|
+
import { startEditorOpenMetrics as fe } from "../composables/useEditorOpenMetrics.js";
|
|
5
|
+
import { provideGuidoActions as ye } from "../composables/useGuidoActions.js";
|
|
6
|
+
import { useGuidoStateBridge as ge } from "../composables/useGuidoStateBridge.js";
|
|
7
|
+
import { usePartner as ve } from "../composables/usePartner.js";
|
|
8
|
+
import { useSaveValidationRollout as Se } from "../composables/useSaveValidationRollout.js";
|
|
9
|
+
import { useStripo as be } from "../composables/useStripo.js";
|
|
10
|
+
import { useTimerClone as he } from "../composables/useTimerClone.js";
|
|
11
|
+
import { migrate as Ee } from "../config/migrator/index.js";
|
|
12
|
+
import { ModuleFolderDefaults as H } from "../enums/defaults.js";
|
|
13
|
+
import { RIBBON_SELECTOR as we } from "../enums/onboarding.js";
|
|
14
|
+
import { useRecommendationExtensionStore as V, disposeStrategyPageReturnListeners as ke } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
15
|
+
import { disposeUnsubscribeListeners as Ce } from "../extensions/Blocks/Unsubscribe/block.js";
|
|
16
|
+
import De from "./organisms/AutoSaveController.vue.js";
|
|
17
|
+
import Ie from "./organisms/base/AuthErrorModal.vue.js";
|
|
18
|
+
import Fe from "./organisms/base/Toaster.vue.js";
|
|
19
|
+
import Me from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
20
|
+
import Re from "./organisms/header/HeaderWrapper.vue.js";
|
|
21
|
+
import Te from "./organisms/LoadingWrapper.vue.js";
|
|
22
|
+
import Le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
23
|
+
import Ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
24
|
+
import Ne from "./organisms/validation/ValidationErrorDrawer.vue.js";
|
|
25
|
+
import { useStripoApi as _e } from "../services/stripoApi.js";
|
|
26
|
+
import { useConfigStore as Ae } from "../stores/config.js";
|
|
27
|
+
import { useDynamicContentStore as Be } from "../stores/dynamic-content.js";
|
|
28
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
29
|
+
import { usePreviewStore as Oe } from "../stores/preview.js";
|
|
30
|
+
import { useSaveValidationStore as Pe } from "../stores/save-validation.js";
|
|
31
|
+
import { useTemplateStore as xe } from "../stores/template.js";
|
|
32
|
+
import { useUnsubscribeStore as We } from "../stores/unsubscribe.js";
|
|
33
|
+
import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
|
|
34
|
+
const ht = /* @__PURE__ */ de({
|
|
34
35
|
__name: "Guido",
|
|
35
36
|
props: {
|
|
36
37
|
config: null,
|
|
37
38
|
ready: { type: Boolean, default: !0 }
|
|
38
39
|
},
|
|
39
40
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
40
|
-
setup(
|
|
41
|
-
const s =
|
|
41
|
+
setup(z, { expose: q, emit: n }) {
|
|
42
|
+
const s = z, a = fe(), K = l(
|
|
42
43
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
43
|
-
),
|
|
44
|
+
), j = l(
|
|
44
45
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
45
|
-
),
|
|
46
|
+
), J = l(
|
|
46
47
|
() => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
|
|
47
|
-
),
|
|
48
|
+
), Q = l(
|
|
48
49
|
() => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
|
|
49
|
-
),
|
|
50
|
+
), X = l(
|
|
50
51
|
() => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
|
|
51
|
-
),
|
|
52
|
+
), k = W(), y = W(), g = Be(), C = We(), o = Ae();
|
|
52
53
|
s.ready && o.init(s.config);
|
|
53
|
-
const
|
|
54
|
+
const d = w(), Y = Oe(), u = f(() => d.hasChanges), { isTestPartner: Z } = ve(), { isEnabled: ee, loadRollout: D } = Se(), I = () => {
|
|
54
55
|
var t;
|
|
55
|
-
return (t =
|
|
56
|
-
},
|
|
57
|
-
|
|
56
|
+
return (t = k.value) == null ? void 0 : t.handleSave(!0);
|
|
57
|
+
}, F = (t) => {
|
|
58
|
+
d.loadingStatus = t;
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
-
const
|
|
60
|
+
ue(), ge();
|
|
61
|
+
const v = () => {
|
|
61
62
|
var t, e;
|
|
62
63
|
return {
|
|
63
64
|
emailId: o.templateId,
|
|
64
65
|
userId: o.userId,
|
|
65
66
|
username: o.username,
|
|
66
67
|
partnerName: o.partnerName,
|
|
67
|
-
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) ||
|
|
68
|
-
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) ||
|
|
68
|
+
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || H.SAVED_MODULES,
|
|
69
|
+
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || H.DEFAULT_MODULES
|
|
69
70
|
};
|
|
70
|
-
}, { initPlugin:
|
|
71
|
-
let
|
|
72
|
-
const { getDefaultTemplate:
|
|
71
|
+
}, { initPlugin: M, preloadRuntime: R } = be(), { runExclusive: T, beginMount: L, isCurrentMount: S } = pe();
|
|
72
|
+
let p = 0;
|
|
73
|
+
const { getDefaultTemplate: U } = _e(), { cloneTimersOnSave: N, hasTimerBlocks: _ } = he(), te = f(() => {
|
|
73
74
|
var t;
|
|
74
75
|
return !((t = o.ui) != null && t.showHeader);
|
|
75
|
-
}),
|
|
76
|
-
() => !!
|
|
76
|
+
}), oe = f(() => o.isFeatureEnabled("reusableRecommendationStrategy")), re = f(
|
|
77
|
+
() => !!V().recommendationConfigs.strategyId
|
|
77
78
|
);
|
|
78
|
-
|
|
79
|
+
ye({
|
|
79
80
|
onBack: () => {
|
|
80
|
-
console.debug("guido:back"),
|
|
81
|
+
console.debug("guido:back"), n("back");
|
|
81
82
|
},
|
|
82
83
|
onSaveStart: () => {
|
|
83
|
-
console.debug("guido:save:start"),
|
|
84
|
+
console.debug("guido:save:start"), n("save:start");
|
|
84
85
|
},
|
|
85
86
|
onSaveComplete: (t) => {
|
|
86
|
-
const e = { ...t, metadata:
|
|
87
|
-
console.debug("guido:save:complete", e),
|
|
87
|
+
const e = { ...t, metadata: v() };
|
|
88
|
+
console.debug("guido:save:complete", e), n("save:complete", e);
|
|
88
89
|
},
|
|
89
90
|
onTestEmailClick: () => {
|
|
90
|
-
console.debug("guido:test-email:click"),
|
|
91
|
+
console.debug("guido:test-email:click"), n("test-email:click");
|
|
91
92
|
}
|
|
92
93
|
});
|
|
93
|
-
const
|
|
94
|
-
console.debug("dynamic-content:close", t),
|
|
95
|
-
},
|
|
94
|
+
const A = (t) => {
|
|
95
|
+
console.debug("dynamic-content:close", t), g.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
96
|
+
}, B = () => {
|
|
96
97
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
97
98
|
};
|
|
98
|
-
G(() =>
|
|
99
|
-
|
|
99
|
+
G(() => u.value, () => {
|
|
100
|
+
n("on-change", u.value);
|
|
100
101
|
});
|
|
101
|
-
const
|
|
102
|
-
const e = t, { attribute:
|
|
103
|
-
console.debug("dynamic-content:open", e.detail),
|
|
102
|
+
const b = (t) => {
|
|
103
|
+
const e = t, { attribute: i, position: m } = e.detail;
|
|
104
|
+
console.debug("dynamic-content:open", e.detail), n("dynamic-content:open", i, m);
|
|
104
105
|
};
|
|
105
|
-
let
|
|
106
|
-
const
|
|
106
|
+
let c = null;
|
|
107
|
+
const h = () => {
|
|
107
108
|
var e;
|
|
108
|
-
const t = document.querySelector(
|
|
109
|
-
(e =
|
|
110
|
-
},
|
|
109
|
+
const t = document.querySelector(we);
|
|
110
|
+
(e = y.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
111
|
+
}, E = async () => {
|
|
111
112
|
var t;
|
|
113
|
+
a.mark("host_ready");
|
|
112
114
|
try {
|
|
113
|
-
o.initialized || o.init(s.config),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
o.initialized || o.init(s.config), d.templateId = o.templateId, a.setContext({
|
|
116
|
+
partnerName: o.partnerName,
|
|
117
|
+
productType: o.productType,
|
|
118
|
+
templateId: o.templateId,
|
|
119
|
+
variationId: o.variationId
|
|
120
|
+
});
|
|
121
|
+
const e = o.template, i = (e == null ? void 0 : e.html) || "", m = (e == null ? void 0 : e.css) || "", O = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
122
|
+
C.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
123
|
+
const ne = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, P = o.isFeatureEnabled("linkTrackingIds"), ae = {
|
|
117
124
|
partnerName: o.partnerName,
|
|
118
125
|
campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
|
|
119
126
|
rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
|
|
127
|
+
}, x = (ce) => a.timed(
|
|
128
|
+
"migration",
|
|
129
|
+
() => Ee(ce, ne, ae)
|
|
130
|
+
);
|
|
131
|
+
let r = {
|
|
132
|
+
html: i && await x(i),
|
|
133
|
+
css: m
|
|
120
134
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
n.html || (n = await I(), n.html = await V(n.html, _, x));
|
|
126
|
-
const ae = O ? H(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
|
|
127
|
-
A(n.html) && (n.html = await U(n.html)), O && (c.trackIdSessionFloor = Math.max(ae, H(n.html)));
|
|
135
|
+
r.html || (r = await a.timed("default_template", () => U()), r.html = await x(r.html));
|
|
136
|
+
const ie = P ? $(r.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
|
|
137
|
+
_(r.html) && (r.html = await a.timed("timer_clone", () => N(r.html))), P && (d.trackIdSessionFloor = Math.max(ie, $(r.html)));
|
|
128
138
|
const se = {
|
|
129
|
-
preselectedDynamicContentList:
|
|
139
|
+
preselectedDynamicContentList: O,
|
|
130
140
|
onReady: () => {
|
|
131
|
-
console.debug("guido:ready"),
|
|
141
|
+
console.debug("guido:ready"), n("ready");
|
|
132
142
|
}
|
|
133
143
|
};
|
|
134
|
-
|
|
144
|
+
p = L(), await M(r, v(), se), g.selectedDynamicContentList = O;
|
|
135
145
|
} catch (e) {
|
|
136
|
-
console.error("Failed to initialize Stripo editor:", e);
|
|
146
|
+
console.error("Failed to initialize Stripo editor:", e), a.markFailed();
|
|
137
147
|
}
|
|
138
148
|
};
|
|
139
|
-
return
|
|
149
|
+
return me(async () => {
|
|
140
150
|
var e;
|
|
141
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
142
|
-
const t = (e =
|
|
143
|
-
if (t && (
|
|
144
|
-
await
|
|
151
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), V().$reset(), w().$reset(), xe().$reset(), Pe().$reset(), D(), h();
|
|
152
|
+
const t = (e = y.value) == null ? void 0 : e.parentElement;
|
|
153
|
+
if (t && (c = new ResizeObserver(h), c.observe(t)), R(), s.ready)
|
|
154
|
+
await E();
|
|
145
155
|
else {
|
|
146
|
-
const
|
|
147
|
-
|
|
156
|
+
const i = G(() => s.ready, (m) => {
|
|
157
|
+
m && (i(), E());
|
|
148
158
|
});
|
|
149
159
|
}
|
|
150
|
-
document.addEventListener("dynamic-content:open",
|
|
151
|
-
}),
|
|
152
|
-
if (
|
|
160
|
+
document.addEventListener("dynamic-content:open", b);
|
|
161
|
+
}), le(() => {
|
|
162
|
+
if (Ce(), ke(), a.dispose(), c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b), S(p))
|
|
153
163
|
try {
|
|
154
|
-
|
|
164
|
+
w().isStripoInitialized = !1;
|
|
155
165
|
} catch (t) {
|
|
156
166
|
console.debug("Failed to close the editor readiness gate on unmount", t);
|
|
157
167
|
}
|
|
158
|
-
|
|
159
|
-
if (S(
|
|
168
|
+
T(async () => {
|
|
169
|
+
if (S(p))
|
|
160
170
|
try {
|
|
161
171
|
window.UIEditor.removeEditor();
|
|
162
172
|
} catch {
|
|
163
173
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
164
174
|
}
|
|
165
175
|
}), o.reset();
|
|
166
|
-
}),
|
|
176
|
+
}), q({
|
|
167
177
|
dynamicContent: {
|
|
168
|
-
insert:
|
|
169
|
-
close:
|
|
178
|
+
insert: A,
|
|
179
|
+
close: B
|
|
170
180
|
},
|
|
171
|
-
hasChanges:
|
|
172
|
-
saveSilent:
|
|
173
|
-
setLoading:
|
|
174
|
-
}), { __sfc: !0, PreviewContainer:
|
|
181
|
+
hasChanges: u,
|
|
182
|
+
saveSilent: I,
|
|
183
|
+
setLoading: F
|
|
184
|
+
}), { __sfc: !0, openMetrics: a, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: k, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: C, props: s, configStore: o, editorStore: d, previewStore: Y, hasChanges: u, isTestPartner: Z, isSaveValidationEnabled: ee, loadRollout: D, saveSilent: I, setLoading: F, emit: n, buildMetadata: v, initPlugin: M, preloadRuntime: R, runExclusive: T, beginMount: L, isCurrentMount: S, mountGeneration: p, getDefaultTemplate: U, cloneTimersOnSave: N, hasTimerBlocks: _, noHeader: te, isRrsEnabled: oe, hasAssignedStrategy: re, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: b, ribbonObserver: c, updateRibbonOffset: h, startEditor: E, AutoSaveController: De, AuthErrorModal: Ie, Toaster: Fe, FilterSelectionDrawer: Me, HeaderWrapper: Re, LoadingWrapper: Te, SaveAsTemplateDrawer: Le, UnsubscribeWrapper: Ue, ValidationErrorDrawer: Ne };
|
|
175
185
|
}
|
|
176
186
|
});
|
|
177
187
|
export {
|
|
178
|
-
|
|
188
|
+
ht as default
|
|
179
189
|
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { SYNC_MODULE_CLASS as S } from "./useSyncModuleExtractor.js";
|
|
2
|
+
import g from "../package.json.js";
|
|
3
|
+
const s = "guido:open:", b = "total", P = [
|
|
4
|
+
"setup",
|
|
5
|
+
"host_ready",
|
|
6
|
+
"migration_start",
|
|
7
|
+
"migration_end",
|
|
8
|
+
"default_template_start",
|
|
9
|
+
"default_template_end",
|
|
10
|
+
"timer_clone_start",
|
|
11
|
+
"timer_clone_end",
|
|
12
|
+
"plugin_start",
|
|
13
|
+
"script_ready",
|
|
14
|
+
"fonts_sync_ready",
|
|
15
|
+
"blocks_config_ready",
|
|
16
|
+
"init_editor",
|
|
17
|
+
"token_start",
|
|
18
|
+
"token_end",
|
|
19
|
+
"ready"
|
|
20
|
+
], p = [
|
|
21
|
+
["host_wait", "setup", "host_ready"],
|
|
22
|
+
["migration", "migration_start", "migration_end"],
|
|
23
|
+
["default_template", "default_template_start", "default_template_end"],
|
|
24
|
+
["timer_clone", "timer_clone_start", "timer_clone_end"],
|
|
25
|
+
["script", "plugin_start", "script_ready"],
|
|
26
|
+
["fonts_sync", "script_ready", "fonts_sync_ready"],
|
|
27
|
+
["blocks_config", "fonts_sync_ready", "blocks_config_ready"],
|
|
28
|
+
["editor_config", "blocks_config_ready", "init_editor"],
|
|
29
|
+
["stripo_load", "init_editor", "ready"],
|
|
30
|
+
["token", "token_start", "token_end"]
|
|
31
|
+
], h = (e) => new RegExp(`(?:^|[\\s"'])(?:${e})(?=[\\s"'])`, "g"), A = /<img\b/gi, N = h(S), $ = /\srecommendation-id=/g, C = h("items-block-v2|esd-(?:cart|browsed|purchased)-items-block"), O = "esd-timer-id", f = {
|
|
32
|
+
html_bytes: null,
|
|
33
|
+
css_bytes: null,
|
|
34
|
+
image_count: null,
|
|
35
|
+
synced_module_count: null,
|
|
36
|
+
recommendation_block_count: null,
|
|
37
|
+
items_block_count: null,
|
|
38
|
+
has_timers: null,
|
|
39
|
+
force_recreate: null
|
|
40
|
+
};
|
|
41
|
+
let c = null;
|
|
42
|
+
const d = (e) => {
|
|
43
|
+
try {
|
|
44
|
+
e();
|
|
45
|
+
} catch (t) {
|
|
46
|
+
console.debug("guido:open: metrics step failed", t);
|
|
47
|
+
}
|
|
48
|
+
}, E = () => window.DD_RUM, y = (e, t) => e === void 0 || t === void 0 ? null : Math.round(t - e), _ = (e, t) => {
|
|
49
|
+
var r;
|
|
50
|
+
return ((r = e.match(t)) == null ? void 0 : r.length) ?? 0;
|
|
51
|
+
}, k = (e) => new TextEncoder().encode(e).length, I = (e) => {
|
|
52
|
+
if (!e)
|
|
53
|
+
return f;
|
|
54
|
+
try {
|
|
55
|
+
const { html: t, css: r, forceRecreate: o } = e;
|
|
56
|
+
return {
|
|
57
|
+
html_bytes: k(t),
|
|
58
|
+
css_bytes: k(r),
|
|
59
|
+
image_count: _(t, A),
|
|
60
|
+
synced_module_count: _(t, N),
|
|
61
|
+
recommendation_block_count: _(t, $),
|
|
62
|
+
items_block_count: _(t, C),
|
|
63
|
+
has_timers: t.includes(O),
|
|
64
|
+
force_recreate: o
|
|
65
|
+
};
|
|
66
|
+
} catch (t) {
|
|
67
|
+
return console.debug("guido:open: template weight failed", t), f;
|
|
68
|
+
}
|
|
69
|
+
}, T = () => {
|
|
70
|
+
d(() => {
|
|
71
|
+
P.forEach((e) => performance.clearMarks(`${s}${e}`)), [...p.map(([e]) => e), b].forEach((e) => performance.clearMeasures(`${s}${e}`));
|
|
72
|
+
});
|
|
73
|
+
}, v = (e) => {
|
|
74
|
+
const t = {
|
|
75
|
+
marks: {},
|
|
76
|
+
context: null,
|
|
77
|
+
template: null,
|
|
78
|
+
scriptPreloaded: null,
|
|
79
|
+
wasBackgrounded: document.visibilityState === "hidden",
|
|
80
|
+
finished: e,
|
|
81
|
+
onVisibilityChange: () => {
|
|
82
|
+
document.visibilityState === "hidden" && (t.wasBackgrounded = !0);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return t;
|
|
86
|
+
}, l = (e, t) => {
|
|
87
|
+
if (e.finished || e.marks[t] !== void 0)
|
|
88
|
+
return;
|
|
89
|
+
const r = performance.now();
|
|
90
|
+
e.marks[t] = r, e === c && d(() => performance.mark(`${s}${t}`, { startTime: r }));
|
|
91
|
+
}, u = (e) => {
|
|
92
|
+
e.finished = !0, document.removeEventListener("visibilitychange", e.onVisibilityChange);
|
|
93
|
+
}, L = (e, t) => {
|
|
94
|
+
const { marks: r } = e, o = p.map(([n, a, i]) => [n, r[a], r[i]]);
|
|
95
|
+
o.push([b, r.setup, t]), o.forEach(([n, a, i]) => {
|
|
96
|
+
a !== void 0 && i !== void 0 && d(() => performance.measure(`${s}${n}`, { start: a, end: i }));
|
|
97
|
+
});
|
|
98
|
+
}, B = (e, t, r) => {
|
|
99
|
+
const { marks: o, context: n } = e, a = Object.fromEntries(
|
|
100
|
+
p.map(([i, M, R]) => [`${i}_ms`, y(o[M], o[R])])
|
|
101
|
+
);
|
|
102
|
+
return {
|
|
103
|
+
outcome: t,
|
|
104
|
+
open_ms: y(o.setup, r),
|
|
105
|
+
...a,
|
|
106
|
+
script_preloaded: e.scriptPreloaded,
|
|
107
|
+
...I(e.template),
|
|
108
|
+
partner_name: (n == null ? void 0 : n.partnerName) ?? null,
|
|
109
|
+
product_type: (n == null ? void 0 : n.productType) ?? null,
|
|
110
|
+
template_id: (n == null ? void 0 : n.templateId) ?? null,
|
|
111
|
+
variation_id: (n == null ? void 0 : n.variationId) ?? null,
|
|
112
|
+
guido_version: g.version,
|
|
113
|
+
stripo_version: g.guido.stripo.version,
|
|
114
|
+
was_backgrounded: e.wasBackgrounded
|
|
115
|
+
};
|
|
116
|
+
}, m = (e, t) => {
|
|
117
|
+
d(() => {
|
|
118
|
+
const r = e.marks.ready ?? performance.now(), o = B(e, t, r);
|
|
119
|
+
e.template = null, e === c && L(e, r), console.debug("guido:open", o), d(() => {
|
|
120
|
+
var n, a;
|
|
121
|
+
return (a = (n = E()) == null ? void 0 : n.addAction) == null ? void 0 : a.call(n, "guido_editor_open", o);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}, w = (e) => ({
|
|
125
|
+
mark: (t) => l(e, t),
|
|
126
|
+
timed: async (t, r) => {
|
|
127
|
+
l(e, `${t}_start`);
|
|
128
|
+
const o = await r();
|
|
129
|
+
return l(e, `${t}_end`), o;
|
|
130
|
+
},
|
|
131
|
+
setContext: (t) => {
|
|
132
|
+
e.context = t;
|
|
133
|
+
},
|
|
134
|
+
setTemplate: (t) => {
|
|
135
|
+
e.template = t;
|
|
136
|
+
},
|
|
137
|
+
setScriptPreloaded: (t) => {
|
|
138
|
+
e.scriptPreloaded = t;
|
|
139
|
+
},
|
|
140
|
+
markReady: () => {
|
|
141
|
+
e.finished || (l(e, "ready"), u(e), d(() => {
|
|
142
|
+
var t, r;
|
|
143
|
+
return (r = (t = E()) == null ? void 0 : t.addTiming) == null ? void 0 : r.call(t, "guido_editor_ready");
|
|
144
|
+
}), setTimeout(() => m(e, "ready"), 0));
|
|
145
|
+
},
|
|
146
|
+
markFailed: () => {
|
|
147
|
+
e.finished || (u(e), m(e, "error"));
|
|
148
|
+
},
|
|
149
|
+
dispose: () => {
|
|
150
|
+
e.finished || (u(e), m(e, "abandoned")), e === c && (T(), c = null);
|
|
151
|
+
}
|
|
152
|
+
}), U = () => {
|
|
153
|
+
const e = v(!1);
|
|
154
|
+
return T(), c = e, document.addEventListener("visibilitychange", e.onVisibilityChange), l(e, "setup"), w(e);
|
|
155
|
+
}, V = () => w(c ?? v(!0));
|
|
156
|
+
export {
|
|
157
|
+
U as startEditorOpenMetrics,
|
|
158
|
+
V as useEditorOpenMetrics
|
|
159
|
+
};
|