@tap-payments/auth-jsconnect 2.4.72-test → 2.4.74-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.
@@ -633,4 +633,8 @@ export type VerifyExpressTokenParams = {
633
633
  };
634
634
  lead_id: string;
635
635
  };
636
+ export declare enum MerchantStatus {
637
+ DISABLED = "disabled",
638
+ ENABLED = "enabled"
639
+ }
636
640
  export {};
@@ -80,3 +80,8 @@ export var VerificationStatus;
80
80
  VerificationStatus["ENTERED"] = "entered";
81
81
  VerificationStatus["NOT_ENTERED"] = "not_entered";
82
82
  })(VerificationStatus || (VerificationStatus = {}));
83
+ export var MerchantStatus;
84
+ (function (MerchantStatus) {
85
+ MerchantStatus["DISABLED"] = "disabled";
86
+ MerchantStatus["ENABLED"] = "enabled";
87
+ })(MerchantStatus || (MerchantStatus = {}));
@@ -704,9 +704,9 @@ export var brandSlice = createSlice({
704
704
  var _a;
705
705
  return team.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.team) === null || _a === void 0 ? void 0 : _a.id);
706
706
  });
707
- state.data.brandSegmentData.segmentLocation = selectedSegmentLocation;
708
- state.data.brandSegmentData.segmentProfit = selectedSegmentProfit;
709
- state.data.brandSegmentData.segmentTech = selectedSegmentTech;
707
+ state.data.brandSegmentData.segmentLocation = selectedSegmentLocation || (segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList[0]);
708
+ state.data.brandSegmentData.segmentProfit = selectedSegmentProfit || (segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList[0]);
709
+ state.data.brandSegmentData.segmentTech = selectedSegmentTech || (segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList[1]);
710
710
  state.data.brandSegmentData.teamSize = selectedTeamSize;
711
711
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { teamSizeList: teamSizeList, segmentLocationList: segmentLocationList, segmentProfitList: segmentProfitList, segmentTechList: segmentTechList });
712
712
  })
@@ -944,23 +944,27 @@ export var connectSlice = createSlice({
944
944
  state.error = null;
945
945
  var _a = action.payload, formData = _a.formData, response = _a.response;
946
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) {
947
+ var selectedSegmentLocation = segment_location_list === null || segment_location_list === void 0 ? void 0 : segment_location_list.find(function (location) {
948
948
  var _a, _b;
949
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
950
  });
951
- state.data.brandSegmentData.segmentProfit = segment_profit_list === null || segment_profit_list === void 0 ? void 0 : segment_profit_list.find(function (profit) {
951
+ var selectedSegmentProfit = segment_profit_list === null || segment_profit_list === void 0 ? void 0 : segment_profit_list.find(function (profit) {
952
952
  var _a, _b;
953
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
954
  });
955
- state.data.brandSegmentData.segmentTech = segment_tech_list === null || segment_tech_list === void 0 ? void 0 : segment_tech_list.find(function (tech) {
955
+ var selectedSegmentTech = segment_tech_list === null || segment_tech_list === void 0 ? void 0 : segment_tech_list.find(function (tech) {
956
956
  var _a, _b;
957
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
958
  });
959
- state.data.brandSegmentData.teamSize = team_size_list === null || team_size_list === void 0 ? void 0 : team_size_list.find(function (_a) {
959
+ var selectedTeamSize = team_size_list === null || team_size_list === void 0 ? void 0 : team_size_list.find(function (_a) {
960
960
  var _b, _c;
961
961
  var id = _a.id;
962
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
963
  });
964
+ state.data.brandSegmentData.segmentLocation = selectedSegmentLocation || (segment_location_list === null || segment_location_list === void 0 ? void 0 : segment_location_list[0]);
965
+ state.data.brandSegmentData.segmentProfit = selectedSegmentProfit || (segment_profit_list === null || segment_profit_list === void 0 ? void 0 : segment_profit_list[0]);
966
+ state.data.brandSegmentData.segmentTech = selectedSegmentTech || (segment_tech_list === null || segment_tech_list === void 0 ? void 0 : segment_tech_list[1]);
967
+ state.data.brandSegmentData.teamSize = selectedTeamSize;
964
968
  state.data.brandData = __assign(__assign({}, formData), { responseBody: __assign(__assign({}, state.data.brandData.responseBody), { brand: brand }) });
965
969
  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 };
966
970
  })
@@ -6,12 +6,12 @@ import { hasVerifiedValue, isTwitter, isWebsite, mapSalesChannel } from '../../.
6
6
  import { brandSelector, clearError } from '../../../app/brand/brandStore';
7
7
  import SalesChannel from '../../../shared/SalesChannels';
8
8
  var SalesChannels = function (_a) {
9
- var _b;
9
+ var _b, _c;
10
10
  var readOnly = _a.readOnly;
11
11
  var control = useFormContext().control;
12
12
  var dispatch = useAppDispatch();
13
- var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
14
- var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
13
+ var _d = useController({ control: control, name: 'salesChannels' }), fieldState = _d.fieldState, field = _d.field;
14
+ var _e = useAppSelector(brandSelector), data = _e.data, error = _e.error;
15
15
  var brand = (data.verify.responseBody || {}).brand;
16
16
  var channelList = (data.verify.responseBody || {}).channel_list;
17
17
  var isChannelVerified = function (id, selected) {
@@ -31,6 +31,6 @@ var SalesChannels = function (_a) {
31
31
  dispatch(clearError());
32
32
  field.onChange(channels);
33
33
  };
34
- return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id, selected) { return isChannelVerified(id, selected); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
34
+ return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id, selected) { return isChannelVerified(id, selected); }, error: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.trim(), list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
35
35
  };
36
36
  export default SalesChannels;
@@ -31,12 +31,6 @@ var validationSalesChannels = function (channels) {
31
31
  typeDic[key] = channel.address || '';
32
32
  }
33
33
  });
34
- for (var key in dic) {
35
- var values = dic[key];
36
- var atLestOne = values.every(function (item) { return item === ''; });
37
- if (atLestOne)
38
- return "enter_at_least_one_".concat(key);
39
- }
40
34
  for (var key in typeDic) {
41
35
  var value = typeDic[key];
42
36
  if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
@@ -67,6 +61,12 @@ var validationSalesChannels = function (channels) {
67
61
  return 'invalid_call_center_number';
68
62
  }
69
63
  }
64
+ for (var key in dic) {
65
+ var values = dic[key];
66
+ var atLestOne = values.every(function (item) { return item === ''; });
67
+ if (atLestOne)
68
+ return ' ';
69
+ }
70
70
  return true;
71
71
  };
72
72
  export var BrandValidationSchema = function () {
@@ -6,12 +6,12 @@ import { connectSelector, clearError } from '../../../app/connect/connectStore';
6
6
  import { mapSalesChannel } from '../../../../utils';
7
7
  import SalesChannel from '../../../shared/SalesChannels';
8
8
  var SalesChannels = function (_a) {
9
- var _b;
10
- var _c = useFormContext(), control = _c.control, setValue = _c.setValue, getValues = _c.getValues;
9
+ var _b, _c;
10
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue, getValues = _d.getValues;
11
11
  var dispatch = useAppDispatch();
12
- var _d = useController({ control: control, name: 'salesChannels' }), fieldState = _d.fieldState, field = _d.field;
13
- var _e = useAppSelector(connectSelector), data = _e.data, error = _e.error;
14
- var _f = data.brandData, selectedBrandItem = _f.selectedBrandItem, responseBody = _f.responseBody, defaultSalesChannels = _f.salesChannels;
12
+ var _e = useController({ control: control, name: 'salesChannels' }), fieldState = _e.fieldState, field = _e.field;
13
+ var _f = useAppSelector(connectSelector), data = _f.data, error = _f.error;
14
+ var _g = data.brandData, selectedBrandItem = _g.selectedBrandItem, responseBody = _g.responseBody, defaultSalesChannels = _g.salesChannels;
15
15
  var channelList = (responseBody || {}).channel_list;
16
16
  var selectedBrandControl = getValues('selectedBrandItem');
17
17
  React.useEffect(function () {
@@ -33,6 +33,6 @@ var SalesChannels = function (_a) {
33
33
  dispatch(clearError());
34
34
  field.onChange(channels);
35
35
  };
36
- return (_jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, selectFirstIconListener: selectedBrandControl === null || selectedBrandControl === void 0 ? void 0 : selectedBrandControl.id, onChange: onChange, defaultValue: selectedSalesChannels }));
36
+ return (_jsx(SalesChannel, { error: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.trim(), list: channelList, selectFirstIconListener: selectedBrandControl === null || selectedBrandControl === void 0 ? void 0 : selectedBrandControl.id, onChange: onChange, defaultValue: selectedSalesChannels }));
37
37
  };
38
38
  export default SalesChannels;
@@ -31,12 +31,6 @@ var validationSalesChannels = function (channels) {
31
31
  typeDic[key] = channel.address || '';
32
32
  }
33
33
  });
34
- for (var key in dic) {
35
- var values = dic[key];
36
- var atLestOne = values.every(function (item) { return item === ''; });
37
- if (atLestOne)
38
- return "enter_at_least_one_".concat(key);
39
- }
40
34
  for (var key in typeDic) {
41
35
  var value = typeDic[key];
42
36
  if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
@@ -67,6 +61,12 @@ var validationSalesChannels = function (channels) {
67
61
  return 'invalid_call_center_number';
68
62
  }
69
63
  }
64
+ for (var key in dic) {
65
+ var values = dic[key];
66
+ var atLestOne = values.every(function (item) { return item === ''; });
67
+ if (atLestOne)
68
+ return ' ';
69
+ }
70
70
  return true;
71
71
  };
72
72
  export var MerchantValidationSchema = function (isNewBrand) {
@@ -13,6 +13,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
+ import { MerchantStatus } from '../../../@types';
16
17
  import { FlowsButtons } from '../../shared/Button';
17
18
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../constants';
18
19
  import { useAppSelector, useLanguage } from '../../../hooks';
@@ -53,6 +54,7 @@ var SuccessFlowButtons = function (_a) {
53
54
  var primary_contact = (business || {}).primary_contact;
54
55
  var _g = entity || {}, license = _g.license, vat_id = _g.vat_id, legal_name = _g.legal_name;
55
56
  var count = (individuals || {}).count;
57
+ var _h = merchant || {}, acceptance_status = _h.acceptance_status, payout_status = _h.payout_status;
56
58
  var username = isAr ? concatenateObjectValues((names === null || names === void 0 ? void 0 : names.ar) || (names === null || names === void 0 ? void 0 : names.en), ['first', 'last']) : concatenateObjectValues(names === null || names === void 0 ? void 0 : names.en, ['first', 'last']);
57
59
  var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
58
60
  var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
@@ -60,8 +62,8 @@ var SuccessFlowButtons = function (_a) {
60
62
  var taxID = vat_id || '';
61
63
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || t('brand');
62
64
  var entityLegalName = shortenString(isAr ? legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar : legal_name === null || legal_name === void 0 ? void 0 : legal_name.en, 20) || t('entity');
63
- var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
64
- var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
65
+ var isAcceptance = acceptance_status === MerchantStatus.ENABLED;
66
+ var isPayout = payout_status === MerchantStatus.ENABLED;
65
67
  var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
66
68
  var email = (primary_contact || {}).email;
67
69
  var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, boardId, boardInfoId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.72-test",
3
+ "version": "2.4.74-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",