@dynamic-labs/legacy-client 0.0.0 → 5.1.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 +6821 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/_virtual/_tslib.cjs +36 -0
- package/_virtual/_tslib.js +32 -0
- package/package.cjs +8 -0
- package/package.js +4 -0
- package/package.json +33 -1
- package/src/client/client.cjs +80 -0
- package/src/client/client.d.ts +108 -0
- package/src/client/client.js +75 -0
- package/src/client/core/core.cjs +84 -0
- package/src/client/core/core.d.ts +75 -0
- package/src/client/core/core.js +80 -0
- package/src/client/core/index.d.ts +1 -0
- package/src/client/core/modules/initializationModule/index.d.ts +1 -0
- package/src/client/core/modules/initializationModule/initializationModule.cjs +72 -0
- package/src/client/core/modules/initializationModule/initializationModule.d.ts +6 -0
- package/src/client/core/modules/initializationModule/initializationModule.js +68 -0
- package/src/client/core/modules/manifestModule/createPartialManifest/createPartialManifest.cjs +28 -0
- package/src/client/core/modules/manifestModule/createPartialManifest/createPartialManifest.d.ts +3 -0
- package/src/client/core/modules/manifestModule/createPartialManifest/createPartialManifest.js +24 -0
- package/src/client/core/modules/manifestModule/createPartialManifest/index.d.ts +1 -0
- package/src/client/core/modules/manifestModule/index.d.ts +1 -0
- package/src/client/core/modules/manifestModule/manifestModule.cjs +40 -0
- package/src/client/core/modules/manifestModule/manifestModule.d.ts +12 -0
- package/src/client/core/modules/manifestModule/manifestModule.js +36 -0
- package/src/client/core/modules/manifestModule/validateManifest/index.d.ts +1 -0
- package/src/client/core/modules/manifestModule/validateManifest/validateManifest.cjs +31 -0
- package/src/client/core/modules/manifestModule/validateManifest/validateManifest.d.ts +14 -0
- package/src/client/core/modules/manifestModule/validateManifest/validateManifest.js +26 -0
- package/src/client/core/modules/webViewLoadControllerRegistry/index.d.ts +1 -0
- package/src/client/core/modules/webViewLoadControllerRegistry/webViewLoadControllerRegistry.cjs +24 -0
- package/src/client/core/modules/webViewLoadControllerRegistry/webViewLoadControllerRegistry.d.ts +29 -0
- package/src/client/core/modules/webViewLoadControllerRegistry/webViewLoadControllerRegistry.js +20 -0
- package/src/client/index.d.ts +1 -0
- package/src/index.cjs +26 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -0
- package/src/modules/authModule/authModule.cjs +60 -0
- package/src/modules/authModule/authModule.d.ts +30 -0
- package/src/modules/authModule/authModule.js +56 -0
- package/src/modules/authModule/emailAuthModule/emailAuthModule.cjs +26 -0
- package/src/modules/authModule/emailAuthModule/emailAuthModule.d.ts +10 -0
- package/src/modules/authModule/emailAuthModule/emailAuthModule.js +22 -0
- package/src/modules/authModule/emailAuthModule/index.d.ts +1 -0
- package/src/modules/authModule/externalAuthModule/externalAuthModule.cjs +16 -0
- package/src/modules/authModule/externalAuthModule/externalAuthModule.d.ts +7 -0
- package/src/modules/authModule/externalAuthModule/externalAuthModule.js +12 -0
- package/src/modules/authModule/externalAuthModule/index.d.ts +1 -0
- package/src/modules/authModule/index.d.ts +1 -0
- package/src/modules/authModule/passkeyAuthModule/index.d.ts +1 -0
- package/src/modules/authModule/passkeyAuthModule/passkeyAuthModule.cjs +15 -0
- package/src/modules/authModule/passkeyAuthModule/passkeyAuthModule.d.ts +6 -0
- package/src/modules/authModule/passkeyAuthModule/passkeyAuthModule.js +11 -0
- package/src/modules/authModule/smsAuthModule/index.d.ts +1 -0
- package/src/modules/authModule/smsAuthModule/smsAuthModule.cjs +23 -0
- package/src/modules/authModule/smsAuthModule/smsAuthModule.d.ts +11 -0
- package/src/modules/authModule/smsAuthModule/smsAuthModule.js +19 -0
- package/src/modules/authModule/socialAuthModule/index.d.ts +1 -0
- package/src/modules/authModule/socialAuthModule/socialAuthModule.cjs +24 -0
- package/src/modules/authModule/socialAuthModule/socialAuthModule.d.ts +10 -0
- package/src/modules/authModule/socialAuthModule/socialAuthModule.js +20 -0
- package/src/modules/bitcoinModule/bitcoinModule.cjs +21 -0
- package/src/modules/bitcoinModule/bitcoinModule.d.ts +19 -0
- package/src/modules/bitcoinModule/bitcoinModule.js +17 -0
- package/src/modules/bitcoinModule/index.d.ts +1 -0
- package/src/modules/deviceRegistrationModule/deviceRegistrationModule.cjs +32 -0
- package/src/modules/deviceRegistrationModule/deviceRegistrationModule.d.ts +12 -0
- package/src/modules/deviceRegistrationModule/deviceRegistrationModule.js +28 -0
- package/src/modules/deviceRegistrationModule/index.d.ts +1 -0
- package/src/modules/instrumentationModule/index.d.ts +1 -0
- package/src/modules/instrumentationModule/instrumentationModule.cjs +40 -0
- package/src/modules/instrumentationModule/instrumentationModule.d.ts +6 -0
- package/src/modules/instrumentationModule/instrumentationModule.js +36 -0
- package/src/modules/localeModule/index.d.ts +1 -0
- package/src/modules/localeModule/localeModule.cjs +15 -0
- package/src/modules/localeModule/localeModule.d.ts +14 -0
- package/src/modules/localeModule/localeModule.js +11 -0
- package/src/modules/mfaModule/index.d.ts +1 -0
- package/src/modules/mfaModule/mfaModule.cjs +35 -0
- package/src/modules/mfaModule/mfaModule.d.ts +23 -0
- package/src/modules/mfaModule/mfaModule.js +31 -0
- package/src/modules/networksModule/index.d.ts +1 -0
- package/src/modules/networksModule/networksModule.cjs +18 -0
- package/src/modules/networksModule/networksModule.d.ts +3 -0
- package/src/modules/networksModule/networksModule.js +14 -0
- package/src/modules/passkeysModule/index.d.ts +1 -0
- package/src/modules/passkeysModule/passkeysModule.cjs +18 -0
- package/src/modules/passkeysModule/passkeysModule.d.ts +10 -0
- package/src/modules/passkeysModule/passkeysModule.js +14 -0
- package/src/modules/sdkModule/index.d.ts +1 -0
- package/src/modules/sdkModule/sdkModule.cjs +64 -0
- package/src/modules/sdkModule/sdkModule.d.ts +25 -0
- package/src/modules/sdkModule/sdkModule.js +60 -0
- package/src/modules/stepUpAuthModule/index.d.ts +1 -0
- package/src/modules/stepUpAuthModule/stepUpAuthModule.cjs +36 -0
- package/src/modules/stepUpAuthModule/stepUpAuthModule.d.ts +19 -0
- package/src/modules/stepUpAuthModule/stepUpAuthModule.js +32 -0
- package/src/modules/tonModule/index.d.ts +1 -0
- package/src/modules/tonModule/tonModule.cjs +19 -0
- package/src/modules/tonModule/tonModule.d.ts +15 -0
- package/src/modules/tonModule/tonModule.js +15 -0
- package/src/modules/userInterfaceModule/index.d.ts +1 -0
- package/src/modules/userInterfaceModule/userInterfaceModule.cjs +66 -0
- package/src/modules/userInterfaceModule/userInterfaceModule.d.ts +155 -0
- package/src/modules/userInterfaceModule/userInterfaceModule.js +62 -0
- package/src/modules/walletsModule/accountAbstractionModule/accountAbstractionModule.cjs +17 -0
- package/src/modules/walletsModule/accountAbstractionModule/accountAbstractionModule.d.ts +14 -0
- package/src/modules/walletsModule/accountAbstractionModule/accountAbstractionModule.js +13 -0
- package/src/modules/walletsModule/accountAbstractionModule/index.d.ts +1 -0
- package/src/modules/walletsModule/createWalletListenerMethods/createWalletListenerMethods.cjs +31 -0
- package/src/modules/walletsModule/createWalletListenerMethods/createWalletListenerMethods.d.ts +9 -0
- package/src/modules/walletsModule/createWalletListenerMethods/createWalletListenerMethods.js +27 -0
- package/src/modules/walletsModule/createWalletListenerMethods/index.d.ts +1 -0
- package/src/modules/walletsModule/delegationModule/delegationModule.cjs +32 -0
- package/src/modules/walletsModule/delegationModule/delegationModule.d.ts +14 -0
- package/src/modules/walletsModule/delegationModule/delegationModule.js +28 -0
- package/src/modules/walletsModule/delegationModule/index.d.ts +1 -0
- package/src/modules/walletsModule/embeddedWalletsModule/embeddedWalletsModule.cjs +32 -0
- package/src/modules/walletsModule/embeddedWalletsModule/embeddedWalletsModule.d.ts +11 -0
- package/src/modules/walletsModule/embeddedWalletsModule/embeddedWalletsModule.js +28 -0
- package/src/modules/walletsModule/embeddedWalletsModule/index.d.ts +1 -0
- package/src/modules/walletsModule/index.d.ts +1 -0
- package/src/modules/walletsModule/phantomModule/index.d.ts +1 -0
- package/src/modules/walletsModule/phantomModule/phantomModule.cjs +18 -0
- package/src/modules/walletsModule/phantomModule/phantomModule.d.ts +27 -0
- package/src/modules/walletsModule/phantomModule/phantomModule.js +14 -0
- package/src/modules/walletsModule/waasModule/index.d.ts +1 -0
- package/src/modules/walletsModule/waasModule/waasModule.cjs +25 -0
- package/src/modules/walletsModule/waasModule/waasModule.d.ts +16 -0
- package/src/modules/walletsModule/waasModule/waasModule.js +21 -0
- package/src/modules/walletsModule/walletsModule.cjs +69 -0
- package/src/modules/walletsModule/walletsModule.d.ts +40 -0
- package/src/modules/walletsModule/walletsModule.js +65 -0
- package/src/types.d.ts +2 -0
- package/src/utils/Extendable/Extendable.cjs +29 -0
- package/src/utils/Extendable/Extendable.d.ts +25 -0
- package/src/utils/Extendable/Extendable.js +25 -0
- package/src/utils/Extendable/deepMerge/deepMergeInto.cjs +26 -0
- package/src/utils/Extendable/deepMerge/deepMergeInto.d.ts +6 -0
- package/src/utils/Extendable/deepMerge/deepMergeInto.js +22 -0
- package/src/utils/Extendable/deepMerge/index.d.ts +1 -0
- package/src/utils/Extendable/hasExtension/hasExtension.cjs +14 -0
- package/src/utils/Extendable/hasExtension/hasExtension.d.ts +9 -0
- package/src/utils/Extendable/hasExtension/hasExtension.js +10 -0
- package/src/utils/Extendable/hasExtension/index.d.ts +1 -0
- package/src/utils/Extendable/index.d.ts +1 -0
- package/src/utils/addProperty/addProperty.cjs +21 -0
- package/src/utils/addProperty/addProperty.d.ts +13 -0
- package/src/utils/addProperty/addProperty.js +17 -0
- package/src/utils/addProperty/index.d.ts +1 -0
- package/src/utils/createWaitForAuthSuccess/createWaitForAuthSuccess.cjs +63 -0
- package/src/utils/createWaitForAuthSuccess/createWaitForAuthSuccess.d.ts +13 -0
- package/src/utils/createWaitForAuthSuccess/createWaitForAuthSuccess.js +59 -0
- package/src/utils/createWaitForAuthSuccess/index.d.ts +1 -0
- package/src/utils/diffMs/diffMs.cjs +12 -0
- package/src/utils/diffMs/diffMs.d.ts +5 -0
- package/src/utils/diffMs/diffMs.js +8 -0
- package/src/utils/diffMs/index.d.ts +1 -0
- package/src/utils/logger/index.d.ts +1 -0
- package/src/utils/logger/logger.cjs +10 -0
- package/src/utils/logger/logger.d.ts +2 -0
- package/src/utils/logger/logger.js +6 -0
- package/src/utils/pickListenerActions/index.d.ts +1 -0
- package/src/utils/pickListenerActions/pickListenerActions.cjs +23 -0
- package/src/utils/pickListenerActions/pickListenerActions.d.ts +7 -0
- package/src/utils/pickListenerActions/pickListenerActions.js +19 -0
- package/src/utils/randomString/index.d.ts +1 -0
- package/src/utils/randomString/randomString.cjs +16 -0
- package/src/utils/randomString/randomString.d.ts +7 -0
- package/src/utils/randomString/randomString.js +12 -0
- package/src/utils/setupFetchHandler/index.d.ts +1 -0
- package/src/utils/setupFetchHandler/setupFetchHandler.cjs +36 -0
- package/src/utils/setupFetchHandler/setupFetchHandler.d.ts +2 -0
- package/src/utils/setupFetchHandler/setupFetchHandler.js +32 -0
- package/src/utils/setupLogHandler/index.d.ts +1 -0
- package/src/utils/setupLogHandler/setupLogHandler.cjs +16 -0
- package/src/utils/setupLogHandler/setupLogHandler.d.ts +2 -0
- package/src/utils/setupLogHandler/setupLogHandler.js +12 -0
- package/src/webviewLoad/WebViewFailedToLoadError/WebViewFailedToLoadError.cjs +13 -0
- package/src/webviewLoad/WebViewFailedToLoadError/WebViewFailedToLoadError.d.ts +110 -0
- package/src/webviewLoad/WebViewFailedToLoadError/WebViewFailedToLoadError.js +9 -0
- package/src/webviewLoad/WebViewFailedToLoadError/index.d.ts +1 -0
- package/src/webviewLoad/assignEnvironmentIdToUrl/assignEnvironmentIdToUrl.cjs +14 -0
- package/src/webviewLoad/assignEnvironmentIdToUrl/assignEnvironmentIdToUrl.d.ts +1 -0
- package/src/webviewLoad/assignEnvironmentIdToUrl/assignEnvironmentIdToUrl.js +10 -0
- package/src/webviewLoad/assignEnvironmentIdToUrl/index.d.ts +1 -0
- package/src/webviewLoad/assignStartTimeToUrl/assignStartTimeToUrl.cjs +13 -0
- package/src/webviewLoad/assignStartTimeToUrl/assignStartTimeToUrl.d.ts +1 -0
- package/src/webviewLoad/assignStartTimeToUrl/assignStartTimeToUrl.js +9 -0
- package/src/webviewLoad/assignStartTimeToUrl/index.d.ts +1 -0
- package/src/webviewLoad/classifyWebViewLoadError/classifyWebViewLoadError.cjs +45 -0
- package/src/webviewLoad/classifyWebViewLoadError/classifyWebViewLoadError.d.ts +26 -0
- package/src/webviewLoad/classifyWebViewLoadError/classifyWebViewLoadError.js +41 -0
- package/src/webviewLoad/classifyWebViewLoadError/constants.cjs +24 -0
- package/src/webviewLoad/classifyWebViewLoadError/constants.d.ts +7 -0
- package/src/webviewLoad/classifyWebViewLoadError/constants.js +16 -0
- package/src/webviewLoad/classifyWebViewLoadError/index.d.ts +2 -0
- package/src/webviewLoad/computeRetryBackoffMs/computeRetryBackoffMs.cjs +24 -0
- package/src/webviewLoad/computeRetryBackoffMs/computeRetryBackoffMs.d.ts +9 -0
- package/src/webviewLoad/computeRetryBackoffMs/computeRetryBackoffMs.js +18 -0
- package/src/webviewLoad/computeRetryBackoffMs/index.d.ts +1 -0
- package/src/webviewLoad/constants.cjs +17 -0
- package/src/webviewLoad/constants.d.ts +4 -0
- package/src/webviewLoad/constants.js +10 -0
- package/src/webviewLoad/createWebViewLoadController/createEmptyAttemptTimings/createEmptyAttemptTimings.cjs +14 -0
- package/src/webviewLoad/createWebViewLoadController/createEmptyAttemptTimings/createEmptyAttemptTimings.d.ts +14 -0
- package/src/webviewLoad/createWebViewLoadController/createEmptyAttemptTimings/createEmptyAttemptTimings.js +10 -0
- package/src/webviewLoad/createWebViewLoadController/createEmptyAttemptTimings/index.d.ts +1 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadController.cjs +288 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadController.d.ts +50 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadController.js +282 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/constants.cjs +45 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/constants.d.ts +29 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/constants.js +37 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/createWebViewLoadTelemetry.cjs +94 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/createWebViewLoadTelemetry.d.ts +38 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/createWebViewLoadTelemetry.js +90 -0
- package/src/webviewLoad/createWebViewLoadController/createWebViewLoadTelemetry/index.d.ts +2 -0
- package/src/webviewLoad/createWebViewLoadController/getPhaseDurations/getPhaseDurations.cjs +20 -0
- package/src/webviewLoad/createWebViewLoadController/getPhaseDurations/getPhaseDurations.d.ts +13 -0
- package/src/webviewLoad/createWebViewLoadController/getPhaseDurations/getPhaseDurations.js +16 -0
- package/src/webviewLoad/createWebViewLoadController/getPhaseDurations/index.d.ts +1 -0
- package/src/webviewLoad/createWebViewLoadController/index.d.ts +3 -0
- package/src/webviewLoad/createWebViewLoadController/recordEventTiming/index.d.ts +1 -0
- package/src/webviewLoad/createWebViewLoadController/recordEventTiming/recordEventTiming.cjs +37 -0
- package/src/webviewLoad/createWebViewLoadController/recordEventTiming/recordEventTiming.d.ts +9 -0
- package/src/webviewLoad/createWebViewLoadController/recordEventTiming/recordEventTiming.js +33 -0
- package/src/webviewLoad/createWebViewLoadController/webViewLoadAdapter/index.d.ts +1 -0
- package/src/webviewLoad/createWebViewLoadController/webViewLoadAdapter/webViewLoadAdapter.d.ts +11 -0
- package/src/webviewLoad/incrementRetryInUrl/incrementRetryInUrl.cjs +17 -0
- package/src/webviewLoad/incrementRetryInUrl/incrementRetryInUrl.d.ts +1 -0
- package/src/webviewLoad/incrementRetryInUrl/incrementRetryInUrl.js +13 -0
- package/src/webviewLoad/incrementRetryInUrl/index.d.ts +1 -0
- package/src/webviewLoad/index.d.ts +14 -0
- package/src/webviewLoad/isRaiseTerminalErrorEffect/index.d.ts +1 -0
- package/src/webviewLoad/isRaiseTerminalErrorEffect/isRaiseTerminalErrorEffect.cjs +8 -0
- package/src/webviewLoad/isRaiseTerminalErrorEffect/isRaiseTerminalErrorEffect.d.ts +13 -0
- package/src/webviewLoad/isRaiseTerminalErrorEffect/isRaiseTerminalErrorEffect.js +4 -0
- package/src/webviewLoad/isSdkReadyMessage/index.d.ts +1 -0
- package/src/webviewLoad/isSdkReadyMessage/isSdkReadyMessage.cjs +27 -0
- package/src/webviewLoad/isSdkReadyMessage/isSdkReadyMessage.d.ts +14 -0
- package/src/webviewLoad/isSdkReadyMessage/isSdkReadyMessage.js +23 -0
- package/src/webviewLoad/probeOrigin/index.d.ts +1 -0
- package/src/webviewLoad/probeOrigin/probeOrigin.cjs +45 -0
- package/src/webviewLoad/probeOrigin/probeOrigin.d.ts +23 -0
- package/src/webviewLoad/probeOrigin/probeOrigin.js +40 -0
- package/src/webviewLoad/sanitizeWebViewLoadOptions/index.d.ts +1 -0
- package/src/webviewLoad/sanitizeWebViewLoadOptions/sanitizeWebViewLoadOptions.cjs +54 -0
- package/src/webviewLoad/sanitizeWebViewLoadOptions/sanitizeWebViewLoadOptions.d.ts +14 -0
- package/src/webviewLoad/sanitizeWebViewLoadOptions/sanitizeWebViewLoadOptions.js +47 -0
- package/src/webviewLoad/sdkWebViewLoadState/index.d.ts +1 -0
- package/src/webviewLoad/sdkWebViewLoadState/sdkWebViewLoadState.cjs +20 -0
- package/src/webviewLoad/sdkWebViewLoadState/sdkWebViewLoadState.d.ts +42 -0
- package/src/webviewLoad/sdkWebViewLoadState/sdkWebViewLoadState.js +16 -0
- package/src/webviewLoad/webViewLoadOptions/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadOptions/webViewLoadOptions.d.ts +45 -0
- package/src/webviewLoad/webViewLoadStateMachine/canAcceptFailureInput/canAcceptFailureInput.cjs +14 -0
- package/src/webviewLoad/webViewLoadStateMachine/canAcceptFailureInput/canAcceptFailureInput.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/canAcceptFailureInput/canAcceptFailureInput.js +10 -0
- package/src/webviewLoad/webViewLoadStateMachine/canAcceptFailureInput/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/constants.cjs +64 -0
- package/src/webviewLoad/webViewLoadStateMachine/constants.d.ts +24 -0
- package/src/webviewLoad/webViewLoadStateMachine/constants.js +37 -0
- package/src/webviewLoad/webViewLoadStateMachine/getHtmlLoadTimeoutMs/getHtmlLoadTimeoutMs.cjs +19 -0
- package/src/webviewLoad/webViewLoadStateMachine/getHtmlLoadTimeoutMs/getHtmlLoadTimeoutMs.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/getHtmlLoadTimeoutMs/getHtmlLoadTimeoutMs.js +15 -0
- package/src/webviewLoad/webViewLoadStateMachine/getHtmlLoadTimeoutMs/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleBackoffElapsed/handleBackoffElapsed.cjs +34 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleBackoffElapsed/handleBackoffElapsed.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleBackoffElapsed/handleBackoffElapsed.js +30 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleBackoffElapsed/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleFailureInput/handleFailureInput.cjs +70 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleFailureInput/handleFailureInput.d.ts +15 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleFailureInput/handleFailureInput.js +66 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleFailureInput/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadRequested/handleLoadRequested.cjs +26 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadRequested/handleLoadRequested.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadRequested/handleLoadRequested.js +22 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadRequested/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadStarted/handleLoadStarted.cjs +28 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadStarted/handleLoadStarted.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadStarted/handleLoadStarted.js +24 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleLoadStarted/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleManifestReceived/handleManifestReceived.cjs +33 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleManifestReceived/handleManifestReceived.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleManifestReceived/handleManifestReceived.js +29 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleManifestReceived/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleNativeError/handleNativeError.cjs +32 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleNativeError/handleNativeError.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleNativeError/handleNativeError.js +28 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleNativeError/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handlePageFinished/handlePageFinished.cjs +25 -0
- package/src/webviewLoad/webViewLoadStateMachine/handlePageFinished/handlePageFinished.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handlePageFinished/handlePageFinished.js +21 -0
- package/src/webviewLoad/webViewLoadStateMachine/handlePageFinished/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRecoveryRequested/handleRecoveryRequested.cjs +25 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRecoveryRequested/handleRecoveryRequested.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRecoveryRequested/handleRecoveryRequested.js +21 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRecoveryRequested/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleResponseCommitted/handleResponseCommitted.cjs +28 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleResponseCommitted/handleResponseCommitted.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleResponseCommitted/handleResponseCommitted.js +24 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleResponseCommitted/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRetryRequested/handleRetryRequested.cjs +38 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRetryRequested/handleRetryRequested.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRetryRequested/handleRetryRequested.js +34 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleRetryRequested/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleSdkReady/handleSdkReady.cjs +39 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleSdkReady/handleSdkReady.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleSdkReady/handleSdkReady.js +35 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleSdkReady/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleTimerExpired/handleTimerExpired.cjs +23 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleTimerExpired/handleTimerExpired.d.ts +3 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleTimerExpired/handleTimerExpired.js +19 -0
- package/src/webviewLoad/webViewLoadStateMachine/handleTimerExpired/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/index.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/noTransition/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadStateMachine/noTransition/noTransition.cjs +13 -0
- package/src/webviewLoad/webViewLoadStateMachine/noTransition/noTransition.d.ts +2 -0
- package/src/webviewLoad/webViewLoadStateMachine/noTransition/noTransition.js +9 -0
- package/src/webviewLoad/webViewLoadStateMachine/webViewLoadStateMachine.cjs +66 -0
- package/src/webviewLoad/webViewLoadStateMachine/webViewLoadStateMachine.d.ts +9 -0
- package/src/webviewLoad/webViewLoadStateMachine/webViewLoadStateMachine.js +61 -0
- package/src/webviewLoad/webViewLoadTypes/index.d.ts +1 -0
- package/src/webviewLoad/webViewLoadTypes/webViewLoadTypes.d.ts +156 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { getAckMessageType } from '@dynamic-labs/message-transport';
|
|
3
|
+
import { WebViewFailedToLoadError } from '../WebViewFailedToLoadError/WebViewFailedToLoadError.js';
|
|
4
|
+
import { assignEnvironmentIdToUrl } from '../assignEnvironmentIdToUrl/assignEnvironmentIdToUrl.js';
|
|
5
|
+
import { assignStartTimeToUrl } from '../assignStartTimeToUrl/assignStartTimeToUrl.js';
|
|
6
|
+
import { incrementRetryInUrl } from '../incrementRetryInUrl/incrementRetryInUrl.js';
|
|
7
|
+
import { isRaiseTerminalErrorEffect } from '../isRaiseTerminalErrorEffect/isRaiseTerminalErrorEffect.js';
|
|
8
|
+
import { isSdkReadyMessage } from '../isSdkReadyMessage/isSdkReadyMessage.js';
|
|
9
|
+
import { sanitizeWebViewLoadOptions } from '../sanitizeWebViewLoadOptions/sanitizeWebViewLoadOptions.js';
|
|
10
|
+
import { transitionWebViewLoadState, createInitialWebViewLoadState } from '../webViewLoadStateMachine/webViewLoadStateMachine.js';
|
|
11
|
+
import { createEmptyAttemptTimings } from './createEmptyAttemptTimings/createEmptyAttemptTimings.js';
|
|
12
|
+
import { createWebViewLoadTelemetry } from './createWebViewLoadTelemetry/createWebViewLoadTelemetry.js';
|
|
13
|
+
import { getPhaseDurations } from './getPhaseDurations/getPhaseDurations.js';
|
|
14
|
+
import { recordEventTiming } from './recordEventTiming/recordEventTiming.js';
|
|
15
|
+
|
|
16
|
+
const DEFAULT_PAGE_LOAD_TIMEOUT_MS = 20000;
|
|
17
|
+
const DEFAULT_SDK_READY_TIMEOUT_MS = 20000;
|
|
18
|
+
// Wire-format `type` of the webview-side `manifest` request — the first
|
|
19
|
+
// message the webview JS bundle sends once it is alive. Used by the machine
|
|
20
|
+
// to grant a one-shot sdk_bootstrap extension on slow-but-alive links.
|
|
21
|
+
const MANIFEST_MESSAGE_TYPE = 'manifest';
|
|
22
|
+
const FAILED_STATUS = 'failed';
|
|
23
|
+
const READY_STATUS = 'ready';
|
|
24
|
+
const WAITING_TO_RETRY_STATUS = 'waiting_to_retry';
|
|
25
|
+
/**
|
|
26
|
+
* The imperative shell around `transitionWebViewLoadState`: holds the
|
|
27
|
+
* current machine state, executes the effects each transition requests
|
|
28
|
+
* (timers, loads, telemetry, terminal errors) and exposes the public
|
|
29
|
+
* projection consumed by `client.sdk.loadState`.
|
|
30
|
+
*
|
|
31
|
+
* All decisions live in the pure machine — this shell only translates
|
|
32
|
+
* effects into the real world and feeds external signals back in as events.
|
|
33
|
+
*/
|
|
34
|
+
const createWebViewLoadController = ({ adapter, core, firstAttemptPageLoadTimeoutMs, maxAttempts, now = Date.now, pageLoadTimeoutMs = DEFAULT_PAGE_LOAD_TIMEOUT_MS, random = Math.random, sdkReadyTimeoutMs = DEFAULT_SDK_READY_TIMEOUT_MS, webviewUrl, }) => {
|
|
35
|
+
const sanitizedRetryOptions = sanitizeWebViewLoadOptions({
|
|
36
|
+
firstAttemptPageLoadTimeoutMs,
|
|
37
|
+
maxAttempts,
|
|
38
|
+
});
|
|
39
|
+
const config = {
|
|
40
|
+
firstAttemptPageLoadTimeoutMs: sanitizedRetryOptions.firstAttemptPageLoadTimeoutMs,
|
|
41
|
+
now,
|
|
42
|
+
pageLoadTimeoutMs,
|
|
43
|
+
random,
|
|
44
|
+
sdkReadyTimeoutMs,
|
|
45
|
+
};
|
|
46
|
+
let state = createInitialWebViewLoadState(sanitizedRetryOptions.maxAttempts);
|
|
47
|
+
let tornDown = false;
|
|
48
|
+
// The base URL built on start (environmentId + start time) and the URL of
|
|
49
|
+
// the current attempt (retries increment its `retry` query param).
|
|
50
|
+
let builtUrl = null;
|
|
51
|
+
let currentUrl = null;
|
|
52
|
+
let attemptTimings = createEmptyAttemptTimings();
|
|
53
|
+
// Cumulative across the controller lifetime, mirroring the reference
|
|
54
|
+
// engine's counters of the same names.
|
|
55
|
+
let nativeErrorCount = 0;
|
|
56
|
+
// ONE timer per phase: arming a phase replaces that phase's timer. The
|
|
57
|
+
// backoff timer is separate; `clear_timers` clears all of them.
|
|
58
|
+
const phaseTimers = new Map();
|
|
59
|
+
let backoffTimer = null;
|
|
60
|
+
const stateChangedCallbacks = new Set();
|
|
61
|
+
// `resolve` of every retry() promise still waiting for a ready/failed
|
|
62
|
+
// transition. teardown() settles these so an awaited retry() can't hang
|
|
63
|
+
// forever after the controller is torn down.
|
|
64
|
+
const pendingRetryResolvers = new Set();
|
|
65
|
+
const ensureBuiltUrl = () => {
|
|
66
|
+
if (builtUrl === null) {
|
|
67
|
+
builtUrl = assignStartTimeToUrl(assignEnvironmentIdToUrl(webviewUrl, core.environmentId));
|
|
68
|
+
}
|
|
69
|
+
return builtUrl;
|
|
70
|
+
};
|
|
71
|
+
const getCurrentUrl = () => currentUrl !== null && currentUrl !== void 0 ? currentUrl : ensureBuiltUrl();
|
|
72
|
+
const telemetry = createWebViewLoadTelemetry({
|
|
73
|
+
core,
|
|
74
|
+
getAttemptTimings: () => attemptTimings,
|
|
75
|
+
getCurrentUrl,
|
|
76
|
+
getNativeErrorCount: () => nativeErrorCount,
|
|
77
|
+
isTornDown: () => tornDown,
|
|
78
|
+
now,
|
|
79
|
+
pageLoadTimeoutMs,
|
|
80
|
+
sdkReadyTimeoutMs,
|
|
81
|
+
webviewType: adapter.webviewType,
|
|
82
|
+
});
|
|
83
|
+
const getPublicState = () => ({
|
|
84
|
+
attempt: state.attempt,
|
|
85
|
+
error: core.initialization.error,
|
|
86
|
+
maxAttempts: state.maxAttempts,
|
|
87
|
+
nextRetryAt: state.nextRetryAt,
|
|
88
|
+
phase: state.phase,
|
|
89
|
+
status: state.status,
|
|
90
|
+
});
|
|
91
|
+
const clearBackoffTimer = () => {
|
|
92
|
+
if (backoffTimer !== null) {
|
|
93
|
+
clearTimeout(backoffTimer);
|
|
94
|
+
backoffTimer = null;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const clearAllTimers = () => {
|
|
98
|
+
phaseTimers.forEach((timer) => clearTimeout(timer));
|
|
99
|
+
phaseTimers.clear();
|
|
100
|
+
clearBackoffTimer();
|
|
101
|
+
};
|
|
102
|
+
const executeLoadUrl = (retryCount) => {
|
|
103
|
+
// Every load attempt opens a fresh timing window.
|
|
104
|
+
attemptTimings = createEmptyAttemptTimings();
|
|
105
|
+
// A pending backoff timer is stale by definition once a new attempt
|
|
106
|
+
// starts (e.g. retry() skipping the remaining backoff) — clear it so
|
|
107
|
+
// it can't fire a pointless backoff_elapsed mid-attempt.
|
|
108
|
+
clearBackoffTimer();
|
|
109
|
+
currentUrl =
|
|
110
|
+
retryCount === 0
|
|
111
|
+
? ensureBuiltUrl()
|
|
112
|
+
: incrementRetryInUrl(getCurrentUrl());
|
|
113
|
+
adapter.load(currentUrl);
|
|
114
|
+
};
|
|
115
|
+
const executeArmTimer = (phase, ms) => {
|
|
116
|
+
const existingTimer = phaseTimers.get(phase);
|
|
117
|
+
if (existingTimer !== undefined)
|
|
118
|
+
clearTimeout(existingTimer);
|
|
119
|
+
phaseTimers.set(phase, setTimeout(() => {
|
|
120
|
+
phaseTimers.delete(phase);
|
|
121
|
+
dispatch({ phase, type: 'timer_expired' });
|
|
122
|
+
}, ms));
|
|
123
|
+
};
|
|
124
|
+
const executeScheduleBackoff = (delayMs) => {
|
|
125
|
+
clearBackoffTimer();
|
|
126
|
+
backoffTimer = setTimeout(() => {
|
|
127
|
+
backoffTimer = null;
|
|
128
|
+
dispatch({ type: 'backoff_elapsed' });
|
|
129
|
+
}, delayMs);
|
|
130
|
+
};
|
|
131
|
+
const executeRaiseTerminalError = (effect) => {
|
|
132
|
+
core.initialization.error = new WebViewFailedToLoadError(Object.assign(Object.assign({ attemptFailures: effect.failures, hadClearState: false,
|
|
133
|
+
// The error-meta field names of the timeout budgets are frozen (they
|
|
134
|
+
// reach Datadog); only the code-level option names changed.
|
|
135
|
+
loadingTimeoutMs: pageLoadTimeoutMs, nativeErrorCount, osKillCount: 0, phase: effect.phase, recoveryTimeoutMs: sdkReadyTimeoutMs,
|
|
136
|
+
// The terminal transition leaves `attempt` unchanged, so the
|
|
137
|
+
// post-transition state still carries the failed attempt number.
|
|
138
|
+
retryCount: state.attempt - 1, webviewUrl: getCurrentUrl().toString() }, getPhaseDurations(attemptTimings)), effect.extraMeta));
|
|
139
|
+
};
|
|
140
|
+
const executeEffect = (effect, previousState, batchExtraMeta) => {
|
|
141
|
+
switch (effect.type) {
|
|
142
|
+
case 'load_url':
|
|
143
|
+
executeLoadUrl(effect.retryCount);
|
|
144
|
+
break;
|
|
145
|
+
case 'arm_timer':
|
|
146
|
+
executeArmTimer(effect.phase, effect.ms);
|
|
147
|
+
break;
|
|
148
|
+
case 'clear_timers':
|
|
149
|
+
clearAllTimers();
|
|
150
|
+
break;
|
|
151
|
+
case 'schedule_backoff':
|
|
152
|
+
executeScheduleBackoff(effect.delayMs);
|
|
153
|
+
break;
|
|
154
|
+
case 'block_transport':
|
|
155
|
+
core.messageTransport.block();
|
|
156
|
+
break;
|
|
157
|
+
case 'probe_origin':
|
|
158
|
+
telemetry.probeOrigin(effect.attempt, effect.phase);
|
|
159
|
+
break;
|
|
160
|
+
case 'emit_telemetry':
|
|
161
|
+
telemetry.emitTelemetry(effect, previousState, batchExtraMeta);
|
|
162
|
+
break;
|
|
163
|
+
case 'raise_terminal_error':
|
|
164
|
+
executeRaiseTerminalError(effect);
|
|
165
|
+
break;
|
|
166
|
+
case 'clear_error':
|
|
167
|
+
core.initialization.error = null;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const dispatch = (event) => {
|
|
172
|
+
var _a, _b;
|
|
173
|
+
if (tornDown)
|
|
174
|
+
return;
|
|
175
|
+
// Record wall-clock timestamps of lifecycle events BEFORE the transition
|
|
176
|
+
// so effects emitted by the same dispatch (e.g. the success telemetry of
|
|
177
|
+
// `sdk_ready`) already see the freshest timing.
|
|
178
|
+
attemptTimings = recordEventTiming(attemptTimings, event, now());
|
|
179
|
+
if (event.type === 'native_error')
|
|
180
|
+
nativeErrorCount += 1;
|
|
181
|
+
const previousState = state;
|
|
182
|
+
const { effects, state: nextState } = transitionWebViewLoadState(state, event, config);
|
|
183
|
+
state = nextState;
|
|
184
|
+
// The terminal `load_error` telemetry carries the native-error meta of
|
|
185
|
+
// the failure that raised it; the machine attaches that meta to the
|
|
186
|
+
// raise_terminal_error effect of the same batch.
|
|
187
|
+
const batchExtraMeta = (_b = (_a = effects.find(isRaiseTerminalErrorEffect)) === null || _a === void 0 ? void 0 : _a.extraMeta) !== null && _b !== void 0 ? _b : {};
|
|
188
|
+
for (const effect of effects) {
|
|
189
|
+
executeEffect(effect, previousState, batchExtraMeta);
|
|
190
|
+
}
|
|
191
|
+
if (state !== previousState) {
|
|
192
|
+
const publicState = getPublicState();
|
|
193
|
+
stateChangedCallbacks.forEach((callback) => callback(publicState));
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const onStateChanged = (callback) => {
|
|
197
|
+
stateChangedCallbacks.add(callback);
|
|
198
|
+
return () => {
|
|
199
|
+
stateChangedCallbacks.delete(callback);
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
const retry = () => {
|
|
203
|
+
// Nothing this call can do will ever produce a settling transition when
|
|
204
|
+
// (a) we're outside failed/waiting_to_retry (retry_requested is a no-op
|
|
205
|
+
// while idle/loading/ready — there is nothing to retry), or (b) the
|
|
206
|
+
// controller is torn down (dispatch() is a no-op and the callbacks are
|
|
207
|
+
// gone). In both cases, resolve immediately with the current projection
|
|
208
|
+
// instead of waiting for a transition that will never arrive.
|
|
209
|
+
if (tornDown ||
|
|
210
|
+
(state.status !== FAILED_STATUS &&
|
|
211
|
+
state.status !== WAITING_TO_RETRY_STATUS)) {
|
|
212
|
+
return Promise.resolve(getPublicState());
|
|
213
|
+
}
|
|
214
|
+
return new Promise((resolve) => {
|
|
215
|
+
pendingRetryResolvers.add(resolve);
|
|
216
|
+
const unsubscribe = onStateChanged((publicState) => {
|
|
217
|
+
if (publicState.status === READY_STATUS ||
|
|
218
|
+
publicState.status === FAILED_STATUS) {
|
|
219
|
+
unsubscribe();
|
|
220
|
+
pendingRetryResolvers.delete(resolve);
|
|
221
|
+
resolve(publicState);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
dispatch({ type: 'retry_requested' });
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
const start = () => {
|
|
228
|
+
currentUrl = ensureBuiltUrl();
|
|
229
|
+
dispatch({ type: 'load_requested' });
|
|
230
|
+
};
|
|
231
|
+
const handleTransportMessage = (message) => {
|
|
232
|
+
if (isSdkReadyMessage(message)) {
|
|
233
|
+
// Ack the request-channel message ourselves so the webview does not time
|
|
234
|
+
// out if the host store handler has not been registered yet. The store
|
|
235
|
+
// will ack too once it is listening; duplicate acks are ignored.
|
|
236
|
+
core.messageTransport.emit({
|
|
237
|
+
args: [],
|
|
238
|
+
messageSessionId: message.messageSessionId,
|
|
239
|
+
origin: 'host',
|
|
240
|
+
type: getAckMessageType(message.type),
|
|
241
|
+
});
|
|
242
|
+
dispatch({ type: 'sdk_ready' });
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
// A `loaded: false` sdk__loadedChanged payload falls through here but
|
|
246
|
+
// matches neither branch — it is ignored entirely (it must not disarm
|
|
247
|
+
// the recovery timer nor count as ready).
|
|
248
|
+
if (message.origin === 'webview' &&
|
|
249
|
+
message.type === MANIFEST_MESSAGE_TYPE) {
|
|
250
|
+
dispatch({ type: 'manifest_received' });
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
core.messageTransport.on(handleTransportMessage);
|
|
254
|
+
// The transport recovery manager declaring the current page dead is a
|
|
255
|
+
// transient failure of the current attempt.
|
|
256
|
+
const unsubscribeRecovery = core.messageTransport.recoveryManager.onRecoveryRequested(() => {
|
|
257
|
+
dispatch({ type: 'recovery_requested' });
|
|
258
|
+
});
|
|
259
|
+
const teardown = () => {
|
|
260
|
+
tornDown = true;
|
|
261
|
+
clearAllTimers();
|
|
262
|
+
core.messageTransport.off(handleTransportMessage);
|
|
263
|
+
unsubscribeRecovery();
|
|
264
|
+
stateChangedCallbacks.clear();
|
|
265
|
+
// Settle any in-flight retry() promises with the final projection: their
|
|
266
|
+
// state-changed subscription was just cleared and dispatch() is now a
|
|
267
|
+
// no-op, so the ready/failed transition they wait on can never fire.
|
|
268
|
+
const publicState = getPublicState();
|
|
269
|
+
pendingRetryResolvers.forEach((resolve) => resolve(publicState));
|
|
270
|
+
pendingRetryResolvers.clear();
|
|
271
|
+
};
|
|
272
|
+
return {
|
|
273
|
+
dispatch,
|
|
274
|
+
getState: getPublicState,
|
|
275
|
+
onStateChanged,
|
|
276
|
+
retry,
|
|
277
|
+
start,
|
|
278
|
+
teardown,
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export { DEFAULT_PAGE_LOAD_TIMEOUT_MS, DEFAULT_SDK_READY_TIMEOUT_MS, createWebViewLoadController };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
// Consolidated instrumentation keys shared by every webview platform path
|
|
7
|
+
// (embedded native, react-native-webview, web iframe). The payloads carry a
|
|
8
|
+
// `webviewType` discriminator instead of per-path keys, so the streams can
|
|
9
|
+
// be queried together in Datadog. Single source of truth — imported by the
|
|
10
|
+
// platform extensions where needed.
|
|
11
|
+
const WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY = 'webview.load_error';
|
|
12
|
+
const WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY = 'webview.load_retry';
|
|
13
|
+
const WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY = 'webview.load_succeeded';
|
|
14
|
+
const WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY = 'webview.origin_probe';
|
|
15
|
+
/**
|
|
16
|
+
* Window during which ONE controller instance emits at most one success
|
|
17
|
+
* log. What it actually suppresses is a repeat success within the life of
|
|
18
|
+
* a single controller — a webview process kill or a transport recovery
|
|
19
|
+
* reloading a page that then goes ready again. The first success of a
|
|
20
|
+
* load cycle always emits, so a recovered boot (`retryCount > 0`) is
|
|
21
|
+
* still reported.
|
|
22
|
+
*
|
|
23
|
+
* Scope is deliberately narrower than the `expo-secure-store` backed
|
|
24
|
+
* cooldown it replaced, in two ways that are BOTH accepted trades for
|
|
25
|
+
* dropping the device-storage dependency from the telemetry path:
|
|
26
|
+
*
|
|
27
|
+
* 1. It does not survive an app restart, so a device relaunching the app
|
|
28
|
+
* several times an hour emits one success log per launch instead of
|
|
29
|
+
* one per hour.
|
|
30
|
+
* 2. It does not survive controller re-creation, so remounting
|
|
31
|
+
* `<WebView>` or recreating the client (see mobile-demo's
|
|
32
|
+
* ReloadWebViewContextProvider) starts a fresh window. Unmounting the
|
|
33
|
+
* webview is already an unsupported pattern the SDK warns about.
|
|
34
|
+
*
|
|
35
|
+
* Net effect: this is an in-process loop guard, not a fleet-wide volume
|
|
36
|
+
* control. Do not "fix" either point by reintroducing persistence
|
|
37
|
+
* without revisiting that decision.
|
|
38
|
+
*/
|
|
39
|
+
const SUCCESS_LOG_COOLDOWN_MS = 60 * 60 * 1000;
|
|
40
|
+
|
|
41
|
+
exports.SUCCESS_LOG_COOLDOWN_MS = SUCCESS_LOG_COOLDOWN_MS;
|
|
42
|
+
exports.WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY = WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY;
|
|
43
|
+
exports.WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY = WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY;
|
|
44
|
+
exports.WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY = WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY;
|
|
45
|
+
exports.WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY = WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY = "webview.load_error";
|
|
2
|
+
export declare const WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY = "webview.load_retry";
|
|
3
|
+
export declare const WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY = "webview.load_succeeded";
|
|
4
|
+
export declare const WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY = "webview.origin_probe";
|
|
5
|
+
/**
|
|
6
|
+
* Window during which ONE controller instance emits at most one success
|
|
7
|
+
* log. What it actually suppresses is a repeat success within the life of
|
|
8
|
+
* a single controller — a webview process kill or a transport recovery
|
|
9
|
+
* reloading a page that then goes ready again. The first success of a
|
|
10
|
+
* load cycle always emits, so a recovered boot (`retryCount > 0`) is
|
|
11
|
+
* still reported.
|
|
12
|
+
*
|
|
13
|
+
* Scope is deliberately narrower than the `expo-secure-store` backed
|
|
14
|
+
* cooldown it replaced, in two ways that are BOTH accepted trades for
|
|
15
|
+
* dropping the device-storage dependency from the telemetry path:
|
|
16
|
+
*
|
|
17
|
+
* 1. It does not survive an app restart, so a device relaunching the app
|
|
18
|
+
* several times an hour emits one success log per launch instead of
|
|
19
|
+
* one per hour.
|
|
20
|
+
* 2. It does not survive controller re-creation, so remounting
|
|
21
|
+
* `<WebView>` or recreating the client (see mobile-demo's
|
|
22
|
+
* ReloadWebViewContextProvider) starts a fresh window. Unmounting the
|
|
23
|
+
* webview is already an unsupported pattern the SDK warns about.
|
|
24
|
+
*
|
|
25
|
+
* Net effect: this is an in-process loop guard, not a fleet-wide volume
|
|
26
|
+
* control. Do not "fix" either point by reintroducing persistence
|
|
27
|
+
* without revisiting that decision.
|
|
28
|
+
*/
|
|
29
|
+
export declare const SUCCESS_LOG_COOLDOWN_MS: number;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
// Consolidated instrumentation keys shared by every webview platform path
|
|
3
|
+
// (embedded native, react-native-webview, web iframe). The payloads carry a
|
|
4
|
+
// `webviewType` discriminator instead of per-path keys, so the streams can
|
|
5
|
+
// be queried together in Datadog. Single source of truth — imported by the
|
|
6
|
+
// platform extensions where needed.
|
|
7
|
+
const WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY = 'webview.load_error';
|
|
8
|
+
const WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY = 'webview.load_retry';
|
|
9
|
+
const WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY = 'webview.load_succeeded';
|
|
10
|
+
const WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY = 'webview.origin_probe';
|
|
11
|
+
/**
|
|
12
|
+
* Window during which ONE controller instance emits at most one success
|
|
13
|
+
* log. What it actually suppresses is a repeat success within the life of
|
|
14
|
+
* a single controller — a webview process kill or a transport recovery
|
|
15
|
+
* reloading a page that then goes ready again. The first success of a
|
|
16
|
+
* load cycle always emits, so a recovered boot (`retryCount > 0`) is
|
|
17
|
+
* still reported.
|
|
18
|
+
*
|
|
19
|
+
* Scope is deliberately narrower than the `expo-secure-store` backed
|
|
20
|
+
* cooldown it replaced, in two ways that are BOTH accepted trades for
|
|
21
|
+
* dropping the device-storage dependency from the telemetry path:
|
|
22
|
+
*
|
|
23
|
+
* 1. It does not survive an app restart, so a device relaunching the app
|
|
24
|
+
* several times an hour emits one success log per launch instead of
|
|
25
|
+
* one per hour.
|
|
26
|
+
* 2. It does not survive controller re-creation, so remounting
|
|
27
|
+
* `<WebView>` or recreating the client (see mobile-demo's
|
|
28
|
+
* ReloadWebViewContextProvider) starts a fresh window. Unmounting the
|
|
29
|
+
* webview is already an unsupported pattern the SDK warns about.
|
|
30
|
+
*
|
|
31
|
+
* Net effect: this is an in-process loop guard, not a fleet-wide volume
|
|
32
|
+
* control. Do not "fix" either point by reintroducing persistence
|
|
33
|
+
* without revisiting that decision.
|
|
34
|
+
*/
|
|
35
|
+
const SUCCESS_LOG_COOLDOWN_MS = 60 * 60 * 1000;
|
|
36
|
+
|
|
37
|
+
export { SUCCESS_LOG_COOLDOWN_MS, WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY, WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY, WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY, WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var logger = require('../../../utils/logger/logger.cjs');
|
|
7
|
+
var probeOrigin = require('../../probeOrigin/probeOrigin.cjs');
|
|
8
|
+
var getPhaseDurations = require('../getPhaseDurations/getPhaseDurations.cjs');
|
|
9
|
+
var constants = require('./constants.cjs');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The telemetry side of the load controller: turns the machine's
|
|
13
|
+
* emit_telemetry / probe_origin effects into `logger.instrument` logs on
|
|
14
|
+
* the consolidated `webview.*` keys. Reads the controller's mutable
|
|
15
|
+
* context (current URL, attempt timings, counters, teardown flag) through
|
|
16
|
+
* the injected getters so async emits always observe fresh values.
|
|
17
|
+
*/
|
|
18
|
+
const createWebViewLoadTelemetry = ({ core, getAttemptTimings, getCurrentUrl, getNativeErrorCount, isTornDown, now, pageLoadTimeoutMs, sdkReadyTimeoutMs, webviewType, }) => {
|
|
19
|
+
// Wall-clock of the last success log emitted by THIS controller, or
|
|
20
|
+
// `null` while none has been emitted yet. Scoped to the controller (so
|
|
21
|
+
// an app mounting both webview paths cools them down independently) and
|
|
22
|
+
// never persisted — see SUCCESS_LOG_COOLDOWN_MS.
|
|
23
|
+
let lastSuccessEmittedAt = null;
|
|
24
|
+
// Fields carried by EVERY telemetry event so the consolidated keys can be
|
|
25
|
+
// filtered per path/environment/session in Datadog.
|
|
26
|
+
const getCommonInstrumentFields = (instrumentedUrl = getCurrentUrl().toString()) => ({
|
|
27
|
+
environmentId: core.environmentId,
|
|
28
|
+
hostSdkSessionId: core.hostSdkSessionId,
|
|
29
|
+
time: 0,
|
|
30
|
+
webviewType,
|
|
31
|
+
webviewUrl: instrumentedUrl,
|
|
32
|
+
});
|
|
33
|
+
const emitSuccessTelemetry = (previousState) => {
|
|
34
|
+
const emittedAt = now();
|
|
35
|
+
const elapsedSinceLastSuccess = lastSuccessEmittedAt === null ? null : emittedAt - lastSuccessEmittedAt;
|
|
36
|
+
// A negative elapsed means the wall clock moved backwards (an NTP
|
|
37
|
+
// correction, or the user changing the device clock). Treat that as
|
|
38
|
+
// "window over" rather than "still inside it", so a backwards jump
|
|
39
|
+
// cannot wedge the gate shut for the length of the jump.
|
|
40
|
+
if (elapsedSinceLastSuccess !== null &&
|
|
41
|
+
elapsedSinceLastSuccess >= 0 &&
|
|
42
|
+
elapsedSinceLastSuccess < constants.SUCCESS_LOG_COOLDOWN_MS) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
lastSuccessEmittedAt = emittedAt;
|
|
46
|
+
// Emitted synchronously inside the dispatch that produced the effect,
|
|
47
|
+
// so the timings and URL read here are unambiguously those of the
|
|
48
|
+
// attempt that just succeeded.
|
|
49
|
+
logger.logger.instrument('Webview loaded successfully', Object.assign(Object.assign({ hadClearState: false, key: constants.WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY,
|
|
50
|
+
// The wire field names of the timeout budgets are frozen (Datadog
|
|
51
|
+
// dashboards query them); only the code-level option names changed.
|
|
52
|
+
loadingTimeoutMs: pageLoadTimeoutMs, nativeErrorCount: getNativeErrorCount(), osKillCount: 0, recoveryTimeoutMs: sdkReadyTimeoutMs, retryCount: previousState.attempt - 1 }, getPhaseDurations.getPhaseDurations(getAttemptTimings())), getCommonInstrumentFields()));
|
|
53
|
+
};
|
|
54
|
+
const emitTelemetry = (effect, previousState, batchExtraMeta) => {
|
|
55
|
+
if (effect.event === 'load_retry') {
|
|
56
|
+
logger.logger.instrument('Webview load retry scheduled', Object.assign({ attempt: effect.attempt, delayMs: effect.delayMs, key: constants.WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY, maxAttempts: effect.maxAttempts, phase: effect.phase }, getCommonInstrumentFields()));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (effect.event === 'load_error') {
|
|
60
|
+
logger.logger.instrument('Webview load error', Object.assign(Object.assign({ attempt: effect.attempt, key: constants.WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY, phase: effect.phase, retryCount: effect.attempt - 1 }, batchExtraMeta), getCommonInstrumentFields()));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
emitSuccessTelemetry(previousState);
|
|
64
|
+
};
|
|
65
|
+
// Diagnostics only: fire-and-forget reachability probe against the origin
|
|
66
|
+
// of the attempt that just failed, emitted as its OWN instrument log so it
|
|
67
|
+
// never delays the (synchronous) failure path. Datadog joins it to the
|
|
68
|
+
// load_error/load_retry logs via hostSdkSessionId + environmentId. It
|
|
69
|
+
// distinguishes "origin unreachable from this device" (probe fails) from
|
|
70
|
+
// "webview stack broken" (probe succeeds) and has zero effect on
|
|
71
|
+
// retry/terminal behavior.
|
|
72
|
+
const executeProbeOrigin = (attempt, phase) => {
|
|
73
|
+
const probedUrl = getCurrentUrl();
|
|
74
|
+
const probedWebviewUrl = probedUrl.toString();
|
|
75
|
+
// probeOrigin never rejects, so no catch is needed.
|
|
76
|
+
probeOrigin.probeOrigin({
|
|
77
|
+
origin: probedUrl.origin,
|
|
78
|
+
timeoutMs: probeOrigin.ORIGIN_PROBE_TIMEOUT_MS,
|
|
79
|
+
}).then(({ originReachable, probeDurationMs, probeStatus }) => {
|
|
80
|
+
if (isTornDown())
|
|
81
|
+
return;
|
|
82
|
+
logger.logger.instrument('Webview origin probe', Object.assign({ attempt, key: constants.WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY, originReachable,
|
|
83
|
+
phase,
|
|
84
|
+
probeDurationMs,
|
|
85
|
+
probeStatus }, getCommonInstrumentFields(probedWebviewUrl)));
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
emitTelemetry,
|
|
90
|
+
probeOrigin: executeProbeOrigin,
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
exports.createWebViewLoadTelemetry = createWebViewLoadTelemetry;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Core } from '../../../client/core';
|
|
2
|
+
import { WebViewFailedToLoadErrorPhase } from '../../WebViewFailedToLoadError';
|
|
3
|
+
import { WebViewLoadEffect, WebViewLoadNativeErrorMeta, WebViewLoadState } from '../../webViewLoadTypes';
|
|
4
|
+
import { AttemptTimings } from '../createEmptyAttemptTimings';
|
|
5
|
+
import { WebViewLoadWebviewType } from '../webViewLoadAdapter';
|
|
6
|
+
export type WebViewLoadEmitTelemetryEffect = Extract<WebViewLoadEffect, {
|
|
7
|
+
type: 'emit_telemetry';
|
|
8
|
+
}>;
|
|
9
|
+
export type CreateWebViewLoadTelemetryArgs = {
|
|
10
|
+
core: Core;
|
|
11
|
+
/** Live view of the current attempt's lifecycle timestamps. */
|
|
12
|
+
getAttemptTimings: () => AttemptTimings;
|
|
13
|
+
/** Live view of the URL of the current attempt. */
|
|
14
|
+
getCurrentUrl: () => URL;
|
|
15
|
+
/** Live view of the controller-lifetime native error counter. */
|
|
16
|
+
getNativeErrorCount: () => number;
|
|
17
|
+
/** Async emits check this so late logs become no-ops after teardown. */
|
|
18
|
+
isTornDown: () => boolean;
|
|
19
|
+
/** Wall-clock source, shared with the machine config. */
|
|
20
|
+
now: () => number;
|
|
21
|
+
pageLoadTimeoutMs: number;
|
|
22
|
+
sdkReadyTimeoutMs: number;
|
|
23
|
+
webviewType: WebViewLoadWebviewType;
|
|
24
|
+
};
|
|
25
|
+
export type WebViewLoadTelemetry = {
|
|
26
|
+
/** Execute an emit_telemetry effect requested by the machine. */
|
|
27
|
+
emitTelemetry: (effect: WebViewLoadEmitTelemetryEffect, previousState: WebViewLoadState, batchExtraMeta: WebViewLoadNativeErrorMeta) => void;
|
|
28
|
+
/** Execute a probe_origin effect requested by the machine. */
|
|
29
|
+
probeOrigin: (attempt: number, phase: WebViewFailedToLoadErrorPhase) => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The telemetry side of the load controller: turns the machine's
|
|
33
|
+
* emit_telemetry / probe_origin effects into `logger.instrument` logs on
|
|
34
|
+
* the consolidated `webview.*` keys. Reads the controller's mutable
|
|
35
|
+
* context (current URL, attempt timings, counters, teardown flag) through
|
|
36
|
+
* the injected getters so async emits always observe fresh values.
|
|
37
|
+
*/
|
|
38
|
+
export declare const createWebViewLoadTelemetry: ({ core, getAttemptTimings, getCurrentUrl, getNativeErrorCount, isTornDown, now, pageLoadTimeoutMs, sdkReadyTimeoutMs, webviewType, }: CreateWebViewLoadTelemetryArgs) => WebViewLoadTelemetry;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { logger } from '../../../utils/logger/logger.js';
|
|
3
|
+
import { probeOrigin, ORIGIN_PROBE_TIMEOUT_MS } from '../../probeOrigin/probeOrigin.js';
|
|
4
|
+
import { getPhaseDurations } from '../getPhaseDurations/getPhaseDurations.js';
|
|
5
|
+
import { WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY, WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY, WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY, WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY, SUCCESS_LOG_COOLDOWN_MS } from './constants.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The telemetry side of the load controller: turns the machine's
|
|
9
|
+
* emit_telemetry / probe_origin effects into `logger.instrument` logs on
|
|
10
|
+
* the consolidated `webview.*` keys. Reads the controller's mutable
|
|
11
|
+
* context (current URL, attempt timings, counters, teardown flag) through
|
|
12
|
+
* the injected getters so async emits always observe fresh values.
|
|
13
|
+
*/
|
|
14
|
+
const createWebViewLoadTelemetry = ({ core, getAttemptTimings, getCurrentUrl, getNativeErrorCount, isTornDown, now, pageLoadTimeoutMs, sdkReadyTimeoutMs, webviewType, }) => {
|
|
15
|
+
// Wall-clock of the last success log emitted by THIS controller, or
|
|
16
|
+
// `null` while none has been emitted yet. Scoped to the controller (so
|
|
17
|
+
// an app mounting both webview paths cools them down independently) and
|
|
18
|
+
// never persisted — see SUCCESS_LOG_COOLDOWN_MS.
|
|
19
|
+
let lastSuccessEmittedAt = null;
|
|
20
|
+
// Fields carried by EVERY telemetry event so the consolidated keys can be
|
|
21
|
+
// filtered per path/environment/session in Datadog.
|
|
22
|
+
const getCommonInstrumentFields = (instrumentedUrl = getCurrentUrl().toString()) => ({
|
|
23
|
+
environmentId: core.environmentId,
|
|
24
|
+
hostSdkSessionId: core.hostSdkSessionId,
|
|
25
|
+
time: 0,
|
|
26
|
+
webviewType,
|
|
27
|
+
webviewUrl: instrumentedUrl,
|
|
28
|
+
});
|
|
29
|
+
const emitSuccessTelemetry = (previousState) => {
|
|
30
|
+
const emittedAt = now();
|
|
31
|
+
const elapsedSinceLastSuccess = lastSuccessEmittedAt === null ? null : emittedAt - lastSuccessEmittedAt;
|
|
32
|
+
// A negative elapsed means the wall clock moved backwards (an NTP
|
|
33
|
+
// correction, or the user changing the device clock). Treat that as
|
|
34
|
+
// "window over" rather than "still inside it", so a backwards jump
|
|
35
|
+
// cannot wedge the gate shut for the length of the jump.
|
|
36
|
+
if (elapsedSinceLastSuccess !== null &&
|
|
37
|
+
elapsedSinceLastSuccess >= 0 &&
|
|
38
|
+
elapsedSinceLastSuccess < SUCCESS_LOG_COOLDOWN_MS) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
lastSuccessEmittedAt = emittedAt;
|
|
42
|
+
// Emitted synchronously inside the dispatch that produced the effect,
|
|
43
|
+
// so the timings and URL read here are unambiguously those of the
|
|
44
|
+
// attempt that just succeeded.
|
|
45
|
+
logger.instrument('Webview loaded successfully', Object.assign(Object.assign({ hadClearState: false, key: WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY,
|
|
46
|
+
// The wire field names of the timeout budgets are frozen (Datadog
|
|
47
|
+
// dashboards query them); only the code-level option names changed.
|
|
48
|
+
loadingTimeoutMs: pageLoadTimeoutMs, nativeErrorCount: getNativeErrorCount(), osKillCount: 0, recoveryTimeoutMs: sdkReadyTimeoutMs, retryCount: previousState.attempt - 1 }, getPhaseDurations(getAttemptTimings())), getCommonInstrumentFields()));
|
|
49
|
+
};
|
|
50
|
+
const emitTelemetry = (effect, previousState, batchExtraMeta) => {
|
|
51
|
+
if (effect.event === 'load_retry') {
|
|
52
|
+
logger.instrument('Webview load retry scheduled', Object.assign({ attempt: effect.attempt, delayMs: effect.delayMs, key: WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY, maxAttempts: effect.maxAttempts, phase: effect.phase }, getCommonInstrumentFields()));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (effect.event === 'load_error') {
|
|
56
|
+
logger.instrument('Webview load error', Object.assign(Object.assign({ attempt: effect.attempt, key: WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY, phase: effect.phase, retryCount: effect.attempt - 1 }, batchExtraMeta), getCommonInstrumentFields()));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
emitSuccessTelemetry(previousState);
|
|
60
|
+
};
|
|
61
|
+
// Diagnostics only: fire-and-forget reachability probe against the origin
|
|
62
|
+
// of the attempt that just failed, emitted as its OWN instrument log so it
|
|
63
|
+
// never delays the (synchronous) failure path. Datadog joins it to the
|
|
64
|
+
// load_error/load_retry logs via hostSdkSessionId + environmentId. It
|
|
65
|
+
// distinguishes "origin unreachable from this device" (probe fails) from
|
|
66
|
+
// "webview stack broken" (probe succeeds) and has zero effect on
|
|
67
|
+
// retry/terminal behavior.
|
|
68
|
+
const executeProbeOrigin = (attempt, phase) => {
|
|
69
|
+
const probedUrl = getCurrentUrl();
|
|
70
|
+
const probedWebviewUrl = probedUrl.toString();
|
|
71
|
+
// probeOrigin never rejects, so no catch is needed.
|
|
72
|
+
probeOrigin({
|
|
73
|
+
origin: probedUrl.origin,
|
|
74
|
+
timeoutMs: ORIGIN_PROBE_TIMEOUT_MS,
|
|
75
|
+
}).then(({ originReachable, probeDurationMs, probeStatus }) => {
|
|
76
|
+
if (isTornDown())
|
|
77
|
+
return;
|
|
78
|
+
logger.instrument('Webview origin probe', Object.assign({ attempt, key: WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY, originReachable,
|
|
79
|
+
phase,
|
|
80
|
+
probeDurationMs,
|
|
81
|
+
probeStatus }, getCommonInstrumentFields(probedWebviewUrl)));
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
emitTelemetry,
|
|
86
|
+
probeOrigin: executeProbeOrigin,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { createWebViewLoadTelemetry };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { SUCCESS_LOG_COOLDOWN_MS, WEBVIEW_LOAD_ERROR_INSTRUMENT_KEY, WEBVIEW_LOAD_RETRY_INSTRUMENT_KEY, WEBVIEW_LOAD_SUCCEEDED_INSTRUMENT_KEY, WEBVIEW_ORIGIN_PROBE_INSTRUMENT_KEY, } from './constants';
|
|
2
|
+
export { createWebViewLoadTelemetry, type CreateWebViewLoadTelemetryArgs, type WebViewLoadEmitTelemetryEffect, type WebViewLoadTelemetry, } from './createWebViewLoadTelemetry';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var diffMs = require('../../../utils/diffMs/diffMs.cjs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Per-phase durations of the current load attempt, for the timing meta on
|
|
10
|
+
* telemetry and terminal errors. A duration is null until both of its
|
|
11
|
+
* boundary events have been observed.
|
|
12
|
+
*/
|
|
13
|
+
const getPhaseDurations = (timings) => ({
|
|
14
|
+
htmlLoadMs: diffMs.diffMs(timings.responseCommittedAt, timings.loadStartedAt),
|
|
15
|
+
manifestReceivedMs: diffMs.diffMs(timings.manifestReceivedAt, timings.pageFinishedAt),
|
|
16
|
+
onLoadToOnLoadEndMs: diffMs.diffMs(timings.pageFinishedAt, timings.responseCommittedAt),
|
|
17
|
+
sdkReadyMs: diffMs.diffMs(timings.sdkReadyAt, timings.pageFinishedAt),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.getPhaseDurations = getPhaseDurations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AttemptTimings } from '../createEmptyAttemptTimings';
|
|
2
|
+
export type WebViewLoadPhaseDurations = {
|
|
3
|
+
htmlLoadMs: number | null;
|
|
4
|
+
manifestReceivedMs: number | null;
|
|
5
|
+
onLoadToOnLoadEndMs: number | null;
|
|
6
|
+
sdkReadyMs: number | null;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Per-phase durations of the current load attempt, for the timing meta on
|
|
10
|
+
* telemetry and terminal errors. A duration is null until both of its
|
|
11
|
+
* boundary events have been observed.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getPhaseDurations: (timings: AttemptTimings) => WebViewLoadPhaseDurations;
|