@tap-payments/auth-jsconnect 2.9.5-sandbox → 2.9.7-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.
@@ -210,7 +210,7 @@ interface LibCallbacks {
210
210
  onBoardButtonClick?: (data: Record<string, any>) => void;
211
211
  onCreated?: (res: Record<string, any>) => void;
212
212
  onBoardCompleted?: () => void;
213
- onMaturityChanged?: (maturity: 'full' | 'express') => void;
213
+ onMaturityChanged?: (maturity: 'full' | 'express') => Promise<void>;
214
214
  onSwitchToBoard?: (boardId: string, authId: string) => void;
215
215
  }
216
216
  export interface LibConfig extends LibCallbacks {
@@ -119,9 +119,6 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
119
119
  if (typeof (board === null || board === void 0 ? void 0 : board.editable) === 'boolean')
120
120
  thunkApi.dispatch(handelBoardMaturity(board.editable));
121
121
  onVerifyConfigTokenSuccess === null || onVerifyConfigTokenSuccess === void 0 ? void 0 : onVerifyConfigTokenSuccess(config);
122
- if (matureData === 'express' && maturity !== matureData && typeof configInfo.onMaturityChanged === 'function') {
123
- configInfo.onMaturityChanged(matureData);
124
- }
125
122
  }
126
123
  deviceInfo = {
127
124
  app: {
@@ -172,7 +169,12 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
172
169
  operator: operator,
173
170
  locale: locale
174
171
  });
175
- return [2, __assign({ countries: countries, businessCountry: businessCountry, locale: locale, deviceInfo: deviceInfo, ipCountry: ipCountry, isValidOperator: isValidOperator, isMaturityExpress: matureData === 'express' }, (merchant && { merchant: merchant }))];
172
+ if (!(matureData === 'express' && maturity !== matureData && typeof configInfo.onMaturityChanged === 'function')) return [3, 7];
173
+ return [4, configInfo.onMaturityChanged(matureData)];
174
+ case 6:
175
+ _k.sent();
176
+ _k.label = 7;
177
+ case 7: return [2, __assign({ countries: countries, businessCountry: businessCountry, locale: locale, deviceInfo: deviceInfo, ipCountry: ipCountry, isValidOperator: isValidOperator, isMaturityExpress: matureData === 'express' }, (merchant && { merchant: merchant }))];
176
178
  }
177
179
  });
178
180
  }); });
@@ -364,6 +364,7 @@
364
364
  "issue_date": "تاريخ الإصدار",
365
365
  "issued_country_label": "بلد الإصدار",
366
366
  "join_our_community": "",
367
+ "kyc_already_submitted_title": "لقد وافقت مسبقاً على كافة الوثائق",
367
368
  "kyc_dispute_policy": "سياسة المنازعات",
368
369
  "kyc_refund_policy": "سياسة الاسترجاع",
369
370
  "kyc_success_button": "حساب لوحة التحكم",
@@ -377,6 +377,7 @@
377
377
  "issue_date": "Date of issuance",
378
378
  "issued_country_label": "Issued Country",
379
379
  "join_our_community": "",
380
+ "kyc_already_submitted_title": "You already approved all documents",
380
381
  "kyc_dispute_policy": "Dispute Policy",
381
382
  "kyc_refund_policy": "Refund Policy",
382
383
  "kyc_success_button": "Go to my board",
@@ -33,7 +33,7 @@ var StyledTooltip = styled(function (_a) {
33
33
  var _b;
34
34
  var theme = _a.theme;
35
35
  return (_b = {},
36
- _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)), zIndex: 2147483647 }),
36
+ _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) }),
37
37
  _b);
38
38
  });
39
39
  var TextStyled = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -1,6 +1,5 @@
1
1
  import { ScreenStepNavigation, BusinessType } from '../@types';
2
2
  export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company";
3
- export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company";
4
3
  export declare const CONNECT_PROD_URL = "https://connect.tap.company";
5
4
  export declare const CLIENT_ORIGIN: string;
6
5
  export declare const TAP_WEBSITE = "https://www.tap.company/";
@@ -1,7 +1,6 @@
1
1
  import { BusinessType } from '../@types';
2
2
  import { CONNECT_FLOWS } from './flows';
3
3
  export var CONNECT_DEV_URL = 'https://connect.dev.tap.company';
4
- export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company';
5
4
  export var CONNECT_PROD_URL = 'https://connect.tap.company';
6
5
  export var CLIENT_ORIGIN = window.location.origin;
7
6
  export var TAP_WEBSITE = 'https://www.tap.company/';
@@ -399,6 +398,12 @@ export var KYC_SCREENS_NAVIGATION = [
399
398
  prev: '',
400
399
  order: 1
401
400
  },
401
+ {
402
+ name: CONNECT_FLOWS.kyc.alreadySubmitted,
403
+ next: '',
404
+ prev: '',
405
+ order: 1
406
+ },
402
407
  {
403
408
  name: CONNECT_FLOWS.kyc.operatorError,
404
409
  next: '',
@@ -1,5 +1,6 @@
1
1
  export declare enum KYC_FLOWS {
2
2
  loadingData = "KYC_LOADING_DATA_STEP",
3
+ alreadySubmitted = "ALREADY_SUBMITTED",
3
4
  tokenError = "TOKEN_ERROR_STEP",
4
5
  verify = "KYC_VERIFY_STEP",
5
6
  terms = "KYC_TERMS_STEP",
@@ -12,6 +13,7 @@ export declare enum KYC_FLOWS {
12
13
  export declare const CONNECT_FLOWS: {
13
14
  kyc: {
14
15
  loadingData: KYC_FLOWS;
16
+ alreadySubmitted: KYC_FLOWS;
15
17
  tokenError: KYC_FLOWS;
16
18
  verify: KYC_FLOWS;
17
19
  terms: KYC_FLOWS;
@@ -1,6 +1,7 @@
1
1
  export var KYC_FLOWS;
2
2
  (function (KYC_FLOWS) {
3
3
  KYC_FLOWS["loadingData"] = "KYC_LOADING_DATA_STEP";
4
+ KYC_FLOWS["alreadySubmitted"] = "ALREADY_SUBMITTED";
4
5
  KYC_FLOWS["tokenError"] = "TOKEN_ERROR_STEP";
5
6
  KYC_FLOWS["verify"] = "KYC_VERIFY_STEP";
6
7
  KYC_FLOWS["terms"] = "KYC_TERMS_STEP";
@@ -13,6 +14,7 @@ export var KYC_FLOWS;
13
14
  export var CONNECT_FLOWS = {
14
15
  kyc: {
15
16
  loadingData: KYC_FLOWS.loadingData,
17
+ alreadySubmitted: KYC_FLOWS.alreadySubmitted,
16
18
  tokenError: KYC_FLOWS.tokenError,
17
19
  verify: KYC_FLOWS.verify,
18
20
  terms: KYC_FLOWS.terms,
@@ -783,7 +783,7 @@ export var verifyPaciLeadIdentityAsync = createAsyncThunk('connectExpress/verify
783
783
  case 6:
784
784
  count++;
785
785
  return [3, 1];
786
- case 7: throw new Error('nafath_verification_failed');
786
+ case 7: throw new Error('paci_verification_failed');
787
787
  }
788
788
  });
789
789
  }); });
@@ -55,7 +55,7 @@ import { sendCustomEventToGTM, sleep } from '../../../utils';
55
55
  export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a, thunkApi) {
56
56
  var token = _a.token;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, _b, config, country_code, segment_id, boardId, recipient, publicKey, nextScreen, userList, userPayload, users;
58
+ var payload, data, _b, config, country_code, segment_id, boardId, status, publicKey, nextScreen, userList, userPayload, users;
59
59
  return __generator(this, function (_c) {
60
60
  switch (_c.label) {
61
61
  case 0:
@@ -69,9 +69,9 @@ export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a,
69
69
  return [4, API.leadService.verifyToken(payload)];
70
70
  case 1:
71
71
  data = _c.sent();
72
- _b = data || {}, config = _b.config, country_code = _b.country_code, segment_id = _b.segment_id, boardId = _b.id, recipient = _b.recipient;
72
+ _b = data || {}, config = _b.config, country_code = _b.country_code, segment_id = _b.segment_id, boardId = _b.id, status = _b.status;
73
73
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
74
- nextScreen = CONNECT_FLOWS.kyc.terms;
74
+ nextScreen = status === 'completed' ? CONNECT_FLOWS.kyc.alreadySubmitted : CONNECT_FLOWS.kyc.terms;
75
75
  userList = [];
76
76
  if (country_code)
77
77
  thunkApi.dispatch(handleSetCountryByIso2(country_code));
@@ -80,7 +80,7 @@ export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a,
80
80
  userPayload = {
81
81
  page: 1,
82
82
  limit: 25,
83
- is_authorized: recipient.is_authorized,
83
+ is_authorized: true,
84
84
  segment_ids: [segment_id]
85
85
  };
86
86
  return [4, API.userService.getUserListUsingSegmentId(userPayload)];
@@ -141,7 +141,7 @@ var Connect = memo(function (props) {
141
141
  (_a = props.unmount) === null || _a === void 0 ? void 0 : _a.call(props);
142
142
  }, 1100);
143
143
  };
144
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onConfirm: handleDialogClose, animationDirection: animationDirection, onClose: ((_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.closeButton) ? handleDialogClose : undefined, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: false, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: __assign({ tapTextLogo: ((_d = appConfig.features) === null || _d === void 0 ? void 0 : _d.tapTextLogo) && activeScreen.name !== 'CONNECT_BUSINESS_COUNTRY_STEP', poweredBy: false }, appConfig.features) }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: false }, { children: connectFeatureScreens.map(function (_a, index) {
144
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading || data.isMaturityExpress }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onConfirm: handleDialogClose, animationDirection: animationDirection, onClose: ((_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.closeButton) ? handleDialogClose : undefined, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: false, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: __assign({ tapTextLogo: ((_d = appConfig.features) === null || _d === void 0 ? void 0 : _d.tapTextLogo) && activeScreen.name !== 'CONNECT_BUSINESS_COUNTRY_STEP', poweredBy: false }, appConfig.features) }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: false }, { children: connectFeatureScreens.map(function (_a, index) {
145
145
  var Element = _a.element, name = _a.name;
146
146
  var isActive = activeScreen.name === name;
147
147
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -129,6 +129,7 @@ import BoardDataLoadingPage from './board/screens/PrepareDataLoading';
129
129
  import BoardOperatorError from './board/screens/OperatorError';
130
130
  import KycLoadingPage from './kyc/screens/Loading';
131
131
  import KycTokenErrorPage from './kyc/screens/TokenError';
132
+ import KycAlreadySubmittedPage from './kyc/screens/AlreadySubmitted';
132
133
  import KycVerifyNafathPage from './kyc/screens/VerifyNafath';
133
134
  import KycVerifyPaciPage from './kyc/screens/VerifyPaci';
134
135
  import KycOperatorErrorPage from './kyc/screens/OperatorError';
@@ -650,6 +651,10 @@ export var kycFeatureScreens = [
650
651
  name: CONNECT_FLOWS.kyc.tokenError,
651
652
  element: KycTokenErrorPage
652
653
  },
654
+ {
655
+ name: CONNECT_FLOWS.kyc.alreadySubmitted,
656
+ element: KycAlreadySubmittedPage
657
+ },
653
658
  {
654
659
  name: CONNECT_FLOWS.kyc.terms,
655
660
  element: KycTermsPage
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface AlreadySubmittedProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: AlreadySubmittedProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { useAppSelector } from '../../../../hooks';
6
+ import { kycSelector } from '../../../app/kyc/kycStore';
7
+ var AlreadySubmitted = function (_a) {
8
+ var t = useTranslation().t;
9
+ var _b = useAppSelector(kycSelector), error = _b.error, loading = _b.loading, data = _b.data;
10
+ var redirectToBoard = function () {
11
+ var _a, _b;
12
+ var baseUrl = window.location.origin;
13
+ var boardId = ((_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.verifyTokenData) === null || _b === void 0 ? void 0 : _b.boardId) || '';
14
+ var boardUrl = "".concat(baseUrl, "/board?board_id=").concat(boardId);
15
+ window.open(boardUrl, '_self');
16
+ };
17
+ return (_jsx(SuccessScreen, { title: t('kyc_already_submitted_title'), onSuccess: redirectToBoard, successTitle: t('kyc_success_button'), loading: loading, error: error || '' }));
18
+ };
19
+ export default React.memo(AlreadySubmitted);
@@ -0,0 +1,2 @@
1
+ import AlreadySubmitted from './AlreadySubmitted';
2
+ export default AlreadySubmitted;
@@ -0,0 +1,2 @@
1
+ import AlreadySubmitted from './AlreadySubmitted';
2
+ export default AlreadySubmitted;
@@ -1,5 +1,5 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
4
  export var sleep = function (milliseconds) {
5
5
  if (milliseconds === void 0) { milliseconds = 1000; }
@@ -17,7 +17,7 @@ export var setBaseUrl = function (publicKey) {
17
17
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
18
18
  return;
19
19
  }
20
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
20
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
21
21
  };
22
22
  export var updateLocationUrlWithCountry = function (countryIso2) {
23
23
  var country = countryIso2.toLowerCase();
@@ -36,7 +36,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
36
36
  window.history.replaceState({}, '', newUrl);
37
37
  };
38
38
  export var openConnect = function (pk, countryCode) {
39
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
39
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
40
40
  if (countryCode) {
41
41
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.9.5-sandbox",
3
+ "version": "2.9.7-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -21,7 +21,7 @@
21
21
  "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
22
  "tsc:alias": "tsc-alias -p tsconfig.json",
23
23
  "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public --tag sandbox"
24
+ "push": "npm publish --access public --tag development"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {