@tap-payments/auth-jsconnect 2.4.71-test → 2.4.72-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 (25) hide show
  1. package/build/@types/form.d.ts +0 -1
  2. package/build/constants/app.d.ts +1 -0
  3. package/build/constants/app.js +10 -3
  4. package/build/features/app/connect/connectStore.d.ts +18 -4
  5. package/build/features/app/connect/connectStore.js +146 -83
  6. package/build/features/connect/screens/BrandSegment/BrandSegment.d.ts +5 -0
  7. package/build/features/connect/screens/BrandSegment/BrandSegment.js +84 -0
  8. package/build/features/connect/screens/{Merchant → BrandSegment}/SegmentLocations.js +1 -1
  9. package/build/features/connect/screens/{Merchant → BrandSegment}/SegmentProfits.js +1 -1
  10. package/build/features/connect/screens/{Merchant → BrandSegment}/SegmentTechs.js +1 -1
  11. package/build/features/connect/screens/{Merchant → BrandSegment}/TeamSize.js +1 -1
  12. package/build/features/connect/screens/BrandSegment/index.d.ts +3 -0
  13. package/build/features/connect/screens/BrandSegment/index.js +2 -0
  14. package/build/features/connect/screens/BrandSegment/validation.d.ts +17 -0
  15. package/build/features/connect/screens/BrandSegment/validation.js +9 -0
  16. package/build/features/connect/screens/Merchant/BrandList.js +2 -25
  17. package/build/features/connect/screens/Merchant/Merchant.js +4 -25
  18. package/build/features/connect/screens/Merchant/validation.d.ts +0 -12
  19. package/build/features/connect/screens/Merchant/validation.js +0 -8
  20. package/build/features/featuresScreens.js +5 -0
  21. package/package.json +1 -1
  22. /package/build/features/connect/screens/{Merchant → BrandSegment}/SegmentLocations.d.ts +0 -0
  23. /package/build/features/connect/screens/{Merchant → BrandSegment}/SegmentProfits.d.ts +0 -0
  24. /package/build/features/connect/screens/{Merchant → BrandSegment}/SegmentTechs.d.ts +0 -0
  25. /package/build/features/connect/screens/{Merchant → BrandSegment}/TeamSize.d.ts +0 -0
@@ -41,7 +41,6 @@ export type BrandSegmentFormValues = {
41
41
  segmentTech?: Segment | undefined;
42
42
  teamSize?: TeamSize | undefined;
43
43
  };
44
- export type ConnectBrandFormValues = BrandFormValues & BrandSegmentFormValues;
45
44
  export type BrandActivitiesFormValues = {
46
45
  activities: Array<Activity>;
47
46
  customerLocations: Array<CustomerLocation>;
@@ -85,6 +85,7 @@ export declare const CONNECT_STEP_NAMES: {
85
85
  UPDATE_LEAD_INDIVIDUAL: string;
86
86
  UPDATE_LEAD_BRAND: string;
87
87
  UPDATE_BRAND_INFO: string;
88
+ UPDATE_BRAND_SEGMENT_INFO: string;
88
89
  CREATE_AUTH_PASSWORD: string;
89
90
  VERIFY_AUTH_PASSWORD: string;
90
91
  CONNECT_SUCCESS: string;
@@ -55,15 +55,21 @@ export var CONNECT_SCREENS_NAVIGATION = [
55
55
  },
56
56
  {
57
57
  name: 'CONNECT_MERCHANT_INFO_STEP',
58
- next: 'CONNECT_THANK_YOU_STEP',
58
+ next: 'CONNECT_BRAND_SEGMENT_INFO_STEP',
59
59
  prev: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_NID_STEP', 'CONNECT_MOBILE_STEP', 'CONNECT_CIVIL_ID_STEP'],
60
60
  order: 4
61
61
  },
62
62
  {
63
- name: 'CONNECT_THANK_YOU_STEP',
64
- next: '',
63
+ name: 'CONNECT_BRAND_SEGMENT_INFO_STEP',
64
+ next: 'CONNECT_THANK_YOU_STEP',
65
65
  prev: 'CONNECT_MERCHANT_INFO_STEP',
66
66
  order: 5
67
+ },
68
+ {
69
+ name: 'CONNECT_THANK_YOU_STEP',
70
+ next: '',
71
+ prev: 'CONNECT_BRAND_SEGMENT_INFO_STEP',
72
+ order: 6
67
73
  }
68
74
  ];
69
75
  export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
@@ -595,6 +601,7 @@ export var CONNECT_STEP_NAMES = {
595
601
  UPDATE_LEAD_INDIVIDUAL: 'connect_update_lead_individual',
596
602
  UPDATE_LEAD_BRAND: 'connect_update_lead_brand',
597
603
  UPDATE_BRAND_INFO: 'connect_update_brand_info',
604
+ UPDATE_BRAND_SEGMENT_INFO: 'connect_update_brand_segment_info',
598
605
  CREATE_AUTH_PASSWORD: 'connect_create_auth_password',
599
606
  VERIFY_AUTH_PASSWORD: 'connect_verify_auth_password',
600
607
  CONNECT_SUCCESS: 'connect_completed'
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, AuthForType, ConnectBrandFormValues, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActionState, AuthForType, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, BrandFormValues, BrandSegmentFormValues } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  response: any;
@@ -125,10 +125,10 @@ export declare const retrieveSegmentDataList: import("@reduxjs/toolkit").AsyncTh
125
125
  }>;
126
126
  export declare const updateLeadBrand: import("@reduxjs/toolkit").AsyncThunk<{
127
127
  response: any;
128
- formData: import("../../../@types").BrandFormValues & import("../../../@types").BrandSegmentFormValues & {
128
+ formData: BrandFormValues & {
129
129
  isNewBrand: boolean;
130
130
  };
131
- }, import("../../../@types").BrandFormValues & import("../../../@types").BrandSegmentFormValues & {
131
+ }, BrandFormValues & {
132
132
  isNewBrand: boolean;
133
133
  }, {
134
134
  state?: unknown;
@@ -140,6 +140,19 @@ export declare const updateLeadBrand: import("@reduxjs/toolkit").AsyncThunk<{
140
140
  fulfilledMeta?: unknown;
141
141
  rejectedMeta?: unknown;
142
142
  }>;
143
+ export declare const updateLeadBrandSegment: import("@reduxjs/toolkit").AsyncThunk<{
144
+ response: any;
145
+ formData: BrandSegmentFormValues;
146
+ }, BrandSegmentFormValues, {
147
+ state?: unknown;
148
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
149
+ extra?: unknown;
150
+ rejectValue?: unknown;
151
+ serializedErrorType?: unknown;
152
+ pendingMeta?: unknown;
153
+ fulfilledMeta?: unknown;
154
+ rejectedMeta?: unknown;
155
+ }>;
143
156
  export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
144
157
  response: any;
145
158
  formData: string;
@@ -199,7 +212,8 @@ export interface ConnectData {
199
212
  authFor: AuthForType;
200
213
  };
201
214
  individualData: IndividualFormValues & ResponseData;
202
- brandData: ConnectBrandFormValues & ResponseData;
215
+ brandData: BrandFormValues & ResponseData;
216
+ brandSegmentData: BrandSegmentFormValues & ResponseData;
203
217
  flowName: FlowsTypes;
204
218
  }
205
219
  export interface ConnectState extends SharedState<ConnectData> {
@@ -363,17 +363,17 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
363
363
  });
364
364
  }); });
365
365
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
366
- var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, _b, segmentLocation, segmentProfit, segmentTech, err_3, teamSize, err_4, brand;
367
- var _c, _d, _e, _f, _g;
368
- return __generator(this, function (_h) {
369
- switch (_h.label) {
366
+ var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, brand;
367
+ var _b, _c, _d, _e, _f;
368
+ return __generator(this, function (_g) {
369
+ switch (_g.label) {
370
370
  case 0:
371
371
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
372
372
  lead_id = (connect.data.otpData.responseBody || {}).lead_id;
373
- phoneCountry = (_d = (_c = params.countryCode) === null || _c === void 0 ? void 0 : _c.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString();
373
+ phoneCountry = (_c = (_b = params.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString();
374
374
  payload = {
375
375
  id: lead_id || '',
376
- country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2,
376
+ country_code: (_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2,
377
377
  name: getIndividualName(params.name),
378
378
  contact: __assign({ email: params.email }, (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })),
379
379
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
@@ -381,39 +381,15 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
381
381
  };
382
382
  return [4, API.leadService.updateLead(payload)];
383
383
  case 1:
384
- leadResponse = _h.sent();
385
- _h.label = 2;
386
- case 2:
387
- _h.trys.push([2, 4, , 5]);
388
- return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
389
- case 3:
390
- _b = _h.sent(), segmentLocation = _b.segmentLocation, segmentProfit = _b.segmentProfit, segmentTech = _b.segmentTech;
391
- leadResponse.segment_location_list = segmentLocation;
392
- leadResponse.segment_profit_list = segmentProfit;
393
- leadResponse.segment_tech_list = segmentTech;
394
- return [3, 5];
395
- case 4:
396
- err_3 = _h.sent();
397
- return [3, 5];
398
- case 5:
399
- _h.trys.push([5, 7, , 8]);
400
- return [4, API.dataService.getTeamSize({ page: 0 })];
401
- case 6:
402
- teamSize = _h.sent();
403
- leadResponse.team_size_list = teamSize.list;
404
- return [3, 8];
405
- case 7:
406
- err_4 = _h.sent();
407
- return [3, 8];
408
- case 8:
409
- if (!leadResponse.brand) return [3, 10];
384
+ leadResponse = _g.sent();
385
+ if (!leadResponse.brand) return [3, 3];
410
386
  return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
411
- case 9:
412
- brand = (_h.sent()).brand;
387
+ case 2:
388
+ brand = (_g.sent()).brand;
413
389
  leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
414
- _h.label = 10;
415
- case 10:
416
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
390
+ _g.label = 3;
391
+ case 3:
392
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
417
393
  thunkApi.dispatch(handleNextScreenStep());
418
394
  return [2, { leadResponse: leadResponse, formData: params }];
419
395
  }
@@ -444,15 +420,15 @@ export var retrieveSegmentDataList = createAsyncThunk('connectRetrieveSegmentDat
444
420
  });
445
421
  }); });
446
422
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
447
- var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, segmentLocation, segmentProfit, segmentTech, teamSize, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
448
- var _b, _c, _d, _e, _f;
449
- return __generator(this, function (_g) {
450
- switch (_g.label) {
423
+ var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, _b, segmentLocation, segmentProfit, segmentTech, err_3, teamSize, err_4, brandNameBody, payload, lead, brandReqBody, brand, _c, segmentLocation, segmentProfit, segmentTech, err_5, teamSize, err_6;
424
+ var _d, _e, _f, _g, _h;
425
+ return __generator(this, function (_j) {
426
+ switch (_j.label) {
451
427
  case 0:
452
428
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
453
429
  responseBody = connect.data.otpData.responseBody;
454
430
  leadBrandId = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand_id;
455
- isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, brandLogoId = params.brandLogoId, segmentLocation = params.segmentLocation, segmentProfit = params.segmentProfit, segmentTech = params.segmentTech, teamSize = params.teamSize, termAndConditionChecked = params.termAndConditionChecked;
431
+ isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, brandLogoId = params.brandLogoId, termAndConditionChecked = params.termAndConditionChecked;
456
432
  getAddress = function (value, isTwitter, isWeb) {
457
433
  if (isTwitter)
458
434
  return '@' + value;
@@ -470,7 +446,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
470
446
  })
471
447
  };
472
448
  });
473
- if (!!isNewBrand) return [3, 4];
449
+ if (!!isNewBrand) return [3, 11];
474
450
  if (!(leadBrandId !== (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id))) return [3, 2];
475
451
  payload_1 = {
476
452
  brand: {
@@ -481,24 +457,46 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
481
457
  };
482
458
  return [4, API.leadService.updateLead(payload_1)];
483
459
  case 1:
484
- _g.sent();
485
- _g.label = 2;
460
+ _j.sent();
461
+ _j.label = 2;
486
462
  case 2:
487
463
  brandReqBody_1 = {
488
464
  id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || '',
489
465
  channel_services: channel_services,
490
466
  term: ['general'],
491
- segment: __assign(__assign(__assign(__assign({}, ((segmentLocation === null || segmentLocation === void 0 ? void 0 : segmentLocation.id) && { location_type: { id: segmentLocation.id } })), ((segmentProfit === null || segmentProfit === void 0 ? void 0 : segmentProfit.id) && { profit_type: { id: segmentProfit.id } })), ((segmentTech === null || segmentTech === void 0 ? void 0 : segmentTech.id) && { tech_type: { id: segmentTech.id } })), { team: { id: (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) || '' } }),
492
467
  step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
493
468
  };
494
469
  return [4, API.brandService.updateBrandInfo(brandReqBody_1)];
495
470
  case 3:
496
- brand_1 = _g.sent();
497
- thunkApi.dispatch(updateLeadSuccess());
498
- thunkApi.dispatch(handleNextScreenStep());
499
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, params);
500
- return [2, { response: brand_1, formData: params }];
471
+ brand_1 = _j.sent();
472
+ _j.label = 4;
501
473
  case 4:
474
+ _j.trys.push([4, 6, , 7]);
475
+ return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
476
+ case 5:
477
+ _b = _j.sent(), segmentLocation = _b.segmentLocation, segmentProfit = _b.segmentProfit, segmentTech = _b.segmentTech;
478
+ brand_1.segment_location_list = segmentLocation;
479
+ brand_1.segment_profit_list = segmentProfit;
480
+ brand_1.segment_tech_list = segmentTech;
481
+ return [3, 7];
482
+ case 6:
483
+ err_3 = _j.sent();
484
+ return [3, 7];
485
+ case 7:
486
+ _j.trys.push([7, 9, , 10]);
487
+ return [4, API.dataService.getTeamSize({ page: 0 })];
488
+ case 8:
489
+ teamSize = _j.sent();
490
+ brand_1.team_size_list = teamSize.list;
491
+ return [3, 10];
492
+ case 9:
493
+ err_4 = _j.sent();
494
+ return [3, 10];
495
+ case 10:
496
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
497
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
498
+ return [2, { response: brand_1, formData: params }];
499
+ case 11:
502
500
  brandNameBody = {
503
501
  id: '',
504
502
  name: {
@@ -514,25 +512,72 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
514
512
  encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
515
513
  };
516
514
  return [4, API.leadService.updateLead(payload)];
517
- case 5:
518
- lead = _g.sent();
515
+ case 12:
516
+ lead = _j.sent();
519
517
  if (!lead.brand) {
520
518
  console.error('Internal server error: brand is not created');
521
519
  throw new Error('Internal server error');
522
520
  }
523
521
  brandReqBody = {
524
- id: ((_d = lead.brand) === null || _d === void 0 ? void 0 : _d.id) || '',
522
+ id: ((_f = lead.brand) === null || _f === void 0 ? void 0 : _f.id) || '',
525
523
  channel_services: channel_services,
526
524
  term: ['general'],
527
- step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO,
525
+ step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
526
+ };
527
+ return [4, API.brandService.updateBrandInfo(brandReqBody)];
528
+ case 13:
529
+ brand = _j.sent();
530
+ _j.label = 14;
531
+ case 14:
532
+ _j.trys.push([14, 16, , 17]);
533
+ return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
534
+ case 15:
535
+ _c = _j.sent(), segmentLocation = _c.segmentLocation, segmentProfit = _c.segmentProfit, segmentTech = _c.segmentTech;
536
+ brand.segment_location_list = segmentLocation;
537
+ brand.segment_profit_list = segmentProfit;
538
+ brand.segment_tech_list = segmentTech;
539
+ return [3, 17];
540
+ case 16:
541
+ err_5 = _j.sent();
542
+ return [3, 17];
543
+ case 17:
544
+ _j.trys.push([17, 19, , 20]);
545
+ return [4, API.dataService.getTeamSize({ page: 0 })];
546
+ case 18:
547
+ teamSize = _j.sent();
548
+ brand.team_size_list = teamSize.list;
549
+ return [3, 20];
550
+ case 19:
551
+ err_6 = _j.sent();
552
+ return [3, 20];
553
+ case 20:
554
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
555
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, params);
556
+ return [2, { response: brand, formData: params }];
557
+ }
558
+ });
559
+ }); });
560
+ export var updateLeadBrandSegment = createAsyncThunk('updateLeadBrandSegment', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
561
+ var _a, settings, connect, responseBody, leadBrandId, segmentLocation, segmentProfit, segmentTech, teamSize, brandReqBody, brand;
562
+ var _b, _c, _d;
563
+ return __generator(this, function (_e) {
564
+ switch (_e.label) {
565
+ case 0:
566
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
567
+ responseBody = connect.data.brandData.responseBody;
568
+ leadBrandId = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand) === null || _b === void 0 ? void 0 : _b.id;
569
+ segmentLocation = params.segmentLocation, segmentProfit = params.segmentProfit, segmentTech = params.segmentTech, teamSize = params.teamSize;
570
+ brandReqBody = {
571
+ id: leadBrandId || '',
572
+ step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_SEGMENT_INFO,
528
573
  segment: __assign(__assign(__assign(__assign({}, ((segmentLocation === null || segmentLocation === void 0 ? void 0 : segmentLocation.id) && { location_type: { id: segmentLocation.id } })), ((segmentProfit === null || segmentProfit === void 0 ? void 0 : segmentProfit.id) && { profit_type: { id: segmentProfit.id } })), ((segmentTech === null || segmentTech === void 0 ? void 0 : segmentTech.id) && { tech_type: { id: segmentTech.id } })), { team: { id: (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) || '' } })
529
574
  };
530
575
  return [4, API.brandService.updateBrandInfo(brandReqBody)];
531
- case 6:
532
- brand = _g.sent();
576
+ case 1:
577
+ brand = _e.sent();
533
578
  thunkApi.dispatch(updateLeadSuccess());
534
579
  thunkApi.dispatch(handleNextScreenStep());
535
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
580
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
536
581
  return [2, { response: brand, formData: params }];
537
582
  }
538
583
  });
@@ -642,15 +687,17 @@ var initialState = {
642
687
  brandData: {
643
688
  brandName: '',
644
689
  salesChannels: [],
645
- segmentLocation: undefined,
646
- segmentProfit: undefined,
647
- segmentTech: undefined,
648
- teamSize: undefined,
649
690
  termAndConditionChecked: false,
650
691
  selectedBrandItem: {},
651
692
  responseBody: {
652
693
  brand_list: []
653
694
  }
695
+ },
696
+ brandSegmentData: {
697
+ segmentLocation: undefined,
698
+ segmentProfit: undefined,
699
+ segmentTech: undefined,
700
+ teamSize: undefined
654
701
  }
655
702
  }
656
703
  };
@@ -853,10 +900,10 @@ export var connectSlice = createSlice({
853
900
  state.error = action.error.message;
854
901
  })
855
902
  .addCase(updateLeadIndividual.fulfilled, function (state, action) {
856
- var _a, _b, _c, _d, _e, _f;
903
+ var _a, _b, _c;
857
904
  state.loading = false;
858
905
  state.error = null;
859
- var _g = action.payload, formData = _g.formData, leadResponse = _g.leadResponse;
906
+ var _d = action.payload, formData = _d.formData, leadResponse = _d.leadResponse;
860
907
  var brand = leadResponse.brand, rest = __rest(leadResponse, ["brand"]);
861
908
  if (brand) {
862
909
  var channel_services = brand.channel_services, terms = brand.terms;
@@ -869,23 +916,6 @@ export var connectSlice = createSlice({
869
916
  }
870
917
  var selectedBrand = ((_b = (_a = state.data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.brand_list[0]) || leadResponse.brand;
871
918
  state.data.brandData.brandName = (_c = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.name) === null || _c === void 0 ? void 0 : _c.en;
872
- state.data.brandData.segmentLocation = (_d = rest.segment_location_list) === null || _d === void 0 ? void 0 : _d.find(function (location) {
873
- var _a, _b;
874
- return location.id === ((_b = (_a = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _a === void 0 ? void 0 : _a.location_type) === null || _b === void 0 ? void 0 : _b.id);
875
- });
876
- state.data.brandData.segmentProfit = (_e = rest.segment_profit_list) === null || _e === void 0 ? void 0 : _e.find(function (profit) {
877
- var _a, _b;
878
- return profit.id === ((_b = (_a = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _a === void 0 ? void 0 : _a.profit_type) === null || _b === void 0 ? void 0 : _b.id);
879
- });
880
- state.data.brandData.segmentTech = (_f = rest.segment_tech_list) === null || _f === void 0 ? void 0 : _f.find(function (tech) {
881
- var _a, _b;
882
- return tech.id === ((_b = (_a = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _a === void 0 ? void 0 : _a.tech_type) === null || _b === void 0 ? void 0 : _b.id);
883
- });
884
- state.data.brandData.teamSize = rest.team_size_list.find(function (_a) {
885
- var _b, _c;
886
- var id = _a.id;
887
- return ((_c = (_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) === id;
888
- });
889
919
  state.data.individualData = formData;
890
920
  state.data.individualData.responseBody = rest;
891
921
  })
@@ -913,8 +943,26 @@ export var connectSlice = createSlice({
913
943
  state.loading = false;
914
944
  state.error = null;
915
945
  var _a = action.payload, formData = _a.formData, response = _a.response;
916
- state.data.brandData = formData;
917
- state.data.brandData.responseBody = response;
946
+ var _b = response || {}, segment_location_list = _b.segment_location_list, segment_profit_list = _b.segment_profit_list, segment_tech_list = _b.segment_tech_list, team_size_list = _b.team_size_list, brand = _b.brand;
947
+ state.data.brandSegmentData.segmentLocation = segment_location_list === null || segment_location_list === void 0 ? void 0 : segment_location_list.find(function (location) {
948
+ var _a, _b;
949
+ return location.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.location_type) === null || _b === void 0 ? void 0 : _b.id);
950
+ });
951
+ state.data.brandSegmentData.segmentProfit = segment_profit_list === null || segment_profit_list === void 0 ? void 0 : segment_profit_list.find(function (profit) {
952
+ var _a, _b;
953
+ return profit.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.profit_type) === null || _b === void 0 ? void 0 : _b.id);
954
+ });
955
+ state.data.brandSegmentData.segmentTech = segment_tech_list === null || segment_tech_list === void 0 ? void 0 : segment_tech_list.find(function (tech) {
956
+ var _a, _b;
957
+ return tech.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.tech_type) === null || _b === void 0 ? void 0 : _b.id);
958
+ });
959
+ state.data.brandSegmentData.teamSize = team_size_list === null || team_size_list === void 0 ? void 0 : team_size_list.find(function (_a) {
960
+ var _b, _c;
961
+ var id = _a.id;
962
+ return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) === id;
963
+ });
964
+ state.data.brandData = __assign(__assign({}, formData), { responseBody: __assign(__assign({}, state.data.brandData.responseBody), { brand: brand }) });
965
+ state.data.brandSegmentData.responseBody = { segment_location_list: segment_location_list, segment_profit_list: segment_profit_list, segment_tech_list: segment_tech_list, team_size_list: team_size_list };
918
966
  })
919
967
  .addCase(updateLeadBrand.pending, function (state) {
920
968
  state.loading = true;
@@ -923,6 +971,21 @@ export var connectSlice = createSlice({
923
971
  .addCase(updateLeadBrand.rejected, function (state, action) {
924
972
  state.loading = false;
925
973
  state.error = action.error.message;
974
+ })
975
+ .addCase(updateLeadBrandSegment.fulfilled, function (state, action) {
976
+ state.loading = false;
977
+ state.error = null;
978
+ var _a = action.payload, formData = _a.formData, response = _a.response;
979
+ state.data.brandSegmentData = formData;
980
+ state.data.brandSegmentData.responseBody = __assign(__assign({}, state.data.brandSegmentData.responseBody), response);
981
+ })
982
+ .addCase(updateLeadBrandSegment.pending, function (state) {
983
+ state.loading = true;
984
+ state.error = null;
985
+ })
986
+ .addCase(updateLeadBrandSegment.rejected, function (state, action) {
987
+ state.loading = false;
988
+ state.error = action.error.message;
926
989
  })
927
990
  .addCase(checkEmailAvailability.fulfilled, function (state, action) {
928
991
  var _a;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface BrandSegmentProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: BrandSegmentProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,84 @@
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 } from '../../../../hooks';
19
+ import { handlePrevScreenStep } from '../../../../app/settings';
20
+ import { sendCustomEventToGTM } from '../../../../utils';
21
+ import Form from '../../../../components/Form';
22
+ import { ScreenContainer } from '../../../shared/Containers';
23
+ import Button from '../../../shared/Button';
24
+ import { clearError, connectSelector, updateLeadBrandSegment } from '../../../app/connect/connectStore';
25
+ import { useLanguage } from '../../../../hooks';
26
+ import { BrandSegmentValidationSchema } from './validation';
27
+ import SegmentLocations from './SegmentLocations';
28
+ import SegmentProfits from './SegmentProfits';
29
+ import SegmentTechs from './SegmentTechs';
30
+ import TeamSize from './TeamSize';
31
+ var ListType;
32
+ (function (ListType) {
33
+ ListType["SegmentLocationList"] = "SegmentLocationList";
34
+ ListType["SegmentProfitList"] = "SegmentProfitList";
35
+ ListType["SegmentTechList"] = "SegmentTechList";
36
+ ListType["TeamSizeList"] = "TeamSizeList";
37
+ ListType["BrandList"] = "BrandList";
38
+ ListType["BusinessList"] = "BusinessList";
39
+ })(ListType || (ListType = {}));
40
+ var BrandSegment = function (_a) {
41
+ var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
42
+ var _c = data.brandSegmentData, segmentLocation = _c.segmentLocation, segmentProfit = _c.segmentProfit, segmentTech = _c.segmentTech, teamSize = _c.teamSize;
43
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
44
+ React.useEffect(function () {
45
+ sendCustomEventToGTM({
46
+ event: 'Send Event',
47
+ event_category: 'User Registration Flow',
48
+ event_action: 'Brand Segment Details Step'
49
+ });
50
+ }, []);
51
+ var methods = useForm({
52
+ resolver: yupResolver(BrandSegmentValidationSchema()),
53
+ defaultValues: {
54
+ segmentLocation: segmentLocation,
55
+ segmentProfit: segmentProfit,
56
+ segmentTech: segmentTech,
57
+ teamSize: teamSize
58
+ },
59
+ mode: 'onChange'
60
+ });
61
+ var t = useTranslation().t;
62
+ var isAr = useLanguage().isAr;
63
+ var dispatch = useAppDispatch();
64
+ var onSubmit = function (formData) {
65
+ dispatch(updateLeadBrandSegment(formData));
66
+ };
67
+ var onBack = function () {
68
+ dispatch(handlePrevScreenStep());
69
+ };
70
+ React.useEffect(function () {
71
+ if (error)
72
+ dispatch(clearError());
73
+ }, [methods.formState.isValid]);
74
+ var disabled = !methods.formState.isValid || !!error;
75
+ var handleMenuClick = function (flag) {
76
+ setListActive(flag);
77
+ };
78
+ var isSegmentLocationListActive = listActive === ListType.SegmentLocationList;
79
+ var isSegmentProfitListActive = listActive === ListType.SegmentProfitList;
80
+ var isSegmentTechListActive = listActive === ListType.SegmentTechList;
81
+ var isTeamSizeListActive = listActive === ListType.TeamSizeList;
82
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(SegmentLocations, { show: !isTeamSizeListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(SegmentProfits, { show: !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentProfitList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(SegmentTechs, { show: !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentProfitListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentTechList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, 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') })) }))] })) })) }));
83
+ };
84
+ export default React.memo(BrandSegment);
@@ -37,7 +37,7 @@ var SegmentLocations = function (_a) {
37
37
  var isAr = useLanguage().isAr;
38
38
  var data = useAppSelector(connectSelector).data;
39
39
  var control = useFormContext().control;
40
- var segmentLocationList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_location_list) || [];
40
+ var segmentLocationList = ((_b = data.brandSegmentData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_location_list) || [];
41
41
  var segmentControl = useController({ control: control, name: 'segmentLocation' });
42
42
  var segment = segmentControl.field.value;
43
43
  var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
@@ -37,7 +37,7 @@ var SegmentProfits = function (_a) {
37
37
  var isAr = useLanguage().isAr;
38
38
  var data = useAppSelector(connectSelector).data;
39
39
  var control = useFormContext().control;
40
- var segmentProfitList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_profit_list) || [];
40
+ var segmentProfitList = ((_b = data.brandSegmentData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_profit_list) || [];
41
41
  var segmentControl = useController({ control: control, name: 'segmentProfit' });
42
42
  var segment = segmentControl.field.value;
43
43
  var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
@@ -37,7 +37,7 @@ var SegmentTechs = function (_a) {
37
37
  var isAr = useLanguage().isAr;
38
38
  var data = useAppSelector(connectSelector).data;
39
39
  var control = useFormContext().control;
40
- var segmentTechList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_tech_list) || [];
40
+ var segmentTechList = ((_b = data.brandSegmentData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_tech_list) || [];
41
41
  var segmentControl = useController({ control: control, name: 'segmentTech' });
42
42
  var segment = segmentControl.field.value;
43
43
  var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
@@ -37,7 +37,7 @@ var TeamSize = function (_a) {
37
37
  var isAr = useLanguage().isAr;
38
38
  var data = useAppSelector(connectSelector).data;
39
39
  var control = useFormContext().control;
40
- var teamSizesList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.team_size_list) || [];
40
+ var teamSizesList = ((_b = data.brandSegmentData.responseBody) === null || _b === void 0 ? void 0 : _b.team_size_list) || [];
41
41
  var teamSizeControl = useController({ control: control, name: 'teamSize' });
42
42
  var teamSize = teamSizeControl.field.value;
43
43
  var error = (_c = teamSizeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
@@ -0,0 +1,3 @@
1
+ import BrandSegment, { BrandSegmentProps } from './BrandSegment';
2
+ export type { BrandSegmentProps };
3
+ export default BrandSegment;
@@ -0,0 +1,2 @@
1
+ import BrandSegment from './BrandSegment';
2
+ export default BrandSegment;
@@ -0,0 +1,17 @@
1
+ import * as yup from 'yup';
2
+ export declare const BrandSegmentValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
4
+ segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
5
+ segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
6
+ teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
7
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
8
+ segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
9
+ segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
10
+ segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
11
+ teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
12
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
14
+ segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
15
+ segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
16
+ teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
17
+ }>>>;
@@ -0,0 +1,9 @@
1
+ import * as yup from 'yup';
2
+ export var BrandSegmentValidationSchema = function () {
3
+ return yup.object().shape({
4
+ segmentLocation: yup.object().required('alert_choose_segment_location'),
5
+ segmentProfit: yup.object().required('alert_choose_segment_profit'),
6
+ segmentTech: yup.object().required('alert_choose_segment_tech'),
7
+ teamSize: yup.object().required('alert_choose_teamSize')
8
+ });
9
+ };
@@ -21,13 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { connectSelector } from '../../../app/connect/connectStore';
25
24
  import * as React from 'react';
26
25
  import { useTranslation } from 'react-i18next';
27
26
  import { useFormContext, useController } from 'react-hook-form';
28
27
  import Box from '@mui/material/Box';
29
28
  import { styled } from '@mui/material/styles';
30
- import { useAppSelector, useLanguage } from '../../../../hooks';
29
+ import { useLanguage } from '../../../../hooks';
31
30
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
32
31
  import InputSelect from '../../../shared/InputSelect';
33
32
  import CheckIcon from '../../../shared/CheckIcon';
@@ -48,9 +47,7 @@ var BrandList = function (_a) {
48
47
  var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
49
48
  var t = useTranslation().t;
50
49
  var isAr = useLanguage().isAr;
51
- var data = useAppSelector(connectSelector).data;
52
- var _c = data.individualData.responseBody || {}, segment_location_list = _c.segment_location_list, segment_profit_list = _c.segment_profit_list, segment_tech_list = _c.segment_tech_list, team_size_list = _c.team_size_list;
53
- var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
50
+ var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
54
51
  var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
55
52
  var selectedBrand = selectedBrandControl.field.value;
56
53
  var onOpenBrandList = function (event) {
@@ -82,26 +79,6 @@ var BrandList = function (_a) {
82
79
  setValue('salesChannels', [], { shouldValidate: true });
83
80
  setValue('brandName', '');
84
81
  }
85
- setValue('segmentLocation', segment_location_list.find(function (_a) {
86
- var _b, _c;
87
- var id = _a.id;
88
- return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.location_type) === null || _c === void 0 ? void 0 : _c.id) === id;
89
- }), { shouldValidate: true });
90
- setValue('segmentProfit', segment_profit_list.find(function (_a) {
91
- var _b, _c;
92
- var id = _a.id;
93
- return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.profit_type) === null || _c === void 0 ? void 0 : _c.id) === id;
94
- }), { shouldValidate: true });
95
- setValue('segmentTech', segment_tech_list.find(function (_a) {
96
- var _b, _c;
97
- var id = _a.id;
98
- return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.tech_type) === null || _c === void 0 ? void 0 : _c.id) === id;
99
- }), { shouldValidate: true });
100
- setValue('teamSize', team_size_list.find(function (_a) {
101
- var _b, _c;
102
- var id = _a.id;
103
- return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) === id;
104
- }), { shouldValidate: true });
105
82
  onCloseBrandList();
106
83
  };
107
84
  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(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (item) {
@@ -10,7 +10,6 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import TeamSize from '../../../connect/screens/Merchant/TeamSize';
14
13
  import * as React from 'react';
15
14
  import { useForm, FormProvider } from 'react-hook-form';
16
15
  import { useTranslation } from 'react-i18next';
@@ -29,15 +28,8 @@ import BrandName from './BrandName';
29
28
  import TAC from './TAC';
30
29
  import BrandList from './BrandList';
31
30
  import SalesChannels from './SalesChannels';
32
- import SegmentLocations from './SegmentLocations';
33
- import SegmentProfits from './SegmentProfits';
34
- import SegmentTechs from './SegmentTechs';
35
31
  var ListType;
36
32
  (function (ListType) {
37
- ListType["SegmentLocationList"] = "SegmentLocationList";
38
- ListType["SegmentProfitList"] = "SegmentProfitList";
39
- ListType["SegmentTechList"] = "SegmentTechList";
40
- ListType["TeamSizeList"] = "TeamSizeList";
41
33
  ListType["BrandList"] = "BrandList";
42
34
  ListType["BusinessList"] = "BusinessList";
43
35
  })(ListType || (ListType = {}));
@@ -46,7 +38,7 @@ var Merchant = function (_a) {
46
38
  var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
47
39
  var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
48
40
  var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
49
- var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segmentLocation = _g.segmentLocation, segmentProfit = _g.segmentProfit, segmentTech = _g.segmentTech, teamSize = _g.teamSize;
41
+ var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels;
50
42
  var brandList = (responseBody || {}).brand_list;
51
43
  var _h = React.useState(), listActive = _h[0], setListActive = _h[1];
52
44
  React.useEffect(function () {
@@ -62,11 +54,7 @@ var Merchant = function (_a) {
62
54
  brandName: brandName || ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.name) === null || _b === void 0 ? void 0 : _b.en),
63
55
  selectedBrandItem: selectedBrandItem,
64
56
  termAndConditionChecked: termAndConditionChecked,
65
- salesChannels: salesChannels,
66
- segmentLocation: segmentLocation,
67
- segmentProfit: segmentProfit,
68
- segmentTech: segmentTech,
69
- teamSize: teamSize
57
+ salesChannels: salesChannels
70
58
  },
71
59
  mode: 'onChange'
72
60
  });
@@ -81,13 +69,9 @@ var Merchant = function (_a) {
81
69
  dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
82
70
  };
83
71
  React.useEffect(function () {
84
- methods.setValue('segmentLocation', segmentLocation);
85
- methods.setValue('segmentProfit', segmentProfit);
86
- methods.setValue('segmentTech', segmentTech);
87
- methods.setValue('teamSize', teamSize);
88
72
  if (brandName)
89
73
  methods.trigger('brandName');
90
- }, [segmentLocation, segmentProfit, segmentTech, teamSize, brandName]);
74
+ }, [brandName]);
91
75
  React.useEffect(function () {
92
76
  if (error)
93
77
  dispatch(clearError());
@@ -111,11 +95,6 @@ var Merchant = function (_a) {
111
95
  var handleMenuClick = function (flag) {
112
96
  setListActive(flag);
113
97
  };
114
- var isSegmentLocationListActive = listActive === ListType.SegmentLocationList;
115
- var isSegmentProfitListActive = listActive === ListType.SegmentProfitList;
116
- var isSegmentTechListActive = listActive === ListType.SegmentTechList;
117
- var isTeamSizeListActive = listActive === ListType.TeamSizeList;
118
- var isBrandListActive = listActive === ListType.BrandList;
119
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList && !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(SegmentLocations, { show: !isTeamSizeListActive && !isBrandListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(SegmentProfits, { show: !isTeamSizeListActive && !isBrandListActive && !isSegmentLocationListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentProfitList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(SegmentTechs, { show: !isTeamSizeListActive && !isBrandListActive && !isSegmentLocationListActive && !isSegmentProfitListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentTechList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !listActive }), _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') })) }))] })) })) }));
98
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !listActive }), _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') })) }))] })) })) }));
120
99
  };
121
100
  export default React.memo(Merchant);
@@ -9,10 +9,6 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
9
9
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
10
10
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>[] | undefined>;
12
- segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
13
- segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
14
- segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
15
- teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
16
12
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
13
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
18
14
  salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -24,10 +20,6 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
24
20
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
25
21
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
26
22
  }>>[] | undefined>;
27
- segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
28
- segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
29
- segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
30
- teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
31
23
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
32
24
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
33
25
  salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -39,9 +31,5 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
39
31
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
40
32
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
41
33
  }>>[] | undefined>;
42
- segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
43
- segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
44
- segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
45
- teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
46
34
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
47
35
  }>>>;
@@ -86,10 +86,6 @@ export var MerchantValidationSchema = function (isNewBrand) {
86
86
  })
87
87
  .required('enter_brand_name_english_chars_numbers_space'),
88
88
  termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
89
- segmentLocation: yup.object().required('alert_choose_segment_location'),
90
- segmentProfit: yup.object().required('alert_choose_segment_profit'),
91
- segmentTech: yup.object().required('alert_choose_segment_tech'),
92
- teamSize: yup.object().required('alert_choose_teamSize'),
93
89
  salesChannels: yup
94
90
  .array()
95
91
  .min(1, 'choose_atleast_one_channel')
@@ -130,10 +126,6 @@ export var MerchantValidationSchema = function (isNewBrand) {
130
126
  }
131
127
  })
132
128
  .required('choose_atleast_one_channel'),
133
- segmentLocation: yup.object().required('alert_choose_segment_location'),
134
- segmentProfit: yup.object().required('alert_choose_segment_profit'),
135
- segmentTech: yup.object().required('alert_choose_segment_tech'),
136
- teamSize: yup.object().required('alert_choose_teamSize'),
137
129
  brandName: yup.string().optional()
138
130
  });
139
131
  };
@@ -4,6 +4,7 @@ import ConnectCivilIDScreen from '../features/connect/screens/CivilID';
4
4
  import ConnectVerifyPACIScreen from './connect/screens/VerifyPACI';
5
5
  import IndividualScreen from './connect/screens/Individual';
6
6
  import MerchantInfoScreen from './connect/screens/Merchant';
7
+ import BrandSegmentInfoScreen from './connect/screens/BrandSegment';
7
8
  import ConnectOTPScreen from './connect/screens/OTP';
8
9
  import ThankYouScreen from './connect/screens/ThankYou';
9
10
  import ConnectExpressMobileScreen from './connectExpress/screens/Mobile';
@@ -107,6 +108,10 @@ export var connectFeatureScreens = [
107
108
  name: 'CONNECT_MERCHANT_INFO_STEP',
108
109
  element: MerchantInfoScreen
109
110
  },
111
+ {
112
+ name: 'CONNECT_BRAND_SEGMENT_INFO_STEP',
113
+ element: BrandSegmentInfoScreen
114
+ },
110
115
  {
111
116
  name: 'CONNECT_THANK_YOU_STEP',
112
117
  element: ThankYouScreen
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.71-test",
3
+ "version": "2.4.72-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",