@lookiero/checkout 0.6.0-beta.0 → 0.6.0-beta.10
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/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/infrastructure/ui/views/App.js +10 -4
- package/dist/shared/logging/SentryDependencies.d.ts +7 -0
- package/dist/shared/logging/SentryDependencies.js +6 -0
- package/dist/shared/logging/SentryDependencies.native.d.ts +5 -0
- package/dist/shared/logging/SentryDependencies.native.js +6 -0
- package/dist/shared/logging/SentryLogger.d.ts +0 -1
- package/dist/shared/logging/SentryLogger.js +26 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { EndpointFunction } from "@lookiero/i18n";
|
|
|
2
2
|
import { ComponentType } from "react";
|
|
3
3
|
import { RootProps } from "./infrastructure/ui/Root";
|
|
4
4
|
import { IsCheckoutAccessibleByCustomerIdProjection } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
5
|
+
import { SentryLoggerFunctionArgs } from "./shared/logging/SentryLogger";
|
|
5
6
|
interface IsCheckoutAccessibleFunctionArgs {
|
|
6
7
|
readonly customerId: string | undefined;
|
|
7
8
|
}
|
|
@@ -12,6 +13,7 @@ interface BootstrapFunctionArgs {
|
|
|
12
13
|
readonly getAuthToken: () => Promise<string>;
|
|
13
14
|
readonly apiUrl: string;
|
|
14
15
|
readonly translations: EndpointFunction;
|
|
16
|
+
readonly sentry: SentryLoggerFunctionArgs;
|
|
15
17
|
}
|
|
16
18
|
interface BootstrapFunctionReturn {
|
|
17
19
|
readonly Root: ComponentType<RootProps>;
|
package/dist/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import { i18n } from "@lookiero/i18n-react";
|
|
|
3
3
|
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
4
4
|
import { root } from "./infrastructure/ui/Root";
|
|
5
5
|
import { viewIsCheckoutAccessibleByCustomerId, } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
6
|
-
const bootstrap = ({ apiUrl, getAuthToken, translations }) => {
|
|
6
|
+
const bootstrap = ({ apiUrl, getAuthToken, translations, sentry }) => {
|
|
7
7
|
const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
|
|
8
8
|
const I18n = i18n({
|
|
9
9
|
fetchTranslation: fetchFetchTranslation({ endpoint: translations }),
|
|
10
10
|
contextId: "CheckoutI18n",
|
|
11
11
|
});
|
|
12
|
-
const Root = root({ Messaging, I18n, getAuthToken });
|
|
12
|
+
const Root = root({ Messaging, I18n, getAuthToken, sentry });
|
|
13
13
|
const isCheckoutAccessible = ({ customerId }) => queryBus(viewIsCheckoutAccessibleByCustomerId({ customerId }));
|
|
14
14
|
return {
|
|
15
15
|
Root,
|
|
@@ -4,8 +4,14 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
4
4
|
import { Notifications } from "../../../shared/notifications/infrastructure/ui/views/Notifications";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
6
6
|
import { Navigation } from "./navigation/Navigation";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const a = true;
|
|
8
|
+
const App = ({ customerId, menu, tabBar, children }) => {
|
|
9
|
+
if (a) {
|
|
10
|
+
throw new Error("This is an error (while integrated in UAF)");
|
|
11
|
+
}
|
|
12
|
+
return (React.createElement(SafeAreaProvider, null,
|
|
13
|
+
React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
|
|
14
|
+
React.createElement(Navigation, { customerId: customerId, menu: menu, tabBar: tabBar },
|
|
15
|
+
React.createElement(PortalProvider, null, children))));
|
|
16
|
+
};
|
|
11
17
|
export { App };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BrowserClient, Hub } from "@sentry/browser";
|
|
2
|
+
import { ErrorBoundary } from "@sentry/react";
|
|
3
|
+
import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
|
|
4
|
+
import { BrowserTracing } from "@sentry/tracing";
|
|
5
|
+
import { Transport } from "@sentry/types";
|
|
6
|
+
declare const transport: (options: ReactNativeTransportOptions) => Transport;
|
|
7
|
+
export { BrowserClient as Client, Hub, ErrorBoundary, BrowserTracing as Tracing, transport };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BrowserClient, Hub } from "@sentry/browser";
|
|
2
|
+
import { makeFetchTransport } from "@sentry/browser";
|
|
3
|
+
import { ErrorBoundary } from "@sentry/react";
|
|
4
|
+
import { BrowserTracing } from "@sentry/tracing";
|
|
5
|
+
const transport = (options, nativeFetch) => makeFetchTransport(options, nativeFetch);
|
|
6
|
+
export { BrowserClient as Client, Hub, ErrorBoundary, BrowserTracing as Tracing, transport };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactNativeClient, Hub, ErrorBoundary, ReactNativeTracing } from "@sentry/react-native";
|
|
2
|
+
import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
|
|
3
|
+
import { Transport } from "@sentry/types";
|
|
4
|
+
declare const transport: (options: ReactNativeTransportOptions) => Transport;
|
|
5
|
+
export { ReactNativeClient as Client, Hub, ErrorBoundary, ReactNativeTracing as Tracing, transport };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { makeFetchTransport } from "@sentry/browser";
|
|
2
|
+
import { ReactNativeClient, Hub, ErrorBoundary, ReactNativeTracing } from "@sentry/react-native";
|
|
3
|
+
import { makeReactNativeTransport } from "@sentry/react-native/dist/js/transports/native";
|
|
4
|
+
import { NATIVE } from "@sentry/react-native/dist/js/wrapper";
|
|
5
|
+
const transport = (options, nativeFetch) => NATIVE.isNativeTransportAvailable() ? makeReactNativeTransport(options) : makeFetchTransport(options, nativeFetch);
|
|
6
|
+
export { ReactNativeClient as Client, Hub, ErrorBoundary, ReactNativeTracing as Tracing, transport };
|
|
@@ -1,38 +1,49 @@
|
|
|
1
|
+
import { defaultStackParser } from "@sentry/browser";
|
|
2
|
+
// import { FetchImpl } from "@sentry/browser/types/transports/utils";
|
|
1
3
|
import { makeMain } from "@sentry/core";
|
|
2
|
-
import
|
|
3
|
-
import "@sentry/
|
|
4
|
+
// import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
|
|
5
|
+
// import { makeReactNativeTransport } from "@sentry/react-native/dist/js/transports/native";
|
|
6
|
+
// import { NATIVE } from "@sentry/react-native/dist/js/wrapper";
|
|
7
|
+
// import "@sentry/tracing";
|
|
8
|
+
// import { Transport } from "@sentry/types";
|
|
4
9
|
import React, { useEffect } from "react";
|
|
10
|
+
import { Platform } from "react-native";
|
|
11
|
+
import { Client, Hub, ErrorBoundary, Tracing, transport } from "./SentryDependencies";
|
|
5
12
|
const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
6
13
|
let mainHub;
|
|
7
|
-
|
|
8
|
-
* TS complains about not providing 'transport' and 'stackParser' implementations
|
|
9
|
-
* although 'ReactNativeClient' defaults to its own implementation for those options.
|
|
10
|
-
*/
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
const client = new Sentry.ReactNativeClient({
|
|
14
|
+
const client = new Client({
|
|
14
15
|
environment,
|
|
15
16
|
release,
|
|
16
17
|
dsn: `https://${publicKey}@o179049.ingest.sentry.io/${project}`,
|
|
17
|
-
integrations: [new
|
|
18
|
+
integrations: [new Tracing()],
|
|
18
19
|
tracesSampleRate: 1.0,
|
|
19
20
|
debug: true,
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
enableNative: Platform.OS !== "web",
|
|
24
|
+
stackParser: defaultStackParser,
|
|
25
|
+
transport,
|
|
20
26
|
});
|
|
21
|
-
const hub = new
|
|
22
|
-
hub.bindClient(client);
|
|
27
|
+
const hub = new Hub(client);
|
|
23
28
|
const switchMainHub = () => {
|
|
24
|
-
|
|
29
|
+
if (!mainHub) {
|
|
30
|
+
mainHub = makeMain(hub);
|
|
31
|
+
}
|
|
25
32
|
};
|
|
26
33
|
const revertMainHub = () => {
|
|
27
34
|
makeMain(mainHub);
|
|
28
35
|
};
|
|
29
36
|
return (Component) => {
|
|
30
37
|
switchMainHub();
|
|
31
|
-
const WrappedComponent = Sentry.wrap(Component);
|
|
38
|
+
// const WrappedComponent = Sentry.wrap(Component);
|
|
32
39
|
// eslint-disable-next-line react/display-name
|
|
33
40
|
return (props) => {
|
|
34
41
|
useEffect(() => revertMainHub, []);
|
|
35
|
-
return
|
|
42
|
+
return (
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
React.createElement(ErrorBoundary, null,
|
|
46
|
+
React.createElement(Component, { ...props })));
|
|
36
47
|
};
|
|
37
48
|
};
|
|
38
49
|
};
|