@dynamic-labs/sdk-react-core 5.11.0 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.cjs +5 -5
- package/package.js +5 -5
- package/package.json +16 -16
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.types.d.ts +1 -0
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpOtp.cjs +24 -17
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpOtp.js +24 -17
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +18 -3
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +18 -3
- package/src/lib/views/StepUpReauthOtpView/StepUpReauthOtpView.cjs +3 -3
- package/src/lib/views/StepUpReauthOtpView/StepUpReauthOtpView.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.12.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.11.0...v5.12.0) (2026-10-16)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **embedded-wallet-solana:** add getSolanaSponsorAddress ([#12517](https://github.com/dynamic-labs/dynamic-auth/issues/12517)) ([b95c550](https://github.com/dynamic-labs/dynamic-auth/commit/b95c550e3dab783b7ff0b019051a17b22ea44f97))
|
|
8
|
+
* **embedded-wallet:** show chain and wallet in private key export modal ([#12507](https://github.com/dynamic-labs/dynamic-auth/issues/12507)) ([4bfb6d6](https://github.com/dynamic-labs/dynamic-auth/commit/4bfb6d6168aac3f800792fde933e0597f288058f))
|
|
9
|
+
* **sdk-react-core:** send OTP purpose from step-up flows ([#12511](https://github.com/dynamic-labs/dynamic-auth/issues/12511)) ([0d2d8a3](https://github.com/dynamic-labs/dynamic-auth/commit/0d2d8a31058b3e75c71af7a34f459e2a3ddf383b)), closes [#12898](https://github.com/dynamic-labs/dynamic-auth/issues/12898) [#816](https://github.com/dynamic-labs/dynamic-auth/issues/816) [#203](https://github.com/dynamic-labs/dynamic-auth/issues/203) [#12512](https://github.com/dynamic-labs/dynamic-auth/issues/12512)
|
|
10
|
+
* **wallet-connect:** back WalletConnect storage with native secure storage on mobile ([#12515](https://github.com/dynamic-labs/dynamic-auth/issues/12515)) ([7b57903](https://github.com/dynamic-labs/dynamic-auth/commit/7b5790325fce707d73d591483a0130b960ed055c))
|
|
11
|
+
|
|
2
12
|
## [5.11.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.10.0...v5.11.0) (2026-10-14)
|
|
3
13
|
|
|
4
14
|
|
package/package.cjs
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "5.
|
|
6
|
+
var version = "5.12.0";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
9
|
-
"@dynamic-labs-sdk/client": "1.
|
|
10
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.1.
|
|
11
|
-
"@dynamic-labs-wallet/core": "1.1.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.104.0",
|
|
9
|
+
"@dynamic-labs-sdk/client": "1.41.0",
|
|
10
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
11
|
+
"@dynamic-labs-wallet/core": "1.1.43",
|
|
12
12
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
13
13
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
14
14
|
"@marsidev/react-turnstile": "1.5.2",
|
package/package.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "5.
|
|
2
|
+
var version = "5.12.0";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
5
|
-
"@dynamic-labs-sdk/client": "1.
|
|
6
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.1.
|
|
7
|
-
"@dynamic-labs-wallet/core": "1.1.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.104.0",
|
|
5
|
+
"@dynamic-labs-sdk/client": "1.41.0",
|
|
6
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
7
|
+
"@dynamic-labs-wallet/core": "1.1.43",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"@marsidev/react-turnstile": "1.5.2",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
6
|
-
"@dynamic-labs-sdk/client": "1.
|
|
7
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.1.
|
|
8
|
-
"@dynamic-labs-wallet/core": "1.1.
|
|
5
|
+
"@dynamic-labs/sdk-api-core": "0.104.0",
|
|
6
|
+
"@dynamic-labs-sdk/client": "1.41.0",
|
|
7
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
8
|
+
"@dynamic-labs-wallet/core": "1.1.43",
|
|
9
9
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"@marsidev/react-turnstile": "1.5.2",
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"react-i18next": "13.5.0",
|
|
20
20
|
"react-international-phone": "4.5.0",
|
|
21
21
|
"yup": "0.32.11",
|
|
22
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
23
|
-
"@dynamic-labs/iconic": "5.
|
|
24
|
-
"@dynamic-labs/locale": "5.
|
|
25
|
-
"@dynamic-labs/logger": "5.
|
|
26
|
-
"@dynamic-labs/multi-wallet": "5.
|
|
27
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
28
|
-
"@dynamic-labs/store": "5.
|
|
29
|
-
"@dynamic-labs/types": "5.
|
|
30
|
-
"@dynamic-labs/utils": "5.
|
|
31
|
-
"@dynamic-labs/wallet-book": "5.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
22
|
+
"@dynamic-labs/assert-package-version": "5.12.0",
|
|
23
|
+
"@dynamic-labs/iconic": "5.12.0",
|
|
24
|
+
"@dynamic-labs/locale": "5.12.0",
|
|
25
|
+
"@dynamic-labs/logger": "5.12.0",
|
|
26
|
+
"@dynamic-labs/multi-wallet": "5.12.0",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "5.12.0",
|
|
28
|
+
"@dynamic-labs/store": "5.12.0",
|
|
29
|
+
"@dynamic-labs/types": "5.12.0",
|
|
30
|
+
"@dynamic-labs/utils": "5.12.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "5.12.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "5.12.0",
|
|
33
33
|
"eventemitter3": "5.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -42,11 +42,14 @@ const resolveTargetCredential = (credentials, credentialId) => {
|
|
|
42
42
|
}
|
|
43
43
|
return ((_b = credentials.find((cred) => cred.signInEnabled && isOtpCapableCredential(cred))) !== null && _b !== void 0 ? _b : 'No sign-in enabled email or SMS credential found for step-up authentication');
|
|
44
44
|
};
|
|
45
|
-
const sendEmailOtp = (credential) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
const sendEmailOtp = (credential, purpose) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
46
|
if (!credential.email) {
|
|
47
47
|
throw new Error('Email credential is missing email address');
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
// `purpose` lets the API tailor the verification email to the step-up
|
|
50
|
+
// operation; client versions predating the param ignore it.
|
|
51
|
+
const params = Object.assign({ email: credential.email }, (purpose !== undefined && { purpose }));
|
|
52
|
+
return client.sendEmailOTP(params);
|
|
50
53
|
});
|
|
51
54
|
const sendSmsOtp = (credential) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
52
55
|
var _a;
|
|
@@ -60,21 +63,22 @@ const sendSmsOtp = (credential) => _tslib.__awaiter(void 0, void 0, void 0, func
|
|
|
60
63
|
}
|
|
61
64
|
return client.sendSmsOTP({ isoCountryCode, phoneNumber: credential.phoneNumber });
|
|
62
65
|
});
|
|
63
|
-
const dispatchOtp = (credential) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
const dispatchOtp = (credential, purpose) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
64
67
|
return credential.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Email
|
|
65
|
-
? sendEmailOtp(credential)
|
|
68
|
+
? sendEmailOtp(credential, purpose)
|
|
66
69
|
: sendSmsOtp(credential);
|
|
67
70
|
});
|
|
68
71
|
const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
69
72
|
const user = useUser.useUser();
|
|
70
73
|
const { setError, setLoading, setState, setSuccess } = stateActions;
|
|
71
74
|
const otpVerificationRef = React.useRef(null);
|
|
72
|
-
// Holds the credential whose OTP send is blocked awaiting
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
+
// Holds the credential and send purpose whose OTP send is blocked awaiting
|
|
76
|
+
// a captcha token.
|
|
77
|
+
const pendingCaptchaSendRef = React.useRef(null);
|
|
78
|
+
const dispatchAndStoreOtp = React.useCallback((credential, purpose) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
75
79
|
setLoading();
|
|
76
80
|
try {
|
|
77
|
-
const otpVerification = yield dispatchOtp(credential);
|
|
81
|
+
const otpVerification = yield dispatchOtp(credential, purpose);
|
|
78
82
|
otpVerificationRef.current = otpVerification;
|
|
79
83
|
setSuccess({ otpVerification });
|
|
80
84
|
return otpVerification;
|
|
@@ -86,7 +90,7 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
86
90
|
}
|
|
87
91
|
}), [setError, setLoading, setSuccess]);
|
|
88
92
|
const sendOtp = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
-
var _a;
|
|
93
|
+
var _a, _b;
|
|
90
94
|
const credentials = user === null || user === void 0 ? void 0 : user.verifiedCredentials;
|
|
91
95
|
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.length)) {
|
|
92
96
|
setError('No verified credentials found for the authenticated user');
|
|
@@ -98,6 +102,9 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
98
102
|
setError(result);
|
|
99
103
|
return null;
|
|
100
104
|
}
|
|
105
|
+
// The first requested scope names the operation (e.g. wallet:export),
|
|
106
|
+
// so the OTP email can describe it instead of a sign-in.
|
|
107
|
+
const purpose = (_b = params === null || params === void 0 ? void 0 : params.requestedScopes) === null || _b === void 0 ? void 0 : _b[0];
|
|
101
108
|
if (!isOtpCapableCredential(result)) {
|
|
102
109
|
setError(`Credential format "${result.format}" does not support OTP verification. Only email and SMS credentials are supported`);
|
|
103
110
|
return null;
|
|
@@ -106,11 +113,11 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
106
113
|
// captcha-enabled environments. Defer the send and surface the challenge
|
|
107
114
|
// to the UI, which collects a token and completes it via submitCaptchaToken.
|
|
108
115
|
if (client.isCaptchaRequired()) {
|
|
109
|
-
|
|
116
|
+
pendingCaptchaSendRef.current = { credential: result, purpose };
|
|
110
117
|
setState((prev) => (Object.assign(Object.assign({}, prev), { captchaRequired: true, error: null })));
|
|
111
118
|
return null;
|
|
112
119
|
}
|
|
113
|
-
return dispatchAndStoreOtp(result);
|
|
120
|
+
return dispatchAndStoreOtp(result, purpose);
|
|
114
121
|
}), [
|
|
115
122
|
credentialId,
|
|
116
123
|
dispatchAndStoreOtp,
|
|
@@ -119,16 +126,16 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
119
126
|
user === null || user === void 0 ? void 0 : user.verifiedCredentials,
|
|
120
127
|
]);
|
|
121
128
|
const submitCaptchaToken = React.useCallback((captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
129
|
+
const pending = pendingCaptchaSendRef.current;
|
|
130
|
+
if (!pending) {
|
|
124
131
|
return null;
|
|
125
132
|
}
|
|
126
|
-
|
|
133
|
+
pendingCaptchaSendRef.current = null;
|
|
127
134
|
client.setCaptchaToken({ captchaToken });
|
|
128
135
|
setState((prev) => (Object.assign(Object.assign({}, prev), { captchaRequired: false })));
|
|
129
|
-
return dispatchAndStoreOtp(credential);
|
|
136
|
+
return dispatchAndStoreOtp(pending.credential, pending.purpose);
|
|
130
137
|
}), [dispatchAndStoreOtp, setState]);
|
|
131
|
-
const verifyOtp = React.useCallback((
|
|
138
|
+
const verifyOtp = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ requestedScopes, verificationToken, }) {
|
|
132
139
|
const otpVerification = otpVerificationRef.current;
|
|
133
140
|
if (!otpVerification) {
|
|
134
141
|
setError('OTP verification has not been initiated. Call sendOtp() first');
|
|
@@ -152,7 +159,7 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
152
159
|
}), [setError, setLoading, setSuccess]);
|
|
153
160
|
const resetOtpRef = React.useCallback(() => {
|
|
154
161
|
otpVerificationRef.current = null;
|
|
155
|
-
|
|
162
|
+
pendingCaptchaSendRef.current = null;
|
|
156
163
|
}, []);
|
|
157
164
|
return { resetOtpRef, sendOtp, submitCaptchaToken, verifyOtp };
|
|
158
165
|
};
|
|
@@ -38,11 +38,14 @@ const resolveTargetCredential = (credentials, credentialId) => {
|
|
|
38
38
|
}
|
|
39
39
|
return ((_b = credentials.find((cred) => cred.signInEnabled && isOtpCapableCredential(cred))) !== null && _b !== void 0 ? _b : 'No sign-in enabled email or SMS credential found for step-up authentication');
|
|
40
40
|
};
|
|
41
|
-
const sendEmailOtp = (credential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const sendEmailOtp = (credential, purpose) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
if (!credential.email) {
|
|
43
43
|
throw new Error('Email credential is missing email address');
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
// `purpose` lets the API tailor the verification email to the step-up
|
|
46
|
+
// operation; client versions predating the param ignore it.
|
|
47
|
+
const params = Object.assign({ email: credential.email }, (purpose !== undefined && { purpose }));
|
|
48
|
+
return sendEmailOTP(params);
|
|
46
49
|
});
|
|
47
50
|
const sendSmsOtp = (credential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
51
|
var _a;
|
|
@@ -56,21 +59,22 @@ const sendSmsOtp = (credential) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
56
59
|
}
|
|
57
60
|
return sendSmsOTP({ isoCountryCode, phoneNumber: credential.phoneNumber });
|
|
58
61
|
});
|
|
59
|
-
const dispatchOtp = (credential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
const dispatchOtp = (credential, purpose) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
63
|
return credential.format === JwtVerifiedCredentialFormatEnum.Email
|
|
61
|
-
? sendEmailOtp(credential)
|
|
64
|
+
? sendEmailOtp(credential, purpose)
|
|
62
65
|
: sendSmsOtp(credential);
|
|
63
66
|
});
|
|
64
67
|
const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
65
68
|
const user = useUser();
|
|
66
69
|
const { setError, setLoading, setState, setSuccess } = stateActions;
|
|
67
70
|
const otpVerificationRef = useRef(null);
|
|
68
|
-
// Holds the credential whose OTP send is blocked awaiting
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
+
// Holds the credential and send purpose whose OTP send is blocked awaiting
|
|
72
|
+
// a captcha token.
|
|
73
|
+
const pendingCaptchaSendRef = useRef(null);
|
|
74
|
+
const dispatchAndStoreOtp = useCallback((credential, purpose) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
75
|
setLoading();
|
|
72
76
|
try {
|
|
73
|
-
const otpVerification = yield dispatchOtp(credential);
|
|
77
|
+
const otpVerification = yield dispatchOtp(credential, purpose);
|
|
74
78
|
otpVerificationRef.current = otpVerification;
|
|
75
79
|
setSuccess({ otpVerification });
|
|
76
80
|
return otpVerification;
|
|
@@ -82,7 +86,7 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
82
86
|
}
|
|
83
87
|
}), [setError, setLoading, setSuccess]);
|
|
84
88
|
const sendOtp = useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
-
var _a;
|
|
89
|
+
var _a, _b;
|
|
86
90
|
const credentials = user === null || user === void 0 ? void 0 : user.verifiedCredentials;
|
|
87
91
|
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.length)) {
|
|
88
92
|
setError('No verified credentials found for the authenticated user');
|
|
@@ -94,6 +98,9 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
94
98
|
setError(result);
|
|
95
99
|
return null;
|
|
96
100
|
}
|
|
101
|
+
// The first requested scope names the operation (e.g. wallet:export),
|
|
102
|
+
// so the OTP email can describe it instead of a sign-in.
|
|
103
|
+
const purpose = (_b = params === null || params === void 0 ? void 0 : params.requestedScopes) === null || _b === void 0 ? void 0 : _b[0];
|
|
97
104
|
if (!isOtpCapableCredential(result)) {
|
|
98
105
|
setError(`Credential format "${result.format}" does not support OTP verification. Only email and SMS credentials are supported`);
|
|
99
106
|
return null;
|
|
@@ -102,11 +109,11 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
102
109
|
// captcha-enabled environments. Defer the send and surface the challenge
|
|
103
110
|
// to the UI, which collects a token and completes it via submitCaptchaToken.
|
|
104
111
|
if (isCaptchaRequired()) {
|
|
105
|
-
|
|
112
|
+
pendingCaptchaSendRef.current = { credential: result, purpose };
|
|
106
113
|
setState((prev) => (Object.assign(Object.assign({}, prev), { captchaRequired: true, error: null })));
|
|
107
114
|
return null;
|
|
108
115
|
}
|
|
109
|
-
return dispatchAndStoreOtp(result);
|
|
116
|
+
return dispatchAndStoreOtp(result, purpose);
|
|
110
117
|
}), [
|
|
111
118
|
credentialId,
|
|
112
119
|
dispatchAndStoreOtp,
|
|
@@ -115,16 +122,16 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
115
122
|
user === null || user === void 0 ? void 0 : user.verifiedCredentials,
|
|
116
123
|
]);
|
|
117
124
|
const submitCaptchaToken = useCallback((captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
125
|
+
const pending = pendingCaptchaSendRef.current;
|
|
126
|
+
if (!pending) {
|
|
120
127
|
return null;
|
|
121
128
|
}
|
|
122
|
-
|
|
129
|
+
pendingCaptchaSendRef.current = null;
|
|
123
130
|
setCaptchaToken({ captchaToken });
|
|
124
131
|
setState((prev) => (Object.assign(Object.assign({}, prev), { captchaRequired: false })));
|
|
125
|
-
return dispatchAndStoreOtp(credential);
|
|
132
|
+
return dispatchAndStoreOtp(pending.credential, pending.purpose);
|
|
126
133
|
}), [dispatchAndStoreOtp, setState]);
|
|
127
|
-
const verifyOtp = useCallback((
|
|
134
|
+
const verifyOtp = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ requestedScopes, verificationToken, }) {
|
|
128
135
|
const otpVerification = otpVerificationRef.current;
|
|
129
136
|
if (!otpVerification) {
|
|
130
137
|
setError('OTP verification has not been initiated. Call sendOtp() first');
|
|
@@ -148,7 +155,7 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
148
155
|
}), [setError, setLoading, setSuccess]);
|
|
149
156
|
const resetOtpRef = useCallback(() => {
|
|
150
157
|
otpVerificationRef.current = null;
|
|
151
|
-
|
|
158
|
+
pendingCaptchaSendRef.current = null;
|
|
152
159
|
}, []);
|
|
153
160
|
return { resetOtpRef, sendOtp, submitCaptchaToken, verifyOtp };
|
|
154
161
|
};
|
|
@@ -28,9 +28,11 @@ var info = require('../../../shared/assets/info.cjs');
|
|
|
28
28
|
var walletV2 = require('../../../shared/assets/wallet-v2.cjs');
|
|
29
29
|
require('@dynamic-labs/iconic');
|
|
30
30
|
var logger = require('../../../shared/logger.cjs');
|
|
31
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
32
|
+
var getChainDisplayName = require('../../../shared/utils/functions/chain/getChainDisplayName.cjs');
|
|
33
|
+
var shortenWalletAddress = require('../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
31
34
|
var errors = require('../../../utils/constants/errors.cjs');
|
|
32
35
|
require('../../../../../_virtual/_tslib.cjs');
|
|
33
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
34
36
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
35
37
|
require('@dynamic-labs/sdk-api-core');
|
|
36
38
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
@@ -219,7 +221,20 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, walle
|
|
|
219
221
|
dynamicEvents.dynamicEvents.emit('embeddedWalletRevealCompleted', revealedWalletRef.current);
|
|
220
222
|
}
|
|
221
223
|
}, []);
|
|
222
|
-
const
|
|
224
|
+
const chainDisplayName = (wallet === null || wallet === void 0 ? void 0 : wallet.chain)
|
|
225
|
+
? getChainDisplayName.getChainDisplayName(wallet.chain)
|
|
226
|
+
: undefined;
|
|
227
|
+
const credentialTitle = t('dyn_embedded_reveal.private_key_title', {
|
|
228
|
+
chain: chainDisplayName !== null && chainDisplayName !== void 0 ? chainDisplayName : '',
|
|
229
|
+
})
|
|
230
|
+
.replace(/\s{2,}/g, ' ')
|
|
231
|
+
.trim();
|
|
232
|
+
const exportingWalletDetails = chainDisplayName || (wallet === null || wallet === void 0 ? void 0 : wallet.address)
|
|
233
|
+
? t('dyn_embedded_reveal.exporting_wallet_details', {
|
|
234
|
+
address: shortenWalletAddress.shortenWalletAddress(wallet === null || wallet === void 0 ? void 0 : wallet.address),
|
|
235
|
+
chain: chainDisplayName !== null && chainDisplayName !== void 0 ? chainDisplayName : '',
|
|
236
|
+
})
|
|
237
|
+
: undefined;
|
|
223
238
|
const getTitle = () => {
|
|
224
239
|
if (hasInjectedCredential) {
|
|
225
240
|
return credentialTitle;
|
|
@@ -256,7 +271,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, walle
|
|
|
256
271
|
setShowAuthFlow(false);
|
|
257
272
|
}, loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
|
|
258
273
|
color: 'inherit',
|
|
259
|
-
}, children: t('dyn_embedded_reveal.done_button_label') })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsxRuntime.jsx(Badge.Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') })] }), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(walletV2.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(eyeOffIcon.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxRuntime.jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setIsAcknowledged(!isAcknowledged), children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Checkbox.Checkbox, { checked: isAcknowledged, onChange: () => setIsAcknowledged(!isAcknowledged), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'export-agreement-checkbox' }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'primary', onClick: () => {
|
|
274
|
+
}, children: t('dyn_embedded_reveal.done_button_label') })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsxRuntime.jsx(Badge.Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') }), exportingWalletDetails && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', weight: 'regular', copykey: 'dyn_embedded_reveal.exporting_wallet_details', children: exportingWalletDetails }))] }), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(walletV2.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(eyeOffIcon.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxRuntime.jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setIsAcknowledged(!isAcknowledged), children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Checkbox.Checkbox, { checked: isAcknowledged, onChange: () => setIsAcknowledged(!isAcknowledged), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'export-agreement-checkbox' }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'primary', onClick: () => {
|
|
260
275
|
handleAcknowledgeExportPrompt();
|
|
261
276
|
setShowAuthFlow(false);
|
|
262
277
|
}, dataTestId: 'export-agreement-skip-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
@@ -24,9 +24,11 @@ import { ReactComponent as SvgInfo } from '../../../shared/assets/info.js';
|
|
|
24
24
|
import { ReactComponent as SvgWalletV2 } from '../../../shared/assets/wallet-v2.js';
|
|
25
25
|
import '@dynamic-labs/iconic';
|
|
26
26
|
import { logger } from '../../../shared/logger.js';
|
|
27
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
28
|
+
import { getChainDisplayName } from '../../../shared/utils/functions/chain/getChainDisplayName.js';
|
|
29
|
+
import { shortenWalletAddress } from '../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
27
30
|
import { INVALID_WALLET_DATA } from '../../../utils/constants/errors.js';
|
|
28
31
|
import '../../../../../_virtual/_tslib.js';
|
|
29
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
30
32
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
31
33
|
import '@dynamic-labs/sdk-api-core';
|
|
32
34
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -215,7 +217,20 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, walle
|
|
|
215
217
|
dynamicEvents.emit('embeddedWalletRevealCompleted', revealedWalletRef.current);
|
|
216
218
|
}
|
|
217
219
|
}, []);
|
|
218
|
-
const
|
|
220
|
+
const chainDisplayName = (wallet === null || wallet === void 0 ? void 0 : wallet.chain)
|
|
221
|
+
? getChainDisplayName(wallet.chain)
|
|
222
|
+
: undefined;
|
|
223
|
+
const credentialTitle = t('dyn_embedded_reveal.private_key_title', {
|
|
224
|
+
chain: chainDisplayName !== null && chainDisplayName !== void 0 ? chainDisplayName : '',
|
|
225
|
+
})
|
|
226
|
+
.replace(/\s{2,}/g, ' ')
|
|
227
|
+
.trim();
|
|
228
|
+
const exportingWalletDetails = chainDisplayName || (wallet === null || wallet === void 0 ? void 0 : wallet.address)
|
|
229
|
+
? t('dyn_embedded_reveal.exporting_wallet_details', {
|
|
230
|
+
address: shortenWalletAddress(wallet === null || wallet === void 0 ? void 0 : wallet.address),
|
|
231
|
+
chain: chainDisplayName !== null && chainDisplayName !== void 0 ? chainDisplayName : '',
|
|
232
|
+
})
|
|
233
|
+
: undefined;
|
|
219
234
|
const getTitle = () => {
|
|
220
235
|
if (hasInjectedCredential) {
|
|
221
236
|
return credentialTitle;
|
|
@@ -252,7 +267,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, walle
|
|
|
252
267
|
setShowAuthFlow(false);
|
|
253
268
|
}, loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
|
|
254
269
|
color: 'inherit',
|
|
255
|
-
}, children: t('dyn_embedded_reveal.done_button_label') })) : (jsxs(Fragment, { children: [jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsx(Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') })] }), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgWalletV2, { height: 16, width: 16 }) }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxs(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgEyeOffIcon, { height: 16, width: 16 }) }), jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setIsAcknowledged(!isAcknowledged), children: [jsx("div", { children: jsx(Checkbox, { checked: isAcknowledged, onChange: () => setIsAcknowledged(!isAcknowledged), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'export-agreement-checkbox' }) }), jsx("div", { children: jsx(Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsx(NeedHelpSection, {}), jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'primary', onClick: () => {
|
|
270
|
+
}, children: t('dyn_embedded_reveal.done_button_label') })) : (jsxs(Fragment, { children: [jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsx(Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') }), exportingWalletDetails && (jsx(Typography, { variant: 'body_small', color: 'secondary', weight: 'regular', copykey: 'dyn_embedded_reveal.exporting_wallet_details', children: exportingWalletDetails }))] }), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgWalletV2, { height: 16, width: 16 }) }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxs(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgEyeOffIcon, { height: 16, width: 16 }) }), jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setIsAcknowledged(!isAcknowledged), children: [jsx("div", { children: jsx(Checkbox, { checked: isAcknowledged, onChange: () => setIsAcknowledged(!isAcknowledged), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'export-agreement-checkbox' }) }), jsx("div", { children: jsx(Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsx(NeedHelpSection, {}), jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'primary', onClick: () => {
|
|
256
271
|
handleAcknowledgeExportPrompt();
|
|
257
272
|
setShowAuthFlow(false);
|
|
258
273
|
}, dataTestId: 'export-agreement-skip-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
@@ -24,8 +24,8 @@ const StepUpReauthOtpView = ({ credentialId, displayLabel, requestedScopes, type
|
|
|
24
24
|
if (hasSentInitialOtpRef.current)
|
|
25
25
|
return;
|
|
26
26
|
hasSentInitialOtpRef.current = true;
|
|
27
|
-
sendOtp();
|
|
28
|
-
}, [sendOtp]);
|
|
27
|
+
sendOtp({ requestedScopes });
|
|
28
|
+
}, [requestedScopes, sendOtp]);
|
|
29
29
|
const handlePinComplete = (verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
const response = yield verifyOtp({
|
|
31
31
|
requestedScopes,
|
|
@@ -46,7 +46,7 @@ const StepUpReauthOtpView = ({ credentialId, displayLabel, requestedScopes, type
|
|
|
46
46
|
return jsxRuntime.jsx(CaptchaChallenge.CaptchaChallenge, { onSuccess: submitCaptchaToken });
|
|
47
47
|
}
|
|
48
48
|
return (jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { MainIcon: MainIcon, displayedDestination: displayLabel, error: displayError, isLoading: isLoading, isValid: verificationSuccess, onPinComplete: handlePinComplete, retryHandler: () => {
|
|
49
|
-
void sendOtp();
|
|
49
|
+
void sendOtp({ requestedScopes });
|
|
50
50
|
}, successBannerTextKey: 'dyn_otp_verification.verification_succeeded' }));
|
|
51
51
|
};
|
|
52
52
|
|
|
@@ -20,8 +20,8 @@ const StepUpReauthOtpView = ({ credentialId, displayLabel, requestedScopes, type
|
|
|
20
20
|
if (hasSentInitialOtpRef.current)
|
|
21
21
|
return;
|
|
22
22
|
hasSentInitialOtpRef.current = true;
|
|
23
|
-
sendOtp();
|
|
24
|
-
}, [sendOtp]);
|
|
23
|
+
sendOtp({ requestedScopes });
|
|
24
|
+
}, [requestedScopes, sendOtp]);
|
|
25
25
|
const handlePinComplete = (verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
const response = yield verifyOtp({
|
|
27
27
|
requestedScopes,
|
|
@@ -42,7 +42,7 @@ const StepUpReauthOtpView = ({ credentialId, displayLabel, requestedScopes, type
|
|
|
42
42
|
return jsx(CaptchaChallenge, { onSuccess: submitCaptchaToken });
|
|
43
43
|
}
|
|
44
44
|
return (jsx(OTPVerificationView, { MainIcon: MainIcon, displayedDestination: displayLabel, error: displayError, isLoading: isLoading, isValid: verificationSuccess, onPinComplete: handlePinComplete, retryHandler: () => {
|
|
45
|
-
void sendOtp();
|
|
45
|
+
void sendOtp({ requestedScopes });
|
|
46
46
|
}, successBannerTextKey: 'dyn_otp_verification.verification_succeeded' }));
|
|
47
47
|
};
|
|
48
48
|
|