@tap-payments/auth-jsconnect 1.0.49 → 1.0.52

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 (49) hide show
  1. package/build/@types/app.d.ts +1 -0
  2. package/build/@types/form.d.ts +6 -1
  3. package/build/app/rootReducer.d.ts +1 -0
  4. package/build/app/rootReducer.js +3 -1
  5. package/build/app/settings.js +1 -1
  6. package/build/app/store.d.ts +2 -0
  7. package/build/assets/locales/ar.json +2 -1
  8. package/build/assets/locales/en.json +3 -2
  9. package/build/components/SimpleList/SimpleList.js +1 -0
  10. package/build/constants/app.d.ts +6 -0
  11. package/build/constants/app.js +14 -8
  12. package/build/constants/dummy.d.ts +2 -0
  13. package/build/constants/dummy.js +12 -6
  14. package/build/features/app/bank/bankStore.d.ts +36 -0
  15. package/build/features/app/bank/bankStore.js +219 -0
  16. package/build/features/app/business/businessStore.js +8 -8
  17. package/build/features/app/connect/connectStore.js +16 -2
  18. package/build/features/bank/Bank.d.ts +2 -1
  19. package/build/features/bank/Bank.js +15 -5
  20. package/build/features/bank/screens/BankDetails/BankDetails.js +1 -2
  21. package/build/features/bank/screens/Verify/OTPInput.d.ts +5 -0
  22. package/build/features/bank/screens/Verify/OTPInput.js +42 -0
  23. package/build/features/bank/screens/Verify/Verify.d.ts +5 -0
  24. package/build/features/bank/screens/Verify/Verify.js +78 -0
  25. package/build/features/bank/screens/Verify/index.d.ts +2 -0
  26. package/build/features/bank/screens/Verify/index.js +2 -0
  27. package/build/features/bank/screens/Verify/validation.d.ts +8 -0
  28. package/build/features/bank/screens/Verify/validation.js +4 -0
  29. package/build/features/business/screens/BusinessType/CRNumber.d.ts +2 -1
  30. package/build/features/business/screens/BusinessType/CRNumber.js +2 -2
  31. package/build/features/business/screens/BusinessType/CompanyLicense.js +2 -1
  32. package/build/features/business/screens/BusinessType/FLNumber.d.ts +2 -1
  33. package/build/features/business/screens/BusinessType/FLNumber.js +2 -2
  34. package/build/features/business/screens/BusinessType/FreelanceLicense.js +2 -1
  35. package/build/features/business/screens/Confirm/Confirm.js +1 -1
  36. package/build/features/connect/screens/Individual/MobileNumber.js +1 -1
  37. package/build/features/connect/screens/Individual/validation.js +1 -1
  38. package/build/features/connect/screens/Merchant/BrandList.d.ts +0 -2
  39. package/build/features/connect/screens/Merchant/BrandList.js +16 -45
  40. package/build/features/connect/screens/Merchant/BrandName.js +1 -1
  41. package/build/features/connect/screens/Merchant/Merchant.js +27 -11
  42. package/build/features/connect/screens/Merchant/SocialMedia.js +26 -3
  43. package/build/features/connect/screens/Merchant/validation.d.ts +4 -4
  44. package/build/features/connect/screens/Merchant/validation.js +9 -7
  45. package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
  46. package/build/features/connect/screens/Mobile/validation.js +1 -1
  47. package/build/features/featuresScreens.js +5 -5
  48. package/build/hooks/useAppDispatch.d.ts +1 -0
  49. package/package.json +1 -1
@@ -159,5 +159,6 @@ export declare type BrandInfo = {
159
159
  ar: string;
160
160
  en: string;
161
161
  };
162
+ website: string;
162
163
  };
163
164
  export {};
@@ -27,7 +27,7 @@ export declare type BrandFormValues = {
27
27
  instagram: string;
28
28
  };
29
29
  termAndConditionChecked: boolean;
30
- brandList?: Array<BrandInfo>;
30
+ selectedBrandItem: BrandInfo;
31
31
  };
32
32
  export declare type BusinessTypeFormValues = {
33
33
  businessType: string;
@@ -51,3 +51,8 @@ export declare type CustomersFormValues = {
51
51
  refundPolicy: boolean;
52
52
  transactionPolicy: boolean;
53
53
  };
54
+ export declare type BankFormValues = {
55
+ iban: string;
56
+ beneficiaryName: string;
57
+ bankName: string;
58
+ };
@@ -2,5 +2,6 @@ declare const rootReducer: {
2
2
  settings: import("redux").Reducer<import("./settings").SettingsState, import("redux").AnyAction>;
3
3
  connect: import("redux").Reducer<import("../features/app/connect/connectStore").ConnectState, import("redux").AnyAction>;
4
4
  business: import("redux").Reducer<import("../features/app/business/businessStore").BusinessState, import("redux").AnyAction>;
5
+ bank: import("redux").Reducer<import("../features/app/bank/bankStore").BankState, import("redux").AnyAction>;
5
6
  };
6
7
  export default rootReducer;
@@ -1,9 +1,11 @@
1
1
  import settings from './settings';
2
2
  import connect from '../features/app/connect/connectStore';
3
3
  import business from '../features/app/business/businessStore';
4
+ import bank from '../features/app/bank/bankStore';
4
5
  var rootReducer = {
5
6
  settings: settings,
6
7
  connect: connect,
7
- business: business
8
+ business: business,
9
+ bank: bank
8
10
  };
9
11
  export default rootReducer;
@@ -154,7 +154,7 @@ export var settingsSlice = createSlice({
154
154
  },
155
155
  handleActiveFlowScreens: function (state, action) {
156
156
  state.data.featureScreensNavigation = action.payload;
157
- state.data.activeScreen = action.payload[3];
157
+ state.data.activeScreen = action.payload[0];
158
158
  },
159
159
  handleSetAppConfig: function (state, action) {
160
160
  var _a = action.payload, appInfo = _a.appInfo, businessCountryCode = _a.businessCountryCode, language = _a.language, onError = _a.onError, onFlowCompleted = _a.onFlowCompleted, publicKey = _a.publicKey;
@@ -3,10 +3,12 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
3
3
  settings: import("./settings").SettingsState;
4
4
  connect: import("../features/app/connect/connectStore").ConnectState;
5
5
  business: import("../features/app/business/businessStore").BusinessState;
6
+ bank: import("../features/app/bank/bankStore").BankState;
6
7
  }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
7
8
  settings: import("./settings").SettingsState;
8
9
  connect: import("../features/app/connect/connectStore").ConnectState;
9
10
  business: import("../features/app/business/businessStore").BusinessState;
11
+ bank: import("../features/app/bank/bankStore").BankState;
10
12
  }, import("redux").AnyAction, undefined>]>>;
11
13
  export declare type AppDispatch = typeof store.dispatch;
12
14
  export declare type RootState = ReturnType<typeof store.getState>;
@@ -213,5 +213,6 @@
213
213
  "open_mail_box": "افتح البريد الإلكتروني",
214
214
  "mobile_button_label": "المتابعة عن طريق رقم الجوال",
215
215
  "select_brand_label": "Brand List",
216
- "choose_brand": "Choose Brand"
216
+ "choose_brand": "Choose Brand",
217
+ "confirm_enter_iban": "الايبان"
217
218
  }
@@ -59,7 +59,7 @@
59
59
  "email_not_valid": "May you please verify the entered email address.",
60
60
  "enter_at_least_one": "May you please enter at least one social media",
61
61
  "enter_bank_name": "Bank name",
62
- "enter_bank_name_placeholder": "- Please select -",
62
+ "enter_bank_name_placeholder": "bank name",
63
63
  "enter_birth_date": "Date of Birth",
64
64
  "enter_brand_name_english_chars_only": "Please write English letters only. with no spaces",
65
65
  "enter_commercial_register_no": "Commercial registration",
@@ -227,5 +227,6 @@
227
227
  "next": "next",
228
228
  "open_mail_box": "Open Mailbox",
229
229
  "select_brand_label": "Brand List",
230
- "choose_brand": "Choose Brand"
230
+ "choose_brand": "Choose Brand",
231
+ "confirm_enter_iban": "IBAN"
231
232
  }
@@ -34,6 +34,7 @@ var ListStyled = styled(List)(function (_a) {
34
34
  return (_b = {
35
35
  overflowY: 'auto',
36
36
  listStyle: 'none',
37
+ display: 'unset',
37
38
  paddingTop: theme.spacing(2.125),
38
39
  height: theme.spacing(40)
39
40
  },
@@ -89,6 +89,12 @@ export declare const BUSINESS_STEP_NAMES: {
89
89
  BUSINESS_CUSTOMERS: string;
90
90
  BUSINESS_SUCCESS: string;
91
91
  };
92
+ export declare const BANK_STEP_NAMES: {
93
+ PHONE_AUTH: string;
94
+ IDENTITY_AUTH: string;
95
+ BANK_INFO: string;
96
+ BANK_SUCCESS: string;
97
+ };
92
98
  export declare const RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
93
99
  export declare const ENCRYPTION_FLAG = "encryption_contract";
94
100
  export declare const BACKEND_ENCRYPTION_FLAG = "backend_encryption_contract";
@@ -36,12 +36,6 @@ export var CONNECT_SCREENS_NAVIGATION = [
36
36
  prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
37
37
  order: 3
38
38
  },
39
- {
40
- name: 'CONNECT_PASSWORD_STEP',
41
- next: 'CONNECT_MERCHANT_INFO_STEP',
42
- prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
43
- order: 3
44
- },
45
39
  {
46
40
  name: 'CONNECT_MERCHANT_INFO_STEP',
47
41
  next: 'CONNECT_THANK_YOU_STEP',
@@ -140,17 +134,23 @@ export var PASSWORD_SCREENS_NAVIGATION = [
140
134
  }
141
135
  ];
142
136
  export var BANK_SCREENS_NAVIGATION = [
137
+ {
138
+ name: 'BANK_VERIFY_STEP',
139
+ next: 'BANK_BANK_DETAILS_STEP',
140
+ prev: '',
141
+ order: 1
142
+ },
143
143
  {
144
144
  name: 'BANK_BANK_DETAILS_STEP',
145
145
  next: 'BANK_DETAILS_SUCCESS_STEP',
146
146
  prev: '',
147
- order: 1
147
+ order: 2
148
148
  },
149
149
  {
150
150
  name: 'BANK_DETAILS_SUCCESS_STEP',
151
151
  next: '',
152
152
  prev: 'BANK_BANK_DETAILS_STEP',
153
- order: 2
153
+ order: 3
154
154
  }
155
155
  ];
156
156
  export var TAX_SCREENS_NAVIGATION = [
@@ -238,6 +238,12 @@ export var BUSINESS_STEP_NAMES = {
238
238
  BUSINESS_CUSTOMERS: 'business_customers',
239
239
  BUSINESS_SUCCESS: 'business_completed'
240
240
  };
241
+ export var BANK_STEP_NAMES = {
242
+ PHONE_AUTH: 'bank_phone_auth',
243
+ IDENTITY_AUTH: 'bank_identity_auth',
244
+ BANK_INFO: 'bank_info',
245
+ BANK_SUCCESS: 'bank_completed'
246
+ };
241
247
  export var RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
242
248
  export var ENCRYPTION_FLAG = 'encryption_contract';
243
249
  export var BACKEND_ENCRYPTION_FLAG = 'backend_encryption_contract';
@@ -13,6 +13,7 @@ export declare const OTHER_BRAND: {
13
13
  ar: string;
14
14
  en: string;
15
15
  };
16
+ website: string;
16
17
  };
17
18
  export declare const defaultCountry: {
18
19
  created: number;
@@ -332,4 +333,5 @@ export declare const BRAND_LIST: {
332
333
  ar: string;
333
334
  en: string;
334
335
  };
336
+ website: string;
335
337
  }[];
@@ -12,7 +12,8 @@ export var OTHER_BRAND = {
12
12
  name: {
13
13
  ar: 'other',
14
14
  en: 'other'
15
- }
15
+ },
16
+ website: 'other.com'
16
17
  };
17
18
  export var defaultCountry = {
18
19
  created: 1577690965000,
@@ -6418,22 +6419,27 @@ export var SOURCE_OF_INCOME = [
6418
6419
  export var BRAND_LIST = [
6419
6420
  {
6420
6421
  id: '477222',
6421
- name: { ar: 'brand test user1', en: 'brand test user1' }
6422
+ name: { ar: 'brand test user1', en: 'brand test user1' },
6423
+ website: 'test1.com'
6422
6424
  },
6423
6425
  {
6424
6426
  id: '477223',
6425
- name: { ar: 'brand test user2', en: 'brand test user2' }
6427
+ name: { ar: 'brand test user2', en: 'brand test user2' },
6428
+ website: 'www.test2.com'
6426
6429
  },
6427
6430
  {
6428
6431
  id: '477224',
6429
- name: { ar: 'brand test user3', en: 'brand test user' }
6432
+ name: { ar: 'brand test user3', en: 'brand test user' },
6433
+ website: 'www.test3.com'
6430
6434
  },
6431
6435
  {
6432
6436
  id: '477225',
6433
- name: { ar: 'brand test user4', en: 'brand test user4' }
6437
+ name: { ar: 'brand test user4', en: 'brand test user4' },
6438
+ website: 'www.test4.com'
6434
6439
  },
6435
6440
  {
6436
6441
  id: '477226',
6437
- name: { ar: 'brand test user5', en: 'brand test user5' }
6442
+ name: { ar: 'brand test user5', en: 'brand test user5' },
6443
+ website: 'www.test5.com'
6438
6444
  }
6439
6445
  ];
@@ -0,0 +1,36 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { BankFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
+ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
+ data: any;
5
+ leadData: any;
6
+ token: string;
7
+ }, string, {}>;
8
+ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ formData: {
11
+ otp: string;
12
+ };
13
+ }, OTPFormValues, {}>;
14
+ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
15
+ response: any;
16
+ formData: void;
17
+ }, void, {}>;
18
+ declare type VerifyData = {
19
+ token: string;
20
+ };
21
+ export interface BankData {
22
+ verify: ResponseData & VerifyData;
23
+ otpData: OTPFormValues & ResponseData;
24
+ bankData: BankFormValues & ResponseData;
25
+ }
26
+ export interface BankState extends SharedState<BankData> {
27
+ }
28
+ export declare const bankSlice: import("@reduxjs/toolkit").Slice<BankState, {
29
+ clearError: (state: BankState) => void;
30
+ stopLoader: (state: BankState) => void;
31
+ resetOTPScreen: (state: BankState) => void;
32
+ }, "bank/store">;
33
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
34
+ declare const _default: import("redux").Reducer<BankState, import("redux").AnyAction>;
35
+ export default _default;
36
+ export declare const bankSelector: (state: RootState) => BankState;
@@ -0,0 +1,219 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var _a;
49
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
+ import API from '../../../api';
51
+ import { removeRequestHeaders } from '../../../utils';
52
+ import { handleNextScreenStep } from '../../../app/settings';
53
+ import { BANK_STEP_NAMES } from '../../../constants';
54
+ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var payload, data, leadResponse;
56
+ return __generator(this, function (_a) {
57
+ switch (_a.label) {
58
+ case 0:
59
+ payload = {
60
+ service_name: 'tap_email',
61
+ verify_token: token
62
+ };
63
+ return [4, API.leadService.verifyLeadToken(payload)];
64
+ case 1:
65
+ data = (_a.sent()).data;
66
+ leadResponse = undefined;
67
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 3];
68
+ return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
69
+ case 2:
70
+ leadResponse = _a.sent();
71
+ if (data.step_name === BANK_STEP_NAMES.IDENTITY_AUTH) {
72
+ thunkApi.dispatch(handleNextScreenStep());
73
+ }
74
+ _a.label = 3;
75
+ case 3: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
76
+ }
77
+ });
78
+ }); });
79
+ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
+ var _a, bank, settings, responseBody, payload, data;
81
+ var _b, _c, _d;
82
+ return __generator(this, function (_e) {
83
+ switch (_e.label) {
84
+ case 0:
85
+ _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
86
+ responseBody = bank.data.verify.responseBody;
87
+ payload = {
88
+ data: params.otp,
89
+ service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
90
+ verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
91
+ step_name: BANK_STEP_NAMES.PHONE_AUTH,
92
+ encryption_contract: ['data']
93
+ };
94
+ return [4, API.leadService.verifyLeadOTP(payload)];
95
+ case 1:
96
+ data = (_e.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
+ thunkApi.dispatch(handleNextScreenStep());
100
+ }
101
+ return [2, { data: data, formData: __assign({}, params) }];
102
+ }
103
+ });
104
+ }); });
105
+ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var _a, settings, bank, payload, data;
107
+ var _b, _c, _d, _e, _f;
108
+ return __generator(this, function (_g) {
109
+ switch (_g.label) {
110
+ case 0:
111
+ _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
112
+ payload = {
113
+ step_name: BANK_STEP_NAMES.BANK_SUCCESS,
114
+ lead_id: ((_b = bank.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
115
+ encryption_contract: []
116
+ };
117
+ return [4, API.leadService.updateLead(payload)];
118
+ case 1:
119
+ data = (_g.sent()).data;
120
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
121
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
122
+ return [2, { response: data, formData: params }];
123
+ }
124
+ });
125
+ }); });
126
+ var initialState = {
127
+ error: null,
128
+ loading: false,
129
+ data: {
130
+ verify: {
131
+ token: ''
132
+ },
133
+ otpData: {
134
+ otp: ''
135
+ },
136
+ bankData: {
137
+ iban: '',
138
+ beneficiaryName: '',
139
+ bankName: ''
140
+ }
141
+ }
142
+ };
143
+ export var bankSlice = createSlice({
144
+ name: 'bank/store',
145
+ initialState: initialState,
146
+ reducers: {
147
+ clearError: function (state) {
148
+ state.error = null;
149
+ },
150
+ stopLoader: function (state) {
151
+ state.loading = false;
152
+ },
153
+ resetOTPScreen: function (state) {
154
+ state.data.otpData.otp = '';
155
+ }
156
+ },
157
+ extraReducers: function (builder) {
158
+ builder
159
+ .addCase(verifyLeadToken.fulfilled, function (state, action) {
160
+ var _a;
161
+ state.error = null;
162
+ var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
163
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
164
+ if (description) {
165
+ state.error = description;
166
+ return;
167
+ }
168
+ state.data.verify.responseBody = __assign(__assign({}, data), leadData);
169
+ state.data.verify.token = token;
170
+ })
171
+ .addCase(verifyLeadToken.rejected, function (state, action) {
172
+ state.error = action.error.message;
173
+ })
174
+ .addCase(verifyLeadOTP.pending, function (state) {
175
+ state.loading = true;
176
+ state.error = null;
177
+ })
178
+ .addCase(verifyLeadOTP.fulfilled, function (state, action) {
179
+ var _a;
180
+ state.loading = false;
181
+ state.error = null;
182
+ var _b = action.payload, data = _b.data, formData = _b.formData;
183
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
184
+ if (description) {
185
+ state.error = description;
186
+ return;
187
+ }
188
+ state.data.otpData = formData;
189
+ state.data.otpData.responseBody = data;
190
+ })
191
+ .addCase(verifyLeadOTP.rejected, function (state, action) {
192
+ state.loading = false;
193
+ state.error = action.error.message;
194
+ })
195
+ .addCase(updateLeadSuccess.fulfilled, function (state, action) {
196
+ var _a;
197
+ state.loading = false;
198
+ state.error = null;
199
+ var response = action.payload.response;
200
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
201
+ if (description) {
202
+ state.error = description;
203
+ return;
204
+ }
205
+ removeRequestHeaders();
206
+ })
207
+ .addCase(updateLeadSuccess.pending, function (state) {
208
+ state.loading = true;
209
+ state.error = null;
210
+ })
211
+ .addCase(updateLeadSuccess.rejected, function (state, action) {
212
+ state.loading = false;
213
+ state.error = action.error.message;
214
+ });
215
+ }
216
+ });
217
+ export var clearError = (_a = bankSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
218
+ export default bankSlice.reducer;
219
+ export var bankSelector = function (state) { return state.bank; };
@@ -511,10 +511,10 @@ export var businessSlice = createSlice({
511
511
  state.error = null;
512
512
  })
513
513
  .addCase(updateLeadBusinessType.fulfilled, function (state, action) {
514
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
514
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
515
515
  state.loading = false;
516
516
  state.error = null;
517
- var _t = action.payload, data = _t.data, formData = _t.formData;
517
+ var _v = action.payload, data = _v.data, formData = _v.formData;
518
518
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
519
519
  if (description) {
520
520
  state.error = description;
@@ -523,20 +523,20 @@ export var businessSlice = createSlice({
523
523
  state.data.businessTypeData = formData;
524
524
  var isAr = i18n.dir() === 'rtl';
525
525
  state.data.businessInfo.brandName = isAr ? (_c = (_b = data === null || data === void 0 ? void 0 : data.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.ar : (_e = (_d = data === null || data === void 0 ? void 0 : data.brand) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.en;
526
- state.data.businessInfo.licenseNumber = (data === null || data === void 0 ? void 0 : data.license_number) || '';
527
- state.data.businessInfo.legalName = isAr ? (_g = (_f = data === null || data === void 0 ? void 0 : data.entity) === null || _f === void 0 ? void 0 : _f.legal_name) === null || _g === void 0 ? void 0 : _g.ar : (_j = (_h = data === null || data === void 0 ? void 0 : data.entity) === null || _h === void 0 ? void 0 : _h.legal_name) === null || _j === void 0 ? void 0 : _j.en;
528
- if (!!((_l = (_k = data === null || data === void 0 ? void 0 : data.entity) === null || _k === void 0 ? void 0 : _k.license) === null || _l === void 0 ? void 0 : _l.issuing_date)) {
529
- state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_o = (_m = data === null || data === void 0 ? void 0 : data.entity) === null || _m === void 0 ? void 0 : _m.license) === null || _o === void 0 ? void 0 : _o.issuing_date).format('YYYY-MM-DD'));
526
+ state.data.businessInfo.licenseNumber = ((_g = (_f = data === null || data === void 0 ? void 0 : data.entity) === null || _f === void 0 ? void 0 : _f.license) === null || _g === void 0 ? void 0 : _g.number) || '';
527
+ state.data.businessInfo.legalName = isAr ? (_j = (_h = data === null || data === void 0 ? void 0 : data.entity) === null || _h === void 0 ? void 0 : _h.legal_name) === null || _j === void 0 ? void 0 : _j.ar : (_l = (_k = data === null || data === void 0 ? void 0 : data.entity) === null || _k === void 0 ? void 0 : _k.legal_name) === null || _l === void 0 ? void 0 : _l.en;
528
+ if (!!((_o = (_m = data === null || data === void 0 ? void 0 : data.entity) === null || _m === void 0 ? void 0 : _m.license) === null || _o === void 0 ? void 0 : _o.issuing_date)) {
529
+ state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_q = (_p = data === null || data === void 0 ? void 0 : data.entity) === null || _p === void 0 ? void 0 : _p.license) === null || _q === void 0 ? void 0 : _q.issuing_date).format('YYYY-MM-DD'));
530
530
  }
531
531
  if (formData.businessType === BusinessType.CR) {
532
- var activities = ((_q = (_p = data === null || data === void 0 ? void 0 : data.license) === null || _p === void 0 ? void 0 : _p.activities) === null || _q === void 0 ? void 0 : _q.isic) || [];
532
+ var activities = ((_s = (_r = data === null || data === void 0 ? void 0 : data.license) === null || _r === void 0 ? void 0 : _r.activities) === null || _s === void 0 ? void 0 : _s.isic) || [];
533
533
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
534
534
  if (!!selectedActivity)
535
535
  state.data.activitiesData.activities = [selectedActivity];
536
536
  state.data.businessTypeData.responseBody = __assign(__assign({}, data), { activities: activities });
537
537
  return;
538
538
  }
539
- var category = (_s = (_r = data === null || data === void 0 ? void 0 : data.license) === null || _r === void 0 ? void 0 : _r.License) === null || _s === void 0 ? void 0 : _s.Category;
539
+ var category = (_u = (_t = data === null || data === void 0 ? void 0 : data.license) === null || _t === void 0 ? void 0 : _t.License) === null || _u === void 0 ? void 0 : _u.Category;
540
540
  if (!!category)
541
541
  state.data.activitiesData.activities = [category];
542
542
  state.data.businessTypeData.responseBody = __assign(__assign({}, data), { activities: !!category ? [category] : [] });
@@ -45,11 +45,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  var _a;
49
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
59
  import { handleNextScreenStep } from '../../../app/settings';
51
60
  import API from '../../../api';
52
- import { BRAND_LIST, CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, TWITTER_URL } from '../../../constants';
61
+ import { BRAND_LIST, CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
53
62
  import { defaultCountry } from '../../../constants';
54
63
  import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
55
64
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
@@ -392,6 +401,10 @@ var initialState = {
392
401
  website: '',
393
402
  twitter: '',
394
403
  instagram: ''
404
+ },
405
+ selectedBrandItem: BRAND_LIST[0],
406
+ responseBody: {
407
+ brands: []
395
408
  }
396
409
  }
397
410
  }
@@ -537,7 +550,8 @@ export var connectSlice = createSlice({
537
550
  var response = action.payload.response;
538
551
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
539
552
  if (!!response && !description) {
540
- state.data.brandData.brandList = BRAND_LIST;
553
+ state.data.brandData.selectedBrandItem = BRAND_LIST[0];
554
+ state.data.brandData.responseBody = { brands: __spreadArray(__spreadArray([], BRAND_LIST, true), [OTHER_BRAND], false) };
541
555
  state.data.otpData.responseBody = response;
542
556
  }
543
557
  })
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- export interface BankLibProps {
2
+ import { LibConfig } from '../../@types';
3
+ export interface BankLibProps extends LibConfig {
3
4
  }
4
5
  export declare function BankLib(props: BankLibProps): JSX.Element;
5
6
  export declare function renderBankLib(config: BankLibProps, elementId: string): void;
@@ -11,26 +11,36 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React, { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector } from '../../hooks';
15
- import { handleActiveFlowScreens, settingsSelector } from '../../app/settings';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
15
+ import { settingsSelector } from '../../app/settings';
16
16
  import AnimationFlow from '../../components/AnimationFlow';
17
17
  import { store } from '../../app/store';
18
18
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
19
  import Collapse from '../../components/Collapse';
20
- import { reactElement } from '../../utils';
20
+ import { getParameterByName, reactElement } from '../../utils';
21
21
  import { FeatureContainer } from '../shared/Containers';
22
22
  import { BANK_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { bankFeatureScreens } from '../featuresScreens';
24
24
  import CustomFooter from '../shared/Footer';
25
+ import { verifyLeadToken } from '../../features/app/business/businessStore';
25
26
  var Bank = memo(function (props) {
26
27
  var open = React.useState(true)[0];
27
28
  var theme = useAppTheme().theme;
28
29
  var dispatch = useAppDispatch();
29
30
  var data = useAppSelector(settingsSelector).data;
31
+ var loading = useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props)).loading;
32
+ useErrorListener();
30
33
  var activeScreen = data.activeScreen;
34
+ var verifyToken = function () {
35
+ var token = getParameterByName('token');
36
+ if (!token)
37
+ throw new Error('Auth token is not found!');
38
+ dispatch(verifyLeadToken(token));
39
+ };
31
40
  useEffect(function () {
32
- dispatch(handleActiveFlowScreens(BANK_SCREENS_NAVIGATION));
33
- }, []);
41
+ if (!loading)
42
+ verifyToken();
43
+ }, [loading]);
34
44
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
35
45
  var Element = _a.element, name = _a.name;
36
46
  var isActive = activeScreen.name === name;
@@ -46,8 +46,7 @@ var BankDetails = function () {
46
46
  },
47
47
  mode: 'onChange'
48
48
  });
49
- var onSubmit = function (data) {
50
- console.log('data', data);
49
+ var onSubmit = function () {
51
50
  dispatch(handleNextScreenStep());
52
51
  };
53
52
  var t = useTranslation().t;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface OTPProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
5
+ export default _default;