@tap-payments/auth-jsconnect 2.1.56-test → 2.1.59-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +34 -34
  2. package/build/@types/app.d.ts +1 -0
  3. package/build/app/settings.d.ts +0 -1
  4. package/build/app/settings.js +6 -16
  5. package/build/assets/locales/ar.json +3 -1
  6. package/build/assets/locales/en.json +3 -1
  7. package/build/constants/app.js +32 -2
  8. package/build/features/app/bank/bankStore.d.ts +5 -1
  9. package/build/features/app/bank/bankStore.js +62 -57
  10. package/build/features/app/brand/brandStore.d.ts +5 -1
  11. package/build/features/app/brand/brandStore.js +70 -65
  12. package/build/features/app/connectExpress/connectExpressStore.js +9 -3
  13. package/build/features/app/entity/entityStore.d.ts +5 -1
  14. package/build/features/app/entity/entityStore.js +75 -70
  15. package/build/features/app/individual/individualStore.d.ts +5 -1
  16. package/build/features/app/individual/individualStore.js +88 -83
  17. package/build/features/app/tax/taxStore.d.ts +5 -1
  18. package/build/features/app/tax/taxStore.js +51 -46
  19. package/build/features/auth/Auth.d.ts +3 -2
  20. package/build/features/auth/Auth.js +5 -13
  21. package/build/features/bank/Bank.d.ts +4 -2
  22. package/build/features/bank/Bank.js +35 -35
  23. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  24. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  25. package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
  26. package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
  27. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  28. package/build/features/brand/Brand.d.ts +4 -2
  29. package/build/features/brand/Brand.js +35 -34
  30. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  31. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  32. package/build/features/brand/screens/PrepareDataLoading/index.d.ts +2 -0
  33. package/build/features/brand/screens/PrepareDataLoading/index.js +2 -0
  34. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  35. package/build/features/business/Business.d.ts +3 -2
  36. package/build/features/business/Business.js +5 -13
  37. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
  38. package/build/features/connect/Connect.d.ts +3 -2
  39. package/build/features/connect/Connect.js +5 -13
  40. package/build/features/connectExpress/ConnectExpress.d.ts +0 -1
  41. package/build/features/connectExpress/ConnectExpress.js +3 -6
  42. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +1 -1
  43. package/build/features/connectExpress/screens/Mobile/Mobile.js +6 -3
  44. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
  45. package/build/features/connectExpress/screens/NID/IDNumber.js +7 -2
  46. package/build/features/connectExpress/screens/NID/NID.js +6 -5
  47. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +3 -7
  48. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -100
  49. package/build/features/entity/Entity.d.ts +4 -2
  50. package/build/features/entity/Entity.js +35 -36
  51. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  52. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  53. package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
  54. package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
  55. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  56. package/build/features/featuresScreens.js +25 -0
  57. package/build/features/individual/Individual.d.ts +4 -2
  58. package/build/features/individual/Individual.js +35 -36
  59. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  60. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  61. package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
  62. package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
  63. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  64. package/build/features/password/Password.d.ts +4 -2
  65. package/build/features/password/Password.js +5 -13
  66. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  67. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  68. package/build/features/shared/Button/FlowsButtons.js +6 -4
  69. package/build/features/shared/DataLoading/DataLoading.d.ts +5 -0
  70. package/build/features/shared/DataLoading/DataLoading.js +55 -0
  71. package/build/features/shared/DataLoading/index.d.ts +2 -0
  72. package/build/features/shared/DataLoading/index.js +2 -0
  73. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -1
  74. package/build/features/signIn/SignIn.d.ts +3 -2
  75. package/build/features/signIn/SignIn.js +4 -13
  76. package/build/features/tax/Tax.d.ts +4 -2
  77. package/build/features/tax/Tax.js +35 -37
  78. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  79. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  80. package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
  81. package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
  82. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  83. package/build/hooks/index.d.ts +1 -0
  84. package/build/hooks/index.js +1 -0
  85. package/build/hooks/useAppConfig.d.ts +2 -2
  86. package/build/hooks/useAppConfig.js +5 -3
  87. package/build/hooks/useVerifyToken.d.ts +15 -0
  88. package/build/hooks/useVerifyToken.js +25 -0
  89. package/build/index.d.ts +11 -11
  90. package/build/index.js +12 -22
  91. package/package.json +1 -1
  92. package/build/features/connectExpress/screens/Brand/Brand.d.ts +0 -0
  93. package/build/features/connectExpress/screens/Brand/Brand.js +0 -1
  94. package/build/features/connectExpress/screens/Brand/BrandList.d.ts +0 -10
  95. package/build/features/connectExpress/screens/Brand/BrandList.js +0 -106
  96. package/build/features/connectExpress/screens/Brand/BrandName.d.ts +0 -8
  97. package/build/features/connectExpress/screens/Brand/BrandName.js +0 -142
  98. package/build/features/connectExpress/screens/Brand/SalesChannels.d.ts +0 -5
  99. package/build/features/connectExpress/screens/Brand/SalesChannels.js +0 -38
  100. package/build/features/connectExpress/screens/Brand/Segments.d.ts +0 -8
  101. package/build/features/connectExpress/screens/Brand/Segments.js +0 -74
  102. package/build/features/connectExpress/screens/Brand/TAC.d.ts +0 -6
  103. package/build/features/connectExpress/screens/Brand/TAC.js +0 -84
  104. package/build/features/connectExpress/screens/Brand/TeamSize.d.ts +0 -8
  105. package/build/features/connectExpress/screens/Brand/TeamSize.js +0 -74
  106. package/build/features/connectExpress/screens/Brand/index.d.ts +0 -0
  107. package/build/features/connectExpress/screens/Brand/index.js +0 -1
  108. package/build/features/connectExpress/screens/Brand/validation.d.ts +0 -38
  109. package/build/features/connectExpress/screens/Brand/validation.js +0 -134
package/README.md CHANGED
@@ -85,44 +85,44 @@ const App = () => {
85
85
  <script>
86
86
  const { renderConnectLib, unmountConnectLib } = window.TapAuth
87
87
  const startConnect = () => {
88
- renderConnectLib(
89
- {
90
- open: true,
91
- merchantDomain: window.location.origin,
92
- publicKey: "pk_test_lat64TEDSvHrUOYAxVRe28PQ",
93
- appInfo: {
94
- identifier: "tap_connect_demo",
95
- name: "Tap Connect Demo",
96
- version: "V2.0.0"
97
- },
98
- businessCountryCode: "SA",
99
- language: "en",
100
- onError: (error) => {
101
- alert(JSON.stringify({ error }))
102
- },
103
- onFlowCompleted: (data) => {
104
- console.log(data)
105
- },
106
- onReady: () => {
107
- console.log("ready!")
108
- },
109
- onStepCompleted: (name, data) => {
110
- console.log(name, data)
111
- },
112
- onStepError: (name, error) => {
113
- console.log(name, error)
114
- },
115
- onStepStarted: (name) => {
116
- console.log(name)
117
- },
118
- scope: []
119
- },
88
+ const {unmount}= renderConnectLib(
89
+ {
90
+ open: true,
91
+ merchantDomain: window.location.origin,
92
+ publicKey: "pk_test_lat64TEDSvHrUOYAxVRe28PQ",
93
+ appInfo: {
94
+ identifier: "tap_connect_demo",
95
+ name: "Tap Connect Demo",
96
+ version: "V2.0.0"
97
+ },
98
+ businessCountryCode: "SA",
99
+ language: "en",
100
+ onError: (error) => {
101
+ alert(JSON.stringify({ error }))
102
+ },
103
+ onFlowCompleted: (data) => {
104
+ console.log(data)
105
+ },
106
+ onReady: () => {
107
+ console.log("ready!")
108
+ },
109
+ onStepCompleted: (name, data) => {
110
+ console.log(name, data)
111
+ },
112
+ onStepError: (name, error) => {
113
+ console.log(name, error)
114
+ },
115
+ onStepStarted: (name) => {
116
+ console.log(name)
117
+ },
118
+ scope: []
119
+ },
120
120
 
121
121
  "root"
122
122
  )
123
123
  }
124
124
  const stopConnect = () => {
125
- unmountConnectLib("root")
125
+ unmount("root")
126
126
  }
127
127
 
128
128
  </script>
@@ -164,4 +164,4 @@ const App = () => {
164
164
  | onReady `required` - `function` | callback function will call after loading library configuration |
165
165
  | onStepError `required` - `function` | callback function will call in case if any error happened in the screen |
166
166
  | onStepStarted `required` - `function` | callback function will call in the begging of each step |
167
- | scope `required` - `array` | it's an array include merchant scope |
167
+ | scope `required` - `string` | it's an string |
@@ -161,6 +161,7 @@ interface LibCallbacks {
161
161
  onStepCompleted?: (name: string, info: any) => void;
162
162
  onReady?: () => void;
163
163
  onStepStarted?: (name: string) => void;
164
+ onFlowButtonClick?: (item: any) => void;
164
165
  }
165
166
  export interface LibConfig extends LibCallbacks {
166
167
  publicKey: string;
@@ -4,7 +4,6 @@ interface SettingParams {
4
4
  disableCountries?: boolean;
5
5
  disableLocale?: boolean;
6
6
  mdn: string;
7
- prepare?: () => Promise<void>;
8
7
  }
9
8
  export declare const fetchAppSettingsSync: import("@reduxjs/toolkit").AsyncThunk<{
10
9
  countries: CountryCode[];
@@ -47,20 +47,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, removeElement } from '../utils';
51
- import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS, DIALOG_ID, BACKGROUND_ID } from '../constants';
50
+ import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString } from '../utils';
51
+ import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
52
52
  import i18n from '../i18n';
53
53
  import { updateLocale } from '../utils/locale';
54
54
  import API, { setAxiosGlobalHeaders } from '../api';
55
55
  export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var settings, _a, appConfig, language, _b, client, device, os, disableCountries, disableLocale, prepare, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, operatorStatus, isValidOperator, countries, businessCountry;
56
+ var settings, _a, appConfig, language, _b, client, device, os, disableCountries, disableLocale, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, operatorStatus, isValidOperator, countries, businessCountry;
57
57
  return __generator(this, function (_e) {
58
58
  switch (_e.label) {
59
59
  case 0:
60
60
  settings = thunkApi.getState().settings;
61
61
  _a = settings.data, appConfig = _a.appConfig, language = _a.language;
62
62
  _b = getBrowserInfo(), client = _b.client, device = _b.device, os = _b.os;
63
- disableCountries = params.disableCountries, disableLocale = params.disableLocale, prepare = params.prepare;
63
+ disableCountries = params.disableCountries, disableLocale = params.disableLocale;
64
64
  return [4, Promise.all([
65
65
  getFingerPrint(),
66
66
  API.locationService.getIP(),
@@ -114,12 +114,6 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
114
114
  isValidOperator = operatorStatus === 'valid';
115
115
  countries = sortCountries(list);
116
116
  businessCountry = findCountryByIso2(countries, appConfig.businessCountryCode);
117
- if (!(typeof prepare === 'function')) return [3, 4];
118
- return [4, prepare()];
119
- case 3:
120
- _e.sent();
121
- _e.label = 4;
122
- case 4:
123
117
  if (!businessCountry)
124
118
  throw new Error('Business country not found, you have to pass a valid business country code in the lib config');
125
119
  return [2, { countries: countries, businessCountry: businessCountry, locale: locale, deviceInfo: deviceInfo, isValidOperator: isValidOperator }];
@@ -152,18 +146,14 @@ export var settingsSlice = createSlice({
152
146
  },
153
147
  handleOpen: function (state, action) {
154
148
  state.data.open = action.payload;
155
- if (action.payload === false) {
156
- setTimeout(function () {
157
- removeElement(DIALOG_ID);
158
- removeElement(BACKGROUND_ID);
159
- }, 1000);
160
- }
161
149
  },
162
150
  handleSkin: function (state, action) {
163
151
  state.data.skin = action.payload;
164
152
  storeData(LOCAL_STORAGE_KEYS.themeMode, action.payload);
165
153
  },
166
154
  handleLanguage: function (state, action) {
155
+ if (!action.payload)
156
+ return;
167
157
  state.data.language = action.payload;
168
158
  i18n.changeLanguage(action.payload);
169
159
  storeData(LOCAL_STORAGE_KEYS.languageMode, action.payload);
@@ -358,5 +358,7 @@
358
358
  "unified_number_required": "Unified Number Required",
359
359
  "creating_account_title": "Creating your account",
360
360
  "creating_account_description": "This might take a moment...",
361
- "uploaded_file": "file"
361
+ "uploaded_file": "file",
362
+ "prepare_data_title": "Preparing your data",
363
+ "prepare_data_description": "This might take a moment..."
362
364
  }
@@ -387,5 +387,7 @@
387
387
  "unified_number_required": "Unified Number Required",
388
388
  "creating_account_title": "Creating your account",
389
389
  "creating_account_description": "This might take a moment...",
390
- "uploaded_file": "file"
390
+ "uploaded_file": "file",
391
+ "prepare_data_title": "Preparing your data",
392
+ "prepare_data_description": "This might take a moment..."
391
393
  }
@@ -86,14 +86,14 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
86
86
  },
87
87
  {
88
88
  name: 'CONNECT_EXPRESS_VERIFY_PACI_STEP',
89
- next: ['CONNECT_EXPRESS_COLLECT_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
89
+ next: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
90
90
  prev: 'CONNECT_EXPRESS_CIVIL_ID_STEP',
91
91
  order: 2
92
92
  },
93
93
  {
94
94
  name: 'CONNECT_EXPRESS_OTP_STEP',
95
95
  next: [
96
- 'CONNECT_EXPRESS_COLLECT_INFO_STEP',
96
+ 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
97
97
  'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
98
98
  'CONNECT_EXPRESS_NID_MISSED_STEP',
99
99
  'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP'
@@ -245,6 +245,12 @@ export var INDIVIDUAL_SCREENS_NAVIGATION = [
245
245
  prev: '',
246
246
  order: 1
247
247
  },
248
+ {
249
+ name: 'INDIVIDUAL_LOADING_DATA_STEP',
250
+ next: ['INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
251
+ prev: '',
252
+ order: 1
253
+ },
248
254
  {
249
255
  name: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
250
256
  next: 'INDIVIDUAL_SUCCESS_STEP',
@@ -315,6 +321,12 @@ export var BANK_SCREENS_NAVIGATION = [
315
321
  prev: '',
316
322
  order: 1
317
323
  },
324
+ {
325
+ name: 'BANK_LOADING_DATA_STEP',
326
+ next: ['BANK_BANK_DETAILS_STEP', 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
327
+ prev: '',
328
+ order: 1
329
+ },
318
330
  {
319
331
  name: 'BANK_BANK_DETAILS_STEP',
320
332
  next: 'BANK_DETAILS_SUCCESS_STEP',
@@ -347,6 +359,12 @@ export var TAX_SCREENS_NAVIGATION = [
347
359
  prev: '',
348
360
  order: 1
349
361
  },
362
+ {
363
+ name: 'TAX_LOADING_DATA_STEP',
364
+ next: ['TAX_TAX_DETAILS_STEP', 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
365
+ prev: '',
366
+ order: 1
367
+ },
350
368
  {
351
369
  name: 'TAX_TAX_DETAILS_STEP',
352
370
  next: 'TAX_DETAILS_SUCCESS_STEP',
@@ -405,6 +423,12 @@ export var ENTITY_SCREENS_NAVIGATION = [
405
423
  prev: '',
406
424
  order: 1
407
425
  },
426
+ {
427
+ name: 'ENTITY_LOADING_DATA_STEP',
428
+ next: ['ENTITY_NAME_STEP', 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
429
+ prev: '',
430
+ order: 1
431
+ },
408
432
  {
409
433
  name: 'ENTITY_NAME_STEP',
410
434
  next: 'ENTITY_CAPITAL_STEP',
@@ -457,6 +481,12 @@ export var BRAND_SCREENS_NAVIGATION = [
457
481
  prev: '',
458
482
  order: 1
459
483
  },
484
+ {
485
+ name: 'BRAND_LOADING_DATA_STEP',
486
+ next: 'BRAND_INFO_STEP',
487
+ prev: '',
488
+ order: 1
489
+ },
460
490
  {
461
491
  name: 'BRAND_INFO_STEP',
462
492
  next: 'BRAND_ACTIVITIES_STEP',
@@ -1,6 +1,10 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { BankFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
+ interface VerifyLeadTokenProps {
5
+ token: string;
6
+ isInternally?: boolean;
7
+ }
4
8
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
9
  data: any;
6
10
  boardResponse: {
@@ -15,7 +19,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
15
19
  flows: any;
16
20
  };
17
21
  token: string;
18
- }, string, {}>;
22
+ }, VerifyLeadTokenProps, {}>;
19
23
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
20
24
  data: any;
21
25
  }, void, {}>;
@@ -51,64 +51,69 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
- export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasBankCompleted;
56
- var _a, _b, _c, _d;
57
- return __generator(this, function (_e) {
58
- switch (_e.label) {
59
- case 0:
60
- payload = {
61
- service_name: 'tap_email',
62
- verify_token: token
63
- };
64
- return [4, API.leadService.verifyLeadToken(payload)];
65
- case 1:
66
- data = (_e.sent()).data;
67
- boardData = undefined;
68
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
69
- board_id = data === null || data === void 0 ? void 0 : data.id;
70
- if (!board_id) return [3, 4];
71
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
72
- case 2:
73
- boardInfoData = _e.sent();
74
- return [4, API.boardService.retrieveBoardDetails(board_id)];
75
- case 3:
76
- boardData = _e.sent();
77
- _e.label = 4;
78
- case 4:
79
- countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
80
- if (countryIso2)
81
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
82
- info = (boardInfoData || {}).info;
83
- hasBankCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
84
- if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
85
- thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
86
- }
87
- else if (hasBankCompleted) {
88
- thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
89
- }
90
- else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
91
- thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
92
- }
93
- _e.label = 5;
94
- case 5: return [2, {
95
- data: data,
96
- boardResponse: {
97
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
98
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
99
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
100
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
101
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
102
- name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
103
- contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
104
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
105
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
106
- },
107
- token: token
108
- }];
109
- }
54
+ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
55
+ var token = _a.token, isInternally = _a.isInternally;
56
+ return __awaiter(void 0, void 0, void 0, function () {
57
+ var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasBankCompleted;
58
+ var _b, _c, _d, _e;
59
+ return __generator(this, function (_f) {
60
+ switch (_f.label) {
61
+ case 0:
62
+ payload = {
63
+ service_name: 'tap_email',
64
+ verify_token: token
65
+ };
66
+ return [4, API.leadService.verifyLeadToken(payload)];
67
+ case 1:
68
+ data = (_f.sent()).data;
69
+ boardData = undefined;
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
71
+ board_id = data === null || data === void 0 ? void 0 : data.id;
72
+ if (!board_id) return [3, 4];
73
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
74
+ case 2:
75
+ boardInfoData = _f.sent();
76
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
77
+ case 3:
78
+ boardData = _f.sent();
79
+ _f.label = 4;
80
+ case 4:
81
+ countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
82
+ if (countryIso2)
83
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
84
+ info = (boardInfoData || {}).info;
85
+ if (isInternally)
86
+ data.step_name = BANK_STEP_NAMES.BANK_INFO;
87
+ hasBankCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
88
+ if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
89
+ thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
90
+ }
91
+ else if (hasBankCompleted) {
92
+ thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
93
+ }
94
+ else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
95
+ thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
96
+ }
97
+ _f.label = 5;
98
+ case 5: return [2, {
99
+ data: data,
100
+ boardResponse: {
101
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
102
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
103
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
104
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
105
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
106
+ name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
107
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
108
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
109
+ flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
110
+ },
111
+ token: token
112
+ }];
113
+ }
114
+ });
110
115
  });
111
- }); });
116
+ });
112
117
  export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
118
  var bank, payload, data;
114
119
  return __generator(this, function (_a) {
@@ -1,6 +1,10 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
+ interface VerifyLeadTokenProps {
5
+ token: string;
6
+ isInternally?: boolean;
7
+ }
4
8
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
9
  data: any;
6
10
  boardResponse: {
@@ -17,7 +21,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
17
21
  segmentsList: any;
18
22
  teamSizeList: any;
19
23
  token: string;
20
- }, string, {}>;
24
+ }, VerifyLeadTokenProps, {}>;
21
25
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
22
26
  data: any;
23
27
  }, void, {}>;
@@ -51,74 +51,79 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BRAND_STEP_NAMES } from '../../../constants';
54
- import { isKW, isSA, isTwitter, isWebsite } from '../../../utils';
55
- export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, countryIso2, board_id, segmentsList, salesChannels, teamSizeList, boardInfoData, boardData;
57
- var _a, _b, _c;
58
- return __generator(this, function (_d) {
59
- switch (_d.label) {
60
- case 0:
61
- payload = {
62
- service_name: 'tap_email',
63
- verify_token: token
64
- };
65
- return [4, API.leadService.verifyLeadToken(payload)];
66
- case 1:
67
- data = (_d.sent()).data;
68
- if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
69
- throw new Error(data.errors[0].description);
70
- }
71
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
72
- if (countryIso2)
73
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
74
- board_id = data === null || data === void 0 ? void 0 : data.id;
75
- if (!board_id) {
76
- throw new Error('Internal server error');
77
- }
78
- boardData = undefined;
79
- if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH)) return [3, 7];
80
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
81
- case 2:
82
- boardInfoData = _d.sent();
83
- return [4, API.boardService.retrieveBoardDetails(board_id)];
84
- case 3:
85
- boardData = _d.sent();
86
- if (!countryIso2) {
87
- countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
54
+ import { isKW, isSA, isTwitter, isWebsite, sleep } from '../../../utils';
55
+ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
56
+ var token = _a.token, isInternally = _a.isInternally;
57
+ return __awaiter(void 0, void 0, void 0, function () {
58
+ var payload, data, countryIso2, board_id, segmentsList, salesChannels, teamSizeList, boardInfoData, boardData;
59
+ var _b, _c, _d;
60
+ return __generator(this, function (_e) {
61
+ switch (_e.label) {
62
+ case 0:
63
+ payload = {
64
+ service_name: 'tap_email',
65
+ verify_token: token
66
+ };
67
+ return [4, API.leadService.verifyLeadToken(payload)];
68
+ case 1:
69
+ data = (_e.sent()).data;
70
+ if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
71
+ throw new Error(data.errors[0].description);
72
+ }
73
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
88
74
  if (countryIso2)
89
75
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
90
- }
91
- return [4, API.dataService.getSegments({ page: 0 })];
92
- case 4:
93
- segmentsList = _d.sent();
94
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
95
- case 5:
96
- salesChannels = _d.sent();
97
- return [4, API.dataService.getTeamSize({ page: 0 })];
98
- case 6:
99
- teamSizeList = _d.sent();
100
- thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
101
- _d.label = 7;
102
- case 7: return [2, {
103
- data: data,
104
- boardResponse: {
105
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
106
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
107
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
108
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
109
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
110
- name: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.names,
111
- contact: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.contact,
112
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
113
- },
114
- salesChannels: salesChannels,
115
- segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
116
- teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
117
- token: token
118
- }];
119
- }
76
+ board_id = data === null || data === void 0 ? void 0 : data.id;
77
+ if (!board_id) {
78
+ throw new Error('Internal server error');
79
+ }
80
+ boardData = undefined;
81
+ if (isInternally)
82
+ data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
83
+ if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
84
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
85
+ case 2:
86
+ boardInfoData = _e.sent();
87
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
88
+ case 3:
89
+ boardData = _e.sent();
90
+ if (!countryIso2) {
91
+ countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
92
+ if (countryIso2)
93
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
94
+ }
95
+ return [4, API.dataService.getSegments({ page: 0 })];
96
+ case 4:
97
+ segmentsList = _e.sent();
98
+ return [4, API.dataService.getChannelsOfServices({ page: 0 })];
99
+ case 5:
100
+ salesChannels = _e.sent();
101
+ return [4, API.dataService.getTeamSize({ page: 0 })];
102
+ case 6:
103
+ teamSizeList = _e.sent();
104
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
105
+ _e.label = 7;
106
+ case 7: return [2, {
107
+ data: data,
108
+ boardResponse: {
109
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
110
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
111
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
112
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
113
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
114
+ name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
115
+ contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
116
+ flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
117
+ },
118
+ salesChannels: salesChannels,
119
+ segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
120
+ teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
121
+ token: token
122
+ }];
123
+ }
124
+ });
120
125
  });
121
- }); });
126
+ });
122
127
  export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
123
128
  var brand, payload, data;
124
129
  return __generator(this, function (_a) {
@@ -693,8 +693,10 @@ export var connectSlice = createSlice({
693
693
  var _a = action.payload, data = _a.data, countryCode = _a.countryCode, boardInfo = _a.boardInfo, boardData = _a.boardData;
694
694
  state.data.responseData = __assign(__assign({}, state.data.responseData), { leadData: data, boardInfo: boardInfo, boardData: boardData });
695
695
  var _b = data || {}, identification = _b.identification, date_of_birth = _b.date_of_birth, contact = _b.contact;
696
- state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
697
- state.data.nidData.dob = date_of_birth;
696
+ if (identification === null || identification === void 0 ? void 0 : identification.id)
697
+ state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
698
+ if (date_of_birth)
699
+ state.data.nidData.dob = date_of_birth;
698
700
  var phone = (contact || {}).phone;
699
701
  if (phone) {
700
702
  state.data.mobileData.mobile = phone === null || phone === void 0 ? void 0 : phone.number;
@@ -714,7 +716,11 @@ export var connectSlice = createSlice({
714
716
  state.loading = false;
715
717
  var _c = action.payload, data = _c.data, countryCode = _c.countryCode;
716
718
  state.data.responseData = __assign(__assign({}, state.data.responseData), { leadData: data });
717
- var _d = data || {}, name = _d.name, contact = _d.contact, brand = _d.brand, license_number = _d.license_number;
719
+ var _d = data || {}, name = _d.name, contact = _d.contact, brand = _d.brand, license_number = _d.license_number, identification = _d.identification, date_of_birth = _d.date_of_birth;
720
+ if (identification === null || identification === void 0 ? void 0 : identification.id)
721
+ state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
722
+ if (date_of_birth)
723
+ state.data.nidData.dob = date_of_birth;
718
724
  var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
719
725
  if (!!fullName) {
720
726
  var capitalizedName = capitalizeTheFirstLetterOfEachWord(fullName);
@@ -1,5 +1,9 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
+ interface VerifyLeadTokenProps {
4
+ token: string;
5
+ isInternally?: boolean;
6
+ }
3
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
8
  data: any;
5
9
  boardResponse: {
@@ -14,7 +18,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
14
18
  entityTypes: any;
15
19
  };
16
20
  token: string;
17
- }, string, {}>;
21
+ }, VerifyLeadTokenProps, {}>;
18
22
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
19
23
  data: any;
20
24
  }, void, {}>;