@dynamic-labs-sdk/client 1.17.1 → 1.19.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.
Files changed (319) hide show
  1. package/dist/client/createDynamicClient/createDynamicClient.d.ts +11 -1
  2. package/dist/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
  3. package/dist/client/defaultClient/defaultClient.d.ts +12 -1
  4. package/dist/client/defaultClient/defaultClient.d.ts.map +1 -1
  5. package/dist/core.cjs +7 -5
  6. package/dist/core.cjs.map +1 -1
  7. package/dist/core.esm.js +6 -6
  8. package/dist/core.esm.js.map +1 -1
  9. package/dist/core.native.esm.js +6 -6
  10. package/dist/core.native.esm.js.map +1 -1
  11. package/dist/errors/APIError/APIError.d.ts +11 -1
  12. package/dist/errors/APIError/APIError.d.ts.map +1 -1
  13. package/dist/errors/DeviceRegistrationIdentityMismatchError.d.ts +26 -0
  14. package/dist/errors/DeviceRegistrationIdentityMismatchError.d.ts.map +1 -0
  15. package/dist/errors/MergeAccountsConfirmationError.d.ts +49 -0
  16. package/dist/errors/MergeAccountsConfirmationError.d.ts.map +1 -0
  17. package/dist/errors/UnsafeDeeplinkUrlError.d.ts +17 -0
  18. package/dist/errors/UnsafeDeeplinkUrlError.d.ts.map +1 -0
  19. package/dist/errors/UnsafeNavigationUrlError.d.ts +16 -0
  20. package/dist/errors/UnsafeNavigationUrlError.d.ts.map +1 -0
  21. package/dist/errors/WalletScreeningBlockedError.d.ts +27 -0
  22. package/dist/errors/WalletScreeningBlockedError.d.ts.map +1 -0
  23. package/dist/exports/core.d.ts +4 -0
  24. package/dist/exports/core.d.ts.map +1 -1
  25. package/dist/exports/index.d.ts +18 -3
  26. package/dist/exports/index.d.ts.map +1 -1
  27. package/dist/exports/waas.d.ts +2 -0
  28. package/dist/exports/waas.d.ts.map +1 -1
  29. package/dist/{getNetworkProviderFromNetworkId-CS4r9hi7.cjs → getNetworkProviderFromNetworkId-BJX2AMGR.cjs} +190 -19
  30. package/dist/getNetworkProviderFromNetworkId-BJX2AMGR.cjs.map +1 -0
  31. package/dist/{getNetworkProviderFromNetworkId-Bfg-NkNJ.native.esm.js → getNetworkProviderFromNetworkId-Bsv12Q6B.native.esm.js} +165 -10
  32. package/dist/getNetworkProviderFromNetworkId-Bsv12Q6B.native.esm.js.map +1 -0
  33. package/dist/{getNetworkProviderFromNetworkId-pknqqhk1.esm.js → getNetworkProviderFromNetworkId-D3uwhdMN.esm.js} +166 -19
  34. package/dist/getNetworkProviderFromNetworkId-D3uwhdMN.esm.js.map +1 -0
  35. package/dist/{getSignedSessionId-cMGkmojJ.cjs → getSignedSessionId-BIZJGg61.cjs} +3 -3
  36. package/dist/{getSignedSessionId-cMGkmojJ.cjs.map → getSignedSessionId-BIZJGg61.cjs.map} +1 -1
  37. package/dist/{getSignedSessionId-CUw7LJ35.esm.js → getSignedSessionId-CnSAMO3P.esm.js} +3 -3
  38. package/dist/{getSignedSessionId-CUw7LJ35.esm.js.map → getSignedSessionId-CnSAMO3P.esm.js.map} +1 -1
  39. package/dist/{getSignedSessionId-Cl3PEqa8.native.esm.js → getSignedSessionId-DXDi7NkE.native.esm.js} +3 -3
  40. package/dist/{getSignedSessionId-Cl3PEqa8.native.esm.js.map → getSignedSessionId-DXDi7NkE.native.esm.js.map} +1 -1
  41. package/dist/{getWalletProviderByKey-CP9Te5Sz.cjs → getWalletProviderByKey-C6aS7KgD.cjs} +2 -2
  42. package/dist/{getWalletProviderByKey-CP9Te5Sz.cjs.map → getWalletProviderByKey-C6aS7KgD.cjs.map} +1 -1
  43. package/dist/{getWalletProviderByKey-lQVfIGFi.esm.js → getWalletProviderByKey-Cr8m-Nax.esm.js} +2 -2
  44. package/dist/{getWalletProviderByKey-lQVfIGFi.esm.js.map → getWalletProviderByKey-Cr8m-Nax.esm.js.map} +1 -1
  45. package/dist/{getWalletProviderByKey-24co0tBE.native.esm.js → getWalletProviderByKey-DVk2t98D.native.esm.js} +2 -2
  46. package/dist/{getWalletProviderByKey-24co0tBE.native.esm.js.map → getWalletProviderByKey-DVk2t98D.native.esm.js.map} +1 -1
  47. package/dist/index.cjs +950 -111
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.esm.js +940 -112
  50. package/dist/index.esm.js.map +1 -1
  51. package/dist/index.native.esm.js +867 -111
  52. package/dist/index.native.esm.js.map +1 -1
  53. package/dist/{isDynamicWaasEnabled-BwP1oowd.cjs → isDynamicWaasEnabled-BawttOeb.cjs} +21 -9
  54. package/dist/isDynamicWaasEnabled-BawttOeb.cjs.map +1 -0
  55. package/dist/{isDynamicWaasEnabled-BYaqAOml.esm.js → isDynamicWaasEnabled-DDrg89y1.esm.js} +20 -8
  56. package/dist/isDynamicWaasEnabled-DDrg89y1.esm.js.map +1 -0
  57. package/dist/{isDynamicWaasEnabled-BXe0VyI4.native.esm.js → isDynamicWaasEnabled-Dj_sLoBO.native.esm.js} +20 -8
  58. package/dist/isDynamicWaasEnabled-Dj_sLoBO.native.esm.js.map +1 -0
  59. package/dist/{isMfaRequiredForAction-Btejc5g3.cjs → isMfaRequiredForAction-BuvyBN_r.cjs} +21 -6
  60. package/dist/isMfaRequiredForAction-BuvyBN_r.cjs.map +1 -0
  61. package/dist/{isMfaRequiredForAction-CqEcCTIe.esm.js → isMfaRequiredForAction-DTp4CZBt.esm.js} +21 -6
  62. package/dist/isMfaRequiredForAction-DTp4CZBt.esm.js.map +1 -0
  63. package/dist/{isMfaRequiredForAction-Demz9zlH.native.esm.js → isMfaRequiredForAction-EY-OQORc.native.esm.js} +3 -5
  64. package/dist/isMfaRequiredForAction-EY-OQORc.native.esm.js.map +1 -0
  65. package/dist/{isUserOnboardingComplete-C86NDY7I.cjs → isUserOnboardingComplete-CkyzRYrg.cjs} +14 -4
  66. package/dist/isUserOnboardingComplete-CkyzRYrg.cjs.map +1 -0
  67. package/dist/{isUserOnboardingComplete-CBrAH0ZF.esm.js → isUserOnboardingComplete-D3HrBYje.native.esm.js} +13 -3
  68. package/dist/isUserOnboardingComplete-D3HrBYje.native.esm.js.map +1 -0
  69. package/dist/{isUserOnboardingComplete-Cr-YTpcU.native.esm.js → isUserOnboardingComplete-Dy2Ygp0u.esm.js} +13 -3
  70. package/dist/isUserOnboardingComplete-Dy2Ygp0u.esm.js.map +1 -0
  71. package/dist/{migrateFromFireblocks-D-J6-gRo.native.esm.js → migrateFromFireblocks-B5qWGLCM.native.esm.js} +3 -3
  72. package/dist/{migrateFromFireblocks-D-J6-gRo.native.esm.js.map → migrateFromFireblocks-B5qWGLCM.native.esm.js.map} +1 -1
  73. package/dist/{migrateFromFireblocks-B_q8Oawb.cjs → migrateFromFireblocks-Dp-QA9hi.cjs} +3 -3
  74. package/dist/{migrateFromFireblocks-B_q8Oawb.cjs.map → migrateFromFireblocks-Dp-QA9hi.cjs.map} +1 -1
  75. package/dist/{migrateFromFireblocks-Bbx2wHZD.esm.js → migrateFromFireblocks-MAatsk_w.esm.js} +3 -3
  76. package/dist/{migrateFromFireblocks-Bbx2wHZD.esm.js.map → migrateFromFireblocks-MAatsk_w.esm.js.map} +1 -1
  77. package/dist/modules/apiClient/constants.d.ts +8 -0
  78. package/dist/modules/apiClient/constants.d.ts.map +1 -1
  79. package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
  80. package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts +0 -1
  81. package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts.map +1 -1
  82. package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts +11 -2
  83. package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts.map +1 -1
  84. package/dist/modules/auth/isSignedIn/isSignedIn.d.ts +9 -0
  85. package/dist/modules/auth/isSignedIn/isSignedIn.d.ts.map +1 -1
  86. package/dist/modules/auth/logout/logout.d.ts +13 -0
  87. package/dist/modules/auth/logout/logout.d.ts.map +1 -1
  88. package/dist/modules/auth/logoutWithReason/logoutWithReason.d.ts.map +1 -1
  89. package/dist/modules/auth/mergeUserAccounts/index.d.ts +3 -0
  90. package/dist/modules/auth/mergeUserAccounts/index.d.ts.map +1 -0
  91. package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts +62 -0
  92. package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts.map +1 -0
  93. package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.types.d.ts +78 -0
  94. package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.types.d.ts.map +1 -0
  95. package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +7 -1
  96. package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
  97. package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +9 -1
  98. package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
  99. package/dist/modules/auth/social/oauth/authenticateWithSocial/authenticateWithSocial.d.ts +8 -0
  100. package/dist/modules/auth/social/oauth/authenticateWithSocial/authenticateWithSocial.d.ts.map +1 -1
  101. package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts +34 -0
  102. package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts.map +1 -0
  103. package/dist/modules/auth/social/oauth/clearSocialRedirectParams/index.d.ts +2 -0
  104. package/dist/modules/auth/social/oauth/clearSocialRedirectParams/index.d.ts.map +1 -0
  105. package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts +11 -0
  106. package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts.map +1 -1
  107. package/dist/modules/auth/social/oauth/detectSocialRedirectUrl/detectSocialRedirectUrl.d.ts +0 -1
  108. package/dist/modules/auth/social/oauth/detectSocialRedirectUrl/detectSocialRedirectUrl.d.ts.map +1 -1
  109. package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.d.ts +12 -0
  110. package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.d.ts.map +1 -1
  111. package/dist/modules/auth/social/oauth/signInWithSocialRedirect/buildOAuthUrl/getOAuthBaseUrl/getOAuthBaseUrl.d.ts.map +1 -1
  112. package/dist/modules/auth/social/oauth/signInWithSocialRedirect/signInWithSocialRedirect.d.ts +10 -0
  113. package/dist/modules/auth/social/oauth/signInWithSocialRedirect/signInWithSocialRedirect.d.ts.map +1 -1
  114. package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts +0 -1
  115. package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -1
  116. package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
  117. package/dist/modules/captcha/CaptchaProviderEnum/CaptchaProviderEnum.d.ts +37 -0
  118. package/dist/modules/captcha/CaptchaProviderEnum/CaptchaProviderEnum.d.ts.map +1 -0
  119. package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.d.ts +50 -0
  120. package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.d.ts.map +1 -0
  121. package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.types.d.ts +22 -0
  122. package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.types.d.ts.map +1 -0
  123. package/dist/modules/captcha/getCaptchaSettings/index.d.ts +3 -0
  124. package/dist/modules/captcha/getCaptchaSettings/index.d.ts.map +1 -0
  125. package/dist/modules/captcha/isCaptchaRequired/isCaptchaRequired.d.ts.map +1 -1
  126. package/dist/modules/captcha/setCaptchaToken/setCaptchaToken.d.ts +0 -1
  127. package/dist/modules/captcha/setCaptchaToken/setCaptchaToken.d.ts.map +1 -1
  128. package/dist/modules/clientEvents/clientEvents.d.ts +34 -0
  129. package/dist/modules/clientEvents/clientEvents.d.ts.map +1 -1
  130. package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/clearDeviceRegistrationRedirectParams.d.ts +35 -0
  131. package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/clearDeviceRegistrationRedirectParams.d.ts.map +1 -0
  132. package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/index.d.ts +2 -0
  133. package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/index.d.ts.map +1 -0
  134. package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts +8 -1
  135. package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts.map +1 -1
  136. package/dist/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.d.ts +1 -0
  137. package/dist/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.d.ts.map +1 -1
  138. package/dist/modules/flow/attachFlowSource/attachFlowSource.instrumentation.d.ts +9 -0
  139. package/dist/modules/flow/attachFlowSource/attachFlowSource.instrumentation.d.ts.map +1 -0
  140. package/dist/modules/flow/broadcastFlow/broadcastFlow.instrumentation.d.ts +9 -0
  141. package/dist/modules/flow/broadcastFlow/broadcastFlow.instrumentation.d.ts.map +1 -0
  142. package/dist/modules/flow/cancelFlow/cancelFlow.d.ts +10 -3
  143. package/dist/modules/flow/cancelFlow/cancelFlow.d.ts.map +1 -1
  144. package/dist/modules/flow/cancelFlow/cancelFlow.instrumentation.d.ts +8 -0
  145. package/dist/modules/flow/cancelFlow/cancelFlow.instrumentation.d.ts.map +1 -0
  146. package/dist/modules/flow/getFlow/getFlow.d.ts +11 -3
  147. package/dist/modules/flow/getFlow/getFlow.d.ts.map +1 -1
  148. package/dist/modules/flow/getFlowQuote/getFlowQuote.d.ts +16 -3
  149. package/dist/modules/flow/getFlowQuote/getFlowQuote.d.ts.map +1 -1
  150. package/dist/modules/flow/prepareFlowSigning/prepareFlowSigning.instrumentation.d.ts +9 -0
  151. package/dist/modules/flow/prepareFlowSigning/prepareFlowSigning.instrumentation.d.ts.map +1 -0
  152. package/dist/modules/flow/submitFlowTransaction/submitFlowTransaction.instrumentation.d.ts +9 -0
  153. package/dist/modules/flow/submitFlowTransaction/submitFlowTransaction.instrumentation.d.ts.map +1 -0
  154. package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts +0 -4
  155. package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts.map +1 -1
  156. package/dist/modules/initializeClient/initializeClient.d.ts +16 -0
  157. package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
  158. package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts +12 -2
  159. package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts.map +1 -1
  160. package/dist/modules/mfa/consumeMfaToken/consumeMfaToken.d.ts +0 -1
  161. package/dist/modules/mfa/consumeMfaToken/consumeMfaToken.d.ts.map +1 -1
  162. package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts +0 -1
  163. package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts.map +1 -1
  164. package/dist/modules/mfa/isPendingRecoveryCodesAcknowledgment/isPendingRecoveryCodesAcknowledgment.d.ts +1 -0
  165. package/dist/modules/mfa/isPendingRecoveryCodesAcknowledgment/isPendingRecoveryCodesAcknowledgment.d.ts.map +1 -1
  166. package/dist/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.d.ts +1 -0
  167. package/dist/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.d.ts.map +1 -1
  168. package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts +0 -3
  169. package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts.map +1 -1
  170. package/dist/modules/otp/sendEmailOTP/sendEmailOTP.d.ts +14 -1
  171. package/dist/modules/otp/sendEmailOTP/sendEmailOTP.d.ts.map +1 -1
  172. package/dist/modules/otp/sendSmsOTP/sendSmsOTP.d.ts +12 -1
  173. package/dist/modules/otp/sendSmsOTP/sendSmsOTP.d.ts.map +1 -1
  174. package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +33 -2
  175. package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
  176. package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts +1 -1
  177. package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts.map +1 -1
  178. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +8 -0
  179. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
  180. package/dist/modules/user/checkUserScopes/checkUserScopes.d.ts +28 -0
  181. package/dist/modules/user/checkUserScopes/checkUserScopes.d.ts.map +1 -0
  182. package/dist/modules/user/checkUserScopes/index.d.ts +2 -0
  183. package/dist/modules/user/checkUserScopes/index.d.ts.map +1 -0
  184. package/dist/modules/user/deleteUser/deleteUser.d.ts +8 -0
  185. package/dist/modules/user/deleteUser/deleteUser.d.ts.map +1 -1
  186. package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts +9 -1
  187. package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts.map +1 -1
  188. package/dist/modules/user/refreshAuth/refreshAuth.d.ts +17 -4
  189. package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
  190. package/dist/modules/user/refreshUser/refreshUser.d.ts +16 -3
  191. package/dist/modules/user/refreshUser/refreshUser.d.ts.map +1 -1
  192. package/dist/modules/user/updateUser/updateUser.d.ts +0 -1
  193. package/dist/modules/user/updateUser/updateUser.d.ts.map +1 -1
  194. package/dist/modules/user/user.types.d.ts +9 -1
  195. package/dist/modules/user/user.types.d.ts.map +1 -1
  196. package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.d.ts +30 -0
  197. package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.d.ts.map +1 -0
  198. package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/index.d.ts +2 -0
  199. package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/index.d.ts.map +1 -0
  200. package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.d.ts +23 -0
  201. package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.d.ts.map +1 -0
  202. package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/index.d.ts +2 -0
  203. package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/index.d.ts.map +1 -0
  204. package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts +11 -1
  205. package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts.map +1 -1
  206. package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts +11 -3
  207. package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts.map +1 -1
  208. package/dist/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.d.ts +16 -3
  209. package/dist/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.d.ts.map +1 -1
  210. package/dist/modules/wallets/getConnectedAddresses/getConnectedAddresses.d.ts +9 -1
  211. package/dist/modules/wallets/getConnectedAddresses/getConnectedAddresses.d.ts.map +1 -1
  212. package/dist/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts +11 -1
  213. package/dist/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts.map +1 -1
  214. package/dist/modules/wallets/getWalletProviderDataByKey/getWalletProviderDataByKey.d.ts +2 -1
  215. package/dist/modules/wallets/getWalletProviderDataByKey/getWalletProviderDataByKey.d.ts.map +1 -1
  216. package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts +9 -0
  217. package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts.map +1 -1
  218. package/dist/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.d.ts +10 -2
  219. package/dist/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.d.ts.map +1 -1
  220. package/dist/modules/wallets/networks/getBalance/getBalance.d.ts +8 -0
  221. package/dist/modules/wallets/networks/getBalance/getBalance.d.ts.map +1 -1
  222. package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts +8 -0
  223. package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts.map +1 -1
  224. package/dist/modules/wallets/networks/switchActiveNetwork/switchActiveNetwork.d.ts +11 -1
  225. package/dist/modules/wallets/networks/switchActiveNetwork/switchActiveNetwork.d.ts.map +1 -1
  226. package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts +10 -0
  227. package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts.map +1 -1
  228. package/dist/modules/wallets/removeWalletAccount/removeWalletAccount.d.ts +9 -1
  229. package/dist/modules/wallets/removeWalletAccount/removeWalletAccount.d.ts.map +1 -1
  230. package/dist/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts +24 -0
  231. package/dist/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts.map +1 -0
  232. package/dist/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/index.d.ts.map +1 -0
  233. package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/getSelectedWalletAccount.d.ts +30 -0
  234. package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/getSelectedWalletAccount.d.ts.map +1 -0
  235. package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/index.d.ts +2 -0
  236. package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/index.d.ts.map +1 -0
  237. package/dist/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/index.d.ts.map +1 -0
  238. package/dist/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts +28 -0
  239. package/dist/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts.map +1 -0
  240. package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/index.d.ts +2 -0
  241. package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/index.d.ts.map +1 -0
  242. package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/setSelectedWalletAccount.d.ts +34 -0
  243. package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/setSelectedWalletAccount.d.ts.map +1 -0
  244. package/dist/modules/wallets/signMessage/signMessage.d.ts +12 -1
  245. package/dist/modules/wallets/signMessage/signMessage.d.ts.map +1 -1
  246. package/dist/modules/wallets/transferAmount/transferAmount.d.ts +13 -2
  247. package/dist/modules/wallets/transferAmount/transferAmount.d.ts.map +1 -1
  248. package/dist/modules/wallets/transferWalletAccount/transferWalletAccount.d.ts +10 -1
  249. package/dist/modules/wallets/transferWalletAccount/transferWalletAccount.d.ts.map +1 -1
  250. package/dist/modules/wallets/utils/getWalletAccountFromAddress/getWalletAccountFromAddress.d.ts +11 -1
  251. package/dist/modules/wallets/utils/getWalletAccountFromAddress/getWalletAccountFromAddress.d.ts.map +1 -1
  252. package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts +3 -0
  253. package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts.map +1 -1
  254. package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts +12 -1
  255. package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts.map +1 -1
  256. package/dist/services/instrumentation/createInstrumentation/createInstrumentation.d.ts.map +1 -1
  257. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts +40 -34
  258. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts.map +1 -1
  259. package/dist/services/instrumentation/instrumentation.types.d.ts +50 -19
  260. package/dist/services/instrumentation/instrumentation.types.d.ts.map +1 -1
  261. package/dist/services/keychain/createKeychainService/createKeychainService.d.ts.map +1 -1
  262. package/dist/services/navigate/createNavigationHandler/createNavigationHandler.d.ts.map +1 -1
  263. package/dist/services/openDeeplink/createWebDeeplinkOpener/createWebDeeplinkOpener.d.ts.map +1 -1
  264. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  265. package/dist/{updateAuthFromVerifyResponse-D1w-Aw9P.native.esm.js → updateAuthFromVerifyResponse-DFjqCSu2.native.esm.js} +235 -159
  266. package/dist/updateAuthFromVerifyResponse-DFjqCSu2.native.esm.js.map +1 -0
  267. package/dist/{updateAuthFromVerifyResponse-azIi_3FB.esm.js → updateAuthFromVerifyResponse-_oYRLK_w.esm.js} +235 -159
  268. package/dist/updateAuthFromVerifyResponse-_oYRLK_w.esm.js.map +1 -0
  269. package/dist/{updateAuthFromVerifyResponse-CElYpi97.cjs → updateAuthFromVerifyResponse-pgYXvDvj.cjs} +241 -159
  270. package/dist/updateAuthFromVerifyResponse-pgYXvDvj.cjs.map +1 -0
  271. package/dist/utils/assertSafeDeeplinkUrl/assertSafeDeeplinkUrl.d.ts +12 -0
  272. package/dist/utils/assertSafeDeeplinkUrl/assertSafeDeeplinkUrl.d.ts.map +1 -0
  273. package/dist/utils/assertSafeDeeplinkUrl/index.d.ts +2 -0
  274. package/dist/utils/assertSafeDeeplinkUrl/index.d.ts.map +1 -0
  275. package/dist/utils/assertSafeNavigationUrl/assertSafeNavigationUrl.d.ts +12 -0
  276. package/dist/utils/assertSafeNavigationUrl/assertSafeNavigationUrl.d.ts.map +1 -0
  277. package/dist/utils/assertSafeNavigationUrl/index.d.ts +2 -0
  278. package/dist/utils/assertSafeNavigationUrl/index.d.ts.map +1 -0
  279. package/dist/utils/getSecureCookieAttribute/getSecureCookieAttribute.d.ts +18 -0
  280. package/dist/utils/getSecureCookieAttribute/getSecureCookieAttribute.d.ts.map +1 -0
  281. package/dist/utils/getSecureCookieAttribute/index.d.ts +2 -0
  282. package/dist/utils/getSecureCookieAttribute/index.d.ts.map +1 -0
  283. package/dist/waas.cjs +72 -5
  284. package/dist/waas.cjs.map +1 -1
  285. package/dist/waas.esm.js +70 -5
  286. package/dist/waas.esm.js.map +1 -1
  287. package/dist/waas.native.esm.js +70 -5
  288. package/dist/waas.native.esm.js.map +1 -1
  289. package/dist/waasCore.cjs +6 -6
  290. package/dist/waasCore.esm.js +6 -6
  291. package/dist/waasCore.native.esm.js +6 -6
  292. package/package.json +3 -3
  293. package/dist/getNetworkProviderFromNetworkId-Bfg-NkNJ.native.esm.js.map +0 -1
  294. package/dist/getNetworkProviderFromNetworkId-CS4r9hi7.cjs.map +0 -1
  295. package/dist/getNetworkProviderFromNetworkId-pknqqhk1.esm.js.map +0 -1
  296. package/dist/isDynamicWaasEnabled-BXe0VyI4.native.esm.js.map +0 -1
  297. package/dist/isDynamicWaasEnabled-BYaqAOml.esm.js.map +0 -1
  298. package/dist/isDynamicWaasEnabled-BwP1oowd.cjs.map +0 -1
  299. package/dist/isMfaRequiredForAction-Btejc5g3.cjs.map +0 -1
  300. package/dist/isMfaRequiredForAction-CqEcCTIe.esm.js.map +0 -1
  301. package/dist/isMfaRequiredForAction-Demz9zlH.native.esm.js.map +0 -1
  302. package/dist/isUserOnboardingComplete-C86NDY7I.cjs.map +0 -1
  303. package/dist/isUserOnboardingComplete-CBrAH0ZF.esm.js.map +0 -1
  304. package/dist/isUserOnboardingComplete-Cr-YTpcU.native.esm.js.map +0 -1
  305. package/dist/modules/wallets/primaryWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts +0 -10
  306. package/dist/modules/wallets/primaryWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts.map +0 -1
  307. package/dist/modules/wallets/primaryWalletAccount/getPrimaryWalletAccount/index.d.ts.map +0 -1
  308. package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/index.d.ts.map +0 -1
  309. package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts +0 -12
  310. package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts.map +0 -1
  311. package/dist/services/instrumentation/instrumentFunction/extractParams/extractParams.d.ts +0 -28
  312. package/dist/services/instrumentation/instrumentFunction/extractParams/extractParams.d.ts.map +0 -1
  313. package/dist/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.d.ts +0 -15
  314. package/dist/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.d.ts.map +0 -1
  315. package/dist/updateAuthFromVerifyResponse-CElYpi97.cjs.map +0 -1
  316. package/dist/updateAuthFromVerifyResponse-D1w-Aw9P.native.esm.js.map +0 -1
  317. package/dist/updateAuthFromVerifyResponse-azIi_3FB.esm.js.map +0 -1
  318. /package/dist/modules/wallets/{primaryWalletAccount → selectedWalletAccount}/getPrimaryWalletAccount/index.d.ts +0 -0
  319. /package/dist/modules/wallets/{primaryWalletAccount → selectedWalletAccount}/selectPrimaryWalletAccount/index.d.ts +0 -0
@@ -1,18 +1,31 @@
1
- const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-Btejc5g3.cjs');
2
- const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CElYpi97.cjs');
1
+ const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-BuvyBN_r.cjs');
2
+ const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-pgYXvDvj.cjs');
3
3
  let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
4
4
 
5
5
  //#region src/modules/user/refreshAuth/refreshAuth.ts
6
6
  /**
7
- * Refreshes the current user's data from the server.
7
+ * Refreshes the current session's authentication from the server.
8
8
  *
9
- * This function fetches the latest user information and token from the backend
10
- * updating the local user and token states with any changes.
9
+ * This rotates the auth token via a full verify call and updates both the
10
+ * token and the user state from the response, returning the raw
11
+ * `VerifyResponse` (which includes the new token). Reach for this when you
12
+ * need a fresh JWT — e.g. before a call that requires a non-expired token.
13
+ *
14
+ * Prefer `refreshUser` when you only need the latest user profile and do not
15
+ * care about rotating the token: it hits the authenticated-user endpoint,
16
+ * touches only the user state, and returns the `SdkUser` directly.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const response = await refreshAuth();
21
+ * console.log('Token refreshed:', response.token);
22
+ * ```
11
23
  *
12
24
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
13
25
  * @returns A promise that resolves to the verify response.
26
+ * @see logout
27
+ * @see refreshUser
14
28
  * @instrumented
15
- * @redact-params
16
29
  */
17
30
  const refreshAuth = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
18
31
  const core = require_updateAuthFromVerifyResponse.getCore(client);
@@ -30,8 +43,7 @@ const __refreshAuth_wrapped = require_updateAuthFromVerifyResponse.instrumentFun
30
43
  } catch {
31
44
  return;
32
45
  }
33
- },
34
- redactAll: true
46
+ }
35
47
  });
36
48
 
37
49
  //#endregion
@@ -85,4 +97,4 @@ Object.defineProperty(exports, 'isDynamicWaasEnabled', {
85
97
  return isDynamicWaasEnabled;
86
98
  }
87
99
  });
88
- //# sourceMappingURL=isDynamicWaasEnabled-BwP1oowd.cjs.map
100
+ //# sourceMappingURL=isDynamicWaasEnabled-BawttOeb.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDynamicWaasEnabled-BawttOeb.cjs","names":["BaseError","getDefaultClient","EmbeddedWalletVersionEnum"],"sources":["../src/modules/user/refreshAuth/refreshAuth.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts"],"sourcesContent":["import type { VerifyResponse } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\nimport { updateAuthFromVerifyResponse } from '../../auth/updateAuthFromVerifyResponse';\n\n/**\n * Refreshes the current session's authentication from the server.\n *\n * This rotates the auth token via a full verify call and updates both the\n * token and the user state from the response, returning the raw\n * `VerifyResponse` (which includes the new token). Reach for this when you\n * need a fresh JWT — e.g. before a call that requires a non-expired token.\n *\n * Prefer `refreshUser` when you only need the latest user profile and do not\n * care about rotating the token: it hits the authenticated-user endpoint,\n * touches only the user state, and returns the `SdkUser` directly.\n *\n * @example\n * ```ts\n * const response = await refreshAuth();\n * console.log('Token refreshed:', response.token);\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the verify response.\n * @see logout\n * @see refreshUser\n * @instrumented\n */\nexport const refreshAuth = async (\n client = getDefaultClient()\n): Promise<VerifyResponse> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const response = await apiClient.refreshAuth({\n environmentId: core.environmentId,\n });\n\n updateAuthFromVerifyResponse({ response }, client);\n\n return response;\n};\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAE,cAAa,OACb,SAAM,uDAAY;CAElB,MAAM,OAAA,6CAAW,OAAM;wBACN,qDAAK,EAAa,EAAA,OAAA,eAGnC,eAAA,KAAA;AAGD,mEAAA,EAAA,UAAA,EAAA,OAAA;;;;;;;;;;;;;;;;;;ACtCD,IAAa,4BAAb,cAA+CA,+CAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;;;;;;;;;;ACCN,MAAa,wBAAwB,SAASC,uDAAkB,KAAK;CACnE,MAAM,kBAAkB,OAAO;AAE/B,oDAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxBC,qDAA0B"}
@@ -1,17 +1,30 @@
1
- import { K as createApiClient, _t as getCore, gt as BaseError, ot as assertDefined, pt as getDefaultClient, t as updateAuthFromVerifyResponse, v as instrumentFunction } from "./updateAuthFromVerifyResponse-azIi_3FB.esm.js";
1
+ import { K as createApiClient, _t as BaseError, mt as getDefaultClient, ot as assertDefined, t as updateAuthFromVerifyResponse, v as instrumentFunction, vt as getCore } from "./updateAuthFromVerifyResponse-_oYRLK_w.esm.js";
2
2
  import { EmbeddedWalletVersionEnum } from "@dynamic-labs/sdk-api-core";
3
3
 
4
4
  //#region src/modules/user/refreshAuth/refreshAuth.ts
5
5
  /**
6
- * Refreshes the current user's data from the server.
6
+ * Refreshes the current session's authentication from the server.
7
7
  *
8
- * This function fetches the latest user information and token from the backend
9
- * updating the local user and token states with any changes.
8
+ * This rotates the auth token via a full verify call and updates both the
9
+ * token and the user state from the response, returning the raw
10
+ * `VerifyResponse` (which includes the new token). Reach for this when you
11
+ * need a fresh JWT — e.g. before a call that requires a non-expired token.
12
+ *
13
+ * Prefer `refreshUser` when you only need the latest user profile and do not
14
+ * care about rotating the token: it hits the authenticated-user endpoint,
15
+ * touches only the user state, and returns the `SdkUser` directly.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const response = await refreshAuth();
20
+ * console.log('Token refreshed:', response.token);
21
+ * ```
10
22
  *
11
23
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
12
24
  * @returns A promise that resolves to the verify response.
25
+ * @see logout
26
+ * @see refreshUser
13
27
  * @instrumented
14
- * @redact-params
15
28
  */
16
29
  const refreshAuth = async (client = getDefaultClient()) => {
17
30
  const core = getCore(client);
@@ -29,8 +42,7 @@ const __refreshAuth_wrapped = instrumentFunction({
29
42
  } catch {
30
43
  return;
31
44
  }
32
- },
33
- redactAll: true
45
+ }
34
46
  });
35
47
 
36
48
  //#endregion
@@ -67,4 +79,4 @@ const isDynamicWaasEnabled = (client = getDefaultClient()) => {
67
79
 
68
80
  //#endregion
69
81
  export { NotWaasWalletAccountError as n, __refreshAuth_wrapped as r, isDynamicWaasEnabled as t };
70
- //# sourceMappingURL=isDynamicWaasEnabled-BYaqAOml.esm.js.map
82
+ //# sourceMappingURL=isDynamicWaasEnabled-DDrg89y1.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDynamicWaasEnabled-DDrg89y1.esm.js","names":[],"sources":["../src/modules/user/refreshAuth/refreshAuth.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts"],"sourcesContent":["import type { VerifyResponse } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\nimport { updateAuthFromVerifyResponse } from '../../auth/updateAuthFromVerifyResponse';\n\n/**\n * Refreshes the current session's authentication from the server.\n *\n * This rotates the auth token via a full verify call and updates both the\n * token and the user state from the response, returning the raw\n * `VerifyResponse` (which includes the new token). Reach for this when you\n * need a fresh JWT — e.g. before a call that requires a non-expired token.\n *\n * Prefer `refreshUser` when you only need the latest user profile and do not\n * care about rotating the token: it hits the authenticated-user endpoint,\n * touches only the user state, and returns the `SdkUser` directly.\n *\n * @example\n * ```ts\n * const response = await refreshAuth();\n * console.log('Token refreshed:', response.token);\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the verify response.\n * @see logout\n * @see refreshUser\n * @instrumented\n */\nexport const refreshAuth = async (\n client = getDefaultClient()\n): Promise<VerifyResponse> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const response = await apiClient.refreshAuth({\n environmentId: core.environmentId,\n });\n\n updateAuthFromVerifyResponse({ response }, client);\n\n return response;\n};\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAE,cAAa,OACb,SAAM,kBAAY;CAElB,MAAM,OAAA,QAAW,OAAM;wBACN,gBAAK,EAAa,EAAA,OAAA,eAGnC,eAAA,KAAA;AAGD,8BAAA,EAAA,UAAA,EAAA,OAAA;;;;;;;;;;;;;;;;;;ACtCD,IAAa,4BAAb,cAA+C,UAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;;;;;;;;;;ACCN,MAAa,wBAAwB,SAAS,kBAAkB,KAAK;CACnE,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxB,0BAA0B"}
@@ -1,17 +1,30 @@
1
- import { K as createApiClient, _t as getCore, gt as BaseError, ot as assertDefined, pt as getDefaultClient, t as updateAuthFromVerifyResponse, v as instrumentFunction } from "./updateAuthFromVerifyResponse-D1w-Aw9P.native.esm.js";
1
+ import { K as createApiClient, _t as BaseError, mt as getDefaultClient, ot as assertDefined, t as updateAuthFromVerifyResponse, v as instrumentFunction, vt as getCore } from "./updateAuthFromVerifyResponse-DFjqCSu2.native.esm.js";
2
2
  import { EmbeddedWalletVersionEnum } from "@dynamic-labs/sdk-api-core";
3
3
 
4
4
  //#region src/modules/user/refreshAuth/refreshAuth.ts
5
5
  /**
6
- * Refreshes the current user's data from the server.
6
+ * Refreshes the current session's authentication from the server.
7
7
  *
8
- * This function fetches the latest user information and token from the backend
9
- * updating the local user and token states with any changes.
8
+ * This rotates the auth token via a full verify call and updates both the
9
+ * token and the user state from the response, returning the raw
10
+ * `VerifyResponse` (which includes the new token). Reach for this when you
11
+ * need a fresh JWT — e.g. before a call that requires a non-expired token.
12
+ *
13
+ * Prefer `refreshUser` when you only need the latest user profile and do not
14
+ * care about rotating the token: it hits the authenticated-user endpoint,
15
+ * touches only the user state, and returns the `SdkUser` directly.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const response = await refreshAuth();
20
+ * console.log('Token refreshed:', response.token);
21
+ * ```
10
22
  *
11
23
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
12
24
  * @returns A promise that resolves to the verify response.
25
+ * @see logout
26
+ * @see refreshUser
13
27
  * @instrumented
14
- * @redact-params
15
28
  */
16
29
  const refreshAuth = async (client = getDefaultClient()) => {
17
30
  const core = getCore(client);
@@ -29,8 +42,7 @@ const __refreshAuth_wrapped = instrumentFunction({
29
42
  } catch {
30
43
  return;
31
44
  }
32
- },
33
- redactAll: true
45
+ }
34
46
  });
35
47
 
36
48
  //#endregion
@@ -67,4 +79,4 @@ const isDynamicWaasEnabled = (client = getDefaultClient()) => {
67
79
 
68
80
  //#endregion
69
81
  export { NotWaasWalletAccountError as n, __refreshAuth_wrapped as r, isDynamicWaasEnabled as t };
70
- //# sourceMappingURL=isDynamicWaasEnabled-BXe0VyI4.native.esm.js.map
82
+ //# sourceMappingURL=isDynamicWaasEnabled-Dj_sLoBO.native.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDynamicWaasEnabled-Dj_sLoBO.native.esm.js","names":[],"sources":["../src/modules/user/refreshAuth/refreshAuth.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts"],"sourcesContent":["import type { VerifyResponse } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\nimport { updateAuthFromVerifyResponse } from '../../auth/updateAuthFromVerifyResponse';\n\n/**\n * Refreshes the current session's authentication from the server.\n *\n * This rotates the auth token via a full verify call and updates both the\n * token and the user state from the response, returning the raw\n * `VerifyResponse` (which includes the new token). Reach for this when you\n * need a fresh JWT — e.g. before a call that requires a non-expired token.\n *\n * Prefer `refreshUser` when you only need the latest user profile and do not\n * care about rotating the token: it hits the authenticated-user endpoint,\n * touches only the user state, and returns the `SdkUser` directly.\n *\n * @example\n * ```ts\n * const response = await refreshAuth();\n * console.log('Token refreshed:', response.token);\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the verify response.\n * @see logout\n * @see refreshUser\n * @instrumented\n */\nexport const refreshAuth = async (\n client = getDefaultClient()\n): Promise<VerifyResponse> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const response = await apiClient.refreshAuth({\n environmentId: core.environmentId,\n });\n\n updateAuthFromVerifyResponse({ response }, client);\n\n return response;\n};\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAE,cAAa,OACb,SAAM,kBAAY;CAElB,MAAM,OAAA,QAAW,OAAM;wBACN,gBAAK,EAAa,EAAA,OAAA,eAGnC,eAAA,KAAA;AAGD,8BAAA,EAAA,UAAA,EAAA,OAAA;;;;;;;;;;;;;;;;;;ACtCD,IAAa,4BAAb,cAA+C,UAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;;;;;;;;;;ACCN,MAAa,wBAAwB,SAAS,kBAAkB,KAAK;CACnE,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxB,0BAA0B"}
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CElYpi97.cjs');
28
+ const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-pgYXvDvj.cjs');
29
29
  let zod_mini = require("zod/mini");
30
30
  zod_mini = __toESM(zod_mini);
31
31
 
@@ -81,8 +81,17 @@ const retryOnFail = async ({ delay = 0, fn, maxRetries }) => {
81
81
  * "Check if signed in" guide:
82
82
  * https://www.dynamic.xyz/docs/javascript/user-session-management
83
83
  *
84
+ * @example
85
+ * ```ts
86
+ * if (isSignedIn()) {
87
+ * console.log('User is authenticated or has a wallet connected');
88
+ * }
89
+ * ```
90
+ *
84
91
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
85
92
  * @returns True if the user is signed in, false otherwise.
93
+ * @see logout
94
+ * @see isAnyWalletAccountConnected
86
95
  * @notInstrumented
87
96
  */
88
97
  const isSignedIn = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => Boolean(client.user || require_updateAuthFromVerifyResponse.getWalletAccounts(client).length > 0);
@@ -117,8 +126,16 @@ const PROJECT_SETTINGS_EXPIRATION_TIME = 1e3 * 60 * 5;
117
126
  * from Dynamic's servers, including authentication options, enabled chains,
118
127
  * and security configurations. The settings are cached for performance.
119
128
  *
129
+ * @example
130
+ * ```ts
131
+ * const settings = await fetchProjectSettings();
132
+ * console.log('Enabled chains:', settings.chains);
133
+ * ```
134
+ *
120
135
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
121
136
  * @returns A promise that resolves to the updated project settings.
137
+ * @see createDynamicClient
138
+ * @see initializeClient
122
139
  * @notInstrumented
123
140
  * @noHook Internal settings fetch that is not part of the public hook surface.
124
141
  */
@@ -242,7 +259,7 @@ const logoutWithReason = async ({ reason }, client) => {
242
259
  * This deletes the auth cookie if it exists.
243
260
  * If the cookie doesn't exist, this sets a new cookie that expires immediately.
244
261
  */
245
- if (require_updateAuthFromVerifyResponse.isCookieEnabled(client)) require_updateAuthFromVerifyResponse.setCookie(`${require_updateAuthFromVerifyResponse.DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
262
+ if (require_updateAuthFromVerifyResponse.isCookieEnabled(client)) require_updateAuthFromVerifyResponse.setCookie(`${require_updateAuthFromVerifyResponse.DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax${require_updateAuthFromVerifyResponse.getSecureCookieAttribute()}`);
246
263
  }
247
264
  await core.keychain.removeKey("session");
248
265
  core.state.set({
@@ -288,7 +305,6 @@ const __logoutWithReason_wrapped = require_updateAuthFromVerifyResponse.instrume
288
305
  * @returns The MFA token that was consumed.
289
306
  * @throws Error if no MFA token is found.
290
307
  * @instrumented
291
- * @redact-params
292
308
  */
293
309
  const consumeMfaToken = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
294
310
  const core = require_updateAuthFromVerifyResponse.getCore(client);
@@ -307,8 +323,7 @@ const __consumeMfaToken_wrapped = require_updateAuthFromVerifyResponse.instrumen
307
323
  } catch {
308
324
  return;
309
325
  }
310
- },
311
- redactAll: true
326
+ }
312
327
  });
313
328
 
314
329
  //#endregion
@@ -412,4 +427,4 @@ Object.defineProperty(exports, 'retryOnFail', {
412
427
  return retryOnFail;
413
428
  }
414
429
  });
415
- //# sourceMappingURL=isMfaRequiredForAction-Btejc5g3.cjs.map
430
+ //# sourceMappingURL=isMfaRequiredForAction-BuvyBN_r.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMfaRequiredForAction-BuvyBN_r.cjs","names":["BaseError","getDefaultClient","getWalletAccounts","z","getDefaultClient","getCore","createApiClient","CLIENT_SDK_NAME","getCore","getCore","walletProvidersMap: Map<string, WalletProvider>","getWalletAccounts","getWalletProviderFromWalletAccount","getCore","getDefaultClient","getCore","createApiClient","getDefaultClient"],"sources":["../src/utils/retryOnFail/InvalidRetryOnFailCallError.ts","../src/utils/retryOnFail/retryOnFail.ts","../src/modules/auth/isSignedIn/isSignedIn.ts","../src/services/storage/createStorageKeySchema/createStorageKeySchema.ts","../src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.ts","../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts","../src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts","../src/modules/wallets/utils/getAvailableWalletProvidersFromWalletAccounts/getAvailableWalletProvidersFromWalletAccounts.ts","../src/modules/wallets/destroyWalletProviders/destroyWalletProviders.ts","../src/modules/auth/logoutWithReason/logoutWithReason.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { BaseError } from '../../errors/base';\n\n/**\n * This error is thrown when the `retryOnFail` function is called with an invalid\n * number of retries (i.e. less than 0).\n */\nexport class InvalidRetryOnFailCallError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(maxRetries: number) {\n super({\n cause: null,\n code: 'invalid_retry_on_fail_call_error',\n docsUrl: null,\n name: 'InvalidRetryOnFailCallError',\n shortMessage: `Invalid retries parameter for retryOnFail call: ${maxRetries}`,\n });\n }\n}\n","import { InvalidRetryOnFailCallError } from './InvalidRetryOnFailCallError';\n\nexport type RetryOnFailParams<T> = {\n /**\n * The delay between retries in milliseconds.\n */\n delay?: number;\n /**\n * The function to call.\n */\n fn: () => Promise<T>;\n /**\n * The maximum number of retries.\n *\n * When set to 0, the function will be called only once and is\n * therefore equivalent to calling the function directly.\n */\n maxRetries: number;\n};\n\n/** @notInstrumented */\nexport const retryOnFail = async <T>({\n delay = 0,\n fn,\n maxRetries,\n}: RetryOnFailParams<T>) => {\n for (let retry = 0; retry <= maxRetries; retry++) {\n try {\n return await fn();\n } catch (error) {\n if (retry >= maxRetries) {\n throw error;\n }\n\n if (delay > 0) {\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n }\n\n /**\n * Reaching this point should never happen and this\n * error is thrown to help us debug the issue.\n */\n throw new InvalidRetryOnFailCallError(maxRetries);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\n\n/**\n * Checks if the user is currently signed in to the Dynamic client.\n *\n * The client is considered to be in a signed in state if a user has\n * authenticated or if the client has at least one wallet connected.\n *\n * @deprecated What counts as \"signed in\" is your app's business logic, not the\n * SDK's. This helper bakes in one opinion (a user OR any connected wallet),\n * which rarely matches every app and forces a dependency on us for every\n * variation. Compose your own check from the underlying primitives instead —\n * e.g. `Boolean(client.user) || isAnyWalletAccountConnected(client)` — and\n * layer in whatever your app requires (device registration, completed\n * onboarding, satisfied MFA, a required embedded wallet, …). See the\n * \"Check if signed in\" guide:\n * https://www.dynamic.xyz/docs/javascript/user-session-management\n *\n * @example\n * ```ts\n * if (isSignedIn()) {\n * console.log('User is authenticated or has a wallet connected');\n * }\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user is signed in, false otherwise.\n * @see logout\n * @see isAnyWalletAccountConnected\n * @notInstrumented\n */\nexport const isSignedIn = (client = getDefaultClient()) =>\n Boolean(client.user || getWalletAccounts(client).length > 0);\n","import type * as z from 'zod/mini';\n\nimport type { StorageKeySchema, StorageKeySchemaConfig } from '../storage.types';\n\n/** @notInstrumented */\nexport const createStorageKeySchema = <T>(params: {\n config?: StorageKeySchemaConfig;\n key: string;\n schema: z.ZodMiniType<T>;\n}): StorageKeySchema<T> => {\n return params;\n};\n","import * as z from 'zod/mini';\n\nimport { createStorageKeySchema } from '../../../services/storage';\n\n/**\n * The schema to track the expiration time of the project settings.\n */\nexport const projectSettingsExpirationStorageKeySchema = createStorageKeySchema(\n {\n key: 'projectSettingsExpiration',\n schema: z.number(),\n }\n);\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { retryOnFail } from '../../../utils/retryOnFail';\nimport { createApiClient } from '../../apiClient';\nimport { CLIENT_SDK_NAME } from '../../apiClient/constants';\nimport { isSignedIn } from '../../auth/isSignedIn';\nimport { projectSettingsExpirationStorageKeySchema } from './projectSettingsExpirationScheme';\n\n/**\n * Expiration time of the project settings in milliseconds.\n */\nexport const PROJECT_SETTINGS_EXPIRATION_TIME = 1000 * 60 * 5; // 5 minutes\n\n/**\n * Fetches and updates the project settings from the API.\n *\n * This function retrieves the latest project configuration settings\n * from Dynamic's servers, including authentication options, enabled chains,\n * and security configurations. The settings are cached for performance.\n *\n * @example\n * ```ts\n * const settings = await fetchProjectSettings();\n * console.log('Enabled chains:', settings.chains);\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the updated project settings.\n * @see createDynamicClient\n * @see initializeClient\n * @notInstrumented\n * @noHook Internal settings fetch that is not part of the public hook surface.\n */\nexport const fetchProjectSettings = async (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const currentExpiration = await core.storage.getItem(\n projectSettingsExpirationStorageKeySchema\n );\n\n const hasProjectSettings = Boolean(client.projectSettings);\n const isExpired = currentExpiration && currentExpiration < Date.now();\n\n // We want to cache the project settings if its valid and user is connected.\n // This avoids unnecessary API calls and speeds up the initial load.\n if (hasProjectSettings && !isExpired && isSignedIn(client)) {\n return client.projectSettings;\n }\n\n const apiClient = createApiClient({}, client);\n\n core.logger.debug('[fetchProjectSettings] Fetching project settings...');\n\n const doFetch = async () =>\n apiClient.getEnvironmentSettings(\n {\n environmentId: core.environmentId,\n sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`,\n },\n {\n credentials: 'omit',\n }\n );\n\n const projectSettings = await retryOnFail({\n fn: doFetch,\n maxRetries: 2,\n });\n\n core.state.set({ projectSettings: projectSettings ?? null });\n\n await core.storage.setItem(\n projectSettingsExpirationStorageKeySchema,\n Date.now() + PROJECT_SETTINGS_EXPIRATION_TIME\n );\n\n return projectSettings;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { SessionKeys } from '../sessionKeys.types';\n\n/** @notInstrumented */\nexport const generateSessionKeys = async (\n client: DynamicClient\n): Promise<SessionKeys> => {\n const core = getCore(client);\n\n const currentState = core.state.get();\n\n const isRotation = Boolean(currentState.sessionKeys);\n\n const logContext = {\n environmentId: core.environmentId,\n operation: isRotation ? 'rotate' : 'create',\n userId: currentState.user?.id ?? null,\n };\n\n core.logger.info(\n isRotation\n ? '[generateSessionKeys] Rotating session key...'\n : '[generateSessionKeys] Creating session key...',\n logContext\n );\n\n await core.keychain.removeKey('session');\n\n const publicKey = await core.keychain.generateKey('session');\n\n assertDefined(publicKey, 'Public key not found');\n\n core.state.set({\n sessionKeys: publicKey,\n });\n\n core.logger.info(\n isRotation\n ? '[generateSessionKeys] Session key rotated'\n : '[generateSessionKeys] Session key created',\n logContext\n );\n\n return { publicKey };\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { getWalletAccounts } from '../../getWalletAccounts';\nimport type { WalletProvider } from '../../walletProvider';\nimport { getWalletProviderFromWalletAccount } from '../getWalletProviderFromWalletAccount';\n\n/** @notInstrumented */\nexport const getAvailableWalletProvidersFromWalletAccounts = (\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProvidersMap: Map<string, WalletProvider> = new Map();\n\n const walletAccounts = getWalletAccounts(client);\n\n walletAccounts.forEach((walletAccount) => {\n if (walletProvidersMap.has(walletAccount.walletProviderKey)) {\n return;\n }\n\n try {\n const walletProvider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);\n } catch (error) {\n core.logger.debug('Wallet provider not found for wallet account', {\n error,\n walletAccount: walletAccount.address,\n });\n }\n });\n\n return Array.from(walletProvidersMap.values());\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { LogoutReason } from '../../auth/logoutReason';\nimport { getAvailableWalletProvidersFromWalletAccounts } from '../utils/getAvailableWalletProvidersFromWalletAccounts';\n\n/**\n * Tear down every wallet provider on the client.\n *\n * Each provider's `destroy` is responsible for its own local + remote\n * cleanup. We swallow errors so a failing destroy on one provider does not\n * block teardown of the others (e.g. during logout).\n *\n * @notInstrumented\n */\nexport const destroyWalletProviders = async (\n { reason }: { reason?: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProviders = getAvailableWalletProvidersFromWalletAccounts(client);\n\n await Promise.all(\n walletProviders.map(async (walletProvider) => {\n if (!walletProvider.destroy) return;\n try {\n await walletProvider.destroy({ reason });\n } catch (err) {\n core.logger.error(\n `Error destroying wallet provider ${walletProvider.key}`,\n err\n );\n }\n })\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getCore } from '../../../client/core/getCore';\nimport { getSecureCookieAttribute } from '../../../utils/getSecureCookieAttribute';\nimport { setCookie } from '../../../utils/setCookie';\nimport { createApiClient } from '../../apiClient';\nimport { emitEvent } from '../../clientEvents';\nimport { fetchProjectSettings } from '../../projectSettings/fetchProjectSettings';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { generateSessionKeys } from '../../sessionKeys/generateSessionKeys';\nimport { destroyWalletProviders } from '../../wallets/destroyWalletProviders';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport type { LogoutReason } from '../logoutReason';\n\n/**\n * Logs the user out with an explicit reason.\n *\n * Revokes the session, clears auth state, terminates wallet providers, and\n * emits the `logout` client event with the given reason. The reason is also\n * captured as an argument on the function-instrumentation event, which is\n * how Datadog distinguishes between different logout causes.\n *\n * Use this instead of the public `logout` when triggering a logout from\n * internal or extension code — the caller owns the reason string, so the\n * telemetry correctly attributes *why* the logout happened.\n *\n * @param params - The logout params.\n * @param params.reason - Why the logout is being triggered. Extension authors\n * needing a reason outside the SDK catalog can cast with `as LogoutReason`.\n * @param client - The Dynamic client instance.\n * @instrumented\n */\nexport const logoutWithReason = async (\n { reason }: { reason: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n core.logger.debug('[logoutWithReason] Logging out...', { reason });\n\n await destroyWalletProviders({ reason }, client);\n\n if (client.user !== null) {\n const apiClient = createApiClient({}, client);\n\n try {\n await apiClient.revokeSession({\n environmentId: core.environmentId,\n });\n } catch (error) {\n core.logger.error('Failed to revoke session', error);\n }\n\n /**\n * This deletes the auth cookie if it exists.\n * If the cookie doesn't exist, this sets a new cookie that expires immediately.\n */\n if (isCookieEnabled(client)) {\n // Match the Secure attribute used when the cookie was written so the\n // deletion cookie is accepted consistently in a secure context.\n const secureAttribute = getSecureCookieAttribute();\n\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax${secureAttribute}`\n );\n }\n }\n\n await core.keychain.removeKey('session');\n\n core.state.set({\n captchaToken: null,\n elevatedAccessTokens: [],\n legacyToken: null,\n mfaToken: null,\n sessionExpiresAt: null,\n sessionKeys: null,\n token: null,\n unverifiedWalletAccounts: [],\n user: null,\n });\n\n emitEvent({ args: { reason }, event: 'logout' }, client);\n\n // Refetch project settings\n void fetchProjectSettings(client);\n\n // Regenerate session keys\n void generateSessionKeys(client);\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n * @instrumented\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n * @notInstrumented\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n * @notInstrumented\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,8BAAb,cAAiDA,+CAAU;CAEzD,YAAY,YAAoB;AAC9B,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mDAAmD;GAClE,CAAC;;;;;;;ACMN,MAAa,cAAc,OAAU,EACnC,QAAQ,GACR,IACA,iBAC0B;AAC1B,MAAK,IAAI,QAAQ,GAAG,SAAS,YAAY,QACvC,KAAI;AACF,SAAO,MAAM,IAAI;UACV,OAAO;AACd,MAAI,SAA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, E as getWalletProviderFromWalletAccount, K as createApiClient, T as DYNAMIC_AUTH_COOKIE_NAME, W as setCookie, _t as getCore, at as isCookieEnabled, gt as BaseError, j as getWalletAccounts, ot as assertDefined, pt as getDefaultClient, ut as CLIENT_SDK_NAME, v as instrumentFunction } from "./updateAuthFromVerifyResponse-azIi_3FB.esm.js";
1
+ import { A as getWalletAccounts, K as createApiClient, T as getWalletProviderFromWalletAccount, U as setCookie, W as getSecureCookieAttribute, _t as BaseError, at as isCookieEnabled, dt as CLIENT_SDK_NAME, mt as getDefaultClient, ot as assertDefined, v as instrumentFunction, vt as getCore, w as DYNAMIC_AUTH_COOKIE_NAME, z as emitEvent } from "./updateAuthFromVerifyResponse-_oYRLK_w.esm.js";
2
2
  import * as z from "zod/mini";
3
3
 
4
4
  //#region src/utils/retryOnFail/InvalidRetryOnFailCallError.ts
@@ -53,8 +53,17 @@ const retryOnFail = async ({ delay = 0, fn, maxRetries }) => {
53
53
  * "Check if signed in" guide:
54
54
  * https://www.dynamic.xyz/docs/javascript/user-session-management
55
55
  *
56
+ * @example
57
+ * ```ts
58
+ * if (isSignedIn()) {
59
+ * console.log('User is authenticated or has a wallet connected');
60
+ * }
61
+ * ```
62
+ *
56
63
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
57
64
  * @returns True if the user is signed in, false otherwise.
65
+ * @see logout
66
+ * @see isAnyWalletAccountConnected
58
67
  * @notInstrumented
59
68
  */
60
69
  const isSignedIn = (client = getDefaultClient()) => Boolean(client.user || getWalletAccounts(client).length > 0);
@@ -89,8 +98,16 @@ const PROJECT_SETTINGS_EXPIRATION_TIME = 1e3 * 60 * 5;
89
98
  * from Dynamic's servers, including authentication options, enabled chains,
90
99
  * and security configurations. The settings are cached for performance.
91
100
  *
101
+ * @example
102
+ * ```ts
103
+ * const settings = await fetchProjectSettings();
104
+ * console.log('Enabled chains:', settings.chains);
105
+ * ```
106
+ *
92
107
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
93
108
  * @returns A promise that resolves to the updated project settings.
109
+ * @see createDynamicClient
110
+ * @see initializeClient
94
111
  * @notInstrumented
95
112
  * @noHook Internal settings fetch that is not part of the public hook surface.
96
113
  */
@@ -214,7 +231,7 @@ const logoutWithReason = async ({ reason }, client) => {
214
231
  * This deletes the auth cookie if it exists.
215
232
  * If the cookie doesn't exist, this sets a new cookie that expires immediately.
216
233
  */
217
- if (isCookieEnabled(client)) setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
234
+ if (isCookieEnabled(client)) setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax${getSecureCookieAttribute()}`);
218
235
  }
219
236
  await core.keychain.removeKey("session");
220
237
  core.state.set({
@@ -260,7 +277,6 @@ const __logoutWithReason_wrapped = instrumentFunction({
260
277
  * @returns The MFA token that was consumed.
261
278
  * @throws Error if no MFA token is found.
262
279
  * @instrumented
263
- * @redact-params
264
280
  */
265
281
  const consumeMfaToken = (client = getDefaultClient()) => {
266
282
  const core = getCore(client);
@@ -279,8 +295,7 @@ const __consumeMfaToken_wrapped = instrumentFunction({
279
295
  } catch {
280
296
  return;
281
297
  }
282
- },
283
- redactAll: true
298
+ }
284
299
  });
285
300
 
286
301
  //#endregion
@@ -325,4 +340,4 @@ const isMfaRequiredForAction = async ({ mfaAction }, client = getDefaultClient()
325
340
 
326
341
  //#endregion
327
342
  export { generateSessionKeys as a, isSignedIn as c, __logoutWithReason_wrapped as i, retryOnFail as l, getMfaMethods as n, fetchProjectSettings as o, __consumeMfaToken_wrapped as r, createStorageKeySchema as s, isMfaRequiredForAction as t };
328
- //# sourceMappingURL=isMfaRequiredForAction-CqEcCTIe.esm.js.map
343
+ //# sourceMappingURL=isMfaRequiredForAction-DTp4CZBt.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMfaRequiredForAction-DTp4CZBt.esm.js","names":["walletProvidersMap: Map<string, WalletProvider>"],"sources":["../src/utils/retryOnFail/InvalidRetryOnFailCallError.ts","../src/utils/retryOnFail/retryOnFail.ts","../src/modules/auth/isSignedIn/isSignedIn.ts","../src/services/storage/createStorageKeySchema/createStorageKeySchema.ts","../src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.ts","../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts","../src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts","../src/modules/wallets/utils/getAvailableWalletProvidersFromWalletAccounts/getAvailableWalletProvidersFromWalletAccounts.ts","../src/modules/wallets/destroyWalletProviders/destroyWalletProviders.ts","../src/modules/auth/logoutWithReason/logoutWithReason.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { BaseError } from '../../errors/base';\n\n/**\n * This error is thrown when the `retryOnFail` function is called with an invalid\n * number of retries (i.e. less than 0).\n */\nexport class InvalidRetryOnFailCallError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(maxRetries: number) {\n super({\n cause: null,\n code: 'invalid_retry_on_fail_call_error',\n docsUrl: null,\n name: 'InvalidRetryOnFailCallError',\n shortMessage: `Invalid retries parameter for retryOnFail call: ${maxRetries}`,\n });\n }\n}\n","import { InvalidRetryOnFailCallError } from './InvalidRetryOnFailCallError';\n\nexport type RetryOnFailParams<T> = {\n /**\n * The delay between retries in milliseconds.\n */\n delay?: number;\n /**\n * The function to call.\n */\n fn: () => Promise<T>;\n /**\n * The maximum number of retries.\n *\n * When set to 0, the function will be called only once and is\n * therefore equivalent to calling the function directly.\n */\n maxRetries: number;\n};\n\n/** @notInstrumented */\nexport const retryOnFail = async <T>({\n delay = 0,\n fn,\n maxRetries,\n}: RetryOnFailParams<T>) => {\n for (let retry = 0; retry <= maxRetries; retry++) {\n try {\n return await fn();\n } catch (error) {\n if (retry >= maxRetries) {\n throw error;\n }\n\n if (delay > 0) {\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n }\n\n /**\n * Reaching this point should never happen and this\n * error is thrown to help us debug the issue.\n */\n throw new InvalidRetryOnFailCallError(maxRetries);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\n\n/**\n * Checks if the user is currently signed in to the Dynamic client.\n *\n * The client is considered to be in a signed in state if a user has\n * authenticated or if the client has at least one wallet connected.\n *\n * @deprecated What counts as \"signed in\" is your app's business logic, not the\n * SDK's. This helper bakes in one opinion (a user OR any connected wallet),\n * which rarely matches every app and forces a dependency on us for every\n * variation. Compose your own check from the underlying primitives instead —\n * e.g. `Boolean(client.user) || isAnyWalletAccountConnected(client)` — and\n * layer in whatever your app requires (device registration, completed\n * onboarding, satisfied MFA, a required embedded wallet, …). See the\n * \"Check if signed in\" guide:\n * https://www.dynamic.xyz/docs/javascript/user-session-management\n *\n * @example\n * ```ts\n * if (isSignedIn()) {\n * console.log('User is authenticated or has a wallet connected');\n * }\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user is signed in, false otherwise.\n * @see logout\n * @see isAnyWalletAccountConnected\n * @notInstrumented\n */\nexport const isSignedIn = (client = getDefaultClient()) =>\n Boolean(client.user || getWalletAccounts(client).length > 0);\n","import type * as z from 'zod/mini';\n\nimport type { StorageKeySchema, StorageKeySchemaConfig } from '../storage.types';\n\n/** @notInstrumented */\nexport const createStorageKeySchema = <T>(params: {\n config?: StorageKeySchemaConfig;\n key: string;\n schema: z.ZodMiniType<T>;\n}): StorageKeySchema<T> => {\n return params;\n};\n","import * as z from 'zod/mini';\n\nimport { createStorageKeySchema } from '../../../services/storage';\n\n/**\n * The schema to track the expiration time of the project settings.\n */\nexport const projectSettingsExpirationStorageKeySchema = createStorageKeySchema(\n {\n key: 'projectSettingsExpiration',\n schema: z.number(),\n }\n);\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { retryOnFail } from '../../../utils/retryOnFail';\nimport { createApiClient } from '../../apiClient';\nimport { CLIENT_SDK_NAME } from '../../apiClient/constants';\nimport { isSignedIn } from '../../auth/isSignedIn';\nimport { projectSettingsExpirationStorageKeySchema } from './projectSettingsExpirationScheme';\n\n/**\n * Expiration time of the project settings in milliseconds.\n */\nexport const PROJECT_SETTINGS_EXPIRATION_TIME = 1000 * 60 * 5; // 5 minutes\n\n/**\n * Fetches and updates the project settings from the API.\n *\n * This function retrieves the latest project configuration settings\n * from Dynamic's servers, including authentication options, enabled chains,\n * and security configurations. The settings are cached for performance.\n *\n * @example\n * ```ts\n * const settings = await fetchProjectSettings();\n * console.log('Enabled chains:', settings.chains);\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the updated project settings.\n * @see createDynamicClient\n * @see initializeClient\n * @notInstrumented\n * @noHook Internal settings fetch that is not part of the public hook surface.\n */\nexport const fetchProjectSettings = async (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const currentExpiration = await core.storage.getItem(\n projectSettingsExpirationStorageKeySchema\n );\n\n const hasProjectSettings = Boolean(client.projectSettings);\n const isExpired = currentExpiration && currentExpiration < Date.now();\n\n // We want to cache the project settings if its valid and user is connected.\n // This avoids unnecessary API calls and speeds up the initial load.\n if (hasProjectSettings && !isExpired && isSignedIn(client)) {\n return client.projectSettings;\n }\n\n const apiClient = createApiClient({}, client);\n\n core.logger.debug('[fetchProjectSettings] Fetching project settings...');\n\n const doFetch = async () =>\n apiClient.getEnvironmentSettings(\n {\n environmentId: core.environmentId,\n sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`,\n },\n {\n credentials: 'omit',\n }\n );\n\n const projectSettings = await retryOnFail({\n fn: doFetch,\n maxRetries: 2,\n });\n\n core.state.set({ projectSettings: projectSettings ?? null });\n\n await core.storage.setItem(\n projectSettingsExpirationStorageKeySchema,\n Date.now() + PROJECT_SETTINGS_EXPIRATION_TIME\n );\n\n return projectSettings;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { SessionKeys } from '../sessionKeys.types';\n\n/** @notInstrumented */\nexport const generateSessionKeys = async (\n client: DynamicClient\n): Promise<SessionKeys> => {\n const core = getCore(client);\n\n const currentState = core.state.get();\n\n const isRotation = Boolean(currentState.sessionKeys);\n\n const logContext = {\n environmentId: core.environmentId,\n operation: isRotation ? 'rotate' : 'create',\n userId: currentState.user?.id ?? null,\n };\n\n core.logger.info(\n isRotation\n ? '[generateSessionKeys] Rotating session key...'\n : '[generateSessionKeys] Creating session key...',\n logContext\n );\n\n await core.keychain.removeKey('session');\n\n const publicKey = await core.keychain.generateKey('session');\n\n assertDefined(publicKey, 'Public key not found');\n\n core.state.set({\n sessionKeys: publicKey,\n });\n\n core.logger.info(\n isRotation\n ? '[generateSessionKeys] Session key rotated'\n : '[generateSessionKeys] Session key created',\n logContext\n );\n\n return { publicKey };\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { getWalletAccounts } from '../../getWalletAccounts';\nimport type { WalletProvider } from '../../walletProvider';\nimport { getWalletProviderFromWalletAccount } from '../getWalletProviderFromWalletAccount';\n\n/** @notInstrumented */\nexport const getAvailableWalletProvidersFromWalletAccounts = (\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProvidersMap: Map<string, WalletProvider> = new Map();\n\n const walletAccounts = getWalletAccounts(client);\n\n walletAccounts.forEach((walletAccount) => {\n if (walletProvidersMap.has(walletAccount.walletProviderKey)) {\n return;\n }\n\n try {\n const walletProvider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);\n } catch (error) {\n core.logger.debug('Wallet provider not found for wallet account', {\n error,\n walletAccount: walletAccount.address,\n });\n }\n });\n\n return Array.from(walletProvidersMap.values());\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { LogoutReason } from '../../auth/logoutReason';\nimport { getAvailableWalletProvidersFromWalletAccounts } from '../utils/getAvailableWalletProvidersFromWalletAccounts';\n\n/**\n * Tear down every wallet provider on the client.\n *\n * Each provider's `destroy` is responsible for its own local + remote\n * cleanup. We swallow errors so a failing destroy on one provider does not\n * block teardown of the others (e.g. during logout).\n *\n * @notInstrumented\n */\nexport const destroyWalletProviders = async (\n { reason }: { reason?: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProviders = getAvailableWalletProvidersFromWalletAccounts(client);\n\n await Promise.all(\n walletProviders.map(async (walletProvider) => {\n if (!walletProvider.destroy) return;\n try {\n await walletProvider.destroy({ reason });\n } catch (err) {\n core.logger.error(\n `Error destroying wallet provider ${walletProvider.key}`,\n err\n );\n }\n })\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getCore } from '../../../client/core/getCore';\nimport { getSecureCookieAttribute } from '../../../utils/getSecureCookieAttribute';\nimport { setCookie } from '../../../utils/setCookie';\nimport { createApiClient } from '../../apiClient';\nimport { emitEvent } from '../../clientEvents';\nimport { fetchProjectSettings } from '../../projectSettings/fetchProjectSettings';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { generateSessionKeys } from '../../sessionKeys/generateSessionKeys';\nimport { destroyWalletProviders } from '../../wallets/destroyWalletProviders';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport type { LogoutReason } from '../logoutReason';\n\n/**\n * Logs the user out with an explicit reason.\n *\n * Revokes the session, clears auth state, terminates wallet providers, and\n * emits the `logout` client event with the given reason. The reason is also\n * captured as an argument on the function-instrumentation event, which is\n * how Datadog distinguishes between different logout causes.\n *\n * Use this instead of the public `logout` when triggering a logout from\n * internal or extension code — the caller owns the reason string, so the\n * telemetry correctly attributes *why* the logout happened.\n *\n * @param params - The logout params.\n * @param params.reason - Why the logout is being triggered. Extension authors\n * needing a reason outside the SDK catalog can cast with `as LogoutReason`.\n * @param client - The Dynamic client instance.\n * @instrumented\n */\nexport const logoutWithReason = async (\n { reason }: { reason: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n core.logger.debug('[logoutWithReason] Logging out...', { reason });\n\n await destroyWalletProviders({ reason }, client);\n\n if (client.user !== null) {\n const apiClient = createApiClient({}, client);\n\n try {\n await apiClient.revokeSession({\n environmentId: core.environmentId,\n });\n } catch (error) {\n core.logger.error('Failed to revoke session', error);\n }\n\n /**\n * This deletes the auth cookie if it exists.\n * If the cookie doesn't exist, this sets a new cookie that expires immediately.\n */\n if (isCookieEnabled(client)) {\n // Match the Secure attribute used when the cookie was written so the\n // deletion cookie is accepted consistently in a secure context.\n const secureAttribute = getSecureCookieAttribute();\n\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax${secureAttribute}`\n );\n }\n }\n\n await core.keychain.removeKey('session');\n\n core.state.set({\n captchaToken: null,\n elevatedAccessTokens: [],\n legacyToken: null,\n mfaToken: null,\n sessionExpiresAt: null,\n sessionKeys: null,\n token: null,\n unverifiedWalletAccounts: [],\n user: null,\n });\n\n emitEvent({ args: { reason }, event: 'logout' }, client);\n\n // Refetch project settings\n void fetchProjectSettings(client);\n\n // Regenerate session keys\n void generateSessionKeys(client);\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n * @instrumented\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n * @notInstrumented\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n * @notInstrumented\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n //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K;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAAS,kBAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
@@ -1,4 +1,4 @@
1
- import { K as createApiClient, _t as getCore, gt as BaseError, ot as assertDefined, pt as getDefaultClient, v as instrumentFunction } from "./updateAuthFromVerifyResponse-D1w-Aw9P.native.esm.js";
1
+ import { K as createApiClient, _t as BaseError, mt as getDefaultClient, ot as assertDefined, v as instrumentFunction, vt as getCore } from "./updateAuthFromVerifyResponse-DFjqCSu2.native.esm.js";
2
2
 
3
3
  //#region src/errors/NativeModuleNotLinkedError.ts
4
4
  var NativeModuleNotLinkedError = class extends BaseError {
@@ -40,7 +40,6 @@ var NativeModuleNotLinkedError = class extends BaseError {
40
40
  * @returns The MFA token that was consumed.
41
41
  * @throws Error if no MFA token is found.
42
42
  * @instrumented
43
- * @redact-params
44
43
  */
45
44
  const consumeMfaToken = (client = getDefaultClient()) => {
46
45
  const core = getCore(client);
@@ -59,8 +58,7 @@ const __consumeMfaToken_wrapped = instrumentFunction({
59
58
  } catch {
60
59
  return;
61
60
  }
62
- },
63
- redactAll: true
61
+ }
64
62
  });
65
63
 
66
64
  //#endregion
@@ -105,4 +103,4 @@ const isMfaRequiredForAction = async ({ mfaAction }, client = getDefaultClient()
105
103
 
106
104
  //#endregion
107
105
  export { NativeModuleNotLinkedError as i, getMfaMethods as n, __consumeMfaToken_wrapped as r, isMfaRequiredForAction as t };
108
- //# sourceMappingURL=isMfaRequiredForAction-Demz9zlH.native.esm.js.map
106
+ //# sourceMappingURL=isMfaRequiredForAction-EY-OQORc.native.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMfaRequiredForAction-EY-OQORc.native.esm.js","names":[],"sources":["../src/errors/NativeModuleNotLinkedError.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NativeModuleNotLinkedErrorParams = {\n moduleName: string;\n};\n\nexport class NativeModuleNotLinkedError extends BaseError {\n constructor({ moduleName }: NativeModuleNotLinkedErrorParams) {\n super({\n cause: null,\n code: 'native_module_not_linked_error',\n details: [\n `The \"${moduleName}\" TurboModule is not registered with React Native.`,\n 'This usually means the native module was not autolinked into the host app,',\n 'or the app binary was not rebuilt after installing the SDK.',\n '',\n 'To resolve:',\n ' 1. Ensure \"@dynamic-labs-sdk/client\" is a direct dependency of the app',\n ' and reinstall (e.g. `pnpm install`).',\n ' 2. Rebuild the native app:',\n ' iOS: `cd ios && pod install && cd .. && npx react-native run-ios`',\n ' Android: `npx react-native run-android`',\n ' Expo: `npx expo prebuild --clean` then run the app.',\n ' 3. Confirm autolinking sees the package:',\n ' `npx expo-modules-autolinking react-native-config --json`',\n ].join('\\n'),\n docsUrl: null,\n name: 'NativeModuleNotLinkedError',\n shortMessage: `Native TurboModule \"${moduleName}\" is not linked.`,\n });\n }\n}\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n * @instrumented\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n * @notInstrumented\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n * @notInstrumented\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,cAAgD;AAC5D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;IACP,QAAQ,WAAW;IACnB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,CAAC,KAAK,KAAK;GACZ,SAAS;GACT,MAAM;GACN,cAAc,uBAAuB,WAAW;GACjD,CAAC;;;;;;;;;;;;;;;;;ACXN,MAAE,mBAAsB,SAAU,kBAAU,KAAA;;;AAK1C,eAAY,UAAI,qBAAA;kBAGhB,UAAO,MACR,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACbD,MAAa,gBAAgB,OAAO,SAAS,kBAAkB,KAAK;CAClE,MAAM,OAAO,QAAQ,OAAO;AAQ5B,QALuB,MAFL,gBAAgB,EAAE,EAAE,OAAO,CAEN,kBAAkB;EACvD,eAAe,KAAK;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAAS,kBAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
@@ -1,6 +1,6 @@
1
- const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-Btejc5g3.cjs');
2
- const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CElYpi97.cjs');
3
- const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-BwP1oowd.cjs');
1
+ const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-BuvyBN_r.cjs');
2
+ const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-pgYXvDvj.cjs');
3
+ const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-BawttOeb.cjs');
4
4
  let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
5
5
  let _dynamic_labs_wallet_browser_wallet_client = require("@dynamic-labs-wallet/browser-wallet-client");
6
6
 
@@ -66,6 +66,7 @@ const preconnectWaasIframe = (client) => {
66
66
  * @param user - The user to check.
67
67
  * @returns True if device registration is required, false otherwise.
68
68
  * @notInstrumented
69
+ * @hook Exposed as a hook so consumers reactively know when this device must be registered, updated when the user changes.
69
70
  */
70
71
  const isDeviceRegistrationRequired = (user) => Boolean(user.scope?.includes("device:register"));
71
72
 
@@ -80,6 +81,7 @@ const isDeviceRegistrationRequired = (user) => Boolean(user.scope?.includes("dev
80
81
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
81
82
  * @returns True if recovery codes are pending acknowledgment, false otherwise.
82
83
  * @notInstrumented
84
+ * @hook Exposed as a hook so consumers reactively know when recovery codes await acknowledgment, updated when the user changes.
83
85
  */
84
86
  const isPendingRecoveryCodesAcknowledgment = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
85
87
  const user = client.user;
@@ -103,9 +105,17 @@ const isPendingRecoveryCodesAcknowledgment = (client = require_updateAuthFromVer
103
105
  * is one such feature — its backend calls reject a pre-`user:basic` token — but
104
106
  * this predicate is general and not specific to embedded wallets.
105
107
  *
108
+ * @deprecated Use {@link checkUserScopes} instead. This function conflates
109
+ * Dynamic-controlled requirements (MFA, device registration, required fields)
110
+ * with the concept of "onboarding complete", which is app-specific. Replace
111
+ * with `checkUserScopes({ user, scopes: ['user:basic'] })` to check whether
112
+ * Dynamic's requirements are satisfied, and compose your own logic on top for
113
+ * any app-specific onboarding steps.
114
+ *
106
115
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
107
116
  * @returns True if onboarding is complete (no pending requirements), false if there are pending requirements.
108
117
  * @notInstrumented
118
+ * @hook Exposed as a hook so consumers reactively know when onboarding is complete, updated when the user changes.
109
119
  */
110
120
  const isUserOnboardingComplete = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
111
121
  const user = client.user;
@@ -148,4 +158,4 @@ Object.defineProperty(exports, 'preconnectWaasIframe', {
148
158
  return preconnectWaasIframe;
149
159
  }
150
160
  });
151
- //# sourceMappingURL=isUserOnboardingComplete-C86NDY7I.cjs.map
161
+ //# sourceMappingURL=isUserOnboardingComplete-CkyzRYrg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUserOnboardingComplete-CkyzRYrg.cjs","names":["BaseError","getCore","isDynamicWaasEnabled","isCookieEnabled","DEFAULT_WAAS_BASE_API_URL","getDefaultClient","MfaBackupCodeAcknowledgement","getDefaultClient","isUserMissingMfaAuth"],"sources":["../src/errors/WaasOnboardingIncompleteError.ts","../src/modules/waas/preconnectWaasIframe/preconnectWaasIframe.ts","../src/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.ts","../src/modules/mfa/isPendingRecoveryCodesAcknowledgment/isPendingRecoveryCodesAcknowledgment.ts","../src/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.ts"],"sourcesContent":["import { BaseError } from './base';\n\n/**\n * Thrown when the embedded (WaaS) wallet client is requested before the user\n * has completed onboarding — i.e. the JWT has not upgraded to `user:basic`\n * because MFA, KYC, recovery-codes acknowledgment, or device registration is\n * still pending.\n *\n * The WaaS iframe's init-time room-cache pre-warm fires `createRooms` using the\n * token captured at client construction (before any per-operation token\n * resync). Building the client during this window lets that pre-warm fire with\n * a pre-`user:basic` token, get a 401, and the iframe's unauthorized handler\n * force-logs-out the user. Throwing here surfaces a clear, recoverable reason\n * instead — wait for onboarding to complete and retry.\n */\nexport class WaasOnboardingIncompleteError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'waas_onboarding_incomplete',\n docsUrl: null,\n name: 'WaasOnboardingIncompleteError',\n shortMessage:\n 'Cannot create or access the embedded wallet until onboarding is complete (pending MFA, KYC, recovery-codes acknowledgment, or device registration).',\n });\n }\n}\n","import type { AuthMode } from '@dynamic-labs-wallet/browser-wallet-client';\nimport { preconnectWaasIframe as preconnectWaasIframeOrigin } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { DEFAULT_WAAS_BASE_API_URL } from '../constants';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Warms the browser's connection (DNS + TCP + TLS) to the embedded-wallet\n * iframe origin so the iframe mounted after authentication completes loads on\n * a hot connection. Called when an auth flow starts (OTP send/verify, social\n * callback). Safe to call repeatedly; no-op on React Native / SSR and when\n * Dynamic WaaS is not enabled.\n *\n * @param client - The Dynamic client instance.\n * @notInstrumented\n */\nexport const preconnectWaasIframe = (client: DynamicClient): void => {\n const core = getCore(client);\n try {\n if (!isDynamicWaasEnabled(client)) return;\n\n preconnectWaasIframeOrigin({\n authMode: (isCookieEnabled(client) ? 'cookie' : 'header') as AuthMode,\n baseApiUrl: (core.apiBaseUrl || DEFAULT_WAAS_BASE_API_URL).replace(\n '/api/v0',\n ''\n ),\n });\n } catch (error) {\n // Best-effort: never break the auth flow (also swallows the assertion\n // from isDynamicWaasEnabled when project settings are not loaded yet).\n core.logger.warn('[preconnectWaasIframe] skipped', error);\n }\n};\n","import type { User } from '../../user/user.types';\n\n/**\n * Checks if device registration is required for the given user.\n *\n * This function determines if the user has the deviceRegistration\n * scope, indicating that device registration is required.\n *\n * @param user - The user to check.\n * @returns True if device registration is required, false otherwise.\n * @notInstrumented\n * @hook Exposed as a hook so consumers reactively know when this device must be registered, updated when the user changes.\n */\nexport const isDeviceRegistrationRequired = (user: User) =>\n Boolean(user.scope?.includes('device:register'));\n","import { MfaBackupCodeAcknowledgement } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user is still pending acknowledgment of their MFA recovery codes.\n *\n * This function determines whether the user has been presented with recovery\n * codes that they have not yet acknowledged as saved or backed up.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if recovery codes are pending acknowledgment, false otherwise.\n * @notInstrumented\n * @hook Exposed as a hook so consumers reactively know when recovery codes await acknowledgment, updated when the user changes.\n */\nexport const isPendingRecoveryCodesAcknowledgment = (\n client = getDefaultClient()\n) => {\n const user = client.user;\n\n assertDefined(user, 'User not logged in');\n\n return (\n user.mfaBackupCodeAcknowledgement === MfaBackupCodeAcknowledgement.Pending\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { isDeviceRegistrationRequired } from '../../deviceRegistration/isDeviceRegistrationRequired';\nimport { isPendingRecoveryCodesAcknowledgment } from '../../mfa/isPendingRecoveryCodesAcknowledgment';\nimport { isUserMissingMfaAuth } from '../../mfa/isUserMissingMfaAuth';\n\n/**\n * Checks if the user has completed all onboarding requirements.\n *\n * This function verifies whether a user has fulfilled all necessary requirements\n * including KYC fields (Know Your Customer information), MFA setup\n * (Multi-Factor Authentication including recovery codes acknowledgment), and\n * device registration.\n *\n * A `false` result means the user still has an outstanding onboarding step, so\n * any feature that requires a fully onboarded (`user:basic`) user should hold\n * off until it returns `true`. Creating or accessing an embedded (WaaS) wallet\n * is one such feature — its backend calls reject a pre-`user:basic` token — but\n * this predicate is general and not specific to embedded wallets.\n *\n * @deprecated Use {@link checkUserScopes} instead. This function conflates\n * Dynamic-controlled requirements (MFA, device registration, required fields)\n * with the concept of \"onboarding complete\", which is app-specific. Replace\n * with `checkUserScopes({ user, scopes: ['user:basic'] })` to check whether\n * Dynamic's requirements are satisfied, and compose your own logic on top for\n * any app-specific onboarding steps.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if onboarding is complete (no pending requirements), false if there are pending requirements.\n * @notInstrumented\n * @hook Exposed as a hook so consumers reactively know when onboarding is complete, updated when the user changes.\n */\nexport const isUserOnboardingComplete = (client = getDefaultClient()) => {\n const user = client.user;\n\n assertDefined(user, 'User not logged in');\n\n const hasMissingKycFields = Boolean(user.missingFields?.length);\n const hasPendingMfaAuth = isUserMissingMfaAuth(client);\n const hasPendingRecoveryCodes = isPendingRecoveryCodesAcknowledgment(client);\n const hasPendingDeviceRegistration = isDeviceRegistrationRequired(user);\n\n const userOnboardingComplete =\n !hasMissingKycFields &&\n !hasPendingMfaAuth &&\n !hasPendingRecoveryCodes &&\n !hasPendingDeviceRegistration;\n\n return userOnboardingComplete;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,IAAa,gCAAb,cAAmDA,+CAAU;CAC3D,cAAc;AACZ,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cACE;GACH,CAAC;;;;;;;;;;;;;;;;ACLN,MAAa,wBAAwB,WAAgC;CACnE,MAAM,OAAOC,6CAAQ,OAAO;AAC5B,KAAI;AACF,MAAI,CAACC,kDAAqB,OAAO,CAAE;AAEnC,uEAA2B;GACzB,UAAWC,qDAAgB,OAAO,GAAG,WAAW;GAChD,aAAa,KAAK,cAAcC,gEAA2B,QACzD,WACA,GACD;GACF,CAAC;UACK,OAAO;AAGd,OAAK,OAAO,KAAK,kCAAkC,MAAM;;;;;;;;;;;;;;;;;ACrB7D,MAAa,gCAAgC,SAC3C,QAAQ,KAAK,OAAO,SAAS,kBAAkB,CAAC;;;;;;;;;;;;;;;ACElD,MAAa,wCACX,SAASC,uDAAkB,KACxB;CACH,MAAM,OAAO,OAAO;AAEpB,oDAAc,MAAM,qBAAqB;AAEzC,QACE,KAAK,iCAAiCC,wDAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACQvE,MAAa,4BAA4B,SAASC,uDAAkB,KAAK;CACvE,MAAM,OAAO,OAAO;AAEpB,oDAAc,MAAM,qBAAqB;CAEzC,MAAM,sBAAsB,QAAQ,KAAK,eAAe,OAAO;CAC/D,MAAM,oBAAoBC,0DAAqB,OAAO;CACtD,MAAM,0BAA0B,qCAAqC,OAAO;CAC5E,MAAM,+BAA+B,6BAA6B,KAAK;AAQvE,QALE,CAAC,uBACD,CAAC,qBACD,CAAC,2BACD,CAAC"}