@everymatrix/cashier-verifications 1.42.0 → 1.43.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/cashier-verifications",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e0be02e594f762ecb10851537d8690d5e66f4e5d"
|
|
39
39
|
}
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
import { _, addNewMessages, setLocale, setupI18n } from './i18n';
|
|
5
5
|
import { TRANSLATIONS } from './translations';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import utc from 'dayjs/plugin/utc';
|
|
8
|
+
dayjs.extend(utc);
|
|
6
9
|
|
|
7
10
|
export let endpoint: string;
|
|
8
11
|
export let lang:string = 'en';
|
|
@@ -11,6 +14,7 @@
|
|
|
11
14
|
export let clientstylingurl:string = '';
|
|
12
15
|
export let session: string = '';
|
|
13
16
|
export let customerid: string = '';
|
|
17
|
+
export let ismobileview: string = '';
|
|
14
18
|
|
|
15
19
|
let customStylingContainer:HTMLElement;
|
|
16
20
|
let verificationVendorList = new Set<string>();
|
|
@@ -18,6 +22,7 @@
|
|
|
18
22
|
let verificationStatus: Verifications;
|
|
19
23
|
let displayMessages;
|
|
20
24
|
let allVerificationsVisible = true;
|
|
25
|
+
let desktopView: boolean = true;
|
|
21
26
|
|
|
22
27
|
enum CustomerVerificationVendors {
|
|
23
28
|
'Manual' = 'Manual',
|
|
@@ -66,7 +71,6 @@
|
|
|
66
71
|
VerificationUrlType: string,
|
|
67
72
|
VerificationUrl: string
|
|
68
73
|
}
|
|
69
|
-
|
|
70
74
|
const verificationStatusInProgress = [CustomerVerificationStatus.InProgress, CustomerVerificationStatus.Referred, CustomerVerificationStatus.AwaitingForResponse]
|
|
71
75
|
|
|
72
76
|
const setTranslationUrl = () => {
|
|
@@ -119,6 +123,7 @@
|
|
|
119
123
|
const headers = new Headers();
|
|
120
124
|
headers.append("accept", "application/json");
|
|
121
125
|
headers.append("Content-Type", "application/json");
|
|
126
|
+
headers.append("X-Client-Request-Timestamp", dayjs.utc().format("YYYY-MM-DD HH:mm:ss.SSS"));
|
|
122
127
|
const requestParams:RequestInit = {
|
|
123
128
|
method: "POST",
|
|
124
129
|
headers: headers,
|
|
@@ -159,12 +164,13 @@
|
|
|
159
164
|
if (!verifications || !verifications.length) {
|
|
160
165
|
return { VerificationSummaryStatus: CustomerVerificationStatus.Unverified }
|
|
161
166
|
}
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
167
|
+
const verificationsInProgress = getVerificationInProgress(verifications);
|
|
168
|
+
if (verificationsInProgress && verificationsInProgress.length) {
|
|
169
|
+
const lastVerification = getLastVerification(verificationsInProgress)
|
|
164
170
|
return {
|
|
165
|
-
VerificationSummaryStatus:
|
|
166
|
-
VerificationUrl:
|
|
167
|
-
VerificationStatuses: getVerificationsFilteredByStatus(
|
|
171
|
+
VerificationSummaryStatus: lastVerification.Status,
|
|
172
|
+
VerificationUrl: lastVerification.Flags?.DeferredUrlKey,
|
|
173
|
+
VerificationStatuses: getVerificationsFilteredByStatus(verificationsInProgress, lastVerification.Status)
|
|
168
174
|
}
|
|
169
175
|
} else {
|
|
170
176
|
const isVerificationFailed = verifications.some((verification) => verification.Status === CustomerVerificationStatus.Failed )
|
|
@@ -175,6 +181,11 @@
|
|
|
175
181
|
}
|
|
176
182
|
}
|
|
177
183
|
|
|
184
|
+
const getLastVerification = (verifications) => {
|
|
185
|
+
return verifications.reduce((acc, curr) => {
|
|
186
|
+
return acc ? (new Date(acc) < new Date(curr) ? curr : acc) : curr
|
|
187
|
+
}, 0)
|
|
188
|
+
}
|
|
178
189
|
const getVerificationsFilteredByStatus = (verifications, statuses) => {
|
|
179
190
|
return verifications
|
|
180
191
|
.filter((verification) => statuses.includes(verification.Status))
|
|
@@ -188,12 +199,12 @@
|
|
|
188
199
|
}
|
|
189
200
|
|
|
190
201
|
const getVerificationInProgress = (verifications) => {
|
|
191
|
-
return verifications.
|
|
202
|
+
return verifications.filter((verification) => {
|
|
192
203
|
let isInProgress = verificationStatusInProgress.includes(verification.Status);
|
|
193
204
|
if (!isInProgress) {
|
|
194
205
|
return false;
|
|
195
206
|
}
|
|
196
|
-
return verification.Flags && verification.Flags.DeferredUrlKey || isManualDocRequested(verification)
|
|
207
|
+
return verification.Flags && verification.Flags.DeferredUrlKey || isManualDocRequested(verification) || isShuftiPro(verification)
|
|
197
208
|
})
|
|
198
209
|
}
|
|
199
210
|
|
|
@@ -203,6 +214,10 @@
|
|
|
203
214
|
return isManual && hasRequestedDocs
|
|
204
215
|
}
|
|
205
216
|
|
|
217
|
+
const isShuftiPro = (verification) => {
|
|
218
|
+
return verification.VendorName === CustomerVerificationVendors.ShuftiPro && verification.Status === CustomerVerificationStatus.Referred
|
|
219
|
+
}
|
|
220
|
+
|
|
206
221
|
const getMessages = () => {
|
|
207
222
|
switch (verificationStatus.VerificationSummaryStatus) {
|
|
208
223
|
case CustomerVerificationStatus.InProgress:
|
|
@@ -211,6 +226,8 @@
|
|
|
211
226
|
result.push(getSuccessfulMessageByVendor(vendor));
|
|
212
227
|
});
|
|
213
228
|
return result;
|
|
229
|
+
case CustomerVerificationStatus.Referred:
|
|
230
|
+
return [$_('verification.idenfy.referred-awaiting')];
|
|
214
231
|
case CustomerVerificationStatus.Failed:
|
|
215
232
|
return [$_('verification.message.failed')];
|
|
216
233
|
}
|
|
@@ -255,10 +272,12 @@
|
|
|
255
272
|
|
|
256
273
|
const showAllVerifications = (event, index) => {
|
|
257
274
|
event.stopPropagation()
|
|
258
|
-
if (event.target && (event.target.href || event.target.closest('a'))
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
275
|
+
if (event.target && (event.target.href || event.target.closest('a'))) {
|
|
276
|
+
if (event.target.closest('.verificationLink')) {
|
|
277
|
+
const type = event.target.className.split(' ')[1];
|
|
278
|
+
clickedVerificationsLink.add(type)
|
|
279
|
+
displayMessages = getMessages();
|
|
280
|
+
}
|
|
262
281
|
return;
|
|
263
282
|
}
|
|
264
283
|
if (index === 0) {
|
|
@@ -266,15 +285,21 @@
|
|
|
266
285
|
}
|
|
267
286
|
}
|
|
268
287
|
|
|
288
|
+
const setDevice = () => {
|
|
289
|
+
desktopView = ismobileview === 'false';
|
|
290
|
+
}
|
|
291
|
+
|
|
269
292
|
$: lang && setActiveLanguage();
|
|
270
293
|
$: endpoint && session && getVerifications();
|
|
271
294
|
$: translationurl && setTranslationUrl();
|
|
272
295
|
$: clientstyling && customStylingContainer && setClientStyling();
|
|
273
296
|
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
297
|
+
$: ismobileview && setDevice()
|
|
298
|
+
|
|
274
299
|
</script>
|
|
275
300
|
|
|
276
301
|
|
|
277
|
-
<div class="CashierVerifications"
|
|
302
|
+
<div class="CashierVerifications" class:CashierVerificationsDesktop={desktopView} bind:this={customStylingContainer}>
|
|
278
303
|
{#if displayMessages}
|
|
279
304
|
<div>
|
|
280
305
|
{#each displayMessages as message, index}
|
|
@@ -316,11 +341,14 @@
|
|
|
316
341
|
flex-direction: column;
|
|
317
342
|
box-shadow: 0 0 4px $color-black-transparency-10;
|
|
318
343
|
width: 100%;
|
|
319
|
-
border-radius: $border-radius-medium-plus;
|
|
320
344
|
container-name: method-list;
|
|
321
345
|
container-type: inline-size;
|
|
322
|
-
|
|
323
|
-
|
|
346
|
+
&.CashierVerificationsDesktop {
|
|
347
|
+
border-radius: $border-radius-medium-plus;
|
|
348
|
+
overflow: hidden;
|
|
349
|
+
&:has(.CashierVerificationMessage) {
|
|
350
|
+
margin-bottom: var(--emw--spacing-small, 12px);
|
|
351
|
+
}
|
|
324
352
|
}
|
|
325
353
|
}
|
|
326
354
|
.IconVerification {
|
|
@@ -339,16 +367,11 @@
|
|
|
339
367
|
|
|
340
368
|
&:first-child {
|
|
341
369
|
cursor: pointer;
|
|
342
|
-
border-radius: $border-radius-medium-plus $border-radius-medium-plus 0 0;
|
|
343
370
|
&:hover {
|
|
344
371
|
background: linear-gradient(0, var(--emw--color-gray-50, #F7F8FA) 0%, var(--emw--color-white, #fff) 100%);
|
|
345
372
|
}
|
|
346
373
|
}
|
|
347
374
|
|
|
348
|
-
&:last-child {
|
|
349
|
-
border-radius: 0 0 $border-radius-medium-plus $border-radius-medium-plus;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
375
|
&:not(.ShowAll):not(:first-child) {
|
|
353
376
|
max-height: 0;
|
|
354
377
|
overflow: hidden;
|
|
@@ -369,14 +392,15 @@
|
|
|
369
392
|
}
|
|
370
393
|
|
|
371
394
|
p {
|
|
372
|
-
|
|
373
395
|
color: var(--mmw--color-grey-10, #111);
|
|
374
396
|
font-size: var(--emw--font-size-small, 14px);
|
|
375
397
|
font-family: inherit;
|
|
376
398
|
line-height: calc(var(--emw--size-small, 14px) + 3px);
|
|
377
399
|
margin: var(--emw--spacing-small, 12px);
|
|
378
400
|
}
|
|
379
|
-
|
|
401
|
+
.text {
|
|
402
|
+
word-break: break-word;
|
|
403
|
+
}
|
|
380
404
|
.CashierVerificationChevron {
|
|
381
405
|
cursor: pointer;
|
|
382
406
|
margin-left: auto;
|