@dynamic-labs/sdk-react-core 4.51.0 → 4.51.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +14 -14
  5. package/src/lib/data/api/constants.cjs +12 -0
  6. package/src/lib/data/api/constants.d.ts +3 -0
  7. package/src/lib/data/api/constants.js +6 -0
  8. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +12 -1
  9. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +12 -1
  10. package/src/lib/data/api/user/user.cjs +19 -0
  11. package/src/lib/data/api/user/user.d.ts +5 -0
  12. package/src/lib/data/api/user/user.js +19 -1
  13. package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.cjs +33 -1
  14. package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.d.ts +11 -0
  15. package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.js +32 -2
  16. package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.cjs +1 -1
  17. package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.js +1 -1
  18. package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs +1 -4
  19. package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js +1 -4
  20. package/src/lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.cjs +8 -1
  21. package/src/lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.js +8 -1
  22. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -1
  23. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +4 -1
  24. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -1
  25. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
  26. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +1 -1
  27. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
  28. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.cjs +131 -0
  29. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.d.ts +6 -0
  30. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.js +127 -0
  31. package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +3 -1
  32. package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +2 -0
  33. package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +3 -1
  34. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +14 -2
  35. package/src/lib/views/SendBalanceView/SendBalanceView.js +15 -3
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ### [4.51.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.51.1...v4.51.2) (2025-12-19)
3
+
4
+
5
+ ### Features
6
+
7
+ * add updateUserEmail method ([#10133](https://github.com/dynamic-labs/dynamic-auth/issues/10133)) ([78ba809](https://github.com/dynamic-labs/dynamic-auth/commit/78ba809b8226d00d7c69a55424dc9c9471060ae7))
8
+
9
+ ### [4.51.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.51.0...v4.51.1) (2025-12-19)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * emit mfaCompletionSuccess event when registering a passkey ([#10135](https://github.com/dynamic-labs/dynamic-auth/issues/10135)) ([1e1a19a](https://github.com/dynamic-labs/dynamic-auth/commit/1e1a19ac19002183b3041c733b2fd98e51b77fa6))
15
+
2
16
  ## [4.51.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.50.5...v4.51.0) (2025-12-18)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.51.0";
6
+ var version = "4.51.2";
7
7
  var dependencies = {
8
- "@dynamic-labs/sdk-api-core": "0.0.831",
9
- "@dynamic-labs-sdk/client": "0.1.0-alpha.33",
8
+ "@dynamic-labs/sdk-api-core": "0.0.843",
9
+ "@dynamic-labs-sdk/client": "0.1.2",
10
10
  "@hcaptcha/react-hcaptcha": "1.4.4",
11
11
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
12
12
  "country-list": "2.3.0",
package/package.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client'
2
- var version = "4.51.0";
2
+ var version = "4.51.2";
3
3
  var dependencies = {
4
- "@dynamic-labs/sdk-api-core": "0.0.831",
5
- "@dynamic-labs-sdk/client": "0.1.0-alpha.33",
4
+ "@dynamic-labs/sdk-api-core": "0.0.843",
5
+ "@dynamic-labs-sdk/client": "0.1.2",
6
6
  "@hcaptcha/react-hcaptcha": "1.4.4",
7
7
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
8
8
  "country-list": "2.3.0",
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.51.0",
3
+ "version": "4.51.2",
4
4
  "dependencies": {
5
- "@dynamic-labs/sdk-api-core": "0.0.831",
6
- "@dynamic-labs-sdk/client": "0.1.0-alpha.33",
5
+ "@dynamic-labs/sdk-api-core": "0.0.843",
6
+ "@dynamic-labs-sdk/client": "0.1.2",
7
7
  "@hcaptcha/react-hcaptcha": "1.4.4",
8
8
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
9
9
  "country-list": "2.3.0",
@@ -15,17 +15,17 @@
15
15
  "yup": "0.32.11",
16
16
  "react-international-phone": "4.5.0",
17
17
  "bs58": "5.0.0",
18
- "@dynamic-labs/assert-package-version": "4.51.0",
19
- "@dynamic-labs/iconic": "4.51.0",
20
- "@dynamic-labs/locale": "4.51.0",
21
- "@dynamic-labs/logger": "4.51.0",
22
- "@dynamic-labs/multi-wallet": "4.51.0",
23
- "@dynamic-labs/rpc-providers": "4.51.0",
24
- "@dynamic-labs/store": "4.51.0",
25
- "@dynamic-labs/types": "4.51.0",
26
- "@dynamic-labs/utils": "4.51.0",
27
- "@dynamic-labs/wallet-book": "4.51.0",
28
- "@dynamic-labs/wallet-connector-core": "4.51.0",
18
+ "@dynamic-labs/assert-package-version": "4.51.2",
19
+ "@dynamic-labs/iconic": "4.51.2",
20
+ "@dynamic-labs/locale": "4.51.2",
21
+ "@dynamic-labs/logger": "4.51.2",
22
+ "@dynamic-labs/multi-wallet": "4.51.2",
23
+ "@dynamic-labs/rpc-providers": "4.51.2",
24
+ "@dynamic-labs/store": "4.51.2",
25
+ "@dynamic-labs/types": "4.51.2",
26
+ "@dynamic-labs/utils": "4.51.2",
27
+ "@dynamic-labs/wallet-book": "4.51.2",
28
+ "@dynamic-labs/wallet-connector-core": "4.51.2",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const DYNAMIC_SESSION_PUBLIC_KEY_HEADER = 'x-dyn-session-public-key';
7
+ const DYNAMIC_SESSION_NONCE_HEADER = 'x-dyn-session-nonce';
8
+ const DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER = 'x-dyn-session-nonce-signature';
9
+
10
+ exports.DYNAMIC_SESSION_NONCE_HEADER = DYNAMIC_SESSION_NONCE_HEADER;
11
+ exports.DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER = DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER;
12
+ exports.DYNAMIC_SESSION_PUBLIC_KEY_HEADER = DYNAMIC_SESSION_PUBLIC_KEY_HEADER;
@@ -0,0 +1,3 @@
1
+ export declare const DYNAMIC_SESSION_PUBLIC_KEY_HEADER = "x-dyn-session-public-key";
2
+ export declare const DYNAMIC_SESSION_NONCE_HEADER = "x-dyn-session-nonce";
3
+ export declare const DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER = "x-dyn-session-nonce-signature";
@@ -0,0 +1,6 @@
1
+ 'use client'
2
+ const DYNAMIC_SESSION_PUBLIC_KEY_HEADER = 'x-dyn-session-public-key';
3
+ const DYNAMIC_SESSION_NONCE_HEADER = 'x-dyn-session-nonce';
4
+ const DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER = 'x-dyn-session-nonce-signature';
5
+
6
+ export { DYNAMIC_SESSION_NONCE_HEADER, DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER, DYNAMIC_SESSION_PUBLIC_KEY_HEADER };
@@ -24,10 +24,12 @@ require('../../../config/ApiEndpoint.cjs');
24
24
  require('@dynamic-labs/multi-wallet');
25
25
  require('react-international-phone');
26
26
  require('../../../store/state/nonce/nonce.cjs');
27
+ var constants = require('../constants.cjs');
27
28
  require('@dynamic-labs/locale');
28
29
  require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
29
30
  require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
30
31
  require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
32
+ var getClientSessionKeys = require('../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
31
33
  require('../../../events/dynamicEvents.cjs');
32
34
  var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
33
35
 
@@ -156,7 +158,16 @@ const exportEmbeddedWallet = (_g) => _tslib.__awaiter(void 0, [_g], void 0, func
156
158
  const registerSessionKey = (_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ environmentId, walletId, publicKey, prevSessionKeySignature, }) {
157
159
  let response;
158
160
  try {
159
- response = yield api.sdkApi().registerSessionKey({
161
+ const { nonce, nonceSignature, publicKey: sessionPublicKey, } = yield getClientSessionKeys.getClientSessionNonceSignature({
162
+ environmentId,
163
+ });
164
+ response = yield api.sdkApi({
165
+ customHeaders: {
166
+ [constants.DYNAMIC_SESSION_NONCE_HEADER]: nonce,
167
+ [constants.DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER]: nonceSignature,
168
+ [constants.DYNAMIC_SESSION_PUBLIC_KEY_HEADER]: sessionPublicKey,
169
+ },
170
+ }).registerSessionKey({
160
171
  environmentId,
161
172
  registerSessionKeyRequest: {
162
173
  prevSessionKeySignature,
@@ -20,10 +20,12 @@ import '../../../config/ApiEndpoint.js';
20
20
  import '@dynamic-labs/multi-wallet';
21
21
  import 'react-international-phone';
22
22
  import '../../../store/state/nonce/nonce.js';
23
+ import { DYNAMIC_SESSION_NONCE_HEADER, DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER, DYNAMIC_SESSION_PUBLIC_KEY_HEADER } from '../constants.js';
23
24
  import '@dynamic-labs/locale';
24
25
  import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
25
26
  import '../../../store/state/primaryWalletId/primaryWalletId.js';
26
27
  import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
28
+ import { getClientSessionNonceSignature } from '../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
27
29
  import '../../../events/dynamicEvents.js';
28
30
  import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
29
31
 
@@ -152,7 +154,16 @@ const exportEmbeddedWallet = (_g) => __awaiter(void 0, [_g], void 0, function* (
152
154
  const registerSessionKey = (_h) => __awaiter(void 0, [_h], void 0, function* ({ environmentId, walletId, publicKey, prevSessionKeySignature, }) {
153
155
  let response;
154
156
  try {
155
- response = yield sdkApi().registerSessionKey({
157
+ const { nonce, nonceSignature, publicKey: sessionPublicKey, } = yield getClientSessionNonceSignature({
158
+ environmentId,
159
+ });
160
+ response = yield sdkApi({
161
+ customHeaders: {
162
+ [DYNAMIC_SESSION_NONCE_HEADER]: nonce,
163
+ [DYNAMIC_SESSION_NONCE_SIGNATURE_HEADER]: nonceSignature,
164
+ [DYNAMIC_SESSION_PUBLIC_KEY_HEADER]: sessionPublicKey,
165
+ },
166
+ }).registerSessionKey({
156
167
  environmentId,
157
168
  registerSessionKeyRequest: {
158
169
  prevSessionKeySignature,
@@ -128,10 +128,29 @@ const getUserFieldsCheck = (_c) => _tslib.__awaiter(void 0, [_c], void 0, functi
128
128
  return undefined;
129
129
  }
130
130
  });
131
+ const unlinkEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ environmentId, primaryWalletId, verifiedCredentialId, }) {
132
+ const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
133
+ try {
134
+ const response = yield api.sdkApi().verifyUnlink({
135
+ environmentId,
136
+ verifyUnlinkRequest: {
137
+ primaryWalletId: normalizedPrimaryWalletId,
138
+ verifiedCredentialId,
139
+ },
140
+ });
141
+ const user = storeTokenAndUser.storeTokenAndUser(response);
142
+ return user;
143
+ }
144
+ catch (e) {
145
+ yield utils.logResponseError(e, 'Error unlinkEmail');
146
+ return undefined;
147
+ }
148
+ });
131
149
 
132
150
  exports.getUserFieldsCheck = getUserFieldsCheck;
133
151
  exports.hardDeleteUser = hardDeleteUser;
134
152
  exports.mergeUserAccounts = mergeUserAccounts;
135
153
  exports.refreshUserJwt = refreshUserJwt;
154
+ exports.unlinkEmail = unlinkEmail;
136
155
  exports.updateUserProfileFields = updateUserProfileFields;
137
156
  exports.verifyMergeUsers = verifyMergeUsers;
@@ -18,3 +18,8 @@ export declare const getUserFieldsCheck: ({ environmentId, filter, }: {
18
18
  environmentId: string;
19
19
  filter: UserFieldsCheckParams;
20
20
  }) => Promise<UserFieldsCheckResponse | undefined>;
21
+ export declare const unlinkEmail: ({ environmentId, primaryWalletId, verifiedCredentialId, }: {
22
+ environmentId: string;
23
+ primaryWalletId: string;
24
+ verifiedCredentialId: string;
25
+ }) => Promise<UserProfile | undefined>;
@@ -124,5 +124,23 @@ const getUserFieldsCheck = (_c) => __awaiter(void 0, [_c], void 0, function* ({
124
124
  return undefined;
125
125
  }
126
126
  });
127
+ const unlinkEmail = (_d) => __awaiter(void 0, [_d], void 0, function* ({ environmentId, primaryWalletId, verifiedCredentialId, }) {
128
+ const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
129
+ try {
130
+ const response = yield sdkApi().verifyUnlink({
131
+ environmentId,
132
+ verifyUnlinkRequest: {
133
+ primaryWalletId: normalizedPrimaryWalletId,
134
+ verifiedCredentialId,
135
+ },
136
+ });
137
+ const user = storeTokenAndUser(response);
138
+ return user;
139
+ }
140
+ catch (e) {
141
+ yield logResponseError(e, 'Error unlinkEmail');
142
+ return undefined;
143
+ }
144
+ });
127
145
 
128
- export { getUserFieldsCheck, hardDeleteUser, mergeUserAccounts, refreshUserJwt, updateUserProfileFields, verifyMergeUsers };
146
+ export { getUserFieldsCheck, hardDeleteUser, mergeUserAccounts, refreshUserJwt, unlinkEmail, updateUserProfileFields, verifyMergeUsers };
@@ -18,7 +18,20 @@ require('../../constants/colors.cjs');
18
18
  require('../../constants/values.cjs');
19
19
  require('@dynamic-labs/sdk-api-core');
20
20
  require('../../../shared/consts/index.cjs');
21
+ require('@dynamic-labs-sdk/client/core');
22
+ require('../../../client/client.cjs');
23
+ require('@dynamic-labs-sdk/client');
24
+ require('../../../config/ApiEndpoint.cjs');
25
+ require('@dynamic-labs/multi-wallet');
26
+ require('react-international-phone');
27
+ require('../../../store/state/nonce/nonce.cjs');
28
+ require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
29
+ require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
30
+ require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
21
31
  var constants = require('./constants.cjs');
32
+ require('../../../events/dynamicEvents.cjs');
33
+ var utils$1 = require('../../../data/api/utils.cjs');
34
+ require('@dynamic-labs/locale');
22
35
 
23
36
  const getClientSessionKeys = () => {
24
37
  const sessionKeysSS = utils.StorageService.getItem(sessionStorage.CLIENT_SESSION_KEYS, sessionStorage.CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
@@ -42,6 +55,7 @@ const generateKeyPair = () => _tslib.__awaiter(void 0, void 0, void 0, function*
42
55
  return { privateKey, privateKeyJwk: privateJwk, publicKey };
43
56
  });
44
57
  const generateSessionSignature = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ privateKeyJwk, sessionId, }) { return keyService.p256Sign(privateKeyJwk, sessionId); });
58
+ const generateNonceSignature = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ privateKeyJwk, nonce, }) { return keyService.p256Sign(privateKeyJwk, nonce); });
45
59
  const generateClientSessionKeys = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
46
60
  // check if session keys are already stored in session storage
47
61
  const clientSessionKeysSS = getClientSessionKeys();
@@ -62,7 +76,7 @@ const getClientSessionPublicKey = () => {
62
76
  const clientSessionKeys = getClientSessionKeys();
63
77
  return clientSessionKeys === null || clientSessionKeys === void 0 ? void 0 : clientSessionKeys.publicKey;
64
78
  };
65
- const getClientSessionSignature = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ sessionId, }) {
79
+ const getClientSessionSignature = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ sessionId, }) {
66
80
  const clientSessionKeys = getClientSessionKeys();
67
81
  if (!clientSessionKeys) {
68
82
  throw new Error('Client session keys not found');
@@ -74,6 +88,22 @@ const getClientSessionSignature = (_b) => _tslib.__awaiter(void 0, [_b], void 0,
74
88
  });
75
89
  return { publicKey, sessionSignature };
76
90
  });
91
+ const getClientSessionNonceSignature = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ environmentId, }) {
92
+ const clientSessionKeys = getClientSessionKeys();
93
+ if (!clientSessionKeys) {
94
+ throw new Error('Client session keys not found');
95
+ }
96
+ const { publicKey, privateKeyJwk } = clientSessionKeys;
97
+ const nonce = yield utils$1.getNonce(environmentId);
98
+ if (!nonce) {
99
+ throw new Error('Nonce not found');
100
+ }
101
+ const nonceSignature = yield generateNonceSignature({
102
+ nonce,
103
+ privateKeyJwk,
104
+ });
105
+ return { nonce, nonceSignature, publicKey };
106
+ });
77
107
  const clearClientSessionKeys = () => {
78
108
  const clientSessionKeys = getClientSessionKeys();
79
109
  logger.logger.instrument('[SessionChaining] Clearing client session keys', {
@@ -87,7 +117,9 @@ const clearClientSessionKeys = () => {
87
117
  exports.clearClientSessionKeys = clearClientSessionKeys;
88
118
  exports.generateClientSessionKeys = generateClientSessionKeys;
89
119
  exports.generateKeyPair = generateKeyPair;
120
+ exports.generateNonceSignature = generateNonceSignature;
90
121
  exports.generateSessionSignature = generateSessionSignature;
91
122
  exports.getClientSessionKeys = getClientSessionKeys;
123
+ exports.getClientSessionNonceSignature = getClientSessionNonceSignature;
92
124
  exports.getClientSessionPublicKey = getClientSessionPublicKey;
93
125
  exports.getClientSessionSignature = getClientSessionSignature;
@@ -5,6 +5,10 @@ export declare const generateSessionSignature: ({ privateKeyJwk, sessionId, }: {
5
5
  privateKeyJwk: JsonWebKey;
6
6
  sessionId: string;
7
7
  }) => Promise<string>;
8
+ export declare const generateNonceSignature: ({ privateKeyJwk, nonce, }: {
9
+ privateKeyJwk: JsonWebKey;
10
+ nonce: string;
11
+ }) => Promise<string>;
8
12
  export declare const generateClientSessionKeys: () => Promise<{
9
13
  publicKey: string;
10
14
  }>;
@@ -15,4 +19,11 @@ export declare const getClientSessionSignature: ({ sessionId, }: {
15
19
  publicKey: string;
16
20
  sessionSignature: string;
17
21
  }>;
22
+ export declare const getClientSessionNonceSignature: ({ environmentId, }: {
23
+ environmentId: string;
24
+ }) => Promise<{
25
+ nonce: string;
26
+ nonceSignature: string;
27
+ publicKey: string;
28
+ }>;
18
29
  export declare const clearClientSessionKeys: () => void;
@@ -14,7 +14,20 @@ import '../../constants/colors.js';
14
14
  import '../../constants/values.js';
15
15
  import '@dynamic-labs/sdk-api-core';
16
16
  import '../../../shared/consts/index.js';
17
+ import '@dynamic-labs-sdk/client/core';
18
+ import '../../../client/client.js';
19
+ import '@dynamic-labs-sdk/client';
20
+ import '../../../config/ApiEndpoint.js';
21
+ import '@dynamic-labs/multi-wallet';
22
+ import 'react-international-phone';
23
+ import '../../../store/state/nonce/nonce.js';
24
+ import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
25
+ import '../../../store/state/primaryWalletId/primaryWalletId.js';
26
+ import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
17
27
  import { clientSessionKeyLogScope } from './constants.js';
28
+ import '../../../events/dynamicEvents.js';
29
+ import { getNonce } from '../../../data/api/utils.js';
30
+ import '@dynamic-labs/locale';
18
31
 
19
32
  const getClientSessionKeys = () => {
20
33
  const sessionKeysSS = StorageService.getItem(CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
@@ -38,6 +51,7 @@ const generateKeyPair = () => __awaiter(void 0, void 0, void 0, function* () {
38
51
  return { privateKey, privateKeyJwk: privateJwk, publicKey };
39
52
  });
40
53
  const generateSessionSignature = (_a) => __awaiter(void 0, [_a], void 0, function* ({ privateKeyJwk, sessionId, }) { return p256Sign(privateKeyJwk, sessionId); });
54
+ const generateNonceSignature = (_b) => __awaiter(void 0, [_b], void 0, function* ({ privateKeyJwk, nonce, }) { return p256Sign(privateKeyJwk, nonce); });
41
55
  const generateClientSessionKeys = () => __awaiter(void 0, void 0, void 0, function* () {
42
56
  // check if session keys are already stored in session storage
43
57
  const clientSessionKeysSS = getClientSessionKeys();
@@ -58,7 +72,7 @@ const getClientSessionPublicKey = () => {
58
72
  const clientSessionKeys = getClientSessionKeys();
59
73
  return clientSessionKeys === null || clientSessionKeys === void 0 ? void 0 : clientSessionKeys.publicKey;
60
74
  };
61
- const getClientSessionSignature = (_b) => __awaiter(void 0, [_b], void 0, function* ({ sessionId, }) {
75
+ const getClientSessionSignature = (_c) => __awaiter(void 0, [_c], void 0, function* ({ sessionId, }) {
62
76
  const clientSessionKeys = getClientSessionKeys();
63
77
  if (!clientSessionKeys) {
64
78
  throw new Error('Client session keys not found');
@@ -70,6 +84,22 @@ const getClientSessionSignature = (_b) => __awaiter(void 0, [_b], void 0, functi
70
84
  });
71
85
  return { publicKey, sessionSignature };
72
86
  });
87
+ const getClientSessionNonceSignature = (_d) => __awaiter(void 0, [_d], void 0, function* ({ environmentId, }) {
88
+ const clientSessionKeys = getClientSessionKeys();
89
+ if (!clientSessionKeys) {
90
+ throw new Error('Client session keys not found');
91
+ }
92
+ const { publicKey, privateKeyJwk } = clientSessionKeys;
93
+ const nonce = yield getNonce(environmentId);
94
+ if (!nonce) {
95
+ throw new Error('Nonce not found');
96
+ }
97
+ const nonceSignature = yield generateNonceSignature({
98
+ nonce,
99
+ privateKeyJwk,
100
+ });
101
+ return { nonce, nonceSignature, publicKey };
102
+ });
73
103
  const clearClientSessionKeys = () => {
74
104
  const clientSessionKeys = getClientSessionKeys();
75
105
  logger.instrument('[SessionChaining] Clearing client session keys', {
@@ -80,4 +110,4 @@ const clearClientSessionKeys = () => {
80
110
  StorageService.removeItem(CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
81
111
  };
82
112
 
83
- export { clearClientSessionKeys, generateClientSessionKeys, generateKeyPair, generateSessionSignature, getClientSessionKeys, getClientSessionPublicKey, getClientSessionSignature };
113
+ export { clearClientSessionKeys, generateClientSessionKeys, generateKeyPair, generateNonceSignature, generateSessionSignature, getClientSessionKeys, getClientSessionNonceSignature, getClientSessionPublicKey, getClientSessionSignature };
@@ -36,6 +36,6 @@ const useAuthenticatePasskeyMFA = () => React.useCallback((props) => _tslib.__aw
36
36
  mfaToken: result.mfaToken,
37
37
  });
38
38
  return result.mfaToken;
39
- }), [dynamicEvents.dynamicEvents]);
39
+ }), []);
40
40
 
41
41
  exports.useAuthenticatePasskeyMFA = useAuthenticatePasskeyMFA;
@@ -32,6 +32,6 @@ const useAuthenticatePasskeyMFA = () => useCallback((props) => __awaiter(void 0,
32
32
  mfaToken: result.mfaToken,
33
33
  });
34
34
  return result.mfaToken;
35
- }), [dynamicEvents]);
35
+ }), []);
36
36
 
37
37
  export { useAuthenticatePasskeyMFA };
@@ -26,9 +26,6 @@ var client = require('@dynamic-labs-sdk/client');
26
26
  * );
27
27
  * }
28
28
  */
29
- const useIsMfaRequiredForAction = () => React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ mfaAction }) {
30
- const response = yield client.isMfaRequiredForAction({ mfaAction });
31
- return response !== null && response !== void 0 ? response : false;
32
- }), []);
29
+ const useIsMfaRequiredForAction = () => React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ mfaAction }) { return client.isMfaRequiredForAction({ mfaAction }); }), []);
33
30
 
34
31
  exports.useIsMfaRequiredForAction = useIsMfaRequiredForAction;
@@ -22,9 +22,6 @@ import { isMfaRequiredForAction } from '@dynamic-labs-sdk/client';
22
22
  * );
23
23
  * }
24
24
  */
25
- const useIsMfaRequiredForAction = () => useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ mfaAction }) {
26
- const response = yield isMfaRequiredForAction({ mfaAction });
27
- return response !== null && response !== void 0 ? response : false;
28
- }), []);
25
+ const useIsMfaRequiredForAction = () => useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ mfaAction }) { return isMfaRequiredForAction({ mfaAction }); }), []);
29
26
 
30
27
  export { useIsMfaRequiredForAction };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
8
  var client = require('@dynamic-labs-sdk/client');
9
+ var dynamicEvents = require('../../../events/dynamicEvents.cjs');
9
10
 
10
11
  /**
11
12
  * Register passkey
@@ -26,6 +27,12 @@ var client = require('@dynamic-labs-sdk/client');
26
27
  * );
27
28
  * }
28
29
  */
29
- const useRegisterPasskey = () => React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () { return client.registerPasskey(); }), []);
30
+ const useRegisterPasskey = () => React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
31
+ const response = yield client.registerPasskey();
32
+ dynamicEvents.dynamicEvents.emit('mfaCompletionSuccess', {
33
+ mfaToken: response.mfaToken,
34
+ });
35
+ return response;
36
+ }), []);
30
37
 
31
38
  exports.useRegisterPasskey = useRegisterPasskey;
@@ -2,6 +2,7 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useCallback } from 'react';
4
4
  import { registerPasskey } from '@dynamic-labs-sdk/client';
5
+ import { dynamicEvents } from '../../../events/dynamicEvents.js';
5
6
 
6
7
  /**
7
8
  * Register passkey
@@ -22,6 +23,12 @@ import { registerPasskey } from '@dynamic-labs-sdk/client';
22
23
  * );
23
24
  * }
24
25
  */
25
- const useRegisterPasskey = () => useCallback(() => __awaiter(void 0, void 0, void 0, function* () { return registerPasskey(); }), []);
26
+ const useRegisterPasskey = () => useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
27
+ const response = yield registerPasskey();
28
+ dynamicEvents.emit('mfaCompletionSuccess', {
29
+ mfaToken: response.mfaToken,
30
+ });
31
+ return response;
32
+ }), []);
26
33
 
27
34
  export { useRegisterPasskey };
@@ -108,7 +108,7 @@ require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
108
108
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
109
109
 
110
110
  // Hook exposed to customers and used internally to handle social account linking
111
- const useSocialAccounts = () => {
111
+ const useSocialAccounts = ({ onError } = {}) => {
112
112
  var _a;
113
113
  const { environmentId, user, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
114
114
  const { pushView } = ViewContext.useViewContext();
@@ -132,6 +132,7 @@ const useSocialAccounts = () => {
132
132
  },
133
133
  }), [pushView, setSocialProvider]);
134
134
  const { handleError, setError, checkValidProvider, error, connectSocialAccount, } = useSocialAuth.useSocialAuth({
135
+ onError,
135
136
  onFarcasterUrl: handleFarcasterUrl,
136
137
  });
137
138
  const verifiedOAuthCredentialsMap = React.useMemo(() => {
@@ -21,7 +21,10 @@ type ConnectSocialProps = {
21
21
  */
22
22
  payingWithDynamic?: PayWithDynamicProps;
23
23
  };
24
- export declare const useSocialAccounts: () => {
24
+ type UseSocialAccountsProps = {
25
+ onError?: (error: unknown) => void;
26
+ };
27
+ export declare const useSocialAccounts: ({ onError }?: UseSocialAccountsProps) => {
25
28
  readonly error: import("@dynamic-labs/types").SocialOAuthError | undefined;
26
29
  readonly getAllLinkedAccounts: () => SocialAccountInformation[];
27
30
  readonly getLinkedAccountInformation: (provider: ProviderEnum, verifiedCredentialId?: string) => SocialAccountInformation | undefined;
@@ -104,7 +104,7 @@ import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
104
104
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
105
105
 
106
106
  // Hook exposed to customers and used internally to handle social account linking
107
- const useSocialAccounts = () => {
107
+ const useSocialAccounts = ({ onError } = {}) => {
108
108
  var _a;
109
109
  const { environmentId, user, projectSettings } = useInternalDynamicContext();
110
110
  const { pushView } = useViewContext();
@@ -128,6 +128,7 @@ const useSocialAccounts = () => {
128
128
  },
129
129
  }), [pushView, setSocialProvider]);
130
130
  const { handleError, setError, checkValidProvider, error, connectSocialAccount, } = useSocialAuth({
131
+ onError,
131
132
  onFarcasterUrl: handleFarcasterUrl,
132
133
  });
133
134
  const verifiedOAuthCredentialsMap = useMemo(() => {
@@ -159,7 +159,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
159
159
  }, [setContextError]);
160
160
  const onFailed = React.useCallback((provider, reason, options) => {
161
161
  setIsProcessing(false);
162
- onError === null || onError === void 0 ? void 0 : onError();
162
+ onError === null || onError === void 0 ? void 0 : onError(reason.error);
163
163
  onSettled === null || onSettled === void 0 ? void 0 : onSettled();
164
164
  if (provider && (options === null || options === void 0 ? void 0 : options.raiseAuthFailure))
165
165
  dynamicEvents.dynamicEvents.emit('authFailure', {
@@ -5,7 +5,7 @@ import { PayWithDynamicProps } from '../usePayWithDynamic/usePayWithDynamic';
5
5
  export type SocialAuthMode = 'link' | 'signin' | 'unlink';
6
6
  type UseSocialAuthProps = {
7
7
  onSettled?: () => void;
8
- onError?: () => void;
8
+ onError?: (error: unknown) => void;
9
9
  onFarcasterUrl?: (url: string) => void;
10
10
  };
11
11
  export type ConnectSocialAccountProps = {
@@ -155,7 +155,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
155
155
  }, [setContextError]);
156
156
  const onFailed = useCallback((provider, reason, options) => {
157
157
  setIsProcessing(false);
158
- onError === null || onError === void 0 ? void 0 : onError();
158
+ onError === null || onError === void 0 ? void 0 : onError(reason.error);
159
159
  onSettled === null || onSettled === void 0 ? void 0 : onSettled();
160
160
  if (provider && (options === null || options === void 0 ? void 0 : options.raiseAuthFailure))
161
161
  dynamicEvents.emit('authFailure', {
@@ -0,0 +1,131 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
7
+ var React = require('react');
8
+ var utils = require('@dynamic-labs/utils');
9
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
10
+ require('../../../../context/DynamicContext/DynamicContext.cjs');
11
+ require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
12
+ require('@dynamic-labs/iconic');
13
+ require('@dynamic-labs/wallet-connector-core');
14
+ require('react/jsx-runtime');
15
+ require('../../../../context/ViewContext/ViewContext.cjs');
16
+ require('../../../../shared/logger.cjs');
17
+ require('@dynamic-labs/wallet-book');
18
+ require('../../../constants/colors.cjs');
19
+ require('../../../constants/values.cjs');
20
+ require('../../../../shared/consts/index.cjs');
21
+ require('../../../../events/dynamicEvents.cjs');
22
+ require('../../../../context/CaptchaContext/CaptchaContext.cjs');
23
+ require('../../../../context/ErrorContext/ErrorContext.cjs');
24
+ require('@dynamic-labs/multi-wallet');
25
+ require('react-international-phone');
26
+ require('../../../../store/state/nonce/nonce.cjs');
27
+ require('@dynamic-labs-sdk/client/core');
28
+ var client = require('../../../../client/client.cjs');
29
+ require('@dynamic-labs-sdk/client');
30
+ require('../../../../config/ApiEndpoint.cjs');
31
+ require('@dynamic-labs/locale');
32
+ var user = require('../../../../data/api/user/user.cjs');
33
+ require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
34
+ var primaryWalletId = require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
35
+ require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
36
+ require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
37
+ require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
38
+ require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
39
+ require('../../../../store/state/authMode/authMode.cjs');
40
+ require('../../../../context/VerificationContext/VerificationContext.cjs');
41
+ require('react-dom');
42
+ require('../../../functions/compareChains/compareChains.cjs');
43
+ require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
44
+ require('../../../../context/ThemeContext/ThemeContext.cjs');
45
+ require('../useUpdateUser/userFieldsSchema.cjs');
46
+ require('bs58');
47
+ require('@dynamic-labs/types');
48
+ require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
49
+ require('../../../../context/LoadingContext/LoadingContext.cjs');
50
+ require('../../../../context/WalletContext/WalletContext.cjs');
51
+ require('../../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
52
+ require('yup');
53
+ require('../../../../context/MockContext/MockContext.cjs');
54
+ require('../../../../views/CollectUserDataView/useFields.cjs');
55
+ require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
56
+ require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
57
+ require('@dynamic-labs/rpc-providers');
58
+ require('../../../../store/state/walletOptions/walletOptions.cjs');
59
+ require('react-i18next');
60
+ require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
61
+ require('../../../../components/Alert/Alert.cjs');
62
+ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
63
+ require('../../../../components/IconButton/IconButton.cjs');
64
+ require('../../../../components/InlineWidget/InlineWidget.cjs');
65
+ require('../../../../components/Input/Input.cjs');
66
+ require('../../../../components/IsBrowser/IsBrowser.cjs');
67
+ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
68
+ require('../../../../components/OverlayCard/OverlayCard.cjs');
69
+ require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
70
+ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
71
+ require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
72
+ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
73
+ require('../../../../components/Popper/Popper/Popper.cjs');
74
+ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
75
+ require('react-focus-lock');
76
+ require('qrcode');
77
+ require('formik');
78
+ require('../../useSubdomainCheck/useSubdomainCheck.cjs');
79
+ require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
80
+ require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
81
+ require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
82
+ require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
83
+ require('@hcaptcha/react-hcaptcha');
84
+ require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
85
+ require('../../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
86
+ require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
87
+ require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
88
+ require('../../../../context/FooterAnimationContext/index.cjs');
89
+ require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
90
+ require('../../../../context/PasskeyContext/PasskeyContext.cjs');
91
+ require('../../../../context/OnrampContext/OnrampContext.cjs');
92
+ require('../../../../store/state/sendBalances.cjs');
93
+ require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
94
+ require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
95
+ require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
96
+ require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
97
+ require('../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
98
+ require('../../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
99
+ require('../../../../../index.cjs');
100
+ require('../../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
101
+ require('../../../../store/state/tokenBalances.cjs');
102
+ require('../../../../store/state/multichainBalances.cjs');
103
+ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
104
+ var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
105
+
106
+ const useUnlinkUserEmail = () => {
107
+ const { environmentId } = useInternalDynamicContext.useInternalDynamicContext();
108
+ const unlinkUserEmail = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ verifiedCredentialId }) {
109
+ var _b;
110
+ const user$1 = (_b = client.getDynamicClient()) === null || _b === void 0 ? void 0 : _b.user;
111
+ const primaryWalletId$1 = primaryWalletId.getPrimaryWalletId();
112
+ if (!primaryWalletId$1) {
113
+ throw new utils.DynamicError('Primary wallet not found');
114
+ }
115
+ const verifiedCredential = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.find((credential) => credential.id === verifiedCredentialId);
116
+ if (!verifiedCredential) {
117
+ throw new utils.DynamicError('Verified credential not found');
118
+ }
119
+ if (verifiedCredential.format !== sdkApiCore.JwtVerifiedCredentialFormatEnum.Email) {
120
+ throw new utils.DynamicError('Verified credential is not an email');
121
+ }
122
+ return user.unlinkEmail({
123
+ environmentId,
124
+ primaryWalletId: primaryWalletId$1,
125
+ verifiedCredentialId,
126
+ });
127
+ }), [environmentId]);
128
+ return unlinkUserEmail;
129
+ };
130
+
131
+ exports.useUnlinkUserEmail = useUnlinkUserEmail;
@@ -0,0 +1,6 @@
1
+ import { UserProfile } from '@dynamic-labs/types';
2
+ export type UnlinkUserEmailArgs = {
3
+ verifiedCredentialId: string;
4
+ };
5
+ export type UnlinkUserEmail = (args: UnlinkUserEmailArgs) => Promise<UserProfile | undefined>;
6
+ export declare const useUnlinkUserEmail: () => UnlinkUserEmail;
@@ -0,0 +1,127 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
3
+ import { useCallback } from 'react';
4
+ import { DynamicError } from '@dynamic-labs/utils';
5
+ import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
6
+ import '../../../../context/DynamicContext/DynamicContext.js';
7
+ import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
8
+ import '@dynamic-labs/iconic';
9
+ import '@dynamic-labs/wallet-connector-core';
10
+ import 'react/jsx-runtime';
11
+ import '../../../../context/ViewContext/ViewContext.js';
12
+ import '../../../../shared/logger.js';
13
+ import '@dynamic-labs/wallet-book';
14
+ import '../../../constants/colors.js';
15
+ import '../../../constants/values.js';
16
+ import '../../../../shared/consts/index.js';
17
+ import '../../../../events/dynamicEvents.js';
18
+ import '../../../../context/CaptchaContext/CaptchaContext.js';
19
+ import '../../../../context/ErrorContext/ErrorContext.js';
20
+ import '@dynamic-labs/multi-wallet';
21
+ import 'react-international-phone';
22
+ import '../../../../store/state/nonce/nonce.js';
23
+ import '@dynamic-labs-sdk/client/core';
24
+ import { getDynamicClient } from '../../../../client/client.js';
25
+ import '@dynamic-labs-sdk/client';
26
+ import '../../../../config/ApiEndpoint.js';
27
+ import '@dynamic-labs/locale';
28
+ import { unlinkEmail } from '../../../../data/api/user/user.js';
29
+ import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
30
+ import { getPrimaryWalletId } from '../../../../store/state/primaryWalletId/primaryWalletId.js';
31
+ import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
32
+ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
33
+ import '../../../../context/AccountExistsContext/AccountExistsContext.js';
34
+ import '../../../../context/UserWalletsContext/UserWalletsContext.js';
35
+ import '../../../../store/state/authMode/authMode.js';
36
+ import '../../../../context/VerificationContext/VerificationContext.js';
37
+ import 'react-dom';
38
+ import '../../../functions/compareChains/compareChains.js';
39
+ import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
40
+ import '../../../../context/ThemeContext/ThemeContext.js';
41
+ import '../useUpdateUser/userFieldsSchema.js';
42
+ import 'bs58';
43
+ import '@dynamic-labs/types';
44
+ import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
45
+ import '../../../../context/LoadingContext/LoadingContext.js';
46
+ import '../../../../context/WalletContext/WalletContext.js';
47
+ import '../../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
48
+ import 'yup';
49
+ import '../../../../context/MockContext/MockContext.js';
50
+ import '../../../../views/CollectUserDataView/useFields.js';
51
+ import '../../../../context/FieldsStateContext/FieldsStateContext.js';
52
+ import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
53
+ import '@dynamic-labs/rpc-providers';
54
+ import '../../../../store/state/walletOptions/walletOptions.js';
55
+ import 'react-i18next';
56
+ import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
57
+ import '../../../../components/Alert/Alert.js';
58
+ import '../../../../components/ShadowDOM/ShadowDOM.js';
59
+ import '../../../../components/IconButton/IconButton.js';
60
+ import '../../../../components/InlineWidget/InlineWidget.js';
61
+ import '../../../../components/Input/Input.js';
62
+ import '../../../../components/IsBrowser/IsBrowser.js';
63
+ import '../../../../components/MenuList/Dropdown/Dropdown.js';
64
+ import '../../../../components/OverlayCard/OverlayCard.js';
65
+ import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
66
+ import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
67
+ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
68
+ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
69
+ import '../../../../components/Popper/Popper/Popper.js';
70
+ import '../../../../components/Popper/PopperContext/PopperContext.js';
71
+ import 'react-focus-lock';
72
+ import 'qrcode';
73
+ import 'formik';
74
+ import '../../useSubdomainCheck/useSubdomainCheck.js';
75
+ import '../../../../context/WalletGroupContext/WalletGroupContext.js';
76
+ import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
77
+ import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
78
+ import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
79
+ import '@hcaptcha/react-hcaptcha';
80
+ import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
81
+ import '../../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
82
+ import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
83
+ import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
84
+ import '../../../../context/FooterAnimationContext/index.js';
85
+ import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
86
+ import '../../../../context/PasskeyContext/PasskeyContext.js';
87
+ import '../../../../context/OnrampContext/OnrampContext.js';
88
+ import '../../../../store/state/sendBalances.js';
89
+ import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
90
+ import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
91
+ import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
92
+ import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
93
+ import '../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
94
+ import '../../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
95
+ import '../../../../../index.js';
96
+ import '../../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
97
+ import '../../../../store/state/tokenBalances.js';
98
+ import '../../../../store/state/multichainBalances.js';
99
+ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
100
+ import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
101
+
102
+ const useUnlinkUserEmail = () => {
103
+ const { environmentId } = useInternalDynamicContext();
104
+ const unlinkUserEmail = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ verifiedCredentialId }) {
105
+ var _b;
106
+ const user = (_b = getDynamicClient()) === null || _b === void 0 ? void 0 : _b.user;
107
+ const primaryWalletId = getPrimaryWalletId();
108
+ if (!primaryWalletId) {
109
+ throw new DynamicError('Primary wallet not found');
110
+ }
111
+ const verifiedCredential = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.id === verifiedCredentialId);
112
+ if (!verifiedCredential) {
113
+ throw new DynamicError('Verified credential not found');
114
+ }
115
+ if (verifiedCredential.format !== JwtVerifiedCredentialFormatEnum.Email) {
116
+ throw new DynamicError('Verified credential is not an email');
117
+ }
118
+ return unlinkEmail({
119
+ environmentId,
120
+ primaryWalletId,
121
+ verifiedCredentialId,
122
+ });
123
+ }), [environmentId]);
124
+ return unlinkUserEmail;
125
+ };
126
+
127
+ export { useUnlinkUserEmail };
@@ -5,12 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var useUpdateUser = require('./useUpdateUser/useUpdateUser.cjs');
7
7
  var useUpdateUserWithModal = require('./useUpdateUserWithModal/useUpdateUserWithModal.cjs');
8
+ var unlinkUserEmail = require('./unlinkUserEmail/unlinkUserEmail.cjs');
8
9
 
9
10
  // Hook only available internally
10
11
  const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
11
12
  const updateUser = useUpdateUser.useUpdateUser(validationSchemaStripUnknown);
12
13
  const updateUserWithModal = useUpdateUserWithModal.useUpdateUserWithModal(updateUser);
13
- return { updateUser, updateUserWithModal };
14
+ const unlinkUserEmail$1 = unlinkUserEmail.useUnlinkUserEmail();
15
+ return { unlinkUserEmail: unlinkUserEmail$1, updateUser, updateUserWithModal };
14
16
  };
15
17
  // Hook exposed to the clients
16
18
  // We do not want customers to be able to edit properties such as policiesConsent or captchaToken
@@ -1,10 +1,12 @@
1
1
  export declare const useUserUpdateRequestInternal: ({ validationSchemaStripUnknown, }: {
2
2
  validationSchemaStripUnknown: boolean;
3
3
  }) => {
4
+ unlinkUserEmail: import("./unlinkUserEmail/unlinkUserEmail").UnlinkUserEmail;
4
5
  updateUser: import("./useUpdateUser").UpdateUser;
5
6
  updateUserWithModal: (fields: import("./useUpdateUserWithModal").UpdateUserWithModalFields, options?: import("./useUpdateUserWithModal").UpdateUserWithModalOptions | undefined) => Promise<import("@dynamic-labs/sdk-api-core").UserFields>;
6
7
  };
7
8
  export declare const useUserUpdateRequest: () => {
9
+ unlinkUserEmail: import("./unlinkUserEmail/unlinkUserEmail").UnlinkUserEmail;
8
10
  updateUser: import("./useUpdateUser").UpdateUser;
9
11
  updateUserWithModal: (fields: import("./useUpdateUserWithModal").UpdateUserWithModalFields, options?: import("./useUpdateUserWithModal").UpdateUserWithModalOptions | undefined) => Promise<import("@dynamic-labs/sdk-api-core").UserFields>;
10
12
  };
@@ -1,12 +1,14 @@
1
1
  'use client'
2
2
  import { useUpdateUser } from './useUpdateUser/useUpdateUser.js';
3
3
  import { useUpdateUserWithModal } from './useUpdateUserWithModal/useUpdateUserWithModal.js';
4
+ import { useUnlinkUserEmail } from './unlinkUserEmail/unlinkUserEmail.js';
4
5
 
5
6
  // Hook only available internally
6
7
  const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
7
8
  const updateUser = useUpdateUser(validationSchemaStripUnknown);
8
9
  const updateUserWithModal = useUpdateUserWithModal(updateUser);
9
- return { updateUser, updateUserWithModal };
10
+ const unlinkUserEmail = useUnlinkUserEmail();
11
+ return { unlinkUserEmail, updateUser, updateUserWithModal };
10
12
  };
11
13
  // Hook exposed to the clients
12
14
  // We do not want customers to be able to edit properties such as policiesConsent or captchaToken
@@ -107,7 +107,9 @@ require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds
107
107
  var useNetworkDataFromWallet = require('../../utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.cjs');
108
108
  var useTokenBalances = require('../../utils/hooks/useTokenBalances/useTokenBalances.cjs');
109
109
  require('../../store/state/multichainBalances.cjs');
110
+ var usePromptMfaAuth = require('../../utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs');
110
111
  require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
112
+ var useIsMfaRequiredForAction = require('../../utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs');
111
113
  var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
112
114
 
113
115
  const usingNative = (token) => Boolean(token.isNative);
@@ -135,6 +137,8 @@ const getSupportedChainName = (connectedChain) => {
135
137
  const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
136
138
  const [stage, setStage] = React.useState('form');
137
139
  const { primaryWallet, walletUiUtils } = useInternalDynamicContext.useInternalDynamicContext();
140
+ const isMfaRequiredForAction = useIsMfaRequiredForAction.useIsMfaRequiredForAction();
141
+ const promptMfaAuth = usePromptMfaAuth.usePromptMfaAuth();
138
142
  const { t } = reactI18next.useTranslation();
139
143
  const [isNativeToken, setIsNativeToken] = React.useState(false);
140
144
  const [currentToken, setCurrentToken] = React.useState(undefined);
@@ -221,10 +225,18 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
221
225
  const buildFormStage = () => (jsxRuntime.jsx(SendBalancePageLayout.SendBalancePageLayout, { transaction: transaction, onClickBack: onClickBack, networkName: networkData.vanityName || networkData.name, networkIcon: currencyIcon, networkCurrencyDecimals: networkData.nativeCurrency.symbol === 'SOL'
222
226
  ? 9
223
227
  : networkData.nativeCurrency.decimals, walletAddress: shortenWalletAddress.shortenWalletAddress(currentToken === null || currentToken === void 0 ? void 0 : currentToken.address), walletKey: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.key, onClickClose: onClickClose, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSubmit: () => setStage('confirmation'), tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, isNativeToken: isNativeToken }));
224
- const buildTransactionStage = () => (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => {
228
+ const buildTransactionStage = () => (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
229
+ if (primaryWallet.connector.key === 'dynamicwaas') {
230
+ const isMfaRequired = yield isMfaRequiredForAction({
231
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
232
+ });
233
+ if (isMfaRequired) {
234
+ yield promptMfaAuth({ createMfaToken: true });
235
+ }
236
+ }
225
237
  walletUiUtils.disabledConfirmationOnce();
226
238
  return transaction.submit();
227
- }, copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
239
+ }), copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
228
240
  if (!txHash)
229
241
  return;
230
242
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(txHash);
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { useState, useEffect } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
- import { ChainEnum } from '@dynamic-labs/sdk-api-core';
6
+ import { ChainEnum, MFAAction } from '@dynamic-labs/sdk-api-core';
7
7
  import { DynamicError } from '@dynamic-labs/utils';
8
8
  import { isSendBalanceWalletConnector } from '@dynamic-labs/wallet-connector-core';
9
9
  import { ChainIcon } from '../../components/ChainIcon/ChainIcon.js';
@@ -103,7 +103,9 @@ import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.
103
103
  import { useNetworkDataFromWallet } from '../../utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.js';
104
104
  import { useTokenBalances } from '../../utils/hooks/useTokenBalances/useTokenBalances.js';
105
105
  import '../../store/state/multichainBalances.js';
106
+ import { usePromptMfaAuth } from '../../utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js';
106
107
  import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
108
+ import { useIsMfaRequiredForAction } from '../../utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js';
107
109
  import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
108
110
 
109
111
  const usingNative = (token) => Boolean(token.isNative);
@@ -131,6 +133,8 @@ const getSupportedChainName = (connectedChain) => {
131
133
  const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
132
134
  const [stage, setStage] = useState('form');
133
135
  const { primaryWallet, walletUiUtils } = useInternalDynamicContext();
136
+ const isMfaRequiredForAction = useIsMfaRequiredForAction();
137
+ const promptMfaAuth = usePromptMfaAuth();
134
138
  const { t } = useTranslation();
135
139
  const [isNativeToken, setIsNativeToken] = useState(false);
136
140
  const [currentToken, setCurrentToken] = useState(undefined);
@@ -217,10 +221,18 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
217
221
  const buildFormStage = () => (jsx(SendBalancePageLayout, { transaction: transaction, onClickBack: onClickBack, networkName: networkData.vanityName || networkData.name, networkIcon: currencyIcon, networkCurrencyDecimals: networkData.nativeCurrency.symbol === 'SOL'
218
222
  ? 9
219
223
  : networkData.nativeCurrency.decimals, walletAddress: shortenWalletAddress(currentToken === null || currentToken === void 0 ? void 0 : currentToken.address), walletKey: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.key, onClickClose: onClickClose, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSubmit: () => setStage('confirmation'), tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, isNativeToken: isNativeToken }));
220
- const buildTransactionStage = () => (jsx(TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => {
224
+ const buildTransactionStage = () => (jsx(TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
225
+ if (primaryWallet.connector.key === 'dynamicwaas') {
226
+ const isMfaRequired = yield isMfaRequiredForAction({
227
+ mfaAction: MFAAction.WalletWaasSign,
228
+ });
229
+ if (isMfaRequired) {
230
+ yield promptMfaAuth({ createMfaToken: true });
231
+ }
232
+ }
221
233
  walletUiUtils.disabledConfirmationOnce();
222
234
  return transaction.submit();
223
- }, copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => __awaiter(void 0, void 0, void 0, function* () {
235
+ }), copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => __awaiter(void 0, void 0, void 0, function* () {
224
236
  if (!txHash)
225
237
  return;
226
238
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(txHash);