@dynamic-labs-sdk/client 1.11.0 → 1.12.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/dist/{InvalidParamError-BazEwozw.esm.js → InvalidParamError-6N66SLG8.esm.js} +2 -2
- package/dist/{InvalidParamError-BazEwozw.esm.js.map → InvalidParamError-6N66SLG8.esm.js.map} +1 -1
- package/dist/{InvalidParamError-CMesesy6.cjs → InvalidParamError-Bgg4SDfm.cjs} +3 -3
- package/dist/{InvalidParamError-CMesesy6.cjs.map → InvalidParamError-Bgg4SDfm.cjs.map} +1 -1
- package/dist/{InvalidParamError-BUpLSb5x.native.esm.js → InvalidParamError-CjC1BFSC.native.esm.js} +2 -2
- package/dist/{InvalidParamError-BUpLSb5x.native.esm.js.map → InvalidParamError-CjC1BFSC.native.esm.js.map} +1 -1
- package/dist/core.cjs +5 -5
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waasCore.d.ts +1 -0
- package/dist/exports/waasCore.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BfBE-dei.esm.js → getNetworkProviderFromNetworkId--egxmnKm.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-BfBE-dei.esm.js.map → getNetworkProviderFromNetworkId--egxmnKm.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-D4xzWb7w.cjs → getNetworkProviderFromNetworkId-Afx6InoJ.cjs} +4 -4
- package/dist/{getNetworkProviderFromNetworkId-D4xzWb7w.cjs.map → getNetworkProviderFromNetworkId-Afx6InoJ.cjs.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-C-1rPWZm.native.esm.js → getNetworkProviderFromNetworkId-BXBlKNF9.native.esm.js} +4 -4
- package/dist/{getNetworkProviderFromNetworkId-C-1rPWZm.native.esm.js.map → getNetworkProviderFromNetworkId-BXBlKNF9.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-BWxWFaJW.esm.js → getSignedSessionId-CsawYVfU.esm.js} +3 -3
- package/dist/{getSignedSessionId-BWxWFaJW.esm.js.map → getSignedSessionId-CsawYVfU.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-fwHlhBvt.native.esm.js → getSignedSessionId-DWb6By0V.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-fwHlhBvt.native.esm.js.map → getSignedSessionId-DWb6By0V.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-BimmHQvA.cjs → getSignedSessionId-Kf9jJ8g0.cjs} +3 -3
- package/dist/{getSignedSessionId-BimmHQvA.cjs.map → getSignedSessionId-Kf9jJ8g0.cjs.map} +1 -1
- package/dist/{getWaasWalletProviderFromWalletAccount-sEzYqoCf.cjs → getWaasWalletProviderFromWalletAccount-BZuQj_tI.cjs} +4 -4
- package/dist/{getWaasWalletProviderFromWalletAccount-sEzYqoCf.cjs.map → getWaasWalletProviderFromWalletAccount-BZuQj_tI.cjs.map} +1 -1
- package/dist/{getWaasWalletProviderFromWalletAccount-CJdnAlDf.native.esm.js → getWaasWalletProviderFromWalletAccount-ChxW7xBR.native.esm.js} +3 -3
- package/dist/{getWaasWalletProviderFromWalletAccount-CJdnAlDf.native.esm.js.map → getWaasWalletProviderFromWalletAccount-ChxW7xBR.native.esm.js.map} +1 -1
- package/dist/{getWaasWalletProviderFromWalletAccount-OM-BlEFR.esm.js → getWaasWalletProviderFromWalletAccount-D1U_Vmr3.esm.js} +3 -3
- package/dist/{getWaasWalletProviderFromWalletAccount-OM-BlEFR.esm.js.map → getWaasWalletProviderFromWalletAccount-D1U_Vmr3.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-CAQkYCGi.native.esm.js → getWalletProviderByKey-Bq0kRpuN.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-CAQkYCGi.native.esm.js.map → getWalletProviderByKey-Bq0kRpuN.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-1zHjzqbz.cjs → getWalletProviderByKey-DRex9vzR.cjs} +3 -3
- package/dist/{getWalletProviderByKey-1zHjzqbz.cjs.map → getWalletProviderByKey-DRex9vzR.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-BXGcVzkf.esm.js → getWalletProviderByKey-OC_h7kSB.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-BXGcVzkf.esm.js.map → getWalletProviderByKey-OC_h7kSB.esm.js.map} +1 -1
- package/dist/index.cjs +34 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +33 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +33 -7
- package/dist/index.native.esm.js.map +1 -1
- package/dist/isDynamicWaasEnabled-CEVTY3gQ.cjs +49 -0
- package/dist/isDynamicWaasEnabled-CEVTY3gQ.cjs.map +1 -0
- package/dist/isDynamicWaasEnabled-DDM_LAa0.native.esm.js +37 -0
- package/dist/isDynamicWaasEnabled-DDM_LAa0.native.esm.js.map +1 -0
- package/dist/isDynamicWaasEnabled-Di2FwljM.esm.js +37 -0
- package/dist/isDynamicWaasEnabled-Di2FwljM.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-DZVNUtPY.esm.js → isMfaRequiredForAction-BnAV59o-.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DZVNUtPY.esm.js.map → isMfaRequiredForAction-BnAV59o-.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-CPadAr7k.native.esm.js → isMfaRequiredForAction-CPhNpJQE.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CPadAr7k.native.esm.js.map → isMfaRequiredForAction-CPhNpJQE.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-CxWuGsmB.cjs → isMfaRequiredForAction-DSo1ysdD.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-CxWuGsmB.cjs.map → isMfaRequiredForAction-DSo1ysdD.cjs.map} +1 -1
- package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts.map +1 -1
- package/dist/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.d.ts +2 -0
- package/dist/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.d.ts.map +1 -1
- package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts +2 -0
- package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/cancelCheckoutTransaction/cancelCheckoutTransaction.d.ts +2 -0
- package/dist/modules/checkout/cancelCheckoutTransaction/cancelCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/createCheckoutTransaction/createCheckoutTransaction.d.ts +2 -0
- package/dist/modules/checkout/createCheckoutTransaction/createCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/getCheckoutTransaction/getCheckoutTransaction.d.ts +3 -1
- package/dist/modules/checkout/getCheckoutTransaction/getCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts +2 -0
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts.map +1 -1
- package/dist/modules/checkout/prepareCheckoutTransaction/prepareCheckoutTransaction.d.ts +2 -0
- package/dist/modules/checkout/prepareCheckoutTransaction/prepareCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.d.ts +2 -0
- package/dist/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/trackCheckoutTransaction/trackCheckoutTransaction.d.ts +2 -0
- package/dist/modules/checkout/trackCheckoutTransaction/trackCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/utils/requiresConversion/requiresConversion.d.ts +2 -0
- package/dist/modules/checkout/utils/requiresConversion/requiresConversion.d.ts.map +1 -1
- package/dist/modules/otp/sendEmailOTP/sendEmailOTP.d.ts +2 -2
- package/dist/modules/otp/sendEmailOTP/sendEmailOTP.d.ts.map +1 -1
- package/dist/modules/otp/sendSmsOTP/sendSmsOTP.d.ts +2 -2
- package/dist/modules/otp/sendSmsOTP/sendSmsOTP.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
- package/dist/modules/waas/preconnectWaasIframe/index.d.ts +2 -0
- package/dist/modules/waas/preconnectWaasIframe/index.d.ts.map +1 -0
- package/dist/modules/waas/preconnectWaasIframe/preconnectWaasIframe.d.ts +13 -0
- package/dist/modules/waas/preconnectWaasIframe/preconnectWaasIframe.d.ts.map +1 -0
- package/dist/preconnectWaasIframe-1BSQ7tHo.native.esm.js +31 -0
- package/dist/preconnectWaasIframe-1BSQ7tHo.native.esm.js.map +1 -0
- package/dist/preconnectWaasIframe-Cb9xM6kI.cjs +37 -0
- package/dist/preconnectWaasIframe-Cb9xM6kI.cjs.map +1 -0
- package/dist/preconnectWaasIframe-D2S_A0QT.esm.js +31 -0
- package/dist/preconnectWaasIframe-D2S_A0QT.esm.js.map +1 -0
- package/dist/{refreshAuth-Cl3adySI.native.esm.js → refreshAuth-C5bVvAAl.native.esm.js} +3 -3
- package/dist/{refreshAuth-Cl3adySI.native.esm.js.map → refreshAuth-C5bVvAAl.native.esm.js.map} +1 -1
- package/dist/{refreshAuth-CKcNynMk.cjs → refreshAuth-Ca_JABru.cjs} +3 -3
- package/dist/{refreshAuth-CKcNynMk.cjs.map → refreshAuth-Ca_JABru.cjs.map} +1 -1
- package/dist/{refreshAuth-DlQw3Dky.esm.js → refreshAuth-DwYi8x0J.esm.js} +3 -3
- package/dist/{refreshAuth-DlQw3Dky.esm.js.map → refreshAuth-DwYi8x0J.esm.js.map} +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs +8 -25
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +6 -23
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +6 -23
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +7 -4
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +7 -5
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +7 -5
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/NotWaasWalletAccountError-CIjFmQ_l.esm.js +0 -18
- package/dist/NotWaasWalletAccountError-CIjFmQ_l.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-D-yqOoH6.cjs +0 -23
- package/dist/NotWaasWalletAccountError-D-yqOoH6.cjs.map +0 -1
- package/dist/NotWaasWalletAccountError-DWXGDcpr.native.esm.js +0 -18
- package/dist/NotWaasWalletAccountError-DWXGDcpr.native.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletProviderByKey-BXGcVzkf.esm.js","names":["newState: Partial<DynamicCoreState>","walletProvider"],"sources":["../src/modules/wallets/emitWalletAccountsChangedEvent/emitWalletAccountsChangedEvent.ts","../src/modules/auth/updateAuthFromVerifyResponse/checkAndRaiseWalletAccountsChangedEvent/checkAndRaiseWalletAccountsChangedEvent.ts","../src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.ts","../src/modules/wallets/getWalletProviders/getWalletProviders.ts","../src/modules/waas/findWaasWalletProviderByChain/findWaasWalletProviderByChain.ts","../src/modules/waas/isWaasWalletAccount/isWaasWalletAccount.ts","../src/modules/waas/restoreUserSharesForAllWalletAccounts/restoreUserSharesForAllWalletAccounts.ts","../src/modules/auth/decodeJwt/decodeJwt.ts","../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.ts","../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.ts","../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.ts","../src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts","../src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.ts","../src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts"],"sourcesContent":["import type { DynamicClient } from '../../../client/types';\nimport { emitEvent } from '../../clientEvents';\nimport { getWalletAccounts } from '../getWalletAccounts';\n\n/**\n * Emits the `walletAccountsChanged` event.\n * @not-instrumented\n */\nexport const emitWalletAccountsChangedEvent = (client: DynamicClient): void => {\n const walletAccounts = getWalletAccounts(client);\n\n emitEvent(\n {\n args: { walletAccounts },\n event: 'walletAccountsChanged',\n },\n client\n );\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { emitWalletAccountsChangedEvent } from '../../../wallets/emitWalletAccountsChangedEvent';\nimport { getWalletAccountsFromState } from '../../../wallets/getWalletAccounts/getWalletAccountsFromState';\n\ntype CheckAndRaiseWalletAccountsChangedEventParams = {\n previousState: Readonly<DynamicCoreState>;\n};\n\n/** @not-instrumented */\nexport const checkAndRaiseWalletAccountsChangedEvent = (\n { previousState }: CheckAndRaiseWalletAccountsChangedEventParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletAccountsHashBefore = getWalletAccountsHash(previousState, client);\n\n const walletAccountsHashAfter = getWalletAccountsHash(\n core.state.get(),\n client\n );\n\n if (walletAccountsHashBefore !== walletAccountsHashAfter) {\n emitWalletAccountsChangedEvent(client);\n }\n};\n\n \n \nconst getWalletAccountsHash = (\n state: Readonly<DynamicCoreState>,\n client: DynamicClient\n) =>\n getWalletAccountsFromState(state, client)\n .map((walletAccount) => JSON.stringify(walletAccount))\n .sort()\n .join('-');\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user requires additional MFA authentication.\n *\n * This function determines if the current user session requires\n * additional multi-factor authentication to access certain features.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user needs additional MFA authentication, false otherwise.\n * @not-instrumented\n */\nexport const isUserMissingMfaAuth = (client = getDefaultClient()) => {\n const user = client.user;\n\n assertDefined(user, 'User not logged in');\n\n return Boolean(user.scope?.includes('requiresAdditionalAuth'));\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getWalletProviderRegistry } from '../walletProviderRegistry';\n\n/**\n * Get all available wallet providers to interact with internally.\n * @not-instrumented\n */\nexport const getWalletProviders = (client: DynamicClient) => {\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n return walletProviderRegistry.listProviders();\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { Chain } from '../../chain';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype FindWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\n/** @not-instrumented */\nexport const findWaasWalletProviderByChain = (\n { chain }: FindWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider | null => {\n const providers = getWalletProviders(client);\n\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const waasProvider = providers.find(\n (provider) => provider.key === waasProviderKey && provider.chain === chain\n );\n\n if (!waasProvider || !isWaasWalletProvider(waasProvider)) {\n return null;\n }\n\n return waasProvider;\n};\n","import type { WalletAccount } from '../../wallets/walletAccount';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\n\ntype IsWaasWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * This function determines whether the provided wallet account is a Dynamic\n * WaaS wallet account.\n *\n * @param params.walletAccount - The wallet account to check.\n * @returns True if the wallet account is a WaaS wallet account, false otherwise.\n * @not-instrumented\n */\nexport const isWaasWalletAccount = ({\n walletAccount,\n}: IsWaasWalletAccountParams): boolean => {\n return walletAccount.walletProviderKey.includes(\n DYNAMIC_WAAS_METADATA.normalizedWalletName\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { isUserMissingMfaAuth } from '../../mfa/isUserMissingMfaAuth';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain';\nimport { isWaasWalletAccount } from '../isWaasWalletAccount';\n\n/** @not-instrumented */\nexport const restoreUserSharesForAllWalletAccounts = async (\n client: DynamicClient\n) => {\n /**\n * Restoring the user shares will fails if the user is missing the MFA auth.\n * This early return prevents the attempt to restore the user shares to fail\n * when we know it will fails and just add noise to the logs.\n */\n if (isUserMissingMfaAuth(client)) {\n return;\n }\n\n const walletAccounts = getWalletAccounts(client);\n\n const waasWalletAccounts = walletAccounts.filter((walletAccount) =>\n isWaasWalletAccount({ walletAccount })\n );\n\n await Promise.all(\n waasWalletAccounts.map(async (walletAccount) => {\n const provider = findWaasWalletProviderByChain(\n { chain: walletAccount.chain },\n client\n );\n\n /**\n * The environment might not have the embedded wallet extensions installed.\n * In that case there is no provider for the chain and we can skip restoring the user share.\n */\n if (!provider) return;\n\n return provider.restoreUserShareForWalletAccount({ walletAccount });\n })\n );\n};\n","import { InvalidParamError } from '../../../errors/InvalidParamError';\n\nexport type JwtPayload = {\n [key: string]: unknown;\n exp: number;\n iat: number;\n scope: string;\n singleUse?: boolean;\n sub: string;\n};\n\n/**\n * Decodes a JWT token and returns the full payload.\n *\n * This function extracts and returns the complete JWT payload including scopes,\n * expiration time, and other claims.\n *\n * @param jwt - The JWT token string.\n * @returns The decoded JWT payload object.\n * @throws InvalidParamError if the token is invalid or cannot be decoded.\n *\n * @example\n * ```typescript\n * const payload = decodeJwt(jwt);\n * // Returns: { scopes: ['wallet:export'], exp: 1234567890, ... }\n * ```\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const decodeJwt = (jwt: string): JwtPayload => {\n try {\n // JWT format: header.payload.signature\n const parts = jwt.split('.');\n if (parts.length !== 3) {\n throw new InvalidParamError('Invalid JWT format');\n }\n\n // Decode the payload (second part)\n // Base64URL decode: replace URL-safe characters and decode\n const base64Payload = parts[1].replaceAll('-', '+').replaceAll('_', '/');\n // Add padding if needed\n const paddedPayload =\n base64Payload + '='.repeat((4 - (base64Payload.length % 4)) % 4);\n const decodedPayload = atob(paddedPayload);\n const claims = JSON.parse(decodedPayload) as JwtPayload;\n\n return claims;\n } catch (error) {\n if (error instanceof InvalidParamError) {\n throw error;\n }\n throw new InvalidParamError(\n `Failed to decode JWT: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n};\n","/**\n * Normalizes scopes by deduplicating and sorting them.\n * This creates a canonical representation for comparison.\n *\n * @param scopes - Array of scope strings (may contain duplicates)\n * @returns Normalized, sorted array of unique scopes\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const normalizeScopes = (scopes: string[]): string[] => {\n return [...new Set(scopes)].sort((a, b) => a.localeCompare(b));\n};\n","import { decodeJwt } from '../../../decodeJwt';\nimport type { ParsedElevatedAccessToken } from '../elevatedAccessTokens.types';\nimport { normalizeScopes } from '../normalizeScopes';\n\nexport type ParseElevatedAccessTokenOptions = {\n /** JWT string containing the elevated access token. */\n token: string;\n};\n\n/**\n * Validates and parses an elevated access token from a JWT string.\n * Extracts scopes, expiration, and validates the token structure.\n *\n * Policy decisions:\n * - Tokens without scopes are rejected (returns null)\n * - Tokens with empty scopes array are rejected (returns null)\n * - Tokens without exp field are rejected (returns null)\n * - Expired tokens are rejected (returns null)\n *\n * @returns Parsed token data or null if token is invalid/expired\n * @not-instrumented\n */\nexport const parseElevatedAccessToken = ({\n token,\n}: ParseElevatedAccessTokenOptions): ParsedElevatedAccessToken | null => {\n const payload = decodeJwt(token);\n const rawScopeClaim = payload?.scope;\n const processedScopes = rawScopeClaim?.split(' ') ?? [];\n const filteredScopes = processedScopes.filter((s) => s.length > 0);\n const singleUse = payload.singleUse ?? false;\n\n // Reject tokens without scopes or with empty scopes\n if (!filteredScopes || filteredScopes.length === 0) {\n return null;\n }\n\n // Reject tokens without exp field\n if (!payload.exp) {\n return null;\n }\n\n // Convert exp (seconds) to Date (milliseconds)\n const expiresAt = new Date(payload.exp * 1000);\n\n // Reject expired tokens\n if (expiresAt <= new Date()) {\n return null;\n }\n\n return {\n expiresAt,\n normalizedScopes: normalizeScopes(filteredScopes),\n scopes: filteredScopes,\n singleUse,\n token,\n };\n};\n","import type {\n ElevatedAccessToken,\n ParsedElevatedAccessToken,\n} from '../elevatedAccessTokens.types';\nimport { normalizeScopes } from '../normalizeScopes';\n\n/**\n * Upserts an elevated access token into the current tokens array.\n *\n * Policy: Only one token per normalized scope-set is allowed.\n * If a token with the same normalized scopes exists, it is replaced.\n * This ensures we don't accumulate multiple tokens for the same scope combination.\n *\n * @param currentTokens - Current array of elevated access tokens\n * @param newToken - New token to upsert\n * @returns Updated array of tokens with the new token upserted\n * @not-instrumented\n */\nexport const upsertElevatedAccessToken = ({\n currentTokens,\n newToken,\n}: {\n currentTokens: ElevatedAccessToken[];\n newToken: ParsedElevatedAccessToken;\n}): ElevatedAccessToken[] => {\n const newScopeKey = normalizeScopes(newToken.scopes).join(' ');\n\n // Remove any existing token with the same normalized scopes\n const filteredTokens = currentTokens.filter((existingToken) => {\n const existingScopeKey = normalizeScopes(existingToken.scopes).join(' ');\n return existingScopeKey !== newScopeKey;\n });\n\n // Add the new token\n return [\n ...filteredTokens,\n {\n expiresAt: newToken.expiresAt,\n scopes: newToken.scopes,\n singleUse: newToken.singleUse,\n token: newToken.token,\n },\n ];\n};\n","import type { VerifyResponse } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport type { DynamicCoreState } from '../../../client/core/types';\nimport type { DynamicClient } from '../../../client/types';\nimport { setCookie } from '../../../utils/setCookie';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { restoreUserSharesForAllWalletAccounts } from '../../waas/restoreUserSharesForAllWalletAccounts';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport { checkAndRaiseWalletAccountsChangedEvent } from './checkAndRaiseWalletAccountsChangedEvent';\nimport { parseElevatedAccessToken } from './elevatedAccessTokens/parseElevatedAccessToken';\nimport { upsertElevatedAccessToken } from './elevatedAccessTokens/upsertElevatedAccessToken';\n\ntype UpdateAuthFromVerifyResponseParams = {\n response: VerifyResponse;\n};\n\n/** @not-instrumented */\nexport const updateAuthFromVerifyResponse = (\n { response }: UpdateAuthFromVerifyResponseParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const previousState = { ...core.state.get() };\n\n const { user, minifiedJwt, jwt, expiresAt, mfaToken, elevatedAccessToken } =\n response;\n\n // Expires at is in seconds, so we need to convert it to milliseconds\n const sessionExpiresAt = new Date(expiresAt * 1000);\n\n const newState: Partial<DynamicCoreState> = {\n legacyToken: jwt ?? null,\n sessionExpiresAt: sessionExpiresAt,\n token: minifiedJwt ?? null,\n user,\n };\n\n // only override the mfaToken if a new one is provided in the response\n if (mfaToken) {\n newState.mfaToken = mfaToken;\n }\n\n // Add elevated access token to the array if a new one is provided in the response\n // Policy: Only one token per normalized scope-set is allowed (old tokens are replaced)\n // Always preserve existing tokens to ensure they're synced to storage\n const currentTokens = core.state.get().elevatedAccessTokens || [];\n newState.elevatedAccessTokens = currentTokens;\n \n if (elevatedAccessToken) {\n const parsedToken = parseElevatedAccessToken({\n token: elevatedAccessToken,\n });\n if (parsedToken) {\n newState.elevatedAccessTokens = upsertElevatedAccessToken({\n currentTokens,\n newToken: parsedToken,\n });\n }\n }\n\n core.state.set(newState);\n\n /**\n * For customers using a sandbox environment with cookies enabled, we need to set the cookie\n * programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically\n * so customers can access the cookie from document.cookie consistently between sandbox and live environments.\n */\n if (minifiedJwt && isCookieEnabled(client)) {\n const expireDate = sessionExpiresAt.toUTCString();\n\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${expireDate}; path=/; SameSite=Lax`\n );\n }\n\n checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);\n\n // if the user is logging in, we should restore user shares\n // for all wallet accounts for performance reasons\n const isUserLoggingIn = !previousState.user && Boolean(newState.user);\n if (isUserLoggingIn) {\n void restoreUserSharesForAllWalletAccounts(client);\n }\n};\n","import type { DynamicClient } from '../../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../walletAccount';\n\ntype GetVerifiedCredentialForWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @not-instrumented */\nexport const getVerifiedCredentialForWalletAccount = (\n { walletAccount }: GetVerifiedCredentialForWalletAccountParams,\n client: DynamicClient\n) => {\n return client.user?.verifiedCredentials.find(\n (vc) => vc.id === walletAccount.verifiedCredentialId\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { getWalletProviders } from '../getWalletProviders';\n\ntype GetWalletProviderByKeyParams = {\n walletProviderKey: string;\n};\n\n/** @not-instrumented */\nexport const getWalletProviderByKey = (\n { walletProviderKey }: GetWalletProviderByKeyParams,\n client: DynamicClient\n) => {\n const walletProviders = getWalletProviders(client);\n\n const walletProvider = walletProviders.find(\n (walletProvider) => walletProvider.key === walletProviderKey\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({ walletProviderKey });\n }\n\n return walletProvider;\n};\n"],"mappings":";;;;;;;;AAQA,MAAa,kCAAkC,WAAgC;AAG7E,WACE;EACE,MAAM,EAAE,gBAJW,kBAAkB,OAAO,EAIpB;EACxB,OAAO;EACR,EACD,OACD;;;;;;ACPH,MAAa,2CACX,EAAE,iBACF,WACG;CACH,MAAM,OAAO,QAAQ,OAAO;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,QAAQ,kBAC5C;AAED,KAAI,CAAC,eACH,OAAM,IAAI,2BAA2B,EAAE,mBAAmB,CAAC;AAG7D,QAAO"}
|
|
1
|
+
{"version":3,"file":"getWalletProviderByKey-OC_h7kSB.esm.js","names":["newState: Partial<DynamicCoreState>","walletProvider"],"sources":["../src/modules/wallets/emitWalletAccountsChangedEvent/emitWalletAccountsChangedEvent.ts","../src/modules/auth/updateAuthFromVerifyResponse/checkAndRaiseWalletAccountsChangedEvent/checkAndRaiseWalletAccountsChangedEvent.ts","../src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.ts","../src/modules/wallets/getWalletProviders/getWalletProviders.ts","../src/modules/waas/findWaasWalletProviderByChain/findWaasWalletProviderByChain.ts","../src/modules/waas/isWaasWalletAccount/isWaasWalletAccount.ts","../src/modules/waas/restoreUserSharesForAllWalletAccounts/restoreUserSharesForAllWalletAccounts.ts","../src/modules/auth/decodeJwt/decodeJwt.ts","../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.ts","../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.ts","../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.ts","../src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts","../src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.ts","../src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts"],"sourcesContent":["import type { DynamicClient } from '../../../client/types';\nimport { emitEvent } from '../../clientEvents';\nimport { getWalletAccounts } from '../getWalletAccounts';\n\n/**\n * Emits the `walletAccountsChanged` event.\n * @not-instrumented\n */\nexport const emitWalletAccountsChangedEvent = (client: DynamicClient): void => {\n const walletAccounts = getWalletAccounts(client);\n\n emitEvent(\n {\n args: { walletAccounts },\n event: 'walletAccountsChanged',\n },\n client\n );\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { emitWalletAccountsChangedEvent } from '../../../wallets/emitWalletAccountsChangedEvent';\nimport { getWalletAccountsFromState } from '../../../wallets/getWalletAccounts/getWalletAccountsFromState';\n\ntype CheckAndRaiseWalletAccountsChangedEventParams = {\n previousState: Readonly<DynamicCoreState>;\n};\n\n/** @not-instrumented */\nexport const checkAndRaiseWalletAccountsChangedEvent = (\n { previousState }: CheckAndRaiseWalletAccountsChangedEventParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletAccountsHashBefore = getWalletAccountsHash(previousState, client);\n\n const walletAccountsHashAfter = getWalletAccountsHash(\n core.state.get(),\n client\n );\n\n if (walletAccountsHashBefore !== walletAccountsHashAfter) {\n emitWalletAccountsChangedEvent(client);\n }\n};\n\n \n \nconst getWalletAccountsHash = (\n state: Readonly<DynamicCoreState>,\n client: DynamicClient\n) =>\n getWalletAccountsFromState(state, client)\n .map((walletAccount) => JSON.stringify(walletAccount))\n .sort()\n .join('-');\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user requires additional MFA authentication.\n *\n * This function determines if the current user session requires\n * additional multi-factor authentication to access certain features.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user needs additional MFA authentication, false otherwise.\n * @not-instrumented\n */\nexport const isUserMissingMfaAuth = (client = getDefaultClient()) => {\n const user = client.user;\n\n assertDefined(user, 'User not logged in');\n\n return Boolean(user.scope?.includes('requiresAdditionalAuth'));\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getWalletProviderRegistry } from '../walletProviderRegistry';\n\n/**\n * Get all available wallet providers to interact with internally.\n * @not-instrumented\n */\nexport const getWalletProviders = (client: DynamicClient) => {\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n return walletProviderRegistry.listProviders();\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { Chain } from '../../chain';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype FindWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\n/** @not-instrumented */\nexport const findWaasWalletProviderByChain = (\n { chain }: FindWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider | null => {\n const providers = getWalletProviders(client);\n\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const waasProvider = providers.find(\n (provider) => provider.key === waasProviderKey && provider.chain === chain\n );\n\n if (!waasProvider || !isWaasWalletProvider(waasProvider)) {\n return null;\n }\n\n return waasProvider;\n};\n","import type { WalletAccount } from '../../wallets/walletAccount';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\n\ntype IsWaasWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * This function determines whether the provided wallet account is a Dynamic\n * WaaS wallet account.\n *\n * @param params.walletAccount - The wallet account to check.\n * @returns True if the wallet account is a WaaS wallet account, false otherwise.\n * @not-instrumented\n */\nexport const isWaasWalletAccount = ({\n walletAccount,\n}: IsWaasWalletAccountParams): boolean => {\n return walletAccount.walletProviderKey.includes(\n DYNAMIC_WAAS_METADATA.normalizedWalletName\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { isUserMissingMfaAuth } from '../../mfa/isUserMissingMfaAuth';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain';\nimport { isWaasWalletAccount } from '../isWaasWalletAccount';\n\n/** @not-instrumented */\nexport const restoreUserSharesForAllWalletAccounts = async (\n client: DynamicClient\n) => {\n /**\n * Restoring the user shares will fails if the user is missing the MFA auth.\n * This early return prevents the attempt to restore the user shares to fail\n * when we know it will fails and just add noise to the logs.\n */\n if (isUserMissingMfaAuth(client)) {\n return;\n }\n\n const walletAccounts = getWalletAccounts(client);\n\n const waasWalletAccounts = walletAccounts.filter((walletAccount) =>\n isWaasWalletAccount({ walletAccount })\n );\n\n await Promise.all(\n waasWalletAccounts.map(async (walletAccount) => {\n const provider = findWaasWalletProviderByChain(\n { chain: walletAccount.chain },\n client\n );\n\n /**\n * The environment might not have the embedded wallet extensions installed.\n * In that case there is no provider for the chain and we can skip restoring the user share.\n */\n if (!provider) return;\n\n return provider.restoreUserShareForWalletAccount({ walletAccount });\n })\n );\n};\n","import { InvalidParamError } from '../../../errors/InvalidParamError';\n\nexport type JwtPayload = {\n [key: string]: unknown;\n exp: number;\n iat: number;\n scope: string;\n singleUse?: boolean;\n sub: string;\n};\n\n/**\n * Decodes a JWT token and returns the full payload.\n *\n * This function extracts and returns the complete JWT payload including scopes,\n * expiration time, and other claims.\n *\n * @param jwt - The JWT token string.\n * @returns The decoded JWT payload object.\n * @throws InvalidParamError if the token is invalid or cannot be decoded.\n *\n * @example\n * ```typescript\n * const payload = decodeJwt(jwt);\n * // Returns: { scopes: ['wallet:export'], exp: 1234567890, ... }\n * ```\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const decodeJwt = (jwt: string): JwtPayload => {\n try {\n // JWT format: header.payload.signature\n const parts = jwt.split('.');\n if (parts.length !== 3) {\n throw new InvalidParamError('Invalid JWT format');\n }\n\n // Decode the payload (second part)\n // Base64URL decode: replace URL-safe characters and decode\n const base64Payload = parts[1].replaceAll('-', '+').replaceAll('_', '/');\n // Add padding if needed\n const paddedPayload =\n base64Payload + '='.repeat((4 - (base64Payload.length % 4)) % 4);\n const decodedPayload = atob(paddedPayload);\n const claims = JSON.parse(decodedPayload) as JwtPayload;\n\n return claims;\n } catch (error) {\n if (error instanceof InvalidParamError) {\n throw error;\n }\n throw new InvalidParamError(\n `Failed to decode JWT: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n};\n","/**\n * Normalizes scopes by deduplicating and sorting them.\n * This creates a canonical representation for comparison.\n *\n * @param scopes - Array of scope strings (may contain duplicates)\n * @returns Normalized, sorted array of unique scopes\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const normalizeScopes = (scopes: string[]): string[] => {\n return [...new Set(scopes)].sort((a, b) => a.localeCompare(b));\n};\n","import { decodeJwt } from '../../../decodeJwt';\nimport type { ParsedElevatedAccessToken } from '../elevatedAccessTokens.types';\nimport { normalizeScopes } from '../normalizeScopes';\n\nexport type ParseElevatedAccessTokenOptions = {\n /** JWT string containing the elevated access token. */\n token: string;\n};\n\n/**\n * Validates and parses an elevated access token from a JWT string.\n * Extracts scopes, expiration, and validates the token structure.\n *\n * Policy decisions:\n * - Tokens without scopes are rejected (returns null)\n * - Tokens with empty scopes array are rejected (returns null)\n * - Tokens without exp field are rejected (returns null)\n * - Expired tokens are rejected (returns null)\n *\n * @returns Parsed token data or null if token is invalid/expired\n * @not-instrumented\n */\nexport const parseElevatedAccessToken = ({\n token,\n}: ParseElevatedAccessTokenOptions): ParsedElevatedAccessToken | null => {\n const payload = decodeJwt(token);\n const rawScopeClaim = payload?.scope;\n const processedScopes = rawScopeClaim?.split(' ') ?? [];\n const filteredScopes = processedScopes.filter((s) => s.length > 0);\n const singleUse = payload.singleUse ?? false;\n\n // Reject tokens without scopes or with empty scopes\n if (!filteredScopes || filteredScopes.length === 0) {\n return null;\n }\n\n // Reject tokens without exp field\n if (!payload.exp) {\n return null;\n }\n\n // Convert exp (seconds) to Date (milliseconds)\n const expiresAt = new Date(payload.exp * 1000);\n\n // Reject expired tokens\n if (expiresAt <= new Date()) {\n return null;\n }\n\n return {\n expiresAt,\n normalizedScopes: normalizeScopes(filteredScopes),\n scopes: filteredScopes,\n singleUse,\n token,\n };\n};\n","import type {\n ElevatedAccessToken,\n ParsedElevatedAccessToken,\n} from '../elevatedAccessTokens.types';\nimport { normalizeScopes } from '../normalizeScopes';\n\n/**\n * Upserts an elevated access token into the current tokens array.\n *\n * Policy: Only one token per normalized scope-set is allowed.\n * If a token with the same normalized scopes exists, it is replaced.\n * This ensures we don't accumulate multiple tokens for the same scope combination.\n *\n * @param currentTokens - Current array of elevated access tokens\n * @param newToken - New token to upsert\n * @returns Updated array of tokens with the new token upserted\n * @not-instrumented\n */\nexport const upsertElevatedAccessToken = ({\n currentTokens,\n newToken,\n}: {\n currentTokens: ElevatedAccessToken[];\n newToken: ParsedElevatedAccessToken;\n}): ElevatedAccessToken[] => {\n const newScopeKey = normalizeScopes(newToken.scopes).join(' ');\n\n // Remove any existing token with the same normalized scopes\n const filteredTokens = currentTokens.filter((existingToken) => {\n const existingScopeKey = normalizeScopes(existingToken.scopes).join(' ');\n return existingScopeKey !== newScopeKey;\n });\n\n // Add the new token\n return [\n ...filteredTokens,\n {\n expiresAt: newToken.expiresAt,\n scopes: newToken.scopes,\n singleUse: newToken.singleUse,\n token: newToken.token,\n },\n ];\n};\n","import type { VerifyResponse } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport type { DynamicCoreState } from '../../../client/core/types';\nimport type { DynamicClient } from '../../../client/types';\nimport { setCookie } from '../../../utils/setCookie';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { restoreUserSharesForAllWalletAccounts } from '../../waas/restoreUserSharesForAllWalletAccounts';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport { checkAndRaiseWalletAccountsChangedEvent } from './checkAndRaiseWalletAccountsChangedEvent';\nimport { parseElevatedAccessToken } from './elevatedAccessTokens/parseElevatedAccessToken';\nimport { upsertElevatedAccessToken } from './elevatedAccessTokens/upsertElevatedAccessToken';\n\ntype UpdateAuthFromVerifyResponseParams = {\n response: VerifyResponse;\n};\n\n/** @not-instrumented */\nexport const updateAuthFromVerifyResponse = (\n { response }: UpdateAuthFromVerifyResponseParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const previousState = { ...core.state.get() };\n\n const { user, minifiedJwt, jwt, expiresAt, mfaToken, elevatedAccessToken } =\n response;\n\n // Expires at is in seconds, so we need to convert it to milliseconds\n const sessionExpiresAt = new Date(expiresAt * 1000);\n\n const newState: Partial<DynamicCoreState> = {\n legacyToken: jwt ?? null,\n sessionExpiresAt: sessionExpiresAt,\n token: minifiedJwt ?? null,\n user,\n };\n\n // only override the mfaToken if a new one is provided in the response\n if (mfaToken) {\n newState.mfaToken = mfaToken;\n }\n\n // Add elevated access token to the array if a new one is provided in the response\n // Policy: Only one token per normalized scope-set is allowed (old tokens are replaced)\n // Always preserve existing tokens to ensure they're synced to storage\n const currentTokens = core.state.get().elevatedAccessTokens || [];\n newState.elevatedAccessTokens = currentTokens;\n \n if (elevatedAccessToken) {\n const parsedToken = parseElevatedAccessToken({\n token: elevatedAccessToken,\n });\n if (parsedToken) {\n newState.elevatedAccessTokens = upsertElevatedAccessToken({\n currentTokens,\n newToken: parsedToken,\n });\n }\n }\n\n core.state.set(newState);\n\n /**\n * For customers using a sandbox environment with cookies enabled, we need to set the cookie\n * programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically\n * so customers can access the cookie from document.cookie consistently between sandbox and live environments.\n */\n if (minifiedJwt && isCookieEnabled(client)) {\n const expireDate = sessionExpiresAt.toUTCString();\n\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${expireDate}; path=/; SameSite=Lax`\n );\n }\n\n checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);\n\n // if the user is logging in, we should restore user shares\n // for all wallet accounts for performance reasons\n const isUserLoggingIn = !previousState.user && Boolean(newState.user);\n if (isUserLoggingIn) {\n void restoreUserSharesForAllWalletAccounts(client);\n }\n};\n","import type { DynamicClient } from '../../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../walletAccount';\n\ntype GetVerifiedCredentialForWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @not-instrumented */\nexport const getVerifiedCredentialForWalletAccount = (\n { walletAccount }: GetVerifiedCredentialForWalletAccountParams,\n client: DynamicClient\n) => {\n return client.user?.verifiedCredentials.find(\n (vc) => vc.id === walletAccount.verifiedCredentialId\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { getWalletProviders } from '../getWalletProviders';\n\ntype GetWalletProviderByKeyParams = {\n walletProviderKey: string;\n};\n\n/** @not-instrumented */\nexport const getWalletProviderByKey = (\n { walletProviderKey }: GetWalletProviderByKeyParams,\n client: DynamicClient\n) => {\n const walletProviders = getWalletProviders(client);\n\n const walletProvider = walletProviders.find(\n (walletProvider) => walletProvider.key === walletProviderKey\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({ walletProviderKey });\n }\n\n return walletProvider;\n};\n"],"mappings":";;;;;;;;AAQA,MAAa,kCAAkC,WAAgC;AAG7E,WACE;EACE,MAAM,EAAE,gBAJW,kBAAkB,OAAO,EAIpB;EACxB,OAAO;EACR,EACD,OACD;;;;;;ACPH,MAAa,2CACX,EAAE,iBACF,WACG;CACH,MAAM,OAAO,QAAQ,OAAO;AAS5B,KAPiC,sBAAsB,eAAe,OAAO,KAE7C,sBAC9B,KAAK,MAAM,KAAK,EAChB,OACD,CAGC,gCAA+B,OAAO;;AAM1C,MAAM,yBACJ,OACA,WAEA,2BAA2B,OAAO,OAAO,CACtC,KAAK,kBAAkB,KAAK,UAAU,cAAc,CAAC,CACrD,MAAM,CACN,KAAK,IAAI;;;;;;;;;;;;;;ACxBd,MAAa,wBAAwB,SAAS,kBAAkB,KAAK;CACnE,MAAM,OAAO,OAAO;AAEpB,eAAc,MAAM,qBAAqB;AAEzC,QAAO,QAAQ,KAAK,OAAO,SAAS,yBAAyB,CAAC;;;;;;;;;ACXhE,MAAa,sBAAsB,WAA0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AAK;CAEnD,MAAMA,WAAsC;EAC1C,aAAa,OAAO;EACF;EAClB,OAAO,eAAe;EACtB;EACD;AAGD,KAAI,SACF,UAAS,WAAW;CAMtB,MAAM,gBAAgB,KAAK,MAAM,KAAK,CAAC,wBAAwB,EAAE;AACjE,UAAS,uBAAuB;AAEhC,KAAI,qBAAqB;EACvB,MAAM,cAAc,yBAAyB,EAC3C,OAAO,qBACR,CAAC;AACF,MAAI,YACF,UAAS,uBAAuB,0BAA0B;GACxD;GACA,UAAU;GACX,CAAC;;AAIN,MAAK,MAAM,IAAI,SAAS;;;;;;AAOxB,KAAI,eAAe,gBAAgB,OAAO,CAGxC,WACE,GAAG,yBAAyB,GAAG,YAAY,YAH1B,iBAAiB,aAAa,CAGmB,wBACnE;AAGH,yCAAwC,EAAE,eAAe,EAAE,OAAO;AAKlE,KADwB,CAAC,cAAc,QAAQ,QAAQ,SAAS,KAAK,CAEnE,CAAK,sCAAsC,OAAO;;;;;;AC3EtD,MAAa,yCACX,EAAE,iBACF,WACG;AACH,QAAO,OAAO,MAAM,oBAAoB,MACrC,OAAO,GAAG,OAAO,cAAc,qBACjC;;;;;;ACLH,MAAa,0BACX,EAAE,qBACF,WACG;CAGH,MAAM,iBAFkB,mBAAmB,OAAO,CAEX,MACpC,qBAAmBC,iBAAe,QAAQ,kBAC5C;AAED,KAAI,CAAC,eACH,OAAM,IAAI,2BAA2B,EAAE,mBAAmB,CAAC;AAG7D,QAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
2
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
3
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
4
|
-
const require_getWalletProviderByKey = require('./getWalletProviderByKey-
|
|
5
|
-
const require_refreshAuth = require('./refreshAuth-
|
|
6
|
-
const
|
|
1
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-DSo1ysdD.cjs');
|
|
2
|
+
const require_InvalidParamError = require('./InvalidParamError-Bgg4SDfm.cjs');
|
|
3
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-Afx6InoJ.cjs');
|
|
4
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-DRex9vzR.cjs');
|
|
5
|
+
const require_refreshAuth = require('./refreshAuth-Ca_JABru.cjs');
|
|
6
|
+
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-CEVTY3gQ.cjs');
|
|
7
|
+
const require_preconnectWaasIframe = require('./preconnectWaasIframe-Cb9xM6kI.cjs');
|
|
7
8
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
8
9
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
9
10
|
let zod_mini = require("zod/mini");
|
|
@@ -2111,6 +2112,7 @@ const processSocialCallback = async ({ url, requestedScopes }, client) => {
|
|
|
2111
2112
|
if (storedSocialRedirectState.state !== dynamicOauthState) throw new InvalidRedirectStorageStateError();
|
|
2112
2113
|
const { provider, codeVerifier } = storedSocialRedirectState;
|
|
2113
2114
|
await core.storage.removeItem(redirectStateStorageKeySchema);
|
|
2115
|
+
require_preconnectWaasIframe.preconnectWaasIframe(client);
|
|
2114
2116
|
let response;
|
|
2115
2117
|
if (client.user) response = await apiClient.oauthVerify({
|
|
2116
2118
|
environmentId: core.environmentId,
|
|
@@ -2500,6 +2502,8 @@ const withCheckoutSessionTokenCleanupOn401 = async ({ call, transactionId }, cli
|
|
|
2500
2502
|
* exchange source record. The response includes `exchangeSource.metadata.url`
|
|
2501
2503
|
* which can be embedded in an iframe for the user to complete payment.
|
|
2502
2504
|
*
|
|
2505
|
+
* @deprecated Use {@link attachFlowSource} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2506
|
+
*
|
|
2503
2507
|
* @param params AttachCheckoutTransactionSourceParams - The source details to attach.
|
|
2504
2508
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2505
2509
|
* @returns The updated checkout transaction (with exchangeSource if sourceType is 'exchange')
|
|
@@ -2547,6 +2551,8 @@ const __attachCheckoutTransactionSource_wrapped = require_InvalidParamError.inst
|
|
|
2547
2551
|
* For exchange sources, `txHash` can be omitted — the user confirms
|
|
2548
2552
|
* they completed the payment and the transaction moves to `broadcasted`.
|
|
2549
2553
|
*
|
|
2554
|
+
* @deprecated Use {@link broadcastFlow} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2555
|
+
*
|
|
2550
2556
|
* @param params BroadcastCheckoutTransactionParams - The transaction ID and optional tx hash.
|
|
2551
2557
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2552
2558
|
* @returns The updated checkout transaction
|
|
@@ -2582,6 +2588,8 @@ const __broadcastCheckoutTransaction_wrapped = require_InvalidParamError.instrum
|
|
|
2582
2588
|
/**
|
|
2583
2589
|
* Cancels a checkout transaction before it has been broadcasted
|
|
2584
2590
|
*
|
|
2591
|
+
* @deprecated Use {@link cancelFlow} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2592
|
+
*
|
|
2585
2593
|
* @param params CancelCheckoutTransactionParams - The transaction to cancel.
|
|
2586
2594
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2587
2595
|
* @returns The cancelled checkout transaction
|
|
@@ -2627,6 +2635,8 @@ const getCheckouts = async (client) => {
|
|
|
2627
2635
|
/**
|
|
2628
2636
|
* Creates a new checkout transaction and stores the session token for subsequent calls
|
|
2629
2637
|
*
|
|
2638
|
+
* @deprecated Use the Flow API instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2639
|
+
*
|
|
2630
2640
|
* @param params CreateCheckoutTransactionParams - The parameters for the checkout transaction.
|
|
2631
2641
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2632
2642
|
* @returns The created transaction with session token
|
|
@@ -2673,6 +2683,8 @@ const __createCheckoutTransaction_wrapped = require_InvalidParamError.instrument
|
|
|
2673
2683
|
/**
|
|
2674
2684
|
* Fetches the current state of a checkout transaction
|
|
2675
2685
|
*
|
|
2686
|
+
* @deprecated Use {@link getFlow} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2687
|
+
*
|
|
2676
2688
|
* @param params GetCheckoutTransactionParams - The parameters for fetching the transaction.
|
|
2677
2689
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2678
2690
|
* @returns The checkout transaction
|
|
@@ -2691,6 +2703,8 @@ const getCheckoutTransaction = async ({ transactionId }, client = require_Invali
|
|
|
2691
2703
|
/**
|
|
2692
2704
|
* Fetches a quote for a checkout transaction
|
|
2693
2705
|
*
|
|
2706
|
+
* @deprecated Use {@link getFlowQuote} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2707
|
+
*
|
|
2694
2708
|
* @param params GetCheckoutTransactionQuoteParams - The quote parameters.
|
|
2695
2709
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2696
2710
|
* @returns The updated checkout transaction with quote data
|
|
@@ -2720,6 +2734,8 @@ const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slip
|
|
|
2720
2734
|
* This should be called immediately before triggering the transaction signing.
|
|
2721
2735
|
* It will confirm the quote is still valid, the risk state is cleared, and the transaction is ready to be signed.
|
|
2722
2736
|
*
|
|
2737
|
+
* @deprecated Use {@link prepareFlowSigning} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2738
|
+
*
|
|
2723
2739
|
* @param params PrepareCheckoutTransactionParams - The transaction to prepare.
|
|
2724
2740
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2725
2741
|
* @returns The updated checkout transaction
|
|
@@ -2867,6 +2883,8 @@ const __executeSwapTransaction_wrapped = require_InvalidParamError.instrumentFun
|
|
|
2867
2883
|
* 3. Delegates on-chain signing to the wallet provider's executeSwapTransaction method
|
|
2868
2884
|
* 4. Calls broadcastCheckoutTransaction with the resulting txHash
|
|
2869
2885
|
*
|
|
2886
|
+
* @deprecated Use {@link submitFlowTransaction} instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2887
|
+
*
|
|
2870
2888
|
* @param params SubmitCheckoutTransactionParams - The transaction ID, wallet account, and optional step callback.
|
|
2871
2889
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2872
2890
|
* @returns The broadcasted checkout transaction
|
|
@@ -2918,6 +2936,8 @@ const __submitCheckoutTransaction_wrapped = require_InvalidParamError.instrument
|
|
|
2918
2936
|
* the realtime checkout transaction channel. Will be re-enabled once the
|
|
2919
2937
|
* dashboard-api environment has the Ably wiring in place.
|
|
2920
2938
|
*
|
|
2939
|
+
* @deprecated Use the Flow API instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2940
|
+
*
|
|
2921
2941
|
* @param params.transactionId - The ID of the checkout transaction to track.
|
|
2922
2942
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2923
2943
|
* @not-instrumented
|
|
@@ -2937,6 +2957,8 @@ const trackCheckoutTransaction = (_params, client = require_InvalidParamError.ge
|
|
|
2937
2957
|
* Returns `false` when the from token already matches a settlement token, so no
|
|
2938
2958
|
* conversion is needed.
|
|
2939
2959
|
*
|
|
2960
|
+
* @deprecated Use the Flow API instead. See https://www.dynamic.xyz/docs/javascript/reference/flow-getting-started
|
|
2961
|
+
*
|
|
2940
2962
|
* @param params - The from token details and the checkout's settlement config.
|
|
2941
2963
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2942
2964
|
* @returns Whether a token conversion is required
|
|
@@ -4832,7 +4854,9 @@ const __setDefaultMfaDevice_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
4832
4854
|
*/
|
|
4833
4855
|
const sendEmailOTP = async ({ email }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4834
4856
|
const core = require_InvalidParamError.getCore(client);
|
|
4835
|
-
const
|
|
4857
|
+
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
4858
|
+
require_preconnectWaasIframe.preconnectWaasIframe(client);
|
|
4859
|
+
const { verificationUUID } = await apiClient.createEmailVerification({
|
|
4836
4860
|
emailVerificationCreateRequest: {
|
|
4837
4861
|
captchaToken: require_getNetworkProviderFromNetworkId.consumeCaptchaToken(client),
|
|
4838
4862
|
email
|
|
@@ -5795,6 +5819,7 @@ const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client = require_Inva
|
|
|
5795
5819
|
const core = require_InvalidParamError.getCore(client);
|
|
5796
5820
|
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
5797
5821
|
const phoneCountryCode = supportedCountries[isoCountryCode].code;
|
|
5822
|
+
require_preconnectWaasIframe.preconnectWaasIframe(client);
|
|
5798
5823
|
const { verificationUUID } = await apiClient.createSmsVerification({
|
|
5799
5824
|
environmentId: core.environmentId,
|
|
5800
5825
|
smsVerificationCreateRequest: {
|
|
@@ -5882,6 +5907,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
5882
5907
|
* @redact-params
|
|
5883
5908
|
*/
|
|
5884
5909
|
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
5910
|
+
require_preconnectWaasIframe.preconnectWaasIframe(client);
|
|
5885
5911
|
let response;
|
|
5886
5912
|
if (client.user) response = await verifyOTPForUserUpdate({
|
|
5887
5913
|
otpVerification,
|
|
@@ -8421,7 +8447,7 @@ exports.NoNetworkProvidersError = require_getNetworkProviderFromNetworkId.NoNetw
|
|
|
8421
8447
|
exports.NoPasskeyCredentialsFoundError = NoPasskeyCredentialsFoundError;
|
|
8422
8448
|
exports.NoSmartWalletAccountSignerFoundError = NoSmartWalletAccountSignerFoundError;
|
|
8423
8449
|
exports.NoWebAuthNSupportError = NoWebAuthNSupportError;
|
|
8424
|
-
exports.NotWaasWalletAccountError =
|
|
8450
|
+
exports.NotWaasWalletAccountError = require_isDynamicWaasEnabled.NotWaasWalletAccountError;
|
|
8425
8451
|
exports.SandboxMaximumThresholdReachedError = require_InvalidParamError.SandboxMaximumThresholdReachedError;
|
|
8426
8452
|
exports.SimulationFailedError = SimulationFailedError;
|
|
8427
8453
|
exports.TokenSwapError = TokenSwapError;
|