@tap-payments/auth-jsconnect 2.0.7 → 2.0.9

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 (84) hide show
  1. package/build/@types/form.d.ts +4 -0
  2. package/build/@types/redux.d.ts +0 -1
  3. package/build/api/entity.d.ts +4 -3
  4. package/build/api/entity.js +8 -1
  5. package/build/api/index.d.ts +2 -0
  6. package/build/api/individual.d.ts +1 -0
  7. package/build/api/individual.js +9 -2
  8. package/build/app/rootReducer.d.ts +1 -0
  9. package/build/app/rootReducer.js +3 -1
  10. package/build/app/store.d.ts +2 -0
  11. package/build/assets/locales/ar.json +2 -1
  12. package/build/assets/locales/en.json +2 -1
  13. package/build/components/FileInput/DragAndDrop.js +1 -2
  14. package/build/constants/app.d.ts +9 -0
  15. package/build/constants/app.js +36 -0
  16. package/build/constants/validation.d.ts +2 -0
  17. package/build/constants/validation.js +2 -0
  18. package/build/features/app/bank/bankStore.d.ts +1 -1
  19. package/build/features/app/bank/bankStore.js +23 -42
  20. package/build/features/app/business/businessStore.d.ts +5 -3
  21. package/build/features/app/business/businessStore.js +55 -31
  22. package/build/features/app/connect/connectStore.d.ts +2 -1
  23. package/build/features/app/connect/connectStore.js +78 -47
  24. package/build/features/app/individual/individualStore.d.ts +9 -2
  25. package/build/features/app/individual/individualStore.js +80 -41
  26. package/build/features/app/password/passwordStore.d.ts +1 -0
  27. package/build/features/app/password/passwordStore.js +3 -7
  28. package/build/features/app/signIn/signInStore.d.ts +33 -0
  29. package/build/features/app/signIn/signInStore.js +389 -0
  30. package/build/features/app/tax/taxStore.d.ts +1 -0
  31. package/build/features/bank/screens/BankDetails/BankStatement.js +6 -17
  32. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  33. package/build/features/bank/screens/BankDetails/validation.js +11 -1
  34. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  35. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  36. package/build/features/connect/screens/Merchant/Merchant.js +3 -2
  37. package/build/features/connect/screens/Merchant/validation.js +1 -1
  38. package/build/features/featuresScreens.d.ts +1 -0
  39. package/build/features/featuresScreens.js +22 -0
  40. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +19 -5
  41. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
  42. package/build/features/shared/UploadFile/UploadFile.js +13 -13
  43. package/build/features/signIn/SignIn.d.ts +7 -0
  44. package/build/features/signIn/SignIn.js +49 -0
  45. package/build/features/signIn/index.d.ts +1 -0
  46. package/build/features/signIn/index.js +1 -0
  47. package/build/features/signIn/screens/Email/Email.d.ts +5 -0
  48. package/build/features/signIn/screens/Email/Email.js +95 -0
  49. package/build/features/signIn/screens/Email/EmailField.d.ts +5 -0
  50. package/build/features/signIn/screens/Email/EmailField.js +55 -0
  51. package/build/features/signIn/screens/Email/index.d.ts +3 -0
  52. package/build/features/signIn/screens/Email/index.js +2 -0
  53. package/build/features/signIn/screens/Email/validation.d.ts +8 -0
  54. package/build/features/signIn/screens/Email/validation.js +5 -0
  55. package/build/features/signIn/screens/Mobile/Mobile.d.ts +5 -0
  56. package/build/features/signIn/screens/Mobile/Mobile.js +106 -0
  57. package/build/features/signIn/screens/Mobile/MobileNumber.d.ts +11 -0
  58. package/build/features/signIn/screens/Mobile/MobileNumber.js +151 -0
  59. package/build/features/signIn/screens/Mobile/index.d.ts +3 -0
  60. package/build/features/signIn/screens/Mobile/index.js +2 -0
  61. package/build/features/signIn/screens/Mobile/validation.d.ts +8 -0
  62. package/build/features/signIn/screens/Mobile/validation.js +28 -0
  63. package/build/features/signIn/screens/OTP/OTP.d.ts +5 -0
  64. package/build/features/signIn/screens/OTP/OTP.js +80 -0
  65. package/build/features/signIn/screens/OTP/OTPInput.d.ts +5 -0
  66. package/build/features/signIn/screens/OTP/OTPInput.js +53 -0
  67. package/build/features/signIn/screens/OTP/index.d.ts +3 -0
  68. package/build/features/signIn/screens/OTP/index.js +2 -0
  69. package/build/features/signIn/screens/OTP/validation.d.ts +8 -0
  70. package/build/features/signIn/screens/OTP/validation.js +4 -0
  71. package/build/features/signIn/screens/Password/Password.d.ts +5 -0
  72. package/build/features/signIn/screens/Password/Password.js +54 -0
  73. package/build/features/signIn/screens/Password/PasswordInput.d.ts +5 -0
  74. package/build/features/signIn/screens/Password/PasswordInput.js +28 -0
  75. package/build/features/signIn/screens/Password/index.d.ts +3 -0
  76. package/build/features/signIn/screens/Password/index.js +2 -0
  77. package/build/features/signIn/screens/Password/validation.d.ts +8 -0
  78. package/build/features/signIn/screens/Password/validation.js +4 -0
  79. package/build/hooks/useAppDispatch.d.ts +1 -0
  80. package/build/index.d.ts +3 -2
  81. package/build/index.js +5 -2
  82. package/build/utils/string.d.ts +1 -0
  83. package/build/utils/string.js +4 -0
  84. package/package.json +1 -1
@@ -3,6 +3,9 @@ export declare type MobileFormValues = {
3
3
  mobile: string | null;
4
4
  countryCode: CountryCode;
5
5
  };
6
+ export declare type EmailFormValues = {
7
+ email: string | null;
8
+ };
6
9
  export declare type OTPFormValues = {
7
10
  otp: string;
8
11
  };
@@ -50,6 +53,7 @@ export declare type BankFormValues = {
50
53
  beneficiaryName: string;
51
54
  bankName: string;
52
55
  bankStatementId?: string;
56
+ bankStatementFile?: File;
53
57
  uploading?: boolean;
54
58
  confirmPolicy: boolean;
55
59
  };
@@ -1,7 +1,6 @@
1
1
  export interface SharedState<T> {
2
2
  error: string | null;
3
3
  loading: boolean;
4
- customLoading?: boolean;
5
4
  data: T;
6
5
  }
7
6
  export interface ActionState<T> {
@@ -6,7 +6,7 @@ export declare type EntityInfoBody = {
6
6
  business_operation_start_at?: string;
7
7
  channel_services?: Array<string>;
8
8
  physical_store_available?: boolean;
9
- yearly_sales_range?: string;
9
+ monthly_sales_range?: string;
10
10
  customers_served_monthly?: number;
11
11
  customers_base?: Array<string>;
12
12
  vat_id?: string;
@@ -32,14 +32,14 @@ export declare type EntityBankUpdateBody = {
32
32
  iban: string;
33
33
  swift_code?: string;
34
34
  account_number?: string;
35
+ is_acknowledged: boolean;
35
36
  };
36
- is_acknowledged: boolean;
37
37
  step_name: string;
38
38
  encryption_contract?: Array<string>;
39
39
  };
40
40
  export declare type UploadFileBody = {
41
41
  file_link_create: boolean;
42
- file: File | null;
42
+ file?: File;
43
43
  title: string | undefined;
44
44
  purpose: string;
45
45
  };
@@ -50,5 +50,6 @@ declare const entityService: {
50
50
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
51
51
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
52
52
  uploadFileInfo: (data: UploadFileBody) => Promise<any>;
53
+ retrieveBusinessInfo: (entity_id: string) => Promise<any>;
53
54
  };
54
55
  export { entityService };
@@ -41,12 +41,19 @@ var updateIndividualInfo = function (_a) {
41
41
  data: data
42
42
  });
43
43
  };
44
+ var retrieveBusinessInfo = function (entity_id) {
45
+ return httpClient({
46
+ method: 'get',
47
+ url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(entity_id, "/info")
48
+ });
49
+ };
44
50
  var entityService = {
45
51
  createEntityInfo: createEntityInfo,
46
52
  updateEntityInfo: updateEntityInfo,
47
53
  createBankAccount: createBankAccount,
48
54
  retrieveEntityInfo: retrieveEntityInfo,
49
55
  updateIndividualInfo: updateIndividualInfo,
50
- uploadFileInfo: uploadFileInfo
56
+ uploadFileInfo: uploadFileInfo,
57
+ retrieveBusinessInfo: retrieveBusinessInfo
51
58
  };
52
59
  export { entityService };
@@ -37,6 +37,7 @@ declare const API: {
37
37
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
38
38
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
39
39
  uploadFileInfo: (data: import("./entity").UploadFileBody) => Promise<any>;
40
+ retrieveBusinessInfo: (entity_id: string) => Promise<any>;
40
41
  };
41
42
  availabilityServices: {
42
43
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -60,6 +61,7 @@ declare const API: {
60
61
  };
61
62
  individualService: {
62
63
  getBrandList: (data: BrandListBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
64
+ retrieveIndividualInfo: (id: string) => Promise<any>;
63
65
  };
64
66
  };
65
67
  export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody };
@@ -4,5 +4,6 @@ export declare type BrandListBody = {
4
4
  };
5
5
  declare const individualService: {
6
6
  getBrandList: (data: BrandListBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
7
+ retrieveIndividualInfo: (id: string) => Promise<any>;
7
8
  };
8
9
  export { individualService };
@@ -1,9 +1,16 @@
1
1
  import { ENDPOINT_PATHS } from '../constants';
2
- import instance from './axios';
2
+ import instance, { httpClient } from './axios';
3
3
  var getBrandList = function (data, config) {
4
4
  return instance.post("".concat(ENDPOINT_PATHS.BRAND_LIST), data, config);
5
5
  };
6
+ var retrieveIndividualInfo = function (id) {
7
+ return httpClient({
8
+ method: 'get',
9
+ url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(id, "/info")
10
+ });
11
+ };
6
12
  var individualService = {
7
- getBrandList: getBrandList
13
+ getBrandList: getBrandList,
14
+ retrieveIndividualInfo: retrieveIndividualInfo
8
15
  };
9
16
  export { individualService };
@@ -6,5 +6,6 @@ declare const rootReducer: {
6
6
  tax: import("redux").Reducer<import("../features/app/tax/taxStore").TaxState, import("redux").AnyAction>;
7
7
  individual: import("redux").Reducer<import("../features/app/individual/individualStore").IndividualState, import("redux").AnyAction>;
8
8
  password: import("redux").Reducer<import("../features/app/password/passwordStore").PasswordState, import("redux").AnyAction>;
9
+ signIn: import("redux").Reducer<import("../features/app/signIn/signInStore").SignInState, import("redux").AnyAction>;
9
10
  };
10
11
  export default rootReducer;
@@ -5,6 +5,7 @@ import bank from '../features/app/bank/bankStore';
5
5
  import tax from '../features/app/tax/taxStore';
6
6
  import individual from '../features/app/individual/individualStore';
7
7
  import password from '../features/app/password/passwordStore';
8
+ import signIn from '../features/app/signIn/signInStore';
8
9
  var rootReducer = {
9
10
  settings: settings,
10
11
  connect: connect,
@@ -12,6 +13,7 @@ var rootReducer = {
12
13
  bank: bank,
13
14
  tax: tax,
14
15
  individual: individual,
15
- password: password
16
+ password: password,
17
+ signIn: signIn
16
18
  };
17
19
  export default rootReducer;
@@ -7,6 +7,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
7
7
  tax: import("../features/app/tax/taxStore").TaxState;
8
8
  individual: import("../features/app/individual/individualStore").IndividualState;
9
9
  password: import("../features/app/password/passwordStore").PasswordState;
10
+ signIn: import("../features/app/signIn/signInStore").SignInState;
10
11
  }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
11
12
  settings: import("./settings").SettingsState;
12
13
  connect: import("../features/app/connect/connectStore").ConnectState;
@@ -15,6 +16,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
15
16
  tax: import("../features/app/tax/taxStore").TaxState;
16
17
  individual: import("../features/app/individual/individualStore").IndividualState;
17
18
  password: import("../features/app/password/passwordStore").PasswordState;
19
+ signIn: import("../features/app/signIn/signInStore").SignInState;
18
20
  }, import("redux").AnyAction, undefined>]>>;
19
21
  export declare type AppDispatch = typeof store.dispatch;
20
22
  export declare type RootState = ReturnType<typeof store.getState>;
@@ -243,5 +243,6 @@
243
243
  "bank": "bank",
244
244
  "reset_password_success_title": "لقد ارسلنا رسالة بريدية إليك",
245
245
  "reset_password_success_description": "تحقق من بريدك الإلكتروني لإعادة تعيين كلمة المرور الخاصة بك.",
246
- "license_name_label": "اسم الرخصة"
246
+ "license_name_label": "اسم الرخصة",
247
+ "email_button_label": "تواصل مع البريد الإلكتروني"
247
248
  }
@@ -263,5 +263,6 @@
263
263
  "bank": "bank",
264
264
  "reset_password_success_title": "We sent you an email",
265
265
  "reset_password_success_description": "Check your email to reset your password.",
266
- "license_name_label": "License Name"
266
+ "license_name_label": "License Name",
267
+ "email_button_label": "Continue with Email"
267
268
  }
@@ -27,9 +27,8 @@ var DragAndDrop = function (_a) {
27
27
  var _b = useDropzone({
28
28
  maxFiles: 1,
29
29
  noKeyboard: true,
30
- noClick: true,
30
+ noClick: false,
31
31
  multiple: false,
32
- accept: { 'image/jpeg': ['.jpeg'], 'image/png': ['.png'], 'image/jpg': ['.jpg'], 'application/pdf': ['.pdf'] },
33
32
  onDrop: function (files) {
34
33
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(files === null || files === void 0 ? void 0 : files[0]);
35
34
  }
@@ -18,6 +18,7 @@ export declare const INDIVIDUAL_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
18
18
  export declare const PASSWORD_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
19
19
  export declare const BANK_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
20
20
  export declare const TAX_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
21
+ export declare const SigIn_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
21
22
  export declare const DefaultDeviceInfo: {
22
23
  source: string;
23
24
  device: {
@@ -79,6 +80,14 @@ export declare const CONNECT_STEP_NAMES: {
79
80
  VERIFY_AUTH_PASSWORD: string;
80
81
  CONNECT_SUCCESS: string;
81
82
  };
83
+ export declare const SignIn_STEP_NAMES: {
84
+ CREATE_AUTH_MOBILE: string;
85
+ VERIFY_AUTH_MOBILE: string;
86
+ CREATE_AUTH_EMAIL: string;
87
+ VERIFY_AUTH_EMAIL: string;
88
+ VERIFY_AUTH_MOBILE_OTP: string;
89
+ VERIFY_AUTH_EMAIL_OTP: string;
90
+ };
82
91
  export declare const BUSINESS_STEP_NAMES: {
83
92
  BUSINESS_INFO: string;
84
93
  PHONE_AUTH: string;
@@ -56,6 +56,8 @@ export var BUSINESS_SCREENS_NAVIGATION = [
56
56
  next: [
57
57
  'BUSINESS_IDBOD_STEP',
58
58
  'BUSINESS_BUSINESS_TYPE_STEP',
59
+ 'BUSINESS_CUSTOMERS_STEP',
60
+ 'BUSINESS_SUCCESS_STEP',
59
61
  'BUSINESS_ACTIVITIES_STEP',
60
62
  'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'
61
63
  ],
@@ -251,6 +253,32 @@ export var TAX_SCREENS_NAVIGATION = [
251
253
  order: 5
252
254
  }
253
255
  ];
256
+ export var SigIn_SCREENS_NAVIGATION = [
257
+ {
258
+ name: 'SIGIN_MOBILE_STEP',
259
+ next: ['SIGIN_OTP_STEP', 'SIGIN_PASSWORD_STEP'],
260
+ prev: 'SIGIN_EMAIL_STEP',
261
+ order: 1
262
+ },
263
+ {
264
+ name: 'SIGIN_EMAIL_STEP',
265
+ next: ['SIGIN_OTP_STEP', 'SIGIN_PASSWORD_STEP'],
266
+ prev: 'SIGIN_MOBILE_STEP',
267
+ order: 1
268
+ },
269
+ {
270
+ name: 'SIGIN_PASSWORD_STEP',
271
+ next: 'SIGIN_OTP_STEP',
272
+ prev: ['SIGIN_MOBILE_STEP', 'SIGIN_EMAIL_STEP'],
273
+ order: 2
274
+ },
275
+ {
276
+ name: 'SIGIN_OTP_STEP',
277
+ next: '',
278
+ prev: ['SIGIN_MOBILE_STEP', 'SIGIN_EMAIL_STEP'],
279
+ order: 3
280
+ }
281
+ ];
254
282
  export var DefaultDeviceInfo = {
255
283
  source: 'browser',
256
284
  device: {
@@ -312,6 +340,14 @@ export var CONNECT_STEP_NAMES = {
312
340
  VERIFY_AUTH_PASSWORD: 'connect_verify_auth_password',
313
341
  CONNECT_SUCCESS: 'connect_completed'
314
342
  };
343
+ export var SignIn_STEP_NAMES = {
344
+ CREATE_AUTH_MOBILE: 'signIn_create_auth_mobile',
345
+ VERIFY_AUTH_MOBILE: 'signIn_verify_auth_mobile',
346
+ CREATE_AUTH_EMAIL: 'signIn_create_auth_email',
347
+ VERIFY_AUTH_EMAIL: 'signIn_verify_auth_email',
348
+ VERIFY_AUTH_MOBILE_OTP: 'signIn_verify_auth_mobile_otp',
349
+ VERIFY_AUTH_EMAIL_OTP: 'signIn_verify_auth_email_otp'
350
+ };
315
351
  export var BUSINESS_STEP_NAMES = {
316
352
  BUSINESS_INFO: 'business_info',
317
353
  PHONE_AUTH: 'business_phone_auth',
@@ -6,7 +6,9 @@ export declare const FL_NUMBER_LENGTH = 8;
6
6
  export declare const CR_NUMBER_LENGTH = 10;
7
7
  export declare const SAUDI_NUMBER_LENGTH = 9;
8
8
  export declare const MAX_FILE_SIZE = 1000000;
9
+ export declare const VALID_FILE_FORMATS: string[];
9
10
  export declare const REGEX_FULL_NAME: RegExp;
10
11
  export declare const REGEX_WEBSITE: RegExp;
11
12
  export declare const REGEX_BENEFICIARY_NAME: RegExp;
12
13
  export declare const REGEX_BRAND_NAME: RegExp;
14
+ export declare const EMAIL_MAX_LENGTH = 50;
@@ -6,7 +6,9 @@ export var FL_NUMBER_LENGTH = 8;
6
6
  export var CR_NUMBER_LENGTH = 10;
7
7
  export var SAUDI_NUMBER_LENGTH = 9;
8
8
  export var MAX_FILE_SIZE = 1000000;
9
+ export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'];
9
10
  export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
10
11
  export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
11
12
  export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
12
13
  export var REGEX_BRAND_NAME = /(.*[a-zA-Z0-9]){3}/g;
14
+ export var EMAIL_MAX_LENGTH = 50;
@@ -20,7 +20,6 @@ export declare const createBankAccount: import("@reduxjs/toolkit").AsyncThunk<{
20
20
  data: any;
21
21
  formData: BankFormValues;
22
22
  }, BankFormValues, {}>;
23
- export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<any, File, {}>;
24
23
  export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
25
24
  data: any;
26
25
  }, {
@@ -42,6 +41,7 @@ export interface BankData {
42
41
  flowName: FlowsTypes;
43
42
  }
44
43
  export interface BankState extends SharedState<BankData> {
44
+ customLoading?: boolean;
45
45
  }
46
46
  export declare const bankSlice: import("@reduxjs/toolkit").Slice<BankState, {
47
47
  clearError: (state: BankState) => void;
@@ -154,56 +154,51 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveBankEntityInfo', funct
154
154
  });
155
155
  }); });
156
156
  export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
157
- var _a, settings, bank, iban, beneficiaryName, bank_name, requestBody, data;
158
- var _b, _c, _d, _e;
159
- return __generator(this, function (_f) {
160
- switch (_f.label) {
157
+ var _a, settings, bank, iban, beneficiaryName, bank_name, fileResponse, uploadPayload, requestBody, data;
158
+ var _b, _c, _d, _e, _f;
159
+ return __generator(this, function (_g) {
160
+ switch (_g.label) {
161
161
  case 0:
162
162
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
163
163
  iban = params.iban;
164
164
  beneficiaryName = params.beneficiaryName;
165
165
  bank_name = params.bankName;
166
+ fileResponse = undefined;
167
+ uploadPayload = {
168
+ file_link_create: true,
169
+ title: (_b = params.bankStatementFile) === null || _b === void 0 ? void 0 : _b.name,
170
+ purpose: 'identity_document',
171
+ file: params.bankStatementFile
172
+ };
173
+ if (!params.bankStatementFile) return [3, 2];
174
+ return [4, API.entityService.uploadFileInfo(uploadPayload)];
175
+ case 1:
176
+ fileResponse = _g.sent();
177
+ _g.label = 2;
178
+ case 2:
166
179
  requestBody = {
167
- wallet_id: (_c = (_b = bank.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.merchant) === null || _c === void 0 ? void 0 : _c.wallet_id,
168
- is_acknowledged: params.confirmPolicy,
180
+ wallet_id: (_d = (_c = bank.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.merchant) === null || _d === void 0 ? void 0 : _d.wallet_id,
169
181
  bank_account: {
170
182
  iban: iban,
171
183
  beneficiary_name: beneficiaryName,
172
184
  bank_name: bank_name,
173
- bank_statement_file_id: params.bankStatementId
185
+ bank_statement_file_id: fileResponse === null || fileResponse === void 0 ? void 0 : fileResponse.id,
186
+ is_acknowledged: params.confirmPolicy
174
187
  },
175
188
  step_name: BANK_STEP_NAMES.BANK_INFO,
176
189
  encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
177
190
  };
178
191
  return [4, API.entityService.createBankAccount(requestBody)];
179
- case 1:
180
- data = (_f.sent()).data;
192
+ case 3:
193
+ data = (_g.sent()).data;
181
194
  if (!data.errors) {
182
195
  thunkApi.dispatch(handleNextScreenStep());
183
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
196
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
184
197
  }
185
198
  return [2, { data: data, formData: params }];
186
199
  }
187
200
  });
188
201
  }); });
189
- export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (file, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
190
- var requestBody, data;
191
- return __generator(this, function (_a) {
192
- switch (_a.label) {
193
- case 0:
194
- requestBody = {
195
- file_link_create: true,
196
- title: file === null || file === void 0 ? void 0 : file.name,
197
- purpose: 'identity_document',
198
- file: file
199
- };
200
- return [4, API.entityService.uploadFileInfo(requestBody)];
201
- case 1:
202
- data = _a.sent();
203
- return [2, data];
204
- }
205
- });
206
- }); });
207
202
  export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
208
203
  var iban = _a.iban, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
209
204
  return __awaiter(void 0, void 0, void 0, function () {
@@ -424,20 +419,6 @@ export var bankSlice = createSlice({
424
419
  if (action.error.message === 'Aborted')
425
420
  return;
426
421
  state.error = action.error.message;
427
- })
428
- .addCase(uploadBankStatement.pending, function (state) {
429
- state.data.bankData.uploading = true;
430
- state.error = null;
431
- })
432
- .addCase(uploadBankStatement.fulfilled, function (state, action) {
433
- state.data.bankData.uploading = false;
434
- state.error = null;
435
- var id = action.payload.id;
436
- state.data.bankData.responseBody = { fileId: id };
437
- })
438
- .addCase(uploadBankStatement.rejected, function (state, action) {
439
- state.data.bankData.uploading = false;
440
- state.error = action.error.message;
441
422
  });
442
423
  }
443
424
  });
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, SalesChannel } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
@@ -14,6 +14,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
14
14
  isNID: boolean;
15
15
  otp: string;
16
16
  };
17
+ entityInfo: any;
17
18
  }, OTPFormValues, {}>;
18
19
  export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
19
20
  data: any;
@@ -41,8 +42,8 @@ export declare const createAccount: import("@reduxjs/toolkit").AsyncThunk<{
41
42
  export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
42
43
  data: any;
43
44
  formData: {
44
- activities: import("../../../@types").Activity[] | undefined;
45
- salesChannels: import("../../../@types").SalesChannel[];
45
+ activities: Activity[] | undefined;
46
+ salesChannels: SalesChannel[];
46
47
  operationStartDate: string;
47
48
  };
48
49
  }, ActivitiesFormValues, {}>;
@@ -79,6 +80,7 @@ export interface BusinessData {
79
80
  flowName: FlowsTypes;
80
81
  }
81
82
  export interface BusinessState extends SharedState<BusinessData> {
83
+ customLoading?: boolean;
82
84
  }
83
85
  export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
84
86
  clearError: (state: BusinessState) => void;
@@ -108,60 +108,76 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
108
108
  });
109
109
  }); });
110
110
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
111
- var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted;
112
- var _b, _c, _d, _e;
113
- return __generator(this, function (_f) {
114
- switch (_f.label) {
111
+ var _a, business, settings, isNID, responseBody, verifyResponse, stepName, entityID, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, entityInfo;
112
+ var _b, _c, _d, _e, _f, _g;
113
+ return __generator(this, function (_h) {
114
+ switch (_h.label) {
115
115
  case 0:
116
116
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
117
117
  isNID = business.data.otpData.isNID;
118
118
  responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
119
119
  verifyResponse = business.data.verify.responseBody;
120
120
  stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
121
+ entityID = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
121
122
  payload = {
122
123
  data: params.otp,
123
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
124
+ service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
124
125
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
125
126
  step_name: stepName,
126
127
  encryption_contract: ['data']
127
128
  };
128
129
  return [4, API.leadService.verifyLeadOTP(payload)];
129
130
  case 1:
130
- data = (_f.sent()).data;
131
- if (!!data.errors) return [3, 9];
131
+ data = (_h.sent()).data;
132
+ if (!!data.errors) return [3, 11];
132
133
  thunkApi.dispatch(updateStepName(stepName));
133
134
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
134
135
  case 2:
135
- _f.sent();
136
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
136
+ _h.sent();
137
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
137
138
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
138
139
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
139
140
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
141
+ hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
142
+ hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
140
143
  if (!isNID) return [3, 3];
141
144
  thunkApi.dispatch(handleNextScreenStep());
142
- return [3, 9];
145
+ return [3, 11];
143
146
  case 3:
144
147
  if (!hasBusinessCompleted) return [3, 5];
145
- return [4, thunkApi.dispatch(retrieveEntityInfo((_e = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _e === void 0 ? void 0 : _e.id))];
148
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_g = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _g === void 0 ? void 0 : _g.id))];
146
149
  case 4:
147
- _f.sent();
150
+ _h.sent();
148
151
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
149
- return [3, 9];
152
+ return [3, 11];
150
153
  case 5:
151
154
  if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 6];
152
155
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
153
- return [3, 9];
156
+ return [3, 11];
154
157
  case 6:
155
- if (!hasBusinessCRInfoCompleted) return [3, 8];
156
- return [4, thunkApi.dispatch(retrieveChannels())];
158
+ if (!hasBusinessCustomersCompleted) return [3, 7];
159
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
160
+ return [3, 11];
157
161
  case 7:
158
- _f.sent();
159
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
160
- return [3, 9];
162
+ if (!hasBusinessCRActivitiesCompleted) return [3, 8];
163
+ thunkApi.dispatch(retrieveChannels());
164
+ thunkApi.dispatch(retrieveDataList());
165
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
166
+ return [3, 11];
161
167
  case 8:
168
+ if (!hasBusinessCRInfoCompleted) return [3, 10];
169
+ return [4, thunkApi.dispatch(retrieveChannels())];
170
+ case 9:
171
+ _h.sent();
172
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
173
+ return [3, 11];
174
+ case 10:
162
175
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
163
- _f.label = 9;
164
- case 9: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
176
+ _h.label = 11;
177
+ case 11: return [4, API.entityService.retrieveBusinessInfo(entityID)];
178
+ case 12:
179
+ entityInfo = _h.sent();
180
+ return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), entityInfo: entityInfo }];
165
181
  }
166
182
  });
167
183
  }); });
@@ -389,11 +405,11 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
389
405
  customers_base: customerBase,
390
406
  id: id,
391
407
  customers_served_monthly: parseInt(((_c = params.expectedCustomer) === null || _c === void 0 ? void 0 : _c.id) || '0'),
392
- yearly_sales_range: ((_d = params.expectedSale) === null || _d === void 0 ? void 0 : _d.id) || '',
408
+ monthly_sales_range: ((_d = params.expectedSale) === null || _d === void 0 ? void 0 : _d.id) || '',
393
409
  agree_refund: params.refundPolicy,
394
410
  agree_chargeback: params.transactionPolicy,
395
411
  step_name: stepName,
396
- encryption_contract: ['customers_served_monthly', 'yearly_sales_range']
412
+ encryption_contract: ['customers_served_monthly', 'monthly_sales_range']
397
413
  };
398
414
  return [4, API.entityService.updateEntityInfo(requestBody)];
399
415
  case 1:
@@ -571,10 +587,10 @@ export var businessSlice = createSlice({
571
587
  state.error = null;
572
588
  })
573
589
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
574
- var _a, _b, _c;
590
+ var _a, _b, _c, _d;
575
591
  state.loading = false;
576
592
  state.error = null;
577
- var _d = action.payload, data = _d.data, formData = _d.formData;
593
+ var _e = action.payload, data = _e.data, formData = _e.formData, entityInfo = _e.entityInfo;
578
594
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
579
595
  if (description) {
580
596
  state.error = description;
@@ -582,21 +598,29 @@ export var businessSlice = createSlice({
582
598
  }
583
599
  state.data.otpData = formData;
584
600
  state.data.otpData.responseBody = data;
585
- var _e = state.data.verify.responseBody || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
586
- var issuingDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
601
+ var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
602
+ var issuingDate = entityInfo ? entityInfo.business_operation_start_at : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
587
603
  if (!!issuingDate) {
588
604
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
589
605
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
590
606
  }
607
+ var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
608
+ var selectedChannels = (channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
609
+ return entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.channel_services.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
610
+ })) || [channels === null || channels === void 0 ? void 0 : channels[0]];
611
+ if ((selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0)
612
+ state.data.activitiesData.salesChannels = selectedChannels;
591
613
  var activities = entity_activities || [];
592
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
593
- if (!!selectedActivity)
594
- state.data.activitiesData.activities = [selectedActivity];
614
+ var selectedActivity = (activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
615
+ return entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.activities.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
616
+ })) || [activities === null || activities === void 0 ? void 0 : activities[0]];
617
+ if ((selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0)
618
+ state.data.activitiesData.activities = selectedActivity;
595
619
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
596
620
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
597
621
  state.data.businessTypeData.selectedLicense = {
598
622
  legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
599
- license: { number: (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number },
623
+ license: { number: (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number },
600
624
  type: business_type
601
625
  };
602
626
  }
@@ -31,7 +31,6 @@ export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<{
31
31
  }, {}>;
32
32
  export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
33
33
  response: any;
34
- brandResponse: any;
35
34
  formData: {
36
35
  individualId: string;
37
36
  stepName: string;
@@ -40,6 +39,7 @@ export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
40
39
  individualId: string;
41
40
  stepName: string;
42
41
  }, {}>;
42
+ export declare const retrieveBrandList: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
43
43
  export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
44
44
  response: any;
45
45
  formData: IndividualFormValues;
@@ -83,6 +83,7 @@ export interface ConnectData {
83
83
  flowName: FlowsTypes;
84
84
  }
85
85
  export interface ConnectState extends SharedState<ConnectData> {
86
+ customLoading?: boolean;
86
87
  }
87
88
  export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectState, {
88
89
  clearError: (state: ConnectState) => void;