@drakkar.software/sunglasses-react-native 0.12.0 → 0.12.1
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.mts +0 -20
- package/dist/index.d.ts +0 -20
- package/dist/index.js +20 -21
- package/dist/index.mjs +20 -21
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -64,26 +64,6 @@ declare function SunglassesProvider({ client, autoCaptureErrors, children, }: Su
|
|
|
64
64
|
*/
|
|
65
65
|
declare function useSunglasses(): ISunglassesClient;
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* Expo Router screen tracking hook.
|
|
69
|
-
*
|
|
70
|
-
* Tracks screen changes by observing the `pathname` from Expo Router.
|
|
71
|
-
* Place this hook inside your root `_layout.tsx`.
|
|
72
|
-
*
|
|
73
|
-
* **Requires**: `expo-router` to be installed in your project.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```tsx
|
|
77
|
-
* // app/_layout.tsx
|
|
78
|
-
* import { useExpoRouterScreenTracking } from '@drakkar.software/sunglasses-react-native';
|
|
79
|
-
*
|
|
80
|
-
* export default function RootLayout() {
|
|
81
|
-
* const client = useSunglasses();
|
|
82
|
-
* useExpoRouterScreenTracking(client);
|
|
83
|
-
* return <Stack />;
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
67
|
declare function useExpoRouterScreenTracking(client: ISunglassesClient, options?: Pick<ScreenTrackingOptions, 'screenNameMapper'>): void;
|
|
88
68
|
|
|
89
69
|
interface NavigationState {
|
package/dist/index.d.ts
CHANGED
|
@@ -64,26 +64,6 @@ declare function SunglassesProvider({ client, autoCaptureErrors, children, }: Su
|
|
|
64
64
|
*/
|
|
65
65
|
declare function useSunglasses(): ISunglassesClient;
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* Expo Router screen tracking hook.
|
|
69
|
-
*
|
|
70
|
-
* Tracks screen changes by observing the `pathname` from Expo Router.
|
|
71
|
-
* Place this hook inside your root `_layout.tsx`.
|
|
72
|
-
*
|
|
73
|
-
* **Requires**: `expo-router` to be installed in your project.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```tsx
|
|
77
|
-
* // app/_layout.tsx
|
|
78
|
-
* import { useExpoRouterScreenTracking } from '@drakkar.software/sunglasses-react-native';
|
|
79
|
-
*
|
|
80
|
-
* export default function RootLayout() {
|
|
81
|
-
* const client = useSunglasses();
|
|
82
|
-
* useExpoRouterScreenTracking(client);
|
|
83
|
-
* return <Stack />;
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
67
|
declare function useExpoRouterScreenTracking(client: ISunglassesClient, options?: Pick<ScreenTrackingOptions, 'screenNameMapper'>): void;
|
|
88
68
|
|
|
89
69
|
interface NavigationState {
|
package/dist/index.js
CHANGED
|
@@ -182,14 +182,26 @@ function SunglassesProvider({
|
|
|
182
182
|
|
|
183
183
|
// src/useExpoRouterScreenTracking.ts
|
|
184
184
|
var import_react3 = require("react");
|
|
185
|
+
|
|
186
|
+
// src/expoRouterCompat.ts
|
|
187
|
+
var _useGlobalSearchParams = null;
|
|
188
|
+
var _usePathname = null;
|
|
189
|
+
try {
|
|
190
|
+
const expoRouter = require("expo-router");
|
|
191
|
+
_useGlobalSearchParams = expoRouter.useGlobalSearchParams;
|
|
192
|
+
_usePathname = expoRouter.usePathname;
|
|
193
|
+
} catch {
|
|
194
|
+
}
|
|
195
|
+
var useGlobalSearchParams = _useGlobalSearchParams;
|
|
196
|
+
var usePathname = _usePathname;
|
|
197
|
+
|
|
198
|
+
// src/useExpoRouterScreenTracking.ts
|
|
199
|
+
function _noopPathname() {
|
|
200
|
+
return "";
|
|
201
|
+
}
|
|
202
|
+
var _impl = usePathname ?? _noopPathname;
|
|
185
203
|
function useExpoRouterScreenTracking(client, options = {}) {
|
|
186
|
-
|
|
187
|
-
try {
|
|
188
|
-
const { usePathname: usePathname2 } = require("expo-router");
|
|
189
|
-
pathname = usePathname2();
|
|
190
|
-
} catch {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
204
|
+
const pathname = _impl();
|
|
193
205
|
const { screenNameMapper } = options;
|
|
194
206
|
(0, import_react3.useEffect)(() => {
|
|
195
207
|
if (!pathname) return;
|
|
@@ -277,20 +289,6 @@ function useLinkingUtmCapture(client) {
|
|
|
277
289
|
|
|
278
290
|
// src/useExpoRouterUtmCapture.ts
|
|
279
291
|
var import_react6 = require("react");
|
|
280
|
-
|
|
281
|
-
// src/expoRouterCompat.ts
|
|
282
|
-
var _useGlobalSearchParams = null;
|
|
283
|
-
var _usePathname = null;
|
|
284
|
-
try {
|
|
285
|
-
const expoRouter = require("expo-router");
|
|
286
|
-
_useGlobalSearchParams = expoRouter.useGlobalSearchParams;
|
|
287
|
-
_usePathname = expoRouter.usePathname;
|
|
288
|
-
} catch {
|
|
289
|
-
}
|
|
290
|
-
var useGlobalSearchParams = _useGlobalSearchParams;
|
|
291
|
-
var usePathname = _usePathname;
|
|
292
|
-
|
|
293
|
-
// src/useExpoRouterUtmCapture.ts
|
|
294
292
|
function useExpoRouterUtmCapture(client) {
|
|
295
293
|
if (!useGlobalSearchParams) return;
|
|
296
294
|
const params = useGlobalSearchParams();
|
|
@@ -355,6 +353,7 @@ var GlobalErrorBoundaryInner = class extends import_react8.default.Component {
|
|
|
355
353
|
return { hasError: true };
|
|
356
354
|
}
|
|
357
355
|
componentDidMount() {
|
|
356
|
+
if (typeof import_sunglasses_core4.subscribeGlobalError !== "function") return;
|
|
358
357
|
this.unsubscribe = (0, import_sunglasses_core4.subscribeGlobalError)((info) => this.handleGlobalError(info));
|
|
359
358
|
}
|
|
360
359
|
componentWillUnmount() {
|
package/dist/index.mjs
CHANGED
|
@@ -138,14 +138,26 @@ function SunglassesProvider({
|
|
|
138
138
|
|
|
139
139
|
// src/useExpoRouterScreenTracking.ts
|
|
140
140
|
import { useEffect as useEffect2 } from "react";
|
|
141
|
+
|
|
142
|
+
// src/expoRouterCompat.ts
|
|
143
|
+
var _useGlobalSearchParams = null;
|
|
144
|
+
var _usePathname = null;
|
|
145
|
+
try {
|
|
146
|
+
const expoRouter = __require("expo-router");
|
|
147
|
+
_useGlobalSearchParams = expoRouter.useGlobalSearchParams;
|
|
148
|
+
_usePathname = expoRouter.usePathname;
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
var useGlobalSearchParams = _useGlobalSearchParams;
|
|
152
|
+
var usePathname = _usePathname;
|
|
153
|
+
|
|
154
|
+
// src/useExpoRouterScreenTracking.ts
|
|
155
|
+
function _noopPathname() {
|
|
156
|
+
return "";
|
|
157
|
+
}
|
|
158
|
+
var _impl = usePathname ?? _noopPathname;
|
|
141
159
|
function useExpoRouterScreenTracking(client, options = {}) {
|
|
142
|
-
|
|
143
|
-
try {
|
|
144
|
-
const { usePathname: usePathname2 } = __require("expo-router");
|
|
145
|
-
pathname = usePathname2();
|
|
146
|
-
} catch {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
160
|
+
const pathname = _impl();
|
|
149
161
|
const { screenNameMapper } = options;
|
|
150
162
|
useEffect2(() => {
|
|
151
163
|
if (!pathname) return;
|
|
@@ -233,20 +245,6 @@ function useLinkingUtmCapture(client) {
|
|
|
233
245
|
|
|
234
246
|
// src/useExpoRouterUtmCapture.ts
|
|
235
247
|
import { useEffect as useEffect5 } from "react";
|
|
236
|
-
|
|
237
|
-
// src/expoRouterCompat.ts
|
|
238
|
-
var _useGlobalSearchParams = null;
|
|
239
|
-
var _usePathname = null;
|
|
240
|
-
try {
|
|
241
|
-
const expoRouter = __require("expo-router");
|
|
242
|
-
_useGlobalSearchParams = expoRouter.useGlobalSearchParams;
|
|
243
|
-
_usePathname = expoRouter.usePathname;
|
|
244
|
-
} catch {
|
|
245
|
-
}
|
|
246
|
-
var useGlobalSearchParams = _useGlobalSearchParams;
|
|
247
|
-
var usePathname = _usePathname;
|
|
248
|
-
|
|
249
|
-
// src/useExpoRouterUtmCapture.ts
|
|
250
248
|
function useExpoRouterUtmCapture(client) {
|
|
251
249
|
if (!useGlobalSearchParams) return;
|
|
252
250
|
const params = useGlobalSearchParams();
|
|
@@ -311,6 +309,7 @@ var GlobalErrorBoundaryInner = class extends React3.Component {
|
|
|
311
309
|
return { hasError: true };
|
|
312
310
|
}
|
|
313
311
|
componentDidMount() {
|
|
312
|
+
if (typeof subscribeGlobalError !== "function") return;
|
|
314
313
|
this.unsubscribe = subscribeGlobalError((info) => this.handleGlobalError(info));
|
|
315
314
|
}
|
|
316
315
|
componentWillUnmount() {
|
package/package.json
CHANGED