@tap-payments/auth-jsconnect 2.6.57-test → 2.6.60-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 (118) hide show
  1. package/build/@types/app.d.ts +3 -1
  2. package/build/@types/app.js +1 -1
  3. package/build/api/account.d.ts +1 -0
  4. package/build/api/account.js +8 -1
  5. package/build/api/auth.d.ts +2 -0
  6. package/build/api/index.d.ts +4 -3
  7. package/build/api/lead.d.ts +3 -0
  8. package/build/api/operator.d.ts +3 -2
  9. package/build/api/operator.js +2 -2
  10. package/build/app/rootReducer.d.ts +1 -0
  11. package/build/app/rootReducer.js +2 -0
  12. package/build/app/settings.js +3 -2
  13. package/build/app/store.d.ts +2 -0
  14. package/build/assets/locales/ar.json +2 -1
  15. package/build/assets/locales/en.json +2 -1
  16. package/build/constants/app.d.ts +11 -0
  17. package/build/constants/app.js +54 -0
  18. package/build/features/app/auth/authStore.d.ts +189 -0
  19. package/build/features/app/auth/authStore.js +726 -0
  20. package/build/features/app/bank/bankStore.js +5 -4
  21. package/build/features/app/brand/brandStore.js +5 -4
  22. package/build/features/app/business/businessStore.js +37 -28
  23. package/build/features/app/connectExpress/connectExpressStore.js +3 -2
  24. package/build/features/app/entity/entityStore.js +5 -4
  25. package/build/features/app/individual/individualStore.js +5 -4
  26. package/build/features/app/tax/taxStore.js +5 -4
  27. package/build/features/auth/Auth.d.ts +9 -0
  28. package/build/features/auth/Auth.js +93 -0
  29. package/build/features/auth/index.d.ts +1 -0
  30. package/build/features/auth/index.js +1 -0
  31. package/build/features/auth/screens/AuthenticationList/AuthenticationList.d.ts +5 -0
  32. package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +91 -0
  33. package/build/features/auth/screens/AuthenticationList/BrandList.d.ts +10 -0
  34. package/build/features/auth/screens/AuthenticationList/BrandList.js +81 -0
  35. package/build/features/auth/screens/AuthenticationList/EntityList.d.ts +11 -0
  36. package/build/features/auth/screens/AuthenticationList/EntityList.js +96 -0
  37. package/build/features/auth/screens/AuthenticationList/MerchantList.d.ts +10 -0
  38. package/build/features/auth/screens/AuthenticationList/MerchantList.js +107 -0
  39. package/build/features/auth/screens/AuthenticationList/index.d.ts +3 -0
  40. package/build/features/auth/screens/AuthenticationList/index.js +2 -0
  41. package/build/features/auth/screens/AuthenticationList/validation.d.ts +14 -0
  42. package/build/features/auth/screens/AuthenticationList/validation.js +8 -0
  43. package/build/features/auth/screens/BusinessCountry/BusinessCountry.d.ts +5 -0
  44. package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +105 -0
  45. package/build/features/auth/screens/BusinessCountry/index.d.ts +3 -0
  46. package/build/features/auth/screens/BusinessCountry/index.js +2 -0
  47. package/build/features/auth/screens/CivilID/CivilID.d.ts +5 -0
  48. package/build/features/auth/screens/CivilID/CivilID.js +88 -0
  49. package/build/features/auth/screens/CivilID/IDNumber.d.ts +8 -0
  50. package/build/features/auth/screens/CivilID/IDNumber.js +54 -0
  51. package/build/features/auth/screens/CivilID/index.d.ts +3 -0
  52. package/build/features/auth/screens/CivilID/index.js +2 -0
  53. package/build/features/auth/screens/CivilID/validation.d.ts +8 -0
  54. package/build/features/auth/screens/CivilID/validation.js +4 -0
  55. package/build/features/auth/screens/Mobile/Mobile.d.ts +5 -0
  56. package/build/features/auth/screens/Mobile/Mobile.js +108 -0
  57. package/build/features/auth/screens/Mobile/MobileNumber.d.ts +13 -0
  58. package/build/features/auth/screens/Mobile/MobileNumber.js +158 -0
  59. package/build/features/auth/screens/Mobile/index.d.ts +3 -0
  60. package/build/features/auth/screens/Mobile/index.js +2 -0
  61. package/build/features/auth/screens/Mobile/validation.d.ts +8 -0
  62. package/build/features/auth/screens/Mobile/validation.js +30 -0
  63. package/build/features/auth/screens/NID/DOB.d.ts +6 -0
  64. package/build/features/auth/screens/NID/DOB.js +47 -0
  65. package/build/features/auth/screens/NID/IDNumber.d.ts +7 -0
  66. package/build/features/auth/screens/NID/IDNumber.js +55 -0
  67. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  68. package/build/features/auth/screens/NID/NID.js +92 -0
  69. package/build/features/auth/screens/NID/index.d.ts +3 -0
  70. package/build/features/auth/screens/NID/index.js +2 -0
  71. package/build/features/auth/screens/NID/validation.d.ts +11 -0
  72. package/build/features/auth/screens/NID/validation.js +11 -0
  73. package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
  74. package/build/features/auth/screens/OTP/OTP.js +88 -0
  75. package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
  76. package/build/features/auth/screens/OTP/OTPInput.js +57 -0
  77. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  78. package/build/features/auth/screens/OTP/index.js +2 -0
  79. package/build/features/auth/screens/OTP/validation.d.ts +8 -0
  80. package/build/features/auth/screens/OTP/validation.js +4 -0
  81. package/build/features/auth/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  82. package/build/features/auth/screens/VerifyPACI/VerifyPACI.js +34 -0
  83. package/build/features/auth/screens/VerifyPACI/index.d.ts +3 -0
  84. package/build/features/auth/screens/VerifyPACI/index.js +2 -0
  85. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +6 -33
  86. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +4 -17
  87. package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -7
  88. package/build/features/business/screens/BusinessType/LicenseType.d.ts +4 -26
  89. package/build/features/business/screens/Customers/CustomerLocations.d.ts +6 -33
  90. package/build/features/business/screens/Customers/RefundPolicy.d.ts +4 -17
  91. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +4 -26
  92. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +2 -7
  93. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +2 -2
  94. package/build/features/connectExpress/screens/NID/TAC.d.ts +2 -7
  95. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +6 -33
  96. package/build/features/featuresScreens.d.ts +1 -0
  97. package/build/features/featuresScreens.js +40 -3
  98. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +4 -26
  99. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +4 -26
  100. package/build/features/shared/Address/CountryList.d.ts +5 -21
  101. package/build/features/shared/Address/InputSelect.d.ts +5 -21
  102. package/build/features/shared/Background/Background.d.ts +2 -1
  103. package/build/features/shared/Background/Background.js +5 -5
  104. package/build/features/shared/Input/Input.d.ts +1 -1
  105. package/build/features/shared/UploadFile/FileUpload.d.ts +2 -7
  106. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -7
  107. package/build/features/shared/UploadFile/UploadWrapper.d.ts +2 -7
  108. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -7
  109. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -7
  110. package/build/hooks/useAppDispatch.d.ts +1 -0
  111. package/build/index.d.ts +3 -2
  112. package/build/index.js +3 -1
  113. package/build/utils/common.d.ts +1 -0
  114. package/build/utils/common.js +8 -1
  115. package/build/utils/string.d.ts +1 -0
  116. package/build/utils/string.js +3 -0
  117. package/build/utils/validation.js +2 -1
  118. package/package.json +1 -1
@@ -60,10 +60,11 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
60
60
  return __generator(this, function (_k) {
61
61
  switch (_k.label) {
62
62
  case 0:
63
- payload = {
64
- service_name: 'tap_email',
65
- verify_token: token
66
- };
63
+ payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
+ notification: {
65
+ sms: false
66
+ }
67
+ }));
67
68
  return [4, API.leadService.verifyLeadToken(payload)];
68
69
  case 1:
69
70
  data = (_k.sent()).data;
@@ -71,10 +71,11 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
71
71
  return __generator(this, function (_j) {
72
72
  switch (_j.label) {
73
73
  case 0:
74
- payload = {
75
- service_name: 'tap_email',
76
- verify_token: token
77
- };
74
+ payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
75
+ notification: {
76
+ sms: false
77
+ }
78
+ }));
78
79
  return [4, API.leadService.verifyLeadToken(payload)];
79
80
  case 1:
80
81
  data = (_j.sent()).data;
@@ -501,10 +501,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
501
501
  });
502
502
  }); });
503
503
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
504
- var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, brandData, brandRes, _c, message, error, list, documentData, entityData, entityId, documentBody, payload_1;
505
- var _d, _e;
506
- return __generator(this, function (_f) {
507
- switch (_f.label) {
504
+ var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, brandData, data_1, brandRes, _c, message, error, list, documentData, entityData, entityId, documentBody, payload_1;
505
+ var _d, _e, _f;
506
+ return __generator(this, function (_g) {
507
+ switch (_g.label) {
508
508
  case 0:
509
509
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
510
510
  isKWCountry = isKW(settings.data.businessCountry.iso2);
@@ -523,7 +523,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
523
523
  })), { encryption_contract: ['license_number', 'business_type', 'license_type'] });
524
524
  return [4, API.leadService.updateLead(payload)];
525
525
  case 1:
526
- data = _f.sent();
526
+ data = _g.sent();
527
527
  accountBody = {
528
528
  lead_id: lead_id,
529
529
  notify: {
@@ -535,20 +535,29 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
535
535
  step_name: BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM
536
536
  };
537
537
  brandData = undefined;
538
- _f.label = 2;
538
+ _g.label = 2;
539
539
  case 2:
540
- _f.trys.push([2, 5, , 6]);
540
+ _g.trys.push([2, 7, , 8]);
541
541
  return [4, API.accountService.createAccount(accountBody)];
542
542
  case 3:
543
- accountData = _f.sent();
543
+ accountData = _g.sent();
544
+ if (!!(accountData === null || accountData === void 0 ? void 0 : accountData.entity_id)) return [3, 5];
545
+ return [4, API.leadService.retrieveLead(lead_id)];
546
+ case 4:
547
+ data_1 = (_g.sent()).data;
548
+ if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.id))
549
+ throw new Error('Internal server error');
550
+ accountData = __assign(__assign({}, accountData), { entity_id: data_1.entity.id });
551
+ _g.label = 5;
552
+ case 5:
544
553
  thunkApi.dispatch(updateStepName(BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM));
545
554
  return [4, API.brandService.retrieveBrand(brand === null || brand === void 0 ? void 0 : brand.id)];
546
- case 4:
547
- brandRes = (_f.sent()).brand;
555
+ case 6:
556
+ brandRes = (_g.sent()).brand;
548
557
  brandData = brandRes;
549
- return [3, 6];
550
- case 5:
551
- _c = _f.sent();
558
+ return [3, 8];
559
+ case 7:
560
+ _c = _g.sent();
552
561
  message = _c.message;
553
562
  error = message;
554
563
  if ((error === null || error === void 0 ? void 0 : error.toLowerCase()) === 'entity with license already exist') {
@@ -556,13 +565,13 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
556
565
  }
557
566
  else
558
567
  throw new Error(error);
559
- return [3, 6];
560
- case 6: return [4, API.dataService.getActivitiesIsIc()];
561
- case 7:
562
- list = (_f.sent()).list;
568
+ return [3, 8];
569
+ case 8: return [4, API.dataService.getActivitiesIsIc()];
570
+ case 9:
571
+ list = (_g.sent()).list;
563
572
  entityData = undefined;
564
573
  entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
565
- if (!((certificateId || []).length > 0)) return [3, 9];
574
+ if (!((certificateId || []).length > 0)) return [3, 11];
566
575
  documentBody = {
567
576
  entity_id: entityId || '',
568
577
  documents: [
@@ -573,22 +582,22 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
573
582
  ]
574
583
  };
575
584
  return [4, API.documentService.updateDocumentInfo(documentBody)];
576
- case 8:
577
- documentData = _f.sent();
578
- _f.label = 9;
579
- case 9:
580
- if (!(articleId && entityId)) return [3, 11];
585
+ case 10:
586
+ documentData = _g.sent();
587
+ _g.label = 11;
588
+ case 11:
589
+ if (!(articleId && entityId)) return [3, 13];
581
590
  payload_1 = {
582
591
  id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
583
592
  AOA_file_id: articleId
584
593
  };
585
594
  return [4, API.entityService.updateEntity(payload_1)];
586
- case 10:
587
- entityData = _f.sent();
588
- _f.label = 11;
589
- case 11:
595
+ case 12:
596
+ entityData = _g.sent();
597
+ _g.label = 13;
598
+ case 13:
590
599
  thunkApi.dispatch(handleNextScreenStep(stepName));
591
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
600
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
592
601
  return [2, { data: __assign(__assign({}, data), { brand: brandData }), formData: params, accountData: accountData, documentData: documentData, entityData: entityData, isicActivityList: list || [] }];
593
602
  }
594
603
  });
@@ -976,9 +976,10 @@ export var updateOperatorInfoAsync = createAsyncThunk('connectExpress/updateOper
976
976
  bi: bi,
977
977
  brand_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id) || '',
978
978
  merchant_id: (merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.id) || '',
979
- entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || ''
979
+ entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || '',
980
+ data: settings.data.appConfig.data || []
980
981
  };
981
- return [4, API.operatorService.updateOperator(body)];
982
+ return [4, API.operatorService.confirm(body)];
982
983
  case 1:
983
984
  data = _h.sent();
984
985
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, data);
@@ -72,10 +72,11 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
72
72
  return __generator(this, function (_l) {
73
73
  switch (_l.label) {
74
74
  case 0:
75
- payload = {
76
- service_name: 'tap_email',
77
- verify_token: token
78
- };
75
+ payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
76
+ notification: {
77
+ sms: false
78
+ }
79
+ }));
79
80
  return [4, API.leadService.verifyLeadToken(payload)];
80
81
  case 1:
81
82
  data = (_l.sent()).data;
@@ -80,10 +80,11 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
80
80
  return __generator(this, function (_m) {
81
81
  switch (_m.label) {
82
82
  case 0:
83
- payload = {
84
- service_name: 'tap_email',
85
- verify_token: token
86
- };
83
+ payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
84
+ notification: {
85
+ sms: false
86
+ }
87
+ }));
87
88
  settings = thunkApi.getState().settings;
88
89
  return [4, API.leadService.verifyLeadToken(payload)];
89
90
  case 1:
@@ -60,10 +60,11 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
60
60
  return __generator(this, function (_j) {
61
61
  switch (_j.label) {
62
62
  case 0:
63
- payload = {
64
- service_name: 'tap_email',
65
- verify_token: token
66
- };
63
+ payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
+ notification: {
65
+ sms: false
66
+ }
67
+ }));
67
68
  return [4, API.leadService.verifyLeadToken(payload)];
68
69
  case 1:
69
70
  data = (_j.sent()).data;
@@ -0,0 +1,9 @@
1
+ import { LibConfig } from '../../@types';
2
+ export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted'> {
3
+ leadId?: string;
4
+ hideOverlay?: boolean;
5
+ }
6
+ export declare function AuthElement(props: AuthLibProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function renderAuthLib(config: AuthLibProps, elementId: string): {
8
+ unmount: () => void;
9
+ };
@@ -0,0 +1,93 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import React, { memo } from 'react';
25
+ import { createRoot } from 'react-dom/client';
26
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
27
+ import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
28
+ import AnimationFlow from '../../components/AnimationFlow';
29
+ import { store } from '../../app/store';
30
+ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
31
+ import Collapse from '../../components/Collapse';
32
+ import { findOrCreateElementAndInject, sendPageView, isSA } from '../../utils';
33
+ import { AUTH_SCREENS_NAVIGATION } from '../../constants';
34
+ import Background from '../shared/Background';
35
+ import { FeatureContainer } from '../shared/Containers';
36
+ import { authSelector, setMobileCountryCode, setLeadId, retrieveLeadIdentityByIdAsync } from '../app/auth/authStore';
37
+ import { authFeatureScreens } from '../featuresScreens';
38
+ var Auth = memo(function (_a) {
39
+ var leadId = _a.leadId, postURL = _a.postURL, hideOverlay = _a.hideOverlay, props = __rest(_a, ["leadId", "postURL", "hideOverlay"]);
40
+ var theme = useAppTheme().theme;
41
+ var dispatch = useAppDispatch();
42
+ 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));
45
+ useErrorListener(authError || error);
46
+ useStepStartedListener();
47
+ var activeScreen = settingData.activeScreen, isTapOrigin = settingData.isTapOrigin, open = settingData.open, merchant = settingData.merchant;
48
+ React.useEffect(function () {
49
+ sendPageView({ title: 'Auth' });
50
+ dispatch(setLeadId(leadId !== null && leadId !== void 0 ? leadId : ''));
51
+ }, []);
52
+ React.useEffect(function () {
53
+ if (leadId) {
54
+ dispatch(retrieveLeadIdentityByIdAsync(leadId));
55
+ }
56
+ }, [leadId]);
57
+ React.useEffect(function () {
58
+ var _a;
59
+ if (settingLoading || !props.open || !settingData.isValidOperator)
60
+ return;
61
+ if (leadId)
62
+ return;
63
+ var iso2 = (_a = settingData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
64
+ if (!iso2) {
65
+ dispatch(handleCurrentActiveScreen('AUTH_BUSINESS_COUNTRY_STEP'));
66
+ return;
67
+ }
68
+ if (iso2 && !isSA(iso2)) {
69
+ dispatch(handleCurrentActiveScreen('AUTH_MOBILE_STEP'));
70
+ }
71
+ }, [settingData.isValidOperator, settingLoading]);
72
+ React.useEffect(function () {
73
+ var _a;
74
+ if (!!((_a = settingData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
75
+ dispatch(setMobileCountryCode(settingData.businessCountry));
76
+ }
77
+ }, [settingData.businessCountry]);
78
+ 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) {
79
+ var Element = _a.element, name = _a.name;
80
+ var isActive = activeScreen.name === name;
81
+ return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
82
+ }) })) })) })) })));
83
+ });
84
+ export function AuthElement(props) {
85
+ return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Auth, __assign({}, props)) })));
86
+ }
87
+ export function renderAuthLib(config, elementId) {
88
+ var el = findOrCreateElementAndInject(elementId);
89
+ var root = createRoot(el);
90
+ root.render(_jsx(AuthElement, __assign({}, config)));
91
+ var unmount = function () { return root.unmount(); };
92
+ return { unmount: unmount };
93
+ }
@@ -0,0 +1 @@
1
+ export * from './Auth';
@@ -0,0 +1 @@
1
+ export * from './Auth';
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface AuthenticationListProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: AuthenticationListProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,91 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useForm, FormProvider } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
16
+ import Collapse from '@mui/material/Collapse';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
+ import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
21
+ import { AuthForType } from '../../../../@types';
22
+ import Form from '../../../../components/Form';
23
+ import { ScreenContainer } from '../../../shared/Containers';
24
+ import Button from '../../../shared/Button';
25
+ import { clearError, authSelector, confirmInfo } from '../../../app/auth/authStore';
26
+ import { AuthenticationListValidationSchema } from './validation';
27
+ import BrandList from './BrandList';
28
+ import EntityList from './EntityList';
29
+ import MerchantList from './MerchantList';
30
+ var ListType;
31
+ (function (ListType) {
32
+ ListType["BrandList"] = "BrandList";
33
+ ListType["EntityList"] = "EntityList";
34
+ ListType["MerchantList"] = "MerchantList";
35
+ })(ListType || (ListType = {}));
36
+ var AuthenticationList = function (_a) {
37
+ var settingsData = useAppSelector(settingsSelector).data;
38
+ var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error, merchantLoading = _b.merchantLoading, terminalLoading = _b.terminalLoading;
39
+ var _c = data.authenticationData, brandInfo = _c.brandInfo, entityInfo = _c.entityInfo, merchantInfo = _c.merchantInfo;
40
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
41
+ var _e = data.responseData || {}, brandList = _e.brandList, entityList = _e.entityList;
42
+ var otpData = data.otpData;
43
+ var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
44
+ React.useEffect(function () {
45
+ sendCustomEventToGTM({
46
+ event: 'Send Event',
47
+ event_category: 'User Authentication Flow',
48
+ event_action: 'Authentication List Step'
49
+ });
50
+ }, []);
51
+ var methods = useForm({
52
+ resolver: yupResolver(AuthenticationListValidationSchema()),
53
+ defaultValues: {
54
+ brandInfo: brandInfo,
55
+ entityInfo: entityInfo,
56
+ merchantInfo: merchantInfo
57
+ },
58
+ mode: 'onChange'
59
+ });
60
+ var t = useTranslation().t;
61
+ var isAr = useLanguage().isAr;
62
+ var dispatch = useAppDispatch();
63
+ var onSubmit = function (formData) {
64
+ dispatch(confirmInfo(deepCopy(formData)));
65
+ };
66
+ var onBack = function () {
67
+ var _a;
68
+ var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
69
+ var screen = startWithNID ? (isKW(code) ? 'AUTH_CIVIL_ID_STEP' : 'AUTH_NID_STEP') : 'AUTH_MOBILE_STEP';
70
+ dispatch(handlePrevScreenStep(screen));
71
+ };
72
+ React.useEffect(function () {
73
+ if (merchantInfo && !methods.getValues('merchantInfo'))
74
+ methods.setValue('merchantInfo', merchantInfo, { shouldValidate: true });
75
+ }, [merchantInfo]);
76
+ React.useEffect(function () {
77
+ if (error)
78
+ dispatch(clearError());
79
+ }, [methods.formState.isValid]);
80
+ var disabled = !methods.formState.isValid || merchantLoading || terminalLoading;
81
+ var handleMenuClick = function (flag) {
82
+ if (error)
83
+ dispatch(clearError());
84
+ setListActive(flag);
85
+ };
86
+ var isBrandList = listActive === ListType.BrandList;
87
+ var isEntityList = listActive === ListType.EntityList;
88
+ var isMerchantList = listActive === ListType.MerchantList;
89
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isEntityList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { list: entityList || [], countryList: settingsData.countries || [], show: !isBrandList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(MerchantList, { show: !isBrandList && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.MerchantList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
90
+ };
91
+ export default React.memo(AuthenticationList);
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { BrandInfo } from '../../../../@types';
3
+ interface BrandListProps {
4
+ show: boolean;
5
+ list: Array<BrandInfo>;
6
+ onListOpen?: () => void;
7
+ onListClose?: () => void;
8
+ }
9
+ declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => import("react/jsx-runtime").JSX.Element>;
10
+ export default _default;
@@ -0,0 +1,81 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import { useTranslation } from 'react-i18next';
26
+ import { useFormContext, useController } from 'react-hook-form';
27
+ import Box from '@mui/material/Box';
28
+ import { styled } from '@mui/material/styles';
29
+ import { useLanguage } from '../../../../hooks';
30
+ import SimpleList from '../../../../components/SimpleList';
31
+ import Text from '../../../../components/Text';
32
+ import ExpandIcon from '../../../../components/ExpandIcon';
33
+ import Collapse from '../../../../components/Collapse';
34
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
35
+ import InputSelect from '../../../shared/InputSelect';
36
+ import CheckIcon from '../../../shared/CheckIcon';
37
+ var BrandContainer = styled(Box)(function () { return ({
38
+ display: 'flex'
39
+ }); });
40
+ var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
41
+ var theme = _a.theme, isSelected = _a.isSelected;
42
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
43
+ });
44
+ var BrandList = function (_a) {
45
+ var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
46
+ var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
47
+ var t = useTranslation().t;
48
+ var isAr = useLanguage().isAr;
49
+ var control = useFormContext().control;
50
+ var brandInfoControl = useController({ control: control, name: 'brandInfo' });
51
+ var brandInfo = brandInfoControl.field.value;
52
+ var onOpenBrandList = function (event) {
53
+ var _a;
54
+ setAnchorEl(event.currentTarget);
55
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
56
+ };
57
+ var onCloseBrandList = function () {
58
+ var _a;
59
+ setAnchorEl(null);
60
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
61
+ };
62
+ var getBrandName = function (brand) {
63
+ var _a, _b;
64
+ if (!brand)
65
+ return '';
66
+ return (isAr ? (_a = brand.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = brand.name) === null || _b === void 0 ? void 0 : _b.en) || '';
67
+ };
68
+ var getBrandId = function (brand) {
69
+ if (!brand)
70
+ return '';
71
+ return brand.id || '';
72
+ };
73
+ var onSelectItem = function (brand) {
74
+ brandInfoControl.field.onChange(brand);
75
+ onCloseBrandList();
76
+ };
77
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputSelect, { label: t('select_brand_label'), onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(brandInfo)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (item) {
78
+ return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(brandInfo) }, { children: t(getBrandName(item)) })) }), getBrandId(item) === getBrandId(brandInfo) && _jsx(CheckIcon, {})] }));
79
+ } }) }))] }) })));
80
+ };
81
+ export default React.memo(BrandList);
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { CountryCode, EntityLicenseAuth } from '../../../../@types';
3
+ interface EntityListProps {
4
+ show: boolean;
5
+ list: Array<EntityLicenseAuth>;
6
+ countryList: Array<CountryCode>;
7
+ onListOpen?: () => void;
8
+ onListClose?: () => void;
9
+ }
10
+ declare const _default: React.MemoExoticComponent<({ show, list, countryList, ...rest }: EntityListProps) => import("react/jsx-runtime").JSX.Element>;
11
+ export default _default;
@@ -0,0 +1,96 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import { useTranslation } from 'react-i18next';
26
+ import { useFormContext, useController } from 'react-hook-form';
27
+ import Box from '@mui/material/Box';
28
+ import { styled } from '@mui/material/styles';
29
+ import { useLanguage } from '../../../../hooks';
30
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
31
+ import InputSelect from '../../../shared/InputSelect';
32
+ import CheckIcon from '../../../shared/CheckIcon';
33
+ import SimpleList from '../../../../components/SimpleList';
34
+ import Text from '../../../../components/Text';
35
+ import ExpandIcon from '../../../../components/ExpandIcon';
36
+ import Collapse from '../../../../components/Collapse';
37
+ import Icon from '../../../../components/Icon';
38
+ var EntityContainer = styled(Box)(function () { return ({
39
+ display: 'flex',
40
+ alignItems: 'center'
41
+ }); });
42
+ var EntityCountryFlag = styled(Icon)(function (_a) {
43
+ var theme = _a.theme;
44
+ return ({
45
+ display: 'flex',
46
+ marginInlineEnd: theme.spacing(1.25)
47
+ });
48
+ });
49
+ var EntityNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
50
+ var theme = _a.theme, isSelected = _a.isSelected;
51
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
52
+ });
53
+ var EntityList = function (_a) {
54
+ var show = _a.show, list = _a.list, countryList = _a.countryList, rest = __rest(_a, ["show", "list", "countryList"]);
55
+ var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
56
+ var t = useTranslation().t;
57
+ var isAr = useLanguage().isAr;
58
+ var control = useFormContext().control;
59
+ var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
60
+ var selectedEntity = selectedEntityControl.field.value;
61
+ var onOpenEntityList = function (event) {
62
+ var _a;
63
+ setAnchorEl(event.currentTarget);
64
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
65
+ };
66
+ var onCloseEntityList = function () {
67
+ var _a;
68
+ setAnchorEl(null);
69
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
70
+ };
71
+ var getLegalName = function (entity) {
72
+ var _a, _b;
73
+ if (!entity)
74
+ return '';
75
+ return (isAr ? (_a = entity.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = entity.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
76
+ };
77
+ var getEntityId = function (entity) {
78
+ if (!entity)
79
+ return '';
80
+ return entity.id || '';
81
+ };
82
+ var getCountryFlag = function (entity) {
83
+ var _a;
84
+ if (!entity)
85
+ return '';
86
+ return ((_a = countryList.find(function (country) { return country.iso2.toLocaleLowerCase() === entity.country.toLocaleLowerCase(); })) === null || _a === void 0 ? void 0 : _a.logo) || '';
87
+ };
88
+ var onSelectItem = function (brand) {
89
+ selectedEntityControl.field.onChange(brand);
90
+ onCloseEntityList();
91
+ };
92
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_entity_label'), onClick: !!anchorEl ? onCloseEntityList : onOpenEntityList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('select_entity_placeholder'), value: t(getLegalName(selectedEntity)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (entity) {
93
+ return (_jsxs(_Fragment, { children: [_jsxs(EntityContainer, { children: [_jsx(EntityCountryFlag, { src: getCountryFlag(entity) }), _jsx(EntityNameText, __assign({ isSelected: getEntityId(entity) === getEntityId(selectedEntity) }, { children: t(getLegalName(entity)) }))] }), getEntityId(entity) === getEntityId(selectedEntity) && _jsx(CheckIcon, {})] }));
94
+ } }) }))] })) })));
95
+ };
96
+ export default React.memo(EntityList);
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ interface MerchantListProps {
3
+ show: boolean;
4
+ onListOpen?: () => void;
5
+ onListClose?: () => void;
6
+ readOnly?: boolean;
7
+ isVerified?: boolean;
8
+ }
9
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MerchantListProps & React.RefAttributes<unknown>>>;
10
+ export default _default;