@tap-payments/auth-jsconnect 2.1.14-test → 2.1.15-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.
@@ -353,7 +353,7 @@
353
353
  },
354
354
  {
355
355
  "ty": "fl",
356
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 4 },
356
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 4 },
357
357
  "o": { "a": 0, "k": 100, "ix": 5 },
358
358
  "r": 1,
359
359
  "bm": 0,
@@ -416,7 +416,7 @@
416
416
  },
417
417
  {
418
418
  "ty": "st",
419
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
419
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
420
420
  "o": { "a": 0, "k": 100, "ix": 4 },
421
421
  "w": { "a": 0, "k": 2, "ix": 5 },
422
422
  "lc": 1,
@@ -512,7 +512,7 @@
512
512
  },
513
513
  {
514
514
  "ty": "st",
515
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
515
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
516
516
  "o": { "a": 0, "k": 100, "ix": 4 },
517
517
  "w": { "a": 0, "k": 2, "ix": 5 },
518
518
  "lc": 1,
@@ -608,7 +608,7 @@
608
608
  },
609
609
  {
610
610
  "ty": "st",
611
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
611
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
612
612
  "o": { "a": 0, "k": 100, "ix": 4 },
613
613
  "w": { "a": 0, "k": 2, "ix": 5 },
614
614
  "lc": 1,
@@ -704,7 +704,7 @@
704
704
  },
705
705
  {
706
706
  "ty": "st",
707
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
707
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
708
708
  "o": { "a": 0, "k": 100, "ix": 4 },
709
709
  "w": { "a": 0, "k": 2, "ix": 5 },
710
710
  "lc": 1,
@@ -800,7 +800,7 @@
800
800
  },
801
801
  {
802
802
  "ty": "st",
803
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
803
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
804
804
  "o": { "a": 0, "k": 100, "ix": 4 },
805
805
  "w": { "a": 0, "k": 2, "ix": 5 },
806
806
  "lc": 1,
@@ -896,7 +896,7 @@
896
896
  },
897
897
  {
898
898
  "ty": "st",
899
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
899
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
900
900
  "o": { "a": 0, "k": 100, "ix": 4 },
901
901
  "w": { "a": 0, "k": 2, "ix": 5 },
902
902
  "lc": 1,
@@ -992,7 +992,7 @@
992
992
  },
993
993
  {
994
994
  "ty": "st",
995
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
995
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
996
996
  "o": { "a": 0, "k": 100, "ix": 4 },
997
997
  "w": { "a": 0, "k": 2, "ix": 5 },
998
998
  "lc": 1,
@@ -1088,7 +1088,7 @@
1088
1088
  },
1089
1089
  {
1090
1090
  "ty": "st",
1091
- "c": { "a": 0, "k": [0.905882358551, 0.921568632126, 0.929411768913, 1], "ix": 3 },
1091
+ "c": { "a": 0, "k": [0.600000023842, 0.674509823322, 0.690196096897, 1], "ix": 3 },
1092
1092
  "o": { "a": 0, "k": 100, "ix": 4 },
1093
1093
  "w": { "a": 0, "k": 2, "ix": 5 },
1094
1094
  "lc": 1,
@@ -36,13 +36,13 @@ export var CONNECT_SCREENS_NAVIGATION = [
36
36
  },
37
37
  {
38
38
  name: 'CONNECT_VERIFY_PACI_STEP',
39
- next: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_MERCHANT_INFO_STEP'],
39
+ next: 'CONNECT_INDIVIDUAL_STEP',
40
40
  prev: 'CONNECT_CIVIL_ID_STEP',
41
41
  order: 2
42
42
  },
43
43
  {
44
44
  name: 'CONNECT_OTP_STEP',
45
- next: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_MERCHANT_INFO_STEP'],
45
+ next: 'CONNECT_INDIVIDUAL_STEP',
46
46
  prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
47
47
  order: 2
48
48
  },
@@ -766,7 +766,7 @@ var initialState = {
766
766
  },
767
767
  activitiesData: {
768
768
  activities: [],
769
- operationStartDate: moment(new Date()).format('YYYY-MM-DD')
769
+ operationStartDate: ''
770
770
  },
771
771
  customersData: {
772
772
  customerLocations: [],
@@ -809,7 +809,7 @@ export var businessSlice = createSlice({
809
809
  state.data.otpData.isNID = false;
810
810
  if (isRequireOTP)
811
811
  return;
812
- var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type, business_name = _d.business_name;
812
+ var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
813
813
  var issuingDate = (brandData === null || brandData === void 0 ? void 0 : brandData.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
814
814
  if (issuingDate)
815
815
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
@@ -827,11 +827,13 @@ export var businessSlice = createSlice({
827
827
  var licenseList = (busResData || {}).licenseList;
828
828
  var selectedLicenseData = selectedLicense;
829
829
  if (number_1) {
830
- var findFL = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
830
+ var findLicense = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
831
831
  var license = _a.license;
832
832
  return (license === null || license === void 0 ? void 0 : license.number) === number_1;
833
833
  });
834
- if (findFL || business_type === BusinessType.FL) {
834
+ if (findLicense)
835
+ selectedLicenseData = findLicense;
836
+ else if (!findLicense && business_type === BusinessType.FL) {
835
837
  selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_1 } });
836
838
  }
837
839
  else
@@ -874,7 +876,7 @@ export var businessSlice = createSlice({
874
876
  state.data.otpData = formData;
875
877
  state.data.otpData.responseBody = data;
876
878
  state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
877
- var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type, business_name = _d.business_name;
879
+ var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
878
880
  var issuingDate = (brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
879
881
  if (issuingDate)
880
882
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
@@ -892,11 +894,13 @@ export var businessSlice = createSlice({
892
894
  var licenseList = (busResData || {}).licenseList;
893
895
  var selectedLicenseData = selectedLicense;
894
896
  if (number_2) {
895
- var findFL = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
897
+ var findLicense = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
896
898
  var license = _a.license;
897
899
  return (license === null || license === void 0 ? void 0 : license.number) === number_2;
898
900
  });
899
- if (findFL || business_type === BusinessType.FL) {
901
+ if (findLicense)
902
+ selectedLicenseData = findLicense;
903
+ else if (!findLicense && business_type === BusinessType.FL) {
900
904
  selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_2 } });
901
905
  }
902
906
  else
@@ -1050,12 +1054,12 @@ export var businessSlice = createSlice({
1050
1054
  var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData;
1051
1055
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
1052
1056
  var entity = data.entity, entity_activities = data.entity_activities;
1053
- var issuingDate = (_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date;
1057
+ var issuingDate = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date) || new Date().getTime();
1054
1058
  if ((accountData === null || accountData === void 0 ? void 0 : accountData.status) === 'ALREADY_TAKEN') {
1055
1059
  state.error = 'signup_user_exists_error';
1056
1060
  return;
1057
1061
  }
1058
- if (!!issuingDate) {
1062
+ if (issuingDate) {
1059
1063
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
1060
1064
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
1061
1065
  }
@@ -10,6 +10,7 @@ export declare const createCivilIdAuth: import("@reduxjs/toolkit").AsyncThunk<{
10
10
  formData: CivilFormValues;
11
11
  }, CivilFormValues, {}>;
12
12
  export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
13
+ export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
13
14
  export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
14
15
  response: any;
15
16
  formData: {
@@ -18,13 +19,10 @@ export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
18
19
  dob: string;
19
20
  };
20
21
  }, NIDFormValues, {}>;
21
- export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
22
22
  export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
23
23
  authResponse: any;
24
24
  leadResponse: any;
25
- isNewUser: any;
26
25
  countryCode: CountryCode;
27
- userInfoMissed: boolean;
28
26
  }, OTPFormValues, {}>;
29
27
  interface verifyPACIParams {
30
28
  onSuccess?: () => void;
@@ -32,9 +30,7 @@ interface verifyPACIParams {
32
30
  export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
33
31
  authResponse: any;
34
32
  leadResponse: any;
35
- isNewUser: any;
36
33
  countryCode: CountryCode;
37
- userInfoMissed: boolean;
38
34
  }, verifyPACIParams, {}>;
39
35
  export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
40
36
  leadResponse: any;
@@ -75,9 +75,9 @@ import { defaultCountry } from '../../../constants';
75
75
  import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isTwitter, isWebsite, fixBrandList } from '../../../utils';
76
76
  export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
77
77
  var settings, requestBody, data;
78
- var _a, _b;
79
- return __generator(this, function (_c) {
80
- switch (_c.label) {
78
+ var _a, _b, _c;
79
+ return __generator(this, function (_d) {
80
+ switch (_d.label) {
81
81
  case 0:
82
82
  settings = thunkApi.getState().settings;
83
83
  requestBody = {
@@ -93,20 +93,20 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
93
93
  };
94
94
  return [4, API.authService.createAuth(requestBody)];
95
95
  case 1:
96
- data = (_c.sent()).data;
97
- if (!data.errors) {
98
- thunkApi.dispatch(handleNextScreenStep());
99
- (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
100
- }
96
+ data = (_d.sent()).data;
97
+ if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
98
+ throw new Error(data.errors[0].description);
99
+ thunkApi.dispatch(handleNextScreenStep());
100
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
101
101
  return [2, { response: data, formData: params }];
102
102
  }
103
103
  });
104
104
  }); });
105
105
  export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
106
106
  var settings, requestBody, data;
107
- var _a, _b;
108
- return __generator(this, function (_c) {
109
- switch (_c.label) {
107
+ var _a, _b, _c;
108
+ return __generator(this, function (_d) {
109
+ switch (_d.label) {
110
110
  case 0:
111
111
  settings = thunkApi.getState().settings;
112
112
  requestBody = {
@@ -122,19 +122,20 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
122
122
  };
123
123
  return [4, API.authService.createAuth(requestBody)];
124
124
  case 1:
125
- data = (_c.sent()).data;
126
- if (!data.errors) {
127
- thunkApi.dispatch(handleNextScreenStep());
128
- (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
129
- }
125
+ data = (_d.sent()).data;
126
+ if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
127
+ throw new Error(data.errors[0].description);
128
+ thunkApi.dispatch(handleNextScreenStep());
129
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
130
130
  return [2, { response: data, formData: params }];
131
131
  }
132
132
  });
133
133
  }); });
134
134
  export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
135
135
  var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
136
- return __generator(this, function (_c) {
137
- switch (_c.label) {
136
+ var _c;
137
+ return __generator(this, function (_d) {
138
+ switch (_d.label) {
138
139
  case 0:
139
140
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
140
141
  _b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
@@ -151,25 +152,27 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
151
152
  };
152
153
  return [4, API.authService.createAuth(requestBody)];
153
154
  case 1:
154
- data = (_c.sent()).data;
155
+ data = (_d.sent()).data;
156
+ if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
157
+ throw new Error(data.errors[0].description);
155
158
  return [2, data];
156
159
  }
157
160
  });
158
161
  }); });
159
- export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
160
- var settings, identification_id_type, requestBody, data;
161
- var _a, _b;
162
- return __generator(this, function (_c) {
163
- switch (_c.label) {
162
+ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
163
+ var _a, settings, connect, _b, nid, dob, type, requestBody, data;
164
+ var _c;
165
+ return __generator(this, function (_d) {
166
+ switch (_d.label) {
164
167
  case 0:
165
- settings = thunkApi.getState().settings;
166
- identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
168
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
169
+ _b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
167
170
  requestBody = {
168
171
  lang: settings.data.language,
169
172
  user_credentail: {
170
- identification_id: params.nid,
171
- identification_id_type: identification_id_type,
172
- date_of_birth: params.dob,
173
+ identification_id: nid,
174
+ identification_id_type: type,
175
+ date_of_birth: dob,
173
176
  country_code: settings.data.businessCountry.iso2
174
177
  },
175
178
  sign_in: false,
@@ -184,28 +187,27 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
184
187
  };
185
188
  return [4, API.authService.createAuth(requestBody)];
186
189
  case 1:
187
- data = (_c.sent()).data;
188
- if (!data.errors) {
189
- thunkApi.dispatch(handleNextScreenStep());
190
- (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
191
- }
192
- return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
190
+ data = (_d.sent()).data;
191
+ if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
192
+ throw new Error(data.errors[0].description);
193
+ return [2, data];
193
194
  }
194
195
  });
195
196
  }); });
196
- export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
197
- var _a, settings, connect, _b, nid, dob, type, requestBody, data;
198
- return __generator(this, function (_c) {
199
- switch (_c.label) {
197
+ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
198
+ var settings, identification_id_type, requestBody, data;
199
+ var _a, _b, _c;
200
+ return __generator(this, function (_d) {
201
+ switch (_d.label) {
200
202
  case 0:
201
- _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
202
- _b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
203
+ settings = thunkApi.getState().settings;
204
+ identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
203
205
  requestBody = {
204
206
  lang: settings.data.language,
205
207
  user_credentail: {
206
- identification_id: nid,
207
- identification_id_type: type,
208
- date_of_birth: dob,
208
+ identification_id: params.nid,
209
+ identification_id_type: identification_id_type,
210
+ date_of_birth: params.dob,
209
211
  country_code: settings.data.businessCountry.iso2
210
212
  },
211
213
  sign_in: false,
@@ -220,16 +222,20 @@ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thu
220
222
  };
221
223
  return [4, API.authService.createAuth(requestBody)];
222
224
  case 1:
223
- data = (_c.sent()).data;
224
- return [2, data];
225
+ data = (_d.sent()).data;
226
+ if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
227
+ throw new Error(data.errors[0].description);
228
+ thunkApi.dispatch(handleNextScreenStep());
229
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
230
+ return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
225
231
  }
226
232
  });
227
233
  }); });
228
234
  export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
229
- var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, individual_id, leadBody, leadResponse, _c, isNewUser, channels, brands, err_1, countryCode, contact, name, _d, phone, email, userInfoMissed;
230
- var _e, _f, _g, _h;
231
- return __generator(this, function (_j) {
232
- switch (_j.label) {
235
+ var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, brands, err_1, countryCode, phone;
236
+ var _c, _d, _e, _f;
237
+ return __generator(this, function (_g) {
238
+ switch (_g.label) {
233
239
  case 0:
234
240
  _a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
235
241
  startWithNID = connect.data.otpData.authFor === AuthForType.NATIONAL_ID;
@@ -250,66 +256,48 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
250
256
  };
251
257
  return [4, API.authService.verifyAuth(payload)];
252
258
  case 1:
253
- data = (_j.sent()).data;
254
- if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
259
+ data = (_g.sent()).data;
260
+ if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
255
261
  throw new Error(data.errors[0].description);
256
- lead_id = data.lead_id, individual_id = data.individual_id;
257
- leadBody = {
258
- country_code: settings.data.businessCountry.iso2,
259
- individual_id: individual_id
260
- };
261
- if (!lead_id) return [3, 3];
262
+ lead_id = data.lead_id;
263
+ if (!lead_id)
264
+ throw new Error('Lead id is missing');
262
265
  return [4, API.leadService.retrieveLead(lead_id)];
263
266
  case 2:
264
- _c = _j.sent();
265
- return [3, 5];
266
- case 3: return [4, API.leadService.createLead(leadBody)];
267
- case 4:
268
- _c = _j.sent();
269
- _j.label = 5;
270
- case 5:
271
- leadResponse = (_c).data;
272
- if ((_f = leadResponse.errors) === null || _f === void 0 ? void 0 : _f.length)
267
+ leadResponse = (_g.sent()).data;
268
+ if ((_d = leadResponse.errors) === null || _d === void 0 ? void 0 : _d.length)
273
269
  throw new Error(leadResponse.errors[0].description);
274
- isNewUser = leadResponse.is_new_individual;
275
- if (!!isNewUser) return [3, 10];
276
270
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
277
- case 6:
278
- channels = (_j.sent()).list;
271
+ case 3:
272
+ channels = (_g.sent()).list;
279
273
  leadResponse.channel_list = channels;
280
- _j.label = 7;
281
- case 7:
282
- _j.trys.push([7, 9, , 10]);
274
+ _g.label = 4;
275
+ case 4:
276
+ _g.trys.push([4, 6, , 7]);
283
277
  return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
284
- case 8:
285
- brands = (_j.sent()).brands;
278
+ case 5:
279
+ brands = (_g.sent()).brands;
286
280
  leadResponse.brand_list = fixBrandList(brands, channels);
287
- return [3, 10];
288
- case 9:
289
- err_1 = _j.sent();
290
- return [3, 10];
291
- case 10:
281
+ return [3, 7];
282
+ case 6:
283
+ err_1 = _g.sent();
284
+ return [3, 7];
285
+ case 7:
292
286
  countryCode = settings.data.businessCountry;
293
- contact = leadResponse.contact, name = leadResponse.name;
294
- _d = contact || {}, phone = _d.phone, email = _d.email;
295
- userInfoMissed = (!phone || !email || !name) && !isNewUser;
287
+ phone = (leadResponse.contact || {}).phone;
296
288
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
297
289
  countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
298
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
299
- if (isNewUser || userInfoMissed) {
300
- thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
301
- return [2, { authResponse: data, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
302
- }
303
- thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
304
- return [2, { authResponse: data, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
290
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
291
+ thunkApi.dispatch(handleNextScreenStep());
292
+ return [2, { authResponse: data, leadResponse: leadResponse, countryCode: countryCode }];
305
293
  }
306
294
  });
307
295
  }); });
308
296
  export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
309
- var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, individual_id, leadBody, leadResponse, _b, isNewUser, countryCode, contact, name_1, _c, phone, email, userInfoMissed, channels, brands, err_2;
310
- var _d, _e, _f, _g, _h, _j;
311
- return __generator(this, function (_k) {
312
- switch (_k.label) {
297
+ var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brands, err_2, phone;
298
+ var _b, _c, _d, _e, _f;
299
+ return __generator(this, function (_g) {
300
+ switch (_g.label) {
313
301
  case 0:
314
302
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
315
303
  responseBody = connect.data.civilIdData.responseBody;
@@ -317,131 +305,105 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
317
305
  interval = 3;
318
306
  maxCalls = Math.floor(expiry / interval);
319
307
  count = 1;
320
- _k.label = 1;
308
+ _g.label = 1;
321
309
  case 1:
322
- if (!(count <= maxCalls)) return [3, 19];
310
+ if (!(count <= maxCalls)) return [3, 13];
323
311
  if (thunkApi.signal.aborted) {
324
- return [3, 19];
312
+ return [3, 13];
325
313
  }
326
314
  return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
327
315
  case 2:
328
- authResponse = _k.sent();
329
- isSuccess = ((_d = authResponse.status) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === 'success';
330
- if (!isSuccess) return [3, 16];
331
- lead_id = authResponse.lead_id, individual_id = authResponse.individual_id;
332
- leadBody = {
333
- country_code: settings.data.businessCountry.iso2,
334
- individual_id: individual_id
335
- };
336
- if (!lead_id) return [3, 4];
316
+ authResponse = _g.sent();
317
+ isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
318
+ if (!isSuccess) return [3, 10];
319
+ lead_id = authResponse.lead_id;
320
+ if (!lead_id)
321
+ throw new Error('Lead id is missing');
337
322
  return [4, API.leadService.retrieveLead(lead_id)];
338
323
  case 3:
339
- _b = _k.sent();
340
- return [3, 6];
341
- case 4: return [4, API.leadService.createLead(leadBody)];
342
- case 5:
343
- _b = _k.sent();
344
- _k.label = 6;
345
- case 6:
346
- leadResponse = (_b).data;
347
- if ((_e = leadResponse.errors) === null || _e === void 0 ? void 0 : _e.length)
324
+ leadResponse = (_g.sent()).data;
325
+ if ((_c = leadResponse.errors) === null || _c === void 0 ? void 0 : _c.length)
348
326
  throw new Error(leadResponse.errors[0].description);
349
- isNewUser = leadResponse.is_new_individual;
350
327
  countryCode = settings.data.businessCountry;
351
- contact = leadResponse.contact, name_1 = leadResponse.name;
352
- _c = contact || {}, phone = _c.phone, email = _c.email;
353
- userInfoMissed = (!phone || !email || !name_1) && !isNewUser;
354
- if (!!isNewUser) return [3, 13];
355
328
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
356
- case 7:
357
- channels = (_k.sent()).list;
329
+ case 4:
330
+ channels = (_g.sent()).list;
358
331
  leadResponse.channel_list = channels;
359
- _k.label = 8;
360
- case 8:
361
- _k.trys.push([8, 10, , 11]);
332
+ _g.label = 5;
333
+ case 5:
334
+ _g.trys.push([5, 7, , 8]);
362
335
  return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
363
- case 9:
364
- brands = (_k.sent()).brands;
336
+ case 6:
337
+ brands = (_g.sent()).brands;
365
338
  leadResponse.brand_list = fixBrandList(brands, channels);
366
- return [3, 11];
367
- case 10:
368
- err_2 = _k.sent();
369
- return [3, 11];
370
- case 11:
371
- (_f = params.onSuccess) === null || _f === void 0 ? void 0 : _f.call(params);
372
- return [4, sleep(3000)];
373
- case 12:
374
- _k.sent();
375
- return [3, 15];
376
- case 13:
377
- (_g = params.onSuccess) === null || _g === void 0 ? void 0 : _g.call(params);
339
+ return [3, 8];
340
+ case 7:
341
+ err_2 = _g.sent();
342
+ return [3, 8];
343
+ case 8:
344
+ (_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
378
345
  return [4, sleep(3000)];
379
- case 14:
380
- _k.sent();
381
- _k.label = 15;
382
- case 15:
346
+ case 9:
347
+ _g.sent();
348
+ phone = (leadResponse.contact || {}).phone;
383
349
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
384
350
  countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
385
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, {});
386
- if (isNewUser || userInfoMissed) {
387
- thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
388
- return [2, { authResponse: authResponse, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
389
- }
390
- thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
391
- return [2, { authResponse: authResponse, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
392
- case 16: return [4, sleep(interval * 1000)];
393
- case 17:
394
- _k.sent();
395
- _k.label = 18;
396
- case 18:
351
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
352
+ thunkApi.dispatch(handleNextScreenStep());
353
+ return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode }];
354
+ case 10: return [4, sleep(interval * 1000)];
355
+ case 11:
356
+ _g.sent();
357
+ _g.label = 12;
358
+ case 12:
397
359
  count++;
398
360
  return [3, 1];
399
- case 19: throw new Error('paci_verification_failed');
361
+ case 13: throw new Error('paci_verification_failed');
400
362
  }
401
363
  });
402
364
  }); });
403
365
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
404
- var _a, settings, connect, _b, userInfoMissed, lead_id, phoneCountry, payload, leadResponse, brand, channels;
405
- var _c, _d, _e, _f, _g;
406
- return __generator(this, function (_h) {
407
- 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) {
408
370
  case 0:
409
371
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
410
- _b = connect.data.otpData.responseBody || {}, userInfoMissed = _b.userInfoMissed, lead_id = _b.lead_id;
411
- phoneCountry = (_d = (_c = params.countryCode) === null || _c === void 0 ? void 0 : _c.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString();
412
- payload = __assign(__assign({ id: lead_id || '', country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2 }, (params.name && { name: getIndividualName(params.name) })), { contact: __assign(__assign({}, (params.email && { email: params.email })), (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })), step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: [
372
+ lead_id = (connect.data.otpData.responseBody || {}).lead_id;
373
+ phoneCountry = (_c = (_b = params.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString();
374
+ payload = {
375
+ id: lead_id || '',
376
+ country_code: (_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2,
377
+ name: getIndividualName(params.name),
378
+ contact: __assign({ email: params.email }, (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })),
379
+ step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
380
+ encryption_contract: [
413
381
  'name.first',
414
382
  'name.middle',
415
383
  'name.last',
416
384
  'contact.email',
417
385
  'contact.phone.country_code',
418
386
  'contact.phone.number'
419
- ] });
387
+ ]
388
+ };
420
389
  return [4, API.leadService.updateLead(payload)];
421
390
  case 1:
422
- leadResponse = _h.sent();
391
+ leadResponse = _g.sent();
423
392
  if (!leadResponse.brand) return [3, 3];
424
393
  return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
425
394
  case 2:
426
- brand = (_h.sent()).brand;
395
+ brand = (_g.sent()).brand;
427
396
  leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
428
- _h.label = 3;
397
+ _g.label = 3;
429
398
  case 3:
430
- if (!!userInfoMissed) return [3, 5];
431
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
432
- case 4:
433
- channels = (_h.sent()).list;
434
- leadResponse.channel_list = channels;
435
- _h.label = 5;
436
- case 5:
437
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
399
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
438
400
  thunkApi.dispatch(handleNextScreenStep());
439
401
  return [2, { leadResponse: leadResponse, formData: params }];
440
402
  }
441
403
  });
442
404
  }); });
443
405
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
444
- var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
406
+ var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
445
407
  var _b, _c, _d, _e, _f;
446
408
  return __generator(this, function (_g) {
447
409
  switch (_g.label) {
@@ -449,7 +411,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
449
411
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
450
412
  responseBody = connect.data.otpData.responseBody;
451
413
  leadBrandId = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand_id;
452
- isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem;
414
+ isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, termAndConditionChecked = params.termAndConditionChecked;
453
415
  getAddress = function (value, isTwitter, isWeb) {
454
416
  if (isTwitter)
455
417
  return '@' + value;
@@ -678,15 +640,9 @@ export var connectSlice = createSlice({
678
640
  extraReducers: function (builder) {
679
641
  builder
680
642
  .addCase(createMobileAuth.fulfilled, function (state, action) {
681
- var _a;
682
643
  state.loading = false;
683
644
  state.error = null;
684
- var _b = action.payload, formData = _b.formData, response = _b.response;
685
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
686
- if (description) {
687
- state.error = description;
688
- return;
689
- }
645
+ var _a = action.payload, formData = _a.formData, response = _a.response;
690
646
  state.data.mobileData = formData;
691
647
  state.data.mobileData.responseBody = response;
692
648
  state.data.otpData.authFor = AuthForType.MOBILE;
@@ -700,14 +656,8 @@ export var connectSlice = createSlice({
700
656
  state.error = action.error.message;
701
657
  })
702
658
  .addCase(resendOTPMobile.fulfilled, function (state, action) {
703
- var _a;
704
659
  state.error = null;
705
660
  var response = action.payload;
706
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
707
- if (description) {
708
- state.error = description;
709
- return;
710
- }
711
661
  state.data.mobileData.responseBody = response;
712
662
  state.data.otpData.authFor = AuthForType.MOBILE;
713
663
  })
@@ -722,15 +672,9 @@ export var connectSlice = createSlice({
722
672
  state.error = null;
723
673
  })
724
674
  .addCase(createCivilIdAuth.fulfilled, function (state, action) {
725
- var _a;
726
675
  state.loading = false;
727
676
  state.error = null;
728
- var _b = action.payload, formData = _b.formData, response = _b.response;
729
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
730
- if (description) {
731
- state.error = description;
732
- return;
733
- }
677
+ var _a = action.payload, formData = _a.formData, response = _a.response;
734
678
  state.data.otpData.authFor = AuthForType.NATIONAL_ID;
735
679
  state.data.civilIdData = __assign(__assign({}, formData), { responseBody: response });
736
680
  })
@@ -746,7 +690,7 @@ export var connectSlice = createSlice({
746
690
  var _a;
747
691
  state.loading = false;
748
692
  state.error = null;
749
- var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, isNewUser = _b.isNewUser, countryCode = _b.countryCode, userInfoMissed = _b.userInfoMissed;
693
+ var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
750
694
  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;
751
695
  var _c = contact || {}, email = _c.email, phone = _c.phone;
752
696
  var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
@@ -762,22 +706,20 @@ export var connectSlice = createSlice({
762
706
  state.data.individualData.countryCode = countryCode;
763
707
  if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
764
708
  state.data.brandData.brandName = brand.name.en;
765
- if (!isNewUser) {
766
- var brandList = [];
767
- if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
768
- var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
769
- brandList = __spreadArray([], brand_list, true);
770
- if (!isBrandExist && brand)
771
- brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
772
- brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
773
- state.data.brandData.selectedBrandItem = brandList[0];
774
- }
775
- state.data.brandData.responseBody = {
776
- brand_list: brandList,
777
- channel_list: channel_list
778
- };
709
+ var brandList = [];
710
+ if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
711
+ var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
712
+ brandList = __spreadArray([], brand_list, true);
713
+ if (!isBrandExist && brand)
714
+ brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
715
+ brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
716
+ state.data.brandData.selectedBrandItem = brandList[0];
779
717
  }
780
- 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, userInfoMissed: userInfoMissed });
718
+ state.data.brandData.responseBody = {
719
+ brand_list: brandList,
720
+ channel_list: channel_list
721
+ };
722
+ 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 });
781
723
  })
782
724
  .addCase(verifyPACI.rejected, function (state, action) {
783
725
  state.loading = false;
@@ -790,7 +732,7 @@ export var connectSlice = createSlice({
790
732
  var _a;
791
733
  state.loading = false;
792
734
  state.error = null;
793
- var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, isNewUser = _b.isNewUser, countryCode = _b.countryCode, userInfoMissed = _b.userInfoMissed;
735
+ var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
794
736
  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;
795
737
  var _c = contact || {}, email = _c.email, phone = _c.phone;
796
738
  var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
@@ -806,22 +748,20 @@ export var connectSlice = createSlice({
806
748
  state.data.individualData.countryCode = countryCode;
807
749
  if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
808
750
  state.data.brandData.brandName = brand.name.en;
809
- if (!isNewUser) {
810
- var brandList = [];
811
- if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
812
- var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
813
- brandList = __spreadArray([], brand_list, true);
814
- if (!isBrandExist && brand)
815
- brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
816
- brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
817
- state.data.brandData.selectedBrandItem = brandList[0];
818
- }
819
- state.data.brandData.responseBody = {
820
- brand_list: brandList,
821
- channel_list: channel_list
822
- };
751
+ var brandList = [];
752
+ if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
753
+ var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
754
+ brandList = __spreadArray([], brand_list, true);
755
+ if (!isBrandExist && brand)
756
+ brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
757
+ brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
758
+ state.data.brandData.selectedBrandItem = brandList[0];
823
759
  }
824
- 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, userInfoMissed: userInfoMissed });
760
+ state.data.brandData.responseBody = {
761
+ brand_list: brandList,
762
+ channel_list: channel_list
763
+ };
764
+ 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 });
825
765
  })
826
766
  .addCase(verifyAuth.pending, function (state) {
827
767
  state.loading = true;
@@ -832,15 +772,9 @@ export var connectSlice = createSlice({
832
772
  state.error = action.error.message;
833
773
  })
834
774
  .addCase(createNIDAuth.fulfilled, function (state, action) {
835
- var _a;
836
775
  state.loading = false;
837
776
  state.error = null;
838
- var _b = action.payload, formData = _b.formData, response = _b.response;
839
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
840
- if (description) {
841
- state.error = description;
842
- return;
843
- }
777
+ var _a = action.payload, formData = _a.formData, response = _a.response;
844
778
  state.data.nidData = formData;
845
779
  state.data.nidData.responseBody = response;
846
780
  state.data.otpData.authFor = AuthForType.NATIONAL_ID;
@@ -854,14 +788,8 @@ export var connectSlice = createSlice({
854
788
  state.error = action.error.message;
855
789
  })
856
790
  .addCase(resendOTPNID.fulfilled, function (state, action) {
857
- var _a;
858
791
  state.error = null;
859
792
  var response = action.payload;
860
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
861
- if (description) {
862
- state.error = description;
863
- return;
864
- }
865
793
  state.data.nidData.responseBody = response;
866
794
  state.data.otpData.authFor = AuthForType.NATIONAL_ID;
867
795
  })
@@ -875,7 +803,7 @@ export var connectSlice = createSlice({
875
803
  state.loading = false;
876
804
  state.error = null;
877
805
  var _a = action.payload, formData = _a.formData, leadResponse = _a.leadResponse;
878
- var brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, rest = __rest(leadResponse, ["brand", "brand_list", "channel_list"]);
806
+ var brand = leadResponse.brand, rest = __rest(leadResponse, ["brand"]);
879
807
  if (brand) {
880
808
  var channel_services = brand.channel_services, terms = brand.terms;
881
809
  state.data.brandData.salesChannels = channel_services || [];
@@ -885,9 +813,6 @@ export var connectSlice = createSlice({
885
813
  });
886
814
  state.data.brandData.termAndConditionChecked = !!termAndCondition;
887
815
  }
888
- if (channel_list) {
889
- state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { channel_list: channel_list });
890
- }
891
816
  state.data.individualData = formData;
892
817
  state.data.individualData.responseBody = rest;
893
818
  })
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { styled } from '@mui/material/styles';
@@ -48,13 +37,16 @@ var Activities = function () {
48
37
  var isAr = useLanguage().isAr;
49
38
  var t = useTranslation().t;
50
39
  var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
51
- var _d = data.activitiesData, responseBody = _d.responseBody, defaultValues = __rest(_d, ["responseBody"]);
40
+ var _d = data.activitiesData, activities = _d.activities, operationStartDate = _d.operationStartDate;
52
41
  var methods = useForm({
53
42
  resolver: yupResolver(ActivitiesValidationSchema),
54
- defaultValues: defaultValues,
43
+ defaultValues: {
44
+ activities: activities,
45
+ operationStartDate: operationStartDate
46
+ },
55
47
  mode: 'onChange'
56
48
  });
57
- useSetFromDefaultValues(methods, defaultValues, true);
49
+ useSetFromDefaultValues(methods, data.activitiesData, true);
58
50
  var onSubmit = function (data) {
59
51
  dispatch(updateActivitiesInfo(__assign({}, data)));
60
52
  };
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { useForm, FormProvider } from 'react-hook-form';
@@ -39,7 +28,7 @@ import LicenseList from './LicenseList';
39
28
  var BusinessType = function (_a) {
40
29
  var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
41
30
  var settingsData = useAppSelector(settingsSelector).data;
42
- var _c = data.businessTypeData, responseBody = _c.responseBody, defaultValues = __rest(_c, ["responseBody"]);
31
+ var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, certificateFile = _c.certificateFile, articleId = _c.articleId, articleFile = _c.articleFile;
43
32
  var t = useTranslation().t;
44
33
  var isAr = useLanguage().isAr;
45
34
  var dispatch = useAppDispatch();
@@ -47,10 +36,18 @@ var BusinessType = function (_a) {
47
36
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
48
37
  var methods = useForm({
49
38
  resolver: yupResolver(!isSACountry ? KWLicenseValidationSchema : LicenseValidationSchema),
50
- defaultValues: defaultValues,
39
+ defaultValues: {
40
+ selectedLicense: selectedLicense,
41
+ licenseNumber: licenseNumber,
42
+ entityLegalName: entityLegalName,
43
+ certificateId: certificateId,
44
+ certificateFile: certificateFile,
45
+ articleId: articleId,
46
+ articleFile: articleFile
47
+ },
51
48
  mode: 'onChange'
52
49
  });
53
- useSetFromDefaultValues(methods, defaultValues);
50
+ useSetFromDefaultValues(methods, data.businessTypeData);
54
51
  React.useEffect(function () {
55
52
  if (error)
56
53
  dispatch(clearError());
@@ -78,7 +78,7 @@ var CivilID = function (_a) {
78
78
  defaultValues: defaultValues,
79
79
  mode: 'onChange'
80
80
  });
81
- useSetFromDefaultValues(methods, defaultValues);
81
+ useSetFromDefaultValues(methods, data.civilIdData);
82
82
  React.useEffect(function () {
83
83
  handleClearError();
84
84
  }, [methods.formState.isValid]);
@@ -58,15 +58,15 @@ var Individual = function (_a) {
58
58
  var individualData = data.individualData, otpData = data.otpData, mobileData = data.mobileData;
59
59
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
60
60
  var isMobile = mobileData.mobile;
61
- var _e = otpData.responseBody || {}, contact = _e.contact, name = _e.name, userInfoMissed = _e.userInfoMissed, is_new_individual = _e.is_new_individual;
61
+ var contact = (otpData.responseBody || {}).contact;
62
62
  var responseBody = individualData.responseBody, defaultValues = __rest(individualData, ["responseBody"]);
63
63
  var is_available = (responseBody || {}).is_available;
64
64
  var methods = useForm({
65
65
  resolver: yupResolver(isMobile ? IndividualValidation : IndividualMobileValidation),
66
- defaultValues: defaultValues,
66
+ defaultValues: individualData,
67
67
  mode: 'onChange'
68
68
  });
69
- useSetFromDefaultValues(methods, defaultValues, true);
69
+ useSetFromDefaultValues(methods, individualData, true);
70
70
  React.useEffect(function () {
71
71
  if (defaultValues.countryCode.iso2 !== methods.getValues('countryCode.iso2'))
72
72
  methods.setValue('countryCode', defaultValues.countryCode);
@@ -86,7 +86,7 @@ var Individual = function (_a) {
86
86
  dispatch(clearError());
87
87
  }, [methods.formState.isValid]);
88
88
  var handleMenuListClick = function () {
89
- listActive ? setListActive(false) : setListActive(true);
89
+ setListActive(!listActive);
90
90
  };
91
91
  React.useEffect(function () {
92
92
  if (is_available === false)
@@ -96,9 +96,6 @@ var Individual = function (_a) {
96
96
  var isEmailValid = typeof is_available === 'undefined' ? isLeadEmailAvailable : is_available;
97
97
  var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
98
98
  var disabled = emailErrChecks || emailChecking || !isEmailValid;
99
- var isNameRequired = (userInfoMissed && !name) || is_new_individual;
100
- var isEmailRequired = (userInfoMissed && !(contact === null || contact === void 0 ? void 0 : contact.email)) || is_new_individual;
101
- var isMobileRequired = (userInfoMissed && !(contact === null || contact === void 0 ? void 0 : contact.phone)) || is_new_individual;
102
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive && isNameRequired }), _jsx(MobileNumber, { show: !isMobile && isMobileRequired, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive && isEmailRequired, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
99
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { show: !isMobile, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
103
100
  };
104
101
  export default React.memo(Individual);
@@ -16,29 +16,24 @@ import { useTranslation } from 'react-i18next';
16
16
  import Collapse from '@mui/material/Collapse';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
- import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
19
+ import { handlePrevScreenStep } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import { ScreenContainer } from '../../../shared/Containers';
22
22
  import Button from '../../../shared/Button';
23
23
  import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
24
24
  import { useLanguage } from '../../../../hooks';
25
- import { AuthForType } from '../../../../@types';
26
- import { isKW } from '../../../../utils';
27
25
  import { MerchantValidationSchema } from './validation';
28
26
  import BrandName from './BrandName';
29
27
  import TAC from './TAC';
30
28
  import BrandList from './BrandList';
31
29
  import SalesChannels from './SalesChannels';
32
30
  var Merchant = function (_a) {
33
- var _b, _c;
34
- var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
35
- var _e = React.useState(false), isBrandListOpen = _e[0], setIsBrandListOpen = _e[1];
36
- var _f = React.useState(false), isRequiredNewBrand = _f[0], setIsRequiredNewBrand = _f[1];
37
- var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
38
- var settingsData = useAppSelector(settingsSelector).data;
39
- var isNewIndividual = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.is_new_individual;
40
- var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
41
- var _h = data.brandData, brandName = _h.brandName, selectedBrandItem = _h.selectedBrandItem, termAndConditionChecked = _h.termAndConditionChecked, responseBody = _h.responseBody, salesChannels = _h.salesChannels;
31
+ var _b;
32
+ var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
33
+ var _d = React.useState(false), isBrandListOpen = _d[0], setIsBrandListOpen = _d[1];
34
+ var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
35
+ var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
36
+ var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels;
42
37
  var brandList = (responseBody || {}).brand_list;
43
38
  var methods = useForm({
44
39
  resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
@@ -58,14 +53,7 @@ var Merchant = function (_a) {
58
53
  dispatch(updateLeadBrand(__assign(__assign({}, formData), { isNewBrand: isRequiredNewBrand })));
59
54
  };
60
55
  var onBack = function () {
61
- var _a;
62
- if (isNewIndividual) {
63
- dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
64
- return;
65
- }
66
- var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
67
- var screen = startWithNID ? (isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP') : 'CONNECT_MOBILE_STEP';
68
- dispatch(handlePrevScreenStep(screen));
56
+ dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
69
57
  };
70
58
  React.useEffect(function () {
71
59
  if (error)
@@ -80,7 +68,7 @@ var Merchant = function (_a) {
80
68
  methods.setValue('termAndConditionChecked', termAndConditionChecked);
81
69
  }, [termAndConditionChecked]);
82
70
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
83
- var disabled = brandErrChecks || brandNameChecking || ((_c = data.brandData.responseBody) === null || _c === void 0 ? void 0 : _c.response_code) === '5';
71
+ var disabled = brandErrChecks || brandNameChecking || ((_b = data.brandData.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5';
84
72
  var hasBrandList = (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0;
85
73
  var isOtherBrand = (brandListItem === null || brandListItem === void 0 ? void 0 : brandListItem.id) === 'other' && hasBrandList;
86
74
  var isNewBrand = (brandList === null || brandList === void 0 ? void 0 : brandList.length) === 0 || BrandList === undefined;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
4
3
  import { useController, useFormContext } from 'react-hook-form';
5
4
  import { useAppSelector, useAppDispatch } from '../../../../hooks';
6
5
  import { connectSelector, clearError } from '../../../app/connect/connectStore';
@@ -8,34 +7,31 @@ import { mapSalesChannel } from '../../../../utils';
8
7
  import SalesChannel from '../../../shared/SalesChannels';
9
8
  var SalesChannels = function (_a) {
10
9
  var _b;
11
- var _c = React.useState([]), defaultValues = _c[0], setDefaultValues = _c[1];
12
- var t = useTranslation().t;
13
- var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
10
+ var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
14
11
  var dispatch = useAppDispatch();
15
- var _e = useController({ control: control, name: 'salesChannels' }), fieldState = _e.fieldState, field = _e.field;
16
- var _f = useAppSelector(connectSelector), data = _f.data, error = _f.error;
17
- var _g = data.brandData, selectedBrandItem = _g.selectedBrandItem, responseBody = _g.responseBody, defaultSalesChannels = _g.salesChannels;
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;
18
15
  var channelList = (responseBody || {}).channel_list;
19
16
  React.useEffect(function () {
20
17
  if (selectedBrandItem.id) {
21
18
  setValue('selectedBrandItem', selectedBrandItem);
22
19
  var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
23
- setDefaultValues(sales);
24
- setValue('salesChannels', sales, { shouldValidate: true });
20
+ field.onChange(sales);
25
21
  }
26
22
  }, [selectedBrandItem]);
27
23
  React.useEffect(function () {
28
24
  if (defaultSalesChannels.length > 0) {
29
25
  var sales = mapSalesChannel(defaultSalesChannels);
30
- setDefaultValues(sales);
31
- setValue('salesChannels', sales, { shouldValidate: true });
26
+ field.onChange(sales);
32
27
  }
33
28
  }, [defaultSalesChannels]);
29
+ var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [field.value]);
34
30
  var onChange = function (channels) {
35
31
  if (error)
36
32
  dispatch(clearError());
37
33
  field.onChange(channels);
38
34
  };
39
- return (_jsx(_Fragment, { children: _jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValues: defaultValues }) }));
35
+ return (_jsx(_Fragment, { children: _jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValues: selectedSalesChannels }) }));
40
36
  };
41
37
  export default SalesChannels;
@@ -79,9 +79,9 @@ export var MerchantValidationSchema = function (isNewBrand) {
79
79
  test: function (value) {
80
80
  if (length === 0)
81
81
  return true;
82
- if (length < 3 || !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
83
- return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
84
- return true;
82
+ if (length >= 3 || (value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
83
+ return true;
84
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
85
85
  }
86
86
  })
87
87
  .required('enter_brand_name_english_chars_numbers_space'),
@@ -4,10 +4,10 @@ import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
4
4
  var VerifyPACILoading = function (_a) {
5
5
  var _b = _a.loop, loop = _b === void 0 ? true : _b, type = _a.type;
6
6
  if (type === 1)
7
- return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.start_loading, loop: loop, width: '90%' }) }));
7
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.start_loading, loop: loop, width: '60%' }) }));
8
8
  if (type === 2)
9
- return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.still_loading, loop: loop, width: '90%' }) }));
10
- return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.error, loop: false, width: '90%' }) }));
9
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.still_loading, loop: loop, width: '60%' }) }));
10
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.error, loop: false, width: '60%' }) }));
11
11
  };
12
12
  VerifyPACILoading.defaultProps = {};
13
13
  export default memo(VerifyPACILoading);
@@ -74,9 +74,9 @@ var CollapseStyled = styled(Collapse)(function (_a) {
74
74
  });
75
75
  });
76
76
  var SalesChannel = function (_a) {
77
- var _b = _a.list, list = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, defaultValues = _a.defaultValues;
78
- var _c = React.useState([]), selectedSalas = _c[0], setSelectedSales = _c[1];
79
- var _d = React.useState(''), activeSaleIconId = _d[0], setActiveSaleIconId = _d[1];
77
+ var _b = _a.list, list = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, _c = _a.defaultValues, defaultValues = _c === void 0 ? [] : _c;
78
+ var _d = React.useState([]), selectedSalas = _d[0], setSelectedSales = _d[1];
79
+ var _e = React.useState(''), activeSaleIconId = _e[0], setActiveSaleIconId = _e[1];
80
80
  var t = useTranslation().t;
81
81
  var isAr = useLanguage().isAr;
82
82
  var isChecked = function (id) {
@@ -97,6 +97,7 @@ var SalesChannel = function (_a) {
97
97
  }
98
98
  onChangeActiveSaleIcon(findFirstId([channel]));
99
99
  setSelectedSales(__spreadArray(__spreadArray([], selectedSalas, true), [channel], false));
100
+ onChange(__spreadArray(__spreadArray([], selectedSalas, true), [channel], false));
100
101
  };
101
102
  var onValueChange = function (value, id) {
102
103
  var newSelectedSales = selectedSalas.map(function (item) {
@@ -119,7 +120,8 @@ var SalesChannel = function (_a) {
119
120
  onChange(newSelectedSales);
120
121
  };
121
122
  React.useEffect(function () {
122
- if (defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.length) {
123
+ if (defaultValues.length >= 0) {
124
+ console.log('defaultValues', defaultValues);
123
125
  setSelectedSales(defaultValues);
124
126
  onChangeActiveSaleIcon(findFirstId(defaultValues));
125
127
  }
@@ -11,6 +11,8 @@ export var useSetFromDefaultValues = function (method, defaultValues, shouldVali
11
11
  var setFromDefaultValues = function () {
12
12
  for (var key in defaultValues) {
13
13
  if (Object.prototype.hasOwnProperty.call(defaultValues, key)) {
14
+ if (key === 'responseBody')
15
+ continue;
14
16
  var value = defaultValues[key];
15
17
  if (!isValidValue(method.getValues(key)) && isValidValue(value)) {
16
18
  method.setValue(key, value, { shouldValidate: shouldValidate });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.14-test",
3
+ "version": "2.1.15-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",