@useinsider/guido 1.0.3-beta.dfb1fcf → 1.0.3-beta.e1adf59
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 -144
- package/dist/components/Guido.vue.js +10 -12
- package/dist/components/Guido.vue2.js +101 -84
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +15 -16
- package/dist/components/organisms/header/RightSlot.vue.js +11 -11
- package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
- package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +9 -9
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +17 -30
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +10 -12
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -19
- package/dist/composables/useApiErrorTracking.js +120 -0
- package/dist/composables/useErrorTracking.js +98 -0
- package/dist/composables/useGuidoActions.js +9 -19
- package/dist/composables/useHttp.js +89 -52
- package/dist/composables/useStripo.js +163 -66
- package/dist/composables/useStripoErrorCategory.js +86 -0
- package/dist/composables/useStripoSlackNotifier.js +47 -0
- package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
- package/dist/config/migrator/index.js +6 -7
- package/dist/enums/defaults.js +8 -16
- package/dist/enums/onboarding.js +1 -2
- package/dist/enums/unsubscribe.js +25 -27
- package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +3 -6
- package/dist/extensions/Blocks/Recommendation/control.js +65 -109
- package/dist/extensions/Blocks/Recommendation/extension.js +7 -18
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -159
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
- package/dist/extensions/Blocks/Recommendation/template.js +200 -0
- package/dist/extensions/Blocks/common-control.js +43 -125
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
- package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +100 -312
- package/dist/package.json.js +1 -1
- package/dist/services/slackNotificationService.js +167 -0
- package/dist/services/stripoApi.js +49 -19
- package/dist/services/stripoErrorDeduplicationService.js +91 -0
- package/dist/src/@types/generic.d.ts +6 -42
- package/dist/src/components/Guido.vue.d.ts +3 -4
- package/dist/src/components/organisms/onboarding/NewVersionPopup.vue.d.ts +1 -3
- package/dist/src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +1 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useApiErrorTracking.d.ts +26 -0
- package/dist/src/composables/useErrorTracking.d.ts +30 -0
- package/dist/src/composables/useGuidoActions.d.ts +0 -9
- package/dist/src/composables/useStripoErrorCategory.d.ts +26 -0
- package/dist/src/composables/useStripoSlackNotifier.d.ts +8 -0
- package/dist/src/enums/onboarding.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +2 -11
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/template.d.ts +6 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -21
- package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
- package/dist/src/services/slackNotificationService.d.ts +110 -0
- package/dist/src/services/stripoErrorDeduplicationService.d.ts +75 -0
- package/dist/src/stores/config.d.ts +2 -10
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/src/stores/editor.d.ts +1 -1
- package/dist/src/stores/onboarding.d.ts +1 -1
- package/dist/src/stores/preview.d.ts +1 -1
- package/dist/src/stores/recommendation.d.ts +1 -1
- package/dist/src/stores/save-as-template.d.ts +1 -1
- package/dist/src/stores/toaster.d.ts +1 -1
- package/dist/src/stores/unsubscribe.d.ts +1 -1
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/dateUtil.d.ts +0 -21
- package/dist/src/utils/genericUtil.d.ts +0 -1
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/static/styles/components/wide-panel.css.js +4 -0
- package/dist/static/styles/customEditorStyle.css.js +0 -19
- package/dist/stores/config.js +5 -5
- package/dist/stores/dynamic-content.js +2 -2
- package/dist/stores/editor.js +1 -1
- package/dist/stores/onboarding.js +27 -27
- package/dist/stores/preview.js +1 -1
- package/dist/stores/recommendation.js +3 -3
- package/dist/stores/save-as-template.js +2 -2
- package/dist/stores/toaster.js +1 -1
- package/dist/stores/unsubscribe.js +1 -1
- package/dist/stores/version-history.js +4 -4
- package/dist/utils/dateUtil.js +3 -24
- package/dist/utils/genericUtil.js +9 -20
- package/package.json +3 -3
- package/dist/composables/useBlocksConfig.js +0 -49
- package/dist/config/migrator/recommendationMigrator.js +0 -293
- package/dist/enums/date.js +0 -6
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -193
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -14
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -272
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
- package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -184
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +0 -25
- package/dist/extensions/Blocks/controlFactories.js +0 -234
- package/dist/src/composables/useBlocksConfig.d.ts +0 -11
- package/dist/src/config/migrator/recommendationMigrator.d.ts +0 -1
- package/dist/src/enums/date.d.ts +0 -4
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -79
- package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -91
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -71
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
- package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -19
- package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -95
- package/dist/src/utils/environmentUtil.d.ts +0 -5
- package/dist/utils/environmentUtil.js +0 -4
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from "./NewVersionPopup.vue2.js";
|
|
2
2
|
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var
|
|
4
|
-
var e = this,
|
|
5
|
-
return o.isVisible ?
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
i,
|
|
3
|
+
var r = function() {
|
|
4
|
+
var e = this, t = e._self._c, o = e._self._setupProxy;
|
|
5
|
+
return o.isVisible ? t(o.WpModal, { attrs: { id: "guido__new-version-popup", "close-on-outside-click": !1, "footer-button-options": o.footerButtonOptions, title: o.trans("email-editor.onboarding-title") }, on: { close: o.handleClose, "primary-action": o.handleDiscoverNow, "secondary-action": o.handleRemindLater } }, [t("div", { staticClass: "d-f f-d-c" }, [t("img", { staticClass: "w-1 h-1 d-b p-e-n mb-5", attrs: { src: o.onboardingImageSvg } }), t("p", { staticClass: "f-s-2 f-w-400", domProps: { innerHTML: e._s(o.trans("email-editor.onboarding-description")) } })])]) : e._e();
|
|
6
|
+
}, i = [], a = /* @__PURE__ */ n(
|
|
7
|
+
s,
|
|
9
8
|
r,
|
|
9
|
+
i,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
12
12
|
null
|
|
13
13
|
);
|
|
14
|
-
const
|
|
14
|
+
const p = a.exports;
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
p as default
|
|
17
17
|
};
|
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { useOnboardingStore as _ } from "../../../stores/onboarding.js";
|
|
8
|
-
import { isAfterDate as C, formatShortDate as L } from "../../../utils/dateUtil.js";
|
|
9
|
-
const I = /* @__PURE__ */ g({
|
|
1
|
+
import { defineComponent as s, ref as r } from "vue";
|
|
2
|
+
import a from "../../wrappers/WpModal.vue.js";
|
|
3
|
+
import { useTranslations as i } from "../../../composables/useTranslations.js";
|
|
4
|
+
import l from "../../../static/assets/onboarding-img.svg.js";
|
|
5
|
+
import { useOnboardingStore as m } from "../../../stores/onboarding.js";
|
|
6
|
+
const w = /* @__PURE__ */ s({
|
|
10
7
|
__name: "NewVersionPopup",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const e = h(), t = _(), s = b(!0), { config: p } = D(), i = o(() => p.migrationDate), n = o(() => C(i.value || 0)), d = o(() => L(
|
|
14
|
-
i.value
|
|
15
|
-
)), m = o(() => n.value ? e("email-editor.onboarding-popup-sunsetted-title") : e("email-editor.onboarding-title")), c = o(() => n.value ? e("email-editor.onboarding-popup-sunsetted-description", {
|
|
16
|
-
sunsetDate: d.value,
|
|
17
|
-
academyLink: l
|
|
18
|
-
}) : e("email-editor.onboarding-description", {
|
|
19
|
-
academyLink: l
|
|
20
|
-
})), u = o(() => n.value ? e("products.cancel") : e("products.remind-me-later")), f = o(() => ({
|
|
8
|
+
setup(p) {
|
|
9
|
+
const n = i(), e = m(), o = r(!0), t = r({
|
|
21
10
|
primaryButton: {
|
|
22
11
|
type: "primary",
|
|
23
|
-
labelText:
|
|
12
|
+
labelText: n("left-menu.discover-now")
|
|
24
13
|
},
|
|
25
14
|
secondaryButton: {
|
|
26
15
|
type: "subtle-primary",
|
|
27
|
-
labelText:
|
|
16
|
+
labelText: n("products.remind-me-later")
|
|
28
17
|
}
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return { __sfc: !0, emit: a, trans: e, onboardingStore: t, isVisible: s, config: p, migrationDate: i, isAfterMigrationDate: n, formattedSunsetDate: d, popupTitle: m, popupDescription: c, secondaryButtonLabel: u, footerButtonOptions: f, closePopup: r, handleDiscoverNow: () => {
|
|
33
|
-
t.onDiscoverNowClicked(), r();
|
|
18
|
+
});
|
|
19
|
+
return { __sfc: !0, trans: n, onboardingStore: e, isVisible: o, footerButtonOptions: t, handleDiscoverNow: () => {
|
|
20
|
+
e.onDiscoverNowClicked(), o.value = !1;
|
|
34
21
|
}, handleRemindLater: () => {
|
|
35
|
-
|
|
22
|
+
e.onRemindMeLater(), o.value = !1;
|
|
36
23
|
}, handleClose: () => {
|
|
37
|
-
|
|
38
|
-
}, WpModal:
|
|
24
|
+
e.onNewVersionPopupClose(), o.value = !1;
|
|
25
|
+
}, WpModal: a, onboardingImageSvg: l };
|
|
39
26
|
}
|
|
40
27
|
});
|
|
41
28
|
export {
|
|
42
|
-
|
|
29
|
+
w as default
|
|
43
30
|
};
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import o from "./OnboardingWrapper.vue2.js";
|
|
2
|
+
import _ from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var s = function() {
|
|
4
|
-
var n = this, e = n._self._c,
|
|
5
|
-
return e("div", n._l(
|
|
6
|
-
return e(
|
|
7
|
-
return r.emit("onboarding-finished");
|
|
8
|
-
} } });
|
|
4
|
+
var n = this, e = n._self._c, t = n._self._setupProxy;
|
|
5
|
+
return e("div", n._l(t.visibleOnboardings, function(r) {
|
|
6
|
+
return e(r.component, { key: r.type, tag: "component" });
|
|
9
7
|
}), 1);
|
|
10
|
-
},
|
|
11
|
-
|
|
8
|
+
}, a = [], p = /* @__PURE__ */ _(
|
|
9
|
+
o,
|
|
12
10
|
s,
|
|
13
|
-
|
|
11
|
+
a,
|
|
14
12
|
!1,
|
|
15
13
|
null,
|
|
16
14
|
null
|
|
17
15
|
);
|
|
18
|
-
const
|
|
16
|
+
const m = p.exports;
|
|
19
17
|
export {
|
|
20
|
-
|
|
18
|
+
m as default
|
|
21
19
|
};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { usePartner as
|
|
3
|
-
import { useEditorStore as
|
|
4
|
-
import { useOnboardingStore as
|
|
5
|
-
import { usePreviewStore as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { defineComponent as g, computed as e, onMounted as b, watch as t } from "vue";
|
|
2
|
+
import { usePartner as O } from "../../../composables/usePartner.js";
|
|
3
|
+
import { useEditorStore as u } from "../../../stores/editor.js";
|
|
4
|
+
import { useOnboardingStore as v } from "../../../stores/onboarding.js";
|
|
5
|
+
import { usePreviewStore as l } from "../../../stores/preview.js";
|
|
6
|
+
import y from "./AMPOnboarding.vue.js";
|
|
7
|
+
import S from "./GenericOnboarding.vue.js";
|
|
8
8
|
import w from "./NewVersionPopup.vue.js";
|
|
9
9
|
import P from "./TextBlockOnboarding.vue.js";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
10
|
+
import h from "./VersionHistoryOnboarding.vue.js";
|
|
11
|
+
const E = /* @__PURE__ */ g({
|
|
12
12
|
__name: "OnboardingWrapper",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const o = l(), r = v(), s = y(), { isTestPartner: a } = u(), p = e(() => r.isStripoInitialized), d = e(() => a()), m = [
|
|
13
|
+
setup(_) {
|
|
14
|
+
const o = v(), r = u(), s = l(), { isTestPartner: a } = O(), p = e(() => r.isStripoInitialized), d = e(() => a()), m = [
|
|
16
15
|
{ type: "newVersionPopup", component: w },
|
|
17
|
-
{ type: "genericOnboarding", component:
|
|
16
|
+
{ type: "genericOnboarding", component: S },
|
|
18
17
|
{ type: "textBlockOnboarding", component: P },
|
|
19
|
-
{ type: "versionHistoryOnboarding", component:
|
|
20
|
-
{ type: "ampOnboarding", component:
|
|
21
|
-
], c = (n) => d.value || !p.value ? !1 : n === "newVersionPopup" ? o.shouldShowOnboarding(n) : o.isActive(n),
|
|
22
|
-
return
|
|
18
|
+
{ type: "versionHistoryOnboarding", component: h },
|
|
19
|
+
{ type: "ampOnboarding", component: y }
|
|
20
|
+
], c = (n) => d.value || !p.value ? !1 : n === "newVersionPopup" ? o.shouldShowOnboarding(n) : o.isActive(n), f = e(() => m.filter((n) => c(n.type)));
|
|
21
|
+
return b(async () => {
|
|
23
22
|
await o.fetchUserModalState();
|
|
24
23
|
}), t(
|
|
25
24
|
() => r.isVersionHistoryOpen,
|
|
@@ -36,9 +35,9 @@ const F = /* @__PURE__ */ b({
|
|
|
36
35
|
(n) => {
|
|
37
36
|
!n && o.isActive("ampOnboarding") && o.close("ampOnboarding");
|
|
38
37
|
}
|
|
39
|
-
), { __sfc: !0,
|
|
38
|
+
), { __sfc: !0, onboardingStore: o, editorStore: r, previewStore: s, isTestPartner: a, isStripoReady: p, isTestPartnerActive: d, onboardingConfigs: m, shouldShow: c, visibleOnboardings: f };
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
41
|
export {
|
|
43
|
-
|
|
42
|
+
E as default
|
|
44
43
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useErrorTracking as p } from "./useErrorTracking.js";
|
|
2
|
+
const h = () => {
|
|
3
|
+
const { captureError: i } = p(), E = (e, t, o = {}) => {
|
|
4
|
+
const s = {
|
|
5
|
+
endpoint: t,
|
|
6
|
+
method: o.method,
|
|
7
|
+
statusCode: e.status,
|
|
8
|
+
statusText: e.statusText,
|
|
9
|
+
errorType: "http_error",
|
|
10
|
+
component: "api-client",
|
|
11
|
+
operation: `http_error_${e.status}`,
|
|
12
|
+
retryable: e.status ? e.status >= 500 : !1,
|
|
13
|
+
// 5xx errors are retryable
|
|
14
|
+
...o
|
|
15
|
+
}, r = new Error(
|
|
16
|
+
`HTTP ${e.status} ${e.statusText} - ${t}`
|
|
17
|
+
);
|
|
18
|
+
return i(r, s), s;
|
|
19
|
+
}, u = (e, t, o = {}) => {
|
|
20
|
+
const s = e.message, r = s.toLowerCase().includes("timeout"), n = e.name === "AbortError";
|
|
21
|
+
let a;
|
|
22
|
+
r ? a = "network_timeout" : n ? a = "request_abort" : a = "network_error";
|
|
23
|
+
const c = {
|
|
24
|
+
endpoint: t,
|
|
25
|
+
errorType: "network_error",
|
|
26
|
+
component: "api-client",
|
|
27
|
+
operation: a,
|
|
28
|
+
retryable: !0,
|
|
29
|
+
...o
|
|
30
|
+
}, l = new Error(
|
|
31
|
+
`Network Error (${String(c.operation)}) - ${String(t)}: ${s}`
|
|
32
|
+
);
|
|
33
|
+
return i(l, c), c;
|
|
34
|
+
}, g = (e, t, o, s = {}) => {
|
|
35
|
+
const r = e instanceof Error ? e.message : String(e), n = {
|
|
36
|
+
endpoint: t,
|
|
37
|
+
errorType: "parsing_error",
|
|
38
|
+
component: "api-client",
|
|
39
|
+
operation: "response_parsing_failed",
|
|
40
|
+
retryable: !1,
|
|
41
|
+
responsePreview: o instanceof Object ? JSON.stringify(o).slice(0, 200) : String(o).slice(0, 200),
|
|
42
|
+
...s
|
|
43
|
+
}, a = new Error(
|
|
44
|
+
`Failed to parse API response from ${t}: ${r}`
|
|
45
|
+
);
|
|
46
|
+
return i(a, n), n;
|
|
47
|
+
}, m = (e, t, o = {}) => {
|
|
48
|
+
const s = {
|
|
49
|
+
endpoint: e,
|
|
50
|
+
errorType: "timeout",
|
|
51
|
+
component: "api-client",
|
|
52
|
+
operation: "request_timeout",
|
|
53
|
+
timeoutMs: t,
|
|
54
|
+
retryable: !0,
|
|
55
|
+
...o
|
|
56
|
+
}, r = new Error(
|
|
57
|
+
`Request to ${e} timed out after ${t}ms`
|
|
58
|
+
);
|
|
59
|
+
return i(r, s), s;
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
captureHttpError: E,
|
|
63
|
+
captureNetworkError: u,
|
|
64
|
+
captureParsingError: g,
|
|
65
|
+
captureTimeoutError: m,
|
|
66
|
+
withApiErrorTracking: async (e, t, o = "GET", s = {}) => {
|
|
67
|
+
try {
|
|
68
|
+
return await e();
|
|
69
|
+
} catch (r) {
|
|
70
|
+
if (r instanceof Error)
|
|
71
|
+
if (r.message === "Request timeout") {
|
|
72
|
+
const n = s.timeoutMs || 1e4;
|
|
73
|
+
m(t, n, {
|
|
74
|
+
method: o,
|
|
75
|
+
...s
|
|
76
|
+
});
|
|
77
|
+
} else if (r.name === "AbortError" || r.message.includes("cancelled"))
|
|
78
|
+
u(r, t, {
|
|
79
|
+
method: o,
|
|
80
|
+
...s
|
|
81
|
+
});
|
|
82
|
+
else if (r.message.includes("HTTP Error")) {
|
|
83
|
+
const n = r.message.match(/HTTP Error: (\d+)/), a = n ? parseInt(n[1]) : void 0, c = {
|
|
84
|
+
message: r.message,
|
|
85
|
+
status: a,
|
|
86
|
+
statusText: r.message
|
|
87
|
+
};
|
|
88
|
+
E(c, t, {
|
|
89
|
+
method: o,
|
|
90
|
+
...s
|
|
91
|
+
});
|
|
92
|
+
} else
|
|
93
|
+
u(r, t, {
|
|
94
|
+
method: o,
|
|
95
|
+
...s
|
|
96
|
+
});
|
|
97
|
+
else {
|
|
98
|
+
const n = new Error(String(r));
|
|
99
|
+
u(n, t, {
|
|
100
|
+
method: o,
|
|
101
|
+
...s
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
throw r;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
withParsingErrorTracking: (e, t, o, s = {}) => {
|
|
108
|
+
try {
|
|
109
|
+
return e();
|
|
110
|
+
} catch (r) {
|
|
111
|
+
throw g(r, t, o, {
|
|
112
|
+
...s
|
|
113
|
+
}), r;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
h as useApiErrorTracking
|
|
120
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { inject as S, ref as g } from "vue";
|
|
2
|
+
const f = () => {
|
|
3
|
+
const s = S("traceId", ""), n = g(0), i = g(null), d = (r, e = {}) => {
|
|
4
|
+
const t = r instanceof Error ? r.message : String(r), o = {
|
|
5
|
+
...e,
|
|
6
|
+
errorMessage: t,
|
|
7
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8
|
+
userAgent: navigator.userAgent,
|
|
9
|
+
url: window.location.href,
|
|
10
|
+
traceId: s || void 0
|
|
11
|
+
};
|
|
12
|
+
return n.value += 1, r instanceof Error && (i.value = r), window.Sentry && window.Sentry.captureException(r, {
|
|
13
|
+
tags: {
|
|
14
|
+
component: e.component,
|
|
15
|
+
operation: e.operation,
|
|
16
|
+
source: "guido"
|
|
17
|
+
},
|
|
18
|
+
contexts: {
|
|
19
|
+
guido: o
|
|
20
|
+
},
|
|
21
|
+
extra: {
|
|
22
|
+
traceId: s || void 0
|
|
23
|
+
}
|
|
24
|
+
}), window.FS && window.FS("event", "guido_error", {
|
|
25
|
+
errorMessageStr: t,
|
|
26
|
+
componentStr: e.component || "unknown",
|
|
27
|
+
operationStr: e.operation || "unknown",
|
|
28
|
+
templateIdStr: e.templateId || "",
|
|
29
|
+
userIdStr: e.userId || "",
|
|
30
|
+
traceIdStr: s || "",
|
|
31
|
+
errorCountInt: n.value,
|
|
32
|
+
timestampInt: Date.now()
|
|
33
|
+
}), o;
|
|
34
|
+
}, c = (r, e, t = {}, o = !0) => {
|
|
35
|
+
const a = r instanceof Error ? r : new Error(String(r)), u = a.message, p = {
|
|
36
|
+
component: "stripo-wrapper",
|
|
37
|
+
operation: e,
|
|
38
|
+
...t,
|
|
39
|
+
errorMessage: u,
|
|
40
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
41
|
+
userAgent: navigator.userAgent,
|
|
42
|
+
url: window.location.href
|
|
43
|
+
};
|
|
44
|
+
return n.value += 1, i.value = a, o && window.Sentry && window.Sentry.captureException(a, {
|
|
45
|
+
tags: {
|
|
46
|
+
component: "stripo-wrapper",
|
|
47
|
+
operation: e
|
|
48
|
+
},
|
|
49
|
+
contexts: {
|
|
50
|
+
guido: p
|
|
51
|
+
}
|
|
52
|
+
}), o && window.FS && window.FS("event", "guido_stripo_error", {
|
|
53
|
+
errorMessageStr: u,
|
|
54
|
+
operationStr: e || "unknown",
|
|
55
|
+
timestampInt: Date.now()
|
|
56
|
+
}), p;
|
|
57
|
+
}, w = (r, e, t = {}) => {
|
|
58
|
+
const o = new Error(
|
|
59
|
+
`Timeout waiting for Stripo ${r} (${e}ms)`
|
|
60
|
+
);
|
|
61
|
+
return c(o, `${r}_timeout`, {
|
|
62
|
+
timeoutMs: e,
|
|
63
|
+
...t
|
|
64
|
+
});
|
|
65
|
+
}, m = (r, e, t = {}) => new Promise((o, a) => {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
const u = w(
|
|
68
|
+
e,
|
|
69
|
+
r,
|
|
70
|
+
t
|
|
71
|
+
);
|
|
72
|
+
a(new Error(u.errorMessage));
|
|
73
|
+
}, r);
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
traceId: s,
|
|
77
|
+
errorCount: n,
|
|
78
|
+
lastError: i,
|
|
79
|
+
captureError: d,
|
|
80
|
+
captureStripoError: c,
|
|
81
|
+
captureTimeoutError: w,
|
|
82
|
+
createTimeoutPromise: m,
|
|
83
|
+
withTimeout: (r, e, t, o = {}) => Promise.race([
|
|
84
|
+
r,
|
|
85
|
+
m(e, t, o)
|
|
86
|
+
]),
|
|
87
|
+
getErrorSummary: () => ({
|
|
88
|
+
errorCount: n.value,
|
|
89
|
+
lastError: i.value
|
|
90
|
+
}),
|
|
91
|
+
resetErrorTracking: () => {
|
|
92
|
+
n.value = 0, i.value = null;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
f as useErrorTracking
|
|
98
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { provideValue as o, useInjectedValue as t } from "./useProvideInject.js";
|
|
2
|
-
const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"),
|
|
3
|
-
o(r, e.onBack), o(n, e.onSaveStart), o(
|
|
2
|
+
const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), a = Symbol.for("guido.save.complete"), s = (e) => {
|
|
3
|
+
o(r, e.onBack), o(n, e.onSaveStart), o(a, e.onSaveComplete);
|
|
4
4
|
}, u = () => {
|
|
5
5
|
try {
|
|
6
6
|
return t(r);
|
|
@@ -9,7 +9,7 @@ const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), c = Symb
|
|
|
9
9
|
"useBack: No back handler provided. Make sure Guido component is in the component tree."
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
|
-
},
|
|
12
|
+
}, d = () => {
|
|
13
13
|
try {
|
|
14
14
|
return t(n);
|
|
15
15
|
} catch {
|
|
@@ -17,31 +17,21 @@ const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), c = Symb
|
|
|
17
17
|
"useSaveStart: No save start handler provided. Make sure Guido component is in the component tree."
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
21
|
-
try {
|
|
22
|
-
return t(c);
|
|
23
|
-
} catch {
|
|
24
|
-
throw new Error(
|
|
25
|
-
"useSaveComplete: No save complete handler provided. Make sure Guido component is in the component tree."
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}, m = () => {
|
|
20
|
+
}, i = () => {
|
|
29
21
|
try {
|
|
30
22
|
return t(a);
|
|
31
23
|
} catch {
|
|
32
24
|
throw new Error(
|
|
33
|
-
"
|
|
25
|
+
"useSaveComplete: No save complete handler provided. Make sure Guido component is in the component tree."
|
|
34
26
|
);
|
|
35
27
|
}
|
|
36
28
|
};
|
|
37
29
|
export {
|
|
38
30
|
r as BACK_KEY,
|
|
39
|
-
|
|
31
|
+
a as SAVE_COMPLETE_KEY,
|
|
40
32
|
n as SAVE_START_KEY,
|
|
41
|
-
|
|
42
|
-
i as provideGuidoActions,
|
|
33
|
+
s as provideGuidoActions,
|
|
43
34
|
u as useBack,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
m as useTestEmailClick
|
|
35
|
+
i as useSaveComplete,
|
|
36
|
+
d as useSaveStart
|
|
47
37
|
};
|
|
@@ -1,86 +1,123 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { getCsrfToken as S } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as h, computed as w } from "vue";
|
|
3
|
+
let b;
|
|
4
|
+
const g = async () => {
|
|
5
|
+
if (!b)
|
|
6
|
+
try {
|
|
7
|
+
const { useApiErrorTracking: E } = await import("./useApiErrorTracking.js");
|
|
8
|
+
b = E();
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
return b;
|
|
12
|
+
}, M = (E = {}) => {
|
|
13
|
+
const d = h(!1), i = h(null), l = h(null), P = w(() => d.value), k = w(() => i.value !== null), v = {
|
|
5
14
|
baseURL: "",
|
|
6
15
|
timeout: 1e4,
|
|
7
16
|
retry: 0,
|
|
8
17
|
retryDelay: 1e3,
|
|
9
18
|
headers: {
|
|
10
19
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
20
|
+
"X-CSRF-TOKEN": S()
|
|
12
21
|
},
|
|
13
|
-
...
|
|
14
|
-
},
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
22
|
+
...E
|
|
23
|
+
}, C = (t, s) => {
|
|
24
|
+
if (t.startsWith("http://") || t.startsWith("https://"))
|
|
25
|
+
return t;
|
|
26
|
+
const e = s || v.baseURL || "";
|
|
27
|
+
return e.endsWith("/") && t.startsWith("/") ? `${e}${t.slice(1)}` : e.endsWith("/") || t.startsWith("/") ? `${e}${t}` : `${e}/${t}`;
|
|
28
|
+
}, A = (t) => new Promise((s, e) => {
|
|
20
29
|
setTimeout(() => {
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
setTimeout(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
e(new Error("Request timeout"));
|
|
31
|
+
}, t);
|
|
32
|
+
}), $ = (t) => new Promise((s) => {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
s();
|
|
35
|
+
}, t);
|
|
36
|
+
}), c = async (t, s, e, L = {}) => {
|
|
37
|
+
i.value = null, d.value = !0, l.value = new AbortController();
|
|
38
|
+
const n = { ...v, ...L }, T = C(s, n.baseURL), m = {
|
|
39
|
+
method: t,
|
|
29
40
|
headers: { ...n.headers },
|
|
30
|
-
signal:
|
|
41
|
+
signal: l.value.signal,
|
|
31
42
|
...n
|
|
32
43
|
};
|
|
33
|
-
|
|
34
|
-
const
|
|
44
|
+
e && ["POST", "PUT", "PATCH"].includes(t) && (e instanceof FormData ? (delete m.headers["Content-Type"], m.body = e) : m.body = JSON.stringify(e));
|
|
45
|
+
const y = async (f = 0) => {
|
|
35
46
|
try {
|
|
36
|
-
const o = [fetch(
|
|
37
|
-
n.timeout && o.push(
|
|
47
|
+
const o = [fetch(T, m)];
|
|
48
|
+
n.timeout && o.push(A(n.timeout));
|
|
38
49
|
const r = await Promise.race(o);
|
|
39
50
|
if (!r.ok) {
|
|
40
|
-
const O = `HTTP Error: ${r.status} ${r.statusText}`,
|
|
41
|
-
|
|
51
|
+
const O = `HTTP Error: ${r.status} ${r.statusText}`, p = new Error(O);
|
|
52
|
+
p.status = r.status, p.statusText = r.statusText, p.response = r;
|
|
53
|
+
const x = await g();
|
|
54
|
+
throw x && x.captureHttpError(p, T, {
|
|
55
|
+
method: t,
|
|
56
|
+
statusCode: r.status,
|
|
57
|
+
statusText: r.statusText
|
|
58
|
+
}), p;
|
|
42
59
|
}
|
|
43
|
-
let
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
data:
|
|
60
|
+
let a;
|
|
61
|
+
const u = r.headers.get("content-type");
|
|
62
|
+
return u != null && u.includes("application/json") ? a = await r.json() : u != null && u.includes("text/") ? a = await r.text() : a = await r.blob(), {
|
|
63
|
+
data: a,
|
|
47
64
|
status: r.status,
|
|
48
65
|
statusText: r.statusText,
|
|
49
66
|
headers: r.headers
|
|
50
67
|
};
|
|
51
68
|
} catch (o) {
|
|
52
69
|
const r = o instanceof Error && o.name === "AbortError";
|
|
53
|
-
if (
|
|
54
|
-
return await
|
|
55
|
-
|
|
70
|
+
if (f < (n.retry || 0) && !r)
|
|
71
|
+
return await $(n.retryDelay || 1e3), y(f + 1);
|
|
72
|
+
if (o instanceof Error)
|
|
73
|
+
if (o.name === "AbortError")
|
|
74
|
+
i.value = { message: "Request was cancelled" };
|
|
75
|
+
else {
|
|
76
|
+
i.value = { message: o.message };
|
|
77
|
+
const a = await g();
|
|
78
|
+
a && a.captureNetworkError(o, T, {
|
|
79
|
+
method: t,
|
|
80
|
+
attemptNumber: f + 1,
|
|
81
|
+
timeoutMs: n.timeout
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
i.value = o;
|
|
86
|
+
const a = await g();
|
|
87
|
+
a && o instanceof Error && a.captureNetworkError(o, T, {
|
|
88
|
+
method: t,
|
|
89
|
+
attemptNumber: f + 1
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
throw o;
|
|
56
93
|
}
|
|
57
94
|
};
|
|
58
95
|
try {
|
|
59
|
-
return await
|
|
96
|
+
return await y();
|
|
60
97
|
} finally {
|
|
61
|
-
|
|
98
|
+
d.value = !1, l.value = null;
|
|
62
99
|
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
100
|
+
}, R = (t, s) => c("GET", t, void 0, s), U = (t, s, e) => c("POST", t, s, e), N = (t, s, e) => c("PUT", t, s, e), W = (t, s, e) => c("PATCH", t, s, e), q = (t, s) => c("DELETE", t, void 0, s), D = (t) => {
|
|
101
|
+
l.value && l.value.abort(t);
|
|
102
|
+
}, H = () => {
|
|
103
|
+
i.value = null;
|
|
67
104
|
};
|
|
68
105
|
return {
|
|
69
106
|
// State
|
|
70
|
-
loading:
|
|
71
|
-
error:
|
|
72
|
-
hasError:
|
|
107
|
+
loading: P,
|
|
108
|
+
error: w(() => i.value),
|
|
109
|
+
hasError: k,
|
|
73
110
|
// Methods
|
|
74
|
-
request:
|
|
75
|
-
get:
|
|
76
|
-
post:
|
|
77
|
-
put:
|
|
78
|
-
patch:
|
|
79
|
-
delete:
|
|
80
|
-
cancel:
|
|
81
|
-
clearError:
|
|
111
|
+
request: c,
|
|
112
|
+
get: R,
|
|
113
|
+
post: U,
|
|
114
|
+
put: N,
|
|
115
|
+
patch: W,
|
|
116
|
+
delete: q,
|
|
117
|
+
cancel: D,
|
|
118
|
+
clearError: H
|
|
82
119
|
};
|
|
83
120
|
};
|
|
84
121
|
export {
|
|
85
|
-
|
|
122
|
+
M as useHttp
|
|
86
123
|
};
|