@verified-network/verified-custody 0.1.9 → 0.2.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/babel.config.json +12 -0
- package/dist/index.d.mts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +31 -42
- package/src/components/overlays.tsx +61 -0
- package/src/components/search.tsx +381 -0
- package/src/components/slider.tsx +29 -0
- package/src/components/success.tsx +142 -0
- package/src/customTypes.d.ts +37 -0
- package/src/index.ts +17 -0
- package/src/pages/addCosigners.tsx +1014 -0
- package/src/pages/contact.tsx +280 -0
- package/src/pages/createPin.tsx +693 -0
- package/src/pages/enterPin.tsx +821 -0
- package/src/pages/ftu.tsx +244 -0
- package/src/pages/index.tsx +170 -0
- package/src/pages/otp.tsx +410 -0
- package/src/services/contracts.ts +817 -0
- package/src/services/store.tsx +65 -0
- package/src/style.css +2030 -0
- package/src/utils/config.ts +103 -0
- package/src/utils/constants.ts +1966 -0
- package/src/utils/helpers.tsx +334 -0
- package/src/utils/types.ts +85 -0
- package/tsconfig.json +16 -0
- package/tsup.config.ts +36 -0
- package/README.md +0 -93
- package/dist/main.js +0 -2
- package/dist/main.js.LICENSE.txt +0 -190
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { useVaultStore } from "../services/store";
|
|
3
|
+
import { hashTheString } from "../utils/helpers";
|
|
4
|
+
import {
|
|
5
|
+
acceptOrRejectInvitation,
|
|
6
|
+
checkOrCreateVault,
|
|
7
|
+
} from "../services/contracts";
|
|
8
|
+
import PageSlider from "../components/slider";
|
|
9
|
+
import Success from "../components/success";
|
|
10
|
+
import { imageAssets } from "../utils/constants";
|
|
11
|
+
import { VerifiedCustodyHelpers } from "../utils/types";
|
|
12
|
+
|
|
13
|
+
const CreatePinPage = (props: {
|
|
14
|
+
setStep: (step: string) => void;
|
|
15
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
16
|
+
setShowSuccessBtn: (showSuccessBtn: boolean) => void;
|
|
17
|
+
setSuccessBtnText: (successBtnText: string) => void;
|
|
18
|
+
setSuccessBtnNeutText: (successBtnNeutText: string) => void;
|
|
19
|
+
setSuccessBtnFunc: (successBtnFunc: any) => void;
|
|
20
|
+
setSuccessBtnNeutFunc: (successBtnNeutFunc: any) => void;
|
|
21
|
+
setActionHeaderText: (actionHeaderText: string) => void;
|
|
22
|
+
setActionFooterText: (actionFooterText: string) => void;
|
|
23
|
+
userNumberFmt: string;
|
|
24
|
+
userEmail: string;
|
|
25
|
+
selectedCountry: { name: string; area: string; flag: string };
|
|
26
|
+
action?: string;
|
|
27
|
+
vaultData?: any;
|
|
28
|
+
txData?: any;
|
|
29
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
30
|
+
}) => {
|
|
31
|
+
const [searchActive, setSearchActive] = useState(false);
|
|
32
|
+
const [pinIncorrect, setPinIncorrect] = useState(false);
|
|
33
|
+
const [pinIncorrectText, setPinIncorrectText] = useState("");
|
|
34
|
+
const [pinHide, setPinHide] = useState(true); //hide pin by default
|
|
35
|
+
const [showInvitation, setShowInvitation] = useState(false);
|
|
36
|
+
const [showInvitationSuccess, setShowInvitationSuccess] = useState(false);
|
|
37
|
+
const [vaultPin, setVaultPin] = useState("");
|
|
38
|
+
const [showRejectInvitation, setShowRejectInvitation] = useState(false);
|
|
39
|
+
|
|
40
|
+
const { address, pk, vaultContract, setVaultData, vaultData } =
|
|
41
|
+
useVaultStore();
|
|
42
|
+
|
|
43
|
+
//todo: add key actions to input focus change
|
|
44
|
+
const handlleInputFocus = (currentInput: any) => {
|
|
45
|
+
if (currentInput.value.length > 0) {
|
|
46
|
+
const nextInput = currentInput.nextElementSibling;
|
|
47
|
+
if (nextInput) {
|
|
48
|
+
nextInput.focus();
|
|
49
|
+
}
|
|
50
|
+
} else if (currentInput.value.length === 0) {
|
|
51
|
+
currentInput.focus();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleOtpBackspace = (e: any) => {
|
|
56
|
+
const previousInpput = e.target.previousElementSibling;
|
|
57
|
+
if (previousInpput) {
|
|
58
|
+
previousInpput.focus();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const handleButtonDisplay = () => {
|
|
63
|
+
const button: any = document.getElementById(
|
|
64
|
+
"verified-custd-mdl-otp-button"
|
|
65
|
+
);
|
|
66
|
+
const otp1: any = document.getElementById("verified-custd-mdl-otp-input-1");
|
|
67
|
+
const otp2: any = document.getElementById("verified-custd-mdl-otp-input-2");
|
|
68
|
+
const otp3: any = document.getElementById("verified-custd-mdl-otp-input-3");
|
|
69
|
+
const otp4: any = document.getElementById("verified-custd-mdl-otp-input-4");
|
|
70
|
+
const otp5: any = document.getElementById("verified-custd-mdl-otp-input-5");
|
|
71
|
+
const otp6: any = document.getElementById("verified-custd-mdl-otp-input-6");
|
|
72
|
+
const otp7: any = document.getElementById("verified-custd-mdl-otp-input-7");
|
|
73
|
+
const otp8: any = document.getElementById("verified-custd-mdl-otp-input-8");
|
|
74
|
+
if (
|
|
75
|
+
button &&
|
|
76
|
+
otp1?.value.length > 0 &&
|
|
77
|
+
otp2?.value.length > 0 &&
|
|
78
|
+
otp3?.value.length > 0 &&
|
|
79
|
+
otp4?.value.length > 0 &&
|
|
80
|
+
otp5?.value.length > 0 &&
|
|
81
|
+
otp6?.value.length > 0 &&
|
|
82
|
+
otp7?.value.length > 0 &&
|
|
83
|
+
otp8?.value.length > 0
|
|
84
|
+
) {
|
|
85
|
+
if (
|
|
86
|
+
otp1?.value + otp2?.value + otp3?.value + otp4?.value ===
|
|
87
|
+
otp5?.value + otp6?.value + otp7?.value + otp8?.value
|
|
88
|
+
) {
|
|
89
|
+
button.className = "verified-custd-mdl-startup-button-active";
|
|
90
|
+
} else {
|
|
91
|
+
button.className = "verified-custd-mdl-startup-button";
|
|
92
|
+
setPinIncorrect(true);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
button.className = "verified-custd-mdl-startup-button";
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const handleVaultManagement = async () => {
|
|
100
|
+
if (!props.helperFunctions) {
|
|
101
|
+
setPinIncorrectText(
|
|
102
|
+
"No Helper Functions. Please include all helper functions in the CreatePinPage props."
|
|
103
|
+
);
|
|
104
|
+
setPinIncorrect(true);
|
|
105
|
+
} else {
|
|
106
|
+
setPinIncorrectText("");
|
|
107
|
+
setPinIncorrect(false);
|
|
108
|
+
const otp1: any = document.getElementById(
|
|
109
|
+
"verified-custd-mdl-otp-input-1"
|
|
110
|
+
);
|
|
111
|
+
const otp2: any = document.getElementById(
|
|
112
|
+
"verified-custd-mdl-otp-input-2"
|
|
113
|
+
);
|
|
114
|
+
const otp3: any = document.getElementById(
|
|
115
|
+
"verified-custd-mdl-otp-input-3"
|
|
116
|
+
);
|
|
117
|
+
const otp4: any = document.getElementById(
|
|
118
|
+
"verified-custd-mdl-otp-input-4"
|
|
119
|
+
);
|
|
120
|
+
const otp5: any = document.getElementById(
|
|
121
|
+
"verified-custd-mdl-otp-input-5"
|
|
122
|
+
);
|
|
123
|
+
const otp6: any = document.getElementById(
|
|
124
|
+
"verified-custd-mdl-otp-input-6"
|
|
125
|
+
);
|
|
126
|
+
const otp7: any = document.getElementById(
|
|
127
|
+
"verified-custd-mdl-otp-input-7"
|
|
128
|
+
);
|
|
129
|
+
const otp8: any = document.getElementById(
|
|
130
|
+
"verified-custd-mdl-otp-input-8"
|
|
131
|
+
);
|
|
132
|
+
const vaultId =
|
|
133
|
+
props.userEmail?.length > 0
|
|
134
|
+
? props.userEmail
|
|
135
|
+
: `+${props.selectedCountry.area}${props.userNumberFmt?.replace(
|
|
136
|
+
" ",
|
|
137
|
+
""
|
|
138
|
+
)}`;
|
|
139
|
+
const channel = props.userEmail?.length > 0 ? "email" : "sms";
|
|
140
|
+
if (
|
|
141
|
+
otp1?.value?.length > 0 &&
|
|
142
|
+
otp2?.value?.length > 0 &&
|
|
143
|
+
otp3?.value?.length > 0 &&
|
|
144
|
+
otp4?.value?.length > 0 &&
|
|
145
|
+
otp5?.value?.length > 0 &&
|
|
146
|
+
otp6?.value?.length > 0 &&
|
|
147
|
+
otp7?.value?.length > 0 &&
|
|
148
|
+
otp8?.value?.length > 0 &&
|
|
149
|
+
address &&
|
|
150
|
+
vaultId &&
|
|
151
|
+
channel &&
|
|
152
|
+
pk &&
|
|
153
|
+
vaultContract
|
|
154
|
+
) {
|
|
155
|
+
props.setIsLoading(true);
|
|
156
|
+
const vaultPin = otp1?.value + otp2?.value + otp3?.value + otp4?.value;
|
|
157
|
+
const hashedVaultId = hashTheString(vaultId);
|
|
158
|
+
const hashedVaultPin = hashTheString(vaultPin);
|
|
159
|
+
|
|
160
|
+
await checkOrCreateVault(
|
|
161
|
+
vaultId,
|
|
162
|
+
hashedVaultId,
|
|
163
|
+
vaultPin,
|
|
164
|
+
hashedVaultPin,
|
|
165
|
+
channel,
|
|
166
|
+
pk,
|
|
167
|
+
address,
|
|
168
|
+
vaultContract,
|
|
169
|
+
props.action,
|
|
170
|
+
props.vaultData,
|
|
171
|
+
props.txData
|
|
172
|
+
).then((res) => {
|
|
173
|
+
props.setIsLoading(false);
|
|
174
|
+
|
|
175
|
+
if (res) {
|
|
176
|
+
setVaultData(res);
|
|
177
|
+
setPinIncorrectText("");
|
|
178
|
+
setPinIncorrect(false);
|
|
179
|
+
if (props.action === "invitation") {
|
|
180
|
+
setVaultPin(vaultPin);
|
|
181
|
+
setShowInvitation(true);
|
|
182
|
+
} else {
|
|
183
|
+
props.setStep("5");
|
|
184
|
+
}
|
|
185
|
+
} else if (res === null) {
|
|
186
|
+
setPinIncorrectText(
|
|
187
|
+
"You are an existing user. Please input the right pin to recover your account."
|
|
188
|
+
);
|
|
189
|
+
setPinIncorrect(true);
|
|
190
|
+
} else {
|
|
191
|
+
setPinIncorrectText(
|
|
192
|
+
"Unexpected error while creating account. Please try again later."
|
|
193
|
+
);
|
|
194
|
+
setPinIncorrect(true);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const handleAcceptAndRejectInvitation = async (accepted: boolean) => {
|
|
202
|
+
const vaultId =
|
|
203
|
+
props.userEmail?.length > 0
|
|
204
|
+
? props.userEmail
|
|
205
|
+
: `+${props.selectedCountry.area}${props.userNumberFmt?.replace(
|
|
206
|
+
" ",
|
|
207
|
+
""
|
|
208
|
+
)}`;
|
|
209
|
+
const channel = props.userEmail?.length > 0 ? "email" : "sms";
|
|
210
|
+
if (
|
|
211
|
+
vaultPin?.length === 4 &&
|
|
212
|
+
props?.vaultData?.hashedVaultId &&
|
|
213
|
+
props.vaultData?.hashedVaultPin &&
|
|
214
|
+
vaultId
|
|
215
|
+
) {
|
|
216
|
+
props.setIsLoading(true);
|
|
217
|
+
const hashedVaultId = hashTheString(vaultId);
|
|
218
|
+
const hashedVaultPin = hashTheString(vaultPin);
|
|
219
|
+
await acceptOrRejectInvitation(
|
|
220
|
+
props.helperFunctions.sendCreatorAcceptance,
|
|
221
|
+
props.helperFunctions.sendCreatorRejection,
|
|
222
|
+
channel,
|
|
223
|
+
hashedVaultId,
|
|
224
|
+
hashedVaultPin,
|
|
225
|
+
props?.vaultData?.hashedVaultId,
|
|
226
|
+
props.vaultData?.hashedVaultPin,
|
|
227
|
+
props.vaultData?.vaultId,
|
|
228
|
+
vaultId,
|
|
229
|
+
accepted,
|
|
230
|
+
vaultContract
|
|
231
|
+
).then((res) => {
|
|
232
|
+
props.setIsLoading(false);
|
|
233
|
+
if (res && !vaultData?.isExisting) {
|
|
234
|
+
props.setShowSuccessBtn(true);
|
|
235
|
+
props.setSuccessBtnText("Continue Setting Up Your Account");
|
|
236
|
+
props.setSuccessBtnNeutText("Do It Later");
|
|
237
|
+
props.setActionHeaderText("Successful");
|
|
238
|
+
props.setActionFooterText(
|
|
239
|
+
accepted
|
|
240
|
+
? `You have been added as a Co-Signer for ${props.vaultData?.vaultId}`
|
|
241
|
+
: `You rejected Co-signer reject from ${props.vaultData?.vaultId}`
|
|
242
|
+
);
|
|
243
|
+
props.setStep("5");
|
|
244
|
+
} else if (res && vaultData?.isExisting) {
|
|
245
|
+
setShowInvitationSuccess(true);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<React.Fragment>
|
|
253
|
+
{!showInvitation && (
|
|
254
|
+
<div className="verified-custd-mdl-startup-language">
|
|
255
|
+
<div className="verified-custd-mdl-startup-contact">
|
|
256
|
+
<PageSlider sliderCount={[1, 2, 3]} currentSlider="1" />
|
|
257
|
+
<div className="verified-custd-mdl-startup-contact-content">
|
|
258
|
+
<p className="verified-custd-mdl-startup-contact-text">
|
|
259
|
+
Create PIN
|
|
260
|
+
</p>
|
|
261
|
+
<div className="verified-custd-mdl-startup-otp-text">
|
|
262
|
+
<p className="verified-custd-mdl-startup-otp-header-text">
|
|
263
|
+
Protect your blockchain assets. This PIN will be required for
|
|
264
|
+
all transactions and logins.
|
|
265
|
+
</p>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
<div className="verified-custd-mdl-otp-input-container">
|
|
269
|
+
<p className="verified-custd-mdl-pin-input-container-text">
|
|
270
|
+
New PIN
|
|
271
|
+
</p>
|
|
272
|
+
<div className="verified-custd-mdl-otp-input-group">
|
|
273
|
+
<input
|
|
274
|
+
onInputCapture={(e: any) => {
|
|
275
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
276
|
+
setPinIncorrect(false);
|
|
277
|
+
}}
|
|
278
|
+
onInput={(e) => {
|
|
279
|
+
handlleInputFocus(e.target);
|
|
280
|
+
handleButtonDisplay();
|
|
281
|
+
}}
|
|
282
|
+
onKeyDown={(e: any) => {
|
|
283
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
284
|
+
handleOtpBackspace(e);
|
|
285
|
+
}
|
|
286
|
+
}}
|
|
287
|
+
className={
|
|
288
|
+
pinIncorrect
|
|
289
|
+
? "verified-custd-mdl-otp-input-red"
|
|
290
|
+
: "verified-custd-mdl-otp-input"
|
|
291
|
+
}
|
|
292
|
+
type={pinHide ? "password" : "text"}
|
|
293
|
+
maxLength={1}
|
|
294
|
+
id="verified-custd-mdl-otp-input-1"
|
|
295
|
+
/>
|
|
296
|
+
<input
|
|
297
|
+
onInputCapture={(e: any) => {
|
|
298
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
299
|
+
setPinIncorrect(false);
|
|
300
|
+
}}
|
|
301
|
+
onInput={(e) => {
|
|
302
|
+
handlleInputFocus(e.target);
|
|
303
|
+
handleButtonDisplay();
|
|
304
|
+
}}
|
|
305
|
+
onKeyDown={(e: any) => {
|
|
306
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
307
|
+
handleOtpBackspace(e);
|
|
308
|
+
}
|
|
309
|
+
}}
|
|
310
|
+
className={
|
|
311
|
+
pinIncorrect
|
|
312
|
+
? "verified-custd-mdl-otp-input-red"
|
|
313
|
+
: "verified-custd-mdl-otp-input"
|
|
314
|
+
}
|
|
315
|
+
type={pinHide ? "password" : "text"}
|
|
316
|
+
maxLength={1}
|
|
317
|
+
id="verified-custd-mdl-otp-input-2"
|
|
318
|
+
/>
|
|
319
|
+
<input
|
|
320
|
+
onInputCapture={(e: any) => {
|
|
321
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
322
|
+
setPinIncorrect(false);
|
|
323
|
+
}}
|
|
324
|
+
onInput={(e) => {
|
|
325
|
+
handlleInputFocus(e.target);
|
|
326
|
+
handleButtonDisplay();
|
|
327
|
+
}}
|
|
328
|
+
onKeyDown={(e: any) => {
|
|
329
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
330
|
+
handleOtpBackspace(e);
|
|
331
|
+
}
|
|
332
|
+
}}
|
|
333
|
+
className={
|
|
334
|
+
pinIncorrect
|
|
335
|
+
? "verified-custd-mdl-otp-input-red"
|
|
336
|
+
: "verified-custd-mdl-otp-input"
|
|
337
|
+
}
|
|
338
|
+
type={pinHide ? "password" : "text"}
|
|
339
|
+
maxLength={1}
|
|
340
|
+
id="verified-custd-mdl-otp-input-3"
|
|
341
|
+
/>
|
|
342
|
+
<input
|
|
343
|
+
onInputCapture={(e: any) => {
|
|
344
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
345
|
+
setPinIncorrect(false);
|
|
346
|
+
}}
|
|
347
|
+
onInput={(e) => {
|
|
348
|
+
handlleInputFocus(e.target);
|
|
349
|
+
handleButtonDisplay();
|
|
350
|
+
}}
|
|
351
|
+
onKeyDown={(e: any) => {
|
|
352
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
353
|
+
handleOtpBackspace(e);
|
|
354
|
+
}
|
|
355
|
+
}}
|
|
356
|
+
className={
|
|
357
|
+
pinIncorrect
|
|
358
|
+
? "verified-custd-mdl-otp-input-red"
|
|
359
|
+
: "verified-custd-mdl-otp-input"
|
|
360
|
+
}
|
|
361
|
+
type={pinHide ? "password" : "text"}
|
|
362
|
+
maxLength={1}
|
|
363
|
+
id="verified-custd-mdl-otp-input-4"
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
<div className="verified-custd-mdl-otp-input-container">
|
|
369
|
+
<p className="verified-custd-mdl-pin-input-container-text">
|
|
370
|
+
Confirm PIN
|
|
371
|
+
</p>
|
|
372
|
+
<div className="verified-custd-mdl-otp-input-group">
|
|
373
|
+
<input
|
|
374
|
+
onInputCapture={(e: any) => {
|
|
375
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
376
|
+
setPinIncorrect(false);
|
|
377
|
+
}}
|
|
378
|
+
onInput={(e) => {
|
|
379
|
+
handlleInputFocus(e.target);
|
|
380
|
+
handleButtonDisplay();
|
|
381
|
+
}}
|
|
382
|
+
onKeyDown={(e: any) => {
|
|
383
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
384
|
+
handleOtpBackspace(e);
|
|
385
|
+
}
|
|
386
|
+
}}
|
|
387
|
+
className={
|
|
388
|
+
pinIncorrect
|
|
389
|
+
? "verified-custd-mdl-otp-input-red"
|
|
390
|
+
: "verified-custd-mdl-otp-input"
|
|
391
|
+
}
|
|
392
|
+
type={pinHide ? "password" : "text"}
|
|
393
|
+
maxLength={1}
|
|
394
|
+
id="verified-custd-mdl-otp-input-5"
|
|
395
|
+
/>
|
|
396
|
+
<input
|
|
397
|
+
onInputCapture={(e: any) => {
|
|
398
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
399
|
+
setPinIncorrect(false);
|
|
400
|
+
}}
|
|
401
|
+
onInput={(e) => {
|
|
402
|
+
handlleInputFocus(e.target);
|
|
403
|
+
handleButtonDisplay();
|
|
404
|
+
}}
|
|
405
|
+
onKeyDown={(e: any) => {
|
|
406
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
407
|
+
handleOtpBackspace(e);
|
|
408
|
+
}
|
|
409
|
+
}}
|
|
410
|
+
className={
|
|
411
|
+
pinIncorrect
|
|
412
|
+
? "verified-custd-mdl-otp-input-red"
|
|
413
|
+
: "verified-custd-mdl-otp-input"
|
|
414
|
+
}
|
|
415
|
+
type={pinHide ? "password" : "text"}
|
|
416
|
+
maxLength={1}
|
|
417
|
+
id="verified-custd-mdl-otp-input-6"
|
|
418
|
+
/>
|
|
419
|
+
<input
|
|
420
|
+
onInputCapture={(e: any) => {
|
|
421
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
422
|
+
setPinIncorrect(false);
|
|
423
|
+
}}
|
|
424
|
+
onInput={(e) => {
|
|
425
|
+
handlleInputFocus(e.target);
|
|
426
|
+
handleButtonDisplay();
|
|
427
|
+
}}
|
|
428
|
+
onKeyDown={(e: any) => {
|
|
429
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
430
|
+
handleOtpBackspace(e);
|
|
431
|
+
}
|
|
432
|
+
}}
|
|
433
|
+
className={
|
|
434
|
+
pinIncorrect
|
|
435
|
+
? "verified-custd-mdl-otp-input-red"
|
|
436
|
+
: "verified-custd-mdl-otp-input"
|
|
437
|
+
}
|
|
438
|
+
type={pinHide ? "password" : "text"}
|
|
439
|
+
maxLength={1}
|
|
440
|
+
id="verified-custd-mdl-otp-input-7"
|
|
441
|
+
/>
|
|
442
|
+
<input
|
|
443
|
+
onInputCapture={(e: any) => {
|
|
444
|
+
e.target.value = e.target.value?.replace(/\D/g, "");
|
|
445
|
+
setPinIncorrect(false);
|
|
446
|
+
}}
|
|
447
|
+
onInput={(e) => {
|
|
448
|
+
handlleInputFocus(e.target);
|
|
449
|
+
handleButtonDisplay();
|
|
450
|
+
}}
|
|
451
|
+
onKeyDown={(e: any) => {
|
|
452
|
+
if (e.key === "Backspace" && e.target.value === "") {
|
|
453
|
+
handleOtpBackspace(e);
|
|
454
|
+
}
|
|
455
|
+
}}
|
|
456
|
+
className={
|
|
457
|
+
pinIncorrect
|
|
458
|
+
? "verified-custd-mdl-otp-input-red"
|
|
459
|
+
: "verified-custd-mdl-otp-input"
|
|
460
|
+
}
|
|
461
|
+
type={pinHide ? "password" : "text"}
|
|
462
|
+
maxLength={1}
|
|
463
|
+
id="verified-custd-mdl-otp-input-8"
|
|
464
|
+
/>
|
|
465
|
+
</div>
|
|
466
|
+
<div className="verified-custd-mdl-otp-timer">
|
|
467
|
+
{!pinIncorrect && <p></p>}
|
|
468
|
+
{pinIncorrect && pinIncorrectText === "" && (
|
|
469
|
+
<p className="verified-custd-mdl-otp-incorrect-text">
|
|
470
|
+
Please enter the correct pin
|
|
471
|
+
</p>
|
|
472
|
+
)}
|
|
473
|
+
{pinIncorrect && pinIncorrectText?.length > 0 && (
|
|
474
|
+
<p className="verified-custd-mdl-otp-incorrect-text">
|
|
475
|
+
{pinIncorrectText}
|
|
476
|
+
</p>
|
|
477
|
+
)}
|
|
478
|
+
{!pinHide && (
|
|
479
|
+
<img
|
|
480
|
+
style={{ cursor: "pointer", width: "24px", height: "24px" }}
|
|
481
|
+
onClick={() => setPinHide(true)}
|
|
482
|
+
src={imageAssets.pinShow}
|
|
483
|
+
alt="show pin icon"
|
|
484
|
+
/>
|
|
485
|
+
)}
|
|
486
|
+
{pinHide && (
|
|
487
|
+
<img
|
|
488
|
+
style={{ cursor: "pointer", width: "24px", height: "24px" }}
|
|
489
|
+
onClick={() => setPinHide(false)}
|
|
490
|
+
src={imageAssets.pinHide}
|
|
491
|
+
alt="hide pin icon"
|
|
492
|
+
/>
|
|
493
|
+
)}
|
|
494
|
+
</div>
|
|
495
|
+
</div>
|
|
496
|
+
</div>
|
|
497
|
+
|
|
498
|
+
{!searchActive && <div style={{ height: "30px" }}></div>}
|
|
499
|
+
|
|
500
|
+
<div className="verified-custd-mdl-startup-contact-footer">
|
|
501
|
+
<div className="verified-custd-mdl-st-contact-footer-first-section">
|
|
502
|
+
<button
|
|
503
|
+
id="verified-custd-mdl-otp-button"
|
|
504
|
+
onClick={async (e: any) => {
|
|
505
|
+
if (
|
|
506
|
+
e.target.className.includes(
|
|
507
|
+
"verified-custd-mdl-startup-button"
|
|
508
|
+
) &&
|
|
509
|
+
e.target.className !== "verified-custd-mdl-startup-button"
|
|
510
|
+
) {
|
|
511
|
+
e.target.className =
|
|
512
|
+
"verified-custd-mdl-startup-button-click";
|
|
513
|
+
await handleVaultManagement();
|
|
514
|
+
} else {
|
|
515
|
+
const buttonElement = document.getElementsByClassName(
|
|
516
|
+
"verified-custd-mdl-startup-button-active"
|
|
517
|
+
);
|
|
518
|
+
if (buttonElement.length > 0) {
|
|
519
|
+
buttonElement[0].className =
|
|
520
|
+
"verified-custd-mdl-startup-button-click";
|
|
521
|
+
await handleVaultManagement();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}}
|
|
525
|
+
className="verified-custd-mdl-startup-button"
|
|
526
|
+
>
|
|
527
|
+
Confirm
|
|
528
|
+
</button>
|
|
529
|
+
{/* <div className="verified-custd-mdl-st-contact-footer-second-section">
|
|
530
|
+
<PrivacyOverlay />
|
|
531
|
+
</div> */}
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
)}
|
|
536
|
+
|
|
537
|
+
{showInvitation && (
|
|
538
|
+
<React.Fragment>
|
|
539
|
+
{!showInvitationSuccess && (
|
|
540
|
+
<div
|
|
541
|
+
style={{ padding: "0", position: "relative" }}
|
|
542
|
+
className="verified-custd-mdl-startup-language"
|
|
543
|
+
>
|
|
544
|
+
<div className="verified-custd-mdl-startup-contact">
|
|
545
|
+
<PageSlider sliderCount={[1, 2, 3]} currentSlider="1" />
|
|
546
|
+
<div className="verified-custd-mdl-startup-contact-content">
|
|
547
|
+
<p className="verified-custd-mdl-startup-contact-text">
|
|
548
|
+
<b>{props.vaultData?.vaultId}</b> has requested you to be a
|
|
549
|
+
Co-Signer
|
|
550
|
+
</p>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
<img
|
|
554
|
+
className="verified-custd-mdl-add-cosigner-body-icon"
|
|
555
|
+
src={imageAssets.addCoSignerIcon1}
|
|
556
|
+
alt=""
|
|
557
|
+
/>
|
|
558
|
+
{!showRejectInvitation && (
|
|
559
|
+
<React.Fragment>
|
|
560
|
+
<div className="verified-custd-mdl-add-cosigner-more-body">
|
|
561
|
+
<div className="verified-custd-mdl-add-cosigner-more-header-cont">
|
|
562
|
+
<div className="verified-custd-mdl-add-cosigner-more-title-cont">
|
|
563
|
+
<p className="verified-custd-mdl-add-cosigner-more-title">
|
|
564
|
+
What is a Co-Signer?
|
|
565
|
+
</p>
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
<p
|
|
569
|
+
style={{
|
|
570
|
+
fontSize: "12px",
|
|
571
|
+
color: "var(--Neutral-600, #5B5D6E)",
|
|
572
|
+
}}
|
|
573
|
+
className="verified-custd-mdl-add-cosigner-more-label"
|
|
574
|
+
>
|
|
575
|
+
A Co-Signer is a person who has the right given by you to
|
|
576
|
+
generate a new pin on your behalf incase you forget it.{" "}
|
|
577
|
+
</p>
|
|
578
|
+
|
|
579
|
+
<div className="verified-custd-mdl-add-cosigner-body-text-cont">
|
|
580
|
+
<div className="verified-custd-mdl-add-cosigner-body-text-icon">
|
|
581
|
+
<img src={imageAssets.pkicon} alt="icon" />
|
|
582
|
+
</div>
|
|
583
|
+
<p className="verified-custd-mdl-add-cosigner-body-text-label">
|
|
584
|
+
As a Co Signer you can help{" "}
|
|
585
|
+
<span className="verified-custd-mdl-add-cosigner-body-text-label-bold">
|
|
586
|
+
reset PIN
|
|
587
|
+
</span>
|
|
588
|
+
</p>
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
<div className="verified-custd-mdl-add-cosigner-body-text-cont">
|
|
592
|
+
<div className="verified-custd-mdl-add-cosigner-body-text-icon">
|
|
593
|
+
<img src={imageAssets.encryptedIcon} alt="icon" />
|
|
594
|
+
</div>
|
|
595
|
+
<p className="verified-custd-mdl-add-cosigner-body-text-label">
|
|
596
|
+
Don’t worry, they{" "}
|
|
597
|
+
<span className="verified-custd-mdl-add-cosigner-body-text-label-bold">
|
|
598
|
+
will not get access
|
|
599
|
+
</span>{" "}
|
|
600
|
+
to your account in any way.
|
|
601
|
+
</p>
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
<div className="verified-custd-mdl-add-cosigner-buttons-cont">
|
|
605
|
+
<button
|
|
606
|
+
onClick={() => {
|
|
607
|
+
setShowRejectInvitation(true);
|
|
608
|
+
}}
|
|
609
|
+
className="verified-custd-mdl-add-cosigner-button-neut"
|
|
610
|
+
>
|
|
611
|
+
Reject
|
|
612
|
+
</button>
|
|
613
|
+
|
|
614
|
+
<button
|
|
615
|
+
onClick={async () => {
|
|
616
|
+
await handleAcceptAndRejectInvitation(true);
|
|
617
|
+
}}
|
|
618
|
+
className="verified-custd-mdl-add-cosigner-button-action"
|
|
619
|
+
>
|
|
620
|
+
Accept
|
|
621
|
+
</button>
|
|
622
|
+
</div>
|
|
623
|
+
</React.Fragment>
|
|
624
|
+
)}
|
|
625
|
+
|
|
626
|
+
{showRejectInvitation && (
|
|
627
|
+
<div className="verified-custd-mdl-add-cosigner-confirm-body-content-outter">
|
|
628
|
+
<div className="verified-custd-mdl-add-cosigner-confirm-body-content">
|
|
629
|
+
<div className="verified-custd-mdl-add-cosigner-confirm-body-cont">
|
|
630
|
+
<div className="verified-custd-mdl-add-cosigner-confirm-body-header">
|
|
631
|
+
<p className="verified-custd-mdl-add-cosigner-confirm-body-title">
|
|
632
|
+
Are you sure you want to reject this request?
|
|
633
|
+
</p>
|
|
634
|
+
<p
|
|
635
|
+
style={{
|
|
636
|
+
fontSize: "12px",
|
|
637
|
+
color: "var(--Neutral-600, #5B5D6E)",
|
|
638
|
+
}}
|
|
639
|
+
className="verified-custd-mdl-add-cosigner-confirm-body-label"
|
|
640
|
+
>
|
|
641
|
+
Once you reject to be a co-signer for{" "}
|
|
642
|
+
<b>{props.vaultData?.vaultId}</b>, you will not be
|
|
643
|
+
able to reset the PIN for them.
|
|
644
|
+
</p>
|
|
645
|
+
</div>
|
|
646
|
+
|
|
647
|
+
<div
|
|
648
|
+
style={{ width: "90%" }}
|
|
649
|
+
className="verified-custd-mdl-add-cosigner-buttons-cont"
|
|
650
|
+
>
|
|
651
|
+
<button
|
|
652
|
+
onClick={async () => {
|
|
653
|
+
await handleAcceptAndRejectInvitation(false);
|
|
654
|
+
}}
|
|
655
|
+
className="verified-custd-mdl-add-cosigner-button-action"
|
|
656
|
+
>
|
|
657
|
+
Yes
|
|
658
|
+
</button>
|
|
659
|
+
|
|
660
|
+
<button
|
|
661
|
+
onClick={() => {
|
|
662
|
+
setShowRejectInvitation(false);
|
|
663
|
+
}}
|
|
664
|
+
className="verified-custd-mdl-add-cosigner-button-action"
|
|
665
|
+
>
|
|
666
|
+
No
|
|
667
|
+
</button>
|
|
668
|
+
</div>
|
|
669
|
+
</div>
|
|
670
|
+
</div>
|
|
671
|
+
</div>
|
|
672
|
+
)}
|
|
673
|
+
</div>
|
|
674
|
+
)}
|
|
675
|
+
|
|
676
|
+
{showInvitationSuccess && (
|
|
677
|
+
<Success
|
|
678
|
+
messageTosend={{ type: "closePopup", key: "", value: "" }}
|
|
679
|
+
customTextHeader="Successful"
|
|
680
|
+
customTextFooter={
|
|
681
|
+
!showRejectInvitation
|
|
682
|
+
? `You have been added as a Co-Signer for ${props.vaultData?.vaultId}`
|
|
683
|
+
: `You rejected Co-signer reject from ${props.vaultData?.vaultId}`
|
|
684
|
+
}
|
|
685
|
+
/>
|
|
686
|
+
)}
|
|
687
|
+
</React.Fragment>
|
|
688
|
+
)}
|
|
689
|
+
</React.Fragment>
|
|
690
|
+
);
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
export default CreatePinPage;
|