@tap-payments/auth-jsconnect 2.9.18-development → 2.9.20-development
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/constants/app.d.ts +6 -2
- package/build/constants/app.js +6 -2
- package/build/features/app/board/boardStore.d.ts +5 -1
- package/build/features/app/board/boardStore.js +40 -35
- package/build/features/app/kyc/kycStore.js +2 -2
- package/build/features/board/Board.js +1 -1
- package/build/features/kyc/screens/Success/Success.js +18 -5
- package/build/features/kyc/screens/Terms/Terms.js +4 -4
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +5 -1
- package/package.json +1 -1
package/build/constants/app.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export declare const SCOPE_AUTH = "auth";
|
|
|
12
12
|
export declare const DEFAULT_COUNTRY_ISO2 = "KW";
|
|
13
13
|
export declare const NAFATH_VERIFICATION_FAILED = "nafath_verification_failed";
|
|
14
14
|
export declare const COLLECT_DOB_INFO_NAFATH = "collect_date_of_birth";
|
|
15
|
+
export declare const LANGUAGE_ABBREVIATIONS: {
|
|
16
|
+
ENGLISH: string;
|
|
17
|
+
ARABIC: string;
|
|
18
|
+
};
|
|
15
19
|
export declare const EXTERNAL_LINKS: {
|
|
16
20
|
TOS_EN: string;
|
|
17
21
|
TOS_AR: string;
|
|
@@ -19,8 +23,8 @@ export declare const EXTERNAL_LINKS: {
|
|
|
19
23
|
REFUND_AR: string;
|
|
20
24
|
TRANSACTION_EN: string;
|
|
21
25
|
TRANSACTION_AR: string;
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
PRIVACY_POLICY: string;
|
|
27
|
+
TERMS_CONDITIONS: string;
|
|
24
28
|
};
|
|
25
29
|
export declare const DIALOG_ID = "auth-js-connect-dialog";
|
|
26
30
|
export declare const BACKGROUND_ID = "auth-js-connect-background";
|
package/build/constants/app.js
CHANGED
|
@@ -13,6 +13,10 @@ export var SCOPE_AUTH = 'auth';
|
|
|
13
13
|
export var DEFAULT_COUNTRY_ISO2 = 'KW';
|
|
14
14
|
export var NAFATH_VERIFICATION_FAILED = 'nafath_verification_failed';
|
|
15
15
|
export var COLLECT_DOB_INFO_NAFATH = 'collect_date_of_birth';
|
|
16
|
+
export var LANGUAGE_ABBREVIATIONS = {
|
|
17
|
+
ENGLISH: 'en',
|
|
18
|
+
ARABIC: 'ar'
|
|
19
|
+
};
|
|
16
20
|
export var EXTERNAL_LINKS = {
|
|
17
21
|
TOS_EN: '/en/terms-conditions',
|
|
18
22
|
TOS_AR: '/ar/terms-conditions',
|
|
@@ -20,8 +24,8 @@ export var EXTERNAL_LINKS = {
|
|
|
20
24
|
REFUND_AR: '/ar/terms-conditions',
|
|
21
25
|
TRANSACTION_EN: '/en/terms-conditions',
|
|
22
26
|
TRANSACTION_AR: '/ar/terms-conditions',
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
PRIVACY_POLICY: '/privacy',
|
|
28
|
+
TERMS_CONDITIONS: '/terms-and-conditions'
|
|
25
29
|
};
|
|
26
30
|
export var DIALOG_ID = 'auth-js-connect-dialog';
|
|
27
31
|
export var BACKGROUND_ID = 'auth-js-connect-background';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
|
-
|
|
3
|
+
interface CreateVerifyTokenByProps {
|
|
4
|
+
boardId: string;
|
|
5
|
+
isInternally?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const createVerifyTokenBy: import("@reduxjs/toolkit").AsyncThunk<any, CreateVerifyTokenByProps, {}>;
|
|
4
8
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
9
|
data: any;
|
|
6
10
|
}, void, {}>;
|
|
@@ -52,44 +52,49 @@ import { FlowsTypes } from '../../../@types';
|
|
|
52
52
|
import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BOARD_STEP_STEPS } from '../../../constants';
|
|
54
54
|
import { retrieveIndividualData, sleep } from '../../../utils';
|
|
55
|
-
export var createVerifyTokenBy = createAsyncThunk('board/createVerifyTokenByBoardId', function (
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
export var createVerifyTokenBy = createAsyncThunk('board/createVerifyTokenByBoardId', function (_a, thunkApi) {
|
|
56
|
+
var boardId = _a.boardId, isInternally = _a.isInternally;
|
|
57
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
var settings, isModeContent, payload, data, _b, country_code, config, publicKey, step_name, boardData;
|
|
59
|
+
var _c, _d, _e;
|
|
60
|
+
return __generator(this, function (_f) {
|
|
61
|
+
switch (_f.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
settings = thunkApi.getState().settings;
|
|
64
|
+
isModeContent = settings.data.appConfig.mode === 'content';
|
|
65
|
+
payload = __assign({ service_name: 'tap_email', board_id: boardId }, ((isModeContent || isInternally) && {
|
|
66
|
+
notification: {
|
|
67
|
+
sms: false
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
return [4, API.leadService.createVerifyTokenByBoardId(payload)];
|
|
71
|
+
case 1:
|
|
72
|
+
data = _f.sent();
|
|
73
|
+
_b = data || {}, country_code = _b.country_code, config = _b.config;
|
|
74
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
75
|
+
if (country_code)
|
|
76
|
+
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
77
|
+
if (publicKey)
|
|
78
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
79
|
+
if (isInternally)
|
|
80
|
+
data.step_name = BOARD_STEP_STEPS.BOARD_INFO;
|
|
81
|
+
step_name = data.step_name;
|
|
82
|
+
if (step_name == BOARD_STEP_STEPS.PHONE_AUTH) {
|
|
83
|
+
sleep(0).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('BOARD_VERIFY_STEP')); });
|
|
84
|
+
return [2, __assign(__assign({}, data), { board_id: boardId })];
|
|
66
85
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
75
|
-
if (publicKey)
|
|
76
|
-
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
77
|
-
step_name = data.step_name;
|
|
78
|
-
if (step_name == BOARD_STEP_STEPS.PHONE_AUTH) {
|
|
79
|
-
sleep(0).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('BOARD_VERIFY_STEP')); });
|
|
86
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails({ boardId: data.id, boardInfoId: data.board_info_id })).unwrap()];
|
|
87
|
+
case 2:
|
|
88
|
+
boardData = (_f.sent()).data;
|
|
89
|
+
if (!country_code && ((_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country))
|
|
90
|
+
thunkApi.dispatch(handleSetCountryByIso2(boardData.entity.country));
|
|
91
|
+
(_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, { boardId: data.id, boardInfoId: data.board_info_id });
|
|
92
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('BOARD_SUCCESS_FLOWS_BUTTONS_STEP')); });
|
|
80
93
|
return [2, __assign(__assign({}, data), { board_id: boardId })];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
case 2:
|
|
84
|
-
boardData = (_e.sent()).data;
|
|
85
|
-
if (!country_code && ((_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country))
|
|
86
|
-
thunkApi.dispatch(handleSetCountryByIso2(boardData.entity.country));
|
|
87
|
-
(_d = (_c = settings.data.appConfig).onFlowCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, { boardId: data.id, boardInfoId: data.board_info_id });
|
|
88
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('BOARD_SUCCESS_FLOWS_BUTTONS_STEP')); });
|
|
89
|
-
return [2, __assign(__assign({}, data), { board_id: boardId })];
|
|
90
|
-
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
91
96
|
});
|
|
92
|
-
});
|
|
97
|
+
});
|
|
93
98
|
export var resendOTP = createAsyncThunk('board/resendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
99
|
var board, boardId, payload, data;
|
|
95
100
|
var _a, _b;
|
|
@@ -49,7 +49,7 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import { handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { CONNECT_FLOWS, KYC_STEP_NAMES } from '../../../constants';
|
|
52
|
+
import { CONNECT_FLOWS, KYC_STEP_NAMES, NAFATH_VERIFICATION_FAILED } from '../../../constants';
|
|
53
53
|
import API from '../../../api';
|
|
54
54
|
import { sendCustomEventToGTM, sleep } from '../../../utils';
|
|
55
55
|
export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a, thunkApi) {
|
|
@@ -194,7 +194,7 @@ export var verifyNafath = createAsyncThunk('kyc/verifyNafath', function (params,
|
|
|
194
194
|
case 6:
|
|
195
195
|
count++;
|
|
196
196
|
return [3, 1];
|
|
197
|
-
case 7: throw new Error(
|
|
197
|
+
case 7: throw new Error(NAFATH_VERIFICATION_FAILED);
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
}); });
|
|
@@ -64,7 +64,7 @@ var Board = memo(function (_a) {
|
|
|
64
64
|
dispatch(handleCurrentActiveScreen('BOARD_OPERATOR_ERROR_STEP'));
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
dispatch(createVerifyTokenBy(boardId));
|
|
67
|
+
dispatch(createVerifyTokenBy({ boardId: boardId, isInternally: disableSettingFetching }));
|
|
68
68
|
if (props.mode === 'content')
|
|
69
69
|
dispatch(handleCurrentActiveScreen('BOARD_SUCCESS_FLOWS_BUTTONS_STEP'));
|
|
70
70
|
}, [data.isValidOperator, settingLoading]);
|
|
@@ -1,18 +1,31 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import * as React from 'react';
|
|
3
14
|
import { useTranslation } from 'react-i18next';
|
|
4
15
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
|
-
import { useAppSelector } from '../../../../hooks';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
6
17
|
import { kycSelector } from '../../../app/kyc/kycStore';
|
|
18
|
+
import { handleSetAppConfig, settingsSelector } from '../../../../app/settings';
|
|
7
19
|
var Success = function (_a) {
|
|
8
20
|
var t = useTranslation().t;
|
|
21
|
+
var dispatch = useAppDispatch();
|
|
9
22
|
var _b = useAppSelector(kycSelector), error = _b.error, loading = _b.loading, data = _b.data;
|
|
23
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
10
24
|
var redirectToBoard = function () {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
var baseUrl = window.location.origin;
|
|
25
|
+
var _a, _b, _c, _d;
|
|
13
26
|
var boardId = ((_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.verifyTokenData) === null || _b === void 0 ? void 0 : _b.boardId) || '';
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
dispatch(handleSetAppConfig(__assign(__assign({}, settingsData.appConfig), { scope: 'merchant' })));
|
|
28
|
+
(_d = (_c = settingsData.appConfig).onSwitchToBoard) === null || _d === void 0 ? void 0 : _d.call(_c, boardId || '', '');
|
|
16
29
|
};
|
|
17
30
|
return (_jsx(SuccessScreen, { title: t('kyc_success_title'), onSuccess: redirectToBoard, successTitle: t('kyc_success_button'), loading: loading, error: error || '' }));
|
|
18
31
|
};
|
|
@@ -16,8 +16,8 @@ import Box from '@mui/material/Box';
|
|
|
16
16
|
import { Link } from '@mui/material';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { useAppDispatch, useAppSelector, useLanguage, useSanitizedTranslation } from '../../../../hooks';
|
|
19
|
-
import { isSA, maskIDNumber } from '../../../../utils';
|
|
20
|
-
import { CONNECT_FLOWS, EXTERNAL_LINKS
|
|
19
|
+
import { getWebsiteLink, isSA, maskIDNumber } from '../../../../utils';
|
|
20
|
+
import { CONNECT_FLOWS, EXTERNAL_LINKS } from '../../../../constants';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
22
22
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
23
23
|
import { createNafathAuth, createPaciAuth, kycSelector } from '../../../app/kyc/kycStore';
|
|
@@ -60,8 +60,8 @@ export var Terms = function () {
|
|
|
60
60
|
var user = hasOneUserOnly ? (_c = data.responseData) === null || _c === void 0 ? void 0 : _c.userList[0] : undefined;
|
|
61
61
|
var idNumber = user ? maskIDNumber(user.identification.id) : '';
|
|
62
62
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
63
|
-
var termsAndConditionsLink = isAr
|
|
64
|
-
var privacyPolicyLink = isAr
|
|
63
|
+
var termsAndConditionsLink = getWebsiteLink(isAr, countryCode, EXTERNAL_LINKS.TERMS_CONDITIONS);
|
|
64
|
+
var privacyPolicyLink = getWebsiteLink(isAr, countryCode, EXTERNAL_LINKS.PRIVACY_POLICY);
|
|
65
65
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
66
66
|
var onNext = function () {
|
|
67
67
|
if (hasOneUserOnly) {
|
package/build/utils/string.d.ts
CHANGED
|
@@ -77,3 +77,4 @@ export declare const isOtherLicense: (item?: License) => boolean;
|
|
|
77
77
|
export declare const formatNumberAsCurrency: (number: string) => string;
|
|
78
78
|
export declare const getCurrencyByCountryIso2: (countryCode: string) => string;
|
|
79
79
|
export declare const getMobileNumberLen: (initialLen: number, number: string) => number;
|
|
80
|
+
export declare const getWebsiteLink: (isAr: boolean, countryCode: string, path: string) => string;
|
package/build/utils/string.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowsTypes } from '../@types';
|
|
2
2
|
import { concatenateObjectValues, encryptString } from '.';
|
|
3
3
|
import { removeAxiosGlobalHeaders } from '../api';
|
|
4
|
-
import { COUNTRY_TO_CURRENCY, ENDPOINT_PATHS, ICONS_FULL_PATH } from '../constants';
|
|
4
|
+
import { COUNTRY_TO_CURRENCY, ENDPOINT_PATHS, ICONS_FULL_PATH, LANGUAGE_ABBREVIATIONS, TAP_WEBSITE } from '../constants';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
export var maskPhone = function (str) {
|
|
7
7
|
if (str === void 0) { str = ''; }
|
|
@@ -340,3 +340,7 @@ export var getMobileNumberLen = function (initialLen, number) {
|
|
|
340
340
|
var isStartsWith0 = number.startsWith('0');
|
|
341
341
|
return isStartsWith0 ? initialLen + 1 : initialLen;
|
|
342
342
|
};
|
|
343
|
+
export var getWebsiteLink = function (isAr, countryCode, path) {
|
|
344
|
+
var language = isAr ? LANGUAGE_ABBREVIATIONS.ARABIC : LANGUAGE_ABBREVIATIONS.ENGLISH;
|
|
345
|
+
return TAP_WEBSITE + language + '-' + countryCode + path;
|
|
346
|
+
};
|