@tap-payments/auth-jsconnect 2.12.9-development → 2.12.9-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 (60) hide show
  1. package/build/@types/app.d.ts +2 -0
  2. package/build/@types/app.js +1 -0
  3. package/build/@types/form.d.ts +1 -0
  4. package/build/api/document.d.ts +1 -1
  5. package/build/api/file.d.ts +1 -0
  6. package/build/api/file.js +9 -1
  7. package/build/api/index.d.ts +1 -0
  8. package/build/assets/locales/ar.json +13 -10
  9. package/build/assets/locales/en.json +8 -6
  10. package/build/components/Tooltip/Tooltip.js +1 -1
  11. package/build/constants/app.d.ts +3 -0
  12. package/build/constants/app.js +15 -6
  13. package/build/features/app/connectExpress/connectExpressStore.d.ts +11 -1
  14. package/build/features/app/connectExpress/connectExpressStore.js +199 -18
  15. package/build/features/app/entity/entityStore.js +56 -35
  16. package/build/features/app/individual/individualStore.js +1 -0
  17. package/build/features/app/terminal/terminalStore.d.ts +3 -0
  18. package/build/features/app/terminal/terminalStore.js +34 -1
  19. package/build/features/bank/screens/BankDetails/BankDetails.js +1 -1
  20. package/build/features/connectExpress/ConnectExpress.js +6 -3
  21. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +5 -2
  22. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +10 -5
  23. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +3 -2
  24. package/build/features/connectExpress/screens/Email/Email.d.ts +5 -0
  25. package/build/features/connectExpress/screens/Email/Email.js +57 -0
  26. package/build/features/connectExpress/screens/Email/EmailField.d.ts +8 -0
  27. package/build/features/connectExpress/screens/Email/EmailField.js +52 -0
  28. package/build/features/connectExpress/screens/Email/index.d.ts +3 -0
  29. package/build/features/connectExpress/screens/Email/index.js +2 -0
  30. package/build/features/connectExpress/screens/Email/validation.d.ts +8 -0
  31. package/build/features/connectExpress/screens/Email/validation.js +4 -0
  32. package/build/features/connectExpress/screens/NIDMissed/NID.js +4 -2
  33. package/build/features/connectExpress/screens/OTP/OTP.js +15 -9
  34. package/build/features/connectExpress/screens/OTP/OTPInput.js +10 -4
  35. package/build/features/entity/screens/EntityName/EntityDocumentUpload.d.ts +12 -0
  36. package/build/features/entity/screens/EntityName/{LicenseCertificate.js → EntityDocumentUpload.js} +10 -15
  37. package/build/features/entity/screens/EntityName/EntityName.js +10 -4
  38. package/build/features/entity/screens/EntityName/validation.d.ts +9 -0
  39. package/build/features/entity/screens/EntityName/validation.js +3 -0
  40. package/build/features/featuresScreens.js +5 -0
  41. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +2 -1
  42. package/build/features/terminal/screens/shared/POSDeviceList.js +5 -5
  43. package/build/hooks/index.d.ts +1 -0
  44. package/build/hooks/index.js +1 -0
  45. package/build/hooks/useAppConfig.js +1 -1
  46. package/build/hooks/useCountry.d.ts +1 -0
  47. package/build/hooks/useCountry.js +3 -2
  48. package/build/hooks/useIsEmailAuth.d.ts +1 -0
  49. package/build/hooks/useIsEmailAuth.js +11 -0
  50. package/build/utils/array.d.ts +1 -1
  51. package/build/utils/array.js +3 -2
  52. package/build/utils/common.js +3 -3
  53. package/build/utils/file.d.ts +1 -0
  54. package/build/utils/file.js +6 -0
  55. package/build/utils/index.d.ts +1 -0
  56. package/build/utils/index.js +1 -0
  57. package/build/utils/string.d.ts +2 -0
  58. package/build/utils/string.js +8 -0
  59. package/package.json +2 -2
  60. package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +0 -9
@@ -31,7 +31,7 @@ export var useAppConfig = function (_a) {
31
31
  var data = useAppSelector(settingsSelector).data;
32
32
  var setAppConfig = function () {
33
33
  if (!disableSettingFetching) {
34
- dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true }, features) }, rest)));
34
+ dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true, emailAuth: true }, features) }, rest)));
35
35
  }
36
36
  dispatch(handleActiveFlowScreens(navigation));
37
37
  };
@@ -1,5 +1,6 @@
1
1
  export declare const useCountry: (code: string) => {
2
2
  isKuwait: boolean;
3
3
  isSaudi: boolean;
4
+ isQatar: boolean;
4
5
  isOther: boolean;
5
6
  };
@@ -1,8 +1,9 @@
1
- import { isKW, isSA } from '../utils';
1
+ import { isKW, isSA, isQA } from '../utils';
2
2
  import { useMemo } from 'react';
3
3
  export var useCountry = function (code) {
4
4
  var isKuwait = useMemo(function () { return isKW(code); }, [code]);
5
5
  var isSaudi = useMemo(function () { return isSA(code); }, [code]);
6
+ var isQatar = useMemo(function () { return isQA(code); }, [code]);
6
7
  var isOther = useMemo(function () { return !isKW(code) && !isSA(code); }, [code]);
7
- return { isKuwait: isKuwait, isSaudi: isSaudi, isOther: isOther };
8
+ return { isKuwait: isKuwait, isSaudi: isSaudi, isQatar: isQatar, isOther: isOther };
8
9
  };
@@ -0,0 +1 @@
1
+ export declare const useIsEmailAuth: () => boolean | undefined;
@@ -0,0 +1,11 @@
1
+ import { useMemo } from 'react';
2
+ import { useAppSelector } from './useAppSelector';
3
+ import { settingsSelector } from '../app/settings';
4
+ import { isEmailAuthEnabled } from '../utils';
5
+ export var useIsEmailAuth = function () {
6
+ var _a, _b;
7
+ var settingsData = useAppSelector(settingsSelector).data;
8
+ var emailAuth = (_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth;
9
+ var countryIso2 = (_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
10
+ return useMemo(function () { return isEmailAuthEnabled(emailAuth, countryIso2); }, [emailAuth, countryIso2]);
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,5 +1,5 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
4
  import { isDisasterRecoveryEnv, isSA } from './string';
5
5
  export var sleep = function (milliseconds) {
@@ -17,7 +17,7 @@ export var setBaseUrl = function (publicKey, region) {
17
17
  var isProd = publicKey.includes('pk_live');
18
18
  var _a = region.split('-'), country = _a[0], envType = _a[1];
19
19
  if (!isProd) {
20
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
20
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
21
21
  return;
22
22
  }
23
23
  if (isSA(country)) {
@@ -44,7 +44,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
44
44
  window.history.replaceState({}, '', newUrl);
45
45
  };
46
46
  export var openConnect = function (pk, countryCode) {
47
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
47
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
48
48
  if (countryCode) {
49
49
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
50
50
  }
@@ -0,0 +1 @@
1
+ export declare const createImageObjectURL: (blob: Blob) => string;
@@ -0,0 +1,6 @@
1
+ export var createImageObjectURL = function (blob) {
2
+ var _a;
3
+ if (!(blob === null || blob === void 0 ? void 0 : blob.size) || !((_a = blob === null || blob === void 0 ? void 0 : blob.type) === null || _a === void 0 ? void 0 : _a.startsWith('image/')))
4
+ return '';
5
+ return URL.createObjectURL(blob);
6
+ };
@@ -8,6 +8,7 @@ export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
10
  export * from './common';
11
+ export * from './file';
11
12
  export * from './date';
12
13
  export * from './error';
13
14
  export * from './gtm';
@@ -8,6 +8,7 @@ export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
10
  export * from './common';
11
+ export * from './file';
11
12
  export * from './date';
12
13
  export * from './error';
13
14
  export * from './gtm';
@@ -48,6 +48,8 @@ export declare const getEighteenYearsAgo: () => string;
48
48
  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
+ export declare const isQA: (flag: string | undefined) => boolean;
52
+ export declare const isEmailAuthEnabled: (emailAuth: boolean | undefined, countryIso2: string | undefined) => boolean | undefined;
51
53
  export declare const isKWOrSA: (flag: string) => boolean;
52
54
  export declare const isLinkedIn: (flag: string) => boolean;
53
55
  export declare const isTwitter: (flag: string) => boolean;
@@ -224,6 +224,14 @@ export var isSA = function (flag) {
224
224
  export var isOtherThanKWOrSA = function (flag) {
225
225
  return !isKW(flag) && !isSA(flag);
226
226
  };
227
+ export var isQA = function (flag) {
228
+ if (!flag)
229
+ return false;
230
+ return ['qa', 'qat'].includes(flag.toLowerCase());
231
+ };
232
+ export var isEmailAuthEnabled = function (emailAuth, countryIso2) {
233
+ return emailAuth && isQA(countryIso2);
234
+ };
227
235
  export var isKWOrSA = function (flag) {
228
236
  return isKW(flag) || isSA(flag);
229
237
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.12.9-development",
3
+ "version": "2.12.9-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 --tag development"
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;