@lookiero/checkout 0.6.0-beta.22 → 0.6.0-beta.24

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.
@@ -11,7 +11,7 @@ const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader =
11
11
  if (notAccessible) {
12
12
  onNotAccessibleRef.current();
13
13
  }
14
- }, [notAccessible, onNotAccessible]);
14
+ }, [notAccessible]);
15
15
  return accessible === undefined && [QueryStatus.IDLE, QueryStatus.LOADING].includes(status)
16
16
  ? loader
17
17
  : accessible
@@ -1,5 +1,5 @@
1
1
  import { I18n } from "@lookiero/i18n-react";
2
- import { FC } from "react";
2
+ import React from "react";
3
3
  import { useRoutes as reactRouterUseRoutes } from "react-router-native";
4
4
  import { Customer } from "../../../projection/shared/customer";
5
5
  import { Menu, TabBar } from "../views/navigation/Navigation";
@@ -16,5 +16,11 @@ interface RoutingProps {
16
16
  readonly useRedirect: () => Record<string, string>;
17
17
  readonly useRoutes: typeof reactRouterUseRoutes;
18
18
  }
19
- declare const Routing: FC<RoutingProps>;
20
- export { Routing };
19
+ /**
20
+ * Provided useRoutes is not stable (when integrated with Sentry) as it's rendering a different component tree.
21
+ *
22
+ * https://github.com/getsentry/sentry-javascript/blob/master/packages/react/src/reactrouterv6.tsx#L221
23
+ * (SentryRoutes is a new component after each re-render)
24
+ */
25
+ declare const MemoizedRouting: React.NamedExoticComponent<RoutingProps>;
26
+ export { MemoizedRouting as Routing };
@@ -1,4 +1,4 @@
1
- import React, { lazy, Suspense, useMemo } from "react";
1
+ import React, { lazy, memo, Suspense } from "react";
2
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";
@@ -13,7 +13,7 @@ const Summary = lazy(() => import("../views/summary/Summary").then((module) => (
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
15
  const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, useRoutes, }) => {
16
- const routes = useMemo(() => useRoutes([
16
+ const routes = useRoutes([
17
17
  {
18
18
  path: "",
19
19
  element: (React.createElement(BasePathProvider, { basePath: basePath },
@@ -51,7 +51,7 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
51
51
  children: [
52
52
  {
53
53
  path: Routes.CHECKOUT_PAYMENT,
54
- element: (React.createElement(CheckoutPaymentModal, { customerId: customer?.customerId, getAuthToken: getAuthToken })),
54
+ element: React.createElement(CheckoutPaymentModal, { customerId: customer?.customerId, getAuthToken: getAuthToken }),
55
55
  },
56
56
  ],
57
57
  },
@@ -66,20 +66,14 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
66
66
  },
67
67
  ],
68
68
  },
69
- ]), [
70
- I18n,
71
- basePath,
72
- customer?.country,
73
- customer?.customerId,
74
- getAuthToken,
75
- locale,
76
- menu,
77
- onI18nError,
78
- onNotAccessible,
79
- tabBar,
80
- useRedirect,
81
- useRoutes,
82
69
  ]);
83
70
  return routes;
84
71
  };
85
- export { Routing };
72
+ /**
73
+ * Provided useRoutes is not stable (when integrated with Sentry) as it's rendering a different component tree.
74
+ *
75
+ * https://github.com/getsentry/sentry-javascript/blob/master/packages/react/src/reactrouterv6.tsx#L221
76
+ * (SentryRoutes is a new component after each re-render)
77
+ */
78
+ const MemoizedRouting = memo(Routing);
79
+ export { MemoizedRouting as Routing };
@@ -8,14 +8,6 @@ const integrations = [
8
8
  ...defaultIntegrations,
9
9
  new BrowserTracing({
10
10
  routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes),
11
- beforeNavigate: (context) => {
12
- console.log("beforeNavigate", context);
13
- return context;
14
- },
15
- shouldCreateSpanForRequest: (url) => {
16
- console.log(url);
17
- return true;
18
- },
19
11
  }),
20
12
  ];
21
13
  const wrap = (Component) => Component;
@@ -66,14 +66,6 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
66
66
  /webappstoolbarba\.texthelp\.com\//i,
67
67
  /metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
68
68
  ],
69
- beforeSend: (event) => {
70
- console.log(event);
71
- return event;
72
- },
73
- beforeSendTransaction: (event) => {
74
- console.log(event);
75
- return event;
76
- },
77
69
  });
78
70
  const hub = new Hub(client);
79
71
  const onMount = (customerId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.6.0-beta.22",
3
+ "version": "0.6.0-beta.24",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [