@smileid/web-components 2.0.2 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/DocumentCaptureScreens-ChpBVvNE.js +1532 -0
- package/dist/esm/DocumentCaptureScreens-ChpBVvNE.js.map +1 -0
- package/dist/esm/EndUserConsent-CMHp-34-.js +715 -0
- package/dist/esm/EndUserConsent-CMHp-34-.js.map +1 -0
- package/dist/esm/Navigation-juBE4qOw.js +136 -0
- package/dist/esm/Navigation-juBE4qOw.js.map +1 -0
- package/dist/esm/PoweredBySmileId-CxbaihMu.js +33 -0
- package/dist/esm/PoweredBySmileId-CxbaihMu.js.map +1 -0
- package/dist/esm/SelfieCaptureScreens-DMo-z-32.js +7618 -0
- package/dist/esm/SelfieCaptureScreens-DMo-z-32.js.map +1 -0
- package/dist/esm/SignaturePad-C7MtmT8m.js +324 -0
- package/dist/esm/SignaturePad-C7MtmT8m.js.map +1 -0
- package/dist/esm/TotpConsent-CQU5jQi4.js +730 -0
- package/dist/esm/TotpConsent-CQU5jQi4.js.map +1 -0
- package/dist/esm/combobox.js +300 -0
- package/dist/esm/combobox.js.map +1 -0
- package/dist/esm/document.js +5 -0
- package/dist/esm/document.js.map +1 -0
- package/dist/esm/end-user-consent.js +5 -0
- package/dist/esm/end-user-consent.js.map +1 -0
- package/dist/esm/main.js +22 -0
- package/dist/esm/main.js.map +1 -0
- package/dist/esm/navigation.js +5 -0
- package/dist/esm/navigation.js.map +1 -0
- package/dist/esm/package-D_4zJ9ck.js +105 -0
- package/dist/esm/package-D_4zJ9ck.js.map +1 -0
- package/dist/esm/selfie.js +5 -0
- package/dist/esm/selfie.js.map +1 -0
- package/dist/esm/signature-pad.js +5 -0
- package/dist/esm/signature-pad.js.map +1 -0
- package/dist/esm/smart-camera-web.js +302 -0
- package/dist/esm/smart-camera-web.js.map +1 -0
- package/dist/esm/styles-D2i3GFLK.js +405 -0
- package/dist/esm/styles-D2i3GFLK.js.map +1 -0
- package/dist/esm/totp-consent.js +5 -0
- package/dist/esm/totp-consent.js.map +1 -0
- package/dist/smart-camera-web.js +4130 -0
- package/dist/smart-camera-web.js.map +1 -0
- package/dist/types/combobox.d.ts +21 -0
- package/dist/types/document.d.ts +21 -0
- package/dist/types/end-user-consent.d.ts +21 -0
- package/dist/types/main.d.ts +331 -0
- package/dist/types/navigation.d.ts +21 -0
- package/dist/types/selfie.d.ts +21 -0
- package/dist/types/signature-pad.d.ts +21 -0
- package/dist/types/smart-camera-web.d.ts +21 -0
- package/dist/types/totp-consent.d.ts +21 -0
- package/{src → lib}/components/camera-permission/CameraPermission.js +0 -1
- package/{src → lib}/components/document/src/document-capture/DocumentCapture.js +0 -1
- package/{src → lib}/components/document/src/document-capture-review/DocumentCaptureReview.js +0 -1
- package/{src → lib}/components/selfie/src/SelfieCaptureScreens.js +188 -37
- package/{src → lib}/components/selfie/src/index.js +0 -2
- package/{src → lib}/components/selfie/src/selfie-capture/SelfieCapture.js +3 -4
- package/{src → lib}/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +0 -1
- package/{src → lib}/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +0 -8
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +226 -0
- package/lib/components/selfie/src/selfie-capture-wrapper/index.ts +1 -0
- package/lib/components/selfie/src/smartselfie-capture/OvalProgress.tsx +81 -0
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +223 -0
- package/lib/components/selfie/src/smartselfie-capture/components/AlertDisplay.tsx +34 -0
- package/lib/components/selfie/src/smartselfie-capture/components/CameraPreview.tsx +97 -0
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +74 -0
- package/lib/components/selfie/src/smartselfie-capture/components/index.ts +3 -0
- package/lib/components/selfie/src/smartselfie-capture/constants.ts +23 -0
- package/lib/components/selfie/src/smartselfie-capture/hooks/index.ts +2 -0
- package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +94 -0
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +558 -0
- package/lib/components/selfie/src/smartselfie-capture/index.ts +1 -0
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +12 -0
- package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +105 -0
- package/lib/components/selfie/src/smartselfie-capture/utils/faceDetection.ts +129 -0
- package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +65 -0
- package/lib/components/selfie/src/smartselfie-capture/utils/index.ts +4 -0
- package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +60 -0
- package/{src → lib}/components/signature-pad/package.json +1 -1
- package/{src → lib}/components/smart-camera-web/src/README.md +0 -1
- package/{src → lib}/styles/src/styles.js +0 -1
- package/package.json +76 -24
- package/src/index.js +0 -5
- /package/{src → lib}/components/README.md +0 -0
- /package/{src → lib}/components/attribution/PoweredBySmileId.js +0 -0
- /package/{src → lib}/components/camera-permission/CameraPermission.stories.js +0 -0
- /package/{src → lib}/components/combobox/src/Combobox.js +0 -0
- /package/{src → lib}/components/combobox/src/index.js +0 -0
- /package/{src → lib}/components/document/src/DocumentCaptureScreens.js +0 -0
- /package/{src → lib}/components/document/src/DocumentCaptureScreens.stories.js +0 -0
- /package/{src → lib}/components/document/src/README.md +0 -0
- /package/{src → lib}/components/document/src/document-capture/DocumentCapture.stories.js +0 -0
- /package/{src → lib}/components/document/src/document-capture/README.md +0 -0
- /package/{src → lib}/components/document/src/document-capture/index.js +0 -0
- /package/{src → lib}/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +0 -0
- /package/{src → lib}/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +0 -0
- /package/{src → lib}/components/document/src/document-capture-instructions/README.md +0 -0
- /package/{src → lib}/components/document/src/document-capture-instructions/index.js +0 -0
- /package/{src → lib}/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +0 -0
- /package/{src → lib}/components/document/src/document-capture-review/README.md +0 -0
- /package/{src → lib}/components/document/src/document-capture-review/index.js +0 -0
- /package/{src → lib}/components/document/src/index.js +0 -0
- /package/{src → lib}/components/end-user-consent/src/EndUserConsent.js +0 -0
- /package/{src → lib}/components/end-user-consent/src/EndUserConsent.stories.js +0 -0
- /package/{src → lib}/components/end-user-consent/src/index.js +0 -0
- /package/{src → lib}/components/navigation/src/Navigation.js +0 -0
- /package/{src → lib}/components/navigation/src/Navigation.stories.js +0 -0
- /package/{src → lib}/components/navigation/src/index.js +0 -0
- /package/{src → lib}/components/selfie/README.md +0 -0
- /package/{src → lib}/components/selfie/src/SelfieCaptureScreens.stories.js +0 -0
- /package/{src → lib}/components/selfie/src/selfie-capture/SelfieCapture.stories.js +0 -0
- /package/{src → lib}/components/selfie/src/selfie-capture/index.js +0 -0
- /package/{src → lib}/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +0 -0
- /package/{src → lib}/components/selfie/src/selfie-capture-instructions/index.js +0 -0
- /package/{src → lib}/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +0 -0
- /package/{src → lib}/components/selfie/src/selfie-capture-review/index.js +0 -0
- /package/{src → lib}/components/signature-pad/package-lock.json +0 -0
- /package/{src → lib}/components/signature-pad/src/SignaturePad.js +0 -0
- /package/{src → lib}/components/signature-pad/src/SignaturePad.stories.js +0 -0
- /package/{src → lib}/components/signature-pad/src/index.js +0 -0
- /package/{src → lib}/components/smart-camera-web/src/SmartCameraWeb.js +0 -0
- /package/{src → lib}/components/smart-camera-web/src/SmartCameraWeb.stories.js +0 -0
- /package/{src → lib}/components/totp-consent/src/TotpConsent.js +0 -0
- /package/{src → lib}/components/totp-consent/src/index.js +0 -0
- /package/{src → lib}/domain/camera/src/README.md +0 -0
- /package/{src → lib}/domain/camera/src/SmartCamera.js +0 -0
- /package/{src → lib}/domain/constants/src/Constants.js +0 -0
- /package/{src → lib}/domain/file-upload/README.md +0 -0
- /package/{src → lib}/domain/file-upload/src/SmartFileUpload.js +0 -0
- /package/{src → lib}/styles/README.md +0 -0
- /package/{src → lib}/styles/src/typography.js +0 -0
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
import d from "validate.js";
|
|
2
|
+
function a(n, t) {
|
|
3
|
+
return fetch(n, {
|
|
4
|
+
body: JSON.stringify(t),
|
|
5
|
+
cache: "no-cache",
|
|
6
|
+
headers: {
|
|
7
|
+
Accept: "application/json",
|
|
8
|
+
"Content-Type": "application/json"
|
|
9
|
+
},
|
|
10
|
+
method: "POST",
|
|
11
|
+
mode: "cors"
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function l() {
|
|
15
|
+
return `
|
|
16
|
+
<style>
|
|
17
|
+
*,
|
|
18
|
+
*::before,
|
|
19
|
+
*::after {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host {
|
|
26
|
+
--flow-space: 1.5rem;
|
|
27
|
+
|
|
28
|
+
--color-dark: #404040;
|
|
29
|
+
--color-grey: #555B69;
|
|
30
|
+
|
|
31
|
+
--color-success: #1EB244;
|
|
32
|
+
--color-failure: #FFEDEB;
|
|
33
|
+
--color-failure-tint: #F86B58;
|
|
34
|
+
|
|
35
|
+
--color-richblue: #043C93;
|
|
36
|
+
--color-theme: ${this.themeColor};
|
|
37
|
+
|
|
38
|
+
--color-active: #2D2B2A;
|
|
39
|
+
--color-default: #001096;
|
|
40
|
+
--color-disabled: #848282;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
html {
|
|
44
|
+
font-family: 'DM Sans', sans-serif;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[hidden] {
|
|
48
|
+
display: none !important;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[disabled] {
|
|
52
|
+
cursor: not-allowed !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.visually-hidden {
|
|
56
|
+
border: 0;
|
|
57
|
+
clip: rect(1px 1px 1px 1px);
|
|
58
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
59
|
+
height: auto;
|
|
60
|
+
margin: 0;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
padding: 0;
|
|
63
|
+
position: absolute;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
width: 1px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.color-dark {
|
|
69
|
+
color: var(--color-dark);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.color-grey {
|
|
73
|
+
color: var(--color-grey);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.flow > * + * {
|
|
77
|
+
margin-top: var(--flow-space);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.center {
|
|
81
|
+
margin-left: auto;
|
|
82
|
+
margin-right: auto;
|
|
83
|
+
|
|
84
|
+
text-align: center;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
h1 {
|
|
88
|
+
font-size: 1.5rem;
|
|
89
|
+
font-weight: 700;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
button, input, select, textarea {
|
|
93
|
+
font: inherit
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
label,
|
|
97
|
+
input,
|
|
98
|
+
select,
|
|
99
|
+
textarea {
|
|
100
|
+
--flow-space: .5rem;
|
|
101
|
+
display: block;
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
input,
|
|
106
|
+
select,
|
|
107
|
+
textarea {
|
|
108
|
+
border: 1px solid #d1d8d6;
|
|
109
|
+
border-radius: .5rem;
|
|
110
|
+
padding: .75rem 1rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
button {
|
|
114
|
+
--button-color: var(--color-default);
|
|
115
|
+
--flow-space: 3rem;
|
|
116
|
+
-webkit-appearance: none;
|
|
117
|
+
-moz-appearance: none;
|
|
118
|
+
align-items: center;
|
|
119
|
+
appearance: none;
|
|
120
|
+
background-color: transparent;
|
|
121
|
+
border-radius: 2.5rem;
|
|
122
|
+
border: none;
|
|
123
|
+
color: #ffffff;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
display: inline-flex;
|
|
126
|
+
font-size: 20px;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
inline-size: 100%;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
letter-spacing: .05ch;
|
|
131
|
+
line-height: 1;
|
|
132
|
+
padding: 1rem 2.5rem;
|
|
133
|
+
text-align: center;
|
|
134
|
+
text-decoration: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
button[data-variant='solid'] {
|
|
138
|
+
background-color: var(--button-color);
|
|
139
|
+
border: 2px solid var(--button-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
button[data-variant='outline'] {
|
|
143
|
+
color: var(--button-color);
|
|
144
|
+
border: 2px solid var(--button-color);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
button[data-variant='ghost'] {
|
|
148
|
+
color: var(--button-color);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
button:hover,
|
|
152
|
+
button:focus,
|
|
153
|
+
button:active {
|
|
154
|
+
--button-color: var(--color-active);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
button:disabled {
|
|
158
|
+
--button-color: var(--color-disabled);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
button[data-type='icon'] {
|
|
162
|
+
height: 2rem;
|
|
163
|
+
padding: 0;
|
|
164
|
+
width: 2rem;
|
|
165
|
+
background: transparent;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
input {
|
|
169
|
+
font: inherit;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
fieldset {
|
|
173
|
+
margin: 0;
|
|
174
|
+
border: none;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.font-weight:bold {
|
|
178
|
+
font-weight: bold;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.justify-right {
|
|
182
|
+
justify-content: end !important;
|
|
183
|
+
}
|
|
184
|
+
.nav {
|
|
185
|
+
display: flex;
|
|
186
|
+
justify-content: space-between;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.back-wrapper {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.back-button-text {
|
|
195
|
+
font-size: 11px;
|
|
196
|
+
line-height: 11px;
|
|
197
|
+
color: ${this.themeColor || "rgb(21, 31, 114)"};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#error,
|
|
201
|
+
.validation-message {
|
|
202
|
+
color: red;
|
|
203
|
+
text-transform: capitalize;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.input-group {
|
|
207
|
+
--flow-space: 1.5rem;
|
|
208
|
+
text-align: initial;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.input-radio {
|
|
212
|
+
--flow-space: 1.5rem;
|
|
213
|
+
background-color: #F8F8F8;
|
|
214
|
+
border-radius: .5rem;
|
|
215
|
+
padding: .625rem 1rem;
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.otp-mode {
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
text-align: initial;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.otp-mode :first-child {
|
|
227
|
+
margin: 0;
|
|
228
|
+
margin-inline-end: 1rem;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.otp-mode :nth-child(2n) {
|
|
232
|
+
--flow-space: .5rem;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.input-radio [type='radio'] {
|
|
236
|
+
border-radius: 50%;
|
|
237
|
+
inline-size: 2rem;
|
|
238
|
+
block-size: 2rem;
|
|
239
|
+
margin-inline-end: .5rem;
|
|
240
|
+
background-color: white;
|
|
241
|
+
border: .125rem solid #f5f5f5;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#totp-token {
|
|
245
|
+
block-size: 3rem;
|
|
246
|
+
inline-size: 20rem;
|
|
247
|
+
max-inline-size: 100%;
|
|
248
|
+
background-color: #F5F5F5;
|
|
249
|
+
border: none;
|
|
250
|
+
border-bottom: 2px solid #2F718D;
|
|
251
|
+
font-size: 1.5rem;
|
|
252
|
+
text-align: center;
|
|
253
|
+
font-weight: 700;
|
|
254
|
+
letter-spacing: 2rem;
|
|
255
|
+
padding: .5rem 1rem;
|
|
256
|
+
margin-inline: auto;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@keyframes spin {
|
|
260
|
+
0% {
|
|
261
|
+
transform: translate3d(-50%, -50%, 0) rotate(0deg);
|
|
262
|
+
}
|
|
263
|
+
100% {
|
|
264
|
+
transform: translate3d(-50%, -50%, 0) rotate(360deg);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.spinner {
|
|
269
|
+
animation: 1.5s linear infinite spin;
|
|
270
|
+
animation-play-state: inherit;
|
|
271
|
+
border: solid 5px #cfd0d1;
|
|
272
|
+
border-bottom-color: var(--color-active);
|
|
273
|
+
border-radius: 50%;
|
|
274
|
+
content: "";
|
|
275
|
+
display: block;
|
|
276
|
+
height: 25px;
|
|
277
|
+
width: 25px;
|
|
278
|
+
will-change: transform;
|
|
279
|
+
position: relative;
|
|
280
|
+
top: .675rem;
|
|
281
|
+
left: 1.25rem;
|
|
282
|
+
}
|
|
283
|
+
</style>
|
|
284
|
+
|
|
285
|
+
<div class='flow center' id='id-entry'>
|
|
286
|
+
<div class="nav">
|
|
287
|
+
<div class="back-wrapper">
|
|
288
|
+
<button type='button' data-type='icon' id="back-button" class="back-button">
|
|
289
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
290
|
+
<path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>
|
|
291
|
+
<path fill="${this.themeColor}" d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"/>
|
|
292
|
+
</svg>
|
|
293
|
+
</button>
|
|
294
|
+
<div class="back-button-text">Back</div>
|
|
295
|
+
</div>
|
|
296
|
+
<button data-type='icon' type='button' class='close-iframe'>
|
|
297
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
298
|
+
<path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>
|
|
299
|
+
<path fill="#91190F" d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"/>
|
|
300
|
+
</svg>
|
|
301
|
+
<span class='visually-hidden'>Close SmileIdentity Verification frame</span>
|
|
302
|
+
</button>
|
|
303
|
+
</div>
|
|
304
|
+
<h1>
|
|
305
|
+
Enter your ${this.idTypeLabel}
|
|
306
|
+
</h1>
|
|
307
|
+
|
|
308
|
+
<form name='id-entry-form' class='flow' novalidate style='--flow-space: 5.5rem'>
|
|
309
|
+
<div id='id-number' class="input-group flow">
|
|
310
|
+
<label class='required' for="id_number">
|
|
311
|
+
${this.idTypeLabel}
|
|
312
|
+
</label>
|
|
313
|
+
|
|
314
|
+
<input aria-required='true' id="id_number" name="id_number"
|
|
315
|
+
maxlength='11' placeholder='' />
|
|
316
|
+
|
|
317
|
+
<p>
|
|
318
|
+
<small>${this.idHint}</small>
|
|
319
|
+
</p>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<button data-variant='solid' id='query-otp-modes' type='submit'>
|
|
323
|
+
<span class='text'>Continue</span>
|
|
324
|
+
<svg aria-hidden='true' width="25" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
325
|
+
<path d="M7 12h11m0 0-4.588-4M18 12l-4.588 4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
326
|
+
</svg>
|
|
327
|
+
<span hidden class='spinner'></span>
|
|
328
|
+
</button>
|
|
329
|
+
</form>
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
<div hidden class='flow center' id='select-mode'>
|
|
333
|
+
<div class="nav">
|
|
334
|
+
<div class="back-wrapper">
|
|
335
|
+
<button type='button' data-type='icon' id="back-to-entry-button" class="back-button">
|
|
336
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
337
|
+
<path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>
|
|
338
|
+
<path fill="${this.themeColor}" d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"/>
|
|
339
|
+
</svg>
|
|
340
|
+
</button>
|
|
341
|
+
<div class="back-button-text">Back</div>
|
|
342
|
+
</div>
|
|
343
|
+
<button data-type='icon' type='button' class='close-iframe'>
|
|
344
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
345
|
+
<path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>
|
|
346
|
+
<path fill="#91190F" d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"/>
|
|
347
|
+
</svg>
|
|
348
|
+
<span class='visually-hidden'>Close SmileIdentity Verification frame</span>
|
|
349
|
+
</button>
|
|
350
|
+
</div>
|
|
351
|
+
<h1>
|
|
352
|
+
Select contact method
|
|
353
|
+
</h1>
|
|
354
|
+
|
|
355
|
+
<form name='select-mode-form' novalidate style='--flow-space: 4.25rem' id='otp-entry' class='flow center'>
|
|
356
|
+
<fieldset class='flow center'>
|
|
357
|
+
<legend class='flow' style='--flow-space: 1.5rem'>
|
|
358
|
+
<p>
|
|
359
|
+
NIBSS, the data custodian of BVN,
|
|
360
|
+
will send you a One-Time Password (OTP)
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
<p>
|
|
364
|
+
<small>
|
|
365
|
+
The request will be from Chams Plc, who is NIBSS' technical partner.
|
|
366
|
+
</small>
|
|
367
|
+
</p>
|
|
368
|
+
</legend>
|
|
369
|
+
|
|
370
|
+
<div class='flow center'>
|
|
371
|
+
${this.modes.length ? this.modes.map(
|
|
372
|
+
(n) => `<label class='input-radio'>
|
|
373
|
+
<input type="radio" id="" name="mode" value="${Object.keys(n)[0]}">
|
|
374
|
+
<div class='otp-mode'>
|
|
375
|
+
${Object.keys(n)[0].includes("sms") ? `
|
|
376
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="37" fill="none">
|
|
377
|
+
<path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.697 24.12c4.914 0 7.37 0 8.897-1.652 1.527-1.651 1.527-4.31 1.527-9.625 0-5.316 0-7.974-1.527-9.625-1.526-1.651-3.983-1.651-8.897-1.651h-5.211c-4.914 0-7.37 0-8.897 1.651-1.527 1.651-1.527 4.31-1.527 9.625 0 5.316 0 7.974 1.527 9.625.85.92 1.991 1.328 3.685 1.508"/>
|
|
378
|
+
<g filter="url(#sms)">
|
|
379
|
+
<path stroke="#2F718D" stroke-linecap="round" stroke-width="2" d="M16.697 24.12c-1.61 0-3.384.703-5.005 1.613-2.602 1.462-3.903 2.193-4.545 1.727-.64-.465-.52-1.91-.277-4.799l.055-.656" shape-rendering="crispEdges"/>
|
|
380
|
+
</g>
|
|
381
|
+
<defs>
|
|
382
|
+
<filter id="sms" width="20.023" height="15.595" x="1.675" y="21.005" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">
|
|
383
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
384
|
+
<feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
|
385
|
+
<feOffset dy="4"/>
|
|
386
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
387
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
388
|
+
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
389
|
+
<feBlend in2="BackgroundImageFix" result="effect1_dropShadow_2_404"/>
|
|
390
|
+
<feBlend in="SourceGraphic" in2="effect1_dropShadow_2_404" result="shape"/>
|
|
391
|
+
</filter>
|
|
392
|
+
</defs>
|
|
393
|
+
</svg>
|
|
394
|
+
` : `
|
|
395
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="35" height="24" fill="none">
|
|
396
|
+
<path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.062 4.367c0-1.437 1.221-2.603 2.727-2.603h21.815c1.506 0 2.727 1.166 2.727 2.603v15.62c0 1.438-1.221 2.604-2.727 2.604H6.789c-1.506 0-2.727-1.166-2.727-2.604V4.367Z"/>
|
|
397
|
+
<g filter="url(#message)">
|
|
398
|
+
<path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m5.426 3.066 8.647 7.338c2.067 1.754 5.18 1.754 7.247 0l8.648-7.338" shape-rendering="crispEdges"/>
|
|
399
|
+
</g>
|
|
400
|
+
<defs>
|
|
401
|
+
<filter id="message" width="34.042" height="18.154" x=".676" y="2.316" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">
|
|
402
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
403
|
+
<feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
|
404
|
+
<feOffset dy="4"/>
|
|
405
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
406
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
407
|
+
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
408
|
+
<feBlend in2="BackgroundImageFix" result="effect1_dropShadow_2_394"/>
|
|
409
|
+
<feBlend in="SourceGraphic" in2="effect1_dropShadow_2_394" result="shape"/>
|
|
410
|
+
</filter>
|
|
411
|
+
</defs>
|
|
412
|
+
</svg>
|
|
413
|
+
`}
|
|
414
|
+
<div class='flow'>
|
|
415
|
+
<p>
|
|
416
|
+
${Object.values(n)[0]}
|
|
417
|
+
</p>
|
|
418
|
+
<p>
|
|
419
|
+
<small>
|
|
420
|
+
An OTP will be sent by ${Object.keys(n)[0].includes(
|
|
421
|
+
"sms"
|
|
422
|
+
) ? "sms" : "email"} to verify your identity
|
|
423
|
+
</small>
|
|
424
|
+
</p>
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
</label>`
|
|
428
|
+
).join(`
|
|
429
|
+
`) : "No modes yet"}
|
|
430
|
+
</div>
|
|
431
|
+
</fieldset>
|
|
432
|
+
|
|
433
|
+
<button data-variant='ghost' id='contact-methods-outdated' style='--flow-space: .5rem' class='' type='button'>
|
|
434
|
+
I am no longer using any of these options
|
|
435
|
+
</button>
|
|
436
|
+
|
|
437
|
+
<button data-variant='solid' id='select-otp-mode' type='submit'>
|
|
438
|
+
<span class='text'>Continue</span>
|
|
439
|
+
<svg aria-hidden='true' width="25" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
440
|
+
<path d="M7 12h11m0 0-4.588-4M18 12l-4.588 4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
441
|
+
</svg>
|
|
442
|
+
<span hidden class='spinner'></span>
|
|
443
|
+
</button>
|
|
444
|
+
</form>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<div hidden class='flow center' id='otp-verification'>
|
|
448
|
+
<div class="nav justify-right">
|
|
449
|
+
<button data-type='icon' type='button' class='close-iframe'>
|
|
450
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
451
|
+
<path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>
|
|
452
|
+
<path fill="#91190F" d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"/>
|
|
453
|
+
</svg>
|
|
454
|
+
<span class='visually-hidden'>Close SmileIdentity Verification frame</span>
|
|
455
|
+
</button>
|
|
456
|
+
</div>
|
|
457
|
+
<h1>
|
|
458
|
+
OTP Verification
|
|
459
|
+
</h1>
|
|
460
|
+
|
|
461
|
+
<div style='--flow-space: 4.25rem' id='otp-entry'>
|
|
462
|
+
<form name='otp-submission-form' novalidate style='--flow-space: 1.5rem' class='flow center'>
|
|
463
|
+
<label for='totp-token'>
|
|
464
|
+
Enter the OTP sent to <span class='font-weight:bold'>${this.selectedOtpDeliveryMode}</span>
|
|
465
|
+
</label>
|
|
466
|
+
<input type='text' id='totp-token' maxlength='6' inputmode='numeric' autocomplete='one-time-code' />
|
|
467
|
+
|
|
468
|
+
<p>
|
|
469
|
+
Didn't receive the OTP${this.selectedOtpDeliveryMode ? ` at <span class='font-weight:bold'>${this.selectedOtpDeliveryMode}</span>?` : "?"}
|
|
470
|
+
</p>
|
|
471
|
+
|
|
472
|
+
<button style='--flow-space: .5rem' data-variant='ghost' class='try-another-method' type='button'>
|
|
473
|
+
Try another contact method
|
|
474
|
+
</button>
|
|
475
|
+
|
|
476
|
+
<button data-variant='solid' id='submit-otp' type='submit'>
|
|
477
|
+
<span class='text'>Submit</span>
|
|
478
|
+
<svg aria-hidden='true' width="25" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
479
|
+
<path d="M7 12h11m0 0-4.588-4M18 12l-4.588 4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
480
|
+
</svg>
|
|
481
|
+
<span hidden class='spinner'></span>
|
|
482
|
+
</button>
|
|
483
|
+
</form>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
`;
|
|
487
|
+
}
|
|
488
|
+
class c extends HTMLElement {
|
|
489
|
+
constructor() {
|
|
490
|
+
super(), this.templateString = l.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" }), this.modes = [], this["otp-delivery-mode"] = "", this.queryOtpModes = this.queryOtpModes.bind(this), this.selectOtpMode = this.selectOtpMode.bind(this), this.submitOtp = this.submitOtp.bind(this), this.switchContactMethod = this.switchContactMethod.bind(this), this.handleTotpConsentGrant = this.handleTotpConsentGrant.bind(this), this.handleTotpConsentContactMethodsOutdated = this.handleTotpConsentContactMethodsOutdated.bind(this), this.pages = [];
|
|
491
|
+
}
|
|
492
|
+
static get observedAttributes() {
|
|
493
|
+
return ["modes", "otp-delivery-mode"];
|
|
494
|
+
}
|
|
495
|
+
attributeChangedCallback(t) {
|
|
496
|
+
switch (t) {
|
|
497
|
+
case "modes":
|
|
498
|
+
case "otp-delivery-mode": {
|
|
499
|
+
const e = document.createElement("template");
|
|
500
|
+
e.innerHTML = this.render();
|
|
501
|
+
const i = e.content.cloneNode(!0).querySelector(`#${this.activeScreen.id}`);
|
|
502
|
+
i.hidden = !1, this.shadowRoot.replaceChild(i, this.activeScreen), this.setUpEventListeners(), this.setActiveScreen(i);
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
setUpEventListeners() {
|
|
508
|
+
this.idEntryScreen = this.shadowRoot.querySelector("#id-entry"), this.selectModeScreen = this.shadowRoot.querySelector("#select-mode"), this.otpVerificationScreen = this.shadowRoot.querySelector("#otp-verification"), this.activeScreen || (this.activeScreen = this.idEntryScreen), this.queryOtpModesButton = this.idEntryScreen.querySelector("#query-otp-modes"), this.backButton = this.idEntryScreen.querySelector("#back-button"), this.selectOtpModeButton = this.selectModeScreen.querySelector("#select-otp-mode"), this.entryBackbutton = this.selectModeScreen.querySelector(
|
|
509
|
+
"#back-to-entry-button"
|
|
510
|
+
), this.contactMethodsOutdatedButton = this.selectModeScreen.querySelector(
|
|
511
|
+
"#contact-methods-outdated"
|
|
512
|
+
), this.submitOtpButton = this.otpVerificationScreen.querySelector("#submit-otp"), this.switchContactMethodButton = this.otpVerificationScreen.querySelector(
|
|
513
|
+
".try-another-method"
|
|
514
|
+
);
|
|
515
|
+
const t = this.shadowRoot.querySelectorAll(".close-iframe");
|
|
516
|
+
this.idNumberInput = this.idEntryScreen.querySelector("#id_number"), this.modeInputs = this.selectModeScreen.querySelectorAll('[name="mode"]'), this.otpInput = this.otpVerificationScreen.querySelector("#totp-token"), this.queryOtpModesButton.addEventListener(
|
|
517
|
+
"click",
|
|
518
|
+
(e) => this.queryOtpModes(e)
|
|
519
|
+
), this.selectOtpModeButton.addEventListener(
|
|
520
|
+
"click",
|
|
521
|
+
(e) => this.selectOtpMode(e)
|
|
522
|
+
), this.submitOtpButton.addEventListener("click", (e) => this.submitOtp(e)), this.switchContactMethodButton.addEventListener(
|
|
523
|
+
"click",
|
|
524
|
+
(e) => this.switchContactMethod(e)
|
|
525
|
+
), this.contactMethodsOutdatedButton.addEventListener(
|
|
526
|
+
"click",
|
|
527
|
+
(e) => this.handleTotpConsentContactMethodsOutdated(e)
|
|
528
|
+
), this.entryBackbutton.addEventListener("click", () => {
|
|
529
|
+
this.handleBackClick();
|
|
530
|
+
}), this.backButton.addEventListener("click", () => {
|
|
531
|
+
this.handleBackClick();
|
|
532
|
+
}), t.forEach((e) => {
|
|
533
|
+
e.addEventListener(
|
|
534
|
+
"click",
|
|
535
|
+
() => {
|
|
536
|
+
this.closeWindow();
|
|
537
|
+
},
|
|
538
|
+
!1
|
|
539
|
+
);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
closeWindow() {
|
|
543
|
+
const t = window.parent;
|
|
544
|
+
[t.parent, t].forEach((e) => {
|
|
545
|
+
e.postMessage("SmileIdentity::Close", "*");
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
handleBackClick() {
|
|
549
|
+
const t = this.pages.pop();
|
|
550
|
+
t ? this.setActiveScreen(t) : this.dispatchEvent(
|
|
551
|
+
new CustomEvent("end-user-consent.totp.cancelled", {})
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
connectedCallback() {
|
|
555
|
+
const t = document.createElement("template");
|
|
556
|
+
t.innerHTML = this.render(), this.shadowRoot.appendChild(t.content.cloneNode(!0)), this.setUpEventListeners();
|
|
557
|
+
}
|
|
558
|
+
switchContactMethod() {
|
|
559
|
+
this.queryOtpModes();
|
|
560
|
+
}
|
|
561
|
+
resetForm() {
|
|
562
|
+
this.activeScreen.querySelectorAll("[aria-invalid]").forEach((i) => i.removeAttribute("aria-invalid")), this.activeScreen.querySelectorAll(
|
|
563
|
+
".validation-message"
|
|
564
|
+
).forEach((i) => i.remove());
|
|
565
|
+
}
|
|
566
|
+
handleIdNumberValidationErrors(t) {
|
|
567
|
+
Object.keys(t).forEach((i) => {
|
|
568
|
+
const o = this.activeScreen.querySelector(`#${i}`);
|
|
569
|
+
o.setAttribute("aria-invalid", "true"), o.setAttribute("aria-describedby", `${i}-hint`);
|
|
570
|
+
const s = document.createElement("div");
|
|
571
|
+
s.setAttribute("id", `${i}-hint`), s.setAttribute("class", "validation-message"), s.textContent = t[i][0], o.insertAdjacentElement("afterend", s);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
handleActiveScreenErrors(t) {
|
|
575
|
+
const e = this.activeScreen.querySelector('[type="submit"]'), i = document.createElement("div");
|
|
576
|
+
i.setAttribute("class", "validation-message"), i.textContent = t, e.insertAdjacentElement("beforebegin", i);
|
|
577
|
+
}
|
|
578
|
+
validateIdNumber(t) {
|
|
579
|
+
const e = {
|
|
580
|
+
id_number: {
|
|
581
|
+
format: new RegExp(this.idRegex),
|
|
582
|
+
presence: {
|
|
583
|
+
allowEmpty: !1,
|
|
584
|
+
message: "is required"
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}, i = d({ id_number: t }, e);
|
|
588
|
+
return i && this.handleIdNumberValidationErrors(i), i;
|
|
589
|
+
}
|
|
590
|
+
async queryOtpModes(t) {
|
|
591
|
+
t && (t.preventDefault(), this.resetForm());
|
|
592
|
+
const e = this.validateIdNumber(this.idNumberInput.value);
|
|
593
|
+
if (localStorage.setItem("idNumber", this.idNumberInput.value || this.idNumber), !e) {
|
|
594
|
+
const i = {
|
|
595
|
+
country: this.country,
|
|
596
|
+
id_number: this.idNumber,
|
|
597
|
+
id_type: this.idType,
|
|
598
|
+
partner_id: this.partnerId,
|
|
599
|
+
token: this.token
|
|
600
|
+
}, o = `${this.baseUrl}/totp_consent`;
|
|
601
|
+
try {
|
|
602
|
+
this.toggleLoading();
|
|
603
|
+
const s = await a(o, i), r = await s.json();
|
|
604
|
+
this.toggleLoading(), s.ok ? (this.sessionId = r.session_id, this.modes = r.modes, this.setActiveScreen(this.selectModeScreen), this.setAttribute("modes", r.modes)) : this.handleActiveScreenErrors(r.error);
|
|
605
|
+
} catch (s) {
|
|
606
|
+
this.toggleLoading(), this.handleActiveScreenErrors(s.message);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
async selectOtpMode(t) {
|
|
611
|
+
t.preventDefault(), this.resetForm(), this.mode = Array.prototype.find.call(
|
|
612
|
+
this.modeInputs,
|
|
613
|
+
(o) => o.checked
|
|
614
|
+
).value;
|
|
615
|
+
const e = {
|
|
616
|
+
country: this.country,
|
|
617
|
+
id_number: this.idNumber,
|
|
618
|
+
id_type: this.idType,
|
|
619
|
+
mode: this.mode,
|
|
620
|
+
partner_id: this.partnerId,
|
|
621
|
+
session_id: this.sessionId,
|
|
622
|
+
token: this.token
|
|
623
|
+
}, i = `${this.baseUrl}/totp_consent/mode`;
|
|
624
|
+
try {
|
|
625
|
+
this.toggleLoading();
|
|
626
|
+
const o = await a(i, e), s = await o.json();
|
|
627
|
+
this.toggleLoading(), o.ok ? (this.selectedOtpDeliveryMode = this.modes.filter(
|
|
628
|
+
(r) => r[this.mode]
|
|
629
|
+
)[0][this.mode], this.setActiveScreen(this.otpVerificationScreen), this.setAttribute("otp-delivery-mode", this.selectedOtpDeliveryMode)) : this.handleActiveScreenErrors(s.error);
|
|
630
|
+
} catch (o) {
|
|
631
|
+
this.toggleLoading(), this.handleActiveScreenErrors(o.message);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
async submitOtp(t) {
|
|
635
|
+
t.preventDefault(), this.resetForm(), this.otp = this.otpInput.value;
|
|
636
|
+
const e = {
|
|
637
|
+
country: this.country,
|
|
638
|
+
id_number: this.idNumber,
|
|
639
|
+
id_type: this.idType,
|
|
640
|
+
otp: this.otp,
|
|
641
|
+
partner_id: this.partnerId,
|
|
642
|
+
session_id: this.sessionId,
|
|
643
|
+
token: this.token
|
|
644
|
+
}, i = `${this.baseUrl}/totp_consent/otp`;
|
|
645
|
+
try {
|
|
646
|
+
this.toggleLoading();
|
|
647
|
+
const o = await a(i, e), s = await o.json();
|
|
648
|
+
this.toggleLoading(), o.ok ? this.handleTotpConsentGrant(t) : this.handleActiveScreenErrors(s.error);
|
|
649
|
+
} catch (o) {
|
|
650
|
+
this.toggleLoading(), this.handleActiveScreenErrors(o.message);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
toggleLoading() {
|
|
654
|
+
const t = this.activeScreen.querySelector('button[type="submit"]'), e = t.querySelector(".text"), i = t.querySelector("svg"), o = t.querySelector(".spinner");
|
|
655
|
+
t.toggleAttribute("disabled"), e.toggleAttribute("hidden"), i.toggleAttribute("hidden"), o.toggleAttribute("hidden");
|
|
656
|
+
}
|
|
657
|
+
setActiveScreen(t) {
|
|
658
|
+
this.activeScreen.hidden = !0, t.hidden = !1, this.activeScreen = t;
|
|
659
|
+
}
|
|
660
|
+
get baseUrl() {
|
|
661
|
+
return this.getAttribute("base-url");
|
|
662
|
+
}
|
|
663
|
+
get country() {
|
|
664
|
+
return this.getAttribute("country");
|
|
665
|
+
}
|
|
666
|
+
get idHint() {
|
|
667
|
+
return this.getAttribute("id-hint") || "Your BVN should be 11 digits long";
|
|
668
|
+
}
|
|
669
|
+
get idNumber() {
|
|
670
|
+
return localStorage.getItem("idNumber");
|
|
671
|
+
}
|
|
672
|
+
get idRegex() {
|
|
673
|
+
return this.getAttribute("id-regex");
|
|
674
|
+
}
|
|
675
|
+
get idType() {
|
|
676
|
+
return this.getAttribute("id-type");
|
|
677
|
+
}
|
|
678
|
+
get idTypeLabel() {
|
|
679
|
+
return this.getAttribute("id-type-label");
|
|
680
|
+
}
|
|
681
|
+
get partnerId() {
|
|
682
|
+
return this.getAttribute("partner-id");
|
|
683
|
+
}
|
|
684
|
+
get partnerName() {
|
|
685
|
+
return this.getAttribute("partner-name");
|
|
686
|
+
}
|
|
687
|
+
get token() {
|
|
688
|
+
return this.getAttribute("token");
|
|
689
|
+
}
|
|
690
|
+
get themeColor() {
|
|
691
|
+
return this.getAttribute("theme-color") || "#001096";
|
|
692
|
+
}
|
|
693
|
+
get hideBack() {
|
|
694
|
+
return this.hasAttribute("hide-back");
|
|
695
|
+
}
|
|
696
|
+
get showNavigation() {
|
|
697
|
+
return this.hasAttribute("show-navigation");
|
|
698
|
+
}
|
|
699
|
+
handleTotpConsentGrant() {
|
|
700
|
+
const t = new CustomEvent("end-user-consent.totp.granted", {
|
|
701
|
+
detail: {
|
|
702
|
+
consented: {
|
|
703
|
+
contact_information: !0,
|
|
704
|
+
document_information: !0,
|
|
705
|
+
personal_details: !0
|
|
706
|
+
},
|
|
707
|
+
id_number: this.idNumber,
|
|
708
|
+
session_id: this.sessionId
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
this.dispatchEvent(t);
|
|
712
|
+
}
|
|
713
|
+
handleTotpConsentContactMethodsOutdated() {
|
|
714
|
+
const t = "end-user-consent.totp.denied.contact-methods-outdated", e = new CustomEvent(t, {
|
|
715
|
+
detail: {
|
|
716
|
+
data: {
|
|
717
|
+
id_number: this.idNumber,
|
|
718
|
+
session_id: this.sessionId
|
|
719
|
+
},
|
|
720
|
+
message: t
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
this.dispatchEvent(e);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
"customElements" in window && !window.customElements.get("totp-consent") && window.customElements.define("totp-consent", c);
|
|
727
|
+
export {
|
|
728
|
+
c as T
|
|
729
|
+
};
|
|
730
|
+
//# sourceMappingURL=TotpConsent-CQU5jQi4.js.map
|