@lookiero/checkout 0.6.0-beta.27 → 0.6.0-beta.29
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/shared/logging/SentryDependencies.d.ts +1 -1
- package/dist/shared/logging/SentryDependencies.js +6 -4
- package/dist/shared/logging/SentryDependencies.native.d.ts +1 -1
- package/dist/shared/logging/SentryDependencies.native.js +10 -2
- package/dist/shared/logging/SentryLogger.d.ts +1 -0
- package/dist/shared/logging/SentryLogger.js +2 -2
- package/dist/shared/logging/matchRoutes.d.ts +6 -0
- package/dist/shared/logging/matchRoutes.js +7 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +14 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.js +10 -0
- package/package.json +1 -1
|
@@ -4,6 +4,6 @@ import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/option
|
|
|
4
4
|
import { Transport, Integration } from "@sentry/types";
|
|
5
5
|
import { ComponentType } from "react";
|
|
6
6
|
declare const transport: (options: ReactNativeTransportOptions) => Transport;
|
|
7
|
-
declare const integrations: Integration[];
|
|
7
|
+
declare const integrations: (basename: string) => Integration[];
|
|
8
8
|
declare const wrap: <P>(Component: ComponentType<P>) => ComponentType<P>;
|
|
9
9
|
export { BrowserClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { BrowserClient, Hub, makeFetchTransport, defaultIntegrations } from "@sentry/browser";
|
|
2
|
-
import { ErrorBoundary
|
|
2
|
+
import { ErrorBoundary } from "@sentry/react";
|
|
3
|
+
import { reactRouterV6Instrumentation } from "@sentry/react";
|
|
3
4
|
import { BrowserTracing } from "@sentry/tracing";
|
|
4
5
|
import { useEffect } from "react";
|
|
5
|
-
import { createRoutesFromChildren,
|
|
6
|
+
import { createRoutesFromChildren, useLocation, useNavigationType } from "react-router-native";
|
|
7
|
+
import { matchRoutesForBasename } from "./matchRoutes";
|
|
6
8
|
const transport = (options, nativeFetch) => makeFetchTransport(options, nativeFetch);
|
|
7
|
-
const integrations = [
|
|
9
|
+
const integrations = (basename) => [
|
|
8
10
|
...defaultIntegrations,
|
|
9
11
|
new BrowserTracing({
|
|
10
|
-
routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren,
|
|
12
|
+
routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutesForBasename(basename)),
|
|
11
13
|
}),
|
|
12
14
|
];
|
|
13
15
|
const wrap = (Component) => Component;
|
|
@@ -3,6 +3,6 @@ import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/option
|
|
|
3
3
|
import { Transport, Integration } from "@sentry/types";
|
|
4
4
|
import { ComponentType } from "react";
|
|
5
5
|
declare const transport: (options: ReactNativeTransportOptions) => Transport;
|
|
6
|
-
declare const integrations: Integration[];
|
|
6
|
+
declare const integrations: (basename: string) => Integration[];
|
|
7
7
|
declare const wrap: <P>(Component: ComponentType<P>) => ComponentType<P>;
|
|
8
8
|
export { ReactNativeClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { makeFetchTransport } from "@sentry/browser";
|
|
2
|
-
import { ReactNativeClient, Hub, ErrorBoundary, wrap as sentryWrap } from "@sentry/react-native";
|
|
2
|
+
import { ReactNativeClient, Hub, ErrorBoundary, wrap as sentryWrap, ReactNativeTracing } 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
|
+
import { useEffect } from "react";
|
|
6
|
+
import { createRoutesFromChildren, useLocation, useNavigationType } from "react-router-native";
|
|
7
|
+
import { matchRoutesForBasename } from "./matchRoutes";
|
|
8
|
+
import { ReactRouterV6Instrumentation } from "./reactRouterV6Instrumentation.native";
|
|
5
9
|
const transport = (options, nativeFetch) => NATIVE.isNativeTransportAvailable() ? makeReactNativeTransport(options) : makeFetchTransport(options, nativeFetch);
|
|
6
|
-
const integrations = [
|
|
10
|
+
const integrations = (basename) => [
|
|
11
|
+
new ReactNativeTracing({
|
|
12
|
+
routingInstrumentation: new ReactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutesForBasename(basename)),
|
|
13
|
+
}),
|
|
14
|
+
];
|
|
7
15
|
const wrap = (Component) => sentryWrap(Component);
|
|
8
16
|
export { ReactNativeClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
interface SentryLoggerFunctionArgs {
|
|
4
|
+
readonly routerBasename: string;
|
|
4
5
|
readonly publicKey: string;
|
|
5
6
|
readonly environment: `${typeof Platform.OS}-${"DEV" | "PROD"}`;
|
|
6
7
|
readonly release: string;
|
|
@@ -5,13 +5,13 @@ import React, { useEffect } from "react";
|
|
|
5
5
|
import { Platform } from "react-native";
|
|
6
6
|
import { Routes as ReactRouterRoutes } from "react-router-native";
|
|
7
7
|
import { Client, Hub, ErrorBoundary, transport, integrations, wrap } from "./SentryDependencies";
|
|
8
|
-
const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
8
|
+
const sentryLogger = ({ routerBasename, publicKey, environment, release, project }) => {
|
|
9
9
|
let mainHub;
|
|
10
10
|
const client = new Client({
|
|
11
11
|
environment,
|
|
12
12
|
release,
|
|
13
13
|
dsn: `https://${publicKey}@o179049.ingest.sentry.io/${project}`,
|
|
14
|
-
integrations,
|
|
14
|
+
integrations: integrations(routerBasename),
|
|
15
15
|
tracesSampleRate: 1.0,
|
|
16
16
|
debug: true,
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { matchRoutes } from "@remix-run/router";
|
|
2
|
+
const matchRoutesForBasename = (basename) => (routes, locationArg) => {
|
|
3
|
+
// Remove the location's first path ("/checkout"). Otherwise it won't match the proper route.
|
|
4
|
+
const location = (typeof locationArg === "string" ? locationArg : locationArg?.pathname || "").replace(/^\/\w+/, "");
|
|
5
|
+
return matchRoutes(routes, location, basename);
|
|
6
|
+
};
|
|
7
|
+
export { matchRoutesForBasename };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RoutingInstrumentation } from "@sentry/react-native";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { matchRoutes } from "react-router-native";
|
|
4
|
+
import { createRoutesFromChildren, useLocation, useNavigationType } from "react-router-native";
|
|
5
|
+
type UseEffect = typeof useEffect;
|
|
6
|
+
type UseLocation = typeof useLocation;
|
|
7
|
+
type UseNavigationType = typeof useNavigationType;
|
|
8
|
+
type CreateRoutesFromChildren = typeof createRoutesFromChildren;
|
|
9
|
+
type MatchRoutes = typeof matchRoutes;
|
|
10
|
+
declare class ReactRouterV6Instrumentation extends RoutingInstrumentation {
|
|
11
|
+
static instrumentationName: string;
|
|
12
|
+
constructor(useEffect: UseEffect, useLocation: UseLocation, useNavigationType: UseNavigationType, createRoutesFromChildren: CreateRoutesFromChildren, matchRoutes: MatchRoutes);
|
|
13
|
+
}
|
|
14
|
+
export { ReactRouterV6Instrumentation };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { reactRouterV6Instrumentation as origReactRouterV6Instrumentation } from "@sentry/react";
|
|
2
|
+
import { RoutingInstrumentation } from "@sentry/react-native";
|
|
3
|
+
class ReactRouterV6Instrumentation extends RoutingInstrumentation {
|
|
4
|
+
static instrumentationName = "react-router-v6";
|
|
5
|
+
constructor(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes) {
|
|
6
|
+
super();
|
|
7
|
+
origReactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { ReactRouterV6Instrumentation };
|