@tap-payments/auth-jsconnect 2.0.28-test → 2.0.30-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.
@@ -150,3 +150,8 @@ export declare const PASSWORD_OPERATION_TYPE: {
150
150
  SET_PASSWORD: string;
151
151
  RESET_PASSWORD: string;
152
152
  };
153
+ export declare const BUSINESS_FLOW_SUCCESS: {
154
+ name: string;
155
+ status: string;
156
+ url: string;
157
+ }[];
@@ -410,3 +410,4 @@ export var PASSWORD_OPERATION_TYPE = {
410
410
  SET_PASSWORD: 'set_password',
411
411
  RESET_PASSWORD: 'reset_password'
412
412
  };
413
+ export var BUSINESS_FLOW_SUCCESS = [{ name: 'business', status: 'completed', url: '' }];
@@ -4,7 +4,11 @@ import { CancelToken } from 'axios';
4
4
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  data: any;
6
6
  boardResponse: {
7
- flows: any;
7
+ flows: {
8
+ name: string;
9
+ status: string;
10
+ url: string;
11
+ }[];
8
12
  };
9
13
  token: string;
10
14
  }, string, {}>;
@@ -50,7 +50,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
53
- import { BANK_STEP_NAMES } from '../../../constants';
53
+ import { BANK_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
55
  var payload, data, boardInfoData, board_id, board_info_id, info, hasBankCompleted;
56
56
  var _a;
@@ -88,7 +88,7 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
88
88
  thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
89
89
  }
90
90
  _b.label = 5;
91
- case 5: return [2, { data: data, boardResponse: { flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }, token: token }];
91
+ case 5: return [2, { data: data, boardResponse: { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) }, token: token }];
92
92
  }
93
93
  });
94
94
  }); });
@@ -246,7 +246,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
246
246
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
247
247
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
248
248
  thunkApi.dispatch(handleNextScreenStep());
249
- return [2, { response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info }), formData: params }];
249
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
250
250
  }
251
251
  });
252
252
  }); });
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
- import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
62
+ import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
63
  import { convertNumbers2English, getEighteenYearsAgo, hasKey } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
@@ -144,7 +144,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
144
144
  _g.label = 17;
145
145
  case 17: return [2, {
146
146
  data: data,
147
- leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }),
147
+ leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) }),
148
148
  token: token,
149
149
  brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
150
150
  boardId: (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_id
@@ -501,7 +501,10 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
501
501
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
502
502
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
503
503
  thunkApi.dispatch(handleNextScreenStep());
504
- return [2, { response: __assign(__assign({}, data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }), formData: params }];
504
+ return [2, {
505
+ response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) }),
506
+ formData: params
507
+ }];
505
508
  }
506
509
  });
507
510
  }); });
@@ -580,10 +583,10 @@ export var businessSlice = createSlice({
580
583
  state.customLoading = true;
581
584
  })
582
585
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
583
- var _a, _b, _c, _d;
586
+ var _a, _b, _c, _d, _e, _f;
584
587
  state.error = null;
585
588
  state.customLoading = false;
586
- var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
589
+ var _g = action.payload, data = _g.data, token = _g.token, leadData = _g.leadData, brandInfo = _g.brandInfo, boardId = _g.boardId;
587
590
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
588
591
  if (description) {
589
592
  state.error = description;
@@ -592,7 +595,7 @@ export var businessSlice = createSlice({
592
595
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
593
596
  state.data.verify.token = token;
594
597
  state.data.otpData.isNID = false;
595
- var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
598
+ var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_type = _h.business_type, brand = _h.brand;
596
599
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
597
600
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
598
601
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -601,11 +604,26 @@ export var businessSlice = createSlice({
601
604
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
602
605
  }
603
606
  var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
604
- var selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
605
- var _a;
606
- 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(); });
607
- });
608
- state.data.activitiesData.salesChannels = (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0 ? selectedChannels : [channels === null || channels === void 0 ? void 0 : channels[0]];
607
+ var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
608
+ var _j = brand || {}, website = _j.website, social = _j.social;
609
+ var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
610
+ var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
611
+ 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'; });
614
+ if (isHasWebsite && (isHasTwitter || isHasInstagram))
615
+ selectedChannels = [websiteData, socialData];
616
+ else if (isHasTwitter || isHasInstagram)
617
+ selectedChannels = [socialData];
618
+ else if (isHasWebsite)
619
+ selectedChannels = [websiteData];
620
+ if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
621
+ selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
622
+ 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(); });
624
+ });
625
+ }
626
+ state.data.activitiesData.salesChannels = selectedChannels;
609
627
  var activities = entity_activities || [];
610
628
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
611
629
  var _a;
@@ -614,11 +632,21 @@ export var businessSlice = createSlice({
614
632
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
615
633
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
616
634
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
617
- state.data.businessTypeData.selectedLicense = {
618
- legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
619
- license: { number: (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number },
620
- type: business_type
621
- };
635
+ var licenseNumber_1 = (_e = entity === null || entity === void 0 ? void 0 : entity.license) === null || _e === void 0 ? void 0 : _e.number;
636
+ var _k = state.data.businessTypeData || {}, responseBody = _k.responseBody, selectedLicense = _k.selectedLicense;
637
+ var licenseList = (responseBody || {}).licenseList;
638
+ var selectedLicenseData = selectedLicense;
639
+ if (!!licenseNumber_1) {
640
+ selectedLicenseData =
641
+ ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
642
+ var license = _a.license;
643
+ return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
644
+ })) ||
645
+ business_type === BusinessType.CR
646
+ ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } });
647
+ state.data.businessTypeData.licenseNumber = licenseNumber_1 || '';
648
+ }
649
+ state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
622
650
  }
623
651
  })
624
652
  .addCase(verifyLeadToken.rejected, function (state, action) {
@@ -647,10 +675,10 @@ export var businessSlice = createSlice({
647
675
  state.error = null;
648
676
  })
649
677
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
650
- var _a, _b, _c, _d;
678
+ var _a, _b, _c, _d, _e, _f;
651
679
  state.loading = false;
652
680
  state.error = null;
653
- var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo;
681
+ var _g = action.payload, data = _g.data, formData = _g.formData, brandInfo = _g.brandInfo;
654
682
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
655
683
  if (description) {
656
684
  state.error = description;
@@ -658,7 +686,7 @@ export var businessSlice = createSlice({
658
686
  }
659
687
  state.data.otpData = formData;
660
688
  state.data.otpData.responseBody = data;
661
- var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
689
+ var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_type = _h.business_type, brand = _h.brand;
662
690
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
663
691
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
664
692
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -667,11 +695,26 @@ export var businessSlice = createSlice({
667
695
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
668
696
  }
669
697
  var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
670
- var selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
671
- var _a;
672
- 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(); });
673
- });
674
- state.data.activitiesData.salesChannels = (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0 ? selectedChannels : [channels === null || channels === void 0 ? void 0 : channels[0]];
698
+ var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
699
+ var _j = brand || {}, website = _j.website, social = _j.social;
700
+ var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
701
+ var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
702
+ 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'; });
705
+ if (isHasWebsite && (isHasTwitter || isHasInstagram))
706
+ selectedChannels = [websiteData, socialData];
707
+ else if (isHasTwitter || isHasInstagram)
708
+ selectedChannels = [socialData];
709
+ else if (isHasWebsite)
710
+ selectedChannels = [websiteData];
711
+ if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
712
+ selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
713
+ 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(); });
715
+ });
716
+ }
717
+ state.data.activitiesData.salesChannels = selectedChannels;
675
718
  var activities = entity_activities || [];
676
719
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
677
720
  var _a;
@@ -680,11 +723,21 @@ export var businessSlice = createSlice({
680
723
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
681
724
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
682
725
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
683
- state.data.businessTypeData.selectedLicense = {
684
- legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
685
- license: { number: (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number },
686
- type: business_type
687
- };
726
+ var licenseNumber_2 = (_e = entity === null || entity === void 0 ? void 0 : entity.license) === null || _e === void 0 ? void 0 : _e.number;
727
+ var _k = state.data.businessTypeData || {}, responseBody = _k.responseBody, selectedLicense = _k.selectedLicense;
728
+ var licenseList = (responseBody || {}).licenseList;
729
+ var selectedLicenseData = selectedLicense;
730
+ if (!!licenseNumber_2) {
731
+ selectedLicenseData =
732
+ ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
733
+ var license = _a.license;
734
+ return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
735
+ })) ||
736
+ business_type === BusinessType.CR
737
+ ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } });
738
+ state.data.businessTypeData.licenseNumber = licenseNumber_2 || '';
739
+ }
740
+ state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
688
741
  }
689
742
  })
690
743
  .addCase(verifyLeadOTP.rejected, function (state, action) {
@@ -738,7 +791,7 @@ export var businessSlice = createSlice({
738
791
  state.loading = true;
739
792
  })
740
793
  .addCase(retrieveEntityList.fulfilled, function (state, action) {
741
- var _a, _b, _c, _d, _e, _f, _g;
794
+ var _a, _b, _c, _d;
742
795
  state.error = null;
743
796
  state.loading = false;
744
797
  var data = action.payload;
@@ -760,15 +813,11 @@ export var businessSlice = createSlice({
760
813
  }
761
814
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
762
815
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: licenseList });
763
- var licenseNumber = (((_c = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) || {}).number;
764
- var selectedLicense = ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
765
- var license = _a.license;
766
- return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber;
767
- })) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
816
+ var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
817
+ var isOtherLicense = ((_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_fl' || ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_cr';
768
818
  state.data.businessTypeData.selectedLicense = selectedLicense;
769
- var isOtherLicense = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) === 'other_fl' || ((_f = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _f === void 0 ? void 0 : _f.number) === 'other_cr';
770
819
  if (!isOtherLicense)
771
- state.data.businessTypeData.licenseNumber = ((_g = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _g === void 0 ? void 0 : _g.number) || '';
820
+ state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
772
821
  })
773
822
  .addCase(retrieveEntityList.rejected, function (state, action) {
774
823
  state.error = action.error.message;
@@ -804,9 +853,21 @@ export var businessSlice = createSlice({
804
853
  }
805
854
  var channels = data || [];
806
855
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
807
- var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
808
- if (!!selectedChannel)
809
- state.data.activitiesData.salesChannels = [selectedChannel];
856
+ var brand = (state.data.verify.responseBody || {}).brand;
857
+ var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
858
+ var _b = brand || {}, website = _b.website, social = _b.social;
859
+ var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
860
+ var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
861
+ 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'; });
864
+ if (isHasWebsite && (isHasTwitter || isHasInstagram))
865
+ selectedChannels = [websiteData, socialData];
866
+ else if (isHasTwitter || isHasInstagram)
867
+ selectedChannels = [socialData];
868
+ else if (isHasWebsite)
869
+ selectedChannels = [websiteData];
870
+ state.data.activitiesData.salesChannels = selectedChannels;
810
871
  })
811
872
  .addCase(retrieveChannels.rejected, function (state, action) {
812
873
  state.error = action.error.message;
@@ -12,7 +12,11 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  contact: any;
13
13
  countries: CountryCode[];
14
14
  countryCode: any;
15
- flows: any;
15
+ flows: {
16
+ name: string;
17
+ status: string;
18
+ url: string;
19
+ }[];
16
20
  };
17
21
  token: string;
18
22
  }, string, {}>;
@@ -50,7 +50,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
53
- import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
53
+ import { BUSINESS_FLOW_SUCCESS, INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
55
  var payload, settings, data, boardData, countryCode, boardInfoData, countries, board_id, board_info_id, entity, info, hasIndividualCompleted;
56
56
  var _a, _b, _c;
@@ -107,7 +107,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
107
107
  contact: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.contact,
108
108
  countries: countries,
109
109
  countryCode: countryCode,
110
- flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
110
+ flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
111
111
  },
112
112
  token: token
113
113
  }];
@@ -252,7 +252,7 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
252
252
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
253
253
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
254
254
  thunkApi.dispatch(handleNextScreenStep());
255
- return [2, { response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info }), formData: params }];
255
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
256
256
  }
257
257
  });
258
258
  }); });
@@ -3,7 +3,11 @@ import { FlowsTypes, OTPFormValues, PasswordCreateFormValues, ResponseData, Shar
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  boardResponse: {
6
- flows: any;
6
+ flows: {
7
+ name: string;
8
+ status: string;
9
+ url: string;
10
+ }[];
7
11
  };
8
12
  token: string;
9
13
  }, string, {}>;
@@ -31,7 +35,11 @@ export declare const verifyOperationToken: import("@reduxjs/toolkit").AsyncThunk
31
35
  data: any;
32
36
  token: string;
33
37
  boardId: string;
34
- flows: any;
38
+ flows: {
39
+ name: string;
40
+ status: string;
41
+ url: string;
42
+ }[];
35
43
  }, {
36
44
  token: string;
37
45
  boardId: string;
@@ -50,7 +50,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
53
- import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
53
+ import { BUSINESS_FLOW_SUCCESS, PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
55
  var payload, data, boardInfoData, board_id, board_info_id, info, hasPasswordCompleted;
56
56
  var _a;
@@ -88,7 +88,7 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
88
88
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
89
89
  }
90
90
  _b.label = 5;
91
- case 5: return [2, { data: data, boardResponse: { flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }, token: token }];
91
+ case 5: return [2, { data: data, boardResponse: { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) }, token: token }];
92
92
  }
93
93
  });
94
94
  }); });
@@ -202,7 +202,7 @@ export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', f
202
202
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
203
203
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
204
204
  thunkApi.dispatch(handleNextScreenStep());
205
- return [2, { response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info }), formData: params }];
205
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
206
206
  }
207
207
  });
208
208
  }); });
@@ -227,7 +227,7 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
227
227
  _a.label = 3;
228
228
  case 3:
229
229
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
230
- return [2, { data: data, token: token, boardId: boardId, flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }];
230
+ return [2, { data: data, token: token, boardId: boardId, flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) }];
231
231
  }
232
232
  });
233
233
  }); });
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { hasKey } from '../../../utils';
53
53
  import { handleNextScreenStep, handleCurrentActiveScreen } from '../../../app/settings';
54
- import { TAX_STEP_NAMES } from '../../../constants';
54
+ import { BUSINESS_FLOW_SUCCESS, TAX_STEP_NAMES } from '../../../constants';
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var payload, data, boardData, boardInfoData, info, hasTaxCompleted;
57
57
  var _a, _b;
@@ -90,7 +90,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (to
90
90
  _c.label = 5;
91
91
  case 5: return [2, {
92
92
  data: data,
93
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
93
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info), entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
94
94
  token: token
95
95
  }];
96
96
  }
@@ -207,7 +207,7 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
207
207
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
208
208
  thunkApi.dispatch(handleNextScreenStep());
209
209
  return [2, {
210
- response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
210
+ response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info), user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
211
211
  formData: params
212
212
  }];
213
213
  }
@@ -67,7 +67,7 @@ var SuccessWithFlowButtons = function () {
67
67
  if (flows === void 0) { flows = []; }
68
68
  var images = ICONS_NAMES;
69
69
  var mappedFlows = flows
70
- .filter(function (item) { return item.name; })
70
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
71
71
  .map(function (_a) {
72
72
  var name = _a.name, url = _a.url, status = _a.status;
73
73
  var type = status === 'completed' ? 'completed' : 'pending';
@@ -85,6 +85,7 @@ var SalesChannels = function () {
85
85
  var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
86
86
  var _c = useAppSelector(businessSelector), data = _c.data, error = _c.error;
87
87
  var channelList = (data.businessTypeData.responseBody || {}).channelList;
88
+ var salesChannels = (data.activitiesData || {}).salesChannels;
88
89
  React.useEffect(function () {
89
90
  if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
90
91
  setChannelsMenuList(channelList);
@@ -106,6 +107,6 @@ var SalesChannels = function () {
106
107
  if (channelsChecked)
107
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); }));
108
109
  };
109
- 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, 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) })) }))] }));
110
111
  };
111
112
  export default SalesChannels;
@@ -67,7 +67,7 @@ var SuccessWithFlowButtons = function () {
67
67
  if (flows === void 0) { flows = []; }
68
68
  var images = ICONS_NAMES;
69
69
  var mappedFlows = flows
70
- .filter(function (item) { return item.name; })
70
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
71
71
  .map(function (_a) {
72
72
  var name = _a.name, url = _a.url, status = _a.status;
73
73
  var type = status === 'completed' ? 'completed' : 'pending';
@@ -67,7 +67,7 @@ var SuccessWithFlowButtons = function () {
67
67
  if (flows === void 0) { flows = []; }
68
68
  var images = ICONS_NAMES;
69
69
  var mappedFlows = flows
70
- .filter(function (item) { return item.name; })
70
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
71
71
  .map(function (_a) {
72
72
  var name = _a.name, url = _a.url, status = _a.status;
73
73
  var type = status === 'completed' ? 'completed' : 'pending';
@@ -68,7 +68,7 @@ var SuccessWithFlowButtons = function () {
68
68
  if (flows === void 0) { flows = []; }
69
69
  var images = ICONS_NAMES;
70
70
  var mappedFlows = flows
71
- .filter(function (item) { return item.name; })
71
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
72
72
  .map(function (_a) {
73
73
  var name = _a.name, url = _a.url, status = _a.status;
74
74
  var type = status === 'completed' ? 'completed' : 'pending';
@@ -67,7 +67,7 @@ var SuccessWithFlowButtons = function () {
67
67
  if (flows === void 0) { flows = []; }
68
68
  var images = ICONS_NAMES;
69
69
  var mappedFlows = flows
70
- .filter(function (item) { return item.name; })
70
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
71
71
  .map(function (_a) {
72
72
  var name = _a.name, url = _a.url, status = _a.status;
73
73
  var type = status === 'initiated' || status === 'in_progress' ? 'pending' : 'completed';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.28-test",
3
+ "version": "2.0.30-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",