@allstak/react-native 0.3.0 → 0.3.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 CHANGED
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+
1
3
  /**
2
4
  * Minimal HTTP transport for React Native. Uses the global `fetch` (always
3
5
  * present in RN >= 0.60) with a 3s timeout. Failed sends fall into a small
@@ -296,9 +298,36 @@ interface HttpTrackingOptions {
296
298
  maxBodyBytes?: number;
297
299
  }
298
300
 
301
+ /**
302
+ * Per-console-method capture flags. Defaults are set to keep the
303
+ * dashboard signal-to-noise high: `warn` and `error` capture by default
304
+ * (most apps fire those at human-meaningful moments), `log` and `info`
305
+ * are OFF by default since typical apps log thousands of debug lines
306
+ * per session.
307
+ *
308
+ * Override per-method:
309
+ *
310
+ * <AllStakProvider captureConsole={{ log: true, info: true }} />
311
+ *
312
+ * Or to fully suppress:
313
+ *
314
+ * <AllStakProvider captureConsole={{ warn: false, error: false }} />
315
+ *
316
+ * Setting `autoConsoleBreadcrumbs={false}` on the provider/install is a
317
+ * higher-level kill switch — it skips wrapping any console method.
318
+ */
319
+ interface ConsoleCaptureOptions {
320
+ log?: boolean;
321
+ info?: boolean;
322
+ warn?: boolean;
323
+ error?: boolean;
324
+ }
325
+ /** @internal — for tests. Resets the wrap-once flag. */
326
+ declare function __resetConsoleInstrumentationFlagForTest(): void;
327
+
299
328
  declare const INGEST_HOST = "https://api.allstak.sa";
300
329
  declare const SDK_NAME = "allstak-react-native";
301
- declare const SDK_VERSION = "0.3.0";
330
+ declare const SDK_VERSION = "0.3.1";
302
331
 
303
332
  interface AllStakConfig {
304
333
  /** Project API key (`ask_live_…`). Required. */
@@ -351,6 +380,12 @@ interface AllStakConfig {
351
380
  * are ALWAYS redacted.
352
381
  */
353
382
  httpTracking?: HttpTrackingOptions;
383
+ /**
384
+ * Per-console-method capture flags. Defaults: warn + error captured,
385
+ * log + info NOT captured (to avoid breadcrumb spam from typical app
386
+ * logging). Set `{ log: true, info: true }` to opt-in.
387
+ */
388
+ captureConsole?: ConsoleCaptureOptions;
354
389
  maxBreadcrumbs?: number;
355
390
  /**
356
391
  * Probability in [0, 1] that any given error is sent. Default: 1 (no sampling).
@@ -560,6 +595,109 @@ declare const AllStak: {
560
595
  _getInstance(): AllStakClient | null;
561
596
  };
562
597
 
598
+ /**
599
+ * React Native runtime integration — ErrorUtils, Hermes promise rejection
600
+ * tracking, Platform tags, AppState breadcrumbs, XHR network capture,
601
+ * fetch breadcrumbs, and console breadcrumbs.
602
+ *
603
+ * Extracted from index.ts so AllStakProvider can call it without circular
604
+ * imports.
605
+ */
606
+ interface ReactNativeInstallOptions {
607
+ /** Auto-capture unhandled JS exceptions via ErrorUtils. Default: true */
608
+ autoErrorHandler?: boolean;
609
+ /** Auto-capture unhandled promise rejections (Hermes). Default: true */
610
+ autoPromiseRejections?: boolean;
611
+ /** Auto-attach Platform.* info as tags. Default: true */
612
+ autoDeviceTags?: boolean;
613
+ /** Auto-emit breadcrumbs on AppState change. Default: true */
614
+ autoAppStateBreadcrumbs?: boolean;
615
+ /** Auto-instrument XHR (RN's fetch is XHR-based) for network breadcrumbs. Default: true */
616
+ autoNetworkCapture?: boolean;
617
+ /** Wrap `globalThis.fetch` to record HTTP breadcrumbs. Default: true */
618
+ autoFetchBreadcrumbs?: boolean;
619
+ /**
620
+ * Wrap `console.*` methods to record log breadcrumbs. Default: true.
621
+ * Per-method capture is controlled by `captureConsole` in AllStakConfig
622
+ * (warn + error default on, log + info default off).
623
+ */
624
+ autoConsoleBreadcrumbs?: boolean;
625
+ /**
626
+ * Auto-detect `@react-navigation/native` and patch `NavigationContainer`
627
+ * so route changes ship as breadcrumbs without the host app needing
628
+ * to call `instrumentReactNavigation(ref)`. Default: true. When the
629
+ * package is not installed, this silently no-ops.
630
+ */
631
+ autoNavigationBreadcrumbs?: boolean;
632
+ /**
633
+ * Emit a `[AllStak] Navigation auto-instrumentation enabled/not applied`
634
+ * console log so developers can confirm the wiring at startup. The
635
+ * provider sets this from its `debug` prop; defaults to false when
636
+ * called manually.
637
+ */
638
+ debugLogs?: boolean;
639
+ }
640
+ declare function installReactNative(options?: ReactNativeInstallOptions): void;
641
+
642
+ interface AllStakProviderProps extends ReactNativeInstallOptions {
643
+ children: React.ReactNode;
644
+ apiKey: string;
645
+ environment?: string;
646
+ release?: string;
647
+ host?: string;
648
+ user?: {
649
+ id?: string;
650
+ email?: string;
651
+ };
652
+ tags?: Record<string, string>;
653
+ debug?: boolean;
654
+ enableHttpTracking?: boolean;
655
+ httpTracking?: AllStakConfig['httpTracking'];
656
+ /**
657
+ * Per-console-method capture flags. Defaults: warn + error on, log +
658
+ * info off. Set `{ log: true, info: true }` to opt-in to verbose
659
+ * capture, or `{ warn: false, error: false }` to suppress.
660
+ */
661
+ captureConsole?: AllStakConfig['captureConsole'];
662
+ sampleRate?: number;
663
+ beforeSend?: AllStakConfig['beforeSend'];
664
+ replay?: AllStakConfig['replay'];
665
+ tracesSampleRate?: number;
666
+ service?: string;
667
+ dist?: string;
668
+ /**
669
+ * Tear down the SDK when the provider unmounts. Default `false`.
670
+ *
671
+ * Most apps mount `AllStakProvider` once at the root and never unmount
672
+ * it. Setting this to `true` risks disabling telemetry if the provider
673
+ * re-mounts (Fast Refresh in dev, route key changes, React 18 Strict
674
+ * Mode double-mount, etc.) — there is a brief window between unmount
675
+ * and remount where captures throw.
676
+ *
677
+ * Leave at the default unless you genuinely need to dispose the SDK
678
+ * (e.g. test harness, multi-tenant container that switches projects).
679
+ */
680
+ destroyOnUnmount?: boolean;
681
+ fallback?: React.ReactNode | ((props: {
682
+ error: Error;
683
+ resetError: () => void;
684
+ }) => React.ReactNode);
685
+ onError?: (error: Error, componentStack?: string) => void;
686
+ }
687
+ declare function AllStakProvider({ children, apiKey, environment, release, host, user, tags, debug, enableHttpTracking, httpTracking, captureConsole, sampleRate, beforeSend, replay, tracesSampleRate, service, dist, destroyOnUnmount, fallback, onError, autoErrorHandler, autoPromiseRejections, autoDeviceTags, autoAppStateBreadcrumbs, autoNetworkCapture, autoFetchBreadcrumbs, autoConsoleBreadcrumbs, autoNavigationBreadcrumbs, }: AllStakProviderProps): React.ReactElement;
688
+ declare function useAllStak(): {
689
+ captureException: (error: Error, ctx?: Record<string, unknown>) => void;
690
+ captureMessage: (msg: string, level?: "fatal" | "error" | "warning" | "info") => void;
691
+ setUser: (user: {
692
+ id?: string;
693
+ email?: string;
694
+ }) => void;
695
+ setTag: (key: string, value: string) => void;
696
+ addBreadcrumb: (type: string, message: string, level?: string, data?: Record<string, unknown>) => void;
697
+ };
698
+ /** @internal — for tests. Resets the module-level remount-guard. */
699
+ declare function __resetProviderInstanceForTest(): void;
700
+
563
701
  /**
564
702
  * React Native navigation breadcrumbs — two opt-in helpers:
565
703
  *
@@ -611,6 +749,38 @@ declare function instrumentReactNavigation(navigationRef: NavigationRef, options
611
749
  * as breadcrumbs. No-op if `react-native` isn't available (test env).
612
750
  */
613
751
  declare function instrumentNavigationFromLinking(): void;
752
+ /**
753
+ * Best-effort automatic instrumentation of `@react-navigation/native`.
754
+ *
755
+ * **What it does:**
756
+ * - Tries `require('@react-navigation/native')`. If the package is not
757
+ * installed, returns `false` and is otherwise a no-op.
758
+ * - If found, monkey-patches the module's exported `NavigationContainer`
759
+ * with a wrapper that auto-creates an internal ref, forwards the
760
+ * user's `ref` prop, and on mount calls `instrumentReactNavigation`
761
+ * so route changes ship as breadcrumbs.
762
+ * - Idempotent: a flag on the module's exports object prevents double
763
+ * patching across hot-reload cycles or repeated `installReactNative`
764
+ * calls.
765
+ *
766
+ * **Why this works:**
767
+ * Babel's CommonJS interop preserves runtime property lookups for
768
+ * named imports — `import { NavigationContainer } from '@react-navigation/native'`
769
+ * compiles to `_rnav.NavigationContainer` accesses at use-site, so
770
+ * patching the module's exports object before the host app renders
771
+ * means user code transparently picks up our wrapper.
772
+ *
773
+ * **Why it might fail:**
774
+ * - `@react-navigation/native` not installed → returns false silently.
775
+ * - Module exports frozen or sealed (rare in CJS-style RN builds).
776
+ * - User imported `NavigationContainer` via a deep path that bypasses
777
+ * the index module.
778
+ * In any failure case the manual API (`instrumentReactNavigation(ref)`)
779
+ * is still available as a fallback.
780
+ */
781
+ declare function tryAutoInstrumentNavigation(): boolean;
782
+ /** @internal — for tests. Resets the auto-patch flag on the cached module. */
783
+ declare function __resetAutoNavigationFlagForTest(): void;
614
784
 
615
785
  /**
616
786
  * React Native architecture / runtime detection.
@@ -658,8 +828,21 @@ declare function applyArchitectureTags(setTag: (key: string, value: string) => v
658
828
  * `document`, `localStorage`, `sessionStorage`, or browser DOM event
659
829
  * listeners.
660
830
  *
661
- * Usage:
831
+ * Recommended usage (one-liner):
832
+ *
833
+ * import { AllStakProvider } from '@allstak/react-native';
662
834
  *
835
+ * export default function App() {
836
+ * return (
837
+ * <AllStakProvider apiKey="YOUR_API_KEY" environment="production">
838
+ * <AppRoot />
839
+ * </AllStakProvider>
840
+ * );
841
+ * }
842
+ *
843
+ * Advanced / manual usage:
844
+ *
845
+ * import { AllStak, installReactNative } from '@allstak/react-native';
663
846
  * AllStak.init({ apiKey, environment, release });
664
847
  * installReactNative();
665
848
  *
@@ -667,29 +850,24 @@ declare function applyArchitectureTags(setTag: (key: string, value: string) => v
667
850
  * under the `native/` directory in this package. See README.
668
851
  */
669
852
 
670
- interface ReactNativeInstallOptions {
671
- /** Auto-capture unhandled JS exceptions via ErrorUtils. Default: true */
672
- autoErrorHandler?: boolean;
673
- /** Auto-capture unhandled promise rejections (Hermes). Default: true */
674
- autoPromiseRejections?: boolean;
675
- /** Auto-attach Platform.* info as tags. Default: true */
676
- autoDeviceTags?: boolean;
677
- /** Auto-emit breadcrumbs on AppState change. Default: true */
678
- autoAppStateBreadcrumbs?: boolean;
679
- /** Auto-instrument XHR (RN's fetch is XHR-based) for network breadcrumbs. Default: true */
680
- autoNetworkCapture?: boolean;
681
- /** Wrap `globalThis.fetch` to record HTTP breadcrumbs. Default: true */
682
- autoFetchBreadcrumbs?: boolean;
683
- /** Wrap `console.warn`/`console.error` to record log breadcrumbs. Default: true */
684
- autoConsoleBreadcrumbs?: boolean;
685
- }
686
853
  declare function __setNativeModuleForTest(mod: any): void;
854
+ /**
855
+ * DEV-ONLY: deliberately trigger a native iOS or Android crash via the
856
+ * linked AllStak native module. This is intended for verifying the
857
+ * native-crash → drain → ingest pipeline during SDK development. It
858
+ * **terminates the app process** — never expose this in production UI.
859
+ *
860
+ * import { __devTriggerNativeCrash } from '@allstak/react-native';
861
+ * if (__DEV__) __devTriggerNativeCrash(); // app dies; relaunch drains
862
+ *
863
+ * No-op when the native module is not linked.
864
+ */
865
+ declare function __devTriggerNativeCrash(): Promise<void>;
687
866
  /**
688
867
  * Drain any native crash stashed by AllStakCrashHandler on the previous
689
868
  * launch and ship it to /ingest/v1/errors. No-op when the native module
690
869
  * is not linked (Expo Go, JS-only test runners, etc).
691
870
  */
692
871
  declare function drainPendingNativeCrashes(release?: string): Promise<void>;
693
- declare function installReactNative(options?: ReactNativeInstallOptions): void;
694
872
 
695
- export { AllStak, AllStakClient, type AllStakConfig, type ArchitectureInfo, type Breadcrumb, type HttpRequestEvent, HttpRequestModule, type HttpTrackingOptions, INGEST_HOST, type ReactNativeInstallOptions, ReplaySurrogate, type ReplaySurrogateOptions, SDK_NAME, SDK_VERSION, Scope, __setNativeModuleForTest, applyArchitectureTags, detectArchitecture, drainPendingNativeCrashes, installReactNative, instrumentNavigationFromLinking, instrumentReactNavigation };
873
+ export { AllStak, AllStakClient, type AllStakConfig, AllStakProvider, type AllStakProviderProps, type ArchitectureInfo, type Breadcrumb, type ConsoleCaptureOptions, type HttpRequestEvent, HttpRequestModule, type HttpTrackingOptions, INGEST_HOST, type ReactNativeInstallOptions, ReplaySurrogate, type ReplaySurrogateOptions, SDK_NAME, SDK_VERSION, Scope, __devTriggerNativeCrash, __resetAutoNavigationFlagForTest, __resetConsoleInstrumentationFlagForTest, __resetProviderInstanceForTest, __setNativeModuleForTest, applyArchitectureTags, detectArchitecture, drainPendingNativeCrashes, installReactNative, instrumentNavigationFromLinking, instrumentReactNavigation, tryAutoInstrumentNavigation, useAllStak };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+
1
3
  /**
2
4
  * Minimal HTTP transport for React Native. Uses the global `fetch` (always
3
5
  * present in RN >= 0.60) with a 3s timeout. Failed sends fall into a small
@@ -296,9 +298,36 @@ interface HttpTrackingOptions {
296
298
  maxBodyBytes?: number;
297
299
  }
298
300
 
301
+ /**
302
+ * Per-console-method capture flags. Defaults are set to keep the
303
+ * dashboard signal-to-noise high: `warn` and `error` capture by default
304
+ * (most apps fire those at human-meaningful moments), `log` and `info`
305
+ * are OFF by default since typical apps log thousands of debug lines
306
+ * per session.
307
+ *
308
+ * Override per-method:
309
+ *
310
+ * <AllStakProvider captureConsole={{ log: true, info: true }} />
311
+ *
312
+ * Or to fully suppress:
313
+ *
314
+ * <AllStakProvider captureConsole={{ warn: false, error: false }} />
315
+ *
316
+ * Setting `autoConsoleBreadcrumbs={false}` on the provider/install is a
317
+ * higher-level kill switch — it skips wrapping any console method.
318
+ */
319
+ interface ConsoleCaptureOptions {
320
+ log?: boolean;
321
+ info?: boolean;
322
+ warn?: boolean;
323
+ error?: boolean;
324
+ }
325
+ /** @internal — for tests. Resets the wrap-once flag. */
326
+ declare function __resetConsoleInstrumentationFlagForTest(): void;
327
+
299
328
  declare const INGEST_HOST = "https://api.allstak.sa";
300
329
  declare const SDK_NAME = "allstak-react-native";
301
- declare const SDK_VERSION = "0.3.0";
330
+ declare const SDK_VERSION = "0.3.1";
302
331
 
303
332
  interface AllStakConfig {
304
333
  /** Project API key (`ask_live_…`). Required. */
@@ -351,6 +380,12 @@ interface AllStakConfig {
351
380
  * are ALWAYS redacted.
352
381
  */
353
382
  httpTracking?: HttpTrackingOptions;
383
+ /**
384
+ * Per-console-method capture flags. Defaults: warn + error captured,
385
+ * log + info NOT captured (to avoid breadcrumb spam from typical app
386
+ * logging). Set `{ log: true, info: true }` to opt-in.
387
+ */
388
+ captureConsole?: ConsoleCaptureOptions;
354
389
  maxBreadcrumbs?: number;
355
390
  /**
356
391
  * Probability in [0, 1] that any given error is sent. Default: 1 (no sampling).
@@ -560,6 +595,109 @@ declare const AllStak: {
560
595
  _getInstance(): AllStakClient | null;
561
596
  };
562
597
 
598
+ /**
599
+ * React Native runtime integration — ErrorUtils, Hermes promise rejection
600
+ * tracking, Platform tags, AppState breadcrumbs, XHR network capture,
601
+ * fetch breadcrumbs, and console breadcrumbs.
602
+ *
603
+ * Extracted from index.ts so AllStakProvider can call it without circular
604
+ * imports.
605
+ */
606
+ interface ReactNativeInstallOptions {
607
+ /** Auto-capture unhandled JS exceptions via ErrorUtils. Default: true */
608
+ autoErrorHandler?: boolean;
609
+ /** Auto-capture unhandled promise rejections (Hermes). Default: true */
610
+ autoPromiseRejections?: boolean;
611
+ /** Auto-attach Platform.* info as tags. Default: true */
612
+ autoDeviceTags?: boolean;
613
+ /** Auto-emit breadcrumbs on AppState change. Default: true */
614
+ autoAppStateBreadcrumbs?: boolean;
615
+ /** Auto-instrument XHR (RN's fetch is XHR-based) for network breadcrumbs. Default: true */
616
+ autoNetworkCapture?: boolean;
617
+ /** Wrap `globalThis.fetch` to record HTTP breadcrumbs. Default: true */
618
+ autoFetchBreadcrumbs?: boolean;
619
+ /**
620
+ * Wrap `console.*` methods to record log breadcrumbs. Default: true.
621
+ * Per-method capture is controlled by `captureConsole` in AllStakConfig
622
+ * (warn + error default on, log + info default off).
623
+ */
624
+ autoConsoleBreadcrumbs?: boolean;
625
+ /**
626
+ * Auto-detect `@react-navigation/native` and patch `NavigationContainer`
627
+ * so route changes ship as breadcrumbs without the host app needing
628
+ * to call `instrumentReactNavigation(ref)`. Default: true. When the
629
+ * package is not installed, this silently no-ops.
630
+ */
631
+ autoNavigationBreadcrumbs?: boolean;
632
+ /**
633
+ * Emit a `[AllStak] Navigation auto-instrumentation enabled/not applied`
634
+ * console log so developers can confirm the wiring at startup. The
635
+ * provider sets this from its `debug` prop; defaults to false when
636
+ * called manually.
637
+ */
638
+ debugLogs?: boolean;
639
+ }
640
+ declare function installReactNative(options?: ReactNativeInstallOptions): void;
641
+
642
+ interface AllStakProviderProps extends ReactNativeInstallOptions {
643
+ children: React.ReactNode;
644
+ apiKey: string;
645
+ environment?: string;
646
+ release?: string;
647
+ host?: string;
648
+ user?: {
649
+ id?: string;
650
+ email?: string;
651
+ };
652
+ tags?: Record<string, string>;
653
+ debug?: boolean;
654
+ enableHttpTracking?: boolean;
655
+ httpTracking?: AllStakConfig['httpTracking'];
656
+ /**
657
+ * Per-console-method capture flags. Defaults: warn + error on, log +
658
+ * info off. Set `{ log: true, info: true }` to opt-in to verbose
659
+ * capture, or `{ warn: false, error: false }` to suppress.
660
+ */
661
+ captureConsole?: AllStakConfig['captureConsole'];
662
+ sampleRate?: number;
663
+ beforeSend?: AllStakConfig['beforeSend'];
664
+ replay?: AllStakConfig['replay'];
665
+ tracesSampleRate?: number;
666
+ service?: string;
667
+ dist?: string;
668
+ /**
669
+ * Tear down the SDK when the provider unmounts. Default `false`.
670
+ *
671
+ * Most apps mount `AllStakProvider` once at the root and never unmount
672
+ * it. Setting this to `true` risks disabling telemetry if the provider
673
+ * re-mounts (Fast Refresh in dev, route key changes, React 18 Strict
674
+ * Mode double-mount, etc.) — there is a brief window between unmount
675
+ * and remount where captures throw.
676
+ *
677
+ * Leave at the default unless you genuinely need to dispose the SDK
678
+ * (e.g. test harness, multi-tenant container that switches projects).
679
+ */
680
+ destroyOnUnmount?: boolean;
681
+ fallback?: React.ReactNode | ((props: {
682
+ error: Error;
683
+ resetError: () => void;
684
+ }) => React.ReactNode);
685
+ onError?: (error: Error, componentStack?: string) => void;
686
+ }
687
+ declare function AllStakProvider({ children, apiKey, environment, release, host, user, tags, debug, enableHttpTracking, httpTracking, captureConsole, sampleRate, beforeSend, replay, tracesSampleRate, service, dist, destroyOnUnmount, fallback, onError, autoErrorHandler, autoPromiseRejections, autoDeviceTags, autoAppStateBreadcrumbs, autoNetworkCapture, autoFetchBreadcrumbs, autoConsoleBreadcrumbs, autoNavigationBreadcrumbs, }: AllStakProviderProps): React.ReactElement;
688
+ declare function useAllStak(): {
689
+ captureException: (error: Error, ctx?: Record<string, unknown>) => void;
690
+ captureMessage: (msg: string, level?: "fatal" | "error" | "warning" | "info") => void;
691
+ setUser: (user: {
692
+ id?: string;
693
+ email?: string;
694
+ }) => void;
695
+ setTag: (key: string, value: string) => void;
696
+ addBreadcrumb: (type: string, message: string, level?: string, data?: Record<string, unknown>) => void;
697
+ };
698
+ /** @internal — for tests. Resets the module-level remount-guard. */
699
+ declare function __resetProviderInstanceForTest(): void;
700
+
563
701
  /**
564
702
  * React Native navigation breadcrumbs — two opt-in helpers:
565
703
  *
@@ -611,6 +749,38 @@ declare function instrumentReactNavigation(navigationRef: NavigationRef, options
611
749
  * as breadcrumbs. No-op if `react-native` isn't available (test env).
612
750
  */
613
751
  declare function instrumentNavigationFromLinking(): void;
752
+ /**
753
+ * Best-effort automatic instrumentation of `@react-navigation/native`.
754
+ *
755
+ * **What it does:**
756
+ * - Tries `require('@react-navigation/native')`. If the package is not
757
+ * installed, returns `false` and is otherwise a no-op.
758
+ * - If found, monkey-patches the module's exported `NavigationContainer`
759
+ * with a wrapper that auto-creates an internal ref, forwards the
760
+ * user's `ref` prop, and on mount calls `instrumentReactNavigation`
761
+ * so route changes ship as breadcrumbs.
762
+ * - Idempotent: a flag on the module's exports object prevents double
763
+ * patching across hot-reload cycles or repeated `installReactNative`
764
+ * calls.
765
+ *
766
+ * **Why this works:**
767
+ * Babel's CommonJS interop preserves runtime property lookups for
768
+ * named imports — `import { NavigationContainer } from '@react-navigation/native'`
769
+ * compiles to `_rnav.NavigationContainer` accesses at use-site, so
770
+ * patching the module's exports object before the host app renders
771
+ * means user code transparently picks up our wrapper.
772
+ *
773
+ * **Why it might fail:**
774
+ * - `@react-navigation/native` not installed → returns false silently.
775
+ * - Module exports frozen or sealed (rare in CJS-style RN builds).
776
+ * - User imported `NavigationContainer` via a deep path that bypasses
777
+ * the index module.
778
+ * In any failure case the manual API (`instrumentReactNavigation(ref)`)
779
+ * is still available as a fallback.
780
+ */
781
+ declare function tryAutoInstrumentNavigation(): boolean;
782
+ /** @internal — for tests. Resets the auto-patch flag on the cached module. */
783
+ declare function __resetAutoNavigationFlagForTest(): void;
614
784
 
615
785
  /**
616
786
  * React Native architecture / runtime detection.
@@ -658,8 +828,21 @@ declare function applyArchitectureTags(setTag: (key: string, value: string) => v
658
828
  * `document`, `localStorage`, `sessionStorage`, or browser DOM event
659
829
  * listeners.
660
830
  *
661
- * Usage:
831
+ * Recommended usage (one-liner):
832
+ *
833
+ * import { AllStakProvider } from '@allstak/react-native';
662
834
  *
835
+ * export default function App() {
836
+ * return (
837
+ * <AllStakProvider apiKey="YOUR_API_KEY" environment="production">
838
+ * <AppRoot />
839
+ * </AllStakProvider>
840
+ * );
841
+ * }
842
+ *
843
+ * Advanced / manual usage:
844
+ *
845
+ * import { AllStak, installReactNative } from '@allstak/react-native';
663
846
  * AllStak.init({ apiKey, environment, release });
664
847
  * installReactNative();
665
848
  *
@@ -667,29 +850,24 @@ declare function applyArchitectureTags(setTag: (key: string, value: string) => v
667
850
  * under the `native/` directory in this package. See README.
668
851
  */
669
852
 
670
- interface ReactNativeInstallOptions {
671
- /** Auto-capture unhandled JS exceptions via ErrorUtils. Default: true */
672
- autoErrorHandler?: boolean;
673
- /** Auto-capture unhandled promise rejections (Hermes). Default: true */
674
- autoPromiseRejections?: boolean;
675
- /** Auto-attach Platform.* info as tags. Default: true */
676
- autoDeviceTags?: boolean;
677
- /** Auto-emit breadcrumbs on AppState change. Default: true */
678
- autoAppStateBreadcrumbs?: boolean;
679
- /** Auto-instrument XHR (RN's fetch is XHR-based) for network breadcrumbs. Default: true */
680
- autoNetworkCapture?: boolean;
681
- /** Wrap `globalThis.fetch` to record HTTP breadcrumbs. Default: true */
682
- autoFetchBreadcrumbs?: boolean;
683
- /** Wrap `console.warn`/`console.error` to record log breadcrumbs. Default: true */
684
- autoConsoleBreadcrumbs?: boolean;
685
- }
686
853
  declare function __setNativeModuleForTest(mod: any): void;
854
+ /**
855
+ * DEV-ONLY: deliberately trigger a native iOS or Android crash via the
856
+ * linked AllStak native module. This is intended for verifying the
857
+ * native-crash → drain → ingest pipeline during SDK development. It
858
+ * **terminates the app process** — never expose this in production UI.
859
+ *
860
+ * import { __devTriggerNativeCrash } from '@allstak/react-native';
861
+ * if (__DEV__) __devTriggerNativeCrash(); // app dies; relaunch drains
862
+ *
863
+ * No-op when the native module is not linked.
864
+ */
865
+ declare function __devTriggerNativeCrash(): Promise<void>;
687
866
  /**
688
867
  * Drain any native crash stashed by AllStakCrashHandler on the previous
689
868
  * launch and ship it to /ingest/v1/errors. No-op when the native module
690
869
  * is not linked (Expo Go, JS-only test runners, etc).
691
870
  */
692
871
  declare function drainPendingNativeCrashes(release?: string): Promise<void>;
693
- declare function installReactNative(options?: ReactNativeInstallOptions): void;
694
872
 
695
- export { AllStak, AllStakClient, type AllStakConfig, type ArchitectureInfo, type Breadcrumb, type HttpRequestEvent, HttpRequestModule, type HttpTrackingOptions, INGEST_HOST, type ReactNativeInstallOptions, ReplaySurrogate, type ReplaySurrogateOptions, SDK_NAME, SDK_VERSION, Scope, __setNativeModuleForTest, applyArchitectureTags, detectArchitecture, drainPendingNativeCrashes, installReactNative, instrumentNavigationFromLinking, instrumentReactNavigation };
873
+ export { AllStak, AllStakClient, type AllStakConfig, AllStakProvider, type AllStakProviderProps, type ArchitectureInfo, type Breadcrumb, type ConsoleCaptureOptions, type HttpRequestEvent, HttpRequestModule, type HttpTrackingOptions, INGEST_HOST, type ReactNativeInstallOptions, ReplaySurrogate, type ReplaySurrogateOptions, SDK_NAME, SDK_VERSION, Scope, __devTriggerNativeCrash, __resetAutoNavigationFlagForTest, __resetConsoleInstrumentationFlagForTest, __resetProviderInstanceForTest, __setNativeModuleForTest, applyArchitectureTags, detectArchitecture, drainPendingNativeCrashes, installReactNative, instrumentNavigationFromLinking, instrumentReactNavigation, tryAutoInstrumentNavigation, useAllStak };