@itilite/iui-user-management 0.3.13 → 0.3.15
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 +80 -47
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +80 -47
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
- package/dist/style.css.map +0 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUIDropdownButton } from '@itilite/iuistyles';
|
|
2
2
|
import React, { useState, useEffect, useRef, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { configs, services, utilUrls } from '@itilite/utils';
|
|
4
|
+
import axios from 'axios';
|
|
4
5
|
import AddIcon$1 from '@material-ui/icons/Add';
|
|
5
6
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
6
|
-
import axios from 'axios';
|
|
7
7
|
import { useDispatch, useSelector, Provider } from 'react-redux';
|
|
8
8
|
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
|
9
9
|
import thunk from 'redux-thunk';
|
|
@@ -158,24 +158,52 @@ function _catch(body, recover) {
|
|
|
158
158
|
|
|
159
159
|
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"};
|
|
160
160
|
|
|
161
|
-
function
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
function toVal(mix) {
|
|
162
|
+
var k,
|
|
163
|
+
y,
|
|
164
|
+
str = '';
|
|
165
|
+
|
|
166
|
+
if (typeof mix === 'string' || typeof mix === 'number') {
|
|
167
|
+
str += mix;
|
|
168
|
+
} else if (typeof mix === 'object') {
|
|
169
|
+
if (Array.isArray(mix)) {
|
|
170
|
+
for (k = 0; k < mix.length; k++) {
|
|
171
|
+
if (mix[k]) {
|
|
172
|
+
if (y = toVal(mix[k])) {
|
|
173
|
+
str && (str += ' ');
|
|
174
|
+
str += y;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
for (k in mix) {
|
|
180
|
+
if (mix[k]) {
|
|
181
|
+
str && (str += ' ');
|
|
182
|
+
str += k;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
169
186
|
}
|
|
170
|
-
|
|
187
|
+
|
|
188
|
+
return str;
|
|
171
189
|
}
|
|
172
190
|
|
|
173
191
|
function clsx() {
|
|
174
|
-
|
|
175
|
-
|
|
192
|
+
var i = 0,
|
|
193
|
+
tmp,
|
|
194
|
+
x,
|
|
195
|
+
str = '';
|
|
196
|
+
|
|
197
|
+
while (i < arguments.length) {
|
|
198
|
+
if (tmp = arguments[i++]) {
|
|
199
|
+
if (x = toVal(tmp)) {
|
|
200
|
+
str && (str += ' ');
|
|
201
|
+
str += x;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
176
204
|
}
|
|
177
205
|
|
|
178
|
-
return
|
|
206
|
+
return str;
|
|
179
207
|
}
|
|
180
208
|
|
|
181
209
|
var GetInputType = React.forwardRef(function (props, ref) {
|
|
@@ -467,6 +495,7 @@ var userPanelUrl = {
|
|
|
467
495
|
}
|
|
468
496
|
};
|
|
469
497
|
|
|
498
|
+
var IUILocalStorageService$1 = services.IUILocalStorageService;
|
|
470
499
|
var api = configs.api;
|
|
471
500
|
var NAoptionConfig = {
|
|
472
501
|
option: {
|
|
@@ -711,34 +740,38 @@ var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
|
|
|
711
740
|
try {
|
|
712
741
|
return Promise.resolve(_catch(function () {
|
|
713
742
|
var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
|
|
714
|
-
|
|
715
|
-
|
|
743
|
+
var token = IUILocalStorageService$1.getAccessToken();
|
|
744
|
+
return Promise.resolve(axios.get(url, {
|
|
745
|
+
headers: {
|
|
746
|
+
Authorization: 'Bearer ' + token
|
|
747
|
+
}
|
|
716
748
|
})).then(function (response) {
|
|
717
|
-
|
|
749
|
+
var mappedValue = response.data.results.map(function (item) {
|
|
718
750
|
return {
|
|
719
751
|
value: item.id,
|
|
720
752
|
label: item.name
|
|
721
753
|
};
|
|
722
|
-
})
|
|
723
|
-
if (placeholder) {
|
|
724
|
-
var placeholderLbl = {
|
|
725
|
-
value: '',
|
|
726
|
-
label: placeholder
|
|
727
|
-
};
|
|
728
|
-
mappedValue.unshift(placeholderLbl);
|
|
729
|
-
}
|
|
754
|
+
});
|
|
730
755
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
page: page + 1,
|
|
736
|
-
placeholder: placeholder
|
|
737
|
-
}
|
|
756
|
+
if (placeholder) {
|
|
757
|
+
var placeholderLbl = {
|
|
758
|
+
value: '',
|
|
759
|
+
label: placeholder
|
|
738
760
|
};
|
|
739
|
-
|
|
761
|
+
mappedValue.unshift(placeholderLbl);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
return {
|
|
765
|
+
options: mappedValue,
|
|
766
|
+
hasMore: !!response.data.next,
|
|
767
|
+
additional: {
|
|
768
|
+
page: page + 1,
|
|
769
|
+
placeholder: placeholder
|
|
770
|
+
}
|
|
771
|
+
};
|
|
740
772
|
});
|
|
741
|
-
}, function () {
|
|
773
|
+
}, function (error) {
|
|
774
|
+
console.log(error);
|
|
742
775
|
return {
|
|
743
776
|
options: [],
|
|
744
777
|
hasMore: false,
|
|
@@ -783,12 +816,12 @@ var SET_STATIC_FIELDS_VISIBILITY = 'SET_STATIC_FIELDS_VISIBILITY';
|
|
|
783
816
|
var SET_PAYMENT_DETAILS = 'SET_PAYMENT_DETAILS';
|
|
784
817
|
|
|
785
818
|
var env$1 = configs.env;
|
|
786
|
-
var IUILocalStorageService$
|
|
819
|
+
var IUILocalStorageService$2 = services.IUILocalStorageService;
|
|
787
820
|
var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
788
821
|
var _payload$employeeInfo, _payload$employeeInfo2, _payload$employeeInfo3, _payload$employeeInfo4, _payload$employeeInfo5, _payload$employeeInfo6, _payload$employeeInfo7, _payload$employeeInfo8, _payload$employeeInfo9, _payload$employeeInfo10;
|
|
789
822
|
|
|
790
823
|
var res = {
|
|
791
|
-
company_id: +IUILocalStorageService$
|
|
824
|
+
company_id: +IUILocalStorageService$2.getCompanyId(),
|
|
792
825
|
first_name: payload.personalInfoInput.first_name,
|
|
793
826
|
last_name: payload.personalInfoInput.last_name,
|
|
794
827
|
email: payload.personalInfoInput.email,
|
|
@@ -1166,7 +1199,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1166
1199
|
|
|
1167
1200
|
var api$1 = configs.api;
|
|
1168
1201
|
var IUIToastMessageService = services.IUIToastMessageService,
|
|
1169
|
-
IUILocalStorageService$
|
|
1202
|
+
IUILocalStorageService$3 = services.IUILocalStorageService;
|
|
1170
1203
|
var showLoader = function showLoader() {
|
|
1171
1204
|
return {
|
|
1172
1205
|
type: SHOW_LOADER
|
|
@@ -1537,7 +1570,7 @@ var deletePaymentCard = function deletePaymentCard(payload) {
|
|
|
1537
1570
|
dispatch(showLoader());
|
|
1538
1571
|
axios["delete"](userAddEditUrl.deletePaymentCard(payload.pmId, payload.vendorId), {
|
|
1539
1572
|
headers: {
|
|
1540
|
-
Authorization: 'Bearer ' + IUILocalStorageService$
|
|
1573
|
+
Authorization: 'Bearer ' + IUILocalStorageService$3.getAccessToken()
|
|
1541
1574
|
}
|
|
1542
1575
|
}).then(function (res) {
|
|
1543
1576
|
if (res.data.status) {
|
|
@@ -1570,7 +1603,7 @@ var setDefaultPaymentCard = function setDefaultPaymentCard(payload) {
|
|
|
1570
1603
|
dispatch(showLoader());
|
|
1571
1604
|
axios.put(userAddEditUrl.setDefaultCard(), payload, {
|
|
1572
1605
|
headers: {
|
|
1573
|
-
Authorization: 'Bearer ' + IUILocalStorageService$
|
|
1606
|
+
Authorization: 'Bearer ' + IUILocalStorageService$3.getAccessToken()
|
|
1574
1607
|
}
|
|
1575
1608
|
}).then(function (res) {
|
|
1576
1609
|
if (res.data.status) {
|
|
@@ -1905,7 +1938,7 @@ var SET_VERIFICATION_ERROR = 'SET_VERIFICATION_ERROR';
|
|
|
1905
1938
|
var api$4 = configs.api,
|
|
1906
1939
|
env$2 = configs.env;
|
|
1907
1940
|
var common = utilUrls.common;
|
|
1908
|
-
var IUILocalStorageService$
|
|
1941
|
+
var IUILocalStorageService$4 = services.IUILocalStorageService;
|
|
1909
1942
|
var setTokenResponse = function setTokenResponse(payload) {
|
|
1910
1943
|
return {
|
|
1911
1944
|
type: VERIFY_ACCESS_TOKEN,
|
|
@@ -1927,7 +1960,7 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
|
|
|
1927
1960
|
return new Promise(function (resolve, reject) {
|
|
1928
1961
|
dispatch(setVerificationError(false));
|
|
1929
1962
|
api$4.post(common.verifyToken(), {
|
|
1930
|
-
client_id: +IUILocalStorageService$
|
|
1963
|
+
client_id: +IUILocalStorageService$4.getClientId() || null,
|
|
1931
1964
|
product: env$2.isExpense() ? 'expense' : 'travel'
|
|
1932
1965
|
}).then(function (res) {
|
|
1933
1966
|
if (res.data.status === true) {
|
|
@@ -1938,14 +1971,14 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
|
|
|
1938
1971
|
}
|
|
1939
1972
|
|
|
1940
1973
|
if (env$2.isProfilePage()) {
|
|
1941
|
-
IUILocalStorageService$
|
|
1974
|
+
IUILocalStorageService$4.setCompanyId(res.data.company);
|
|
1942
1975
|
dispatch(setTokenResponse(res.data));
|
|
1943
1976
|
dispatch(setVerificationError(false));
|
|
1944
1977
|
|
|
1945
1978
|
if (env$2.isExpense()) {
|
|
1946
|
-
IUILocalStorageService$
|
|
1979
|
+
IUILocalStorageService$4.setRole('submitter');
|
|
1947
1980
|
} else {
|
|
1948
|
-
IUILocalStorageService$
|
|
1981
|
+
IUILocalStorageService$4.setRole('traveler');
|
|
1949
1982
|
}
|
|
1950
1983
|
|
|
1951
1984
|
resolve();
|
|
@@ -1953,8 +1986,8 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
|
|
|
1953
1986
|
} else {
|
|
1954
1987
|
for (var index = 0; index < res.data.applicable_role.length; index++) {
|
|
1955
1988
|
if (roleCanAccess.includes(res.data.applicable_role[index])) {
|
|
1956
|
-
IUILocalStorageService$
|
|
1957
|
-
IUILocalStorageService$
|
|
1989
|
+
IUILocalStorageService$4.setCompanyId(res.data.company);
|
|
1990
|
+
IUILocalStorageService$4.setRole(res.data.applicable_role[index]);
|
|
1958
1991
|
dispatch(setTokenResponse(res.data));
|
|
1959
1992
|
dispatch(setVerificationError(false));
|
|
1960
1993
|
resolve();
|
|
@@ -2109,7 +2142,7 @@ var editCustomFieldLabel = function editCustomFieldLabel(payload) {
|
|
|
2109
2142
|
};
|
|
2110
2143
|
};
|
|
2111
2144
|
|
|
2112
|
-
var IUILocalStorageService$
|
|
2145
|
+
var IUILocalStorageService$5 = services.IUILocalStorageService;
|
|
2113
2146
|
var env$3 = configs.env;
|
|
2114
2147
|
|
|
2115
2148
|
var CreditCard = function CreditCard(_ref) {
|
|
@@ -2177,7 +2210,7 @@ var CreditCard = function CreditCard(_ref) {
|
|
|
2177
2210
|
var AddCard = function AddCard(_ref2) {
|
|
2178
2211
|
var pg = _ref2.pg;
|
|
2179
2212
|
|
|
2180
|
-
var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$
|
|
2213
|
+
var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$5.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
|
|
2181
2214
|
|
|
2182
2215
|
var handleAddCard = function handleAddCard() {
|
|
2183
2216
|
window.location.assign(_url);
|