@dynamic-labs/legacy-client 0.0.0 → 5.0.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 +6800 -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,72 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var reactivity = require('@vue/reactivity');
|
|
7
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
8
|
+
var logger = require('../../../../utils/logger/logger.cjs');
|
|
9
|
+
|
|
10
|
+
const createInitializationModule = (messageTransport$1) => {
|
|
11
|
+
const consoleRequestChannel = messageTransport.createRequestChannel(messageTransport$1);
|
|
12
|
+
const state = reactivity.reactive({
|
|
13
|
+
error: null,
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Uses regular console.error to log the errors
|
|
17
|
+
* so we dont send the error to the backend twice
|
|
18
|
+
*/
|
|
19
|
+
consoleRequestChannel.handle('error', (serializedError, { severity }) => {
|
|
20
|
+
const error = messageTransport.parseErrorFromTransport(serializedError);
|
|
21
|
+
if (Array.isArray(error)) {
|
|
22
|
+
// Log each item individually because the expo console fails to log complex objects
|
|
23
|
+
// So this way if one item is complex, it doesn't hide the others
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
for (const item of error)
|
|
26
|
+
console.error(item);
|
|
27
|
+
if (severity === 'fatal') {
|
|
28
|
+
state.error = new Error('Unknown error occurred, check your console for more details');
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (severity === 'fatal') {
|
|
33
|
+
state.error = error;
|
|
34
|
+
}
|
|
35
|
+
// We also log the message individually in case the error object fails to be logged by the expo console
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
if (error.message)
|
|
38
|
+
console.error(error.message);
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.error(error);
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
get error() {
|
|
44
|
+
return state.error;
|
|
45
|
+
},
|
|
46
|
+
set error(error) {
|
|
47
|
+
state.error = error;
|
|
48
|
+
// Clearing the error (e.g. the webview load engine wiping a terminal
|
|
49
|
+
// error before a customer-facing retry) is not a failure — there is
|
|
50
|
+
// nothing to report to the logger.
|
|
51
|
+
if (error === null)
|
|
52
|
+
return;
|
|
53
|
+
/**
|
|
54
|
+
* Uses the logger so the error is sent to the backend.
|
|
55
|
+
*
|
|
56
|
+
* If the error carries a `meta` property, forward it to the logger
|
|
57
|
+
* so the resulting Datadog log carries both the error message and
|
|
58
|
+
* the structured context (e.g. WebViewFailedToLoadError attaches
|
|
59
|
+
* phase timings via its `meta`).
|
|
60
|
+
*/
|
|
61
|
+
const { meta } = error;
|
|
62
|
+
if (meta) {
|
|
63
|
+
logger.logger.error(state.error, meta);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
logger.logger.error(state.error);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
exports.createInitializationModule = createInitializationModule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
|
|
2
|
+
export type InitializationModule = {
|
|
3
|
+
get error(): Error | null;
|
|
4
|
+
set error(error: Error | null);
|
|
5
|
+
};
|
|
6
|
+
export declare const createInitializationModule: (messageTransport: MessageTransportWithDefaultOrigin) => InitializationModule;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { reactive } from '@vue/reactivity';
|
|
3
|
+
import { createRequestChannel, parseErrorFromTransport } from '@dynamic-labs/message-transport';
|
|
4
|
+
import { logger } from '../../../../utils/logger/logger.js';
|
|
5
|
+
|
|
6
|
+
const createInitializationModule = (messageTransport) => {
|
|
7
|
+
const consoleRequestChannel = createRequestChannel(messageTransport);
|
|
8
|
+
const state = reactive({
|
|
9
|
+
error: null,
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Uses regular console.error to log the errors
|
|
13
|
+
* so we dont send the error to the backend twice
|
|
14
|
+
*/
|
|
15
|
+
consoleRequestChannel.handle('error', (serializedError, { severity }) => {
|
|
16
|
+
const error = parseErrorFromTransport(serializedError);
|
|
17
|
+
if (Array.isArray(error)) {
|
|
18
|
+
// Log each item individually because the expo console fails to log complex objects
|
|
19
|
+
// So this way if one item is complex, it doesn't hide the others
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
for (const item of error)
|
|
22
|
+
console.error(item);
|
|
23
|
+
if (severity === 'fatal') {
|
|
24
|
+
state.error = new Error('Unknown error occurred, check your console for more details');
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (severity === 'fatal') {
|
|
29
|
+
state.error = error;
|
|
30
|
+
}
|
|
31
|
+
// We also log the message individually in case the error object fails to be logged by the expo console
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
if (error.message)
|
|
34
|
+
console.error(error.message);
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.error(error);
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
get error() {
|
|
40
|
+
return state.error;
|
|
41
|
+
},
|
|
42
|
+
set error(error) {
|
|
43
|
+
state.error = error;
|
|
44
|
+
// Clearing the error (e.g. the webview load engine wiping a terminal
|
|
45
|
+
// error before a customer-facing retry) is not a failure — there is
|
|
46
|
+
// nothing to report to the logger.
|
|
47
|
+
if (error === null)
|
|
48
|
+
return;
|
|
49
|
+
/**
|
|
50
|
+
* Uses the logger so the error is sent to the backend.
|
|
51
|
+
*
|
|
52
|
+
* If the error carries a `meta` property, forward it to the logger
|
|
53
|
+
* so the resulting Datadog log carries both the error message and
|
|
54
|
+
* the structured context (e.g. WebViewFailedToLoadError attaches
|
|
55
|
+
* phase timings via its `meta`).
|
|
56
|
+
*/
|
|
57
|
+
const { meta } = error;
|
|
58
|
+
if (meta) {
|
|
59
|
+
logger.error(state.error, meta);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
logger.error(state.error);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { createInitializationModule };
|
package/src/client/core/modules/manifestModule/createPartialManifest/createPartialManifest.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _package = require('../../../../../../package.cjs');
|
|
7
|
+
|
|
8
|
+
const createPartialManifest = ({ apiBaseUrl, environmentId, appLogoUrl, appName, cssOverrides, evmNetworks, bitcoinNetworks, solNetworks, tonNetworks, debug, globalWallets, locale, connectOnly, deviceRegistrationModal, legacyWalletMigrationModal, useMetamaskSdk, }) => ({
|
|
9
|
+
apiBaseUrl,
|
|
10
|
+
appLogoUrl,
|
|
11
|
+
appName,
|
|
12
|
+
bitcoinNetworks,
|
|
13
|
+
clientVersion: _package.version,
|
|
14
|
+
connectOnly,
|
|
15
|
+
cssOverrides,
|
|
16
|
+
debug,
|
|
17
|
+
deviceRegistrationModal,
|
|
18
|
+
environmentId,
|
|
19
|
+
evmNetworks,
|
|
20
|
+
globalWallets,
|
|
21
|
+
legacyWalletMigrationModal,
|
|
22
|
+
locale,
|
|
23
|
+
solNetworks,
|
|
24
|
+
tonNetworks,
|
|
25
|
+
useMetamaskSdk,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
exports.createPartialManifest = createPartialManifest;
|
package/src/client/core/modules/manifestModule/createPartialManifest/createPartialManifest.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ClientManifest } from '@dynamic-labs/webview-messages';
|
|
2
|
+
import { ClientProps } from '../../../../client';
|
|
3
|
+
export declare const createPartialManifest: ({ apiBaseUrl, environmentId, appLogoUrl, appName, cssOverrides, evmNetworks, bitcoinNetworks, solNetworks, tonNetworks, debug, globalWallets, locale, connectOnly, deviceRegistrationModal, legacyWalletMigrationModal, useMetamaskSdk, }: ClientProps) => Partial<ClientManifest>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { version } from '../../../../../../package.js';
|
|
3
|
+
|
|
4
|
+
const createPartialManifest = ({ apiBaseUrl, environmentId, appLogoUrl, appName, cssOverrides, evmNetworks, bitcoinNetworks, solNetworks, tonNetworks, debug, globalWallets, locale, connectOnly, deviceRegistrationModal, legacyWalletMigrationModal, useMetamaskSdk, }) => ({
|
|
5
|
+
apiBaseUrl,
|
|
6
|
+
appLogoUrl,
|
|
7
|
+
appName,
|
|
8
|
+
bitcoinNetworks,
|
|
9
|
+
clientVersion: version,
|
|
10
|
+
connectOnly,
|
|
11
|
+
cssOverrides,
|
|
12
|
+
debug,
|
|
13
|
+
deviceRegistrationModal,
|
|
14
|
+
environmentId,
|
|
15
|
+
evmNetworks,
|
|
16
|
+
globalWallets,
|
|
17
|
+
legacyWalletMigrationModal,
|
|
18
|
+
locale,
|
|
19
|
+
solNetworks,
|
|
20
|
+
tonNetworks,
|
|
21
|
+
useMetamaskSdk,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { createPartialManifest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createPartialManifest';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createManifestModule } from './manifestModule';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
8
|
+
var logger$1 = require('@dynamic-labs/logger');
|
|
9
|
+
var logger = require('../../../../utils/logger/logger.cjs');
|
|
10
|
+
var createPartialManifest = require('./createPartialManifest/createPartialManifest.cjs');
|
|
11
|
+
var validateManifest = require('./validateManifest/validateManifest.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Manifest module handles the client manifest that will be requested by the webview
|
|
15
|
+
*/
|
|
16
|
+
const createManifestModule = (props, messageTransport$1, initializationModule) => {
|
|
17
|
+
const requestChannel = messageTransport.createRequestChannel(messageTransport$1);
|
|
18
|
+
const manifest = createPartialManifest.createPartialManifest(props);
|
|
19
|
+
requestChannel.handle('manifest', () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
return validateManifest.validateManifest(manifest);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
logger.logger.error(error);
|
|
25
|
+
if (error instanceof Error)
|
|
26
|
+
initializationModule.error = error;
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
return {
|
|
31
|
+
setAppOrigin: (appOrigin) => (manifest.appOrigin = appOrigin),
|
|
32
|
+
setPlatform: (platform) => {
|
|
33
|
+
logger$1.Logger.globalMetaData.set('platform', platform);
|
|
34
|
+
manifest.platform = platform;
|
|
35
|
+
},
|
|
36
|
+
setRedirectUrl: (redirectUrl) => (manifest.redirectUrl = redirectUrl),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.createManifestModule = createManifestModule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
|
|
2
|
+
import { ClientManifest } from '@dynamic-labs/webview-messages';
|
|
3
|
+
import { ClientProps } from '../../../client';
|
|
4
|
+
import { InitializationModule } from '../initializationModule/initializationModule';
|
|
5
|
+
/**
|
|
6
|
+
* Manifest module handles the client manifest that will be requested by the webview
|
|
7
|
+
*/
|
|
8
|
+
export declare const createManifestModule: (props: ClientProps, messageTransport: MessageTransportWithDefaultOrigin, initializationModule: InitializationModule) => {
|
|
9
|
+
setAppOrigin: (appOrigin: string) => string;
|
|
10
|
+
setPlatform: (platform: ClientManifest['platform']) => void;
|
|
11
|
+
setRedirectUrl: (redirectUrl: string) => string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { createRequestChannel } from '@dynamic-labs/message-transport';
|
|
4
|
+
import { Logger } from '@dynamic-labs/logger';
|
|
5
|
+
import { logger } from '../../../../utils/logger/logger.js';
|
|
6
|
+
import { createPartialManifest } from './createPartialManifest/createPartialManifest.js';
|
|
7
|
+
import { validateManifest } from './validateManifest/validateManifest.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Manifest module handles the client manifest that will be requested by the webview
|
|
11
|
+
*/
|
|
12
|
+
const createManifestModule = (props, messageTransport, initializationModule) => {
|
|
13
|
+
const requestChannel = createRequestChannel(messageTransport);
|
|
14
|
+
const manifest = createPartialManifest(props);
|
|
15
|
+
requestChannel.handle('manifest', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
return validateManifest(manifest);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
logger.error(error);
|
|
21
|
+
if (error instanceof Error)
|
|
22
|
+
initializationModule.error = error;
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
return {
|
|
27
|
+
setAppOrigin: (appOrigin) => (manifest.appOrigin = appOrigin),
|
|
28
|
+
setPlatform: (platform) => {
|
|
29
|
+
Logger.globalMetaData.set('platform', platform);
|
|
30
|
+
manifest.platform = platform;
|
|
31
|
+
},
|
|
32
|
+
setRedirectUrl: (redirectUrl) => (manifest.redirectUrl = redirectUrl),
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { createManifestModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validateManifest';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Maps each required field of the client manifest to an error message that explains
|
|
8
|
+
* what the customer can do if his app runs into the issue where this field is missing from his manifest.
|
|
9
|
+
*/
|
|
10
|
+
const mandatoryFields = {
|
|
11
|
+
clientVersion: "We were unable to retrieve the Dynamic Client's version from your app. Please contact us about this.",
|
|
12
|
+
environmentId: 'You must provide an environment id to the Dynamic Client.',
|
|
13
|
+
platform: 'Missing platform specific extension, like WebExtension or ReactNativeExtension. See how to setup Dynamic Client in our docs for help.',
|
|
14
|
+
redirectUrl: 'Missing platform specific extension, like WebExtension or ReactNativeExtension. See how to setup Dynamic Client in our docs for help.',
|
|
15
|
+
};
|
|
16
|
+
const validateManifest = (partialManifest) => {
|
|
17
|
+
/**
|
|
18
|
+
* If any of these fields are missing, we show the user an error message.
|
|
19
|
+
* You should map to each required field a description of what the user can do to fix this issue.
|
|
20
|
+
*
|
|
21
|
+
* And if you add a new required field to DynamicClient, TS will automatically force you to
|
|
22
|
+
* also include a description here :)
|
|
23
|
+
*/
|
|
24
|
+
for (const [field, description] of Object.entries(mandatoryFields))
|
|
25
|
+
if (partialManifest[field] === undefined)
|
|
26
|
+
throw new Error(`Missing client manifest field "${field}": ${description}`);
|
|
27
|
+
return partialManifest;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.mandatoryFields = mandatoryFields;
|
|
31
|
+
exports.validateManifest = validateManifest;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClientManifest } from '@dynamic-labs/webview-messages';
|
|
2
|
+
/**
|
|
3
|
+
* Union of fields from ClientManifest which must be defined
|
|
4
|
+
*/
|
|
5
|
+
type MandatoryClientManifestField = {
|
|
6
|
+
[K in keyof ClientManifest]-?: NonNullable<unknown> extends Pick<ClientManifest, K> ? never : K;
|
|
7
|
+
}[keyof ClientManifest];
|
|
8
|
+
/**
|
|
9
|
+
* Maps each required field of the client manifest to an error message that explains
|
|
10
|
+
* what the customer can do if his app runs into the issue where this field is missing from his manifest.
|
|
11
|
+
*/
|
|
12
|
+
export declare const mandatoryFields: Record<MandatoryClientManifestField, string>;
|
|
13
|
+
export declare const validateManifest: (partialManifest: Partial<ClientManifest>) => ClientManifest;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Maps each required field of the client manifest to an error message that explains
|
|
4
|
+
* what the customer can do if his app runs into the issue where this field is missing from his manifest.
|
|
5
|
+
*/
|
|
6
|
+
const mandatoryFields = {
|
|
7
|
+
clientVersion: "We were unable to retrieve the Dynamic Client's version from your app. Please contact us about this.",
|
|
8
|
+
environmentId: 'You must provide an environment id to the Dynamic Client.',
|
|
9
|
+
platform: 'Missing platform specific extension, like WebExtension or ReactNativeExtension. See how to setup Dynamic Client in our docs for help.',
|
|
10
|
+
redirectUrl: 'Missing platform specific extension, like WebExtension or ReactNativeExtension. See how to setup Dynamic Client in our docs for help.',
|
|
11
|
+
};
|
|
12
|
+
const validateManifest = (partialManifest) => {
|
|
13
|
+
/**
|
|
14
|
+
* If any of these fields are missing, we show the user an error message.
|
|
15
|
+
* You should map to each required field a description of what the user can do to fix this issue.
|
|
16
|
+
*
|
|
17
|
+
* And if you add a new required field to DynamicClient, TS will automatically force you to
|
|
18
|
+
* also include a description here :)
|
|
19
|
+
*/
|
|
20
|
+
for (const [field, description] of Object.entries(mandatoryFields))
|
|
21
|
+
if (partialManifest[field] === undefined)
|
|
22
|
+
throw new Error(`Missing client manifest field "${field}": ${description}`);
|
|
23
|
+
return partialManifest;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { mandatoryFields, validateManifest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createWebViewLoadControllerRegistry, type RegisteredWebViewLoadController, type WebViewLoadControllerRegistry, } from './webViewLoadControllerRegistry';
|
package/src/client/core/modules/webViewLoadControllerRegistry/webViewLoadControllerRegistry.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const createWebViewLoadControllerRegistry = () => {
|
|
7
|
+
let registeredController = null;
|
|
8
|
+
const registrationCallbacks = new Set();
|
|
9
|
+
return {
|
|
10
|
+
getController: () => registeredController,
|
|
11
|
+
onRegistered: (callback) => {
|
|
12
|
+
registrationCallbacks.add(callback);
|
|
13
|
+
return () => {
|
|
14
|
+
registrationCallbacks.delete(callback);
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
register: (controller) => {
|
|
18
|
+
registeredController = controller;
|
|
19
|
+
registrationCallbacks.forEach((callback) => callback(controller));
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.createWebViewLoadControllerRegistry = createWebViewLoadControllerRegistry;
|
package/src/client/core/modules/webViewLoadControllerRegistry/webViewLoadControllerRegistry.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SdkWebViewLoadState } from '../../../../webviewLoad/sdkWebViewLoadState';
|
|
2
|
+
/**
|
|
3
|
+
* The surface of a webview load controller that client modules consume.
|
|
4
|
+
* Structurally satisfied by `createWebViewLoadController`'s return value —
|
|
5
|
+
* kept minimal so the core registry doesn't depend on the controller
|
|
6
|
+
* implementation.
|
|
7
|
+
*/
|
|
8
|
+
export type RegisteredWebViewLoadController = {
|
|
9
|
+
getState: () => SdkWebViewLoadState;
|
|
10
|
+
onStateChanged: (callback: (state: SdkWebViewLoadState) => void) => () => void;
|
|
11
|
+
retry: () => Promise<SdkWebViewLoadState>;
|
|
12
|
+
};
|
|
13
|
+
export type WebViewLoadControllerRegistry = {
|
|
14
|
+
/** The currently registered controller, or `null` when none exists yet. */
|
|
15
|
+
getController: () => RegisteredWebViewLoadController | null;
|
|
16
|
+
/**
|
|
17
|
+
* Subscribe to controller registrations. Returns an unsubscribe. Needed
|
|
18
|
+
* because modules (e.g. `sdkModule`) are created with the client, while
|
|
19
|
+
* the controller is registered later by the platform extension.
|
|
20
|
+
*/
|
|
21
|
+
onRegistered: (callback: (controller: RegisteredWebViewLoadController) => void) => () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Register the webview load controller. Registering again replaces the
|
|
24
|
+
* previous controller (e.g. when the platform extension re-initializes
|
|
25
|
+
* its webview) and notifies `onRegistered` subscribers again.
|
|
26
|
+
*/
|
|
27
|
+
register: (controller: RegisteredWebViewLoadController) => void;
|
|
28
|
+
};
|
|
29
|
+
export declare const createWebViewLoadControllerRegistry: () => WebViewLoadControllerRegistry;
|
package/src/client/core/modules/webViewLoadControllerRegistry/webViewLoadControllerRegistry.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const createWebViewLoadControllerRegistry = () => {
|
|
3
|
+
let registeredController = null;
|
|
4
|
+
const registrationCallbacks = new Set();
|
|
5
|
+
return {
|
|
6
|
+
getController: () => registeredController,
|
|
7
|
+
onRegistered: (callback) => {
|
|
8
|
+
registrationCallbacks.add(callback);
|
|
9
|
+
return () => {
|
|
10
|
+
registrationCallbacks.delete(callback);
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
register: (controller) => {
|
|
14
|
+
registeredController = controller;
|
|
15
|
+
registrationCallbacks.forEach((callback) => callback(controller));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { createWebViewLoadControllerRegistry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client';
|
package/src/index.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var assertPackageVersion = require('@dynamic-labs/assert-package-version');
|
|
7
|
+
var _package = require('../package.cjs');
|
|
8
|
+
var Extendable = require('./utils/Extendable/Extendable.cjs');
|
|
9
|
+
var hasExtension = require('./utils/Extendable/hasExtension/hasExtension.cjs');
|
|
10
|
+
var client = require('./client/client.cjs');
|
|
11
|
+
var WebViewFailedToLoadError = require('./webviewLoad/WebViewFailedToLoadError/WebViewFailedToLoadError.cjs');
|
|
12
|
+
var constants = require('./webviewLoad/classifyWebViewLoadError/constants.cjs');
|
|
13
|
+
var createWebViewLoadController = require('./webviewLoad/createWebViewLoadController/createWebViewLoadController.cjs');
|
|
14
|
+
require('./utils/logger/logger.cjs');
|
|
15
|
+
require('../_virtual/_tslib.cjs');
|
|
16
|
+
require('@dynamic-labs/webview-messages');
|
|
17
|
+
|
|
18
|
+
assertPackageVersion.assertPackageVersion('@dynamic-labs/legacy-client', _package.version);
|
|
19
|
+
|
|
20
|
+
exports.Extendable = Extendable.Extendable;
|
|
21
|
+
exports.hasExtension = hasExtension.hasExtension;
|
|
22
|
+
exports.baseClientExtensionName = client.baseClientExtensionName;
|
|
23
|
+
exports.createClient = client.createClient;
|
|
24
|
+
exports.WebViewFailedToLoadError = WebViewFailedToLoadError.WebViewFailedToLoadError;
|
|
25
|
+
exports.EMBEDDED_WEBVIEW_HTTP_ERROR_DOMAIN = constants.EMBEDDED_WEBVIEW_HTTP_ERROR_DOMAIN;
|
|
26
|
+
exports.createWebViewLoadController = createWebViewLoadController.createWebViewLoadController;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { RegisteredDevice, SocialProvider, UpdateUserReturnPayload, } from '@dynamic-labs/webview-messages';
|
|
2
|
+
export { type Core } from './client/core';
|
|
3
|
+
export type { Wallet } from './types';
|
|
4
|
+
export { Extendable, type Extension } from './utils/Extendable';
|
|
5
|
+
export { hasExtension } from './utils/Extendable/hasExtension';
|
|
6
|
+
export { createClient, type BaseClient, type ClientProps, baseClientExtensionName, } from './client';
|
|
7
|
+
export { EMBEDDED_WEBVIEW_HTTP_ERROR_DOMAIN, WebViewFailedToLoadError, createWebViewLoadController, type CreateWebViewLoadControllerArgs, type SdkWebViewLoadState, type SdkWebViewLoadStatus, type WebViewFailedToLoadErrorMeta, type WebViewFailedToLoadErrorPhase, type WebViewLoadAdapter, type WebViewLoadAttemptFailure, type WebViewLoadController, type WebViewLoadEvent, type WebViewLoadOptions, type WebViewLoadWebviewType, } from './webviewLoad';
|
|
8
|
+
export type { AuthModule, WaitForAuthSuccessOptions, } from './modules/authModule';
|
|
9
|
+
export type { DeviceRegistrationModule } from './modules/deviceRegistrationModule';
|
|
10
|
+
export type { LocaleModule } from './modules/localeModule';
|
|
11
|
+
export type { MfaModule } from './modules/mfaModule';
|
|
12
|
+
export type { SdkModule } from './modules/sdkModule';
|
|
13
|
+
export type { WalletsModule } from './modules/walletsModule';
|
|
14
|
+
export type { LocaleResource } from '@dynamic-labs/locale';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
|
|
3
|
+
import { version } from '../package.js';
|
|
4
|
+
export { Extendable } from './utils/Extendable/Extendable.js';
|
|
5
|
+
export { hasExtension } from './utils/Extendable/hasExtension/hasExtension.js';
|
|
6
|
+
export { baseClientExtensionName, createClient } from './client/client.js';
|
|
7
|
+
export { WebViewFailedToLoadError } from './webviewLoad/WebViewFailedToLoadError/WebViewFailedToLoadError.js';
|
|
8
|
+
export { EMBEDDED_WEBVIEW_HTTP_ERROR_DOMAIN } from './webviewLoad/classifyWebViewLoadError/constants.js';
|
|
9
|
+
export { createWebViewLoadController } from './webviewLoad/createWebViewLoadController/createWebViewLoadController.js';
|
|
10
|
+
import './utils/logger/logger.js';
|
|
11
|
+
import '../_virtual/_tslib.js';
|
|
12
|
+
import '@dynamic-labs/webview-messages';
|
|
13
|
+
|
|
14
|
+
assertPackageVersion('@dynamic-labs/legacy-client', version);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
7
|
+
var webviewMessages = require('@dynamic-labs/webview-messages');
|
|
8
|
+
var createWaitForAuthSuccess = require('../../utils/createWaitForAuthSuccess/createWaitForAuthSuccess.cjs');
|
|
9
|
+
var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
|
|
10
|
+
var emailAuthModule = require('./emailAuthModule/emailAuthModule.cjs');
|
|
11
|
+
var externalAuthModule = require('./externalAuthModule/externalAuthModule.cjs');
|
|
12
|
+
var passkeyAuthModule = require('./passkeyAuthModule/passkeyAuthModule.cjs');
|
|
13
|
+
var smsAuthModule = require('./smsAuthModule/smsAuthModule.cjs');
|
|
14
|
+
var socialAuthModule = require('./socialAuthModule/socialAuthModule.cjs');
|
|
15
|
+
|
|
16
|
+
const defaultAuthenticatedUserHandler = () => Promise.resolve();
|
|
17
|
+
const createAuthModule = (core) => {
|
|
18
|
+
const store = messageTransport.createStore({
|
|
19
|
+
initialState: {
|
|
20
|
+
authenticatedUser: null,
|
|
21
|
+
minifiedToken: null,
|
|
22
|
+
token: null,
|
|
23
|
+
},
|
|
24
|
+
key: 'auth',
|
|
25
|
+
messageTransport: core.messageTransport,
|
|
26
|
+
});
|
|
27
|
+
const messageEvents = messageTransport.createEventEmitterForMessages({
|
|
28
|
+
eventNames: webviewMessages.authEventNames,
|
|
29
|
+
initialEventEmitter: store.eventEmitter,
|
|
30
|
+
messageTransport: core.messageTransport,
|
|
31
|
+
});
|
|
32
|
+
const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
33
|
+
const handlers = {
|
|
34
|
+
userAuthenticated: defaultAuthenticatedUserHandler,
|
|
35
|
+
};
|
|
36
|
+
requestChannel.handle('handleAuthenticatedUser', ({ user }) => handlers.userAuthenticated(user));
|
|
37
|
+
const listenerActions = pickListenerActions.pickListenerActions(messageEvents);
|
|
38
|
+
const waitForAuthSuccess = createWaitForAuthSuccess.createWaitForAuthSuccess({
|
|
39
|
+
getAuthenticatedUser: () => store.getters.authenticatedUser,
|
|
40
|
+
listenerActions,
|
|
41
|
+
});
|
|
42
|
+
return Object.assign(store.getters, listenerActions, {
|
|
43
|
+
clearHandler: () => (handlers.userAuthenticated = defaultAuthenticatedUserHandler),
|
|
44
|
+
email: emailAuthModule.createEmailAuthModule(core),
|
|
45
|
+
external: externalAuthModule.createExternalAuthModule(core),
|
|
46
|
+
getProjectSettings: () => requestChannel.request('getProjectSettings'),
|
|
47
|
+
logout: () => requestChannel.request('logout'),
|
|
48
|
+
passkey: passkeyAuthModule.createPasskeyAuthModule(core),
|
|
49
|
+
permanentlyDeleteCurrentUser: () => requestChannel.request('permanentlyDeleteCurrentUser'),
|
|
50
|
+
refreshUser: () => requestChannel.request('refreshUser'),
|
|
51
|
+
setHandler: (_, handler) => (handlers.userAuthenticated = handler),
|
|
52
|
+
sms: smsAuthModule.createSmsAuthModule(core),
|
|
53
|
+
social: socialAuthModule.createSocialAuthModule(core),
|
|
54
|
+
updateUser: (userFields) => requestChannel.request('updateUser', userFields),
|
|
55
|
+
verifyUserUpdateOtp: (verificationToken) => requestChannel.request('verifyUserUpdateOtp', verificationToken),
|
|
56
|
+
waitForAuthSuccess,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.createAuthModule = createAuthModule;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PickedEventListeners, StoreEventListeners } from '@dynamic-labs/message-transport';
|
|
2
|
+
import { AuthModuleMessages, AuthModuleState, authEventNames } from '@dynamic-labs/webview-messages';
|
|
3
|
+
import type { UserProfile } from '@dynamic-labs/types';
|
|
4
|
+
import { Core } from '../../client/core';
|
|
5
|
+
import { WaitForAuthSuccessOptions } from '../../utils/createWaitForAuthSuccess';
|
|
6
|
+
import { EmailAuthModule } from './emailAuthModule';
|
|
7
|
+
import { ExternalAuthModule } from './externalAuthModule';
|
|
8
|
+
import { PasskeyAuthModule } from './passkeyAuthModule';
|
|
9
|
+
import { SmsAuthModule } from './smsAuthModule';
|
|
10
|
+
import { SocialAuthModule } from './socialAuthModule';
|
|
11
|
+
type PublicAuthModuleMessages = Pick<AuthModuleMessages, typeof authEventNames[number]>;
|
|
12
|
+
export type { WaitForAuthSuccessOptions };
|
|
13
|
+
export type AuthModule = AuthModuleState & StoreEventListeners<AuthModuleState> & PickedEventListeners<PublicAuthModuleMessages> & {
|
|
14
|
+
passkey: PasskeyAuthModule;
|
|
15
|
+
sms: SmsAuthModule;
|
|
16
|
+
email: EmailAuthModule;
|
|
17
|
+
social: SocialAuthModule;
|
|
18
|
+
external: ExternalAuthModule;
|
|
19
|
+
getProjectSettings: AuthModuleMessages['getProjectSettings'];
|
|
20
|
+
logout: AuthModuleMessages['logout'];
|
|
21
|
+
refreshUser: AuthModuleMessages['refreshUser'];
|
|
22
|
+
updateUser: AuthModuleMessages['updateUser'];
|
|
23
|
+
verifyUserUpdateOtp: AuthModuleMessages['verifyUserUpdateOtp'];
|
|
24
|
+
permanentlyDeleteCurrentUser: AuthModuleMessages['permanentlyDeleteCurrentUser'];
|
|
25
|
+
setHandler: (name: 'userAuthenticated', handler: AuthenticatedUserHandler) => void;
|
|
26
|
+
clearHandler: (name: 'userAuthenticated') => void;
|
|
27
|
+
waitForAuthSuccess: (options?: WaitForAuthSuccessOptions) => Promise<UserProfile>;
|
|
28
|
+
};
|
|
29
|
+
type AuthenticatedUserHandler = (user: UserProfile) => Promise<void>;
|
|
30
|
+
export declare const createAuthModule: (core: Core) => AuthModule;
|