@dynamic-labs/react-native-extension 4.92.4 → 4.93.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.
Files changed (40) hide show
  1. package/android/EmbeddedWebViewController.kt +19 -2
  2. package/android/dynamic/embeddedwebview/EmbeddedWebViewController.kt +19 -2
  3. package/android/embeddedwebview/EmbeddedWebViewController.kt +19 -2
  4. package/android/java/xyz/dynamic/embeddedwebview/EmbeddedWebViewController.kt +19 -2
  5. package/android/main/java/xyz/dynamic/embeddedwebview/EmbeddedWebViewController.kt +19 -2
  6. package/android/src/main/java/xyz/dynamic/embeddedwebview/EmbeddedWebViewController.kt +19 -2
  7. package/android/xyz/dynamic/embeddedwebview/EmbeddedWebViewController.kt +19 -2
  8. package/index.cjs +252 -796
  9. package/index.js +251 -797
  10. package/ios/EmbeddedWebViewController.swift +7 -6
  11. package/package.json +6 -6
  12. package/src/ReactNativeExtension/ReactNativeExtension.d.ts +11 -2
  13. package/src/components/WebView/EmbeddedWebView/EmbeddedWebView.d.ts +6 -19
  14. package/src/components/WebView/WebView.d.ts +17 -6
  15. package/src/errors/WebViewFailedToLoadError.d.ts +1 -86
  16. package/src/components/WebView/EmbeddedWebView/embeddedWebViewPhaseTimers/embeddedWebViewPhaseTimers.d.ts +0 -66
  17. package/src/components/WebView/EmbeddedWebView/embeddedWebViewPhaseTimers/index.d.ts +0 -1
  18. package/src/components/WebView/constants.d.ts +0 -3
  19. package/src/components/WebView/successLog/emitSuccessLog.d.ts +0 -35
  20. package/src/components/WebView/successLog/index.d.ts +0 -3
  21. package/src/components/WebView/useWebViewLoadingTimeout/index.d.ts +0 -1
  22. package/src/components/WebView/useWebViewLoadingTimeout/useWebViewLoadingTimeout.d.ts +0 -4
  23. package/src/components/WebView/useWebViewPhaseTimers/index.d.ts +0 -1
  24. package/src/components/WebView/useWebViewPhaseTimers/useWebViewPhaseTimers.d.ts +0 -46
  25. package/src/components/WebView/useWebViewRecoveryTimeout/index.d.ts +0 -1
  26. package/src/components/WebView/useWebViewRecoveryTimeout/useWebViewRecoveryTimeout.d.ts +0 -12
  27. package/src/components/WebView/useWebViewSuccessLog/index.d.ts +0 -1
  28. package/src/components/WebView/useWebViewSuccessLog/useWebViewSuccessLog.d.ts +0 -28
  29. package/src/components/WebView/utils/assignEnvironmentIdToUrl/assignEnvironmentIdToUrl.d.ts +0 -1
  30. package/src/components/WebView/utils/assignEnvironmentIdToUrl/index.d.ts +0 -1
  31. package/src/components/WebView/utils/assignStartTimeToUrl/assignStartTimeToUrl.d.ts +0 -1
  32. package/src/components/WebView/utils/assignStartTimeToUrl/index.d.ts +0 -1
  33. package/src/components/WebView/utils/hasClearStateInUrl/hasClearStateInUrl.d.ts +0 -1
  34. package/src/components/WebView/utils/hasClearStateInUrl/index.d.ts +0 -1
  35. package/src/components/WebView/utils/increaseRetryToUrl/increaseRetryToUrl.d.ts +0 -1
  36. package/src/components/WebView/utils/increaseRetryToUrl/index.d.ts +0 -1
  37. package/src/components/WebView/utils/setClearStateToUrl/index.d.ts +0 -1
  38. package/src/components/WebView/utils/setClearStateToUrl/setClearStateToUrl.d.ts +0 -1
  39. package/src/components/WebView/webViewPhaseTimerCore/index.d.ts +0 -2
  40. package/src/components/WebView/webViewPhaseTimerCore/webViewPhaseTimerCore.d.ts +0 -123
@@ -1,123 +0,0 @@
1
- import { Core } from '@dynamic-labs/client';
2
- /**
3
- * Per-attempt lifecycle event recorded by the phase-timer core.
4
- *
5
- * - `load_start` — native bridge fired `onLoadStart` (resets per-attempt
6
- * state so timings reflect the current attempt)
7
- * - `load` — native bridge fired `onLoad` (HTML byte stream received)
8
- * - `load_end` — native bridge fired `onLoadEnd` (page finished
9
- * rendering)
10
- * - `native_error` — native bridge raised an `onLoadError`; increments a
11
- * counter that persists across reloads
12
- * - `os_kill` — host detected an OS-level WebView kill (e.g. backgrounded
13
- * for too long); also a cumulative counter
14
- */
15
- export type WebViewPhaseEvent = 'load' | 'load_end' | 'load_start' | 'native_error' | 'os_kill';
16
- export type PerAttemptTimings = {
17
- htmlLoadStartedAt: number | null;
18
- htmlLoadedAt: number | null;
19
- manifestReceivedAt: number | null;
20
- onLoadEndAt: number | null;
21
- sdkReadyAt: number | null;
22
- };
23
- export type CumulativeCounters = {
24
- nativeErrorCount: number;
25
- osKillCount: number;
26
- };
27
- export type PhaseDurations = {
28
- htmlLoadMs: number | null;
29
- manifestReceivedMs: number | null;
30
- onLoadToOnLoadEndMs: number | null;
31
- sdkReadyMs: number | null;
32
- };
33
- /**
34
- * Derive cross-phase durations from raw timestamps. The four durations
35
- * are what end up in the failure / success log meta:
36
- *
37
- * - `htmlLoadMs` — `onLoadStart` to `onLoad`; native HTML fetch
38
- * - `onLoadToOnLoadEndMs` — `onLoad` to `onLoadEnd`; native render/parse
39
- * - `manifestReceivedMs` — `onLoadEnd` to first `manifest` request from
40
- * the webview JS; "JS bundle is alive" signal
41
- * - `sdkReadyMs` — `onLoadEnd` to first `sdkHasLoaded` event from the
42
- * webview JS; "SDK fully bootstrapped" signal
43
- */
44
- export declare const computePhaseDurations: (timings: PerAttemptTimings) => PhaseDurations;
45
- export type WebViewPhaseTimerCore = {
46
- /** Detach the message-transport subscription. */
47
- dispose: () => void;
48
- getCounters: () => CumulativeCounters;
49
- getTimings: () => PerAttemptTimings;
50
- recordEvent: (event: WebViewPhaseEvent) => void;
51
- };
52
- /**
53
- * Path-agnostic shape of the `webview.load_succeeded` instrumentation
54
- * log meta. Both the React `<WebView>` and the embedded native WebView
55
- * paths emit this exact surface so the two log streams can be queried
56
- * together in Datadog without per-path field translation.
57
- *
58
- * The failure meta (`WebViewFailedToLoadErrorMeta`) is this shape plus
59
- * a `phase` discriminator — see `buildSuccessMeta` callers.
60
- */
61
- export type WebViewLoadSuccessMeta = {
62
- hadClearState: boolean;
63
- htmlLoadMs: number | null;
64
- loadingTimeoutMs: number;
65
- manifestReceivedMs: number | null;
66
- nativeErrorCount: number;
67
- onLoadToOnLoadEndMs: number | null;
68
- osKillCount: number;
69
- recoveryTimeoutMs: number;
70
- retryCount: number;
71
- sdkReadyMs: number | null;
72
- webviewUrl: string;
73
- };
74
- type BuildSuccessMetaArgs = {
75
- /**
76
- * Snapshot source for raw timings + cumulative counters. Typically a
77
- * live {@link WebViewPhaseTimerCore} instance, but the type only
78
- * requires `getTimings` / `getCounters` so callers can fall back to
79
- * empty values if the core hasn't been created yet.
80
- */
81
- core: Pick<WebViewPhaseTimerCore, 'getCounters' | 'getTimings'>;
82
- /**
83
- * Whether the current attempt was kicked off by the React
84
- * `<WebView>`'s clear-state recovery flow. Embedded path is always
85
- * `false`.
86
- */
87
- hadClearState: boolean;
88
- loadingTimeoutMs: number;
89
- recoveryTimeoutMs: number;
90
- /**
91
- * Number of times the React `<WebView>` re-mounted via the `?retry=`
92
- * URL query param. Embedded path is always `0`.
93
- */
94
- retryCount: number;
95
- webviewUrl: string;
96
- };
97
- /**
98
- * Build the success-shape meta from a {@link WebViewPhaseTimerCore}
99
- * snapshot plus the path-specific fields. Both call sites call this
100
- * with their own context (RN reads `hadClearState` / `retryCount` from
101
- * the URL; embedded passes constants) so the success-log payload stays
102
- * identical across the two paths.
103
- */
104
- export declare const buildSuccessMeta: ({ core, hadClearState, loadingTimeoutMs, recoveryTimeoutMs, retryCount, webviewUrl, }: BuildSuccessMetaArgs) => WebViewLoadSuccessMeta;
105
- /**
106
- * Shared state machine driving WebView load-phase instrumentation.
107
- *
108
- * Both the React `<WebView>` (RN bridge) and the native embedded WebView
109
- * (native bridge) feed lifecycle events into this core and produce
110
- * matching meta from the same timings + counters. Each path layers its
111
- * own path-specific fields (`hadClearState`, `retryCount`, etc.) on top
112
- * of the raw state this core exposes via `getTimings()` / `getCounters()`.
113
- *
114
- * The core owns the `core.messageTransport` subscription that captures
115
- * the two webview-originated signals bracketing SDK bootstrap
116
- * (`manifest` once the JS bundle is alive; `sdkHasLoadedEventName`
117
- * once the SDK is fully ready). Native bridge lifecycle events come in
118
- * via `recordEvent` instead.
119
- */
120
- export declare const createWebViewPhaseTimerCore: ({ core, }: {
121
- core: Core;
122
- }) => WebViewPhaseTimerCore;
123
- export {};