@dynamic-labs/sdk-react-core 4.88.1 → 4.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -153
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +6 -0
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +6 -0
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.cjs +8 -0
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.js +8 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/index.d.ts +1 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/useRestoreOtpVerificationState.cjs +48 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/useRestoreOtpVerificationState.d.ts +16 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/useRestoreOtpVerificationState.js +44 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.cjs +88 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.d.ts +16 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.js +84 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/index.d.ts +1 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.cjs +67 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.d.ts +17 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.js +63 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/index.d.ts +1 -0
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.cjs +23 -47
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.d.ts +1 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.js +23 -47
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +19 -34
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.d.ts +1 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +19 -34
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/index.d.ts +2 -0
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.cjs +60 -0
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.d.ts +30 -0
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.js +54 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -3
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +4 -4
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +10 -2
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +10 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +11 -10
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +12 -11
- package/src/lib/utils/hooks/useReconcileInstalledWallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.cjs +69 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.d.ts +7 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.js +65 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.cjs +42 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.d.ts +17 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.js +38 -0
- package/src/lib/utils/hooks/useWalletList/useWalletList.cjs +27 -26
- package/src/lib/utils/hooks/useWalletList/useWalletList.js +27 -26
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +26 -21
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +26 -21
package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import '@dynamic-labs-sdk/client/core';
|
|
4
|
+
import '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'eventemitter3';
|
|
7
|
+
import '@dynamic-labs/utils';
|
|
8
|
+
import '@dynamic-labs-sdk/client';
|
|
9
|
+
import '../../../../config/ApiEndpoint.js';
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
+
import 'react/jsx-runtime';
|
|
13
|
+
import '../../../ViewContext/ViewContext.js';
|
|
14
|
+
import '../../../../shared/logger.js';
|
|
15
|
+
import '@dynamic-labs/wallet-book';
|
|
16
|
+
import '../../../../utils/constants/colors.js';
|
|
17
|
+
import '../../../../utils/constants/values.js';
|
|
18
|
+
import '../../../../shared/consts/index.js';
|
|
19
|
+
import '@dynamic-labs/multi-wallet';
|
|
20
|
+
import 'react-international-phone';
|
|
21
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
22
|
+
import { retryEmailVerification, signInWithEmailVerification } from '../../../../data/api/email/email.js';
|
|
23
|
+
import '@dynamic-labs/locale';
|
|
24
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
25
|
+
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
26
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
27
|
+
import '../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
28
|
+
import '../../../../events/dynamicEvents.js';
|
|
29
|
+
import { storeTokenAndUser } from '../../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
30
|
+
import { generateSessionKeys } from '../../../../client/extension/functions/generateSessionKeys/generateSessionKeys.js';
|
|
31
|
+
import { persistOtpVerificationState } from '../otpVerificationStorage/otpVerificationStorage.js';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Builds a ProviderVerificationHandler for email OTP from the given parameters.
|
|
35
|
+
* Used both after creating a new email verification and when restoring a
|
|
36
|
+
* persisted verification state after a webview remount.
|
|
37
|
+
*/
|
|
38
|
+
const buildEmailOtpHandler = ({ captchaToken, email, embeddedWalletSessionKeys: { shouldRegisterSessionKeysOnSignin, generateSessionKey, }, environmentId, initialVerificationUUID, }) => {
|
|
39
|
+
// Mutable so retry can update the UUID for subsequent verify calls
|
|
40
|
+
let verificationUUID = initialVerificationUUID;
|
|
41
|
+
return {
|
|
42
|
+
retry: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
const retryEmailVerificationResponse = yield retryEmailVerification({
|
|
44
|
+
email,
|
|
45
|
+
environmentId,
|
|
46
|
+
verificationUUID,
|
|
47
|
+
});
|
|
48
|
+
// eslint-disable-next-line prefer-destructuring
|
|
49
|
+
verificationUUID = retryEmailVerificationResponse.verificationUUID;
|
|
50
|
+
persistOtpVerificationState({
|
|
51
|
+
captchaToken,
|
|
52
|
+
destination: email,
|
|
53
|
+
type: 'email',
|
|
54
|
+
verificationUUID,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
57
|
+
type: 'email',
|
|
58
|
+
verify: (oneTimePassword, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
let sessionPublicKey = undefined;
|
|
60
|
+
if (shouldRegisterSessionKeysOnSignin()) {
|
|
61
|
+
const keypair = yield generateSessionKey();
|
|
62
|
+
sessionPublicKey = keypair.publicKey;
|
|
63
|
+
}
|
|
64
|
+
yield generateSessionKeys();
|
|
65
|
+
const response = yield signInWithEmailVerification({
|
|
66
|
+
captchaToken,
|
|
67
|
+
environmentId,
|
|
68
|
+
sessionPublicKey,
|
|
69
|
+
verificationToken: oneTimePassword,
|
|
70
|
+
verificationUUID,
|
|
71
|
+
});
|
|
72
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
73
|
+
storeTokenAndUser(response);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
destination: email,
|
|
77
|
+
response: response,
|
|
78
|
+
verified: true,
|
|
79
|
+
};
|
|
80
|
+
}),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { buildEmailOtpHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildEmailOtpHandler } from './buildEmailOtpHandler';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
require('@dynamic-labs-sdk/client/core');
|
|
8
|
+
require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
require('react');
|
|
10
|
+
require('eventemitter3');
|
|
11
|
+
require('@dynamic-labs/utils');
|
|
12
|
+
require('@dynamic-labs-sdk/client');
|
|
13
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
14
|
+
require('@dynamic-labs/iconic');
|
|
15
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
+
require('react/jsx-runtime');
|
|
17
|
+
require('../../../ViewContext/ViewContext.cjs');
|
|
18
|
+
require('../../../../shared/logger.cjs');
|
|
19
|
+
require('@dynamic-labs/wallet-book');
|
|
20
|
+
require('../../../../utils/constants/colors.cjs');
|
|
21
|
+
require('../../../../utils/constants/values.cjs');
|
|
22
|
+
require('../../../../shared/consts/index.cjs');
|
|
23
|
+
require('@dynamic-labs/multi-wallet');
|
|
24
|
+
require('react-international-phone');
|
|
25
|
+
require('../../../../store/state/nonce/nonce.cjs');
|
|
26
|
+
var sms = require('../../../../data/api/sms/sms.cjs');
|
|
27
|
+
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
|
+
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
|
+
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
+
require('../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
31
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
32
|
+
var storeTokenAndUser = require('../../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
|
|
33
|
+
var generateSessionKeys = require('../../../../client/extension/functions/generateSessionKeys/generateSessionKeys.cjs');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Builds a ProviderVerificationHandler for SMS OTP from the given parameters.
|
|
37
|
+
* Used both after creating a new SMS verification and when restoring a
|
|
38
|
+
* persisted verification state after a webview remount.
|
|
39
|
+
*/
|
|
40
|
+
const buildSmsOtpHandler = ({ captchaToken, embeddedWalletSessionKeys: { shouldRegisterSessionKeysOnSignin, generateSessionKey, }, environmentId, phone, verificationUUID, }) => ({
|
|
41
|
+
type: 'sms',
|
|
42
|
+
verify: (oneTimePassword, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
let sessionPublicKey = undefined;
|
|
44
|
+
if (shouldRegisterSessionKeysOnSignin()) {
|
|
45
|
+
const keypair = yield generateSessionKey();
|
|
46
|
+
sessionPublicKey = keypair.publicKey;
|
|
47
|
+
}
|
|
48
|
+
yield generateSessionKeys.generateSessionKeys();
|
|
49
|
+
const response = yield sms.signInWithSmsVerification({
|
|
50
|
+
captchaToken,
|
|
51
|
+
environmentId,
|
|
52
|
+
sessionPublicKey,
|
|
53
|
+
verificationToken: oneTimePassword,
|
|
54
|
+
verificationUUID,
|
|
55
|
+
});
|
|
56
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
57
|
+
storeTokenAndUser.storeTokenAndUser(response);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
destination: phone,
|
|
61
|
+
response: response,
|
|
62
|
+
verified: true,
|
|
63
|
+
};
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
exports.buildSmsOtpHandler = buildSmsOtpHandler;
|
package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PhoneData } from '@dynamic-labs/types';
|
|
2
|
+
import { useEmbeddedWalletSessionKeys } from '../../../../utils/hooks';
|
|
3
|
+
import { ProviderVerificationHandler } from '../../types';
|
|
4
|
+
type BuildSmsOtpHandlerParams = {
|
|
5
|
+
captchaToken: string | undefined;
|
|
6
|
+
embeddedWalletSessionKeys: ReturnType<typeof useEmbeddedWalletSessionKeys>;
|
|
7
|
+
environmentId: string;
|
|
8
|
+
phone: PhoneData;
|
|
9
|
+
verificationUUID: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Builds a ProviderVerificationHandler for SMS OTP from the given parameters.
|
|
13
|
+
* Used both after creating a new SMS verification and when restoring a
|
|
14
|
+
* persisted verification state after a webview remount.
|
|
15
|
+
*/
|
|
16
|
+
export declare const buildSmsOtpHandler: ({ captchaToken, embeddedWalletSessionKeys: { shouldRegisterSessionKeysOnSignin, generateSessionKey, }, environmentId, phone, verificationUUID, }: BuildSmsOtpHandlerParams) => ProviderVerificationHandler<PhoneData>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import '@dynamic-labs-sdk/client/core';
|
|
4
|
+
import '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'eventemitter3';
|
|
7
|
+
import '@dynamic-labs/utils';
|
|
8
|
+
import '@dynamic-labs-sdk/client';
|
|
9
|
+
import '../../../../config/ApiEndpoint.js';
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
+
import 'react/jsx-runtime';
|
|
13
|
+
import '../../../ViewContext/ViewContext.js';
|
|
14
|
+
import '../../../../shared/logger.js';
|
|
15
|
+
import '@dynamic-labs/wallet-book';
|
|
16
|
+
import '../../../../utils/constants/colors.js';
|
|
17
|
+
import '../../../../utils/constants/values.js';
|
|
18
|
+
import '../../../../shared/consts/index.js';
|
|
19
|
+
import '@dynamic-labs/multi-wallet';
|
|
20
|
+
import 'react-international-phone';
|
|
21
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
22
|
+
import { signInWithSmsVerification } from '../../../../data/api/sms/sms.js';
|
|
23
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
|
+
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
+
import '../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
27
|
+
import '../../../../events/dynamicEvents.js';
|
|
28
|
+
import { storeTokenAndUser } from '../../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
29
|
+
import { generateSessionKeys } from '../../../../client/extension/functions/generateSessionKeys/generateSessionKeys.js';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Builds a ProviderVerificationHandler for SMS OTP from the given parameters.
|
|
33
|
+
* Used both after creating a new SMS verification and when restoring a
|
|
34
|
+
* persisted verification state after a webview remount.
|
|
35
|
+
*/
|
|
36
|
+
const buildSmsOtpHandler = ({ captchaToken, embeddedWalletSessionKeys: { shouldRegisterSessionKeysOnSignin, generateSessionKey, }, environmentId, phone, verificationUUID, }) => ({
|
|
37
|
+
type: 'sms',
|
|
38
|
+
verify: (oneTimePassword, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
let sessionPublicKey = undefined;
|
|
40
|
+
if (shouldRegisterSessionKeysOnSignin()) {
|
|
41
|
+
const keypair = yield generateSessionKey();
|
|
42
|
+
sessionPublicKey = keypair.publicKey;
|
|
43
|
+
}
|
|
44
|
+
yield generateSessionKeys();
|
|
45
|
+
const response = yield signInWithSmsVerification({
|
|
46
|
+
captchaToken,
|
|
47
|
+
environmentId,
|
|
48
|
+
sessionPublicKey,
|
|
49
|
+
verificationToken: oneTimePassword,
|
|
50
|
+
verificationUUID,
|
|
51
|
+
});
|
|
52
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
53
|
+
storeTokenAndUser(response);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
destination: phone,
|
|
57
|
+
response: response,
|
|
58
|
+
verified: true,
|
|
59
|
+
};
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export { buildSmsOtpHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildSmsOtpHandler } from './buildSmsOtpHandler';
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
require('
|
|
7
|
+
var email = require('../../../data/api/email/email.cjs');
|
|
8
8
|
require('@dynamic-labs/sdk-api-core');
|
|
9
|
-
require('react');
|
|
10
|
-
require('eventemitter3');
|
|
11
9
|
require('@dynamic-labs/utils');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
14
10
|
require('@dynamic-labs/iconic');
|
|
15
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('react');
|
|
16
13
|
require('react/jsx-runtime');
|
|
17
14
|
require('../../ViewContext/ViewContext.cjs');
|
|
18
15
|
require('../../../shared/logger.cjs');
|
|
@@ -20,63 +17,42 @@ require('@dynamic-labs/wallet-book');
|
|
|
20
17
|
require('../../../utils/constants/colors.cjs');
|
|
21
18
|
require('../../../utils/constants/values.cjs');
|
|
22
19
|
require('../../../shared/consts/index.cjs');
|
|
20
|
+
require('@dynamic-labs-sdk/client/core');
|
|
21
|
+
require('eventemitter3');
|
|
22
|
+
require('@dynamic-labs-sdk/client');
|
|
23
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
23
24
|
require('@dynamic-labs/multi-wallet');
|
|
24
25
|
require('react-international-phone');
|
|
25
26
|
require('../../../store/state/nonce/nonce.cjs');
|
|
26
|
-
var email = require('../../../data/api/email/email.cjs');
|
|
27
|
-
require('@dynamic-labs/locale');
|
|
28
27
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
29
28
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
30
29
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
31
30
|
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
32
31
|
require('../../../events/dynamicEvents.cjs');
|
|
33
|
-
|
|
34
|
-
var
|
|
32
|
+
require('@dynamic-labs/locale');
|
|
33
|
+
var buildEmailOtpHandler = require('./buildEmailOtpHandler/buildEmailOtpHandler.cjs');
|
|
34
|
+
var otpVerificationStorage = require('./otpVerificationStorage/otpVerificationStorage.cjs');
|
|
35
35
|
|
|
36
|
-
const createEmailHandler = (environmentId,
|
|
36
|
+
const createEmailHandler = (environmentId, embeddedWalletSessionKeys) => (email$1, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
const createEmailVerificationResponse = yield email.createEmailVerification({
|
|
38
38
|
captchaToken,
|
|
39
39
|
email: email$1,
|
|
40
40
|
environmentId,
|
|
41
41
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
email: email$1,
|
|
47
|
-
environmentId,
|
|
48
|
-
verificationUUID,
|
|
49
|
-
});
|
|
50
|
-
// eslint-disable-next-line prefer-destructuring
|
|
51
|
-
verificationUUID = retryEmailVerificationResponse.verificationUUID;
|
|
52
|
-
}),
|
|
42
|
+
const { verificationUUID } = createEmailVerificationResponse;
|
|
43
|
+
otpVerificationStorage.persistOtpVerificationState({
|
|
44
|
+
captchaToken,
|
|
45
|
+
destination: email$1,
|
|
53
46
|
type: 'email',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
environmentId,
|
|
64
|
-
sessionPublicKey,
|
|
65
|
-
verificationToken: oneTimePassword,
|
|
66
|
-
verificationUUID,
|
|
67
|
-
});
|
|
68
|
-
// Skip setting the user auth token and only return the VerifyResponse
|
|
69
|
-
// if needed because setUser can trigger view re-renders.
|
|
70
|
-
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
71
|
-
storeTokenAndUser.storeTokenAndUser(response);
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
destination: email$1,
|
|
75
|
-
response: response,
|
|
76
|
-
verified: true,
|
|
77
|
-
};
|
|
78
|
-
}),
|
|
79
|
-
};
|
|
47
|
+
verificationUUID,
|
|
48
|
+
});
|
|
49
|
+
return buildEmailOtpHandler.buildEmailOtpHandler({
|
|
50
|
+
captchaToken,
|
|
51
|
+
email: email$1,
|
|
52
|
+
embeddedWalletSessionKeys,
|
|
53
|
+
environmentId,
|
|
54
|
+
initialVerificationUUID: verificationUUID,
|
|
55
|
+
});
|
|
80
56
|
});
|
|
81
57
|
|
|
82
58
|
exports.createEmailHandler = createEmailHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { useEmbeddedWalletSessionKeys } from '../../../utils/hooks';
|
|
2
2
|
import { ProviderHandler } from '../types';
|
|
3
|
-
export declare const createEmailHandler: (environmentId: string,
|
|
3
|
+
export declare const createEmailHandler: (environmentId: string, embeddedWalletSessionKeys: ReturnType<typeof useEmbeddedWalletSessionKeys>) => ProviderHandler<string>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import '
|
|
3
|
+
import { createEmailVerification } from '../../../data/api/email/email.js';
|
|
4
4
|
import '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import 'react';
|
|
6
|
-
import 'eventemitter3';
|
|
7
5
|
import '@dynamic-labs/utils';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
|
-
import '../../../config/ApiEndpoint.js';
|
|
10
6
|
import '@dynamic-labs/iconic';
|
|
11
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import 'react';
|
|
12
9
|
import 'react/jsx-runtime';
|
|
13
10
|
import '../../ViewContext/ViewContext.js';
|
|
14
11
|
import '../../../shared/logger.js';
|
|
@@ -16,63 +13,42 @@ import '@dynamic-labs/wallet-book';
|
|
|
16
13
|
import '../../../utils/constants/colors.js';
|
|
17
14
|
import '../../../utils/constants/values.js';
|
|
18
15
|
import '../../../shared/consts/index.js';
|
|
16
|
+
import '@dynamic-labs-sdk/client/core';
|
|
17
|
+
import 'eventemitter3';
|
|
18
|
+
import '@dynamic-labs-sdk/client';
|
|
19
|
+
import '../../../config/ApiEndpoint.js';
|
|
19
20
|
import '@dynamic-labs/multi-wallet';
|
|
20
21
|
import 'react-international-phone';
|
|
21
22
|
import '../../../store/state/nonce/nonce.js';
|
|
22
|
-
import { createEmailVerification, retryEmailVerification, signInWithEmailVerification } from '../../../data/api/email/email.js';
|
|
23
|
-
import '@dynamic-labs/locale';
|
|
24
23
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
25
24
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
26
25
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
27
26
|
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
28
27
|
import '../../../events/dynamicEvents.js';
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
28
|
+
import '@dynamic-labs/locale';
|
|
29
|
+
import { buildEmailOtpHandler } from './buildEmailOtpHandler/buildEmailOtpHandler.js';
|
|
30
|
+
import { persistOtpVerificationState } from './otpVerificationStorage/otpVerificationStorage.js';
|
|
31
31
|
|
|
32
|
-
const createEmailHandler = (environmentId,
|
|
32
|
+
const createEmailHandler = (environmentId, embeddedWalletSessionKeys) => (email, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
33
|
const createEmailVerificationResponse = yield createEmailVerification({
|
|
34
34
|
captchaToken,
|
|
35
35
|
email,
|
|
36
36
|
environmentId,
|
|
37
37
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
email,
|
|
43
|
-
environmentId,
|
|
44
|
-
verificationUUID,
|
|
45
|
-
});
|
|
46
|
-
// eslint-disable-next-line prefer-destructuring
|
|
47
|
-
verificationUUID = retryEmailVerificationResponse.verificationUUID;
|
|
48
|
-
}),
|
|
38
|
+
const { verificationUUID } = createEmailVerificationResponse;
|
|
39
|
+
persistOtpVerificationState({
|
|
40
|
+
captchaToken,
|
|
41
|
+
destination: email,
|
|
49
42
|
type: 'email',
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
environmentId,
|
|
60
|
-
sessionPublicKey,
|
|
61
|
-
verificationToken: oneTimePassword,
|
|
62
|
-
verificationUUID,
|
|
63
|
-
});
|
|
64
|
-
// Skip setting the user auth token and only return the VerifyResponse
|
|
65
|
-
// if needed because setUser can trigger view re-renders.
|
|
66
|
-
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
67
|
-
storeTokenAndUser(response);
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
destination: email,
|
|
71
|
-
response: response,
|
|
72
|
-
verified: true,
|
|
73
|
-
};
|
|
74
|
-
}),
|
|
75
|
-
};
|
|
43
|
+
verificationUUID,
|
|
44
|
+
});
|
|
45
|
+
return buildEmailOtpHandler({
|
|
46
|
+
captchaToken,
|
|
47
|
+
email,
|
|
48
|
+
embeddedWalletSessionKeys,
|
|
49
|
+
environmentId,
|
|
50
|
+
initialVerificationUUID: verificationUUID,
|
|
51
|
+
});
|
|
76
52
|
});
|
|
77
53
|
|
|
78
54
|
export { createEmailHandler };
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
require('@dynamic-labs-sdk/client
|
|
7
|
+
require('@dynamic-labs-sdk/client');
|
|
8
|
+
require('@dynamic-labs/utils');
|
|
8
9
|
require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
require('@dynamic-labs-sdk/client/core');
|
|
9
11
|
require('react');
|
|
10
12
|
require('eventemitter3');
|
|
11
|
-
require('@dynamic-labs/utils');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
13
|
require('../../../config/ApiEndpoint.cjs');
|
|
14
14
|
require('@dynamic-labs/iconic');
|
|
15
15
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -23,16 +23,16 @@ require('../../../shared/consts/index.cjs');
|
|
|
23
23
|
require('@dynamic-labs/multi-wallet');
|
|
24
24
|
require('react-international-phone');
|
|
25
25
|
require('../../../store/state/nonce/nonce.cjs');
|
|
26
|
-
var sms = require('../../../data/api/sms/sms.cjs');
|
|
27
26
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
27
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
28
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
29
|
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
31
30
|
require('../../../events/dynamicEvents.cjs');
|
|
32
|
-
var
|
|
33
|
-
var
|
|
31
|
+
var sms = require('../../../data/api/sms/sms.cjs');
|
|
32
|
+
var buildSmsOtpHandler = require('./buildSmsOtpHandler/buildSmsOtpHandler.cjs');
|
|
33
|
+
var otpVerificationStorage = require('./otpVerificationStorage/otpVerificationStorage.cjs');
|
|
34
34
|
|
|
35
|
-
const createSmsHandler = (environmentId,
|
|
35
|
+
const createSmsHandler = (environmentId, embeddedWalletSessionKeys) => (phone, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
const { verificationUUID } = yield sms.createSmsVerification({
|
|
37
37
|
captchaToken,
|
|
38
38
|
environmentId,
|
|
@@ -40,34 +40,19 @@ const createSmsHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, ge
|
|
|
40
40
|
phoneCountryCode: phone.dialCode,
|
|
41
41
|
phoneNumber: phone.phone,
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
otpVerificationStorage.persistOtpVerificationState({
|
|
44
|
+
captchaToken,
|
|
45
|
+
destination: phone,
|
|
44
46
|
type: 'sms',
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
environmentId,
|
|
55
|
-
sessionPublicKey,
|
|
56
|
-
verificationToken: oneTimePassword,
|
|
57
|
-
verificationUUID,
|
|
58
|
-
});
|
|
59
|
-
// Skip setting the user auth token and only return the VerifyResponse
|
|
60
|
-
// if needed because setUser can trigger view re-renders.
|
|
61
|
-
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
62
|
-
storeTokenAndUser.storeTokenAndUser(response);
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
destination: phone,
|
|
66
|
-
response: response,
|
|
67
|
-
verified: true,
|
|
68
|
-
};
|
|
69
|
-
}),
|
|
70
|
-
};
|
|
47
|
+
verificationUUID,
|
|
48
|
+
});
|
|
49
|
+
return buildSmsOtpHandler.buildSmsOtpHandler({
|
|
50
|
+
captchaToken,
|
|
51
|
+
embeddedWalletSessionKeys,
|
|
52
|
+
environmentId,
|
|
53
|
+
phone,
|
|
54
|
+
verificationUUID,
|
|
55
|
+
});
|
|
71
56
|
});
|
|
72
57
|
|
|
73
58
|
exports.createSmsHandler = createSmsHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PhoneData } from '@dynamic-labs/types';
|
|
2
2
|
import { useEmbeddedWalletSessionKeys } from '../../../utils/hooks';
|
|
3
3
|
import { ProviderHandler } from '../types';
|
|
4
|
-
export declare const createSmsHandler: (environmentId: string,
|
|
4
|
+
export declare const createSmsHandler: (environmentId: string, embeddedWalletSessionKeys: ReturnType<typeof useEmbeddedWalletSessionKeys>) => ProviderHandler<PhoneData>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import '@dynamic-labs-sdk/client
|
|
3
|
+
import '@dynamic-labs-sdk/client';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
4
5
|
import '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import '@dynamic-labs-sdk/client/core';
|
|
5
7
|
import 'react';
|
|
6
8
|
import 'eventemitter3';
|
|
7
|
-
import '@dynamic-labs/utils';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
9
|
import '../../../config/ApiEndpoint.js';
|
|
10
10
|
import '@dynamic-labs/iconic';
|
|
11
11
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -19,16 +19,16 @@ import '../../../shared/consts/index.js';
|
|
|
19
19
|
import '@dynamic-labs/multi-wallet';
|
|
20
20
|
import 'react-international-phone';
|
|
21
21
|
import '../../../store/state/nonce/nonce.js';
|
|
22
|
-
import { createSmsVerification, signInWithSmsVerification } from '../../../data/api/sms/sms.js';
|
|
23
22
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
23
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
24
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
25
|
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
27
26
|
import '../../../events/dynamicEvents.js';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
27
|
+
import { createSmsVerification } from '../../../data/api/sms/sms.js';
|
|
28
|
+
import { buildSmsOtpHandler } from './buildSmsOtpHandler/buildSmsOtpHandler.js';
|
|
29
|
+
import { persistOtpVerificationState } from './otpVerificationStorage/otpVerificationStorage.js';
|
|
30
30
|
|
|
31
|
-
const createSmsHandler = (environmentId,
|
|
31
|
+
const createSmsHandler = (environmentId, embeddedWalletSessionKeys) => (phone, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
32
|
const { verificationUUID } = yield createSmsVerification({
|
|
33
33
|
captchaToken,
|
|
34
34
|
environmentId,
|
|
@@ -36,34 +36,19 @@ const createSmsHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, ge
|
|
|
36
36
|
phoneCountryCode: phone.dialCode,
|
|
37
37
|
phoneNumber: phone.phone,
|
|
38
38
|
});
|
|
39
|
-
|
|
39
|
+
persistOtpVerificationState({
|
|
40
|
+
captchaToken,
|
|
41
|
+
destination: phone,
|
|
40
42
|
type: 'sms',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
environmentId,
|
|
51
|
-
sessionPublicKey,
|
|
52
|
-
verificationToken: oneTimePassword,
|
|
53
|
-
verificationUUID,
|
|
54
|
-
});
|
|
55
|
-
// Skip setting the user auth token and only return the VerifyResponse
|
|
56
|
-
// if needed because setUser can trigger view re-renders.
|
|
57
|
-
if (!(options === null || options === void 0 ? void 0 : options.skipSetUserAndAuthToken)) {
|
|
58
|
-
storeTokenAndUser(response);
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
destination: phone,
|
|
62
|
-
response: response,
|
|
63
|
-
verified: true,
|
|
64
|
-
};
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
43
|
+
verificationUUID,
|
|
44
|
+
});
|
|
45
|
+
return buildSmsOtpHandler({
|
|
46
|
+
captchaToken,
|
|
47
|
+
embeddedWalletSessionKeys,
|
|
48
|
+
environmentId,
|
|
49
|
+
phone,
|
|
50
|
+
verificationUUID,
|
|
51
|
+
});
|
|
67
52
|
});
|
|
68
53
|
|
|
69
54
|
export { createSmsHandler };
|