@itilite/iui-user-management 0.0.15 → 0.0.17

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.
package/dist/index.js CHANGED
@@ -161,52 +161,24 @@ function _catch(body, recover) {
161
161
 
162
162
  var styles = {"UUIUserManagementAddEdit":"_3n-WG","pageHeader":"_3qWcA","buttonWrapper":"_1IP9P","scrolled":"_m8f96","headingButtonWrapper":"_w9z7b","headingButtonWrapperProfile":"_12Wd9","hintText":"_ySdbZ","heading":"_2Y1Aw","headingLarge":"_2K1NF","headingMedium":"_RUuAz","headingSmall":"_23Dye","additionalInfoContainer":"_1Suhw","additionalInfoTitle":"_56iJF","titleContainer":"_H5nfl","expandIconAlign":"_3F4i0","detailsContainer":"_2G0LW","formWrapper":"_2fPRc","sectionWrapper":"_37Gqp","margin":"_2Sdl7","minGridWidth":"_2D7iu","firstRowMargin":"_1BozG","firstChildMargin":"_2C3Mb","paddingTop":"_DBPjV","backGrdColorOnHover":"_5oE6H","fieldMargin":"_RCWjq","productContainerGap":"_tuCbi","containerWidth":"_1oWos","productItemBroder":"_T0Hcd","headingPadding":"_2MFfQ","emptyFieldContainer":"_3VWtw","emptyFieldDescription":"_2jC5u","rowGap":"_1NJFY","formTitle":"_GAKk2","formDescription":"_3TZ6Z","themeLink":"_eJ_1B","dashedLine":"_3ZOs1","dividerColor":"_2pxEJ","errorTextCls":"_27eth","backdrop":"_Pm0Au","inputWidth":"_ajB82"};
163
163
 
164
- function toVal(mix) {
165
- var k,
166
- y,
167
- str = '';
168
-
169
- if (typeof mix === 'string' || typeof mix === 'number') {
170
- str += mix;
171
- } else if (typeof mix === 'object') {
172
- if (Array.isArray(mix)) {
173
- for (k = 0; k < mix.length; k++) {
174
- if (mix[k]) {
175
- if (y = toVal(mix[k])) {
176
- str && (str += ' ');
177
- str += y;
178
- }
179
- }
180
- }
181
- } else {
182
- for (k in mix) {
183
- if (mix[k]) {
184
- str && (str += ' ');
185
- str += k;
186
- }
187
- }
188
- }
164
+ function r(e) {
165
+ var t,
166
+ f,
167
+ n = "";
168
+ if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) {
169
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
170
+ } else for (t in e) {
171
+ e[t] && (n && (n += " "), n += t);
189
172
  }
190
-
191
- return str;
173
+ return n;
192
174
  }
193
175
 
194
176
  function clsx() {
195
- var i = 0,
196
- tmp,
197
- x,
198
- str = '';
199
-
200
- while (i < arguments.length) {
201
- if (tmp = arguments[i++]) {
202
- if (x = toVal(tmp)) {
203
- str && (str += ' ');
204
- str += x;
205
- }
206
- }
177
+ for (var e, t, f = 0, n = ""; f < arguments.length;) {
178
+ (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
207
179
  }
208
180
 
209
- return str;
181
+ return n;
210
182
  }
211
183
 
212
184
  var env = utils.configs.env;
@@ -250,6 +222,9 @@ var userAddEditUrl = {
250
222
  },
251
223
  verifyUserInfo: function verifyUserInfo(userId) {
252
224
  return "api/v1/onboarding/user-sign-up-info/" + userId + "?company_id=" + IUILocalStorageService.getCompanyId();
225
+ },
226
+ rejectUserVerification: function rejectUserVerification(userId) {
227
+ return "api/v1/onboarding/user-signup-reject/" + userId;
253
228
  }
254
229
  };
255
230
  var userListUrl = {
@@ -1817,12 +1792,12 @@ var addTravelApproverField = function addTravelApproverField() {
1817
1792
  return new Promise(function (resolve, reject) {
1818
1793
  var _travelApprovers = getState().userAddEdit.renderFields.travelApprovers;
1819
1794
  var sNo = _travelApprovers.length + 1;
1820
- var label = "Travel person " + sNo;
1795
+ var label = "Travel approver " + sNo;
1821
1796
 
1822
1797
  _travelApprovers.forEach(function (approver) {
1823
1798
  if (approver.label === label) {
1824
1799
  sNo++;
1825
- label = "Travel person " + sNo;
1800
+ label = "Travel approver " + sNo;
1826
1801
  }
1827
1802
  });
1828
1803
 
@@ -1861,12 +1836,12 @@ var addExpenseApproverField = function addExpenseApproverField() {
1861
1836
  return new Promise(function (resolve, reject) {
1862
1837
  var _expenseApprovers = getState().userAddEdit.renderFields.expenseApprovers;
1863
1838
  var sNo = _expenseApprovers.length + 1;
1864
- var label = "Expense person " + sNo;
1839
+ var label = "Expense approver " + sNo;
1865
1840
 
1866
1841
  _expenseApprovers.forEach(function (approver) {
1867
1842
  if (approver.label === label) {
1868
1843
  sNo++;
1869
- label = "Expense person " + sNo;
1844
+ label = "Expense approver " + sNo;
1870
1845
  }
1871
1846
  });
1872
1847
 
@@ -2163,6 +2138,33 @@ var verifyUserInfo = function verifyUserInfo(userId) {
2163
2138
  });
2164
2139
  };
2165
2140
  };
2141
+ var rejectUserVerification = function rejectUserVerification(userId) {
2142
+ return function (dispatch) {
2143
+ return new Promise(function (resolve, reject) {
2144
+ api$1.get(userAddEditUrl.rejectUserVerification(userId)).then(function (res) {
2145
+ console.log(res);
2146
+
2147
+ if (res.data.status === true) {
2148
+ var _res$data5;
2149
+
2150
+ IUIToastMessageService.sNotify((res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.message) || 'User rejected successfully.');
2151
+ resolve(res.data);
2152
+ } else {
2153
+ var _res$data6;
2154
+
2155
+ IUIToastMessageService.warningNotify((res === null || res === void 0 ? void 0 : (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.message) || 'Opps, Unable to reject user.');
2156
+ reject(res);
2157
+ }
2158
+ })["catch"](function (err) {
2159
+ var _err$response10, _err$response10$data;
2160
+
2161
+ console.log(err);
2162
+ IUIToastMessageService.warningNotify((err === null || err === void 0 ? void 0 : (_err$response10 = err.response) === null || _err$response10 === void 0 ? void 0 : (_err$response10$data = _err$response10.data) === null || _err$response10$data === void 0 ? void 0 : _err$response10$data.message) || 'Opps, Unable to reject user.');
2163
+ reject(err);
2164
+ });
2165
+ });
2166
+ };
2167
+ };
2166
2168
 
2167
2169
  var SHOW_LOADER$1 = 'SHOW_LOADER';
2168
2170
  var STOP_LOADER$1 = 'STOP_LOADER';
@@ -2643,8 +2645,10 @@ var CreditCard = function CreditCard(_ref) {
2643
2645
  var AddCard = function AddCard(_ref2) {
2644
2646
  var pg = _ref2.pg;
2645
2647
 
2648
+ var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$4.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2649
+
2646
2650
  var handleAddCard = function handleAddCard() {
2647
- window.location.assign(env$3.getPaymentUrl() + "/api/v1/auth/" + IUILocalStorageService$4.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2651
+ window.location.assign(_url);
2648
2652
  };
2649
2653
 
2650
2654
  return /*#__PURE__*/React__default.createElement("div", {
@@ -2845,13 +2849,13 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2845
2849
  var rgx = null;
2846
2850
 
2847
2851
  if (type === 'travel') {
2848
- rgx = /^(travel person)( )[0-9]*$/i;
2852
+ rgx = /^(travel approver)( )[0-9]*$/i;
2849
2853
  } else {
2850
- rgx = /^(expense person)( )[0-9]*$/i;
2854
+ rgx = /^(expense approver)( )[0-9]*$/i;
2851
2855
  }
2852
2856
 
2853
- if (editedLabel.approvers[i].label.match(rgx) && editedLabel.approvers[i].label.toLowerCase() !== type.toLowerCase() + " person " + (editedLabel.approvers[i].indexAt + 1)) {
2854
- _errMsg[editedLabel.approvers[i].indexAt] = "Can't update '" + (type === 'travel' ? 'Travel' : 'Expense') + " person " + (editedLabel.approvers[i].indexAt + 1) + "' to '" + editedLabel.approvers[i].label + "'";
2857
+ if (editedLabel.approvers[i].label.match(rgx) && editedLabel.approvers[i].label.toLowerCase() !== type.toLowerCase() + " approver " + (editedLabel.approvers[i].indexAt + 1)) {
2858
+ _errMsg[editedLabel.approvers[i].indexAt] = "Can't update '" + (type === 'travel' ? 'Travel' : 'Expense') + " approver " + (editedLabel.approvers[i].indexAt + 1) + "' to '" + editedLabel.approvers[i].label + "'";
2855
2859
 
2856
2860
  if (!hasError) {
2857
2861
  hasError = true;
@@ -2966,10 +2970,10 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2966
2970
  return null;
2967
2971
  }
2968
2972
 
2969
- if (p.label.toLowerCase() === type + " person " + (i + 1)) {
2973
+ if (p.label.toLowerCase() === type + " approver " + (i + 1)) {
2970
2974
  p.secondaryLabel = '';
2971
2975
  } else {
2972
- p.secondaryLabel = type + " person " + (i + 1);
2976
+ p.secondaryLabel = type + " approver " + (i + 1);
2973
2977
  }
2974
2978
 
2975
2979
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
@@ -3085,7 +3089,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
3085
3089
  className: styles.fieldMargin
3086
3090
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
3087
3091
  defaultValue: p.label,
3088
- label: (type === 'travel' ? 'Travel' : 'Expense') + " person " + (i + 1),
3092
+ label: (type === 'travel' ? 'Travel' : 'Expense') + " approver " + (i + 1),
3089
3093
  className: styles.inputWidth,
3090
3094
  id: type + '_' + p.sequence,
3091
3095
  name: type + '_' + p.sequence,
@@ -5454,7 +5458,7 @@ var UserAddEdit = function UserAddEdit(props) {
5454
5458
  userTagType: userTagType
5455
5459
  };
5456
5460
 
5457
- if (verifyUserId) {
5461
+ if (verifyUserId && isILadmin) {
5458
5462
  payload.verifyUserId = verifyUserId;
5459
5463
  }
5460
5464
 
@@ -5774,10 +5778,10 @@ var UserAddEdit = function UserAddEdit(props) {
5774
5778
  window.location.href = config.routes.profile.redirectUrl.cancel;
5775
5779
  }
5776
5780
  }
5777
- } else if (verifyUserId) {
5781
+ } else if (verifyUserId && isILadmin) {
5778
5782
  var _config$routes4, _config$routes4$signu, _config$routes4$signu2;
5779
5783
 
5780
- (config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$signu = _config$routes4.signupRequest) === null || _config$routes4$signu === void 0 ? void 0 : (_config$routes4$signu2 = _config$routes4$signu.list) === null || _config$routes4$signu2 === void 0 ? void 0 : _config$routes4$signu2.path) && history.push(config.routes.signupRequest.list.path);
5784
+ (config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$signu = _config$routes4.signupRequest) === null || _config$routes4$signu === void 0 ? void 0 : (_config$routes4$signu2 = _config$routes4$signu.list) === null || _config$routes4$signu2 === void 0 ? void 0 : _config$routes4$signu2.path) && window.location.assign(config.routes.signupRequest.list.path);
5781
5785
  } else {
5782
5786
  var _config$routes5, _config$routes5$users, _config$routes5$users2;
5783
5787
 
@@ -5802,7 +5806,7 @@ var UserAddEdit = function UserAddEdit(props) {
5802
5806
  };
5803
5807
 
5804
5808
  var getUserInfoForVerification = function getUserInfoForVerification() {
5805
- if (verifyUserId) {
5809
+ if (verifyUserId && isILadmin) {
5806
5810
  dispatch(showLoader());
5807
5811
  dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
5808
5812
  console.log(res);
@@ -5905,6 +5909,19 @@ var UserAddEdit = function UserAddEdit(props) {
5905
5909
  }
5906
5910
  };
5907
5911
 
5912
+ var handleSignUpRequestRejection = function handleSignUpRequestRejection() {
5913
+ if (verifyUserId && isILadmin) {
5914
+ dispatch(showLoader());
5915
+ dispatch(rejectUserVerification(verifyUserId)).then(function (res) {
5916
+ setTimeout(function () {
5917
+ window.location.assign(config.routes.signupRequest.list.path);
5918
+ }, 1500);
5919
+ })["finally"](function () {
5920
+ dispatch(stopLoader());
5921
+ });
5922
+ }
5923
+ };
5924
+
5908
5925
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
5909
5926
  component: "div",
5910
5927
  className: styles.UUIUserManagementAddEdit
@@ -5921,7 +5938,7 @@ var UserAddEdit = function UserAddEdit(props) {
5921
5938
  className: styles.breadcrumb
5922
5939
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBreadCrumb, {
5923
5940
  breadCrumbs: [{
5924
- href: verifyUserId ? config.routes.signupRequest.list.path : config.routes.users.list.path,
5941
+ href: verifyUserId && isILadmin ? config.routes.signupRequest.list.path : config.routes.users.list.path,
5925
5942
  label: 'Users',
5926
5943
  hasLink: true
5927
5944
  }]
@@ -5956,7 +5973,14 @@ var UserAddEdit = function UserAddEdit(props) {
5956
5973
  type: "contained",
5957
5974
  onClick: formSubmitHandler,
5958
5975
  disabled: isPageLoading || productAccess.travel === false && productAccess.expense === false || !!doesFormHasError()
5959
- }))))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
5976
+ })), verifyUserId && isILadmin ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
5977
+ component: "div",
5978
+ className: clsx(styles.buttonSingle, styles.buttonLeft)
5979
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
5980
+ buttonText: "Reject",
5981
+ type: "outlined",
5982
+ onClick: handleSignUpRequestRejection
5983
+ })) : null))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
5960
5984
  component: "div",
5961
5985
  marginTop: "8rem",
5962
5986
  flexDirection: "column"