@tap-payments/auth-jsconnect 2.6.0 → 2.6.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/build/api/lead.d.ts +8 -3
- package/build/features/app/auth/authStore.js +16 -14
- package/build/features/app/connect/connectStore.js +2 -1
- package/build/features/app/connectExpress/connectExpressStore.js +10 -9
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +13 -0
- package/build/utils/object.d.ts +1 -0
- package/build/utils/object.js +3 -0
- package/package.json +1 -1
- package/build/features/auth/screens/NID/DOB.d.ts +0 -6
- package/build/features/auth/screens/NID/DOB.js +0 -47
package/build/api/lead.d.ts
CHANGED
|
@@ -22,6 +22,13 @@ type BrandTitle = {
|
|
|
22
22
|
ar?: string;
|
|
23
23
|
zh?: string;
|
|
24
24
|
};
|
|
25
|
+
type MetaData = {
|
|
26
|
+
utm_source?: string;
|
|
27
|
+
utm_medium?: string;
|
|
28
|
+
utm_campaign?: string;
|
|
29
|
+
utm_term?: string;
|
|
30
|
+
utm_content?: string;
|
|
31
|
+
};
|
|
25
32
|
type BrandContent = {
|
|
26
33
|
tag_line?: BrandTitle;
|
|
27
34
|
about?: BrandTitle;
|
|
@@ -49,9 +56,7 @@ export type UpdateLeadBody = {
|
|
|
49
56
|
business_type?: string;
|
|
50
57
|
country_code?: string;
|
|
51
58
|
brand?: BrandInfo;
|
|
52
|
-
metadata?:
|
|
53
|
-
check: string;
|
|
54
|
-
};
|
|
59
|
+
metadata?: MetaData;
|
|
55
60
|
note?: string;
|
|
56
61
|
source?: {
|
|
57
62
|
business_id?: string;
|
|
@@ -366,16 +366,17 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
|
|
|
366
366
|
});
|
|
367
367
|
}); });
|
|
368
368
|
export var createNafathAuth = createAsyncThunk('auth/createNafathAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
|
-
var settings, requestBody, data;
|
|
370
|
-
var
|
|
371
|
-
return __generator(this, function (
|
|
372
|
-
switch (
|
|
369
|
+
var _a, settings, auth, requestBody, data;
|
|
370
|
+
var _b, _c;
|
|
371
|
+
return __generator(this, function (_d) {
|
|
372
|
+
switch (_d.label) {
|
|
373
373
|
case 0:
|
|
374
|
-
|
|
374
|
+
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
375
375
|
requestBody = {
|
|
376
376
|
country: settings.data.businessCountry.iso2,
|
|
377
377
|
scope: settings.data.appConfig.scope,
|
|
378
378
|
lang: settings.data.language,
|
|
379
|
+
lead_id: auth.data.leadId,
|
|
379
380
|
user_credentail: {
|
|
380
381
|
identification_id: params.nid,
|
|
381
382
|
identification_id_type: IDENTIFICATION_TYPE.NAFATH,
|
|
@@ -388,9 +389,9 @@ export var createNafathAuth = createAsyncThunk('auth/createNafathAuth', function
|
|
|
388
389
|
};
|
|
389
390
|
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
390
391
|
case 1:
|
|
391
|
-
data =
|
|
392
|
+
data = _d.sent();
|
|
392
393
|
thunkApi.dispatch(handleNextScreenStep());
|
|
393
|
-
(
|
|
394
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
|
|
394
395
|
return [2, { response: data, formData: params }];
|
|
395
396
|
}
|
|
396
397
|
});
|
|
@@ -444,17 +445,18 @@ export var verifyNafath = createAsyncThunk('auth/verifyNafath', function (params
|
|
|
444
445
|
});
|
|
445
446
|
}); });
|
|
446
447
|
export var createCivilIdAuth = createAsyncThunk('auth/createCivilAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
447
|
-
var settings, countryCode, requestBody, data;
|
|
448
|
-
var
|
|
449
|
-
return __generator(this, function (
|
|
450
|
-
switch (
|
|
448
|
+
var _a, settings, auth, countryCode, requestBody, data;
|
|
449
|
+
var _b, _c;
|
|
450
|
+
return __generator(this, function (_d) {
|
|
451
|
+
switch (_d.label) {
|
|
451
452
|
case 0:
|
|
452
|
-
|
|
453
|
+
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
453
454
|
countryCode = settings.data.businessCountry.iso2;
|
|
454
455
|
requestBody = {
|
|
455
456
|
country: settings.data.businessCountry.iso2,
|
|
456
457
|
scope: settings.data.appConfig.scope,
|
|
457
458
|
lang: settings.data.language,
|
|
459
|
+
lead_id: auth.data.leadId,
|
|
458
460
|
user_credentail: {
|
|
459
461
|
identification_id: params.civilId,
|
|
460
462
|
country_code: countryCode
|
|
@@ -466,9 +468,9 @@ export var createCivilIdAuth = createAsyncThunk('auth/createCivilAuth', function
|
|
|
466
468
|
};
|
|
467
469
|
return [4, API.authService.createAuth(requestBody)];
|
|
468
470
|
case 1:
|
|
469
|
-
data =
|
|
471
|
+
data = _d.sent();
|
|
470
472
|
thunkApi.dispatch(handleNextScreenStep());
|
|
471
|
-
(
|
|
473
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
472
474
|
return [2, { response: data, formData: params }];
|
|
473
475
|
}
|
|
474
476
|
});
|
|
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
|
|
|
71
71
|
import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
|
|
72
72
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
73
73
|
import { AuthForType, FlowsTypes } from '../../../@types';
|
|
74
|
-
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2 } from '../../../utils';
|
|
74
|
+
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData } from '../../../utils';
|
|
75
75
|
export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
76
|
var connect, payload, data;
|
|
77
77
|
return __generator(this, function (_a) {
|
|
@@ -457,6 +457,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
457
457
|
country_code: (_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2,
|
|
458
458
|
name: getIndividualName(params.name),
|
|
459
459
|
contact: __assign({ email: params.email }, (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })),
|
|
460
|
+
metadata: getMetaData(),
|
|
460
461
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
|
|
461
462
|
encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number']
|
|
462
463
|
};
|
|
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@ty
|
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { ADD_NEW_ENTITY, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension } from '../../../utils';
|
|
64
|
+
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData } from '../../../utils';
|
|
65
65
|
export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var connectExpress, payload, data;
|
|
67
67
|
return __generator(this, function (_a) {
|
|
@@ -310,16 +310,17 @@ export var resendMobileAuthOTP = createAsyncThunk('connectExpress/resendMobileAu
|
|
|
310
310
|
});
|
|
311
311
|
}); });
|
|
312
312
|
export var createNafathAuth = createAsyncThunk('connectExpress/createNafathAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
|
-
var settings, requestBody, data;
|
|
314
|
-
var
|
|
315
|
-
return __generator(this, function (
|
|
316
|
-
switch (
|
|
313
|
+
var _a, settings, connectExpress, requestBody, data;
|
|
314
|
+
var _b, _c;
|
|
315
|
+
return __generator(this, function (_d) {
|
|
316
|
+
switch (_d.label) {
|
|
317
317
|
case 0:
|
|
318
|
-
|
|
318
|
+
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
319
319
|
requestBody = {
|
|
320
320
|
country: settings.data.businessCountry.iso2,
|
|
321
321
|
scope: settings.data.appConfig.scope,
|
|
322
322
|
lang: settings.data.language,
|
|
323
|
+
lead_id: connectExpress.data.leadId,
|
|
323
324
|
user_credentail: {
|
|
324
325
|
identification_id: params.nid,
|
|
325
326
|
identification_id_type: IDENTIFICATION_TYPE.NAFATH,
|
|
@@ -332,9 +333,9 @@ export var createNafathAuth = createAsyncThunk('connectExpress/createNafathAuth'
|
|
|
332
333
|
};
|
|
333
334
|
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
334
335
|
case 1:
|
|
335
|
-
data =
|
|
336
|
+
data = _d.sent();
|
|
336
337
|
thunkApi.dispatch(handleNextScreenStep());
|
|
337
|
-
(
|
|
338
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
|
|
338
339
|
return [2, { response: data, formData: __assign(__assign({}, params), { type: IDENTIFICATION_TYPE.NAFATH }) }];
|
|
339
340
|
}
|
|
340
341
|
});
|
|
@@ -976,7 +977,7 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
|
|
|
976
977
|
isContactAvailable = email || mobile;
|
|
977
978
|
payload = __assign(__assign({ id: id || '', country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2, name: getIndividualName(name) }, (isContactAvailable && {
|
|
978
979
|
contact: __assign({ email: email }, (mobile && { phone: { country_code: phoneCountry, number: mobile } }))
|
|
979
|
-
})), { step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number'] });
|
|
980
|
+
})), { metadata: getMetaData(), step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number'] });
|
|
980
981
|
return [4, API.leadService.updateLeadExpress(payload)];
|
|
981
982
|
case 1:
|
|
982
983
|
data = _h.sent();
|
package/build/utils/common.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export declare const dangerousMessage: (message: string, callBack?: Function) =>
|
|
|
3
3
|
export declare const setBaseUrl: (publicKey: string) => void;
|
|
4
4
|
export declare const updateLocationUrlWithCountry: (countryIso2: string) => void;
|
|
5
5
|
export declare const openConnect: (pk: string, countryCode?: string) => void;
|
|
6
|
+
export declare function getMetaData(): Record<string, string> | undefined;
|
package/build/utils/common.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { axiosInstance } from '../api';
|
|
2
2
|
import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
|
|
3
|
+
import { objectHasValues } from './object';
|
|
3
4
|
export var sleep = function (milliseconds) {
|
|
4
5
|
if (milliseconds === void 0) { milliseconds = 1000; }
|
|
5
6
|
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
@@ -41,3 +42,15 @@ export var openConnect = function (pk, countryCode) {
|
|
|
41
42
|
}
|
|
42
43
|
window.open("".concat(newUrl), '_self', '_blank');
|
|
43
44
|
};
|
|
45
|
+
export function getMetaData() {
|
|
46
|
+
var urlObj = new URL(window.location.href);
|
|
47
|
+
var paramsToExtract = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
|
|
48
|
+
var meta_data = {};
|
|
49
|
+
paramsToExtract.forEach(function (param) {
|
|
50
|
+
var value = urlObj.searchParams.get(param);
|
|
51
|
+
if (value !== null && value !== '') {
|
|
52
|
+
meta_data[param] = value;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return objectHasValues(meta_data) ? meta_data : undefined;
|
|
56
|
+
}
|
package/build/utils/object.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare const hasNoneEditableValue: (obj: any, path: string) => boolean;
|
|
|
8
8
|
export declare const hasEditableValue: (obj: any, path: string) => boolean;
|
|
9
9
|
export declare const hasVerifiedValue: (obj: any, path: string) => boolean;
|
|
10
10
|
export declare function deepCopy(obj: any): any;
|
|
11
|
+
export declare function objectHasValues(obj: Record<string, any>): boolean;
|
package/build/utils/object.js
CHANGED
package/package.json
CHANGED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
18
|
-
import { clearError, authSelector } from '../../../app/auth/authStore';
|
|
19
|
-
import Text from '../../../../components/Text';
|
|
20
|
-
import Calender from '../../../shared/Calender';
|
|
21
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
|
-
var theme = _a.theme;
|
|
23
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
24
|
-
});
|
|
25
|
-
var DOB = function (_a) {
|
|
26
|
-
var _b;
|
|
27
|
-
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly;
|
|
28
|
-
var t = useTranslation().t;
|
|
29
|
-
var control = useFormContext().control;
|
|
30
|
-
var dispatch = useAppDispatch();
|
|
31
|
-
var dobControl = useController({ control: control, name: 'dob' });
|
|
32
|
-
var error = useAppSelector(authSelector).error;
|
|
33
|
-
var handleBirthDateChange = function (data) {
|
|
34
|
-
dobControl.field.onChange(data);
|
|
35
|
-
handleClearError();
|
|
36
|
-
};
|
|
37
|
-
var handleClearError = function () {
|
|
38
|
-
if (error)
|
|
39
|
-
dispatch(clearError());
|
|
40
|
-
};
|
|
41
|
-
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
42
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
|
-
var spacing = _a.spacing;
|
|
44
|
-
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
46
|
-
};
|
|
47
|
-
export default DOB;
|