@dynamic-labs/legacy-client 5.12.0 → 5.13.0
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/CHANGELOG.md +58 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/webviewLoad/WebViewFailedToLoadError/WebViewFailedToLoadError.d.ts +22 -0
- package/src/webviewLoad/constants.cjs +2 -0
- package/src/webviewLoad/constants.d.ts +1 -0
- package/src/webviewLoad/constants.js +2 -1
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadController.cjs +25 -4
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadController.js +25 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,62 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.13.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.4...v5.13.0) (2026-10-27)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* surface wallet creation error on backup-unsuccessful view ([#12600](https://github.com/dynamic-labs/dynamic-auth/issues/12600)) ([660be5d](https://github.com/dynamic-labs/dynamic-auth/commit/660be5dd1b883a848ee23b9df6dcdbc500b13f19))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **bitcoin:** format BTC amounts with a fixed locale in the confirmation modal ([#12598](https://github.com/dynamic-labs/dynamic-auth/issues/12598)) ([51baede](https://github.com/dynamic-labs/dynamic-auth/commit/51baede580dfe49c1c3cd80147b02f391f5c471c))
|
|
13
|
+
* **react-native-extension:** vendor NativeICloudBackup TurboModule spec ([#12613](https://github.com/dynamic-labs/dynamic-auth/issues/12613)) ([27b3d6e](https://github.com/dynamic-labs/dynamic-auth/commit/27b3d6e70a87129ff5a2eecb048c9dbb307dc5a0))
|
|
14
|
+
|
|
15
|
+
### [5.12.4](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.3...v5.12.4) (2026-10-24)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **security:** bump engines.node floor to >=22.23.4 (CVE-2026-111497) ([#12587](https://github.com/dynamic-labs/dynamic-auth/issues/12587)) ([0c49471](https://github.com/dynamic-labs/dynamic-auth/commit/0c4947155333404fbc7b146257cd9f0e7a312a74))
|
|
21
|
+
|
|
22
|
+
### [5.12.3](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.2...v5.12.3) (2026-10-23)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* accept recoveryEncryptionPublicKey in createOfflineRecoveryShares ([#12417](https://github.com/dynamic-labs/dynamic-auth/issues/12417)) ([7bb6dac](https://github.com/dynamic-labs/dynamic-auth/commit/7bb6dac56f4509fba46bc2afc9a37bcfb52aecc5))
|
|
28
|
+
* **client:** add loadId and sdk_bootstrap sub-stage to webview load failure meta ([#12576](https://github.com/dynamic-labs/dynamic-auth/issues/12576)) ([4f5254e](https://github.com/dynamic-labs/dynamic-auth/commit/4f5254e011afbaa20deb10300ea5fa92ae85e56d))
|
|
29
|
+
* **sui:** migrate SDK clients to gRPC ([#12446](https://github.com/dynamic-labs/dynamic-auth/issues/12446)) ([b6c04f3](https://github.com/dynamic-labs/dynamic-auth/commit/b6c04f32bead909439f1e24fb684eeaadd1692d2))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **client:** derive webview bootstrapStage from raw manifest timestamp ([#12578](https://github.com/dynamic-labs/dynamic-auth/issues/12578)) ([965263f](https://github.com/dynamic-labs/dynamic-auth/commit/965263f553d9b83d0fab7f42ed1e76053b514e45))
|
|
35
|
+
* **deps:** bump next 16.4.1 + toml/image-size floors (crit/high vulns) ([#12582](https://github.com/dynamic-labs/dynamic-auth/issues/12582)) ([ac732e4](https://github.com/dynamic-labs/dynamic-auth/commit/ac732e443d450be15f3362c9b59fc29dbe1f1727)), closes [#1163](https://github.com/dynamic-labs/dynamic-auth/issues/1163) [-#1166](https://github.com/dynamic-labs/-/issues/1166) [#1171](https://github.com/dynamic-labs/dynamic-auth/issues/1171) [#1172](https://github.com/dynamic-labs/dynamic-auth/issues/1172) [#1168](https://github.com/dynamic-labs/dynamic-auth/issues/1168) [-#1170](https://github.com/dynamic-labs/-/issues/1170) [#1014](https://github.com/dynamic-labs/dynamic-auth/issues/1014) [-#1019](https://github.com/dynamic-labs/-/issues/1019)
|
|
36
|
+
* **emudhra-fix:** move Maestro Cloud action off Node 20 (v1.9.9 to v3.0.1) ([#12568](https://github.com/dynamic-labs/dynamic-auth/issues/12568)) ([8282d84](https://github.com/dynamic-labs/dynamic-auth/commit/8282d8436edd2c5d7e339884e04a41922fc2581e))
|
|
37
|
+
* **sdk-react-core:** show signing wallet's network in SendBalanceTransactionCard [DYNT-2337] ([#12573](https://github.com/dynamic-labs/dynamic-auth/issues/12573)) ([4f78456](https://github.com/dynamic-labs/dynamic-auth/commit/4f78456b6100075156465b3f5efd0c760b2465ef)), closes [#12063](https://github.com/dynamic-labs/dynamic-auth/issues/12063)
|
|
38
|
+
* **wallet-book:** add a separate OKX Exchange entry ([#12564](https://github.com/dynamic-labs/dynamic-auth/issues/12564)) ([b4dc2ad](https://github.com/dynamic-labs/dynamic-auth/commit/b4dc2adab5a6bc75a1ba96c4f5d6b713dc0fc217))
|
|
39
|
+
* **wallet-book:** open OKX Wallet app for OKX Wallet connections ([#12563](https://github.com/dynamic-labs/dynamic-auth/issues/12563)) ([182bfa7](https://github.com/dynamic-labs/dynamic-auth/commit/182bfa714c883d010333a9d2e4cd748888a2a0d9))
|
|
40
|
+
* **wallet-connect:** send http(s) redirect URLs as universal redirects ([#12565](https://github.com/dynamic-labs/dynamic-auth/issues/12565)) ([ae11460](https://github.com/dynamic-labs/dynamic-auth/commit/ae11460a6d07c843e150932a895ca1462192ef28))
|
|
41
|
+
|
|
42
|
+
### [5.12.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.1...v5.12.2) (2026-10-21)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* **deps:** patch follow-redirects GHSA-8r9p-f939-6h3c and bump test-app next to 16.3.8 ([#12554](https://github.com/dynamic-labs/dynamic-auth/issues/12554)) ([a4df20f](https://github.com/dynamic-labs/dynamic-auth/commit/a4df20f5c5742b2d042c6bd6304843352dbc83bd))
|
|
48
|
+
* **eMudhra-fix:** bump @dynamic-labs-wallet/* to 1.1.47 (eMudhra CA distrust) ([#12561](https://github.com/dynamic-labs/dynamic-auth/issues/12561)) ([6f6a9ce](https://github.com/dynamic-labs/dynamic-auth/commit/6f6a9ce310db000af38b3411d60776b2fa5f9e89))
|
|
49
|
+
* **emudhra-fix:** bump Node to 22.23.4 in CI and actions to Node 24 runtimes ([#12559](https://github.com/dynamic-labs/dynamic-auth/issues/12559)) ([af1a97f](https://github.com/dynamic-labs/dynamic-auth/commit/af1a97fc12629a31a1297aa910fab155f9317163))
|
|
50
|
+
* **wallet-book:** detect TokenPocket EVM via window.tokenpocket and isTokenPocket ([#12546](https://github.com/dynamic-labs/dynamic-auth/issues/12546)) ([bd4f01a](https://github.com/dynamic-labs/dynamic-auth/commit/bd4f01a0b8c4180c1b4a5a5d891c84f8af7f0269))
|
|
51
|
+
|
|
52
|
+
### [5.12.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.0...v5.12.1) (2026-10-20)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* rabby not using native rabby:// scheme when redirecting on android devices [main] ([#12541](https://github.com/dynamic-labs/dynamic-auth/issues/12541)) ([923a372](https://github.com/dynamic-labs/dynamic-auth/commit/923a3724eae5e82ef896de78641320b7320933df))
|
|
58
|
+
* **sui,ton:** sign serialized Sui txs without parsing; native TON balance for jetton sends ([#12503](https://github.com/dynamic-labs/dynamic-auth/issues/12503)) ([6a5bfd6](https://github.com/dynamic-labs/dynamic-auth/commit/6a5bfd6bd0118b8ed7ce079159c10ac47cade337))
|
|
59
|
+
|
|
2
60
|
## [5.12.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.11.0...v5.12.0) (2026-10-16)
|
|
3
61
|
|
|
4
62
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/legacy-client",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"description": "Core package for utilizing Dynamic's sdk",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@vue/reactivity": "^3.4.21",
|
|
22
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
23
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
24
|
-
"@dynamic-labs/locale": "5.
|
|
25
|
-
"@dynamic-labs/logger": "5.
|
|
26
|
-
"@dynamic-labs/message-transport": "5.
|
|
27
|
-
"@dynamic-labs/types": "5.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
29
|
-
"@dynamic-labs/webview-messages": "5.
|
|
22
|
+
"@dynamic-labs/sdk-api-core": "0.136.0",
|
|
23
|
+
"@dynamic-labs/assert-package-version": "5.13.0",
|
|
24
|
+
"@dynamic-labs/locale": "5.13.0",
|
|
25
|
+
"@dynamic-labs/logger": "5.13.0",
|
|
26
|
+
"@dynamic-labs/message-transport": "5.13.0",
|
|
27
|
+
"@dynamic-labs/types": "5.13.0",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "5.13.0",
|
|
29
|
+
"@dynamic-labs/webview-messages": "5.13.0",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {}
|
|
@@ -23,6 +23,17 @@ export type WebViewLoadAttemptFailure = {
|
|
|
23
23
|
/** Native error domain, when the failure came from a native `onLoadError`. */
|
|
24
24
|
nativeErrorDomain?: string;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Which concrete sub-step a `sdk_bootstrap` failure died in, derived from
|
|
28
|
+
* which signals the host saw before the ready window expired:
|
|
29
|
+
* - `bundle_fetch`: no manifest request ever arrived — the webview's JS
|
|
30
|
+
* bundle never ran (download or eval failed, or the bridge never came up).
|
|
31
|
+
* - `sdk_init`: the manifest arrived (bundle alive, bridge works) but the
|
|
32
|
+
* webview-side SDK never signalled ready. Covers init hanging AND the
|
|
33
|
+
* ready message not making it back; the `loadId` query param joins this
|
|
34
|
+
* log with the webview-side boot beacons to tell those two apart.
|
|
35
|
+
*/
|
|
36
|
+
export type WebViewBootstrapStage = 'bundle_fetch' | 'sdk_init';
|
|
26
37
|
/**
|
|
27
38
|
* Structured context attached to {@link WebViewFailedToLoadError} so the
|
|
28
39
|
* resulting error log carries enough information to tell *which* step the
|
|
@@ -35,6 +46,17 @@ export type WebViewLoadAttemptFailure = {
|
|
|
35
46
|
*/
|
|
36
47
|
export type WebViewFailedToLoadErrorMeta = {
|
|
37
48
|
phase: WebViewFailedToLoadErrorPhase;
|
|
49
|
+
/**
|
|
50
|
+
* Sub-step of `sdk_bootstrap` the failure died in; only set when `phase`
|
|
51
|
+
* is `sdk_bootstrap`.
|
|
52
|
+
*/
|
|
53
|
+
bootstrapStage?: WebViewBootstrapStage;
|
|
54
|
+
/**
|
|
55
|
+
* Correlation id stamped on the webview URL (`loadId` query param). The
|
|
56
|
+
* webview-side boot beacons echo it as their instanceId, so a failure log
|
|
57
|
+
* can be joined against `service:waas-browser-iframe` boot stages.
|
|
58
|
+
*/
|
|
59
|
+
loadId?: string;
|
|
38
60
|
/**
|
|
39
61
|
* Milliseconds between RN's `onLoadStart` and `onLoad` callbacks (the
|
|
40
62
|
* HTML + asset fetch). `null` if `onLoad` never fired.
|
|
@@ -10,8 +10,10 @@ const CLEAR_STATE_PARAM = 'clear-state';
|
|
|
10
10
|
const ENVIRONMENT_ID_PARAM = 'environmentId';
|
|
11
11
|
const WEBVIEW_START_TIME_PARAM = 'webviewStartTime';
|
|
12
12
|
const RETRY_PARAM = 'retry';
|
|
13
|
+
const LOAD_ID_PARAM = 'loadId';
|
|
13
14
|
|
|
14
15
|
exports.CLEAR_STATE_PARAM = CLEAR_STATE_PARAM;
|
|
15
16
|
exports.ENVIRONMENT_ID_PARAM = ENVIRONMENT_ID_PARAM;
|
|
17
|
+
exports.LOAD_ID_PARAM = LOAD_ID_PARAM;
|
|
16
18
|
exports.RETRY_PARAM = RETRY_PARAM;
|
|
17
19
|
exports.WEBVIEW_START_TIME_PARAM = WEBVIEW_START_TIME_PARAM;
|
|
@@ -2,3 +2,4 @@ export declare const CLEAR_STATE_PARAM = "clear-state";
|
|
|
2
2
|
export declare const ENVIRONMENT_ID_PARAM = "environmentId";
|
|
3
3
|
export declare const WEBVIEW_START_TIME_PARAM = "webviewStartTime";
|
|
4
4
|
export declare const RETRY_PARAM = "retry";
|
|
5
|
+
export declare const LOAD_ID_PARAM = "loadId";
|
|
@@ -6,5 +6,6 @@ const CLEAR_STATE_PARAM = 'clear-state';
|
|
|
6
6
|
const ENVIRONMENT_ID_PARAM = 'environmentId';
|
|
7
7
|
const WEBVIEW_START_TIME_PARAM = 'webviewStartTime';
|
|
8
8
|
const RETRY_PARAM = 'retry';
|
|
9
|
+
const LOAD_ID_PARAM = 'loadId';
|
|
9
10
|
|
|
10
|
-
export { CLEAR_STATE_PARAM, ENVIRONMENT_ID_PARAM, RETRY_PARAM, WEBVIEW_START_TIME_PARAM };
|
|
11
|
+
export { CLEAR_STATE_PARAM, ENVIRONMENT_ID_PARAM, LOAD_ID_PARAM, RETRY_PARAM, WEBVIEW_START_TIME_PARAM };
|
|
@@ -12,6 +12,7 @@ var isRaiseTerminalErrorEffect = require('../isRaiseTerminalErrorEffect/isRaiseT
|
|
|
12
12
|
var isSdkReadyMessage = require('../isSdkReadyMessage/isSdkReadyMessage.cjs');
|
|
13
13
|
var sanitizeWebViewLoadOptions = require('../sanitizeWebViewLoadOptions/sanitizeWebViewLoadOptions.cjs');
|
|
14
14
|
var webViewLoadStateMachine = require('../webViewLoadStateMachine/webViewLoadStateMachine.cjs');
|
|
15
|
+
var constants = require('../constants.cjs');
|
|
15
16
|
var createEmptyAttemptTimings = require('./createEmptyAttemptTimings/createEmptyAttemptTimings.cjs');
|
|
16
17
|
var createWebViewLoadTelemetry = require('./createWebViewLoadTelemetry/createWebViewLoadTelemetry.cjs');
|
|
17
18
|
var getPhaseDurations = require('./getPhaseDurations/getPhaseDurations.cjs');
|
|
@@ -49,10 +50,16 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
49
50
|
};
|
|
50
51
|
let state = webViewLoadStateMachine.createInitialWebViewLoadState(sanitizedRetryOptions.maxAttempts);
|
|
51
52
|
let tornDown = false;
|
|
52
|
-
// The base URL built on start (environmentId + start time) and
|
|
53
|
-
// the current attempt (retries increment its `retry` query
|
|
53
|
+
// The base URL built on start (environmentId + start time + loadId) and
|
|
54
|
+
// the URL of the current attempt (retries increment its `retry` query
|
|
55
|
+
// param).
|
|
54
56
|
let builtUrl = null;
|
|
55
57
|
let currentUrl = null;
|
|
58
|
+
// Correlates a load cycle with the webview-side boot beacons. Stable
|
|
59
|
+
// across retries within a cycle; a customer-facing retry() starts a fresh
|
|
60
|
+
// cycle and a fresh id, so a failure log joins to exactly one boot.
|
|
61
|
+
const createLoadId = () => `${now().toString(36)}-${Math.floor(random() * Math.pow(36, 10)).toString(36)}`;
|
|
62
|
+
let loadId = createLoadId();
|
|
56
63
|
let attemptTimings = createEmptyAttemptTimings.createEmptyAttemptTimings();
|
|
57
64
|
// Cumulative across the controller lifetime, mirroring the reference
|
|
58
65
|
// engine's counters of the same names.
|
|
@@ -69,6 +76,7 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
69
76
|
const ensureBuiltUrl = () => {
|
|
70
77
|
if (builtUrl === null) {
|
|
71
78
|
builtUrl = assignStartTimeToUrl.assignStartTimeToUrl(assignEnvironmentIdToUrl.assignEnvironmentIdToUrl(webviewUrl, core.environmentId));
|
|
79
|
+
builtUrl.searchParams.set(constants.LOAD_ID_PARAM, loadId);
|
|
72
80
|
}
|
|
73
81
|
return builtUrl;
|
|
74
82
|
};
|
|
@@ -110,6 +118,12 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
110
118
|
// starts (e.g. retry() skipping the remaining backoff) — clear it so
|
|
111
119
|
// it can't fire a pointless backoff_elapsed mid-attempt.
|
|
112
120
|
clearBackoffTimer();
|
|
121
|
+
if (retryCount === 0) {
|
|
122
|
+
// A fresh cycle gets a fresh base URL: new loadId (and start time) so
|
|
123
|
+
// its boot beacons can't be confused with the previous cycle's.
|
|
124
|
+
builtUrl = null;
|
|
125
|
+
loadId = createLoadId();
|
|
126
|
+
}
|
|
113
127
|
currentUrl =
|
|
114
128
|
retryCount === 0
|
|
115
129
|
? ensureBuiltUrl()
|
|
@@ -133,13 +147,20 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
133
147
|
}, delayMs);
|
|
134
148
|
};
|
|
135
149
|
const executeRaiseTerminalError = (effect) => {
|
|
136
|
-
|
|
150
|
+
const durations = getPhaseDurations.getPhaseDurations(attemptTimings);
|
|
151
|
+
// The manifest request is the first signal the webview's JS bundle
|
|
152
|
+
// sends once alive: absent means the bundle never ran (fetch/eval),
|
|
153
|
+
// present means init or the ready handshake died afterwards.
|
|
154
|
+
// Raw timestamp, not the duration: the duration stays null when
|
|
155
|
+
// page_finished is never observed even though the manifest arrived.
|
|
156
|
+
const bootstrapStage = attemptTimings.manifestReceivedAt === null ? 'bundle_fetch' : 'sdk_init';
|
|
157
|
+
core.initialization.error = new WebViewFailedToLoadError.WebViewFailedToLoadError(Object.assign(Object.assign({ attemptFailures: effect.failures, bootstrapStage: effect.phase === 'sdk_bootstrap' ? bootstrapStage : undefined, hadClearState: false, loadId,
|
|
137
158
|
// The error-meta field names of the timeout budgets are frozen (they
|
|
138
159
|
// reach Datadog); only the code-level option names changed.
|
|
139
160
|
loadingTimeoutMs: pageLoadTimeoutMs, nativeErrorCount, osKillCount: 0, phase: effect.phase, recoveryTimeoutMs: sdkReadyTimeoutMs,
|
|
140
161
|
// The terminal transition leaves `attempt` unchanged, so the
|
|
141
162
|
// post-transition state still carries the failed attempt number.
|
|
142
|
-
retryCount: state.attempt - 1, webviewUrl: getCurrentUrl().toString() },
|
|
163
|
+
retryCount: state.attempt - 1, webviewUrl: getCurrentUrl().toString() }, durations), effect.extraMeta));
|
|
143
164
|
};
|
|
144
165
|
const executeEffect = (effect, previousState, batchExtraMeta) => {
|
|
145
166
|
switch (effect.type) {
|
|
@@ -8,6 +8,7 @@ import { isRaiseTerminalErrorEffect } from '../isRaiseTerminalErrorEffect/isRais
|
|
|
8
8
|
import { isSdkReadyMessage } from '../isSdkReadyMessage/isSdkReadyMessage.js';
|
|
9
9
|
import { sanitizeWebViewLoadOptions } from '../sanitizeWebViewLoadOptions/sanitizeWebViewLoadOptions.js';
|
|
10
10
|
import { transitionWebViewLoadState, createInitialWebViewLoadState } from '../webViewLoadStateMachine/webViewLoadStateMachine.js';
|
|
11
|
+
import { LOAD_ID_PARAM } from '../constants.js';
|
|
11
12
|
import { createEmptyAttemptTimings } from './createEmptyAttemptTimings/createEmptyAttemptTimings.js';
|
|
12
13
|
import { createWebViewLoadTelemetry } from './createWebViewLoadTelemetry/createWebViewLoadTelemetry.js';
|
|
13
14
|
import { getPhaseDurations } from './getPhaseDurations/getPhaseDurations.js';
|
|
@@ -45,10 +46,16 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
45
46
|
};
|
|
46
47
|
let state = createInitialWebViewLoadState(sanitizedRetryOptions.maxAttempts);
|
|
47
48
|
let tornDown = false;
|
|
48
|
-
// The base URL built on start (environmentId + start time) and
|
|
49
|
-
// the current attempt (retries increment its `retry` query
|
|
49
|
+
// The base URL built on start (environmentId + start time + loadId) and
|
|
50
|
+
// the URL of the current attempt (retries increment its `retry` query
|
|
51
|
+
// param).
|
|
50
52
|
let builtUrl = null;
|
|
51
53
|
let currentUrl = null;
|
|
54
|
+
// Correlates a load cycle with the webview-side boot beacons. Stable
|
|
55
|
+
// across retries within a cycle; a customer-facing retry() starts a fresh
|
|
56
|
+
// cycle and a fresh id, so a failure log joins to exactly one boot.
|
|
57
|
+
const createLoadId = () => `${now().toString(36)}-${Math.floor(random() * Math.pow(36, 10)).toString(36)}`;
|
|
58
|
+
let loadId = createLoadId();
|
|
52
59
|
let attemptTimings = createEmptyAttemptTimings();
|
|
53
60
|
// Cumulative across the controller lifetime, mirroring the reference
|
|
54
61
|
// engine's counters of the same names.
|
|
@@ -65,6 +72,7 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
65
72
|
const ensureBuiltUrl = () => {
|
|
66
73
|
if (builtUrl === null) {
|
|
67
74
|
builtUrl = assignStartTimeToUrl(assignEnvironmentIdToUrl(webviewUrl, core.environmentId));
|
|
75
|
+
builtUrl.searchParams.set(LOAD_ID_PARAM, loadId);
|
|
68
76
|
}
|
|
69
77
|
return builtUrl;
|
|
70
78
|
};
|
|
@@ -106,6 +114,12 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
106
114
|
// starts (e.g. retry() skipping the remaining backoff) — clear it so
|
|
107
115
|
// it can't fire a pointless backoff_elapsed mid-attempt.
|
|
108
116
|
clearBackoffTimer();
|
|
117
|
+
if (retryCount === 0) {
|
|
118
|
+
// A fresh cycle gets a fresh base URL: new loadId (and start time) so
|
|
119
|
+
// its boot beacons can't be confused with the previous cycle's.
|
|
120
|
+
builtUrl = null;
|
|
121
|
+
loadId = createLoadId();
|
|
122
|
+
}
|
|
109
123
|
currentUrl =
|
|
110
124
|
retryCount === 0
|
|
111
125
|
? ensureBuiltUrl()
|
|
@@ -129,13 +143,20 @@ const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeou
|
|
|
129
143
|
}, delayMs);
|
|
130
144
|
};
|
|
131
145
|
const executeRaiseTerminalError = (effect) => {
|
|
132
|
-
|
|
146
|
+
const durations = getPhaseDurations(attemptTimings);
|
|
147
|
+
// The manifest request is the first signal the webview's JS bundle
|
|
148
|
+
// sends once alive: absent means the bundle never ran (fetch/eval),
|
|
149
|
+
// present means init or the ready handshake died afterwards.
|
|
150
|
+
// Raw timestamp, not the duration: the duration stays null when
|
|
151
|
+
// page_finished is never observed even though the manifest arrived.
|
|
152
|
+
const bootstrapStage = attemptTimings.manifestReceivedAt === null ? 'bundle_fetch' : 'sdk_init';
|
|
153
|
+
core.initialization.error = new WebViewFailedToLoadError(Object.assign(Object.assign({ attemptFailures: effect.failures, bootstrapStage: effect.phase === 'sdk_bootstrap' ? bootstrapStage : undefined, hadClearState: false, loadId,
|
|
133
154
|
// The error-meta field names of the timeout budgets are frozen (they
|
|
134
155
|
// reach Datadog); only the code-level option names changed.
|
|
135
156
|
loadingTimeoutMs: pageLoadTimeoutMs, nativeErrorCount, osKillCount: 0, phase: effect.phase, recoveryTimeoutMs: sdkReadyTimeoutMs,
|
|
136
157
|
// The terminal transition leaves `attempt` unchanged, so the
|
|
137
158
|
// post-transition state still carries the failed attempt number.
|
|
138
|
-
retryCount: state.attempt - 1, webviewUrl: getCurrentUrl().toString() },
|
|
159
|
+
retryCount: state.attempt - 1, webviewUrl: getCurrentUrl().toString() }, durations), effect.extraMeta));
|
|
139
160
|
};
|
|
140
161
|
const executeEffect = (effect, previousState, batchExtraMeta) => {
|
|
141
162
|
switch (effect.type) {
|