@tap-payments/auth-jsconnect 2.12.9 → 2.12.10-sandbox

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.
Files changed (62) hide show
  1. package/README.md +29 -0
  2. package/build/@types/app.d.ts +3 -0
  3. package/build/@types/app.js +1 -0
  4. package/build/@types/config.d.ts +2 -0
  5. package/build/@types/form.d.ts +1 -0
  6. package/build/api/document.d.ts +1 -1
  7. package/build/app/settings.d.ts +2 -1
  8. package/build/app/settings.js +8 -5
  9. package/build/assets/locales/ar.json +13 -10
  10. package/build/assets/locales/en.json +8 -7
  11. package/build/components/Slide/Slide.d.ts +1 -1
  12. package/build/constants/api.d.ts +1 -3
  13. package/build/constants/api.js +6 -4
  14. package/build/constants/app.d.ts +0 -1
  15. package/build/constants/app.js +0 -1
  16. package/build/features/app/brand/brandStore.js +5 -2
  17. package/build/features/app/connectExpress/connectExpressStore.js +21 -19
  18. package/build/features/app/entity/entityStore.js +56 -35
  19. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +2 -2
  20. package/build/features/bank/screens/BankDetails/BankDetails.js +1 -1
  21. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +2 -2
  22. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
  23. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  24. package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +2 -2
  25. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  26. package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
  27. package/build/features/connectExpress/ConnectExpress.js +6 -5
  28. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +9 -9
  29. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +2 -2
  30. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +5 -4
  31. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  32. package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +2 -2
  33. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +8 -8
  34. package/build/features/connectExpress/screens/NIDMissed/NID.js +5 -6
  35. package/build/features/connectExpress/screens/OTP/OTP.js +7 -8
  36. package/build/features/connectExpress/screens/OTP/OTPInput.js +5 -8
  37. package/build/features/entity/screens/EntityName/EntityDocumentUpload.d.ts +12 -0
  38. package/build/features/entity/screens/EntityName/{LicenseCertificate.js → EntityDocumentUpload.js} +10 -15
  39. package/build/features/entity/screens/EntityName/EntityName.js +10 -4
  40. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -2
  41. package/build/features/entity/screens/EntityName/validation.d.ts +9 -0
  42. package/build/features/entity/screens/EntityName/validation.js +3 -0
  43. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +2 -2
  44. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  45. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -2
  46. package/build/features/shared/Address/CountryList.d.ts +2 -2
  47. package/build/features/shared/Address/InputSelect.d.ts +2 -2
  48. package/build/features/shared/Containers/FeatureContainer.d.ts +1 -1
  49. package/build/features/shared/Containers/ScreenContainer.d.ts +1 -1
  50. package/build/features/shared/Input/Input.d.ts +1 -1
  51. package/build/features/terminal/screens/shared/styles.d.ts +1 -1
  52. package/build/hooks/index.d.ts +1 -0
  53. package/build/hooks/index.js +1 -0
  54. package/build/hooks/useIsEmailAuth.d.ts +1 -0
  55. package/build/hooks/useIsEmailAuth.js +11 -0
  56. package/build/utils/array.d.ts +1 -1
  57. package/build/utils/array.js +3 -2
  58. package/build/utils/common.js +4 -5
  59. package/build/utils/string.d.ts +2 -2
  60. package/build/utils/string.js +12 -1
  61. package/package.json +2 -2
  62. package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +0 -9
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountDown';
17
17
  export * from './useCountry';
18
+ export * from './useIsEmailAuth';
18
19
  export * from './useVerifyToken';
19
20
  export * from './useFormReadOnly';
20
21
  export * from './useDataNoneEditable';
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountDown';
17
17
  export * from './useCountry';
18
+ export * from './useIsEmailAuth';
18
19
  export * from './useVerifyToken';
19
20
  export * from './useFormReadOnly';
20
21
  export * from './useDataNoneEditable';
@@ -0,0 +1 @@
1
+ export declare const useIsEmailAuth: () => boolean;
@@ -0,0 +1,11 @@
1
+ import { useMemo } from 'react';
2
+ import { useAppSelector } from './useAppSelector';
3
+ import { settingsSelector } from '../app/settings';
4
+ import { getFlowStartScreen } from '../utils';
5
+ export var useIsEmailAuth = function () {
6
+ var _a;
7
+ var settingsData = useAppSelector(settingsSelector).data;
8
+ var countryIso2 = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
9
+ var flowStart = settingsData.flowStart;
10
+ return useMemo(function () { return getFlowStartScreen(flowStart, countryIso2) === 'CONNECT_EXPRESS_EMAIL_STEP'; }, [countryIso2, flowStart]);
11
+ };
@@ -62,7 +62,7 @@ export declare const fixBrandList: (items: Array<{
62
62
  }[];
63
63
  export declare const findFirstId: (items: Array<SaleChannel>) => string;
64
64
  export declare const sortActivitiesByName: (items: Array<ActivityParams>, path: string) => ActivityParams[];
65
- export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose: string) => any;
65
+ export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose: string | Array<string>) => any;
66
66
  export declare const getRecentDocumentBasedOnPurpose: (documents: Array<any>, purpose: string) => any;
67
67
  export declare const findInArrayOrSubArray: (items: Array<any>, value: string | number) => null;
68
68
  export declare const groupSectionWithSelectedActivitiesAtBeginning: (sections: Array<ActivitiesIsIc>, selectedActivities: Array<Activity>) => ActivitiesIsIc[];
@@ -191,8 +191,9 @@ export var sortActivitiesByName = function (items, path) {
191
191
  export var getFileDetailsFromDocument = function (documents, purpose) {
192
192
  if ((documents || []).length === 0)
193
193
  return [];
194
+ var purposes = Array.isArray(purpose) ? purpose : [purpose];
194
195
  return documents.reduce(function (acc, document) {
195
- var fileDetails = (document.file_details || []).filter(function (file) { return purpose.includes(file.purpose); });
196
+ var fileDetails = (document.file_details || []).filter(function (file) { return purposes.includes(file.purpose); });
196
197
  return acc.concat(fileDetails.map(function (f) { return (__assign(__assign({}, f), { docId: document.id })); }));
197
198
  }, []);
198
199
  };
@@ -200,7 +201,7 @@ export var getRecentDocumentBasedOnPurpose = function (documents, purpose) {
200
201
  if ((documents || []).length === 0)
201
202
  return [];
202
203
  var filteredByPurpose = documents.filter(function (doc) {
203
- return purpose.includes(doc.type);
204
+ return doc.type === purpose;
204
205
  });
205
206
  if ((filteredByPurpose || []).length > 0) {
206
207
  return filteredByPurpose.sort(function (a, b) { return b.created - a.created; })[0];
@@ -1,7 +1,6 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, REGION_BASE_URLS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
- import { isDisasterRecoveryEnv, isSA } from './string';
5
4
  export var sleep = function (milliseconds) {
6
5
  if (milliseconds === void 0) { milliseconds = 1000; }
7
6
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -15,13 +14,13 @@ export var dangerousMessage = function (message, callBack) {
15
14
  export var setBaseUrl = function (publicKey, region) {
16
15
  if (region === void 0) { region = ''; }
17
16
  var isProd = publicKey.includes('pk_live');
18
- var _a = region.split('-'), country = _a[0], envType = _a[1];
19
17
  if (!isProd) {
20
18
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
21
19
  return;
22
20
  }
23
- if (isSA(country)) {
24
- axiosInstance.defaults.baseURL = isDisasterRecoveryEnv(envType) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA_DR : ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA;
21
+ var regionKey = (region || '').trim().toLowerCase();
22
+ if (Object.prototype.hasOwnProperty.call(REGION_BASE_URLS, regionKey)) {
23
+ axiosInstance.defaults.baseURL = REGION_BASE_URLS[regionKey];
25
24
  }
26
25
  else {
27
26
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
@@ -1,4 +1,4 @@
1
- import { DeviceInfo, License, User } from '../@types';
1
+ import { DeviceInfo, FlowStart, License, User } from '../@types';
2
2
  export declare const maskPhone: (str?: string) => string;
3
3
  export declare const shortenString: (str: string, length: number) => string;
4
4
  export declare const maskID: (str: string) => string;
@@ -49,6 +49,7 @@ export declare const isKW: (flag: string) => boolean;
49
49
  export declare const isSA: (flag: string | undefined) => boolean;
50
50
  export declare const isOtherThanKWOrSA: (flag: string) => boolean;
51
51
  export declare const isQA: (flag: string | undefined) => boolean;
52
+ export declare const getFlowStartScreen: (flowStart: FlowStart | undefined, countryIso2: string | undefined) => string | undefined;
52
53
  export declare const isKWOrSA: (flag: string) => boolean;
53
54
  export declare const isLinkedIn: (flag: string) => boolean;
54
55
  export declare const isTwitter: (flag: string) => boolean;
@@ -80,4 +81,3 @@ export declare const getCurrencyByCountryIso2: (countryCode?: string) => string;
80
81
  export declare const getMobileNumberLen: (initialLen: number, number: string) => number;
81
82
  export declare const getWebsiteLink: (isAr: boolean, countryCode: string, path: string) => string;
82
83
  export declare function formatCode(code: string, chunkSize?: number, delimiter?: string): string;
83
- export declare const isDisasterRecoveryEnv: (type?: string) => boolean;
@@ -229,6 +229,18 @@ export var isQA = function (flag) {
229
229
  return false;
230
230
  return ['qa', 'qat'].includes(flag.toLowerCase());
231
231
  };
232
+ export var getFlowStartScreen = function (flowStart, countryIso2) {
233
+ if (!flowStart || !countryIso2)
234
+ return undefined;
235
+ var value = flowStart[countryIso2.toUpperCase()];
236
+ if (value === 'phone')
237
+ return 'CONNECT_EXPRESS_MOBILE_STEP';
238
+ if (value === 'email' && isQA(countryIso2))
239
+ return 'CONNECT_EXPRESS_EMAIL_STEP';
240
+ if (value === 'id' && isSA(countryIso2))
241
+ return 'CONNECT_EXPRESS_NID_STEP';
242
+ return undefined;
243
+ };
232
244
  export var isKWOrSA = function (flag) {
233
245
  return isKW(flag) || isSA(flag);
234
246
  };
@@ -360,4 +372,3 @@ export function formatCode(code, chunkSize, delimiter) {
360
372
  if (delimiter === void 0) { delimiter = ' - '; }
361
373
  return ((_a = code.match(new RegExp(".{1,".concat(chunkSize, "}"), 'g'))) === null || _a === void 0 ? void 0 : _a.join(delimiter)) || code;
362
374
  }
363
- export var isDisasterRecoveryEnv = function (type) { return type === 'dr'; };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.12.9",
3
+ "version": "2.12.10-sandbox",
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"
24
+ "push": "npm publish --access public --tag sandbox"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { FileDetails } from '../../../../@types';
3
- interface LicenseCertificateProps {
4
- show: boolean;
5
- readOnly?: boolean;
6
- defaultFiles?: Array<FileDetails>;
7
- }
8
- declare const LicenseCertificate: ({ show, readOnly, defaultFiles }: LicenseCertificateProps) => JSX.Element;
9
- export default LicenseCertificate;