@lookiero/checkout 0.6.0-beta.10 → 0.6.0-beta.12

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.
@@ -1,13 +1,16 @@
1
+ import { wrapUseRoutes } from "@sentry/react";
1
2
  import React, { useCallback } from "react";
2
3
  import { Platform } from "react-native";
4
+ import { useRoutes as reactRouterUseRoutes } from "react-router-native";
3
5
  import { sentryLogger } from "../../shared/logging/SentryLogger";
4
6
  import { Routing } from "./routing/Routing";
5
7
  const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
8
+ const useRoutes = sentry ? wrapUseRoutes(reactRouterUseRoutes) : reactRouterUseRoutes;
6
9
  // eslint-disable-next-line react/display-name, react/prop-types
7
10
  const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect }) => {
8
11
  const handleOnI18nError = useCallback(() => void 0, []);
9
12
  return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
10
- React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
13
+ React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, useRoutes: useRoutes, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
11
14
  };
12
15
  return sentry
13
16
  ? sentryLogger({
@@ -1,5 +1,6 @@
1
1
  import { I18n } from "@lookiero/i18n-react";
2
- import { FC } from "react";
2
+ import React, { FC } from "react";
3
+ import { Location, RouteObject } from "react-router-native";
3
4
  import { Customer } from "../../../projection/shared/customer";
4
5
  import { Menu, TabBar } from "../views/navigation/Navigation";
5
6
  interface RoutingProps {
@@ -13,6 +14,7 @@ interface RoutingProps {
13
14
  readonly onNotAccessible: () => void;
14
15
  readonly onI18nError?: (err: Error) => void;
15
16
  readonly useRedirect: () => Record<string, string>;
17
+ readonly useRoutes: (routes: RouteObject[], locationArg?: Partial<Location> | string) => React.ReactElement | null;
16
18
  }
17
19
  declare const Routing: FC<RoutingProps>;
18
20
  export { Routing };
@@ -1,5 +1,5 @@
1
1
  import React, { lazy, Suspense } from "react";
2
- import { Navigate, Outlet, useRoutes } from "react-router-native";
2
+ import { Navigate, Outlet } from "react-router-native";
3
3
  import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
4
4
  import { App } from "../views/App";
5
5
  import { CheckoutPaymentModal } from "../views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal";
@@ -12,7 +12,7 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
12
12
  const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
13
13
  const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
14
14
  const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
15
- const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, }) => {
15
+ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, useRoutes, }) => {
16
16
  const routes = useRoutes([
17
17
  {
18
18
  path: "",
@@ -1,7 +1,9 @@
1
1
  import { BrowserClient, Hub } from "@sentry/browser";
2
2
  import { ErrorBoundary } from "@sentry/react";
3
3
  import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
4
- import { BrowserTracing } from "@sentry/tracing";
5
- import { Transport } from "@sentry/types";
4
+ import { Transport, Integration } from "@sentry/types";
5
+ import { ComponentType } from "react";
6
6
  declare const transport: (options: ReactNativeTransportOptions) => Transport;
7
- export { BrowserClient as Client, Hub, ErrorBoundary, BrowserTracing as Tracing, transport };
7
+ declare const integrations: Integration[];
8
+ declare const wrap: <P>(Component: ComponentType<P>) => ComponentType<P>;
9
+ export { BrowserClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
@@ -1,6 +1,14 @@
1
1
  import { BrowserClient, Hub } from "@sentry/browser";
2
2
  import { makeFetchTransport } from "@sentry/browser";
3
- import { ErrorBoundary } from "@sentry/react";
3
+ import { ErrorBoundary, reactRouterV6Instrumentation } from "@sentry/react";
4
4
  import { BrowserTracing } from "@sentry/tracing";
5
+ import { useEffect } from "react";
6
+ import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router-native";
5
7
  const transport = (options, nativeFetch) => makeFetchTransport(options, nativeFetch);
6
- export { BrowserClient as Client, Hub, ErrorBoundary, BrowserTracing as Tracing, transport };
8
+ const integrations = [
9
+ new BrowserTracing({
10
+ routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes),
11
+ }),
12
+ ];
13
+ const wrap = (Component) => Component;
14
+ export { BrowserClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
@@ -1,5 +1,8 @@
1
- import { ReactNativeClient, Hub, ErrorBoundary, ReactNativeTracing } from "@sentry/react-native";
1
+ import { ReactNativeClient, Hub, ErrorBoundary } from "@sentry/react-native";
2
2
  import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
3
- import { Transport } from "@sentry/types";
3
+ import { Transport, Integration } from "@sentry/types";
4
+ import { ComponentType } from "react";
4
5
  declare const transport: (options: ReactNativeTransportOptions) => Transport;
5
- export { ReactNativeClient as Client, Hub, ErrorBoundary, ReactNativeTracing as Tracing, transport };
6
+ declare const integrations: Integration[];
7
+ declare const wrap: <P>(Component: ComponentType<P>) => ComponentType<P>;
8
+ export { ReactNativeClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
@@ -1,6 +1,10 @@
1
1
  import { makeFetchTransport } from "@sentry/browser";
2
- import { ReactNativeClient, Hub, ErrorBoundary, ReactNativeTracing } from "@sentry/react-native";
2
+ import { ReactNativeClient, Hub, ErrorBoundary, wrap as sentryWrap } from "@sentry/react-native";
3
3
  import { makeReactNativeTransport } from "@sentry/react-native/dist/js/transports/native";
4
4
  import { NATIVE } from "@sentry/react-native/dist/js/wrapper";
5
5
  const transport = (options, nativeFetch) => NATIVE.isNativeTransportAvailable() ? makeReactNativeTransport(options) : makeFetchTransport(options, nativeFetch);
6
- export { ReactNativeClient as Client, Hub, ErrorBoundary, ReactNativeTracing as Tracing, transport };
6
+ const integrations = [
7
+ // native tracing?? => rr6 integration??
8
+ ];
9
+ const wrap = (Component) => sentryWrap(Component);
10
+ export { ReactNativeClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
@@ -1,21 +1,15 @@
1
1
  import { defaultStackParser } from "@sentry/browser";
2
- // import { FetchImpl } from "@sentry/browser/types/transports/utils";
3
2
  import { makeMain } from "@sentry/core";
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";
9
3
  import React, { useEffect } from "react";
10
4
  import { Platform } from "react-native";
11
- import { Client, Hub, ErrorBoundary, Tracing, transport } from "./SentryDependencies";
5
+ import { Client, Hub, ErrorBoundary, transport, integrations, wrap } from "./SentryDependencies";
12
6
  const sentryLogger = ({ publicKey, environment, release, project }) => {
13
7
  let mainHub;
14
8
  const client = new Client({
15
9
  environment,
16
10
  release,
17
11
  dsn: `https://${publicKey}@o179049.ingest.sentry.io/${project}`,
18
- integrations: [new Tracing()],
12
+ integrations,
19
13
  tracesSampleRate: 1.0,
20
14
  debug: true,
21
15
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -35,16 +29,13 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
35
29
  };
36
30
  return (Component) => {
37
31
  switchMainHub();
38
- // const WrappedComponent = Sentry.wrap(Component);
39
- // eslint-disable-next-line react/display-name
40
- return (props) => {
32
+ const WrappedComponent = wrap(Component);
33
+ const SentryLogger = (props) => {
41
34
  useEffect(() => revertMainHub, []);
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 })));
35
+ return (React.createElement(ErrorBoundary, null,
36
+ React.createElement(WrappedComponent, { ...props })));
47
37
  };
38
+ return SentryLogger;
48
39
  };
49
40
  };
50
41
  export { sentryLogger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.6.0-beta.10",
3
+ "version": "0.6.0-beta.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [