@dynamic-labs-sdk/client 0.27.0 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InvalidParamError-D_EzyxXy.native.esm.js → InvalidParamError-B8XO1W5c.native.esm.js} +2 -2
- package/dist/{InvalidParamError-D_EzyxXy.native.esm.js.map → InvalidParamError-B8XO1W5c.native.esm.js.map} +1 -1
- package/dist/{InvalidParamError-BHNFIR4K.cjs → InvalidParamError-Co6j4qll.cjs} +3 -3
- package/dist/{InvalidParamError-BHNFIR4K.cjs.map → InvalidParamError-Co6j4qll.cjs.map} +1 -1
- package/dist/{InvalidParamError-DJxqCxOB.esm.js → InvalidParamError-Di6crZca.esm.js} +2 -2
- package/dist/{InvalidParamError-DJxqCxOB.esm.js.map → InvalidParamError-Di6crZca.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-CIUs1vxk.cjs → NotWaasWalletAccountError-BvN42V8M.cjs} +3 -3
- package/dist/{NotWaasWalletAccountError-CIUs1vxk.cjs.map → NotWaasWalletAccountError-BvN42V8M.cjs.map} +1 -1
- package/dist/{NotWaasWalletAccountError-BSon-4Ob.native.esm.js → NotWaasWalletAccountError-CUQFqBLS.native.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-BSon-4Ob.native.esm.js.map → NotWaasWalletAccountError-CUQFqBLS.native.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-DyqqJavQ.esm.js → NotWaasWalletAccountError-yLvN4JGj.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-DyqqJavQ.esm.js.map → NotWaasWalletAccountError-yLvN4JGj.esm.js.map} +1 -1
- package/dist/client/core/createCore/createCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCore.d.ts +8 -0
- package/dist/client/core/types/DynamicCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCoreConfig.d.ts +1 -1
- package/dist/client/core/types/DynamicCoreConfig.d.ts.map +1 -1
- package/dist/core.cjs +19 -21
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +19 -22
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +19 -8
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/InvalidSocialCallbackOriginError.d.ts +10 -0
- package/dist/errors/InvalidSocialCallbackOriginError.d.ts.map +1 -0
- package/dist/errors/UserCancelledSocialPopUpError.d.ts +5 -0
- package/dist/errors/UserCancelledSocialPopUpError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +9 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BN3NLh8u.native.esm.js → getNetworkProviderFromNetworkId-B55TeeB6.native.esm.js} +35 -41
- package/dist/getNetworkProviderFromNetworkId-B55TeeB6.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-EbAuEVM-.esm.js → getNetworkProviderFromNetworkId-Cx5BbTRa.esm.js} +35 -27
- package/dist/getNetworkProviderFromNetworkId-Cx5BbTRa.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-B5HGICoA.cjs → getNetworkProviderFromNetworkId-ctY-MguW.cjs} +36 -28
- package/dist/getNetworkProviderFromNetworkId-ctY-MguW.cjs.map +1 -0
- package/dist/{getSignedSessionId-BW4I7fDk.esm.js → getSignedSessionId-C-R1Tsh4.esm.js} +3 -3
- package/dist/{getSignedSessionId-BW4I7fDk.esm.js.map → getSignedSessionId-C-R1Tsh4.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DMMejcaD.cjs → getSignedSessionId-CEh6X6Uk.cjs} +3 -3
- package/dist/{getSignedSessionId-DMMejcaD.cjs.map → getSignedSessionId-CEh6X6Uk.cjs.map} +1 -1
- package/dist/{getSignedSessionId-B_a6CXGP.native.esm.js → getSignedSessionId-CqQEOYvq.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-B_a6CXGP.native.esm.js.map → getSignedSessionId-CqQEOYvq.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-ChZvrEQJ.esm.js → getVerifiedCredentialForWalletAccount-Bb6xxqc5.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-ChZvrEQJ.esm.js.map → getVerifiedCredentialForWalletAccount-Bb6xxqc5.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-DMoMmbjK.native.esm.js → getVerifiedCredentialForWalletAccount-C3_d4Wfb.native.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-DMoMmbjK.native.esm.js.map → getVerifiedCredentialForWalletAccount-C3_d4Wfb.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-C7-3wtlJ.cjs → getVerifiedCredentialForWalletAccount-Cc41eb96.cjs} +3 -3
- package/dist/{getVerifiedCredentialForWalletAccount-C7-3wtlJ.cjs.map → getVerifiedCredentialForWalletAccount-Cc41eb96.cjs.map} +1 -1
- package/dist/index.cjs +304 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +300 -113
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +523 -116
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BUfcq6P2.esm.js → isMfaRequiredForAction-5fIZTsUT.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BUfcq6P2.esm.js.map → isMfaRequiredForAction-5fIZTsUT.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-IhCAdScF.cjs → isMfaRequiredForAction-BgSJwZj8.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-IhCAdScF.cjs.map → isMfaRequiredForAction-BgSJwZj8.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-iVSdynw1.native.esm.js → isMfaRequiredForAction-BvOa3tgh.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-iVSdynw1.native.esm.js.map → isMfaRequiredForAction-BvOa3tgh.native.esm.js.map} +1 -1
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/processSocialCallback/index.d.ts +2 -0
- package/dist/modules/auth/social/oauth/processSocialCallback/index.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts +29 -0
- package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/index.d.ts +2 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/index.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.d.ts +16 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.types.d.ts +5 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.types.d.ts.map +1 -0
- package/dist/modules/checkout/createCheckoutTransaction/createCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/trackCheckoutTransaction/trackCheckoutTransaction.d.ts +6 -1
- package/dist/modules/checkout/trackCheckoutTransaction/trackCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/waas.types.d.ts +3 -3
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/walletBackup/googleDrive/constants.d.ts +19 -0
- package/dist/modules/walletBackup/googleDrive/constants.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/findMissingGoogleDriveBackupScopes/findMissingGoogleDriveBackupScopes.d.ts +11 -0
- package/dist/modules/walletBackup/googleDrive/findMissingGoogleDriveBackupScopes/findMissingGoogleDriveBackupScopes.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/findMissingGoogleDriveBackupScopes/index.d.ts +2 -0
- package/dist/modules/walletBackup/googleDrive/findMissingGoogleDriveBackupScopes/index.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/getGoogleDriveBackupReadiness/getGoogleDriveBackupReadiness.d.ts +35 -0
- package/dist/modules/walletBackup/googleDrive/getGoogleDriveBackupReadiness/getGoogleDriveBackupReadiness.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/getGoogleDriveBackupReadiness/index.d.ts +2 -0
- package/dist/modules/walletBackup/googleDrive/getGoogleDriveBackupReadiness/index.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/googleDrive.types.d.ts +30 -0
- package/dist/modules/walletBackup/googleDrive/googleDrive.types.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/hasAllGoogleDriveBackupScopes/hasAllGoogleDriveBackupScopes.d.ts +10 -0
- package/dist/modules/walletBackup/googleDrive/hasAllGoogleDriveBackupScopes/hasAllGoogleDriveBackupScopes.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/hasAllGoogleDriveBackupScopes/index.d.ts +2 -0
- package/dist/modules/walletBackup/googleDrive/hasAllGoogleDriveBackupScopes/index.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/isInsufficientGoogleDriveScopesError/index.d.ts +2 -0
- package/dist/modules/walletBackup/googleDrive/isInsufficientGoogleDriveScopesError/index.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/isInsufficientGoogleDriveScopesError/isInsufficientGoogleDriveScopesError.d.ts +15 -0
- package/dist/modules/walletBackup/googleDrive/isInsufficientGoogleDriveScopesError/isInsufficientGoogleDriveScopesError.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/utils/fetchGoogleDriveOauthAccess/fetchGoogleDriveOauthAccess.d.ts +21 -0
- package/dist/modules/walletBackup/googleDrive/utils/fetchGoogleDriveOauthAccess/fetchGoogleDriveOauthAccess.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/utils/fetchGoogleDriveOauthAccess/index.d.ts +2 -0
- package/dist/modules/walletBackup/googleDrive/utils/fetchGoogleDriveOauthAccess/index.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/utils/findGoogleOauthAccountId/findGoogleOauthAccountId.d.ts +18 -0
- package/dist/modules/walletBackup/googleDrive/utils/findGoogleOauthAccountId/findGoogleOauthAccountId.d.ts.map +1 -0
- package/dist/modules/walletBackup/googleDrive/utils/findGoogleOauthAccountId/index.d.ts +2 -0
- package/dist/modules/walletBackup/googleDrive/utils/findGoogleOauthAccountId/index.d.ts.map +1 -0
- package/dist/modules/wallets/destroyWalletProviders/destroyWalletProviders.d.ts +15 -0
- package/dist/modules/wallets/destroyWalletProviders/destroyWalletProviders.d.ts.map +1 -0
- package/dist/modules/wallets/destroyWalletProviders/index.d.ts +2 -0
- package/dist/modules/wallets/destroyWalletProviders/index.d.ts.map +1 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +9 -10
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/dist/services/openAuthSession/index.d.ts +2 -0
- package/dist/services/openAuthSession/index.d.ts.map +1 -0
- package/dist/services/openAuthSession/openAuthSession.types.d.ts +26 -0
- package/dist/services/openAuthSession/openAuthSession.types.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/debouncedMutex/createDebouncedMutex/createDebouncedMutex.d.ts.map +1 -1
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +3 -3
- package/dist/waasCore.cjs +17 -7
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +17 -7
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +17 -7
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +39 -3
- package/dist/getNetworkProviderFromNetworkId-B5HGICoA.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-BN3NLh8u.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-EbAuEVM-.esm.js.map +0 -1
- package/dist/modules/wallets/disconnectAndTerminateWalletProviders/disconnectAndTerminateWalletProviders.d.ts +0 -10
- package/dist/modules/wallets/disconnectAndTerminateWalletProviders/disconnectAndTerminateWalletProviders.d.ts.map +0 -1
- package/dist/modules/wallets/disconnectAndTerminateWalletProviders/index.d.ts +0 -2
- package/dist/modules/wallets/disconnectAndTerminateWalletProviders/index.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as extractSessionId, B as name, C as isCookieEnabled, D as instrumentFunction, E as __getElevatedAccessToken_wrapped, F as getDefaultClient, I as setDefaultClient, O as DEFAULT_PII_FIELDS, P as NONCE_POOL_SIZE, R as BaseError, T as ValueMustBeDefinedError, V as version, _ as MfaRateLimitedError, a as DYNAMIC_ICONIC_SPRITE_URL, b as InvalidExternalAuthError, c as CHAINS_INFO_MAP, d as UnauthorizedError, g as SandboxMaximumThresholdReachedError, h as getNonce, j as randomString, k as getUserAgent, l as fetchAndStoreNonces, o as SDK_API_CORE_VERSION, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as createApiClient, v as MfaInvalidOtpError, w as assertDefined, x as APIError, y as LinkCredentialError, z as getCore } from "./InvalidParamError-
|
|
2
|
-
import { A as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, B as createLocalStorageAdapter, C as createCrossTabBroadcast, D as FETCH_PROJECT_SETTINGS_TRACKER_KEY, E as createDeferredPromise, F as generateSessionKeys, H as retryOnFail, I as fetchProjectSettings, L as createStorageKeySchema, M as isServerSideRendering, N as getBuffer, O as GENERATE_SESSION_KEYS_TRACKER_KEY, P as __logoutWithReason_wrapped, R as createStorage, S as createLogger, T as CannotTrackError, U as subscribeWithSelector, V as isSignedIn, W as isEqualShallow, _ as WalletAlreadyLinkedToAnotherUserError, a as updateWalletProviderKeysForVerifiedCredentials, b as createRealtimeService, c as createSignInMessageStatement, d as createVisit, f as hasExtension, g as
|
|
3
|
-
import { A as onceEvent, C as formatWalletAccountId, D as emitEvent, O as offEvent, T as splitWalletProviderKey, a as parseElevatedAccessToken, b as getWalletAccounts, d as isUserMissingMfaAuth, f as checkAndRaiseWalletAccountsChangedEvent, h as getWalletProviderFromWalletAccount, i as upsertElevatedAccessToken, k as onEvent, n as getWalletProviderByKey, o as restoreUserSharesForAllWalletAccounts, p as emitWalletAccountsChangedEvent, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as getWalletProviders, w as normalizeAddress, y as NoWalletProviderFoundError } from "./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
import { n as __refreshAuth_wrapped, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-
|
|
5
|
-
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
1
|
+
import { A as extractSessionId, B as name, C as isCookieEnabled, D as instrumentFunction, E as __getElevatedAccessToken_wrapped, F as getDefaultClient, I as setDefaultClient, O as DEFAULT_PII_FIELDS, P as NONCE_POOL_SIZE, R as BaseError, T as ValueMustBeDefinedError, V as version, _ as MfaRateLimitedError, a as DYNAMIC_ICONIC_SPRITE_URL, b as InvalidExternalAuthError, c as CHAINS_INFO_MAP, d as UnauthorizedError, g as SandboxMaximumThresholdReachedError, h as getNonce, j as randomString, k as getUserAgent, l as fetchAndStoreNonces, o as SDK_API_CORE_VERSION, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as createApiClient, v as MfaInvalidOtpError, w as assertDefined, x as APIError, y as LinkCredentialError, z as getCore } from "./InvalidParamError-Di6crZca.esm.js";
|
|
2
|
+
import { A as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, B as createLocalStorageAdapter, C as createCrossTabBroadcast, D as FETCH_PROJECT_SETTINGS_TRACKER_KEY, E as createDeferredPromise, F as generateSessionKeys, H as retryOnFail, I as fetchProjectSettings, L as createStorageKeySchema, M as isServerSideRendering, N as getBuffer, O as GENERATE_SESSION_KEYS_TRACKER_KEY, P as __logoutWithReason_wrapped, R as createStorage, S as createLogger, T as CannotTrackError, U as subscribeWithSelector, V as isSignedIn, W as isEqualShallow, _ as WalletAlreadyLinkedToAnotherUserError, a as updateWalletProviderKeysForVerifiedCredentials, b as createRealtimeService, c as createSignInMessageStatement, d as createVisit, f as hasExtension, g as MethodNotImplementedError, h as isCaptchaRequired, i as getNetworksData, j as REFRESH_USER_STATE_FROM_VALID_TOKEN_TRACKER_KEY, k as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, l as formatSignInMessage, m as consumeCaptchaToken, o as verifyMessageSignatureOwnership, p as __setCaptchaToken_wrapped, s as removeUnverifiedWalletAccount, t as getNetworkProviderFromNetworkId, u as setUnverifiedWalletAccounts, v as NoNetworkProvidersError, x as createKeychainService, y as getKeychainIndexedDBName } from "./getNetworkProviderFromNetworkId-Cx5BbTRa.esm.js";
|
|
3
|
+
import { A as onceEvent, C as formatWalletAccountId, D as emitEvent, O as offEvent, T as splitWalletProviderKey, a as parseElevatedAccessToken, b as getWalletAccounts, d as isUserMissingMfaAuth, f as checkAndRaiseWalletAccountsChangedEvent, h as getWalletProviderFromWalletAccount, i as upsertElevatedAccessToken, k as onEvent, n as getWalletProviderByKey, o as restoreUserSharesForAllWalletAccounts, p as emitWalletAccountsChangedEvent, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as getWalletProviders, w as normalizeAddress, y as NoWalletProviderFoundError } from "./getVerifiedCredentialForWalletAccount-Bb6xxqc5.esm.js";
|
|
4
|
+
import { n as __refreshAuth_wrapped, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-yLvN4JGj.esm.js";
|
|
5
|
+
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-5fIZTsUT.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { AuthModeEnum, ExchangeKeyEnum, JwtVerifiedCredentialFormatEnum, MFAAction, MfaBackupCodeAcknowledgement, ProviderEnum, TokenScope, WaasBackupOptionsEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
import * as z from "zod/mini";
|
|
9
|
-
import EventEmitter
|
|
9
|
+
import EventEmitter, { EventEmitter as EventEmitter$1 } from "eventemitter3";
|
|
10
10
|
import { browserSupportsWebAuthn, startAuthentication, startRegistration } from "@simplewebauthn/browser";
|
|
11
11
|
|
|
12
12
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -535,7 +535,7 @@ const createAsyncTrack = () => {
|
|
|
535
535
|
* This ensures no process is missed (as it would throw when tracked on a different node tick).
|
|
536
536
|
*/
|
|
537
537
|
let isTrackEnabled = true;
|
|
538
|
-
const eventEmitter = new EventEmitter();
|
|
538
|
+
const eventEmitter = new EventEmitter$1();
|
|
539
539
|
const allSettledPromise = createDeferredPromise();
|
|
540
540
|
const tracker = /* @__PURE__ */ new Map();
|
|
541
541
|
/**
|
|
@@ -582,7 +582,7 @@ const createAsyncTrack = () => {
|
|
|
582
582
|
//#endregion
|
|
583
583
|
//#region src/services/eventEmitter/createEventEmitter.ts
|
|
584
584
|
/** @not-instrumented */
|
|
585
|
-
const createEventEmitter = () => new EventEmitter
|
|
585
|
+
const createEventEmitter = () => new EventEmitter();
|
|
586
586
|
|
|
587
587
|
//#endregion
|
|
588
588
|
//#region src/errors/UnavailableInServerSideError.ts
|
|
@@ -947,6 +947,7 @@ const createCore = (config) => {
|
|
|
947
947
|
});
|
|
948
948
|
const fetch = config.coreConfig?.fetch ?? createWebFetch();
|
|
949
949
|
const openDeeplink = config.coreConfig?.openDeeplink ?? createWebDeeplinkOpener();
|
|
950
|
+
const openAuthSession = config.coreConfig?.openAuthSession;
|
|
950
951
|
const navigate = config.coreConfig?.navigate ?? createNavigationHandler();
|
|
951
952
|
const state = createObservableState(getInitialState);
|
|
952
953
|
const debouncedMutex = createDebouncedMutex();
|
|
@@ -993,6 +994,7 @@ const createCore = (config) => {
|
|
|
993
994
|
logger,
|
|
994
995
|
metadata,
|
|
995
996
|
navigate,
|
|
997
|
+
openAuthSession,
|
|
996
998
|
openDeeplink,
|
|
997
999
|
passkey,
|
|
998
1000
|
realtime,
|
|
@@ -1149,6 +1151,34 @@ var InvalidRedirectStorageStateError = class extends BaseError {
|
|
|
1149
1151
|
}
|
|
1150
1152
|
};
|
|
1151
1153
|
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region src/errors/InvalidSocialCallbackOriginError.ts
|
|
1156
|
+
var InvalidSocialCallbackOriginError = class extends BaseError {
|
|
1157
|
+
constructor({ actualOrigin, expectedOrigin }) {
|
|
1158
|
+
super({
|
|
1159
|
+
cause: null,
|
|
1160
|
+
code: "invalid_social_callback_origin_error",
|
|
1161
|
+
docsUrl: null,
|
|
1162
|
+
name: "InvalidSocialCallbackOriginError",
|
|
1163
|
+
shortMessage: `OAuth callback URL origin mismatch. Expected ${expectedOrigin}, got ${actualOrigin}. This may indicate a compromised auth session or misconfigured redirect URL.`
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region src/errors/UserCancelledSocialPopUpError.ts
|
|
1170
|
+
var UserCancelledSocialPopUpError = class extends BaseError {
|
|
1171
|
+
constructor() {
|
|
1172
|
+
super({
|
|
1173
|
+
cause: null,
|
|
1174
|
+
code: "user_cancelled_social_popup_error",
|
|
1175
|
+
docsUrl: null,
|
|
1176
|
+
name: "UserCancelledSocialPopUpError",
|
|
1177
|
+
shortMessage: "The user cancelled (or dismissed) the social authentication pop-up."
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1152
1182
|
//#endregion
|
|
1153
1183
|
//#region src/errors/MissingRedirectStorageStateError.ts
|
|
1154
1184
|
var MissingRedirectStorageStateError = class extends BaseError {
|
|
@@ -1982,6 +2012,35 @@ const __signInWithSocialRedirect_wrapped = instrumentFunction({
|
|
|
1982
2012
|
}
|
|
1983
2013
|
});
|
|
1984
2014
|
|
|
2015
|
+
//#endregion
|
|
2016
|
+
//#region src/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.ts
|
|
2017
|
+
/**
|
|
2018
|
+
* Sign in with a social provider via an in-app popup (ASWebAuthenticationSession
|
|
2019
|
+
* on iOS, Chrome Custom Tabs on Android).
|
|
2020
|
+
*
|
|
2021
|
+
* This method is **only available on React Native**. On web, use
|
|
2022
|
+
* {@link signInWithSocialRedirect} + {@link completeSocialRedirect} instead —
|
|
2023
|
+
* the browser already owns the tab so there is no popup to open.
|
|
2024
|
+
*
|
|
2025
|
+
* @throws MethodNotImplementedError Always on web.
|
|
2026
|
+
* @instrumented
|
|
2027
|
+
*/
|
|
2028
|
+
const signInWithSocialPopUp = async ({ provider }, client = getDefaultClient()) => {
|
|
2029
|
+
throw new MethodNotImplementedError("signInWithSocialPopUp (only available on React Native — use signInWithSocialRedirect on web)");
|
|
2030
|
+
};
|
|
2031
|
+
const __signInWithSocialPopUp_impl = signInWithSocialPopUp;
|
|
2032
|
+
const __signInWithSocialPopUp_wrapped = instrumentFunction({
|
|
2033
|
+
fn: __signInWithSocialPopUp_impl,
|
|
2034
|
+
functionName: "signInWithSocialPopUp",
|
|
2035
|
+
getCore: () => {
|
|
2036
|
+
try {
|
|
2037
|
+
return getCore(getDefaultClient());
|
|
2038
|
+
} catch {
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
});
|
|
2043
|
+
|
|
1985
2044
|
//#endregion
|
|
1986
2045
|
//#region src/modules/auth/social/oauth/detectSocialRedirectUrl/detectSocialRedirectUrl.ts
|
|
1987
2046
|
/**
|
|
@@ -2006,23 +2065,27 @@ const detectSocialRedirectUrl = async ({ url }, client = getDefaultClient()) =>
|
|
|
2006
2065
|
};
|
|
2007
2066
|
|
|
2008
2067
|
//#endregion
|
|
2009
|
-
//#region src/modules/auth/social/oauth/
|
|
2068
|
+
//#region src/modules/auth/social/oauth/processSocialCallback/processSocialCallback.ts
|
|
2010
2069
|
/**
|
|
2011
|
-
*
|
|
2070
|
+
* Platform-agnostic OAuth callback processor used by both the web redirect
|
|
2071
|
+
* flow (`completeSocialRedirect`) and the native pop-up flow
|
|
2072
|
+
* (`signInWithSocialPopUp`). Intentionally has no `.native.ts` variant — the
|
|
2073
|
+
* logic (parse URL, validate state, call oauthSignIn/oauthVerify, update auth)
|
|
2074
|
+
* works identically on every platform.
|
|
2012
2075
|
*
|
|
2013
|
-
*
|
|
2014
|
-
*
|
|
2015
|
-
* final step after `signInWithSocialRedirect` + `detectSocialRedirectUrl`.
|
|
2076
|
+
* Not exported from the public SDK surface; public callers go through
|
|
2077
|
+
* `completeSocialRedirect` or `signInWithSocialPopUp` instead.
|
|
2016
2078
|
*
|
|
2017
2079
|
* @param params.url - The callback URL containing OAuth response parameters.
|
|
2018
2080
|
* @param [params.requestedScopes] - Optional scopes to request an elevated access token when verifying (linking) a social account.
|
|
2019
|
-
* @param
|
|
2020
|
-
* @returns
|
|
2081
|
+
* @param client - The Dynamic client instance.
|
|
2082
|
+
* @returns The authenticated user, or null if the verify response had none.
|
|
2021
2083
|
* @throws MissingSocialUrlParamError If required OAuth parameters are missing.
|
|
2022
|
-
* @throws
|
|
2084
|
+
* @throws MissingRedirectStorageStateError If no stored redirect state exists.
|
|
2085
|
+
* @throws InvalidRedirectStorageStateError If the stored state doesn't match the URL state.
|
|
2023
2086
|
* @instrumented
|
|
2024
2087
|
*/
|
|
2025
|
-
const
|
|
2088
|
+
const processSocialCallback = async ({ url, requestedScopes }, client) => {
|
|
2026
2089
|
const core = getCore(client);
|
|
2027
2090
|
const apiClient = createApiClient({}, client);
|
|
2028
2091
|
await core.initTrack.waitForAll();
|
|
@@ -2059,6 +2122,40 @@ const completeSocialRedirect = async ({ url, requestedScopes }, client = getDefa
|
|
|
2059
2122
|
updateAuthFromVerifyResponse({ response }, client);
|
|
2060
2123
|
return response.user;
|
|
2061
2124
|
};
|
|
2125
|
+
const __processSocialCallback_impl = processSocialCallback;
|
|
2126
|
+
const __processSocialCallback_wrapped = instrumentFunction({
|
|
2127
|
+
fn: __processSocialCallback_impl,
|
|
2128
|
+
functionName: "processSocialCallback",
|
|
2129
|
+
getCore: () => {
|
|
2130
|
+
try {
|
|
2131
|
+
return getCore(getDefaultClient());
|
|
2132
|
+
} catch {
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
|
|
2138
|
+
//#endregion
|
|
2139
|
+
//#region src/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.ts
|
|
2140
|
+
/**
|
|
2141
|
+
* Completes the social authentication flow after the OAuth redirect.
|
|
2142
|
+
*
|
|
2143
|
+
* Processes the OAuth callback URL with the authorization code and finishes
|
|
2144
|
+
* authenticating (or linking) the user with the social provider. This is the
|
|
2145
|
+
* final step after `signInWithSocialRedirect` + `detectSocialRedirectUrl`.
|
|
2146
|
+
*
|
|
2147
|
+
* @param params.url - The callback URL containing OAuth response parameters.
|
|
2148
|
+
* @param [params.requestedScopes] - Optional scopes to request an elevated access token when verifying (linking) a social account.
|
|
2149
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2150
|
+
* @returns A promise that resolves to the authenticated user or null.
|
|
2151
|
+
* @throws MissingSocialUrlParamError If required OAuth parameters are missing.
|
|
2152
|
+
* @throws InvalidRedirectStorageStateError If the stored state doesn't match.
|
|
2153
|
+
* @instrumented
|
|
2154
|
+
*/
|
|
2155
|
+
const completeSocialRedirect = ({ url, requestedScopes }, client = getDefaultClient()) => __processSocialCallback_wrapped({
|
|
2156
|
+
requestedScopes,
|
|
2157
|
+
url
|
|
2158
|
+
}, client);
|
|
2062
2159
|
const __completeSocialRedirect_impl = completeSocialRedirect;
|
|
2063
2160
|
const __completeSocialRedirect_wrapped = instrumentFunction({
|
|
2064
2161
|
fn: __completeSocialRedirect_impl,
|
|
@@ -2379,97 +2476,6 @@ const getCheckouts = async (client) => {
|
|
|
2379
2476
|
return projectSettings.checkouts ?? [];
|
|
2380
2477
|
};
|
|
2381
2478
|
|
|
2382
|
-
//#endregion
|
|
2383
|
-
//#region src/modules/checkout/utils/createCheckoutTransactionChannelSchema/createCheckoutTransactionChannelSchema.ts
|
|
2384
|
-
/**
|
|
2385
|
-
* Zod schema for realtime events published to a checkout transaction's channel.
|
|
2386
|
-
* Uses z.string() for axis and state fields to remain valid when new states are
|
|
2387
|
-
* added to the backend without requiring a SDK update.
|
|
2388
|
-
*/
|
|
2389
|
-
const checkoutTransactionEventSchema = z.object({
|
|
2390
|
-
axis: z.string(),
|
|
2391
|
-
newState: z.string(),
|
|
2392
|
-
previousState: z.string(),
|
|
2393
|
-
timestamp: z.string(),
|
|
2394
|
-
transactionId: z.string()
|
|
2395
|
-
});
|
|
2396
|
-
/**
|
|
2397
|
-
* Creates a typed realtime channel schema for a given checkout transaction.
|
|
2398
|
-
* Channel name follows the backend convention: `transaction:{transactionId}`.
|
|
2399
|
-
* @not-instrumented
|
|
2400
|
-
*/
|
|
2401
|
-
const createCheckoutTransactionChannelSchema = (transactionId) => createRealtimeChannelSchema({
|
|
2402
|
-
channel: `transaction:${transactionId}`,
|
|
2403
|
-
schema: checkoutTransactionEventSchema
|
|
2404
|
-
});
|
|
2405
|
-
|
|
2406
|
-
//#endregion
|
|
2407
|
-
//#region src/modules/checkout/utils/subscribeToCheckoutTransaction/subscribeToCheckoutTransaction.ts
|
|
2408
|
-
const TERMINAL_EXECUTION_STATES = new Set([
|
|
2409
|
-
"cancelled",
|
|
2410
|
-
"expired",
|
|
2411
|
-
"failed"
|
|
2412
|
-
]);
|
|
2413
|
-
const TERMINAL_SETTLEMENT_STATES = new Set(["completed", "failed"]);
|
|
2414
|
-
const isTerminalEvent = (data) => {
|
|
2415
|
-
if (data.axis === "execution") return TERMINAL_EXECUTION_STATES.has(data.newState);
|
|
2416
|
-
if (data.axis === "settlement") return TERMINAL_SETTLEMENT_STATES.has(data.newState);
|
|
2417
|
-
return false;
|
|
2418
|
-
};
|
|
2419
|
-
/**
|
|
2420
|
-
* Connects to the realtime service if not already connected and subscribes to
|
|
2421
|
-
* all state transition events for the given checkout transaction.
|
|
2422
|
-
*
|
|
2423
|
-
* Settlement and execution axis events are forwarded as public SDK events.
|
|
2424
|
-
* The subscription is torn down automatically when a terminal event is received.
|
|
2425
|
-
* @not-instrumented
|
|
2426
|
-
*/
|
|
2427
|
-
const subscribeToCheckoutTransaction = async ({ transactionId }, client) => {
|
|
2428
|
-
const core = getCore(client);
|
|
2429
|
-
const { realtime } = core;
|
|
2430
|
-
if (realtime.getConnectionState() === "idle") {
|
|
2431
|
-
const sessionToken = await core.storage.getItem(createCheckoutSessionTokenStorageKey(transactionId));
|
|
2432
|
-
const headers = {};
|
|
2433
|
-
if (sessionToken) {
|
|
2434
|
-
headers["x-dynamic-checkout-session-token"] = sessionToken;
|
|
2435
|
-
headers["x-dynamic-checkout-transaction-id"] = transactionId;
|
|
2436
|
-
}
|
|
2437
|
-
await realtime.connect({
|
|
2438
|
-
client,
|
|
2439
|
-
headers
|
|
2440
|
-
});
|
|
2441
|
-
}
|
|
2442
|
-
const channelSchema = createCheckoutTransactionChannelSchema(transactionId);
|
|
2443
|
-
const handler = ({ data }) => {
|
|
2444
|
-
if (data.axis === "execution") emitEvent({
|
|
2445
|
-
args: {
|
|
2446
|
-
newState: data.newState,
|
|
2447
|
-
previousState: data.previousState,
|
|
2448
|
-
timestamp: data.timestamp,
|
|
2449
|
-
transactionId: data.transactionId
|
|
2450
|
-
},
|
|
2451
|
-
event: "checkoutTransactionExecutionStateChanged"
|
|
2452
|
-
}, client);
|
|
2453
|
-
if (data.axis === "settlement") emitEvent({
|
|
2454
|
-
args: {
|
|
2455
|
-
newState: data.newState,
|
|
2456
|
-
previousState: data.previousState,
|
|
2457
|
-
timestamp: data.timestamp,
|
|
2458
|
-
transactionId: data.transactionId
|
|
2459
|
-
},
|
|
2460
|
-
event: "checkoutTransactionSettlementStateChanged"
|
|
2461
|
-
}, client);
|
|
2462
|
-
if (isTerminalEvent(data)) realtime.unsubscribe({
|
|
2463
|
-
callback: handler,
|
|
2464
|
-
channelSchema
|
|
2465
|
-
});
|
|
2466
|
-
};
|
|
2467
|
-
await realtime.subscribe({
|
|
2468
|
-
callback: handler,
|
|
2469
|
-
channelSchema
|
|
2470
|
-
});
|
|
2471
|
-
};
|
|
2472
|
-
|
|
2473
2479
|
//#endregion
|
|
2474
2480
|
//#region src/modules/checkout/createCheckoutTransaction/createCheckoutTransaction.ts
|
|
2475
2481
|
/**
|
|
@@ -2501,9 +2507,6 @@ const createCheckoutTransaction = async (params, client = getDefaultClient()) =>
|
|
|
2501
2507
|
environmentId: core.environmentId
|
|
2502
2508
|
});
|
|
2503
2509
|
await core.storage.setItem(createCheckoutSessionTokenStorageKey(result.transaction.id), result.sessionToken);
|
|
2504
|
-
subscribeToCheckoutTransaction({ transactionId: result.transaction.id }, client).catch((error) => {
|
|
2505
|
-
core.logger.error("Failed to subscribe to checkout transaction realtime channel", error);
|
|
2506
|
-
});
|
|
2507
2510
|
return result;
|
|
2508
2511
|
};
|
|
2509
2512
|
const __createCheckoutTransaction_impl = createCheckoutTransaction;
|
|
@@ -2729,11 +2732,17 @@ const __submitCheckoutTransaction_wrapped = instrumentFunction({
|
|
|
2729
2732
|
* subscribed — calling this again for those is unnecessary unless the page
|
|
2730
2733
|
* has been reloaded.
|
|
2731
2734
|
*
|
|
2735
|
+
* NOTE: Temporarily a no-op while the Ably API key is being provisioned for
|
|
2736
|
+
* the realtime checkout transaction channel. Will be re-enabled once the
|
|
2737
|
+
* dashboard-api environment has the Ably wiring in place.
|
|
2738
|
+
*
|
|
2732
2739
|
* @param params.transactionId - The ID of the checkout transaction to track.
|
|
2733
2740
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2734
2741
|
* @not-instrumented
|
|
2735
2742
|
*/
|
|
2736
|
-
const trackCheckoutTransaction = (
|
|
2743
|
+
const trackCheckoutTransaction = (_params, client = getDefaultClient()) => {
|
|
2744
|
+
return Promise.resolve();
|
|
2745
|
+
};
|
|
2737
2746
|
|
|
2738
2747
|
//#endregion
|
|
2739
2748
|
//#region src/modules/checkout/utils/requiresConversion/requiresConversion.ts
|
|
@@ -5311,6 +5320,184 @@ const isUserOnboardingComplete = (client = getDefaultClient()) => {
|
|
|
5311
5320
|
return !hasMissingKycFields && !hasPendingMfaAuth && !hasPendingRecoveryCodes;
|
|
5312
5321
|
};
|
|
5313
5322
|
|
|
5323
|
+
//#endregion
|
|
5324
|
+
//#region src/modules/walletBackup/googleDrive/constants.ts
|
|
5325
|
+
/**
|
|
5326
|
+
* OAuth scopes that must be granted on the user's Google account in order
|
|
5327
|
+
* for the keyshare backup upload to Google Drive to succeed.
|
|
5328
|
+
*
|
|
5329
|
+
* Exported so host apps can pre-flight check or display these in their own
|
|
5330
|
+
* UX. Kept as a `readonly` tuple to discourage mutation.
|
|
5331
|
+
*/
|
|
5332
|
+
const GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES = ["https://www.googleapis.com/auth/drive.appdata", "https://www.googleapis.com/auth/drive.file"];
|
|
5333
|
+
/**
|
|
5334
|
+
* Stable phrase the WaaS layer includes in Google Drive 401 / scope-insufficient
|
|
5335
|
+
* upload failure messages. Match by `.includes(...)` rather than equality
|
|
5336
|
+
* because the iframe message-handler fallback path rewraps the original error
|
|
5337
|
+
* as `new Error(String(response.error))`, which prefixes the message with
|
|
5338
|
+
* "Error: ". The phrase remains unique to the auth/scope case across all the
|
|
5339
|
+
* Drive failure reasons (rate-limit, storage-full, 5xx, network all use
|
|
5340
|
+
* distinct prefixes), so message-only matching is sufficient to discriminate.
|
|
5341
|
+
*/
|
|
5342
|
+
const ACCESS_DENIED_PHRASE = "Google Drive access denied";
|
|
5343
|
+
|
|
5344
|
+
//#endregion
|
|
5345
|
+
//#region src/modules/walletBackup/googleDrive/findMissingGoogleDriveBackupScopes/findMissingGoogleDriveBackupScopes.ts
|
|
5346
|
+
/**
|
|
5347
|
+
* Returns the Google OAuth scopes from `GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES`
|
|
5348
|
+
* that are NOT present in `grantedScopes`. An empty array means all required
|
|
5349
|
+
* scopes have been granted.
|
|
5350
|
+
*
|
|
5351
|
+
* @param grantedScopes - Scopes the user has granted to their Google account.
|
|
5352
|
+
* @returns The subset of required scopes that are still missing.
|
|
5353
|
+
* @not-instrumented
|
|
5354
|
+
*/
|
|
5355
|
+
const findMissingGoogleDriveBackupScopes = (grantedScopes) => GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES.filter((required) => !grantedScopes.includes(required));
|
|
5356
|
+
|
|
5357
|
+
//#endregion
|
|
5358
|
+
//#region src/modules/walletBackup/googleDrive/utils/fetchGoogleDriveOauthAccess/fetchGoogleDriveOauthAccess.ts
|
|
5359
|
+
/**
|
|
5360
|
+
* Fetches the user's stored Google OAuth access token together with the
|
|
5361
|
+
* scopes that were granted when the token was issued.
|
|
5362
|
+
*
|
|
5363
|
+
* Internal to the Google Drive backup readiness check — not exported as a
|
|
5364
|
+
* public API. The returned `scopes` array can be empty for legacy tokens
|
|
5365
|
+
* captured before the API began tracking granted scopes.
|
|
5366
|
+
*
|
|
5367
|
+
* @param params.oauthAccountId - The verified-credential id of the linked
|
|
5368
|
+
* Google account (see `findGoogleOauthAccountId`).
|
|
5369
|
+
* @param client - The Dynamic client instance.
|
|
5370
|
+
* @returns The OAuth access token and granted scopes.
|
|
5371
|
+
* @not-instrumented
|
|
5372
|
+
*/
|
|
5373
|
+
const fetchGoogleDriveOauthAccess = async ({ oauthAccountId }, client) => {
|
|
5374
|
+
const core = getCore(client);
|
|
5375
|
+
return createApiClient({}, client).getEndUserOauthAccessToken({
|
|
5376
|
+
environmentId: core.environmentId,
|
|
5377
|
+
oauthAccountId
|
|
5378
|
+
});
|
|
5379
|
+
};
|
|
5380
|
+
|
|
5381
|
+
//#endregion
|
|
5382
|
+
//#region src/modules/walletBackup/googleDrive/utils/findGoogleOauthAccountId/findGoogleOauthAccountId.ts
|
|
5383
|
+
/**
|
|
5384
|
+
* Returns the verified-credential `id` (UUID of the user_oauth_accounts row)
|
|
5385
|
+
* for the user's linked Google account, or `undefined` if no Google account
|
|
5386
|
+
* is linked.
|
|
5387
|
+
*
|
|
5388
|
+
* The `getEndUserOauthAccessToken` API path parameter expects this UUID, NOT
|
|
5389
|
+
* the third-party `oauthAccountId` (Google's numeric profile ID) — those are
|
|
5390
|
+
* stored in the same credential under different fields.
|
|
5391
|
+
*
|
|
5392
|
+
* @param credentials - The user's verified credentials, typically from
|
|
5393
|
+
* `client.user?.verifiedCredentials`.
|
|
5394
|
+
* @returns The credential id of the linked Google oauth account, or
|
|
5395
|
+
* `undefined`.
|
|
5396
|
+
* @not-instrumented
|
|
5397
|
+
*/
|
|
5398
|
+
const findGoogleOauthAccountId = (credentials) => credentials?.find((cred) => cred.format === JwtVerifiedCredentialFormatEnum.Oauth && cred.oauthProvider === ProviderEnum.Google)?.id;
|
|
5399
|
+
|
|
5400
|
+
//#endregion
|
|
5401
|
+
//#region src/modules/walletBackup/googleDrive/getGoogleDriveBackupReadiness/getGoogleDriveBackupReadiness.ts
|
|
5402
|
+
/**
|
|
5403
|
+
* Pre-flight readiness check for backing up MPC keyshares to Google Drive.
|
|
5404
|
+
*
|
|
5405
|
+
* Call this before initiating the keyshare backup ceremony. When the result
|
|
5406
|
+
* is `'needs-access'`, have the user re-link their Google account so the
|
|
5407
|
+
* required Drive scopes are granted, then call this again before retrying
|
|
5408
|
+
* the backup. This avoids spending an MPC reshare ceremony on a backup that
|
|
5409
|
+
* will predictably fail.
|
|
5410
|
+
*
|
|
5411
|
+
* Status values:
|
|
5412
|
+
* - `'ready'`: stored scopes include both required Drive scopes; backup
|
|
5413
|
+
* should succeed (barring transient errors).
|
|
5414
|
+
* - `'needs-access'`: backup likely won't succeed without user intervention.
|
|
5415
|
+
* Three sub-cases, distinguished by `missingScopes`:
|
|
5416
|
+
* - No Google account linked → `missingScopes` is the full required set.
|
|
5417
|
+
* - Some scopes granted but not all → `missingScopes` lists the gap.
|
|
5418
|
+
* - Legacy token captured before scope tracking shipped (`scopes: []` from
|
|
5419
|
+
* the API) → `missingScopes` is empty. Forcing a fresh consent will
|
|
5420
|
+
* populate the scopes column for subsequent calls.
|
|
5421
|
+
*
|
|
5422
|
+
* Failures of the underlying access-token fetch propagate as Promise
|
|
5423
|
+
* rejections — the caller is expected to surface or retry them.
|
|
5424
|
+
*
|
|
5425
|
+
* Pair with `isInsufficientGoogleDriveScopesError` to detect post-flight
|
|
5426
|
+
* scope failures (e.g. for the legacy "unknown scopes" case where pre-flight
|
|
5427
|
+
* cannot prove failure).
|
|
5428
|
+
*
|
|
5429
|
+
* @param [client] - The Dynamic client instance. Only required when using
|
|
5430
|
+
* multiple Dynamic clients.
|
|
5431
|
+
* @returns The readiness result.
|
|
5432
|
+
* @instrumented
|
|
5433
|
+
*/
|
|
5434
|
+
const getGoogleDriveBackupReadiness = async (client = getDefaultClient()) => {
|
|
5435
|
+
const { user } = client;
|
|
5436
|
+
const oauthAccountId = findGoogleOauthAccountId(user?.verifiedCredentials);
|
|
5437
|
+
if (!oauthAccountId) return {
|
|
5438
|
+
missingScopes: GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES,
|
|
5439
|
+
status: "needs-access"
|
|
5440
|
+
};
|
|
5441
|
+
const { accessToken, scopes } = await fetchGoogleDriveOauthAccess({ oauthAccountId }, client);
|
|
5442
|
+
if (scopes.length === 0) return {
|
|
5443
|
+
accessToken,
|
|
5444
|
+
missingScopes: [],
|
|
5445
|
+
status: "needs-access"
|
|
5446
|
+
};
|
|
5447
|
+
const missing = findMissingGoogleDriveBackupScopes(scopes);
|
|
5448
|
+
if (missing.length === 0) return {
|
|
5449
|
+
accessToken,
|
|
5450
|
+
missingScopes: [],
|
|
5451
|
+
status: "ready"
|
|
5452
|
+
};
|
|
5453
|
+
return {
|
|
5454
|
+
accessToken,
|
|
5455
|
+
missingScopes: missing,
|
|
5456
|
+
status: "needs-access"
|
|
5457
|
+
};
|
|
5458
|
+
};
|
|
5459
|
+
const __getGoogleDriveBackupReadiness_impl = getGoogleDriveBackupReadiness;
|
|
5460
|
+
const __getGoogleDriveBackupReadiness_wrapped = instrumentFunction({
|
|
5461
|
+
fn: __getGoogleDriveBackupReadiness_impl,
|
|
5462
|
+
functionName: "getGoogleDriveBackupReadiness",
|
|
5463
|
+
getCore: () => {
|
|
5464
|
+
try {
|
|
5465
|
+
return getCore(getDefaultClient());
|
|
5466
|
+
} catch {
|
|
5467
|
+
return;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
});
|
|
5471
|
+
|
|
5472
|
+
//#endregion
|
|
5473
|
+
//#region src/modules/walletBackup/googleDrive/hasAllGoogleDriveBackupScopes/hasAllGoogleDriveBackupScopes.ts
|
|
5474
|
+
/**
|
|
5475
|
+
* Returns whether `grantedScopes` covers every Google OAuth scope required
|
|
5476
|
+
* to upload a keyshare backup to Google Drive.
|
|
5477
|
+
*
|
|
5478
|
+
* @param grantedScopes - Scopes the user has granted to their Google account.
|
|
5479
|
+
* @returns `true` when every required scope is granted, otherwise `false`.
|
|
5480
|
+
* @not-instrumented
|
|
5481
|
+
*/
|
|
5482
|
+
const hasAllGoogleDriveBackupScopes = (grantedScopes) => findMissingGoogleDriveBackupScopes(grantedScopes).length === 0;
|
|
5483
|
+
|
|
5484
|
+
//#endregion
|
|
5485
|
+
//#region src/modules/walletBackup/googleDrive/isInsufficientGoogleDriveScopesError/isInsufficientGoogleDriveScopesError.ts
|
|
5486
|
+
/**
|
|
5487
|
+
* Type-guard for Google Drive backup failures caused by missing or
|
|
5488
|
+
* insufficient OAuth scopes (or otherwise denied access).
|
|
5489
|
+
*
|
|
5490
|
+
* Recover by having the user re-link their Google account and retrying the
|
|
5491
|
+
* backup once the granted scopes include
|
|
5492
|
+
* `GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES`.
|
|
5493
|
+
*
|
|
5494
|
+
* @param err - The unknown value to check.
|
|
5495
|
+
* @returns `true` when `err` is an `Error` whose message indicates Google
|
|
5496
|
+
* Drive access was denied.
|
|
5497
|
+
* @not-instrumented
|
|
5498
|
+
*/
|
|
5499
|
+
const isInsufficientGoogleDriveScopesError = (err) => err instanceof Error && err.message.includes(ACCESS_DENIED_PHRASE);
|
|
5500
|
+
|
|
5314
5501
|
//#endregion
|
|
5315
5502
|
//#region src/modules/wallets/assertWalletAccountSigningAvailability/assertWalletAccountSigningAvailability.ts
|
|
5316
5503
|
/**
|
|
@@ -6384,5 +6571,5 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
6384
6571
|
assertPackageVersion(name, version);
|
|
6385
6572
|
|
|
6386
6573
|
//#endregion
|
|
6387
|
-
export { BaseError, CheckoutSessionTokenMissingError, ClientAlreadyInitializedError, DeeplinkConnectAndVerifyUnsupportedError, FeeEstimationFailedError, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, TokenSwapError, UnauthorizedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, __acknowledgeRecoveryCodes_wrapped as acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, __addNetwork_wrapped as addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, __attachCheckoutTransactionSource_wrapped as attachCheckoutTransactionSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, __authenticateWithSocial_wrapped as authenticateWithSocial, __broadcastCheckoutTransaction_wrapped as broadcastCheckoutTransaction, canConnectWithHardwareWallet, __cancelCheckoutTransaction_wrapped as cancelCheckoutTransaction, __checkStepUpAuth_wrapped as checkStepUpAuth, __completeDeviceRegistration_wrapped as completeDeviceRegistration, __completeSocialAuthentication_wrapped as completeSocialAuthentication, __completeSocialRedirect_wrapped as completeSocialRedirect, __confirmTransaction_wrapped as confirmTransaction, __connectAndVerifyWithWalletProvider_wrapped as connectAndVerifyWithWalletProvider, __connectWithWalletProvider_wrapped as connectWithWalletProvider, __consumeMfaToken_wrapped as consumeMfaToken, __createCheckoutTransaction_wrapped as createCheckoutTransaction, __createCoinbaseOnrampOrder_wrapped as createCoinbaseOnrampOrder, __createCryptoDotComPayment_wrapped as createCryptoDotComPayment, __createDynamicClient_wrapped as createDynamicClient, __createKrakenExchangeTransfer_wrapped as createKrakenExchangeTransfer, __createNewMfaRecoveryCodes_wrapped as createNewMfaRecoveryCodes, __deleteMfaDevice_wrapped as deleteMfaDevice, __deletePasskey_wrapped as deletePasskey, __deleteUser_wrapped as deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, detectSocialRedirectUrl, __executeSwapTransaction_wrapped as executeSwapTransaction, fetchProjectSettings, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getBalances, getCheckoutTransaction, getCheckoutTransactionQuote, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, __getElevatedAccessToken_wrapped as getElevatedAccessToken, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getRegisteredDevices, getSwapQuote, getSwapStatus, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletProviderDataByKey, hasExtension, __initializeClient_wrapped as initializeClient, isCaptchaRequired, isDeeplinkWalletProvider, isDeviceRegistrationRequired, isHardwareWalletAccount, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, parseUserAgent, __prepareCheckoutTransaction_wrapped as prepareCheckoutTransaction, __proveWalletAccountOwnership_wrapped as proveWalletAccountOwnership, __refreshAuth_wrapped as refreshAuth, __refreshUser_wrapped as refreshUser, __registerPasskey_wrapped as registerPasskey, __registerTotpMfaDevice_wrapped as registerTotpMfaDevice, __removeWalletAccount_wrapped as removeWalletAccount, __requestExternalAuthElevatedToken_wrapped as requestExternalAuthElevatedToken, requiresConversion, __revokeAllRegisteredDevices_wrapped as revokeAllRegisteredDevices, __revokeRegisteredDevice_wrapped as revokeRegisteredDevice, __selectPrimaryWalletAccount_wrapped as selectPrimaryWalletAccount, __sendEmailOTP_wrapped as sendEmailOTP, __sendSmsOTP_wrapped as sendSmsOTP, __setCaptchaToken_wrapped as setCaptchaToken, __setDefaultMfaDevice_wrapped as setDefaultMfaDevice, __setInstrumentationEnabled_wrapped as setInstrumentationEnabled, __signInWithExternalJwt_wrapped as signInWithExternalJwt, __signInWithPasskey_wrapped as signInWithPasskey, __signInWithSocialRedirect_wrapped as signInWithSocialRedirect, __signMessage_wrapped as signMessage, __submitCheckoutTransaction_wrapped as submitCheckoutTransaction, supportedCountries, __switchActiveNetwork_wrapped as switchActiveNetwork, trackCheckoutTransaction, __transferAmount_wrapped as transferAmount, __transferWalletAccount_wrapped as transferWalletAccount, __unlinkSocialAccount_wrapped as unlinkSocialAccount, __updateUser_wrapped as updateUser, __verifyOTP_wrapped as verifyOTP, __verifyWalletAccount_wrapped as verifyWalletAccount, waitForClientInitialized };
|
|
6574
|
+
export { BaseError, CheckoutSessionTokenMissingError, ClientAlreadyInitializedError, DeeplinkConnectAndVerifyUnsupportedError, FeeEstimationFailedError, GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, InvalidSocialCallbackOriginError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, TokenSwapError, UnauthorizedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserCancelledSocialPopUpError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, __acknowledgeRecoveryCodes_wrapped as acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, __addNetwork_wrapped as addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, __attachCheckoutTransactionSource_wrapped as attachCheckoutTransactionSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, __authenticateWithSocial_wrapped as authenticateWithSocial, __broadcastCheckoutTransaction_wrapped as broadcastCheckoutTransaction, canConnectWithHardwareWallet, __cancelCheckoutTransaction_wrapped as cancelCheckoutTransaction, __checkStepUpAuth_wrapped as checkStepUpAuth, __completeDeviceRegistration_wrapped as completeDeviceRegistration, __completeSocialAuthentication_wrapped as completeSocialAuthentication, __completeSocialRedirect_wrapped as completeSocialRedirect, __confirmTransaction_wrapped as confirmTransaction, __connectAndVerifyWithWalletProvider_wrapped as connectAndVerifyWithWalletProvider, __connectWithWalletProvider_wrapped as connectWithWalletProvider, __consumeMfaToken_wrapped as consumeMfaToken, __createCheckoutTransaction_wrapped as createCheckoutTransaction, __createCoinbaseOnrampOrder_wrapped as createCoinbaseOnrampOrder, __createCryptoDotComPayment_wrapped as createCryptoDotComPayment, __createDynamicClient_wrapped as createDynamicClient, __createKrakenExchangeTransfer_wrapped as createKrakenExchangeTransfer, __createNewMfaRecoveryCodes_wrapped as createNewMfaRecoveryCodes, __deleteMfaDevice_wrapped as deleteMfaDevice, __deletePasskey_wrapped as deletePasskey, __deleteUser_wrapped as deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, detectSocialRedirectUrl, __executeSwapTransaction_wrapped as executeSwapTransaction, fetchProjectSettings, findMissingGoogleDriveBackupScopes, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getBalances, getCheckoutTransaction, getCheckoutTransactionQuote, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, __getElevatedAccessToken_wrapped as getElevatedAccessToken, __getGoogleDriveBackupReadiness_wrapped as getGoogleDriveBackupReadiness, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getRegisteredDevices, getSwapQuote, getSwapStatus, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletProviderDataByKey, hasAllGoogleDriveBackupScopes, hasExtension, __initializeClient_wrapped as initializeClient, isCaptchaRequired, isDeeplinkWalletProvider, isDeviceRegistrationRequired, isHardwareWalletAccount, isInsufficientGoogleDriveScopesError, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, parseUserAgent, __prepareCheckoutTransaction_wrapped as prepareCheckoutTransaction, __proveWalletAccountOwnership_wrapped as proveWalletAccountOwnership, __refreshAuth_wrapped as refreshAuth, __refreshUser_wrapped as refreshUser, __registerPasskey_wrapped as registerPasskey, __registerTotpMfaDevice_wrapped as registerTotpMfaDevice, __removeWalletAccount_wrapped as removeWalletAccount, __requestExternalAuthElevatedToken_wrapped as requestExternalAuthElevatedToken, requiresConversion, __revokeAllRegisteredDevices_wrapped as revokeAllRegisteredDevices, __revokeRegisteredDevice_wrapped as revokeRegisteredDevice, __selectPrimaryWalletAccount_wrapped as selectPrimaryWalletAccount, __sendEmailOTP_wrapped as sendEmailOTP, __sendSmsOTP_wrapped as sendSmsOTP, __setCaptchaToken_wrapped as setCaptchaToken, __setDefaultMfaDevice_wrapped as setDefaultMfaDevice, __setInstrumentationEnabled_wrapped as setInstrumentationEnabled, __signInWithExternalJwt_wrapped as signInWithExternalJwt, __signInWithPasskey_wrapped as signInWithPasskey, __signInWithSocialPopUp_wrapped as signInWithSocialPopUp, __signInWithSocialRedirect_wrapped as signInWithSocialRedirect, __signMessage_wrapped as signMessage, __submitCheckoutTransaction_wrapped as submitCheckoutTransaction, supportedCountries, __switchActiveNetwork_wrapped as switchActiveNetwork, trackCheckoutTransaction, __transferAmount_wrapped as transferAmount, __transferWalletAccount_wrapped as transferWalletAccount, __unlinkSocialAccount_wrapped as unlinkSocialAccount, __updateUser_wrapped as updateUser, __verifyOTP_wrapped as verifyOTP, __verifyWalletAccount_wrapped as verifyWalletAccount, waitForClientInitialized };
|
|
6388
6575
|
//# sourceMappingURL=index.esm.js.map
|