@tap-payments/auth-jsconnect 2.0.4 → 2.0.7

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 (78) hide show
  1. package/build/@types/form.d.ts +2 -0
  2. package/build/api/entity.d.ts +8 -0
  3. package/build/api/entity.js +10 -1
  4. package/build/api/index.d.ts +1 -0
  5. package/build/api/lead.d.ts +1 -0
  6. package/build/assets/locales/ar.json +4 -1
  7. package/build/assets/locales/en.json +4 -1
  8. package/build/components/FileInput/DragAndDrop.d.ts +7 -0
  9. package/build/components/FileInput/DragAndDrop.js +39 -0
  10. package/build/components/FileInput/UploadInput.d.ts +7 -0
  11. package/build/components/FileInput/UploadInput.js +38 -0
  12. package/build/components/FileInput/index.d.ts +3 -0
  13. package/build/components/FileInput/index.js +3 -0
  14. package/build/constants/api.d.ts +1 -0
  15. package/build/constants/api.js +3 -1
  16. package/build/constants/app.js +35 -5
  17. package/build/constants/assets.d.ts +1 -0
  18. package/build/constants/assets.js +1 -0
  19. package/build/constants/validation.d.ts +2 -0
  20. package/build/constants/validation.js +2 -0
  21. package/build/features/app/bank/bankStore.d.ts +1 -0
  22. package/build/features/app/bank/bankStore.js +44 -10
  23. package/build/features/app/business/businessStore.js +13 -6
  24. package/build/features/app/connect/connectStore.js +18 -16
  25. package/build/features/app/individual/individualStore.js +12 -11
  26. package/build/features/app/password/passwordStore.d.ts +4 -1
  27. package/build/features/app/password/passwordStore.js +22 -19
  28. package/build/features/app/tax/taxStore.js +2 -2
  29. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  30. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +3 -0
  31. package/build/features/bank/screens/BankDetails/BankStatement.js +38 -0
  32. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  33. package/build/features/bank/screens/BankDetails/validation.js +1 -0
  34. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  35. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  36. package/build/features/bank/screens/ResetPasswordSuccess/index.d.ts +3 -0
  37. package/build/features/bank/screens/ResetPasswordSuccess/index.js +2 -0
  38. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  39. package/build/features/business/screens/Activities/Activities.js +2 -1
  40. package/build/features/business/screens/Activities/LicenseName.d.ts +5 -0
  41. package/build/features/business/screens/Activities/LicenseName.js +30 -0
  42. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  43. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  44. package/build/features/business/screens/ResetPasswordSuccess/index.d.ts +3 -0
  45. package/build/features/business/screens/ResetPasswordSuccess/index.js +2 -0
  46. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  47. package/build/features/connect/screens/Merchant/BrandList.js +1 -5
  48. package/build/features/connect/screens/Merchant/Merchant.js +10 -8
  49. package/build/features/connect/screens/Merchant/validation.js +4 -2
  50. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  51. package/build/features/connect/screens/NID/NID.js +1 -1
  52. package/build/features/featuresScreens.js +15 -5
  53. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  54. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  55. package/build/features/individual/screens/ResetPasswordSuccess/index.d.ts +3 -0
  56. package/build/features/individual/screens/ResetPasswordSuccess/index.js +2 -0
  57. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  58. package/build/features/password/screens/OTP/OTP.js +1 -1
  59. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  60. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  61. package/build/features/password/screens/ResetPasswordSuccess/index.d.ts +3 -0
  62. package/build/features/password/screens/ResetPasswordSuccess/index.js +2 -0
  63. package/build/features/password/screens/Success/Success.js +2 -2
  64. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  65. package/build/features/shared/Button/Button.js +1 -1
  66. package/build/features/shared/Button/FlowsButtons.js +3 -6
  67. package/build/features/shared/Button/SuccessButton.js +14 -0
  68. package/build/features/shared/UploadFile/UploadFile.d.ts +21 -0
  69. package/build/features/shared/UploadFile/UploadFile.js +77 -0
  70. package/build/features/shared/UploadFile/index.d.ts +2 -0
  71. package/build/features/shared/UploadFile/index.js +2 -0
  72. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  73. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  74. package/build/features/tax/screens/ResetPasswordSuccess/index.d.ts +3 -0
  75. package/build/features/tax/screens/ResetPasswordSuccess/index.js +2 -0
  76. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -13
  77. package/build/utils/string.js +2 -1
  78. package/package.json +2 -1
@@ -12,23 +12,28 @@ import BusinessTypePage from './business/screens/BusinessType';
12
12
  import ActivitiesPage from './business/screens/Activities';
13
13
  import SuccessPage from './business/screens/Success';
14
14
  import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButtons';
15
+ import ResetPasswordSuccessPage from './business/screens/ResetPasswordSuccess';
15
16
  import PasswordVerifyPage from './password/screens/Verify';
16
17
  import CreatePasswordPage from './password/screens/CreatePassword';
17
18
  import PasswordOTPPage from './password/screens/OTP';
18
19
  import SuccessPasswordPage from './password/screens/Success';
19
20
  import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
21
+ import PasswordResetPasswordSuccessPage from './password/screens/ResetPasswordSuccess';
20
22
  import IndividualVerifyPage from './individual/screens/Verify';
21
23
  import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
22
24
  import SuccessOwnerPage from './individual/screens/Success';
23
25
  import IndividualSuccessWithFlowPage from './individual/screens/SuccessWithFlowButtons';
26
+ import IndividualResetPasswordSuccessPage from './individual/screens/ResetPasswordSuccess';
24
27
  import BankVerifyPage from './bank/screens/Verify';
25
28
  import BankDetailsPage from './bank/screens/BankDetails';
26
29
  import BankSuccessPage from './bank/screens/Success';
27
30
  import BankSuccessWithFlowPage from './bank/screens/SuccessWithFlowButtons';
31
+ import BankResetPasswordSuccessPage from './bank/screens/ResetPasswordSuccess';
28
32
  import TaxVerifyPage from './tax/screens/Verify';
29
33
  import TaxDetailsPage from './tax/screens/TaxDetails';
30
34
  import TaxSuccessPage from './tax/screens/Success';
31
35
  import TaxSuccessWithFlowPage from './tax/screens/SuccessWithFlowButtons';
36
+ import TaxResetPasswordSuccessPage from './tax/screens/ResetPasswordSuccess';
32
37
  export var connectFeatureScreens = [
33
38
  {
34
39
  name: 'CONNECT_NID_STEP',
@@ -81,7 +86,8 @@ export var businessFeatureScreens = [
81
86
  element: CustomersPage
82
87
  },
83
88
  { name: 'BUSINESS_SUCCESS_STEP', element: SuccessPage },
84
- { name: 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP', element: SuccessWithFlowButtonsPage }
89
+ { name: 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP', element: SuccessWithFlowButtonsPage },
90
+ { name: 'BUSINESS_RESET_PASSWORD_SUCCESS', element: ResetPasswordSuccessPage }
85
91
  ];
86
92
  export var passwordFeatureScreens = [
87
93
  {
@@ -103,7 +109,8 @@ export var passwordFeatureScreens = [
103
109
  {
104
110
  name: 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
105
111
  element: PasswordSuccessWithFlowPage
106
- }
112
+ },
113
+ { name: 'PASSWORD_RESET_PASSWORD_SUCCESS', element: PasswordResetPasswordSuccessPage }
107
114
  ];
108
115
  export var individualFeatureScreens = [
109
116
  {
@@ -121,7 +128,8 @@ export var individualFeatureScreens = [
121
128
  {
122
129
  name: 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
123
130
  element: IndividualSuccessWithFlowPage
124
- }
131
+ },
132
+ { name: 'INDIVIDUAL_RESET_PASSWORD_SUCCESS', element: IndividualResetPasswordSuccessPage }
125
133
  ];
126
134
  export var bankFeatureScreens = [
127
135
  {
@@ -139,7 +147,8 @@ export var bankFeatureScreens = [
139
147
  {
140
148
  name: 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
141
149
  element: BankSuccessWithFlowPage
142
- }
150
+ },
151
+ { name: 'BANK_RESET_PASSWORD_SUCCESS', element: BankResetPasswordSuccessPage }
143
152
  ];
144
153
  export var taxFeatureScreens = [
145
154
  {
@@ -157,5 +166,6 @@ export var taxFeatureScreens = [
157
166
  {
158
167
  name: 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
159
168
  element: TaxSuccessWithFlowPage
160
- }
169
+ },
170
+ { name: 'TAX_RESET_PASSWORD_SUCCESS', element: TaxResetPasswordSuccessPage }
161
171
  ];
@@ -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 { individualSelector } from '../../../app/individual/individualStore';
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(individualSelector).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)
@@ -72,7 +72,7 @@ var OTP = function (_a) {
72
72
  };
73
73
  var disabled = !methods.formState.isValid || !!error;
74
74
  var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.auth_info) === null || _c === void 0 ? void 0 : _c.phone;
75
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('opt_nid_sent_title', { provider: 'ABSHER' }), ' ', !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
75
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
76
76
  };
77
77
  OTP.defaultProps = {};
78
78
  export default React.memo(OTP);
@@ -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;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
5
- import { updateLeadSuccess, passwordSelector, retrieveLead } from '../../../app/password/passwordStore';
5
+ import { updateLeadSuccess, passwordSelector, retrieveLeadPassword } from '../../../app/password/passwordStore';
6
6
  import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  import { PASSWORD_OPERATION_TYPE } from '../../../../constants';
8
8
  var Success = function (_a) {
@@ -12,7 +12,7 @@ var Success = function (_a) {
12
12
  var operationType = data.verify.operationType;
13
13
  var onSuccess = function () {
14
14
  if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
15
- dispatch(retrieveLead());
15
+ dispatch(retrieveLeadPassword());
16
16
  return;
17
17
  }
18
18
  dispatch(updateLeadSuccess());
@@ -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)
@@ -37,7 +37,7 @@ var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop
37
37
  width: theme.spacing(3),
38
38
  height: theme.spacing(3),
39
39
  transform: isAr ? 'scaleX(-1)' : 'scaleX(1)',
40
- marginInlineEnd: theme.spacing(0.5)
40
+ marginInlineEnd: theme.spacing(-0.375)
41
41
  });
42
42
  });
43
43
  var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -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
  });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare const InputContainerStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
+ children?: React.ReactNode;
4
+ component?: React.ElementType<any> | undefined;
5
+ ref?: React.Ref<unknown> | undefined;
6
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
7
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
8
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
9
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "ref" | "children" | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
10
+ interface UploadFileProps {
11
+ label: string;
12
+ required?: boolean;
13
+ dragTitle: string;
14
+ uploadTitle: string;
15
+ error?: string;
16
+ loading?: boolean;
17
+ onFileUploaded: (file: File) => void;
18
+ onReset: () => void;
19
+ }
20
+ declare const UploadFile: ({ label, required, dragTitle, uploadTitle, loading, error, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
21
+ export default UploadFile;
@@ -0,0 +1,77 @@
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
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { styled } from '@mui/material/styles';
15
+ import { ScreenContainer } from '../../shared/Containers';
16
+ import Box from '@mui/material/Box';
17
+ import { InputLabelStyled } from '../../shared/Input/Input';
18
+ import Mandatory from '../../shared/Mandatory';
19
+ import { DragAndDrop, UploadInput } from '../../../components/FileInput';
20
+ import Collapse from '../../../components/Collapse';
21
+ import Warning from '../../../components/Warning';
22
+ import Icon from '../../../components/Icon';
23
+ import { ICONS_NAMES } from '../../../constants';
24
+ import { useTranslation } from 'react-i18next';
25
+ import Loader from '../../../components/Loader';
26
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
27
+ var theme = _a.theme;
28
+ return ({
29
+ marginBlockStart: theme.spacing(0)
30
+ });
31
+ });
32
+ var LabelContainerStyled = styled(Box)(function (_a) {
33
+ var theme = _a.theme;
34
+ return ({
35
+ display: 'flex',
36
+ justifyContent: 'flex-start',
37
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
38
+ });
39
+ });
40
+ var BoxStyled = styled(Box)(function (_a) {
41
+ var theme = _a.theme;
42
+ return (__assign(__assign({ direction: theme.direction }, theme.typography.subtitle2), { color: theme.palette.primary.main, fontWeight: theme.typography.fontWeightBold, background: theme.palette.background.default, padding: theme.spacing(1.5, 2.5, 1.5), width: '85%' }));
43
+ });
44
+ var UploadBoxStyled = styled(Box)(function (_a) {
45
+ var theme = _a.theme;
46
+ return (__assign(__assign({}, theme.typography.caption), { background: theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, padding: theme.spacing(0.75, 1.75, 0), cursor: 'pointer', width: '15%', display: 'flex', justifyContent: 'center' }));
47
+ });
48
+ var IconStyled = styled(Icon)(function (_a) {
49
+ var theme = _a.theme;
50
+ return ({
51
+ marginBlockStart: theme.spacing(0),
52
+ width: theme.spacing(3.5),
53
+ height: theme.spacing(3.5)
54
+ });
55
+ });
56
+ export var InputContainerStyled = styled(Box)(function (_a) {
57
+ var theme = _a.theme;
58
+ return ({
59
+ display: 'flex',
60
+ width: '100%'
61
+ });
62
+ });
63
+ var UploadFile = function (_a) {
64
+ var label = _a.label, required = _a.required, dragTitle = _a.dragTitle, uploadTitle = _a.uploadTitle, loading = _a.loading, error = _a.error, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
65
+ var _b = React.useState(''), fileName = _b[0], setFileName = _b[1];
66
+ var t = useTranslation().t;
67
+ var handleFileChange = function (file) {
68
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
69
+ onFileUploaded === null || onFileUploaded === void 0 ? void 0 : onFileUploaded(file);
70
+ };
71
+ var handleReset = function () {
72
+ setFileName('');
73
+ onReset === null || onReset === void 0 ? void 0 : onReset();
74
+ };
75
+ return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(DragAndDrop, { title: dragTitle, onSuccess: handleFileChange }), _jsx(UploadInput, { title: uploadTitle, onChange: handleFileChange })] }) })), _jsx(Collapse, __assign({ in: !!fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(BoxStyled, { children: loading ? t('loading_bank_statement') : fileName }), _jsxs(UploadBoxStyled, __assign({ onClick: handleReset }, { children: [_jsx(Collapse, __assign({ in: !loading }, { children: _jsx(IconStyled, { src: ICONS_NAMES.DELETE_ICON }) })), _jsx(Collapse, __assign({ in: loading }, { children: _jsx(Loader, { innerColor: 'white', outerColor: 'white', toggleAnimation: true, style: { width: 30, height: 30 }, svgStyle: { width: 30, height: 30 } }) }))] }))] }) })), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: error })) }))] }));
76
+ };
77
+ export default UploadFile;
@@ -0,0 +1,2 @@
1
+ import UploadFile from './UploadFile';
2
+ export default UploadFile;
@@ -0,0 +1,2 @@
1
+ import UploadFile from './UploadFile';
2
+ export default UploadFile;
@@ -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": "2.0.4",
3
+ "version": "2.0.7",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -94,6 +94,7 @@
94
94
  "react-calendar": "~3.7.0",
95
95
  "react-device-detect": "^2.2.2",
96
96
  "react-dom": "^18.2.0",
97
+ "react-dropzone": "^14.2.2",
97
98
  "react-hook-form": "^7.33.1",
98
99
  "react-i18next": "^11.18.1",
99
100
  "react-otp-input": "^2.4.0",