@tap-payments/auth-jsconnect 1.0.68 → 1.0.69

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.
@@ -80,9 +80,9 @@ export interface SalesChannel {
80
80
  title: string;
81
81
  }
82
82
  export interface SourceOfIncome {
83
- id: number;
84
- titleAr: string;
85
- title: string;
83
+ id: string;
84
+ name_ar: string;
85
+ name_en: string;
86
86
  }
87
87
  export interface AppInfo {
88
88
  name: string;
@@ -3,5 +3,6 @@ declare const dataService: {
3
3
  getCustomerBases: () => Promise<import("axios").AxiosResponse<any, any>>;
4
4
  getExpectedSales: () => Promise<import("axios").AxiosResponse<any, any>>;
5
5
  getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
6
+ getSourceOfIncome: () => Promise<import("axios").AxiosResponse<any, any>>;
6
7
  };
7
8
  export { dataService };
package/build/api/data.js CHANGED
@@ -12,10 +12,14 @@ var getExpectedSales = function () {
12
12
  var getExpectedCustomerSales = function () {
13
13
  return instance.get("".concat(ENDPOINT_PATHS.EXPECTED_CUSTOMERS));
14
14
  };
15
+ var getSourceOfIncome = function () {
16
+ return instance.get("".concat(ENDPOINT_PATHS.SOURCE_INCOME));
17
+ };
15
18
  var dataService = {
16
19
  getChannelsOfServices: getChannelsOfServices,
17
20
  getCustomerBases: getCustomerBases,
18
21
  getExpectedSales: getExpectedSales,
19
- getExpectedCustomerSales: getExpectedCustomerSales
22
+ getExpectedCustomerSales: getExpectedCustomerSales,
23
+ getSourceOfIncome: getSourceOfIncome
20
24
  };
21
25
  export { dataService };
@@ -50,6 +50,7 @@ declare const API: {
50
50
  getCustomerBases: () => Promise<import("axios").AxiosResponse<any, any>>;
51
51
  getExpectedSales: () => Promise<import("axios").AxiosResponse<any, any>>;
52
52
  getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
53
+ getSourceOfIncome: () => Promise<import("axios").AxiosResponse<any, any>>;
53
54
  };
54
55
  };
55
56
  export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody };
@@ -18,6 +18,7 @@ export declare const ENDPOINT_PATHS: {
18
18
  CUSTOMER_BASES: string;
19
19
  SALES: string;
20
20
  EXPECTED_CUSTOMERS: string;
21
+ SOURCE_INCOME: string;
21
22
  BANK: string;
22
23
  IBAN_BANK: string;
23
24
  };
@@ -18,6 +18,7 @@ var CHANNEL_PATH = '/channel';
18
18
  var CUSTOMER_BASES_PATH = '/customerBases';
19
19
  var SALES_PATH = '/sales';
20
20
  var EXPECTED_CUSTOMERS_PATH = '/expectedCustomers';
21
+ var SOURCE_INCOME_PATH = '/v2/sourceOfIncome';
21
22
  var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/sandbox/local.json';
22
23
  export var ENDPOINT_PATHS = {
23
24
  BASE_URL: API_BASE_URL,
@@ -39,6 +40,7 @@ export var ENDPOINT_PATHS = {
39
40
  CUSTOMER_BASES: CUSTOMER_BASES_PATH,
40
41
  SALES: SALES_PATH,
41
42
  EXPECTED_CUSTOMERS: EXPECTED_CUSTOMERS_PATH,
43
+ SOURCE_INCOME: SOURCE_INCOME_PATH,
42
44
  BANK: BANK_PATH,
43
45
  IBAN_BANK: IBAN_PATH
44
46
  };
@@ -42,15 +42,21 @@ export declare const ICONS_NAMES: {
42
42
  Apple_Filled_ICON: string;
43
43
  apple_white_icon: string;
44
44
  tax_filled_icon: string;
45
+ tax_green_icon: string;
45
46
  tax_white_icon: string;
46
47
  bank_filled_icon: string;
48
+ bank_green_icon: string;
47
49
  bank_white_icon: string;
48
50
  individual_filled_icon: string;
51
+ individual_green_icon: string;
49
52
  individual_white_icon: string;
50
53
  password_filled_icon: string;
54
+ password_green_icon: string;
51
55
  password_white_icon: string;
52
56
  business_filled_icon: string;
57
+ business_green_icon: string;
53
58
  business_white_icon: string;
54
59
  Arrow_filled_right_icon: string;
60
+ Arrow_green_right_icon: string;
55
61
  Arrow_white_right_icon: string;
56
62
  };
@@ -41,16 +41,22 @@ export var ICONS_NAMES = {
41
41
  outlook_White_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-white.svg',
42
42
  Apple_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Apple-filled.svg',
43
43
  apple_white_icon: 'https://dash.b-cdn.net/icons/menu/Apple-white.svg',
44
- tax_filled_icon: 'https://dash.b-cdn.net/icons/menu/tax-filled.svg',
44
+ tax_filled_icon: 'https://dash.b-cdn.net/icons/menu/tax-filled-blue.svg',
45
+ tax_green_icon: 'https://dash.b-cdn.net/icons/menu/tax-filled-green.svg',
45
46
  tax_white_icon: 'https://dash.b-cdn.net/icons/menu/tax-white.svg',
46
- bank_filled_icon: 'https://dash.b-cdn.net/icons/menu/bank-filled.svg',
47
+ bank_filled_icon: 'https://dash.b-cdn.net/icons/menu/bank-filled-blue.svg',
48
+ bank_green_icon: 'https://dash.b-cdn.net/icons/menu/bank-filled-green.svg',
47
49
  bank_white_icon: 'https://dash.b-cdn.net/icons/menu/bank-white.svg',
48
- individual_filled_icon: 'https://dash.b-cdn.net/icons/menu/user-filled.svg',
50
+ individual_filled_icon: 'https://dash.b-cdn.net/icons/menu/user-filled-blue.svg',
51
+ individual_green_icon: 'https://dash.b-cdn.net/icons/menu/user-filled-green.svg',
49
52
  individual_white_icon: 'https://dash.b-cdn.net/icons/menu/user-white.svg',
50
- password_filled_icon: 'https://dash.b-cdn.net/icons/menu/password-filled.svg',
53
+ password_filled_icon: 'https://dash.b-cdn.net/icons/menu/password-filled-blue.svg',
54
+ password_green_icon: 'https://dash.b-cdn.net/icons/menu/password-filled-green.svg',
51
55
  password_white_icon: 'https://dash.b-cdn.net/icons/menu/password-white.svg',
52
- business_filled_icon: 'https://dash.b-cdn.net/icons/menu/business-filled.svg',
56
+ business_filled_icon: 'https://dash.b-cdn.net/icons/menu/business-filled-blue.svg',
57
+ business_green_icon: 'https://dash.b-cdn.net/icons/menu/business-filled-green.svg',
53
58
  business_white_icon: 'https://dash.b-cdn.net/icons/menu/business-white.svg',
54
- Arrow_filled_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-filled.svg',
59
+ Arrow_filled_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-filled-blue.svg',
60
+ Arrow_green_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-filled-green.svg',
55
61
  Arrow_white_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-white.svg'
56
62
  };
@@ -314,7 +314,7 @@ export declare const SALES_CHANNELS: {
314
314
  titleAr: string;
315
315
  }[];
316
316
  export declare const SOURCE_OF_INCOME: {
317
- id: number;
317
+ id: string;
318
318
  titleAr: string;
319
319
  title: string;
320
320
  }[];
@@ -6400,12 +6400,12 @@ export var SALES_CHANNELS = [
6400
6400
  { id: 5, title: 'Call Center', titleAr: 'مركز اتصال' }
6401
6401
  ];
6402
6402
  export var SOURCE_OF_INCOME = [
6403
- { id: 1, titleAr: 'راتب', title: 'Salary' },
6404
- { id: 2, titleAr: 'تمويل', title: 'Investment' },
6405
- { id: 3, titleAr: 'ورث', title: 'Inheritance / inherit' },
6406
- { id: 4, titleAr: 'اسهم', title: 'Stocks' },
6407
- { id: 5, titleAr: 'تجارة', title: 'Trading' },
6408
- { id: 6, titleAr: 'غير ذلك', title: 'Other' }
6403
+ { id: '1', titleAr: 'راتب', title: 'Salary' },
6404
+ { id: '2', titleAr: 'تمويل', title: 'Investment' },
6405
+ { id: '3', titleAr: 'ورث', title: 'Inheritance / inherit' },
6406
+ { id: '4', titleAr: 'اسهم', title: 'Stocks' },
6407
+ { id: '5', titleAr: 'تجارة', title: 'Trading' },
6408
+ { id: '6', titleAr: 'غير ذلك', title: 'Other' }
6409
6409
  ];
6410
6410
  export var BRAND_LIST = [
6411
6411
  {
@@ -265,7 +265,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
265
265
  switch (_m.label) {
266
266
  case 0:
267
267
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
268
- instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.twitter) : '';
268
+ instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.instagram) : '';
269
269
  twitter = !!((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) ? "".concat(TWITTER_URL, "/").concat((_f = params.links) === null || _f === void 0 ? void 0 : _f.twitter) : '';
270
270
  _b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
271
271
  isAbsher = otpData.isAbsher;
@@ -5,6 +5,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  leadData: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
+ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
8
9
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
10
  data: any;
10
11
  formData: {
@@ -76,6 +76,17 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
76
76
  }
77
77
  });
78
78
  }); });
79
+ export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
80
+ var sourceIncome;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0: return [4, API.dataService.getSourceOfIncome()];
84
+ case 1:
85
+ sourceIncome = (_a.sent()).data;
86
+ return [2, sourceIncome];
87
+ }
88
+ });
89
+ }); });
79
90
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
91
  var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
81
92
  var _b, _c, _d, _e;
@@ -94,18 +105,19 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
94
105
  return [4, API.leadService.verifyLeadOTP(payload)];
95
106
  case 1:
96
107
  data = (_f.sent()).data;
97
- if (!data.errors) {
98
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
99
- steps = (_e = individual.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.steps;
100
- hasIndividualCompleted = Object.keys(steps).find(function (key) { return key === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS; });
101
- if (hasIndividualCompleted) {
102
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_STEP'));
103
- }
104
- else {
105
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
106
- }
107
- }
108
- return [2, { data: data, formData: __assign({}, params) }];
108
+ if (!!data.errors) return [3, 4];
109
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
110
+ steps = (_e = individual.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.steps;
111
+ hasIndividualCompleted = Object.keys(steps).find(function (key) { return key === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS; });
112
+ if (!hasIndividualCompleted) return [3, 2];
113
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_STEP'));
114
+ return [3, 4];
115
+ case 2: return [4, thunkApi.dispatch(retrieveDataList())];
116
+ case 3:
117
+ _f.sent();
118
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
119
+ _f.label = 4;
120
+ case 4: return [2, { data: data, formData: __assign({}, params) }];
109
121
  }
110
122
  });
111
123
  }); });
@@ -120,10 +132,11 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
120
132
  id: (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
121
133
  employer_name: params.employerName,
122
134
  employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
123
- source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.title],
135
+ source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.id],
124
136
  actual_income: params.monthlyIncome,
125
137
  is_relative_PEP: params.isPEP,
126
138
  is_influencer: params.isInfluencer,
139
+ encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'is_relative_PEP', 'is_influencer'],
127
140
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
128
141
  };
129
142
  return [4, API.entityService.updateEntityInfo(requestBody)];
@@ -239,6 +252,24 @@ export var individualSlice = createSlice({
239
252
  .addCase(verifyLeadOTP.rejected, function (state, action) {
240
253
  state.loading = false;
241
254
  state.error = action.error.message;
255
+ })
256
+ .addCase(retrieveDataList.pending, function (state) {
257
+ state.loading = true;
258
+ state.error = null;
259
+ })
260
+ .addCase(retrieveDataList.fulfilled, function (state, action) {
261
+ state.loading = false;
262
+ state.error = null;
263
+ var sourceIncome = action.payload;
264
+ var data = state.data.individualData.responseBody;
265
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [] });
266
+ var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
267
+ if (!!selectedSourceIncome)
268
+ state.data.individualData.sourceIncome = selectedSourceIncome;
269
+ })
270
+ .addCase(retrieveDataList.rejected, function (state, action) {
271
+ state.loading = false;
272
+ state.error = action.error.message;
242
273
  })
243
274
  .addCase(updateIndividualInfo.pending, function (state) {
244
275
  state.loading = true;
@@ -63,9 +63,9 @@ var SuccessWithFlowButtons = function () {
63
63
  var name = _a.name, url = _a.url, status = _a.status;
64
64
  var type = status === 'initiated' ? 'pending' : 'completed';
65
65
  var title = t("".concat(name, "_flow_").concat(type), { individual_name: username });
66
- var src = "".concat(name, "_filled_icon");
67
- var hoverSrc = "".concat(name, "_white_icon");
68
66
  var isCompleted = status === 'completed' && name !== 'password';
67
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
68
+ var hoverSrc = "".concat(name, "_white_icon");
69
69
  return {
70
70
  title: title,
71
71
  href: url,
@@ -21,13 +21,14 @@ import { getParameterByName, reactElement } from '../../utils';
21
21
  import { FeatureContainer } from '../shared/Containers';
22
22
  import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { individualFeatureScreens } from '../featuresScreens';
24
- import { verifyLeadToken } from '../app/individual/individualStore';
24
+ import { individualSelector, verifyLeadToken } from '../app/individual/individualStore';
25
25
  import CustomFooter from '../shared/Footer';
26
26
  var Individual = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
+ var customLoading = useAppSelector(individualSelector).customLoading;
31
32
  var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
32
33
  useErrorListener();
33
34
  var activeScreen = data.activeScreen;
@@ -41,7 +42,7 @@ var Individual = memo(function (props) {
41
42
  if (!loading)
42
43
  verifyToken();
43
44
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
45
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
45
46
  var Element = _a.element, name = _a.name;
46
47
  var isActive = activeScreen.name === name;
47
48
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -30,7 +30,7 @@ import MonthlyIncome from './MonthlyIncome';
30
30
  import EmployerName from './EmployerName';
31
31
  import EmployerLocation from './EmployerLocation';
32
32
  import SourceOfIncome from './SourceOfIncome';
33
- import { countriesCode, SOURCE_OF_INCOME } from '../../../../constants';
33
+ import { countriesCode } from '../../../../constants';
34
34
  import { useSelector } from 'react-redux';
35
35
  import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
36
36
  var InputsContainerStyled = styled(Box)(function (_a) {
@@ -67,21 +67,21 @@ var AdditionalIndividualInfo = function (_a) {
67
67
  });
68
68
  var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
69
69
  var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
70
- var onSubmit = function (data) {
71
- dispatch(updateIndividualInfo(data));
72
- };
73
- var handleSelectSource = function (country) {
74
- var _a;
75
- if (((_a = country.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary')
70
+ React.useEffect(function () {
71
+ var _a, _b;
72
+ if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name_en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
76
73
  setEmployerFieldsActive(true);
77
74
  else {
78
75
  setEmployerFieldsActive(false);
79
76
  }
77
+ }, [methods.watch('sourceIncome')]);
78
+ var onSubmit = function (data) {
79
+ dispatch(updateIndividualInfo(data));
80
80
  };
81
81
  var onBack = function () {
82
82
  dispatch(handlePrevScreenStep());
83
83
  };
84
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive, list: SOURCE_OF_INCOME, onSelectSource: handleSelectSource }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: countriesCode, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
84
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: countriesCode, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(ButtonStyled, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
85
85
  };
86
86
  export default React.memo(AdditionalIndividualInfo);
87
87
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { SourceOfIncome as SourceOfIncomeType } from '../../../../@types';
3
3
  interface SourceOfIncomeProps {
4
- list: Array<SourceOfIncomeType>;
5
4
  show: boolean;
6
5
  onSelectSource?: (country: SourceOfIncomeType) => void;
7
6
  }
8
- declare const _default: React.MemoExoticComponent<({ list, ...rest }: SourceOfIncomeProps) => JSX.Element>;
7
+ declare const _default: React.MemoExoticComponent<({ ...rest }: SourceOfIncomeProps) => JSX.Element>;
9
8
  export default _default;
@@ -26,6 +26,8 @@ import Box from '@mui/material/Box';
26
26
  import { styled } from '@mui/material/styles';
27
27
  import { useTranslation } from 'react-i18next';
28
28
  import { useController, useFormContext } from 'react-hook-form';
29
+ import { useAppSelector, useLanguage } from '../../../../hooks';
30
+ import { individualSelector } from '../../../app/individual/individualStore';
29
31
  import Text from '../../../../components/Text';
30
32
  import Collapse from '../../../../components/Collapse';
31
33
  import CheckIcon from '@mui/icons-material/Check';
@@ -33,7 +35,6 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
33
35
  import Input from '../../../shared/Input';
34
36
  import ExpandIcon from '../../../../components/ExpandIcon';
35
37
  import SimpleList from '../../../../components/SimpleList';
36
- import { useLanguage } from '../../../../hooks';
37
38
  var Container = styled(Box)(function () { return ({
38
39
  display: 'flex'
39
40
  }); });
@@ -58,30 +59,35 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
58
59
  });
59
60
  });
60
61
  var SourceOfIncome = function (_a) {
61
- var _b;
62
- var list = _a.list, rest = __rest(_a, ["list"]);
63
- var sourceList = React.useState(list)[0];
64
- var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
62
+ var _b, _c;
63
+ var rest = __rest(_a, []);
64
+ var _d = React.useState([]), sourceList = _d[0], setSourceList = _d[1];
65
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
65
66
  var t = useTranslation().t;
66
67
  var isAr = useLanguage().isAr;
68
+ var data = useAppSelector(individualSelector).data;
67
69
  var control = useFormContext().control;
70
+ var sourceIncomeList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.sourceIncomeList) || [];
68
71
  var sourceIncomeControl = useController({ control: control, name: 'sourceIncome' });
72
+ React.useEffect(function () {
73
+ if ((sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.length) > 0) {
74
+ setSourceList(sourceIncomeList);
75
+ }
76
+ }, [sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.sourceIncome]);
69
77
  var onOpenList = function (event) {
70
78
  setAnchorEl(event.currentTarget);
71
79
  };
72
80
  var onCloseList = function () {
73
81
  setAnchorEl(null);
74
82
  };
75
- var onSelectItem = function (country) {
76
- var _a;
83
+ var onSelectItem = function (source) {
77
84
  onCloseList();
78
- (_a = rest.onSelectSource) === null || _a === void 0 ? void 0 : _a.call(rest, country);
79
- sourceIncomeControl.field.onChange(country);
85
+ sourceIncomeControl.field.onChange(source);
80
86
  };
81
87
  var source = sourceIncomeControl.field.value;
82
- var error = (_b = sourceIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
83
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.titleAr : source === null || source === void 0 ? void 0 : source.title) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'nameEn', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
84
- return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.titleAr : item === null || item === void 0 ? void 0 : item.title })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
88
+ var error = (_c = sourceIncomeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
89
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name_ar : source === null || source === void 0 ? void 0 : source.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name_en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
90
+ return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name_ar : item === null || item === void 0 ? void 0 : item.name_en })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
85
91
  } }) }))] })) })));
86
92
  };
87
93
  export default React.memo(SourceOfIncome);
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from '../../../components/Button';
3
+ interface SuccessButtonProps extends ButtonProps {
4
+ isAr: boolean;
5
+ loading?: boolean;
6
+ hideIcon?: boolean;
7
+ }
8
+ export default function SuccessButton({ children, isAr, hideIcon, disabled, ...props }: SuccessButtonProps): JSX.Element;
9
+ export {};
@@ -0,0 +1,71 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import Button from '../../../components/Button';
25
+ import Icon from '../../../components/Icon';
26
+ import { alpha, styled } from '@mui/material/styles';
27
+ import Box from '@mui/material/Box';
28
+ import { ICONS_NAMES } from '../../../constants';
29
+ var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
30
+ var theme = _a.theme, disabled = _a.disabled;
31
+ return (__assign({ width: theme.spacing(3), height: theme.spacing(3), marginInlineStart: theme.spacing(0.75) }, (disabled && {
32
+ opacity: 0.3
33
+ })));
34
+ });
35
+ var ButtonBoxStyled = styled(Box)(function (_a) {
36
+ var theme = _a.theme;
37
+ return ({
38
+ margin: theme.spacing(0, 2.5, 2.5, 2.5)
39
+ });
40
+ });
41
+ var ButtonStyled = styled(Button)(function (_a) {
42
+ var _b;
43
+ var theme = _a.theme;
44
+ return (_b = {
45
+ paddingInlineStart: theme.spacing(0.75),
46
+ textTransform: 'none',
47
+ backgroundColor: theme.palette.common.white,
48
+ border: "1px solid ".concat(theme.palette.primary.main),
49
+ color: theme.palette.primary.main,
50
+ '&:hover': {
51
+ backgroundColor: theme.palette.common.white,
52
+ color: theme.palette.primary.main
53
+ },
54
+ '&:disabled': {
55
+ backgroundColor: theme.palette.common.white,
56
+ color: alpha(theme.palette.primary.main, 0.3)
57
+ }
58
+ },
59
+ _b[theme.breakpoints.down('sm')] = {
60
+ '&:hover': {
61
+ backgroundColor: theme.palette.common.white,
62
+ border: "1px solid ".concat(theme.palette.primary.main),
63
+ color: theme.palette.primary.main
64
+ }
65
+ },
66
+ _b);
67
+ });
68
+ export default function SuccessButton(_a) {
69
+ var children = _a.children, isAr = _a.isAr, hideIcon = _a.hideIcon, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "hideIcon", "disabled"]);
70
+ return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { disabled: disabled, src: ICONS_NAMES.MOBILE_ICON }) }, props, { children: children })) }));
71
+ }
@@ -3,5 +3,6 @@ import AbsherButton from './AbsherButton';
3
3
  import MobileButton from './MobileButton';
4
4
  import EmailProvidersButton from './EmailProvidersButtons';
5
5
  import FlowsButtons from './FlowsButtons';
6
- export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons };
6
+ import SuccessButton from './SuccessButton';
7
+ export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton };
7
8
  export default Button;
@@ -3,5 +3,6 @@ import AbsherButton from './AbsherButton';
3
3
  import MobileButton from './MobileButton';
4
4
  import EmailProvidersButton from './EmailProvidersButtons';
5
5
  import FlowsButtons from './FlowsButtons';
6
- export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons };
6
+ import SuccessButton from './SuccessButton';
7
+ export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton };
7
8
  export default Button;
@@ -16,7 +16,7 @@ import * as React from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import Text from '../../../components/Text';
18
18
  import Container from '../Containers/ScreenContainer';
19
- import { AbsherButton, EmailProvidersButton } from '../../shared/Button';
19
+ import { EmailProvidersButton, SuccessButton } from '../../shared/Button';
20
20
  import Icon from '../../../components/Icon';
21
21
  import { ICONS_NAMES } from '../../../constants';
22
22
  import { useLanguage } from '../../../hooks';
@@ -67,6 +67,6 @@ var ThankYou = function (_a) {
67
67
  var title = _a.title, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle, disabledSuccessButton = _a.disabledSuccessButton;
68
68
  var t = useTranslation().t;
69
69
  var isAr = useLanguage().isAr;
70
- return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ disabled: disabledSuccessButton, hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t(successTitle || 'open_mail_box') })) }))] }));
70
+ return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(SuccessButton, __assign({ disabled: disabledSuccessButton, hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t(successTitle || 'open_mail_box') })) }))] }));
71
71
  };
72
72
  export default React.memo(ThankYou);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",