@tap-payments/auth-jsconnect 2.0.49-test → 2.0.50-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 (80) hide show
  1. package/build/@types/app.d.ts +6 -4
  2. package/build/@types/app.js +2 -2
  3. package/build/@types/form.d.ts +3 -0
  4. package/build/api/auth.d.ts +6 -1
  5. package/build/api/auth.js +16 -1
  6. package/build/api/data.d.ts +4 -1
  7. package/build/api/data.js +6 -2
  8. package/build/api/index.d.ts +4 -1
  9. package/build/assets/locales/ar.json +7 -1
  10. package/build/assets/locales/en.json +7 -1
  11. package/build/components/AnimationFlow/AnimationFlow.js +3 -5
  12. package/build/components/AnimationFlow/BottomSheet.js +2 -1
  13. package/build/components/AnimationFlow/Dialog.d.ts +1 -1
  14. package/build/components/AnimationFlow/Dialog.js +2 -2
  15. package/build/components/FileInput/DragAndDrop.d.ts +9 -1
  16. package/build/components/FileInput/DragAndDrop.js +113 -8
  17. package/build/components/Lottie/Lottie.d.ts +220 -0
  18. package/build/components/Lottie/Lottie.js +56 -0
  19. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  20. package/build/components/Lottie/index.d.ts +3 -0
  21. package/build/components/Lottie/index.js +3 -0
  22. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  23. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  24. package/build/components/ProgressBar/index.d.ts +2 -0
  25. package/build/components/ProgressBar/index.js +2 -0
  26. package/build/constants/api.js +1 -1
  27. package/build/constants/app.d.ts +1 -0
  28. package/build/constants/app.js +16 -3
  29. package/build/constants/assets.d.ts +7 -0
  30. package/build/constants/assets.js +7 -0
  31. package/build/constants/validation.d.ts +1 -0
  32. package/build/constants/validation.js +1 -0
  33. package/build/features/app/bank/bankStore.d.ts +4 -0
  34. package/build/features/app/bank/bankStore.js +42 -22
  35. package/build/features/app/business/businessStore.js +16 -12
  36. package/build/features/app/connect/connectStore.d.ts +9 -1
  37. package/build/features/app/connect/connectStore.js +115 -13
  38. package/build/features/app/entity/entityStore.js +13 -9
  39. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
  40. package/build/features/bank/screens/BankDetails/BankStatement.js +33 -8
  41. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  42. package/build/features/business/screens/Activities/SalesChannels.js +1 -1
  43. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  44. package/build/features/connect/Connect.js +11 -5
  45. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  46. package/build/features/connect/screens/CivilID/CivilID.js +85 -0
  47. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  48. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  49. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  50. package/build/features/connect/screens/CivilID/index.js +2 -0
  51. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  52. package/build/features/connect/screens/CivilID/validation.js +4 -0
  53. package/build/features/connect/screens/Individual/Individual.js +5 -2
  54. package/build/features/connect/screens/Merchant/Merchant.js +7 -4
  55. package/build/features/connect/screens/Merchant/SalesChannels.js +1 -1
  56. package/build/features/connect/screens/Merchant/SocialMedia.js +7 -7
  57. package/build/features/connect/screens/Mobile/Mobile.js +7 -4
  58. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  59. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +118 -0
  60. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  61. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  62. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +1 -1
  63. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +1 -1
  64. package/build/features/featuresScreens.js +10 -0
  65. package/build/features/shared/Background/Background.d.ts +2 -5
  66. package/build/features/shared/Background/Background.js +6 -4
  67. package/build/features/shared/Input/Input.d.ts +1 -1
  68. package/build/features/shared/Input/Input.js +2 -2
  69. package/build/features/shared/UploadFile/UploadFile.d.ts +8 -3
  70. package/build/features/shared/UploadFile/UploadFile.js +23 -8
  71. package/build/hooks/index.d.ts +1 -0
  72. package/build/hooks/index.js +1 -0
  73. package/build/hooks/useScreen.d.ts +3 -0
  74. package/build/hooks/useScreen.js +14 -0
  75. package/build/utils/device.d.ts +1 -0
  76. package/build/utils/device.js +13 -0
  77. package/build/utils/locale.js +1 -1
  78. package/build/utils/string.d.ts +2 -0
  79. package/build/utils/string.js +9 -0
  80. package/package.json +2 -1
@@ -302,12 +302,16 @@ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', fun
302
302
  });
303
303
  }); });
304
304
  export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
305
- var data;
305
+ var body, data;
306
306
  return __generator(this, function (_a) {
307
307
  switch (_a.label) {
308
- case 0: return [4, API.dataService.getChannelsOfServices()];
308
+ case 0:
309
+ body = {
310
+ page: 0
311
+ };
312
+ return [4, API.dataService.getChannelsOfServices(body)];
309
313
  case 1:
310
- data = (_a.sent()).data;
314
+ data = _a.sent();
311
315
  return [2, data];
312
316
  }
313
317
  });
@@ -609,8 +613,8 @@ export var businessSlice = createSlice({
609
613
  var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
610
614
  var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
611
615
  var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
612
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
613
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
616
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
617
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
614
618
  if (isHasWebsite && (isHasTwitter || isHasInstagram))
615
619
  selectedChannels = [websiteData, socialData];
616
620
  else if (isHasTwitter || isHasInstagram)
@@ -620,7 +624,7 @@ export var businessSlice = createSlice({
620
624
  if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
621
625
  selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
622
626
  var _a;
623
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
627
+ return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.id === storedChannel; });
624
628
  });
625
629
  }
626
630
  state.data.activitiesData.salesChannels = selectedChannels;
@@ -700,8 +704,8 @@ export var businessSlice = createSlice({
700
704
  var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
701
705
  var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
702
706
  var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
703
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
704
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
707
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
708
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
705
709
  if (isHasWebsite && (isHasTwitter || isHasInstagram))
706
710
  selectedChannels = [websiteData, socialData];
707
711
  else if (isHasTwitter || isHasInstagram)
@@ -711,7 +715,7 @@ export var businessSlice = createSlice({
711
715
  if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
712
716
  selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
713
717
  var _a;
714
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
718
+ return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name.en.toLowerCase() === storedChannel.toLowerCase(); });
715
719
  });
716
720
  }
717
721
  state.data.activitiesData.salesChannels = selectedChannels;
@@ -851,7 +855,7 @@ export var businessSlice = createSlice({
851
855
  state.error = description;
852
856
  return;
853
857
  }
854
- var channels = data || [];
858
+ var channels = data.list || [];
855
859
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
856
860
  var brand = (state.data.verify.responseBody || {}).brand;
857
861
  var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
@@ -859,8 +863,8 @@ export var businessSlice = createSlice({
859
863
  var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
860
864
  var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
861
865
  var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
862
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
863
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
866
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
867
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
864
868
  if (isHasWebsite && (isHasTwitter || isHasInstagram))
865
869
  selectedChannels = [websiteData, socialData];
866
870
  else if (isHasTwitter || isHasInstagram)
@@ -1,10 +1,14 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ResponseData, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, FlowsTypes } from '../../../@types';
2
+ import { ResponseData, MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, FlowsTypes } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  response: any;
6
6
  formData: MobileFormValues;
7
7
  }, MobileFormValues, {}>;
8
+ export declare const createCivilIdAuth: import("@reduxjs/toolkit").AsyncThunk<{
9
+ response: any;
10
+ formData: CivilFormValues;
11
+ }, CivilFormValues, {}>;
8
12
  export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
9
13
  export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
10
14
  response: any;
@@ -19,6 +23,9 @@ export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
19
23
  response: any;
20
24
  formData: OTPFormValues;
21
25
  }, OTPFormValues, {}>;
26
+ export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
27
+ response: any;
28
+ }, void, {}>;
22
29
  export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<{
23
30
  response: any;
24
31
  formData: {
@@ -76,6 +83,7 @@ export interface ConnectData {
76
83
  nidData: NIDFormValues & ResponseData & {
77
84
  type: string;
78
85
  };
86
+ civilIdData: CivilFormValues & ResponseData;
79
87
  otpData: OTPFormValues & ResponseData & {
80
88
  isAbsher: boolean;
81
89
  };
@@ -90,6 +90,34 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
90
90
  }
91
91
  });
92
92
  }); });
93
+ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
+ var settings, requestBody, data;
95
+ var _a, _b;
96
+ return __generator(this, function (_c) {
97
+ switch (_c.label) {
98
+ case 0:
99
+ settings = thunkApi.getState().settings;
100
+ requestBody = {
101
+ lang: settings.data.language,
102
+ user_credentail: {
103
+ identification_id: params.civilId,
104
+ country_code: 'KW'
105
+ },
106
+ sign_in: false,
107
+ step_name: CONNECT_STEP_NAMES.CREATE_AUTH_CIVIL_ID,
108
+ encryption_contract: ['user_credentail.civil_id']
109
+ };
110
+ return [4, API.authService.createAuth(requestBody)];
111
+ case 1:
112
+ data = (_c.sent()).data;
113
+ if (!data.errors) {
114
+ thunkApi.dispatch(handleNextScreenStep());
115
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
116
+ }
117
+ return [2, { response: data, formData: params }];
118
+ }
119
+ });
120
+ }); });
93
121
  export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
122
  var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
95
123
  return __generator(this, function (_c) {
@@ -237,6 +265,47 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
237
265
  }
238
266
  });
239
267
  }); });
268
+ export var verifyPACI = createAsyncThunk('verifyPACI', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
269
+ var _a, settings, connect, responseBody, data, params, params;
270
+ var _b, _c, _d;
271
+ return __generator(this, function (_e) {
272
+ switch (_e.label) {
273
+ case 0:
274
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
275
+ responseBody = connect.data.civilIdData.responseBody;
276
+ return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
277
+ case 1:
278
+ data = _e.sent();
279
+ if (!(((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success')) return [3, 5];
280
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, {});
281
+ if (!(responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user)) return [3, 2];
282
+ params = {
283
+ leadId: data === null || data === void 0 ? void 0 : data.lead_id,
284
+ stepName: 'CONNECT_INDIVIDUAL_STEP'
285
+ };
286
+ thunkApi.dispatch(retrieveLead(params));
287
+ return [3, 5];
288
+ case 2: return [4, thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id))];
289
+ case 3:
290
+ _e.sent();
291
+ return [4, thunkApi.dispatch(retrieveChannels())];
292
+ case 4:
293
+ _e.sent();
294
+ if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
295
+ params = {
296
+ individualId: data === null || data === void 0 ? void 0 : data.individual_id,
297
+ stepName: 'CONNECT_MERCHANT_INFO_STEP'
298
+ };
299
+ thunkApi.dispatch(createLead(params));
300
+ }
301
+ else {
302
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
303
+ }
304
+ _e.label = 5;
305
+ case 5: return [2, { response: data }];
306
+ }
307
+ });
308
+ }); });
240
309
  export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
241
310
  var data;
242
311
  return __generator(this, function (_a) {
@@ -286,12 +355,16 @@ export var retrieveBrandList = createAsyncThunk('retrieveBrandList', function (i
286
355
  });
287
356
  }); });
288
357
  export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
289
- var data;
358
+ var body, data;
290
359
  return __generator(this, function (_a) {
291
360
  switch (_a.label) {
292
- case 0: return [4, API.dataService.getChannelsOfServices()];
361
+ case 0:
362
+ body = {
363
+ page: 0
364
+ };
365
+ return [4, API.dataService.getChannelsOfServices(body)];
293
366
  case 1:
294
- data = (_a.sent()).data;
367
+ data = _a.sent();
295
368
  return [2, data];
296
369
  }
297
370
  });
@@ -475,6 +548,9 @@ var initialState = {
475
548
  dob: getEighteenYearsAgo(),
476
549
  type: ''
477
550
  },
551
+ civilIdData: {
552
+ civilId: '284121505934'
553
+ },
478
554
  otpData: {
479
555
  otp: '',
480
556
  isAbsher: false
@@ -565,6 +641,38 @@ export var connectSlice = createSlice({
565
641
  })
566
642
  .addCase(resendOTPMobile.rejected, function (state, action) {
567
643
  state.error = action.error.message;
644
+ })
645
+ .addCase(createCivilIdAuth.pending, function (state, action) {
646
+ state.loading = true;
647
+ state.error = null;
648
+ })
649
+ .addCase(createCivilIdAuth.fulfilled, function (state, action) {
650
+ var _a;
651
+ state.loading = false;
652
+ state.error = null;
653
+ var _b = action.payload, formData = _b.formData, response = _b.response;
654
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
655
+ if (description) {
656
+ state.error = description;
657
+ return;
658
+ }
659
+ state.data.civilIdData = __assign(__assign({}, formData), { responseBody: response });
660
+ })
661
+ .addCase(createCivilIdAuth.rejected, function (state, action) {
662
+ state.loading = false;
663
+ state.error = action.error.message;
664
+ })
665
+ .addCase(verifyPACI.pending, function (state) {
666
+ state.loading = true;
667
+ state.error = null;
668
+ })
669
+ .addCase(verifyPACI.fulfilled, function (state, action) {
670
+ state.loading = false;
671
+ state.error = null;
672
+ })
673
+ .addCase(verifyPACI.rejected, function (state, action) {
674
+ state.loading = false;
675
+ state.error = action.error.message;
568
676
  })
569
677
  .addCase(createNIDAuth.fulfilled, function (state, action) {
570
678
  var _a;
@@ -792,25 +900,19 @@ export var connectSlice = createSlice({
792
900
  state.loading = true;
793
901
  })
794
902
  .addCase(retrieveChannels.fulfilled, function (state, action) {
795
- var _a;
796
903
  state.error = null;
797
904
  state.loading = false;
798
905
  var data = action.payload || {};
799
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
800
- if (description) {
801
- state.error = description;
802
- return;
803
- }
804
- var channels = data || [];
906
+ var channels = data.list || [];
805
907
  state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { channelList: channels });
806
908
  var selectedChannels = [];
807
909
  var selectedBrandItem = (state.data.brandData || {}).selectedBrandItem;
808
- var _b = selectedBrandItem || {}, website = _b.website, social = _b.social;
910
+ var _a = selectedBrandItem || {}, website = _a.website, social = _a.social;
809
911
  var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
810
912
  var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
811
913
  var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
812
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
813
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
914
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.id.toLocaleLowerCase() === 'website'; });
915
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a; return ((_a = c.name) === null || _a === void 0 ? void 0 : _a.en.toLocaleLowerCase()) === 'social'; });
814
916
  if (isHasWebsite && (isHasTwitter || isHasInstagram))
815
917
  selectedChannels = [websiteData, socialData];
816
918
  else if (isHasTwitter || isHasInstagram)
@@ -220,12 +220,16 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
220
220
  });
221
221
  }); });
222
222
  export var retrieveChannels = createAsyncThunk('retrieveChannelsEntity', function () { return __awaiter(void 0, void 0, void 0, function () {
223
- var data;
223
+ var body, data;
224
224
  return __generator(this, function (_a) {
225
225
  switch (_a.label) {
226
- case 0: return [4, API.dataService.getChannelsOfServices()];
226
+ case 0:
227
+ body = {
228
+ page: 0
229
+ };
230
+ return [4, API.dataService.getChannelsOfServices(body)];
227
231
  case 1:
228
- data = (_a.sent()).data;
232
+ data = _a.sent();
229
233
  return [2, data];
230
234
  }
231
235
  });
@@ -291,8 +295,8 @@ export var entitySlice = createSlice({
291
295
  var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
292
296
  var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
293
297
  var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
294
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
295
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
298
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
299
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
296
300
  if (isHasWebsite && (isHasTwitter || isHasInstagram))
297
301
  selectedChannels = [websiteData, socialData];
298
302
  else if (isHasTwitter || isHasInstagram)
@@ -302,7 +306,7 @@ export var entitySlice = createSlice({
302
306
  if (((_c = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _c === void 0 ? void 0 : _c.length) > 0) {
303
307
  selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
304
308
  var _a;
305
- return (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
309
+ return (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name.en.toLowerCase() === storedChannel.toLowerCase(); });
306
310
  });
307
311
  }
308
312
  state.data.entityData.salesChannels = selectedChannels;
@@ -428,7 +432,7 @@ export var entitySlice = createSlice({
428
432
  state.error = description;
429
433
  return;
430
434
  }
431
- var channels = data || [];
435
+ var channels = data.list || [];
432
436
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { channelList: channels });
433
437
  var brand = (state.data.verify.responseBody || {}).brand;
434
438
  var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
@@ -436,8 +440,8 @@ export var entitySlice = createSlice({
436
440
  var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
437
441
  var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
438
442
  var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
439
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
440
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
443
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
444
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
441
445
  if (isHasWebsite && (isHasTwitter || isHasInstagram))
442
446
  selectedChannels = [websiteData, socialData];
443
447
  else if (isHasTwitter || isHasInstagram)
@@ -42,7 +42,7 @@ var ButtonStyled = styled(Button)(function (_a) {
42
42
  var BankDetails = function () {
43
43
  var _a = React.useState(false), ibanChecking = _a[0], setIbanChecking = _a[1];
44
44
  var dispatch = useAppDispatch();
45
- var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error;
45
+ var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
46
46
  var methods = useForm({
47
47
  resolver: yupResolver(BankValidation),
48
48
  defaultValues: data.bankData,
@@ -56,7 +56,7 @@ var BankDetails = function () {
56
56
  var onBack = function () {
57
57
  dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
58
58
  };
59
- var disabled = ibanChecking || !methods.formState.isValid || !!error;
59
+ var disabled = ibanChecking || !methods.formState.isValid || !!error || uploading;
60
60
  React.useEffect(function () {
61
61
  if (error)
62
62
  dispatch(clearError());
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { ScreenContainer } from '../../../shared/Containers';
4
5
  import { useTranslation } from 'react-i18next';
5
6
  import { useController, useFormContext } from 'react-hook-form';
6
- import { useAppSelector } from '../../../../hooks';
7
- import { bankSelector } from '../../../app/bank/bankStore';
7
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
+ import { bankSelector, uploadBankStatement } from '../../../app/bank/bankStore';
8
9
  import UploadFile from '../../../shared/UploadFile';
10
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
9
11
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
10
12
  var theme = _a.theme;
11
13
  return ({
@@ -13,18 +15,41 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
15
  });
14
16
  });
15
17
  var BankStatement = function () {
16
- var _a;
18
+ var _a, _b;
17
19
  var t = useTranslation().t;
18
- var control = useFormContext().control;
20
+ var _c = useFormContext(), control = _c.control, setError = _c.setError, clearErrors = _c.clearErrors;
19
21
  var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
20
- var loading = useAppSelector(bankSelector).loading;
21
- var error = (_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
22
+ var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
23
+ var _d = useAppSelector(bankSelector), loading = _d.loading, uploading = _d.uploading, sysError = _d.error;
24
+ var dispatch = useAppDispatch();
25
+ var bankStatementValue = bankStatementFileControl.field.value;
26
+ var error = ((_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = bankStatementIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
22
27
  var handleBankStatementChange = function (file) {
23
- bankStatementFileControl.field.onChange(file);
28
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
29
+ setError('bankStatementFile', { message: 'file_not_supported_alert' });
30
+ }
31
+ else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
32
+ setError('bankStatementFile', { message: 'file_size_alert' });
33
+ }
34
+ else {
35
+ bankStatementFileControl.field.onChange(file);
36
+ dispatch(uploadBankStatement(file));
37
+ }
24
38
  };
25
39
  var handleReset = function () {
26
40
  bankStatementFileControl.field.onChange(null);
41
+ bankStatementIdControl.field.onChange('');
27
42
  };
28
- return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), dragTitle: t('drag_and_drop'), uploadTitle: t('title_upload_file'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, onReset: handleReset, error: error && t(error) }) }));
43
+ React.useEffect(function () {
44
+ if (sysError === 'file_upload_error') {
45
+ setError('bankStatementId', { message: sysError });
46
+ bankStatementFileControl.field.onChange(null);
47
+ }
48
+ }, [sysError]);
49
+ React.useEffect(function () {
50
+ if ((bankStatementFileControl.formState.isValid || !!bankStatementValue) && error != 'file_upload_error')
51
+ clearErrors();
52
+ }, [bankStatementFileControl.formState.isValid, bankStatementValue]);
53
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isFileUploaded: !uploading && !!bankStatementValue, isSubmitting: loading, isUploading: uploading, onReset: handleReset, error: error && t(error) }) }));
29
54
  };
30
55
  export default BankStatement;
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
20
20
  export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
21
21
  children?: React.ReactNode;
22
22
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
23
- color?: "inherit" | "disabled" | "error" | "info" | "primary" | "secondary" | "action" | "success" | "warning" | undefined;
23
+ color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
24
24
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
25
25
  htmlColor?: string | undefined;
26
26
  inheritViewBox?: boolean | undefined;
@@ -107,6 +107,6 @@ var SalesChannels = function () {
107
107
  if (channelsChecked)
108
108
  return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
109
109
  };
110
- return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name_ar : channel.name_en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
110
+ return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name.ar : channel.name.en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
111
111
  };
112
112
  export default SalesChannels;
@@ -35,7 +35,7 @@ export declare const NameContainer: import("@emotion/styled").StyledComponent<im
35
35
  export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
36
36
  children?: React.ReactNode;
37
37
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
38
- color?: "inherit" | "disabled" | "error" | "info" | "primary" | "secondary" | "action" | "success" | "warning" | undefined;
38
+ color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
39
39
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
40
40
  htmlColor?: string | undefined;
41
41
  inheritViewBox?: boolean | undefined;
@@ -49,7 +49,7 @@ export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<
49
49
  export declare const RemainingCheck: import("@emotion/styled").StyledComponent<{
50
50
  children?: React.ReactNode;
51
51
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
52
- color?: "inherit" | "disabled" | "error" | "info" | "primary" | "secondary" | "action" | "success" | "warning" | undefined;
52
+ color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
53
53
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
54
54
  htmlColor?: string | undefined;
55
55
  inheritViewBox?: boolean | undefined;
@@ -21,17 +21,16 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import { memo } from 'react';
24
+ import React, { memo } from 'react';
25
25
  import { FeatureContainer } from '../shared/Containers';
26
- import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
27
- import { useAppDispatch } from '../../hooks';
28
- import { settingsSelector, handleOpen } from '../../app/settings';
26
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
27
+ import { handleCurrentActiveScreen, settingsSelector, handleOpen } from '../../app/settings';
29
28
  import AnimationFlow from '../../components/AnimationFlow';
30
29
  import { store } from '../../app/store';
31
30
  import { connectSelector } from '../app/connect/connectStore';
32
31
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
33
32
  import Collapse from '../../components/Collapse';
34
- import { reactElement, removeElement } from '../../utils';
33
+ import { reactElement, removeElement, isKW } from '../../utils';
35
34
  import { CONNECT_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
36
35
  import { connectFeatureScreens } from '../featuresScreens';
37
36
  import CustomFooter from '../shared/Footer';
@@ -46,6 +45,13 @@ var Connect = memo(function (_a) {
46
45
  useErrorListener(connectError || error);
47
46
  useStepStartedListener();
48
47
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
48
+ React.useEffect(function () {
49
+ var _a;
50
+ if (!settingLoading) {
51
+ if (isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2))
52
+ dispatch(handleCurrentActiveScreen('CONNECT_CIVIL_ID_STEP'));
53
+ }
54
+ }, [settingLoading]);
49
55
  var handleDialogClose = function () {
50
56
  dispatch(handleOpen(false));
51
57
  };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface CivilIDProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CivilIDProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,85 @@
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 { useTranslation } from 'react-i18next';
15
+ import { alpha, styled } from '@mui/material/styles';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { civilIDValidationSchema } from './validation';
19
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
+ import { clearError, connectSelector, createCivilIdAuth } from '../../../app/connect/connectStore';
22
+ import Form from '../../../../components/Form';
23
+ import Button, { MobileButton } from '../../../shared/Button';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Collapse from '../../../../components/Collapse';
26
+ import Box from '@mui/material/Box';
27
+ import Divider from '@mui/material/Divider';
28
+ import Text from '../../../../components/Text';
29
+ import IDNumber from './IDNumber';
30
+ var FormStyled = styled(Form)(function () { return ({
31
+ display: 'flex',
32
+ flexDirection: 'column'
33
+ }); });
34
+ var TextStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return ({
37
+ color: alpha(theme.palette.primary.dark, 0.4)
38
+ });
39
+ });
40
+ var DividerStyled = styled(Divider)(function (_a) {
41
+ var theme = _a.theme;
42
+ return ({
43
+ width: '45%',
44
+ borderColor: alpha(theme.palette.primary.dark, 0.4),
45
+ marginBlockEnd: theme.spacing(0.62)
46
+ });
47
+ });
48
+ var OrBoxStyled = styled(Box)(function (_a) {
49
+ var theme = _a.theme;
50
+ return ({
51
+ display: 'flex',
52
+ justifyContent: 'space-between',
53
+ marginBlockEnd: theme.spacing(1.62),
54
+ marginBlockStart: theme.spacing(-1.25),
55
+ marginInline: theme.spacing(2.5)
56
+ });
57
+ });
58
+ var CivilID = function (_a) {
59
+ var isAr = useLanguage().isAr;
60
+ var dispatch = useAppDispatch();
61
+ var t = useTranslation().t;
62
+ var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
63
+ var settingsStore = useAppSelector(settingsSelector);
64
+ var methods = useForm({
65
+ resolver: yupResolver(civilIDValidationSchema),
66
+ defaultValues: data.civilIdData,
67
+ mode: 'onChange'
68
+ });
69
+ React.useEffect(function () {
70
+ handleClearError();
71
+ }, [methods.formState.isValid]);
72
+ var onSubmit = function (data) {
73
+ dispatch(createCivilIdAuth(data));
74
+ };
75
+ var handleClearError = function () {
76
+ if (error)
77
+ dispatch(clearError());
78
+ };
79
+ var onBack = function () {
80
+ dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
81
+ };
82
+ var disabled = !methods.formState.isValid || !!error;
83
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { sx: { mb: methods.formState.isValid ? 7.5 : 0, transition: 'mb 0.3s' } }), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] })) })) }));
84
+ };
85
+ export default React.memo(CivilID);
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ interface IDNumberProps {
4
+ sx: SxProps<Theme> | undefined;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
7
+ export default _default;