@tap-payments/auth-jsconnect 1.0.97-test → 1.0.100-test

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 (53) hide show
  1. package/build/api/entity.d.ts +3 -0
  2. package/build/assets/locales/ar.json +3 -1
  3. package/build/assets/locales/en.json +3 -1
  4. package/build/constants/app.js +41 -6
  5. package/build/constants/validation.d.ts +1 -0
  6. package/build/constants/validation.js +1 -0
  7. package/build/features/app/bank/bankStore.js +19 -14
  8. package/build/features/app/business/businessStore.d.ts +1 -1
  9. package/build/features/app/business/businessStore.js +85 -30
  10. package/build/features/app/individual/individualStore.js +27 -19
  11. package/build/features/app/password/passwordStore.js +12 -8
  12. package/build/features/app/tax/taxStore.js +14 -9
  13. package/build/features/bank/Bank.js +2 -3
  14. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  15. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  16. package/build/features/bank/screens/ResetPasswordSuccess/index.d.ts +3 -0
  17. package/build/features/bank/screens/ResetPasswordSuccess/index.js +2 -0
  18. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  19. package/build/features/business/Business.js +2 -3
  20. package/build/features/business/screens/Activities/Activities.js +1 -1
  21. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  22. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  23. package/build/features/business/screens/ResetPasswordSuccess/index.d.ts +3 -0
  24. package/build/features/business/screens/ResetPasswordSuccess/index.js +2 -0
  25. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  26. package/build/features/connect/screens/Merchant/validation.js +4 -2
  27. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  28. package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
  29. package/build/features/connect/screens/NID/IDNumber.js +1 -1
  30. package/build/features/connect/screens/NID/NID.js +1 -1
  31. package/build/features/featuresScreens.js +15 -5
  32. package/build/features/individual/Individual.js +2 -3
  33. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  34. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  35. package/build/features/individual/screens/ResetPasswordSuccess/index.d.ts +3 -0
  36. package/build/features/individual/screens/ResetPasswordSuccess/index.js +2 -0
  37. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  38. package/build/features/password/Password.js +2 -3
  39. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  40. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  41. package/build/features/password/screens/ResetPasswordSuccess/index.d.ts +3 -0
  42. package/build/features/password/screens/ResetPasswordSuccess/index.js +2 -0
  43. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  44. package/build/features/shared/Button/FlowsButtons.js +3 -6
  45. package/build/features/shared/Button/SuccessButton.js +14 -0
  46. package/build/features/tax/Tax.js +2 -3
  47. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  48. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  49. package/build/features/tax/screens/ResetPasswordSuccess/index.d.ts +3 -0
  50. package/build/features/tax/screens/ResetPasswordSuccess/index.js +2 -0
  51. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  52. package/build/utils/string.js +2 -1
  53. package/package.json +1 -1
@@ -10,13 +10,13 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import React, { memo, useEffect, useState } from 'react';
13
+ import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
19
+ import { getResetFlowUrl, showLastFour } from '../../../../utils';
20
20
  import { passwordSelector } from '../../../app/password/passwordStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -47,19 +47,20 @@ var SuccessWithFlowButtons = function () {
47
47
  var _a, _b, _c;
48
48
  var t = useTranslation().t;
49
49
  var isAr = useLanguage().isAr;
50
- var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
51
- var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
52
50
  var data = useAppSelector(passwordSelector).data;
53
- var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
54
- var _g = useState([]), buttons = _g[0], setButtons = _g[1];
51
+ var _d = data.verify.responseBody || {}, flows = _d.flows, nameObj = _d.name, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, identification_id = _d.identification_id;
52
+ var _e = useState([]), buttons = _e[0], setButtons = _e[1];
55
53
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
56
54
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
57
55
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
56
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
57
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
60
58
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
59
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
60
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
61
+ var maskedId = !!identification_id ? " ".concat(t('masking_symbols')).concat(identification_id) : '';
61
62
  var settings = useAppSelector(settingsSelector);
62
- var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
63
+ var _f = data.verify.responseBody || { contact: {}, id: '' }, contact = _f.contact, id = _f.id;
63
64
  var email = (contact || { email: '' }).email;
64
65
  var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
65
66
  var reMapFlowData = function (flows) {
@@ -71,15 +72,13 @@ var SuccessWithFlowButtons = function () {
71
72
  var name = _a.name, url = _a.url, status = _a.status;
72
73
  var type = status === 'initiated' ? 'pending' : 'completed';
73
74
  var title = t("".concat(name, "_flow_").concat(type), {
74
- individual_name: username.toLowerCase(),
75
+ individual_name: username.toLowerCase() + maskedId,
75
76
  business_type: brandName,
76
77
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
77
78
  bank_name: bankName,
78
79
  iban: t('masking_symbols') + iban,
79
80
  tax_id: t('masking_symbols') + showLastFour(taxID)
80
81
  });
81
- if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
82
- setIsAcceptance(true);
83
82
  var isCompleted = status === 'completed' && name !== 'password';
84
83
  var isIndividual = name === 'individual';
85
84
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
@@ -96,9 +95,6 @@ var SuccessWithFlowButtons = function () {
96
95
  };
97
96
  });
98
97
  setButtons(mappedFlows);
99
- var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
100
- if (isAllCompleted)
101
- setIsPayout(true);
102
98
  };
103
99
  useEffect(function () {
104
100
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
@@ -54,7 +54,7 @@ import Link from '@mui/material/Link';
54
54
  import { ICONS_NAMES } from '../../../constants';
55
55
  import CheckIcon from '@mui/icons-material/Check';
56
56
  import { useAppDispatch, useLanguage } from '../../../hooks';
57
- import { handleOpen, handleCurrentActiveScreen } from '../../../app/settings';
57
+ import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
58
58
  import { getScreenNameBasedOnFlow } from '../../../utils';
59
59
  import API from '../../../api';
60
60
  var Image = styled('img')(function (_a) {
@@ -159,11 +159,11 @@ export default function FlowsButtons(_a) {
159
159
  step_name: 'reset_password_auth',
160
160
  encryption_contract: ['user_credentail.email']
161
161
  };
162
+ dispatch(handleNextScreenStep());
162
163
  return [4, API.authService
163
164
  .createAuth(payload)
164
165
  .then(function (response) {
165
166
  var _a;
166
- setLoading(false);
167
167
  var data = response.data;
168
168
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
169
169
  if (description) {
@@ -173,11 +173,8 @@ export default function FlowsButtons(_a) {
173
173
  })
174
174
  .catch(function (error) {
175
175
  alert(error);
176
- setLoading(false);
177
176
  })
178
- .finally(function () {
179
- setLoading(false);
180
- })];
177
+ .finally(function () { })];
181
178
  case 1:
182
179
  _a.sent();
183
180
  return [2];
@@ -47,6 +47,20 @@ var ButtonStyled = styled(Button)(function (_a) {
47
47
  easing: theme.transitions.easing.easeInOut,
48
48
  duration: theme.transitions.duration.complex * 2
49
49
  })
50
+ },
51
+ '&.MuiButton-contained': {
52
+ color: theme.palette.common.white,
53
+ backgroundColor: theme.palette.primary.main,
54
+ '&:hover': {
55
+ backgroundColor: theme.palette.primary.main
56
+ },
57
+ '&:active': {
58
+ backgroundColor: theme.palette.primary.main
59
+ },
60
+ ':disabled': {
61
+ backgroundColor: theme.palette.primary.main,
62
+ color: theme.palette.common.white
63
+ }
50
64
  }
51
65
  });
52
66
  });
@@ -36,11 +36,10 @@ var Tax = memo(function (props) {
36
36
  var verifyToken = function () {
37
37
  var token = getParameterByName('token');
38
38
  var lang = getParameterByName('lang');
39
+ if (lang)
40
+ dispatch(handleLanguage(lang));
39
41
  if (!token)
40
42
  throw new Error('Auth token is not found!');
41
- if (!lang)
42
- throw new Error('Language is not found!');
43
- dispatch(handleLanguage(lang));
44
43
  dispatch(verifyLeadToken(token));
45
44
  };
46
45
  useEffect(function () {
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface ResetPasswordSuccessProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: ResetPasswordSuccessProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,9 @@
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
+ var ResetPasswordSuccess = function (_a) {
6
+ var t = useTranslation().t;
7
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
8
+ };
9
+ export default React.memo(ResetPasswordSuccess);
@@ -0,0 +1,3 @@
1
+ import ResetPasswordSuccess, { ResetPasswordSuccessProps } from './ResetPasswordSuccess';
2
+ export type { ResetPasswordSuccessProps };
3
+ export default ResetPasswordSuccess;
@@ -0,0 +1,2 @@
1
+ import ResetPasswordSuccess from './ResetPasswordSuccess';
2
+ export default ResetPasswordSuccess;
@@ -10,13 +10,13 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import React, { memo, useEffect, useState } from 'react';
13
+ import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
19
+ import { getResetFlowUrl, showLastFour } from '../../../../utils';
20
20
  import { taxSelector } from '../../../app/tax/taxStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -47,19 +47,20 @@ var SuccessWithFlowButtons = function () {
47
47
  var _a, _b, _c;
48
48
  var t = useTranslation().t;
49
49
  var isAr = useLanguage().isAr;
50
- var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
51
- var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
52
50
  var data = useAppSelector(taxSelector).data;
53
- var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
54
- var _g = useState([]), buttons = _g[0], setButtons = _g[1];
51
+ var _d = data.verify.responseBody || {}, flows = _d.flows, nameObj = _d.name, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, identification_id = _d.identification_id;
52
+ var _e = useState([]), buttons = _e[0], setButtons = _e[1];
55
53
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
56
54
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
57
55
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
56
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
57
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
60
58
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
59
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
60
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
61
+ var maskedId = !!identification_id ? " ".concat(t('masking_symbols')).concat(identification_id) : '';
61
62
  var settings = useAppSelector(settingsSelector);
62
- var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
63
+ var _f = data.verify.responseBody || { contact: {}, id: '' }, contact = _f.contact, id = _f.id;
63
64
  var email = (contact || { email: '' }).email;
64
65
  var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
65
66
  var reMapFlowData = function (flows) {
@@ -71,15 +72,13 @@ var SuccessWithFlowButtons = function () {
71
72
  var name = _a.name, url = _a.url, status = _a.status;
72
73
  var type = status === 'initiated' ? 'pending' : 'completed';
73
74
  var title = t("".concat(name, "_flow_").concat(type), {
74
- individual_name: username.toLowerCase(),
75
+ individual_name: username.toLowerCase() + maskedId,
75
76
  business_type: brandName,
76
77
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
77
78
  bank_name: bankName,
78
79
  iban: t('masking_symbols') + iban,
79
80
  tax_id: t('masking_symbols') + showLastFour(taxID)
80
81
  });
81
- if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
82
- setIsAcceptance(true);
83
82
  var isCompleted = status === 'completed' && name !== 'password';
84
83
  var isIndividual = name === 'individual';
85
84
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
@@ -96,9 +95,6 @@ var SuccessWithFlowButtons = function () {
96
95
  };
97
96
  });
98
97
  setButtons(mappedFlows);
99
- var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
100
- if (isAllCompleted)
101
- setIsPayout(true);
102
98
  };
103
99
  useEffect(function () {
104
100
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
@@ -75,6 +75,7 @@ export var capitalizeTheFirstLetterOfEachWord = function (words) {
75
75
  };
76
76
  export var getRequestHeaders = function (deviceInfo) {
77
77
  var app = deviceInfo.app, browser = deviceInfo.browser, connection = deviceInfo.connection, device = deviceInfo.device, source = deviceInfo.source;
78
+ console.log('bi:', browser.browser_id);
78
79
  return {
79
80
  al: encryptString(app.language || ''),
80
81
  at: encryptString(source || ''),
@@ -93,7 +94,7 @@ export var getRequestHeaders = function (deviceInfo) {
93
94
  bb: encryptString(''),
94
95
  bv: encryptString(browser.version || ''),
95
96
  bua: encryptString((browser.user_agent || '').substring(0, 80)),
96
- bi: encryptString(browser.browser_id || ''),
97
+ bi: browser.browser_id || '',
97
98
  ci: encryptString(connection.ip || ''),
98
99
  cm: encryptString(connection.mac || ''),
99
100
  l: encryptString((connection.latitude || 0).toString() + '-' + (connection.longitude || 0).toString())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.97-test",
3
+ "version": "1.0.100-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",