@tap-payments/auth-jsconnect 2.3.85-test → 2.3.86-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.
@@ -271,14 +271,6 @@ export declare type BrandInfo = {
271
271
  };
272
272
  channel_services: SaleChannel[];
273
273
  };
274
- export declare type BusinessInfo = {
275
- id: string;
276
- segment: string;
277
- name: {
278
- ar: string;
279
- en: string;
280
- };
281
- };
282
274
  export declare enum FlowsTypes {
283
275
  CONNECT_EXPRESS = "connect_express",
284
276
  CONNECT = "connect",
@@ -1,4 +1,4 @@
1
- import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense, BusinessInfo } from './app';
1
+ import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense } from './app';
2
2
  export declare type MobileFormValues = {
3
3
  mobile: string;
4
4
  countryCode: CountryCode;
@@ -36,7 +36,6 @@ export declare type BrandFormValues = {
36
36
  salesChannels: Array<SaleChannel>;
37
37
  termAndConditionChecked?: boolean;
38
38
  selectedBrandItem: BrandInfo;
39
- business?: BusinessInfo | undefined;
40
39
  };
41
40
  export declare type BrandActivitiesFormValues = {
42
41
  activities: Array<Activity>;
@@ -113,7 +113,6 @@ declare const API: {
113
113
  retrieveIndividual: (id: string, type: string) => Promise<any>;
114
114
  updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
115
115
  getIndividualList: (data: GetIndividualListBody) => Promise<any>;
116
- getBusinessList: (id: string) => Promise<any>;
117
116
  };
118
117
  boardService: {
119
118
  retrieveBoard: (id: string) => Promise<any>;
@@ -141,6 +141,5 @@ declare const individualService: {
141
141
  retrieveIndividual: (id: string, type: string) => Promise<any>;
142
142
  updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
143
143
  getIndividualList: (data: GetIndividualListBody) => Promise<any>;
144
- getBusinessList: (id: string) => Promise<any>;
145
144
  };
146
145
  export { individualService };
@@ -38,24 +38,10 @@ var getIndividualList = function (data) {
38
38
  data: data
39
39
  });
40
40
  };
41
- var getBusinessList = function (id) {
42
- return httpClient({
43
- method: 'post',
44
- url: "".concat(ENDPOINT_PATHS.BUSINESS, "/list"),
45
- data: {
46
- individual_id: id,
47
- list: {
48
- limit: 10,
49
- page: 1
50
- }
51
- }
52
- });
53
- };
54
41
  var individualService = {
55
42
  retrieveIndividualInfo: retrieveIndividualInfo,
56
43
  retrieveIndividual: retrieveIndividual,
57
44
  updateIndividual: updateIndividual,
58
- getIndividualList: getIndividualList,
59
- getBusinessList: getBusinessList
45
+ getIndividualList: getIndividualList
60
46
  };
61
47
  export { individualService };
@@ -38,7 +38,6 @@ declare type BrandInfo = {
38
38
  export declare type UpdateLeadBody = {
39
39
  step_name?: string;
40
40
  id: string;
41
- business_id?: string;
42
41
  encryption_contract?: Array<string>;
43
42
  entity?: {
44
43
  id: string;
@@ -396,9 +396,5 @@
396
396
  "powered_by": "بواسطة",
397
397
  "add_other": "أخرى",
398
398
  "choose_entity_license": "اختر ترخيص المنشأة",
399
- "choose_license_entity": "- الرجاء الاختيار -",
400
- "select_business_label": "اختر الشركة",
401
- "Choose_business": "الرجاء تحديد شركة",
402
- "alert_choose_business": "يُرجى اختيار الشركة",
403
- "other": "اخرى"
399
+ "choose_license_entity": "- الرجاء الاختيار -"
404
400
  }
@@ -426,9 +426,5 @@
426
426
  "powered_by": "Powered by",
427
427
  "add_other": "Other",
428
428
  "choose_entity_license": "Choose Entity License",
429
- "choose_license_entity": "- Please select -",
430
- "select_business_label": "Business",
431
- "choose_business": "Please select a business",
432
- "alert_choose_business": "Please select business",
433
- "other": "other"
429
+ "choose_license_entity": "- Please select -"
434
430
  }
@@ -6,14 +6,6 @@ export declare const OTHER_BRAND: {
6
6
  en: string;
7
7
  };
8
8
  };
9
- export declare const OTHER_BUSINESS: {
10
- id: string;
11
- segment: string;
12
- name: {
13
- ar: string;
14
- en: string;
15
- };
16
- };
17
9
  export declare const defaultCountry: {
18
10
  created: number;
19
11
  updated: number;
@@ -6,14 +6,6 @@ export var OTHER_BRAND = {
6
6
  en: 'other'
7
7
  }
8
8
  };
9
- export var OTHER_BUSINESS = {
10
- id: 'other',
11
- segment: 'other',
12
- name: {
13
- ar: 'other',
14
- en: 'other'
15
- }
16
- };
17
9
  export var defaultCountry = {
18
10
  created: 1577690965000,
19
11
  updated: 1577691209000,
@@ -68,7 +68,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
68
68
  var _a;
69
69
  import API from '../../../api';
70
70
  import { handleNextScreenStep } from '../../../app/settings';
71
- import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_BRAND, OTHER_BUSINESS } from '../../../constants';
71
+ import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_BRAND } from '../../../constants';
72
72
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
73
73
  import { AuthForType, FlowsTypes } from '../../../@types';
74
74
  import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep } from '../../../utils';
@@ -228,7 +228,7 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
228
228
  });
229
229
  }); });
230
230
  export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
231
- var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, businessList, err_1, brands, err_2, countryCode, phone;
231
+ var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, brands, err_1, countryCode, phone;
232
232
  var _c, _d, _e, _f;
233
233
  return __generator(this, function (_g) {
234
234
  switch (_g.label) {
@@ -269,25 +269,15 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
269
269
  _g.label = 4;
270
270
  case 4:
271
271
  _g.trys.push([4, 6, , 7]);
272
- return [4, API.individualService.getBusinessList(leadResponse.individual_id)];
272
+ return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
273
273
  case 5:
274
- businessList = (_g.sent()).list;
275
- leadResponse.business_list = businessList;
274
+ brands = (_g.sent()).brands;
275
+ leadResponse.brand_list = fixBrandList(brands, channels);
276
276
  return [3, 7];
277
277
  case 6:
278
278
  err_1 = _g.sent();
279
279
  return [3, 7];
280
280
  case 7:
281
- _g.trys.push([7, 9, , 10]);
282
- return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
283
- case 8:
284
- brands = (_g.sent()).brands;
285
- leadResponse.brand_list = fixBrandList(brands, channels);
286
- return [3, 10];
287
- case 9:
288
- err_2 = _g.sent();
289
- return [3, 10];
290
- case 10:
291
281
  countryCode = settings.data.businessCountry;
292
282
  phone = (leadResponse.contact || {}).phone;
293
283
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
@@ -299,7 +289,7 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
299
289
  });
300
290
  }); });
301
291
  export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
302
- var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, businessList, err_3, brands, err_4, phone;
292
+ var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brands, err_2, phone;
303
293
  var _b, _c, _d, _e, _f;
304
294
  return __generator(this, function (_g) {
305
295
  switch (_g.label) {
@@ -312,15 +302,15 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
312
302
  count = 1;
313
303
  _g.label = 1;
314
304
  case 1:
315
- if (!(count <= maxCalls)) return [3, 16];
305
+ if (!(count <= maxCalls)) return [3, 13];
316
306
  if (thunkApi.signal.aborted) {
317
- return [3, 16];
307
+ return [3, 13];
318
308
  }
319
309
  return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
320
310
  case 2:
321
311
  authResponse = _g.sent();
322
312
  isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
323
- if (!isSuccess) return [3, 13];
313
+ if (!isSuccess) return [3, 10];
324
314
  lead_id = authResponse.lead_id;
325
315
  if (!lead_id)
326
316
  throw new Error('Lead id is missing');
@@ -337,28 +327,18 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
337
327
  _g.label = 5;
338
328
  case 5:
339
329
  _g.trys.push([5, 7, , 8]);
340
- return [4, API.individualService.getBusinessList(leadResponse.individual_id)];
330
+ return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
341
331
  case 6:
342
- businessList = (_g.sent()).list;
343
- leadResponse.business_list = businessList;
332
+ brands = (_g.sent()).brands;
333
+ leadResponse.brand_list = fixBrandList(brands, channels);
344
334
  return [3, 8];
345
335
  case 7:
346
- err_3 = _g.sent();
336
+ err_2 = _g.sent();
347
337
  return [3, 8];
348
338
  case 8:
349
- _g.trys.push([8, 10, , 11]);
350
- return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
351
- case 9:
352
- brands = (_g.sent()).brands;
353
- leadResponse.brand_list = fixBrandList(brands, channels);
354
- return [3, 11];
355
- case 10:
356
- err_4 = _g.sent();
357
- return [3, 11];
358
- case 11:
359
339
  (_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
360
340
  return [4, sleep(3000)];
361
- case 12:
341
+ case 9:
362
342
  _g.sent();
363
343
  phone = (leadResponse.contact || {}).phone;
364
344
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
@@ -366,19 +346,19 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
366
346
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
367
347
  thunkApi.dispatch(handleNextScreenStep());
368
348
  return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode }];
369
- case 13: return [4, sleep(interval * 1000)];
370
- case 14:
349
+ case 10: return [4, sleep(interval * 1000)];
350
+ case 11:
371
351
  _g.sent();
372
- _g.label = 15;
373
- case 15:
352
+ _g.label = 12;
353
+ case 12:
374
354
  count++;
375
355
  return [3, 1];
376
- case 16: throw new Error('paci_verification_failed');
356
+ case 13: throw new Error('paci_verification_failed');
377
357
  }
378
358
  });
379
359
  }); });
380
360
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
381
- var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, segments, err_5, teamSize, err_6, brand;
361
+ var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, segments, err_3, teamSize, err_4, brand;
382
362
  var _b, _c, _d, _e, _f;
383
363
  return __generator(this, function (_g) {
384
364
  switch (_g.label) {
@@ -406,7 +386,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
406
386
  leadResponse.segments_list = segments.list;
407
387
  return [3, 5];
408
388
  case 4:
409
- err_5 = _g.sent();
389
+ err_3 = _g.sent();
410
390
  return [3, 5];
411
391
  case 5:
412
392
  _g.trys.push([5, 7, , 8]);
@@ -416,7 +396,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
416
396
  leadResponse.team_size_list = teamSize.list;
417
397
  return [3, 8];
418
398
  case 7:
419
- err_6 = _g.sent();
399
+ err_4 = _g.sent();
420
400
  return [3, 8];
421
401
  case 8:
422
402
  if (!leadResponse.brand) return [3, 10];
@@ -433,7 +413,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
433
413
  });
434
414
  }); });
435
415
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
436
- var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, termAndConditionChecked, business, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
416
+ var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
437
417
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
438
418
  return __generator(this, function (_l) {
439
419
  switch (_l.label) {
@@ -441,7 +421,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
441
421
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
442
422
  responseBody = connect.data.otpData.responseBody;
443
423
  leadBrandId = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand_id;
444
- isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, termAndConditionChecked = params.termAndConditionChecked, business = params.business;
424
+ isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem;
445
425
  getAddress = function (value, isTwitter, isWeb) {
446
426
  if (isTwitter)
447
427
  return '@' + value;
@@ -495,10 +475,12 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
495
475
  zh: brandName
496
476
  }
497
477
  };
498
- payload = __assign(__assign({ brand: brandNameBody }, ((business === null || business === void 0 ? void 0 : business.id) &&
499
- (business === null || business === void 0 ? void 0 : business.id) !== OTHER_BUSINESS.id && {
500
- business_id: business.id
501
- })), { id: (responseBody === null || responseBody === void 0 ? void 0 : responseBody.lead_id) || '', step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_BRAND, encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh'] });
478
+ payload = {
479
+ brand: brandNameBody,
480
+ id: (responseBody === null || responseBody === void 0 ? void 0 : responseBody.lead_id) || '',
481
+ step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_BRAND,
482
+ encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
483
+ };
502
484
  return [4, API.leadService.updateLead(payload)];
503
485
  case 5:
504
486
  lead = _l.sent();
@@ -633,8 +615,7 @@ var initialState = {
633
615
  termAndConditionChecked: false,
634
616
  selectedBrandItem: {},
635
617
  responseBody: {
636
- brand_list: [],
637
- business_list: []
618
+ brand_list: []
638
619
  }
639
620
  }
640
621
  }
@@ -729,7 +710,7 @@ export var connectSlice = createSlice({
729
710
  state.loading = false;
730
711
  state.error = null;
731
712
  var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
732
- var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id, business_list = leadResponse.business_list, business_id = leadResponse.business_id;
713
+ var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id;
733
714
  var _c = contact || {}, email = _c.email, phone = _c.phone;
734
715
  var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
735
716
  if (!!fullName) {
@@ -744,11 +725,6 @@ export var connectSlice = createSlice({
744
725
  state.data.individualData.countryCode = countryCode;
745
726
  if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
746
727
  state.data.brandData.brandName = brand.name.en;
747
- var businessList = [];
748
- if ((business_list === null || business_list === void 0 ? void 0 : business_list.length) > 0) {
749
- businessList = __spreadArray(__spreadArray([], business_list, true), [OTHER_BUSINESS], false);
750
- state.data.brandData.business = business_list.find(function (b) { return b.id === business_id; }) || business_list[0];
751
- }
752
728
  var brandList = [];
753
729
  if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
754
730
  var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
@@ -760,8 +736,7 @@ export var connectSlice = createSlice({
760
736
  }
761
737
  state.data.brandData.responseBody = {
762
738
  brand_list: brandList,
763
- channel_list: channel_list,
764
- business_list: businessList
739
+ channel_list: channel_list
765
740
  };
766
741
  state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact });
767
742
  })
@@ -777,7 +752,7 @@ export var connectSlice = createSlice({
777
752
  state.loading = false;
778
753
  state.error = null;
779
754
  var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
780
- var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id, business_list = leadResponse.business_list, business_id = leadResponse.business_id;
755
+ var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id;
781
756
  var _c = contact || {}, email = _c.email, phone = _c.phone;
782
757
  var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
783
758
  if (!!fullName) {
@@ -792,11 +767,6 @@ export var connectSlice = createSlice({
792
767
  state.data.individualData.countryCode = countryCode;
793
768
  if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
794
769
  state.data.brandData.brandName = brand.name.en;
795
- var businessList = [];
796
- if ((business_list === null || business_list === void 0 ? void 0 : business_list.length) > 0) {
797
- businessList = __spreadArray(__spreadArray([], business_list, true), [OTHER_BUSINESS], false);
798
- state.data.brandData.business = business_list.find(function (b) { return b.id === business_id; }) || business_list[0];
799
- }
800
770
  var brandList = [];
801
771
  if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
802
772
  var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
@@ -808,8 +778,7 @@ export var connectSlice = createSlice({
808
778
  }
809
779
  state.data.brandData.responseBody = {
810
780
  brand_list: brandList,
811
- channel_list: channel_list,
812
- business_list: businessList
781
+ channel_list: channel_list
813
782
  };
814
783
  state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact });
815
784
  })
@@ -29,7 +29,6 @@ import TAC from './TAC';
29
29
  import BrandList from './BrandList';
30
30
  import SalesChannels from './SalesChannels';
31
31
  import Segments from './Segments';
32
- import BusinessList from './BusinessList';
33
32
  var ListType;
34
33
  (function (ListType) {
35
34
  ListType["SegmentsList"] = "SegmentsList";
@@ -42,20 +41,18 @@ var Merchant = function (_a) {
42
41
  var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
43
42
  var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
44
43
  var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
45
- var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segment = _g.segment, teamSize = _g.teamSize, business = _g.business;
46
- var _h = responseBody || {}, brandList = _h.brand_list, businessList = _h.business_list;
47
- var _j = React.useState(), listActive = _j[0], setListActive = _j[1];
48
- var hasBusinessList = (businessList === null || businessList === void 0 ? void 0 : businessList.length) > 0;
44
+ var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segment = _g.segment, teamSize = _g.teamSize;
45
+ var brandList = (responseBody || {}).brand_list;
46
+ var _h = React.useState(), listActive = _h[0], setListActive = _h[1];
49
47
  var methods = useForm({
50
- resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand, hasBusinessList)),
48
+ resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
51
49
  defaultValues: {
52
50
  brandName: brandName || ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.name) === null || _b === void 0 ? void 0 : _b.en),
53
51
  selectedBrandItem: selectedBrandItem,
54
52
  termAndConditionChecked: termAndConditionChecked,
55
53
  salesChannels: salesChannels,
56
54
  segment: segment,
57
- teamSize: teamSize,
58
- business: business
55
+ teamSize: teamSize
59
56
  },
60
57
  mode: 'onChange'
61
58
  });
@@ -101,7 +98,6 @@ var Merchant = function (_a) {
101
98
  var isSegmentsListActive = listActive === ListType.SegmentsList;
102
99
  var isTeamSizeListActive = listActive === ListType.TeamSizeList;
103
100
  var isBrandListActive = listActive === ListType.BrandList;
104
- var isBusinessListActive = listActive === ListType.BusinessList;
105
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList && !isTeamSizeListActive && !isSegmentsListActive && !isBusinessListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BusinessList, { show: hasBusinessList && (isOtherBrand || isNewBrand) && !isTeamSizeListActive && !isSegmentsListActive && !isBrandListActive, list: businessList, onListOpen: function () { return handleMenuClick(ListType.BusinessList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive && !isBrandListActive && !isBusinessListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive && !isBrandListActive && !isBusinessListActive, 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') })) }))] })) })) }));
101
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList && !isTeamSizeListActive && !isSegmentsListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive && !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') })) }))] })) })) }));
106
102
  };
107
103
  export default React.memo(Merchant);
@@ -1,5 +1,5 @@
1
1
  import * as yup from 'yup';
2
- export declare const MerchantValidationSchema: (isNewBrand?: boolean, hasBusinessList?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
2
+ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
4
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
5
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -9,7 +9,6 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean, hasBusines
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
- business: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
13
12
  segment: 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
13
  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>>;
15
14
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -23,7 +22,6 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean, hasBusines
23
22
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
23
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
25
24
  }>>[] | undefined>;
26
- business: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
27
25
  segment: 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
26
  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>>;
29
27
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -37,7 +35,6 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean, hasBusines
37
35
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
38
36
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
39
37
  }>>[] | undefined>;
40
- business: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
41
38
  segment: 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>>;
42
39
  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>>;
43
40
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -69,9 +69,8 @@ var validationSalesChannels = function (channels) {
69
69
  }
70
70
  return true;
71
71
  };
72
- export var MerchantValidationSchema = function (isNewBrand, hasBusinessList) {
72
+ export var MerchantValidationSchema = function (isNewBrand) {
73
73
  if (isNewBrand === void 0) { isNewBrand = true; }
74
- if (hasBusinessList === void 0) { hasBusinessList = false; }
75
74
  if (isNewBrand)
76
75
  return yup.object().shape({
77
76
  brandName: yup
@@ -89,7 +88,6 @@ export var MerchantValidationSchema = function (isNewBrand, hasBusinessList) {
89
88
  termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
90
89
  segment: yup.object().required('alert_choose_segment'),
91
90
  teamSize: yup.object().required('alert_choose_teamSize'),
92
- business: hasBusinessList ? yup.object().required('alert_choose_business') : yup.object().optional(),
93
91
  salesChannels: yup
94
92
  .array()
95
93
  .min(1, 'choose_atleast_one_channel')
@@ -130,7 +128,6 @@ export var MerchantValidationSchema = function (isNewBrand, hasBusinessList) {
130
128
  }
131
129
  })
132
130
  .required('choose_atleast_one_channel'),
133
- business: yup.object().optional(),
134
131
  segment: yup.object().required('alert_choose_segment'),
135
132
  teamSize: yup.object().required('alert_choose_teamSize'),
136
133
  brandName: yup.string().optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.85-test",
3
+ "version": "2.3.86-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { BusinessInfo } from '../../../../@types';
3
- interface BusinessListProps {
4
- show: boolean;
5
- list: Array<BusinessInfo>;
6
- onListOpen?: () => void;
7
- onListClose?: () => void;
8
- }
9
- declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BusinessListProps) => JSX.Element>;
10
- export default _default;
@@ -1,82 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
- import * as React from 'react';
25
- import { useTranslation } from 'react-i18next';
26
- import { useFormContext, useController } from 'react-hook-form';
27
- import Box from '@mui/material/Box';
28
- import { styled } from '@mui/material/styles';
29
- import { useLanguage } from '../../../../hooks';
30
- import SimpleList from '../../../../components/SimpleList';
31
- import Text from '../../../../components/Text';
32
- import ExpandIcon from '../../../../components/ExpandIcon';
33
- import Collapse from '../../../../components/Collapse';
34
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
35
- import Input from '../../../shared/Input';
36
- import CheckIcon from '../../../shared/CheckIcon';
37
- var InputStyled = styled(Input)(function () { return ({
38
- '& .MuiInputBase-input': {
39
- cursor: 'pointer'
40
- }
41
- }); });
42
- var BusinessContainer = styled(Box)(function () { return ({
43
- display: 'flex'
44
- }); });
45
- var BusinessNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
46
- var theme = _a.theme, isSelected = _a.isSelected;
47
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
48
- });
49
- var BusinessList = function (_a) {
50
- var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
51
- var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
52
- var t = useTranslation().t;
53
- var isAr = useLanguage().isAr;
54
- var control = useFormContext().control;
55
- var businessControl = useController({ control: control, name: 'business' });
56
- var business = businessControl.field.value;
57
- var onOpenBusinessList = function (event) {
58
- var _a;
59
- setAnchorEl(event.currentTarget);
60
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
61
- };
62
- var onCloseBusinessList = function () {
63
- var _a;
64
- setAnchorEl(null);
65
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
66
- };
67
- var getBusinessName = function (business) {
68
- var _a, _b;
69
- return (isAr ? (_a = business === null || business === void 0 ? void 0 : business.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = business === null || business === void 0 ? void 0 : business.name) === null || _b === void 0 ? void 0 : _b.en) || '';
70
- };
71
- var getBusinessId = function (item) {
72
- return (item === null || item === void 0 ? void 0 : item.id) || '';
73
- };
74
- var onSelectItem = function (business) {
75
- businessControl.field.onChange(business);
76
- onCloseBusinessList();
77
- };
78
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { label: t('select_business_label'), onClick: !!anchorEl ? onCloseBusinessList : onOpenBusinessList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_business'), value: t(getBusinessName(business)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', searchValuePath: ['id', 'name.ar', 'name.en'], list: list, onSelectItem: onSelectItem, renderItem: function (item) {
79
- return (_jsxs(_Fragment, { children: [_jsx(BusinessContainer, { children: _jsx(BusinessNameText, __assign({ isSelected: getBusinessId(item) === getBusinessId(business) }, { children: t(getBusinessName(item)) })) }), getBusinessId(item) === getBusinessId(business) && _jsx(CheckIcon, {})] }));
80
- } }) }))] })) })));
81
- };
82
- export default React.memo(BusinessList);