@tap-payments/auth-jsconnect 2.0.113-test → 2.0.115-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.
@@ -52,6 +52,7 @@ export declare type UploadFileBody = {
52
52
  file?: File;
53
53
  title: string | undefined;
54
54
  purpose: string;
55
+ type?: string;
55
56
  };
56
57
  export declare type UpdateEntityBody = {
57
58
  id: string;
@@ -72,6 +73,7 @@ export declare type UpdateEntityBody = {
72
73
  ar: string;
73
74
  en: string;
74
75
  };
76
+ AOA_file_id?: string;
75
77
  encryption_contract?: Array<string>;
76
78
  };
77
79
  export declare type DocumentInfo = {
@@ -711,7 +711,7 @@ export var connectSlice = createSlice({
711
711
  var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, isNewUser = _b.isNewUser, countryCode = _b.countryCode, userInfoMissed = _b.userInfoMissed;
712
712
  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;
713
713
  var _c = contact || {}, email = _c.email, phone = _c.phone;
714
- var fullName = concatenateObjectValues(name, ['first', 'middle', 'third', 'last']);
714
+ var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
715
715
  if (!!fullName) {
716
716
  var capitalizedName = capitalizeTheFirstLetterOfEachWord(fullName);
717
717
  state.data.individualData.name = capitalizedName;
@@ -747,7 +747,7 @@ export var connectSlice = createSlice({
747
747
  var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, isNewUser = _b.isNewUser, countryCode = _b.countryCode, userInfoMissed = _b.userInfoMissed;
748
748
  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;
749
749
  var _c = contact || {}, email = _c.email, phone = _c.phone;
750
- var fullName = concatenateObjectValues(name, ['first', 'middle', 'third', 'last']);
750
+ var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
751
751
  if (!!fullName) {
752
752
  var capitalizedName = capitalizeTheFirstLetterOfEachWord(fullName);
753
753
  state.data.individualData.name = capitalizedName;
@@ -216,7 +216,7 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
216
216
  });
217
217
  }); });
218
218
  export var updateEntity = createAsyncThunk('entityUpdateEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
219
- var _a, settings, entity, id, brandId, documentData, articleId, documentBody, requestBody, brandData, payload, data;
219
+ var _a, settings, entity, id, brandId, articleId, requestBody, brandData, payload, data;
220
220
  var _b, _c, _d, _e, _f, _g, _h;
221
221
  return __generator(this, function (_j) {
222
222
  switch (_j.label) {
@@ -224,22 +224,7 @@ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (param
224
224
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
225
225
  id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
226
226
  brandId = (_e = (_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
227
- documentData = undefined;
228
227
  articleId = entity.data.entityData.articleId;
229
- if (!articleId) return [3, 2];
230
- documentBody = {
231
- entity_id: id || '',
232
- documents: [
233
- {
234
- images: [articleId]
235
- }
236
- ]
237
- };
238
- return [4, API.entityService.updateDocumentInfo(documentBody)];
239
- case 1:
240
- documentData = _j.sent();
241
- _j.label = 2;
242
- case 2:
243
228
  requestBody = {
244
229
  id: brandId,
245
230
  activities: (_f = (params.activities || [])) === null || _f === void 0 ? void 0 : _f.map(function (_a) {
@@ -252,7 +237,7 @@ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (param
252
237
  encryption_contract: ['operations.start_date']
253
238
  };
254
239
  return [4, API.brandService.updateBrandInfo(requestBody)];
255
- case 3:
240
+ case 1:
256
241
  brandData = (_j.sent()).data;
257
242
  payload = {
258
243
  id: id,
@@ -263,28 +248,33 @@ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (param
263
248
  ar: params.licenseName,
264
249
  en: params.licenseName
265
250
  },
251
+ AOA_file_id: articleId,
266
252
  encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en']
267
253
  };
268
254
  return [4, API.entityService.updateEntity(payload)];
269
- case 4:
255
+ case 2:
270
256
  data = _j.sent();
271
257
  thunkApi.dispatch(handleNextScreenStep());
272
258
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
273
- return [2, { data: __assign(__assign(__assign({}, data), brandData), documentData), formData: params }];
259
+ return [2, { data: __assign(__assign({}, data), brandData), formData: params }];
274
260
  }
275
261
  });
276
262
  }); });
277
263
  export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
278
264
  var file = _a.file, onProgress = _a.onProgress;
279
265
  return __awaiter(void 0, void 0, void 0, function () {
280
- var uploadPayload, onUploadProgress, data;
281
- return __generator(this, function (_b) {
282
- switch (_b.label) {
266
+ var typeArray, type, uploadPayload, onUploadProgress, data;
267
+ var _b;
268
+ return __generator(this, function (_c) {
269
+ switch (_c.label) {
283
270
  case 0:
271
+ typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
272
+ type = typeArray[1] || '';
284
273
  uploadPayload = {
285
274
  file_link_create: true,
286
275
  title: file === null || file === void 0 ? void 0 : file.name,
287
276
  purpose: 'identity_document',
277
+ type: type,
288
278
  file: file
289
279
  };
290
280
  onUploadProgress = function (progressEvent) {
@@ -293,7 +283,7 @@ export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a)
293
283
  };
294
284
  return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
295
285
  case 1:
296
- data = _b.sent();
286
+ data = _c.sent();
297
287
  return [2, { data: data }];
298
288
  }
299
289
  });
@@ -47,7 +47,8 @@ var BankName = function () {
47
47
  React.useEffect(function () {
48
48
  var _a;
49
49
  var bankName = (_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.bank_name;
50
- setValue('bankName', bankName);
50
+ if (bankName && !bankNameValue)
51
+ setValue('bankName', bankName);
51
52
  }, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name]);
52
53
  var handleBankChange = function (_a) {
53
54
  var target = _a.target;
@@ -9,6 +9,17 @@ 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
+ };
12
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
24
  import { styled } from '@mui/material/styles';
14
25
  import Email from './Email';
@@ -46,10 +57,11 @@ var Individual = function (_a) {
46
57
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
47
58
  var isMobile = mobileData.mobile;
48
59
  var _e = otpData.responseBody || {}, contact = _e.contact, name = _e.name, userInfoMissed = _e.userInfoMissed, is_new_individual = _e.is_new_individual;
49
- var is_available = (individualData.responseBody || {}).is_available;
60
+ var responseBody = individualData.responseBody, individualDataForm = __rest(individualData, ["responseBody"]);
61
+ var is_available = (responseBody || {}).is_available;
50
62
  var methods = useForm({
51
63
  resolver: yupResolver(isMobile ? IndividualValidation : IndividualMobileValidation),
52
- defaultValues: data.individualData,
64
+ defaultValues: individualDataForm,
53
65
  mode: 'onChange'
54
66
  });
55
67
  var onSubmit = function (formData) {
@@ -81,10 +93,9 @@ var Individual = function (_a) {
81
93
  listActive ? setListActive(false) : setListActive(true);
82
94
  };
83
95
  React.useEffect(function () {
84
- var _a;
85
- if (((_a = individualData === null || individualData === void 0 ? void 0 : individualData.responseBody) === null || _a === void 0 ? void 0 : _a.is_available) === false)
96
+ if (is_available === false)
86
97
  methods.setError('email', { message: 'tap_js_email_already_exist' });
87
- }, [individualData === null || individualData === void 0 ? void 0 : individualData.responseBody]);
98
+ }, [responseBody]);
88
99
  var isLeadEmailAvailable = (contact === null || contact === void 0 ? void 0 : contact.email) === methods.watch('email');
89
100
  var isEmailValid = typeof is_available === 'undefined' ? isLeadEmailAvailable : is_available;
90
101
  var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
@@ -28,7 +28,7 @@ export var concatenateObjectValues = function (data, keys) {
28
28
  for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
29
29
  var key = keys_1[_i];
30
30
  if (data[key]) {
31
- result += data[key] + ' ';
31
+ result += data[key].trim() + ' ';
32
32
  }
33
33
  }
34
34
  return result.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.113-test",
3
+ "version": "2.0.115-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",