@tap-payments/auth-jsconnect 2.6.61-test → 2.6.82-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 (79) hide show
  1. package/build/@types/app.d.ts +2 -1
  2. package/build/api/auth.d.ts +19 -0
  3. package/build/api/auth.js +9 -1
  4. package/build/api/entity.d.ts +6 -1
  5. package/build/api/entity.js +2 -5
  6. package/build/api/index.d.ts +6 -5
  7. package/build/api/lead.d.ts +8 -1
  8. package/build/api/lead.js +2 -5
  9. package/build/app/settings.js +3 -3
  10. package/build/assets/locales/ar.json +5 -1
  11. package/build/assets/locales/en.json +5 -1
  12. package/build/components/AnimationFlow/AnimationFlow.d.ts +7 -2
  13. package/build/components/AnimationFlow/AnimationFlow.js +16 -5
  14. package/build/components/AnimationFlow/BottomSheet.d.ts +3 -1
  15. package/build/components/AnimationFlow/BottomSheet.js +4 -4
  16. package/build/components/AnimationFlow/Dialog.d.ts +7 -1
  17. package/build/components/AnimationFlow/Dialog.js +5 -9
  18. package/build/components/AnimationFlow/Loader.d.ts +6 -1
  19. package/build/components/AnimationFlow/Loader.js +17 -5
  20. package/build/constants/app.d.ts +0 -1
  21. package/build/constants/app.js +14 -3
  22. package/build/constants/assets.d.ts +1 -0
  23. package/build/constants/assets.js +2 -1
  24. package/build/features/app/auth/authStore.d.ts +6 -13
  25. package/build/features/app/auth/authStore.js +168 -111
  26. package/build/features/app/board/boardStore.js +8 -2
  27. package/build/features/app/connectExpress/connectExpressStore.js +18 -5
  28. package/build/features/auth/Auth.d.ts +5 -0
  29. package/build/features/auth/Auth.js +56 -7
  30. package/build/features/auth/screens/AccountNotFound/AccountNotFound.d.ts +5 -0
  31. package/build/features/auth/screens/AccountNotFound/AccountNotFound.js +74 -0
  32. package/build/features/auth/screens/AccountNotFound/index.d.ts +2 -0
  33. package/build/features/auth/screens/AccountNotFound/index.js +2 -0
  34. package/build/features/auth/screens/OTP/OTP.js +2 -3
  35. package/build/features/auth/screens/PreparingData/PreparingData.d.ts +5 -0
  36. package/build/features/auth/screens/PreparingData/PreparingData.js +41 -0
  37. package/build/features/auth/screens/PreparingData/index.d.ts +2 -0
  38. package/build/features/auth/screens/PreparingData/index.js +2 -0
  39. package/build/features/bank/Bank.d.ts +1 -0
  40. package/build/features/bank/Bank.js +5 -4
  41. package/build/features/board/Board.d.ts +1 -0
  42. package/build/features/board/Board.js +7 -5
  43. package/build/features/brand/Brand.d.ts +1 -0
  44. package/build/features/brand/Brand.js +5 -4
  45. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +2 -2
  46. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  47. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  48. package/build/features/connect/screens/Individual/Email.js +3 -1
  49. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  50. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -1
  51. package/build/features/entity/Entity.d.ts +1 -0
  52. package/build/features/entity/Entity.js +5 -4
  53. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -2
  54. package/build/features/featuresScreens.js +10 -0
  55. package/build/features/individual/Individual.d.ts +1 -0
  56. package/build/features/individual/Individual.js +5 -4
  57. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  58. package/build/features/individual/screens/IndividualList/Email.js +3 -2
  59. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +4 -2
  60. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -2
  61. package/build/features/password/Password.d.ts +1 -0
  62. package/build/features/password/Password.js +5 -5
  63. package/build/features/shared/Address/CountryList.d.ts +1 -1
  64. package/build/features/shared/Address/InputSelect.d.ts +1 -1
  65. package/build/features/shared/Background/Background.d.ts +2 -1
  66. package/build/features/shared/Background/Background.js +9 -11
  67. package/build/features/shared/Containers/FeatureContainer.d.ts +2 -1
  68. package/build/features/shared/Containers/FeatureContainer.js +3 -3
  69. package/build/features/shared/DataLoading/DataLoading.d.ts +2 -1
  70. package/build/features/shared/DataLoading/DataLoading.js +2 -2
  71. package/build/features/tax/Tax.d.ts +1 -0
  72. package/build/features/tax/Tax.js +5 -4
  73. package/build/hooks/useAppConfig.js +2 -2
  74. package/build/hooks/useVerifyToken.d.ts +2 -1
  75. package/build/hooks/useVerifyToken.js +2 -2
  76. package/build/theme/palette.js +2 -1
  77. package/build/utils/validation.d.ts +2 -0
  78. package/build/utils/validation.js +7 -1
  79. package/package.json +1 -1
@@ -48,10 +48,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import { AuthForType, FlowsTypes } from '../../../@types';
51
- import { ACCOUNT_NOT_AVAILABLE, AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
51
+ import { AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
52
52
  import API from '../../../api';
53
53
  import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handleSetCountryByIso2 } from '../../../app/settings';
54
- import { findCountryByIddPrefix, isSA, sleep } from '../../../utils';
54
+ import { findCountryByIddPrefix, isSA, openConnect, sleep } from '../../../utils';
55
55
  export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var auth, payload, data;
57
57
  return __generator(this, function (_a) {
@@ -71,7 +71,7 @@ export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry'
71
71
  });
72
72
  }); });
73
73
  export var retrieveLeadIdentityByIdAsync = createAsyncThunk('auth/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
74
- var settingData, countryCode, data, _a, country_code, contact, phone, businessCountryIso2, ipCountryIso2;
74
+ var settingData, countryCode, data, _a, country_code, contact, businessCountryIso2, ipCountryIso2, phone;
75
75
  var _b, _c;
76
76
  return __generator(this, function (_d) {
77
77
  switch (_d.label) {
@@ -82,22 +82,28 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('auth/retrieveLeadId
82
82
  case 1:
83
83
  data = _d.sent();
84
84
  _a = data || {}, country_code = _a.country_code, contact = _a.contact;
85
- if (country_code)
85
+ businessCountryIso2 = (_b = settingData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
86
+ ipCountryIso2 = (_c = settingData.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2;
87
+ if (country_code) {
86
88
  thunkApi.dispatch(handleSetCountryByIso2(country_code));
89
+ businessCountryIso2 = country_code;
90
+ }
87
91
  phone = (contact || {}).phone;
88
92
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
89
93
  countryCode = findCountryByIddPrefix(settingData.countries, phone.country_code);
90
- businessCountryIso2 = (_b = settingData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
91
- ipCountryIso2 = (_c = settingData.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2;
92
- if (!businessCountryIso2 && ipCountryIso2) {
94
+ if (!businessCountryIso2 && ipCountryIso2 && settingData.appConfig.scope === 'auth') {
93
95
  thunkApi.dispatch(handleSetCountryByIso2(ipCountryIso2));
94
96
  businessCountryIso2 = ipCountryIso2;
95
97
  }
96
- if (!(data === null || data === void 0 ? void 0 : data.country_code) && !businessCountryIso2) {
98
+ if (!country_code && !businessCountryIso2) {
97
99
  thunkApi.dispatch(handleCurrentActiveScreen('AUTH_BUSINESS_COUNTRY_STEP'));
98
100
  return [2, { data: data, countryCode: countryCode }];
99
101
  }
100
- if ((data === null || data === void 0 ? void 0 : data.country_code) && !businessCountryIso2) {
102
+ if (!(data === null || data === void 0 ? void 0 : data.identification) && phone) {
103
+ thunkApi.dispatch(handleCurrentActiveScreen('AUTH_MOBILE_STEP'));
104
+ return [2, { data: data, countryCode: countryCode }];
105
+ }
106
+ if (country_code && !businessCountryIso2) {
101
107
  thunkApi.dispatch(handleSetCountryByIso2(data.country_code));
102
108
  if (!isSA(data.country_code))
103
109
  thunkApi.dispatch(handleCurrentActiveScreen('AUTH_MOBILE_STEP'));
@@ -169,18 +175,17 @@ export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', fu
169
175
  });
170
176
  }); });
171
177
  export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
172
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, authData, isDataHasIndividualOnly, payload, data, accountData, _d, step_name, brands, entities, brandList, entityList, isExistingUser, authId;
173
- var _e, _f, _g, _h;
174
- return __generator(this, function (_j) {
175
- switch (_j.label) {
178
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, scope, payload, data;
179
+ var _d, _e, _f, _g;
180
+ return __generator(this, function (_h) {
181
+ switch (_h.label) {
176
182
  case 0:
177
183
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
178
184
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
179
- _c = (_e = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _e !== void 0 ? _e : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name;
185
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name;
180
186
  if (!auth_token)
181
187
  throw new Error('Auth token is missing');
182
- authData = settings.data.appConfig.data;
183
- isDataHasIndividualOnly = (authData === null || authData === void 0 ? void 0 : authData.length) === 1 && authData.includes('individual');
188
+ scope = settings.data.appConfig.scope;
184
189
  payload = {
185
190
  auth_token: auth_token,
186
191
  lead_id: leadId,
@@ -194,29 +199,16 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
194
199
  };
195
200
  return [4, API.authService.verifyAuth(payload)];
196
201
  case 1:
197
- data = (_j.sent()).data;
198
- if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
202
+ data = (_h.sent()).data;
203
+ if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
199
204
  throw new Error(data.errors[0].description);
200
- return [4, API.accountService.checkAccountAvailability(data.individual_id)];
201
- case 2:
202
- accountData = _j.sent();
203
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, params);
204
- _d = accountData || {}, step_name = _d.step_name, brands = _d.brands, entities = _d.entities;
205
- brandList = brands || [];
206
- entityList = entities || [];
207
- isExistingUser = step_name === 'select_account';
208
- authId = data.id;
209
- if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 4];
210
- return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
211
- case 3:
212
- _j.sent();
213
- return [2, { data: data, brandList: brandList, entityList: entityList }];
214
- case 4:
215
- if (isExistingUser && !isDataHasIndividualOnly && brandList.length && entityList.length) {
216
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
217
- return [2, { data: data, brandList: brandList, entityList: entityList }];
205
+ if (scope === 'merchant') {
206
+ openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
207
+ return [2, data];
218
208
  }
219
- throw new Error(ACCOUNT_NOT_AVAILABLE);
209
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
210
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_PREPARING_DATA_STEP')); });
211
+ return [2, data];
220
212
  }
221
213
  });
222
214
  }); });
@@ -298,18 +290,17 @@ export var resendNIDAuthOTP = createAsyncThunk('auth/resendNIDAuthOTP', function
298
290
  });
299
291
  }); });
300
292
  export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
301
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, authData, isDataHasIndividualOnly, payload, data, accountData, _d, step_name, brands, entities, brandList, entityList, isExistingUser, authId;
302
- var _e, _f, _g, _h;
303
- return __generator(this, function (_j) {
304
- switch (_j.label) {
293
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, scope, payload, data;
294
+ var _d, _e, _f, _g;
295
+ return __generator(this, function (_h) {
296
+ switch (_h.label) {
305
297
  case 0:
306
298
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
307
299
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
308
- _c = (_e = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _e !== void 0 ? _e : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name;
300
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name;
309
301
  if (!auth_token)
310
302
  throw new Error('Auth token is missing');
311
- authData = settings.data.appConfig.data;
312
- isDataHasIndividualOnly = (authData === null || authData === void 0 ? void 0 : authData.length) === 1 && authData.includes('individual');
303
+ scope = settings.data.appConfig.scope;
313
304
  payload = {
314
305
  auth_token: auth_token,
315
306
  lead_id: leadId,
@@ -323,29 +314,16 @@ export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params
323
314
  };
324
315
  return [4, API.authService.verifyAuth(payload)];
325
316
  case 1:
326
- data = (_j.sent()).data;
327
- if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
317
+ data = (_h.sent()).data;
318
+ if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
328
319
  throw new Error(data.errors[0].description);
329
- return [4, API.accountService.checkAccountAvailability(data.individual_id)];
330
- case 2:
331
- accountData = _j.sent();
332
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, params);
333
- _d = accountData || {}, step_name = _d.step_name, brands = _d.brands, entities = _d.entities;
334
- brandList = brands || [];
335
- entityList = entities || [];
336
- isExistingUser = step_name === 'select_account';
337
- authId = data.id;
338
- if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 4];
339
- return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
340
- case 3:
341
- _j.sent();
342
- return [2, { data: data, brandList: brandList, entityList: entityList }];
343
- case 4:
344
- if (isExistingUser && !isDataHasIndividualOnly && brandList.length && entityList.length) {
345
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
346
- return [2, { data: data, brandList: brandList, entityList: entityList }];
320
+ if (scope === 'merchant') {
321
+ openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
322
+ return [2, data];
347
323
  }
348
- throw new Error(ACCOUNT_NOT_AVAILABLE);
324
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
325
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_PREPARING_DATA_STEP')); });
326
+ return [2, data];
349
327
  }
350
328
  });
351
329
  }); });
@@ -380,65 +358,97 @@ export var createCivilIdAuth = createAsyncThunk('auth/createCivilAuth', function
380
358
  });
381
359
  }); });
382
360
  export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
383
- var _a, settings, auth, authResponse, authConfigData, isDataHasIndividualOnly, expiry, interval, maxCalls, count, data, isSuccess, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
384
- var _c;
385
- return __generator(this, function (_d) {
386
- switch (_d.label) {
361
+ var _a, settings, auth, authResponse, scope, expiry, interval, maxCalls, count, data, isSuccess;
362
+ var _b, _c, _d;
363
+ return __generator(this, function (_e) {
364
+ switch (_e.label) {
387
365
  case 0:
388
366
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
389
367
  authResponse = (auth.data.responseData || {}).authResponse;
390
- authConfigData = settings.data.appConfig.data;
391
- isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
368
+ scope = settings.data.appConfig.scope;
392
369
  expiry = (authResponse === null || authResponse === void 0 ? void 0 : authResponse.expiry) || 120;
393
370
  interval = 3;
394
371
  maxCalls = Math.floor(expiry / interval);
395
372
  count = 1;
396
- _d.label = 1;
373
+ _e.label = 1;
397
374
  case 1:
398
- if (!(count <= maxCalls)) return [3, 9];
375
+ if (!(count <= maxCalls)) return [3, 5];
399
376
  if (thunkApi.signal.aborted) {
400
- return [3, 9];
377
+ return [3, 5];
401
378
  }
402
379
  return [4, API.authService.getVerifyAuth(authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_token)];
403
380
  case 2:
404
- data = _d.sent();
405
- isSuccess = ((_c = data === null || data === void 0 ? void 0 : data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'success';
406
- if (!isSuccess) return [3, 6];
407
- authId = data.id;
408
- return [4, API.accountService.checkAccountAvailability(data.individual_id)];
381
+ data = _e.sent();
382
+ isSuccess = ((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
383
+ if (isSuccess) {
384
+ if (scope === 'merchant') {
385
+ openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
386
+ return [2, data];
387
+ }
388
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
389
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_PREPARING_DATA_STEP')); });
390
+ return [2, data];
391
+ }
392
+ return [4, sleep(interval * 1000)];
409
393
  case 3:
394
+ _e.sent();
395
+ _e.label = 4;
396
+ case 4:
397
+ count++;
398
+ return [3, 1];
399
+ case 5: throw new Error('paci_verification_failed');
400
+ }
401
+ });
402
+ }); });
403
+ export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
404
+ var _a, settings, auth, authConfigData, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
405
+ var _c;
406
+ return __generator(this, function (_d) {
407
+ switch (_d.label) {
408
+ case 0:
409
+ _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
410
+ authConfigData = settings.data.appConfig.data;
411
+ isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
412
+ data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
413
+ authId = data === null || data === void 0 ? void 0 : data.id;
414
+ return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
415
+ case 1:
410
416
  accountData = _d.sent();
411
417
  _b = accountData || {}, step_name = _b.step_name, brands = _b.brands, entities = _b.entities;
412
418
  brandList = brands || [];
413
419
  entityList = entities || [];
414
420
  isExistingUser = step_name === 'select_account';
415
- if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 5];
421
+ if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 3];
416
422
  return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
417
- case 4:
423
+ case 2:
418
424
  _d.sent();
419
- return [2, { data: data, brandList: brandList, entityList: entityList }];
420
- case 5:
425
+ return [2, { brandList: brandList, entityList: entityList }];
426
+ case 3:
421
427
  if (isExistingUser && !isDataHasIndividualOnly && brandList.length && entityList.length) {
422
428
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
423
- return [2, { data: data, brandList: brandList, entityList: entityList }];
429
+ return [2, { brandList: brandList, entityList: entityList }];
424
430
  }
425
- throw new Error(ACCOUNT_NOT_AVAILABLE);
426
- case 6: return [4, sleep(interval * 1000)];
427
- case 7:
428
- _d.sent();
429
- _d.label = 8;
430
- case 8:
431
- count++;
432
- return [3, 1];
433
- case 9: throw new Error('paci_verification_failed');
431
+ if (auth.data.leadId) {
432
+ openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
433
+ return [2, { brandList: brandList, entityList: entityList }];
434
+ }
435
+ thunkApi.dispatch(handleNextScreenStep('AUTH_ACCOUNT_NOT_FOUND_STEP'));
436
+ return [2, { brandList: brandList, entityList: entityList }];
434
437
  }
435
438
  });
436
439
  }); });
437
- export var getMerchantList = createAsyncThunk('auth/getMerchantList', function (entityId) { return __awaiter(void 0, void 0, void 0, function () {
438
- var merchants;
440
+ export var getMerchantList = createAsyncThunk('auth/getMerchantList', function (entityId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
441
+ var settings, payload, merchants;
439
442
  return __generator(this, function (_a) {
440
443
  switch (_a.label) {
441
- case 0: return [4, API.entityService.getMerchantListUsingEntityId(entityId)];
444
+ case 0:
445
+ settings = thunkApi.getState().settings;
446
+ payload = {
447
+ business_entity_id: entityId,
448
+ create_if_not_present: true,
449
+ platforms: settings.data.appConfig.platforms
450
+ };
451
+ return [4, API.entityService.getMerchantListUsingEntityId(payload)];
442
452
  case 1:
443
453
  merchants = (_a.sent()).merchants;
444
454
  return [2, merchants || []];
@@ -487,6 +497,33 @@ export var confirmInfo = createAsyncThunk('auth/confirmInfo', function (_a, thun
487
497
  });
488
498
  });
489
499
  });
500
+ export var onSignUp = createAsyncThunk('auth/onSignUp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
501
+ var _a, auth, settings, authResponse, _b, appConfig, businessCountry, isMaturityExpress, publicKey, boardMaturity, merchantDomain, language, scope, postURL, body, data, redirectUrl;
502
+ var _c, _d, _e, _f;
503
+ return __generator(this, function (_g) {
504
+ switch (_g.label) {
505
+ case 0:
506
+ _a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
507
+ authResponse = ((_c = auth.data.responseData) !== null && _c !== void 0 ? _c : {}).authResponse;
508
+ _b = settings.data, appConfig = _b.appConfig, businessCountry = _b.businessCountry, isMaturityExpress = _b.isMaturityExpress;
509
+ publicKey = appConfig.publicKey, boardMaturity = appConfig.boardMaturity, merchantDomain = appConfig.merchantDomain, language = appConfig.language, scope = appConfig.scope, postURL = appConfig.postURL;
510
+ body = __assign({ board: true, public_key: publicKey, board_maturity: boardMaturity, domain: merchantDomain, language: language, country: businessCountry.iso2, scope: scope, lead_id: authResponse === null || authResponse === void 0 ? void 0 : authResponse.lead_id, maturity: !isMaturityExpress }, (postURL && {
511
+ post: {
512
+ url: postURL
513
+ }
514
+ }));
515
+ return [4, API.authService.generateConfigToken(body)];
516
+ case 1:
517
+ data = _g.sent();
518
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, data);
519
+ redirectUrl = (_f = data === null || data === void 0 ? void 0 : data.redirect) === null || _f === void 0 ? void 0 : _f.url;
520
+ if (!redirectUrl)
521
+ throw new Error('Internal server error');
522
+ window.open(redirectUrl, '_self');
523
+ return [2];
524
+ }
525
+ });
526
+ }); });
490
527
  var initialState = {
491
528
  error: null,
492
529
  loading: false,
@@ -612,12 +649,8 @@ export var authSlice = createSlice({
612
649
  .addCase(verifyMobileOtp.fulfilled, function (state, action) {
613
650
  var _a;
614
651
  state.loading = false;
615
- var _b = action.payload, data = _b.data, brandList = _b.brandList, entityList = _b.entityList;
616
- if (brandList === null || brandList === void 0 ? void 0 : brandList.length)
617
- state.data.authenticationData.brandInfo = brandList[0];
618
- if (entityList === null || entityList === void 0 ? void 0 : entityList.length)
619
- state.data.authenticationData.entityInfo = entityList[0];
620
- state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data), brandList: brandList, entityList: entityList });
652
+ var data = action.payload;
653
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
621
654
  })
622
655
  .addCase(verifyMobileOtp.rejected, function (state, action) {
623
656
  state.loading = false;
@@ -655,12 +688,8 @@ export var authSlice = createSlice({
655
688
  .addCase(verifyNIDOtp.fulfilled, function (state, action) {
656
689
  var _a;
657
690
  state.loading = false;
658
- var _b = action.payload, data = _b.data, brandList = _b.brandList, entityList = _b.entityList;
659
- if (brandList === null || brandList === void 0 ? void 0 : brandList.length)
660
- state.data.authenticationData.brandInfo = brandList[0];
661
- if (entityList === null || entityList === void 0 ? void 0 : entityList.length)
662
- state.data.authenticationData.entityInfo = entityList[0];
663
- state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data), brandList: brandList, entityList: entityList });
691
+ var data = action.payload;
692
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
664
693
  })
665
694
  .addCase(verifyNIDOtp.rejected, function (state, action) {
666
695
  state.loading = false;
@@ -687,14 +716,30 @@ export var authSlice = createSlice({
687
716
  .addCase(verifyPACI.fulfilled, function (state, action) {
688
717
  var _a;
689
718
  state.loading = false;
690
- var _b = action.payload, data = _b.data, brandList = _b.brandList, entityList = _b.entityList;
719
+ var data = action.payload;
720
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
721
+ })
722
+ .addCase(verifyPACI.rejected, function (state, action) {
723
+ state.loading = false;
724
+ var error = action.error.message;
725
+ if (error !== 'Aborted') {
726
+ state.error = error;
727
+ }
728
+ })
729
+ .addCase(checkAccountAvailability.pending, function (state) {
730
+ state.loading = true;
731
+ state.error = null;
732
+ })
733
+ .addCase(checkAccountAvailability.fulfilled, function (state, action) {
734
+ state.loading = false;
735
+ var _a = action.payload, brandList = _a.brandList, entityList = _a.entityList;
691
736
  if (brandList === null || brandList === void 0 ? void 0 : brandList.length)
692
737
  state.data.authenticationData.brandInfo = brandList[0];
693
738
  if (entityList === null || entityList === void 0 ? void 0 : entityList.length)
694
739
  state.data.authenticationData.entityInfo = entityList[0];
695
- state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data), brandList: brandList, entityList: entityList });
740
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { brandList: brandList, entityList: entityList });
696
741
  })
697
- .addCase(verifyPACI.rejected, function (state, action) {
742
+ .addCase(checkAccountAvailability.rejected, function (state, action) {
698
743
  state.loading = false;
699
744
  state.error = action.error.message;
700
745
  })
@@ -726,6 +771,18 @@ export var authSlice = createSlice({
726
771
  .addCase(confirmInfo.rejected, function (state, action) {
727
772
  state.loading = false;
728
773
  state.error = action.error.message;
774
+ })
775
+ .addCase(onSignUp.pending, function (state) {
776
+ state.loading = true;
777
+ state.error = null;
778
+ })
779
+ .addCase(onSignUp.fulfilled, function (state) {
780
+ state.loading = false;
781
+ state.error = null;
782
+ })
783
+ .addCase(onSignUp.rejected, function (state, action) {
784
+ state.loading = false;
785
+ state.error = action.error.message;
729
786
  });
730
787
  }
731
788
  });
@@ -53,13 +53,19 @@ import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/se
53
53
  import { BOARD_STEP_STEPS } from '../../../constants';
54
54
  import { retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var createVerifyTokenBy = createAsyncThunk('board/createVerifyTokenByBoardId', function (boardId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var settings, data, step_name;
56
+ var settings, isModeContent, payload, data, step_name;
57
57
  var _a, _b;
58
58
  return __generator(this, function (_c) {
59
59
  switch (_c.label) {
60
60
  case 0:
61
61
  settings = thunkApi.getState().settings;
62
- return [4, API.leadService.createVerifyTokenByBoardId(boardId)];
62
+ isModeContent = settings.data.appConfig.mode === 'content';
63
+ payload = __assign({ service_name: 'tap_email', board_id: boardId }, (isModeContent && {
64
+ notification: {
65
+ sms: false
66
+ }
67
+ }));
68
+ return [4, API.leadService.createVerifyTokenByBoardId(payload)];
63
69
  case 1:
64
70
  data = _c.sent();
65
71
  step_name = data.step_name;
@@ -213,11 +213,18 @@ export var retrieveAuthenticationListAsync = createAsyncThunk('connectExpress/re
213
213
  });
214
214
  });
215
215
  });
216
- export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (entityId) { return __awaiter(void 0, void 0, void 0, function () {
217
- var merchants;
216
+ export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (entityId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
217
+ var settings, payload, merchants;
218
218
  return __generator(this, function (_a) {
219
219
  switch (_a.label) {
220
- case 0: return [4, API.entityService.getMerchantListUsingEntityId(entityId)];
220
+ case 0:
221
+ settings = thunkApi.getState().settings;
222
+ payload = {
223
+ business_entity_id: entityId,
224
+ create_if_not_present: true,
225
+ platforms: settings.data.appConfig.platforms
226
+ };
227
+ return [4, API.entityService.getMerchantListUsingEntityId(payload)];
221
228
  case 1:
222
229
  merchants = (_a.sent()).merchants;
223
230
  return [2, merchants || []];
@@ -1315,7 +1322,10 @@ export var connectSlice = createSlice({
1315
1322
  })
1316
1323
  .addCase(verifyPACIAsync.rejected, function (state, action) {
1317
1324
  state.loading = false;
1318
- state.error = action.error.message;
1325
+ var error = action.error.message;
1326
+ if (error !== 'Aborted') {
1327
+ state.error = error;
1328
+ }
1319
1329
  })
1320
1330
  .addCase(verifyNIDOtpLeadIdentityAsync.pending, function (state) {
1321
1331
  state.loading = true;
@@ -1343,7 +1353,10 @@ export var connectSlice = createSlice({
1343
1353
  })
1344
1354
  .addCase(verifyPaciLeadIdentityAsync.rejected, function (state, action) {
1345
1355
  state.loading = false;
1346
- state.error = action.error.message;
1356
+ var error = action.error.message;
1357
+ if (error !== 'Aborted') {
1358
+ state.error = error;
1359
+ }
1347
1360
  })
1348
1361
  .addCase(retrieveEntityListAsync.pending, function (state) {
1349
1362
  state.loading = true;
@@ -3,6 +3,11 @@ import { LibConfig } from '../../@types';
3
3
  export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted'> {
4
4
  leadId?: string;
5
5
  hideOverlay?: boolean;
6
+ configToken?: string;
7
+ hideMerchantLogo?: boolean;
8
+ hideLoaderOverlay?: boolean;
9
+ openAnimationDirection?: 'left' | 'right' | 'up' | 'down';
10
+ closeAnimationDirection?: 'left' | 'right' | 'up' | 'down';
6
11
  }
7
12
  export declare function AuthElement(props: AuthLibProps): JSX.Element;
8
13
  export declare function renderAuthLib(config: AuthLibProps, elementId: string): {
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
+ };
12
48
  var __rest = (this && this.__rest) || function (s, e) {
13
49
  var t = {};
14
50
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -29,25 +65,38 @@ import AnimationFlow from '../../components/AnimationFlow';
29
65
  import { store } from '../../app/store';
30
66
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
31
67
  import Collapse from '../../components/Collapse';
32
- import { findOrCreateElementAndInject, sendPageView, isSA } from '../../utils';
68
+ import { findOrCreateElementAndInject, sendPageView, isSA, isTapDomain } from '../../utils';
33
69
  import { AUTH_SCREENS_NAVIGATION } from '../../constants';
34
70
  import Background from '../shared/Background';
35
71
  import { FeatureContainer } from '../shared/Containers';
36
72
  import { authSelector, setMobileCountryCode, setLeadId, retrieveLeadIdentityByIdAsync } from '../app/auth/authStore';
37
73
  import { authFeatureScreens } from '../featuresScreens';
38
74
  var Auth = memo(function (_a) {
39
- var leadId = _a.leadId, postURL = _a.postURL, hideOverlay = _a.hideOverlay, props = __rest(_a, ["leadId", "postURL", "hideOverlay"]);
75
+ var postURL = _a.postURL, hideOverlay = _a.hideOverlay, configToken = _a.configToken, hideMerchantLogo = _a.hideMerchantLogo, hideLoaderOverlay = _a.hideLoaderOverlay, openAnimationDirection = _a.openAnimationDirection, closeAnimationDirection = _a.closeAnimationDirection, props = __rest(_a, ["postURL", "hideOverlay", "configToken", "hideMerchantLogo", "hideLoaderOverlay", "openAnimationDirection", "closeAnimationDirection"]);
40
76
  var theme = useAppTheme().theme;
41
77
  var dispatch = useAppDispatch();
42
78
  var _b = useAppSelector(settingsSelector), settingData = _b.data, error = _b.error, settingLoading = _b.loading;
43
- var _c = useAppSelector(authSelector), authError = _c.error, loading = _c.loading, customLoading = _c.customLoading;
44
- useAppConfig(__assign({ postURL: postURL, navigation: AUTH_SCREENS_NAVIGATION }, props));
79
+ var _c = useAppSelector(authSelector), authError = _c.error, loading = _c.loading, customLoading = _c.customLoading, data = _c.data;
80
+ var leadId = data.leadId;
81
+ var onVerifyConfigTokenSuccess = function (data) { return __awaiter(void 0, void 0, void 0, function () {
82
+ var lead_id;
83
+ return __generator(this, function (_a) {
84
+ lead_id = (data || {}).lead_id;
85
+ if (lead_id) {
86
+ dispatch(setLeadId(lead_id));
87
+ }
88
+ return [2];
89
+ });
90
+ }); };
91
+ useAppConfig(__assign(__assign(__assign({ postURL: postURL, navigation: AUTH_SCREENS_NAVIGATION }, props), { configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
45
92
  useErrorListener(authError || error);
46
93
  useStepStartedListener();
47
94
  var activeScreen = settingData.activeScreen, isTapOrigin = settingData.isTapOrigin, open = settingData.open, merchant = settingData.merchant;
95
+ var animationDirection = open ? openAnimationDirection : closeAnimationDirection;
48
96
  React.useEffect(function () {
97
+ var _a;
49
98
  sendPageView({ title: 'Auth' });
50
- dispatch(setLeadId(leadId !== null && leadId !== void 0 ? leadId : ''));
99
+ dispatch(setLeadId((_a = props.leadId) !== null && _a !== void 0 ? _a : ''));
51
100
  }, []);
52
101
  React.useEffect(function () {
53
102
  var _a, _b;
@@ -59,7 +108,7 @@ var Auth = memo(function (_a) {
59
108
  }
60
109
  var iso2 = (_a = settingData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
61
110
  var ipIso2 = (_b = settingData.ipCountry) === null || _b === void 0 ? void 0 : _b.iso2;
62
- if (!iso2 && ipIso2) {
111
+ if (!iso2 && ipIso2 && settingData.appConfig.scope === 'auth') {
63
112
  dispatch(handleSetCountryByIso2(ipIso2));
64
113
  iso2 = ipIso2;
65
114
  }
@@ -77,7 +126,7 @@ var Auth = memo(function (_a) {
77
126
  dispatch(setMobileCountryCode(settingData.businessCountry));
78
127
  }
79
128
  }, [settingData.businessCountry]);
80
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ hideOverlay: hideOverlay, open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: !isTapOrigin }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: true }, { children: authFeatureScreens.map(function (_a, index) {
129
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ hideOverlay: hideOverlay, open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, hideLoaderOverlay: hideLoaderOverlay, screenId: activeScreen.name, hideFooter: true, hideMerchantLogo: hideMerchantLogo, merchantInfo: merchant, isMaturityExpress: !isTapDomain(props.merchantDomain), animationDirection: animationDirection }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: !isTapDomain(props.merchantDomain) }, { children: authFeatureScreens.map(function (_a, index) {
81
130
  var Element = _a.element, name = _a.name;
82
131
  var isActive = activeScreen.name === name;
83
132
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface AccountNotFoundProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: AccountNotFoundProps) => JSX.Element>;
5
+ export default _default;