@copart/ops-tool-kit 1.12.4-alpha.0 → 1.12.4-alpha.1
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/ops-tool-kit.js +718 -383
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
47
47
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
48
48
|
|
|
49
49
|
const name$r = "@copart/ops-tool-kit";
|
|
50
|
-
const version$8 = "1.12.4-alpha.
|
|
50
|
+
const version$8 = "1.12.4-alpha.1";
|
|
51
51
|
const main$1 = "dist/ops-tool-kit.js";
|
|
52
52
|
const style = "dist/ops-tool-kit.css";
|
|
53
53
|
const files = [
|
|
@@ -1263,17 +1263,17 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
1263
1263
|
var ReactPropTypesSecret$2 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1264
1264
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
|
|
1265
1265
|
|
|
1266
|
-
var has$
|
|
1266
|
+
var has$6 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1267
1267
|
|
|
1268
1268
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
1269
1269
|
|
|
1270
|
-
var has$
|
|
1270
|
+
var has$5 = has$6;
|
|
1271
1271
|
|
|
1272
1272
|
var printWarning$3 = function () {};
|
|
1273
1273
|
if (process.env.NODE_ENV !== 'production') {
|
|
1274
1274
|
var ReactPropTypesSecret = ReactPropTypesSecret$1;
|
|
1275
1275
|
var loggedTypeFailures = {};
|
|
1276
|
-
var has$
|
|
1276
|
+
var has$4 = has$5;
|
|
1277
1277
|
printWarning$3 = function (text) {
|
|
1278
1278
|
var message = 'Warning: ' + text;
|
|
1279
1279
|
if (typeof console !== 'undefined') {
|
|
@@ -1302,7 +1302,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1302
1302
|
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
1303
1303
|
if (process.env.NODE_ENV !== 'production') {
|
|
1304
1304
|
for (var typeSpecName in typeSpecs) {
|
|
1305
|
-
if (has$
|
|
1305
|
+
if (has$4(typeSpecs, typeSpecName)) {
|
|
1306
1306
|
var error;
|
|
1307
1307
|
// Prop type validation may throw. In case they do, we don't want to
|
|
1308
1308
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -1652,7 +1652,7 @@ var factoryWithTypeCheckers = function (isValidElement, throwOnDirectAccess) {
|
|
|
1652
1652
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
1653
1653
|
}
|
|
1654
1654
|
for (var key in propValue) {
|
|
1655
|
-
if (has$
|
|
1655
|
+
if (has$5(propValue, key)) {
|
|
1656
1656
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
1657
1657
|
if (error instanceof Error) {
|
|
1658
1658
|
return error;
|
|
@@ -1683,7 +1683,7 @@ var factoryWithTypeCheckers = function (isValidElement, throwOnDirectAccess) {
|
|
|
1683
1683
|
if (checkerResult == null) {
|
|
1684
1684
|
return null;
|
|
1685
1685
|
}
|
|
1686
|
-
if (checkerResult.data && has$
|
|
1686
|
+
if (checkerResult.data && has$5(checkerResult.data, 'expectedType')) {
|
|
1687
1687
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
1688
1688
|
}
|
|
1689
1689
|
}
|
|
@@ -1736,7 +1736,7 @@ var factoryWithTypeCheckers = function (isValidElement, throwOnDirectAccess) {
|
|
|
1736
1736
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
1737
1737
|
for (var key in allKeys) {
|
|
1738
1738
|
var checker = shapeTypes[key];
|
|
1739
|
-
if (has$
|
|
1739
|
+
if (has$5(shapeTypes, key) && typeof checker !== 'function') {
|
|
1740
1740
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1741
1741
|
}
|
|
1742
1742
|
if (!checker) {
|
|
@@ -5302,6 +5302,9 @@ var handleHeaders = function handleHeaders(config) {
|
|
|
5302
5302
|
if (accessToken && headers) {
|
|
5303
5303
|
headers.Authorization = "bearer ".concat(accessToken);
|
|
5304
5304
|
if (headers.country) headers.country || (headers.country = countryCodeFromStorage);
|
|
5305
|
+
if (headers.gStackCountry) {
|
|
5306
|
+
headers.country = headers.gStackCountry;
|
|
5307
|
+
}
|
|
5305
5308
|
if (stack !== 'g') {
|
|
5306
5309
|
headers['Content-Type'] = 'application/json';
|
|
5307
5310
|
headers.countryCode || (headers.countryCode = config.imageRequest ? 'US' : countryCode);
|
|
@@ -6043,7 +6046,7 @@ var oktaLogin = /*#__PURE__*/function () {
|
|
|
6043
6046
|
};
|
|
6044
6047
|
}();
|
|
6045
6048
|
|
|
6046
|
-
var has$
|
|
6049
|
+
var has$3 = Object.prototype.hasOwnProperty,
|
|
6047
6050
|
undef;
|
|
6048
6051
|
|
|
6049
6052
|
/**
|
|
@@ -6124,7 +6127,7 @@ function querystringify(obj, prefix) {
|
|
|
6124
6127
|
//
|
|
6125
6128
|
if ('string' !== typeof prefix) prefix = '?';
|
|
6126
6129
|
for (key in obj) {
|
|
6127
|
-
if (has$
|
|
6130
|
+
if (has$3.call(obj, key)) {
|
|
6128
6131
|
value = obj[key];
|
|
6129
6132
|
|
|
6130
6133
|
//
|
|
@@ -7201,6 +7204,38 @@ var prop = /*#__PURE__*/_curry2(function prop(p, obj) {
|
|
|
7201
7204
|
});
|
|
7202
7205
|
var prop$1 = prop;
|
|
7203
7206
|
|
|
7207
|
+
/**
|
|
7208
|
+
* Returns a new list by plucking the same named property off all objects in
|
|
7209
|
+
* the list supplied.
|
|
7210
|
+
*
|
|
7211
|
+
* `pluck` will work on
|
|
7212
|
+
* any [functor](https://github.com/fantasyland/fantasy-land#functor) in
|
|
7213
|
+
* addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`.
|
|
7214
|
+
*
|
|
7215
|
+
* @func
|
|
7216
|
+
* @memberOf R
|
|
7217
|
+
* @since v0.1.0
|
|
7218
|
+
* @category List
|
|
7219
|
+
* @sig Functor f => k -> f {k: v} -> f v
|
|
7220
|
+
* @param {Number|String} key The key name to pluck off of each object.
|
|
7221
|
+
* @param {Array} f The array or functor to consider.
|
|
7222
|
+
* @return {Array} The list of values for the given key.
|
|
7223
|
+
* @see R.props
|
|
7224
|
+
* @example
|
|
7225
|
+
*
|
|
7226
|
+
* var getAges = R.pluck('age');
|
|
7227
|
+
* getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27]
|
|
7228
|
+
*
|
|
7229
|
+
* R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3]
|
|
7230
|
+
* R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5}
|
|
7231
|
+
* @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
|
|
7232
|
+
* @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
|
|
7233
|
+
*/
|
|
7234
|
+
var pluck = /*#__PURE__*/_curry2(function pluck(p, list) {
|
|
7235
|
+
return map$3(prop$1(p), list);
|
|
7236
|
+
});
|
|
7237
|
+
var pluck$1 = pluck;
|
|
7238
|
+
|
|
7204
7239
|
/**
|
|
7205
7240
|
* Returns a single item by iterating through the list, successively calling
|
|
7206
7241
|
* the iterator function and passing it an accumulator value and the current
|
|
@@ -8920,6 +8955,74 @@ var forEachObjIndexed = /*#__PURE__*/_curry2(function forEachObjIndexed(fn, obj)
|
|
|
8920
8955
|
});
|
|
8921
8956
|
var forEachObjIndexed$1 = forEachObjIndexed;
|
|
8922
8957
|
|
|
8958
|
+
/**
|
|
8959
|
+
* Returns whether or not a path exists in an object. Only the object's
|
|
8960
|
+
* own properties are checked.
|
|
8961
|
+
*
|
|
8962
|
+
* @func
|
|
8963
|
+
* @memberOf R
|
|
8964
|
+
* @since v0.26.0
|
|
8965
|
+
* @category Object
|
|
8966
|
+
* @typedefn Idx = String | Int
|
|
8967
|
+
* @sig [Idx] -> {a} -> Boolean
|
|
8968
|
+
* @param {Array} path The path to use.
|
|
8969
|
+
* @param {Object} obj The object to check the path in.
|
|
8970
|
+
* @return {Boolean} Whether the path exists.
|
|
8971
|
+
* @see R.has
|
|
8972
|
+
* @example
|
|
8973
|
+
*
|
|
8974
|
+
* R.hasPath(['a', 'b'], {a: {b: 2}}); // => true
|
|
8975
|
+
* R.hasPath(['a', 'b'], {a: {b: undefined}}); // => true
|
|
8976
|
+
* R.hasPath(['a', 'b'], {a: {c: 2}}); // => false
|
|
8977
|
+
* R.hasPath(['a', 'b'], {}); // => false
|
|
8978
|
+
*/
|
|
8979
|
+
var hasPath$1 = /*#__PURE__*/_curry2(function hasPath(_path, obj) {
|
|
8980
|
+
if (_path.length === 0) {
|
|
8981
|
+
return false;
|
|
8982
|
+
}
|
|
8983
|
+
var val = obj;
|
|
8984
|
+
var idx = 0;
|
|
8985
|
+
while (idx < _path.length) {
|
|
8986
|
+
if (_has(_path[idx], val)) {
|
|
8987
|
+
val = val[_path[idx]];
|
|
8988
|
+
idx += 1;
|
|
8989
|
+
} else {
|
|
8990
|
+
return false;
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
return true;
|
|
8994
|
+
});
|
|
8995
|
+
var hasPath$2 = hasPath$1;
|
|
8996
|
+
|
|
8997
|
+
/**
|
|
8998
|
+
* Returns whether or not an object has an own property with the specified name
|
|
8999
|
+
*
|
|
9000
|
+
* @func
|
|
9001
|
+
* @memberOf R
|
|
9002
|
+
* @since v0.7.0
|
|
9003
|
+
* @category Object
|
|
9004
|
+
* @sig s -> {s: x} -> Boolean
|
|
9005
|
+
* @param {String} prop The name of the property to check for.
|
|
9006
|
+
* @param {Object} obj The object to query.
|
|
9007
|
+
* @return {Boolean} Whether the property exists.
|
|
9008
|
+
* @example
|
|
9009
|
+
*
|
|
9010
|
+
* const hasName = R.has('name');
|
|
9011
|
+
* hasName({name: 'alice'}); //=> true
|
|
9012
|
+
* hasName({name: 'bob'}); //=> true
|
|
9013
|
+
* hasName({}); //=> false
|
|
9014
|
+
*
|
|
9015
|
+
* const point = {x: 0, y: 0};
|
|
9016
|
+
* const pointHas = R.has(R.__, point);
|
|
9017
|
+
* pointHas('x'); //=> true
|
|
9018
|
+
* pointHas('y'); //=> true
|
|
9019
|
+
* pointHas('z'); //=> false
|
|
9020
|
+
*/
|
|
9021
|
+
var has$1 = /*#__PURE__*/_curry2(function has(prop, obj) {
|
|
9022
|
+
return hasPath$2([prop], obj);
|
|
9023
|
+
});
|
|
9024
|
+
var has$2 = has$1;
|
|
9025
|
+
|
|
8923
9026
|
/**
|
|
8924
9027
|
* Returns `true` if the specified value is equal, in [`R.equals`](#equals)
|
|
8925
9028
|
* terms, to at least one element of the given list; `false` otherwise.
|
|
@@ -9485,6 +9588,85 @@ var getUserScopes = /*#__PURE__*/function () {
|
|
|
9485
9588
|
};
|
|
9486
9589
|
}();
|
|
9487
9590
|
|
|
9591
|
+
var getCobaltUserFacilities = /*#__PURE__*/function () {
|
|
9592
|
+
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(country, role) {
|
|
9593
|
+
var url, headers, response, facilitiesData, yardObject;
|
|
9594
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9595
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9596
|
+
case 0:
|
|
9597
|
+
_context.prev = 0;
|
|
9598
|
+
url = frontEndUtils.string.substitute(storage$1.coreConfig.endpoints.allFacilitiesNew, {
|
|
9599
|
+
country: country.toLowerCase()
|
|
9600
|
+
});
|
|
9601
|
+
headers = _objectSpread2({
|
|
9602
|
+
gStackCountry: country,
|
|
9603
|
+
AUTHORIZATIONROLE: role
|
|
9604
|
+
}, storage$1.activeLanguage === 'fi' ? {
|
|
9605
|
+
language: 'en',
|
|
9606
|
+
LANGUAGECODE: 'en'
|
|
9607
|
+
} : {});
|
|
9608
|
+
_context.next = 5;
|
|
9609
|
+
return fetcher.get(url, {
|
|
9610
|
+
headers: headers
|
|
9611
|
+
});
|
|
9612
|
+
case 5:
|
|
9613
|
+
response = _context.sent;
|
|
9614
|
+
facilitiesData = response.data.data;
|
|
9615
|
+
yardObject = map$3(function (val) {
|
|
9616
|
+
return {
|
|
9617
|
+
yard_number: val.yard_number,
|
|
9618
|
+
yard_name: val.yard_name
|
|
9619
|
+
};
|
|
9620
|
+
}, facilitiesData);
|
|
9621
|
+
return _context.abrupt("return", yardObject);
|
|
9622
|
+
case 11:
|
|
9623
|
+
_context.prev = 11;
|
|
9624
|
+
_context.t0 = _context["catch"](0);
|
|
9625
|
+
return _context.abrupt("return", Promise.reject('Unable to fetch Facilities'));
|
|
9626
|
+
case 14:
|
|
9627
|
+
case "end":
|
|
9628
|
+
return _context.stop();
|
|
9629
|
+
}
|
|
9630
|
+
}, _callee, null, [[0, 11]]);
|
|
9631
|
+
}));
|
|
9632
|
+
return function getCobaltUserFacilities(_x, _x2) {
|
|
9633
|
+
return _ref.apply(this, arguments);
|
|
9634
|
+
};
|
|
9635
|
+
}();
|
|
9636
|
+
|
|
9637
|
+
var getCobaltUserRoles = /*#__PURE__*/function () {
|
|
9638
|
+
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(country) {
|
|
9639
|
+
var url, _yield$fetcher$get, data;
|
|
9640
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9641
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9642
|
+
case 0:
|
|
9643
|
+
_context.prev = 0;
|
|
9644
|
+
url = storage$1.coreConfig.endpoints.getRoles;
|
|
9645
|
+
_context.next = 4;
|
|
9646
|
+
return fetcher.get(url, {
|
|
9647
|
+
headers: _objectSpread2(_objectSpread2({}, fetcher.defaults.headers.common), {}, {
|
|
9648
|
+
gStackCountry: country
|
|
9649
|
+
})
|
|
9650
|
+
});
|
|
9651
|
+
case 4:
|
|
9652
|
+
_yield$fetcher$get = _context.sent;
|
|
9653
|
+
data = _yield$fetcher$get.data;
|
|
9654
|
+
return _context.abrupt("return", data);
|
|
9655
|
+
case 9:
|
|
9656
|
+
_context.prev = 9;
|
|
9657
|
+
_context.t0 = _context["catch"](0);
|
|
9658
|
+
return _context.abrupt("return", Promise.reject('Unable to fetch Roles'));
|
|
9659
|
+
case 12:
|
|
9660
|
+
case "end":
|
|
9661
|
+
return _context.stop();
|
|
9662
|
+
}
|
|
9663
|
+
}, _callee, null, [[0, 9]]);
|
|
9664
|
+
}));
|
|
9665
|
+
return function getCobaltUserRoles(_x) {
|
|
9666
|
+
return _ref.apply(this, arguments);
|
|
9667
|
+
};
|
|
9668
|
+
}();
|
|
9669
|
+
|
|
9488
9670
|
fetcher.login = login;
|
|
9489
9671
|
fetcher.oktaLogin = oktaLogin;
|
|
9490
9672
|
fetcher.getConfig = getConfig;
|
|
@@ -9501,6 +9683,8 @@ fetcher.getPermissions = getPermissions;
|
|
|
9501
9683
|
fetcher.getCoreAppPermissions = getCoreAppPermissions;
|
|
9502
9684
|
fetcher.getInnovationHubToken = getInnovationHubToken;
|
|
9503
9685
|
fetcher.getUserScopes = getUserScopes;
|
|
9686
|
+
fetcher.getCobaltUserFacilities = getCobaltUserFacilities;
|
|
9687
|
+
fetcher.getCobaltUserRoles = getCobaltUserRoles;
|
|
9504
9688
|
|
|
9505
9689
|
var getRouteName = function getRouteName() {
|
|
9506
9690
|
return window.location.pathname.split('/').splice(1)[0];
|
|
@@ -23380,6 +23564,10 @@ var spanish = {
|
|
|
23380
23564
|
code: 'es',
|
|
23381
23565
|
description: 'Spanish'
|
|
23382
23566
|
};
|
|
23567
|
+
var finnish = {
|
|
23568
|
+
code: 'fi',
|
|
23569
|
+
description: 'Finnish'
|
|
23570
|
+
};
|
|
23383
23571
|
var getLanguages = function getLanguages() {
|
|
23384
23572
|
var selectedCountry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
23385
23573
|
var stack = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'c';
|
|
@@ -23421,6 +23609,10 @@ var getLanguages = function getLanguages() {
|
|
|
23421
23609
|
en: english,
|
|
23422
23610
|
es: spanish
|
|
23423
23611
|
},
|
|
23612
|
+
FI: {
|
|
23613
|
+
en: english,
|
|
23614
|
+
fi: finnish
|
|
23615
|
+
},
|
|
23424
23616
|
IN: {
|
|
23425
23617
|
en: english
|
|
23426
23618
|
},
|
|
@@ -23453,7 +23645,7 @@ var LanguageMenu = function LanguageMenu(props) {
|
|
|
23453
23645
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
|
|
23454
23646
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.Select, {
|
|
23455
23647
|
label: locale('Language'),
|
|
23456
|
-
options: formatOptions(Object.values(languageOptions)),
|
|
23648
|
+
options: formatOptions(Object.values(languageOptions || {})),
|
|
23457
23649
|
selectedOption: props.value,
|
|
23458
23650
|
onChange: function onChange(e, option) {
|
|
23459
23651
|
return props.handleChange(option.key);
|
|
@@ -23465,7 +23657,7 @@ var LanguageMenu = function LanguageMenu(props) {
|
|
|
23465
23657
|
}));
|
|
23466
23658
|
};
|
|
23467
23659
|
|
|
23468
|
-
var unique = function unique(roles) {
|
|
23660
|
+
var unique$1 = function unique(roles) {
|
|
23469
23661
|
return roles.reduce(function (final, role) {
|
|
23470
23662
|
var found = final.find(function (r) {
|
|
23471
23663
|
return role.roleName === r.roleName;
|
|
@@ -23477,14 +23669,14 @@ var unique = function unique(roles) {
|
|
|
23477
23669
|
};
|
|
23478
23670
|
|
|
23479
23671
|
// Sort roles based on session country
|
|
23480
|
-
var filterRoles$
|
|
23481
|
-
var filtered = unique(roles).filter(function (role) {
|
|
23672
|
+
var filterRoles$3 = function filterRoles(roles) {
|
|
23673
|
+
var filtered = unique$1(roles).filter(function (role) {
|
|
23482
23674
|
return role.roleName;
|
|
23483
23675
|
});
|
|
23484
23676
|
var byCountry = descend$1(prop$1('countryCode'));
|
|
23485
23677
|
return sort$1(byCountry, filtered);
|
|
23486
23678
|
};
|
|
23487
|
-
var RoleSelector$
|
|
23679
|
+
var RoleSelector$2 = function RoleSelector(_ref) {
|
|
23488
23680
|
var handleChange = _ref.handleChange,
|
|
23489
23681
|
value = _ref.value,
|
|
23490
23682
|
roles = _ref.roles,
|
|
@@ -23497,7 +23689,7 @@ var RoleSelector$1 = function RoleSelector(_ref) {
|
|
|
23497
23689
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, {
|
|
23498
23690
|
name: "role",
|
|
23499
23691
|
label: "Role",
|
|
23500
|
-
options: filterRoles$
|
|
23692
|
+
options: filterRoles$3(roles),
|
|
23501
23693
|
onChange: function onChange(value) {
|
|
23502
23694
|
var selectedValue = _typeof$1(value) === 'object' ? frontEndUtils.regex.beautifyRoleText(value.roleName) : value;
|
|
23503
23695
|
var option = _typeof$1(value) === 'object' ? value : null;
|
|
@@ -23528,7 +23720,7 @@ var optionStyleProps = {
|
|
|
23528
23720
|
rowHeight: 40,
|
|
23529
23721
|
optionsMinHeight: 200
|
|
23530
23722
|
};
|
|
23531
|
-
var YardNumberMenu$
|
|
23723
|
+
var YardNumberMenu$2 = function YardNumberMenu(_ref) {
|
|
23532
23724
|
var selectedYard = _ref.selectedYard,
|
|
23533
23725
|
name = _ref.name,
|
|
23534
23726
|
handleChange = _ref.handleChange,
|
|
@@ -23634,7 +23826,7 @@ var YardNumberContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
23634
23826
|
value: function render() {
|
|
23635
23827
|
var props = this.props,
|
|
23636
23828
|
state = this.state;
|
|
23637
|
-
return /*#__PURE__*/React__namespace.createElement(YardNumberMenu$
|
|
23829
|
+
return /*#__PURE__*/React__namespace.createElement(YardNumberMenu$2, {
|
|
23638
23830
|
required: true,
|
|
23639
23831
|
name: "selectedYard",
|
|
23640
23832
|
label: "Yard",
|
|
@@ -23726,7 +23918,7 @@ var formatPhoneNumber = function formatPhoneNumber() {
|
|
|
23726
23918
|
return "".concat(formattedNumber, " * ").concat(extension);
|
|
23727
23919
|
};
|
|
23728
23920
|
|
|
23729
|
-
var EMPTY_PRINTERS$
|
|
23921
|
+
var EMPTY_PRINTERS$2 = {
|
|
23730
23922
|
barcode_label_printers: '',
|
|
23731
23923
|
check_printers: '',
|
|
23732
23924
|
standard_printers: '',
|
|
@@ -23755,7 +23947,7 @@ var sessionOrDefault = function sessionOrDefault(label) {
|
|
|
23755
23947
|
return function () {
|
|
23756
23948
|
var printer_name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
23757
23949
|
var sessionDashboard = storage$1.getSessionItem('dashboard');
|
|
23758
|
-
sessionDashboard.printers = sessionDashboard.printers || EMPTY_PRINTERS$
|
|
23950
|
+
sessionDashboard.printers = sessionDashboard.printers || EMPTY_PRINTERS$2;
|
|
23759
23951
|
var printerName = sessionDashboard.printers[label];
|
|
23760
23952
|
return !isEmpty$2(printerName) ? printerName : printer_name;
|
|
23761
23953
|
};
|
|
@@ -23784,14 +23976,14 @@ var getActivePrinters = (function (printersData) {
|
|
|
23784
23976
|
var css_248z$9 = ".utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--title {\r\n font-weight: 500;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--inputRow {\r\n display: flex;\r\n width: 100%;\r\n align-items: flex-end;\r\n position: relative;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--inputRow .ms-TextField-errorMessage {\r\n position: absolute;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--textField {\r\n position: relative;\r\n display: flex;\r\n align-items: flex-end;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--prefix {\r\n margin: 5px;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--testCallButton {\r\n margin-left: 12px;\r\n}\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--prefix8 {\r\n margin: auto 2px auto 0;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--PhoneNumberSettings input {\r\n margin-right: 12px;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--smallInfo {\r\n margin-top: 2px;\r\n opacity: 0.5;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--PhoneNumberSettings small {\r\n margin-bottom: 12px;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--statusIndicator {\r\n position: absolute;\r\n right: 5px;\r\n height: 30px;\r\n display: flex;\r\n bottom: 1px;\r\n align-items: center;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--PhoneNumberSettings .utilities_ops-app-frame_AppBarComponent_Settings_PhoneNumberSettings_styles_PhoneNumberSettings--statusIndicator .ms-Spinner-circle {\r\n max-width: 20px !important;\r\n max-height: 20px !important;\r\n right: 5px;\r\n}\r\n\r\nmaterial-icon[name='check'] {\r\n color: rgb(100, 181, 10);\r\n font-size: 12px;\r\n}\r\n\r\nmaterial-icon[name='error_outline'] {\r\n color: #a80000;\r\n font-size: 12px;\r\n}\r\n";
|
|
23785
23977
|
styleInject(css_248z$9);
|
|
23786
23978
|
|
|
23787
|
-
var EMPTY_PRINTERS$
|
|
23979
|
+
var EMPTY_PRINTERS$1 = {
|
|
23788
23980
|
barcode_label_printers: '',
|
|
23789
23981
|
check_printers: '',
|
|
23790
23982
|
standard_printers: '',
|
|
23791
23983
|
windshield_label_printers: '',
|
|
23792
23984
|
text_printers: ''
|
|
23793
23985
|
};
|
|
23794
|
-
var getHierarchyLevel
|
|
23986
|
+
var getHierarchyLevel = function getHierarchyLevel(levelId) {
|
|
23795
23987
|
switch (levelId) {
|
|
23796
23988
|
case 0:
|
|
23797
23989
|
return 'country';
|
|
@@ -23801,8 +23993,8 @@ var getHierarchyLevel$1 = function getHierarchyLevel(levelId) {
|
|
|
23801
23993
|
return '';
|
|
23802
23994
|
}
|
|
23803
23995
|
};
|
|
23804
|
-
var isInvalid
|
|
23805
|
-
var keysToBeDeleted
|
|
23996
|
+
var isInvalid = either$1(isNil$1, isEmpty$2);
|
|
23997
|
+
var keysToBeDeleted = ['openEmailDialog', 'openPhoneDialog', 'searchParam', 'selectedCountry', 'selectedCountryA3code', 'selectedCurrency', 'selectedRole', 'selectedTimeZone', 'selectedYard', 'showPhoneEntryOnEnter', 'yard'];
|
|
23806
23998
|
|
|
23807
23999
|
// Handles changes to all inputs.
|
|
23808
24000
|
var handleInputChange$2 = function handleInputChange(self) {
|
|
@@ -23812,14 +24004,14 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23812
24004
|
if (name === 'selectedRole') {
|
|
23813
24005
|
var selectedValue = value.selectedValue,
|
|
23814
24006
|
option = value.option;
|
|
23815
|
-
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS$
|
|
24007
|
+
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS$1, 'printers');
|
|
23816
24008
|
return self.setState({
|
|
23817
24009
|
selectedRoleOption: option,
|
|
23818
24010
|
selectedRole: selectedValue
|
|
23819
24011
|
});
|
|
23820
24012
|
} else if (name === 'selectedYardNumber') {
|
|
23821
|
-
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS$
|
|
23822
|
-
self.updatePhoneNumber(activePhoneNumber$
|
|
24013
|
+
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS$1, 'printers');
|
|
24014
|
+
self.updatePhoneNumber(activePhoneNumber$1());
|
|
23823
24015
|
|
|
23824
24016
|
// Ensure we fetch the proper roles per the entered yard
|
|
23825
24017
|
var oldSelectedYard = self.state.selectedYardNumber;
|
|
@@ -23832,7 +24024,7 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23832
24024
|
});
|
|
23833
24025
|
if (value !== oldSelectedYard && Boolean(value)) {
|
|
23834
24026
|
self.setState({
|
|
23835
|
-
printersData: EMPTY_PRINTERS$
|
|
24027
|
+
printersData: EMPTY_PRINTERS$1
|
|
23836
24028
|
});
|
|
23837
24029
|
self.getActivePrinters(value, false, yardCountryCode);
|
|
23838
24030
|
}
|
|
@@ -23854,12 +24046,12 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23854
24046
|
return final;
|
|
23855
24047
|
}, {});
|
|
23856
24048
|
};
|
|
23857
|
-
var getSelectedYard
|
|
24049
|
+
var getSelectedYard = function getSelectedYard(selectedNumber) {
|
|
23858
24050
|
return storage$1.getLocalItem('login').yardList.find(function (yard) {
|
|
23859
24051
|
return yard.number == selectedNumber;
|
|
23860
24052
|
});
|
|
23861
24053
|
};
|
|
23862
|
-
var pickUserSecurityLevel
|
|
24054
|
+
var pickUserSecurityLevel = function pickUserSecurityLevel() {
|
|
23863
24055
|
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23864
24056
|
return obj.userSecurityLevel || '0';
|
|
23865
24057
|
};
|
|
@@ -23885,7 +24077,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23885
24077
|
};
|
|
23886
24078
|
dashboardState = storage$1.getLocalItem('dashboard');
|
|
23887
24079
|
cleanedDashboardState = pickBy$1(function (val, key) {
|
|
23888
|
-
return !keysToBeDeleted
|
|
24080
|
+
return !keysToBeDeleted.includes(key);
|
|
23889
24081
|
}, dashboardState);
|
|
23890
24082
|
storage$1.setLocalItem('dashboard', cleanedDashboardState);
|
|
23891
24083
|
toPairs$1(self.state).forEach(function (_ref4) {
|
|
@@ -23911,11 +24103,11 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23911
24103
|
if (roleOptionFromState) {
|
|
23912
24104
|
_roleOptionFromState$ = roleOptionFromState.levelId, levelId = _roleOptionFromState$ === void 0 ? -1 : _roleOptionFromState$, _roleOptionFromState$2 = roleOptionFromState.hierarchyId, hierarchyId = _roleOptionFromState$2 === void 0 ? -1 : _roleOptionFromState$2;
|
|
23913
24105
|
storage$1.setLocalItem('settings', {
|
|
23914
|
-
level: getHierarchyLevel
|
|
24106
|
+
level: getHierarchyLevel(levelId),
|
|
23915
24107
|
id: hierarchyId
|
|
23916
24108
|
}, 'selectedHierarchy');
|
|
23917
24109
|
}
|
|
23918
|
-
if (!(isInvalid
|
|
24110
|
+
if (!(isInvalid(selectedYard) || isInvalid(selectedLanguage) || isInvalid(selectedCurrency))) {
|
|
23919
24111
|
_context.next = 13;
|
|
23920
24112
|
break;
|
|
23921
24113
|
}
|
|
@@ -23938,7 +24130,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23938
24130
|
storage$1.setLocalItem('settings', roleName, 'selectedRole');
|
|
23939
24131
|
storage$1.setLocalItem('lastSelectedYard', yard);
|
|
23940
24132
|
storage$1.setLocalItem('dashboard', selectedCurrency || yard.yard_currency, 'selectedCurrency');
|
|
23941
|
-
securityLevel = pickUserSecurityLevel
|
|
24133
|
+
securityLevel = pickUserSecurityLevel(getSelectedYard(selectedYard));
|
|
23942
24134
|
storage$1.setSessionItem('securityLevel', Number(securityLevel));
|
|
23943
24135
|
_context.next = 24;
|
|
23944
24136
|
return fetcher.getUserScopes();
|
|
@@ -23992,7 +24184,7 @@ var selectedLanguage$1 = function selectedLanguage() {
|
|
|
23992
24184
|
var _storage$getSessionIt3;
|
|
23993
24185
|
return ((_storage$getSessionIt3 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt3 === void 0 ? void 0 : _storage$getSessionIt3.language) || 'en';
|
|
23994
24186
|
};
|
|
23995
|
-
var selectedCurrency
|
|
24187
|
+
var selectedCurrency = function selectedCurrency() {
|
|
23996
24188
|
var _storage$getSessionIt4;
|
|
23997
24189
|
return ((_storage$getSessionIt4 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCurrency) || 'USD';
|
|
23998
24190
|
};
|
|
@@ -24000,28 +24192,28 @@ var selectedCountryA3code$2 = function selectedCountryA3code() {
|
|
|
24000
24192
|
var _storage$getSessionIt5;
|
|
24001
24193
|
return ((_storage$getSessionIt5 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt5 === void 0 ? void 0 : _storage$getSessionIt5.selectedCountryA3code) || 'USA';
|
|
24002
24194
|
};
|
|
24003
|
-
var activePrinters$
|
|
24195
|
+
var activePrinters$1 = function activePrinters() {
|
|
24004
24196
|
var _storage$getLocalItem;
|
|
24005
|
-
return ((_storage$getLocalItem = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.printers) || EMPTY_PRINTERS$
|
|
24197
|
+
return ((_storage$getLocalItem = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.printers) || EMPTY_PRINTERS$1;
|
|
24006
24198
|
};
|
|
24007
|
-
var makeKeyValue$
|
|
24199
|
+
var makeKeyValue$1 = function makeKeyValue(final, target) {
|
|
24008
24200
|
final[target.label] = target.printer_name;
|
|
24009
24201
|
return final;
|
|
24010
24202
|
};
|
|
24011
|
-
var formatActivePrintersForState$
|
|
24203
|
+
var formatActivePrintersForState$1 = function formatActivePrintersForState() {
|
|
24012
24204
|
var activePrinters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24013
24205
|
var printers = Array.isArray(activePrinters) ? activePrinters : [];
|
|
24014
|
-
return printers.reduce(makeKeyValue$
|
|
24206
|
+
return printers.reduce(makeKeyValue$1, {});
|
|
24015
24207
|
};
|
|
24016
|
-
var activePhoneNumber$
|
|
24208
|
+
var activePhoneNumber$1 = function activePhoneNumber() {
|
|
24017
24209
|
var _storage$getLocalItem2;
|
|
24018
24210
|
return ((_storage$getLocalItem2 = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
24019
24211
|
};
|
|
24020
|
-
var ringCentralEnabled$
|
|
24212
|
+
var ringCentralEnabled$1 = function ringCentralEnabled() {
|
|
24021
24213
|
var _storage$getLocalItem3;
|
|
24022
24214
|
return ((_storage$getLocalItem3 = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
24023
24215
|
};
|
|
24024
|
-
var filterRoles$
|
|
24216
|
+
var filterRoles$2 = function filterRoles(roles, countryCode) {
|
|
24025
24217
|
return compose(uniqBy$1(prop$1('roleName')), filter$1(propEq$1('countryCode', countryCode)))(roles);
|
|
24026
24218
|
};
|
|
24027
24219
|
var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
@@ -24035,22 +24227,22 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24035
24227
|
}
|
|
24036
24228
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
24037
24229
|
_defineProperty$2(_assertThisInitialized(_this), "state", _objectSpread2({
|
|
24038
|
-
phoneNumber: activePhoneNumber$
|
|
24039
|
-
ringCentralEnabled: ringCentralEnabled$
|
|
24230
|
+
phoneNumber: activePhoneNumber$1(),
|
|
24231
|
+
ringCentralEnabled: ringCentralEnabled$1(),
|
|
24040
24232
|
selectedYardNumber: selectedYardNumber$2(),
|
|
24041
24233
|
selectedCountry: selectedCountry$1(),
|
|
24042
24234
|
selectedCountryA3code: selectedCountryA3code$2(),
|
|
24043
24235
|
selectedLanguage: selectedLanguage$1(),
|
|
24044
|
-
selectedCurrency: selectedCurrency
|
|
24236
|
+
selectedCurrency: selectedCurrency(),
|
|
24045
24237
|
roles: [],
|
|
24046
24238
|
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$1.userRole),
|
|
24047
|
-
printersData: EMPTY_PRINTERS$
|
|
24239
|
+
printersData: EMPTY_PRINTERS$1,
|
|
24048
24240
|
loadingPrinters: false,
|
|
24049
24241
|
oldActivePrinters: null
|
|
24050
|
-
}, EMPTY_PRINTERS$
|
|
24242
|
+
}, EMPTY_PRINTERS$1));
|
|
24051
24243
|
_defineProperty$2(_assertThisInitialized(_this), "fetchRoles", function (countryCode) {
|
|
24052
24244
|
fetcher.getUserRoles(countryCode).then(function (_roles) {
|
|
24053
|
-
var roles = filterRoles$
|
|
24245
|
+
var roles = filterRoles$2(_roles, countryCode);
|
|
24054
24246
|
var selectedRole = _this.state.selectedRole;
|
|
24055
24247
|
_this.setState({
|
|
24056
24248
|
roles: roles
|
|
@@ -24094,12 +24286,12 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24094
24286
|
showLoading: false
|
|
24095
24287
|
});
|
|
24096
24288
|
if (firstTime && storage$1.getLocalItem('dashboard', 'printers')) {
|
|
24097
|
-
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters$
|
|
24098
|
-
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters$
|
|
24289
|
+
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters$1()), {}, {
|
|
24290
|
+
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters$1()) : _this.state.oldActivePrinters
|
|
24099
24291
|
}));
|
|
24100
24292
|
} else {
|
|
24101
24293
|
response = getActivePrinters(printersData);
|
|
24102
|
-
fromatted = formatActivePrintersForState$
|
|
24294
|
+
fromatted = formatActivePrintersForState$1(response);
|
|
24103
24295
|
_this.setState(_objectSpread2({
|
|
24104
24296
|
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, fromatted) : _this.state.oldActivePrinters
|
|
24105
24297
|
}, fromatted));
|
|
@@ -24137,8 +24329,8 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24137
24329
|
getRCExtensionStatus().then(function (response) {
|
|
24138
24330
|
response && resetPhoneSettingsBasedOnRCStatus(response);
|
|
24139
24331
|
_this2.setState({
|
|
24140
|
-
ringCentralEnabled: ringCentralEnabled$
|
|
24141
|
-
phoneNumber: activePhoneNumber$
|
|
24332
|
+
ringCentralEnabled: ringCentralEnabled$1(),
|
|
24333
|
+
phoneNumber: activePhoneNumber$1()
|
|
24142
24334
|
});
|
|
24143
24335
|
});
|
|
24144
24336
|
this.getActivePrinters(this.state.selectedYardNumber, true, this.state.selectedCountryA3code);
|
|
@@ -24178,7 +24370,7 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24178
24370
|
selectedYard: this.state.selectedYardNumber,
|
|
24179
24371
|
handleChange: this.handleInputChange.selectedYardNumber,
|
|
24180
24372
|
selectedCountry: this.state.selectedCountry
|
|
24181
|
-
}), /*#__PURE__*/React__default["default"].createElement(RoleSelector$
|
|
24373
|
+
}), /*#__PURE__*/React__default["default"].createElement(RoleSelector$2, {
|
|
24182
24374
|
roles: this.state.roles,
|
|
24183
24375
|
value: this.state.selectedRole,
|
|
24184
24376
|
handleChange: this.handleInputChange.selectedRole,
|
|
@@ -24214,12 +24406,12 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24214
24406
|
return SettingsView;
|
|
24215
24407
|
}(React__default["default"].Component);
|
|
24216
24408
|
|
|
24217
|
-
var filterRoles$
|
|
24409
|
+
var filterRoles$1 = function filterRoles(roles) {
|
|
24218
24410
|
return roles.filter(function (role) {
|
|
24219
24411
|
return role.roleName;
|
|
24220
24412
|
});
|
|
24221
24413
|
};
|
|
24222
|
-
var RoleSelector = function RoleSelector(_ref) {
|
|
24414
|
+
var RoleSelector$1 = function RoleSelector(_ref) {
|
|
24223
24415
|
var handleChange = _ref.handleChange,
|
|
24224
24416
|
value = _ref.value,
|
|
24225
24417
|
roles = _ref.roles,
|
|
@@ -24231,7 +24423,7 @@ var RoleSelector = function RoleSelector(_ref) {
|
|
|
24231
24423
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, {
|
|
24232
24424
|
name: "role",
|
|
24233
24425
|
label: "Role",
|
|
24234
|
-
options: filterRoles$
|
|
24426
|
+
options: filterRoles$1(roles),
|
|
24235
24427
|
onChange: function onChange(value) {
|
|
24236
24428
|
var selectedValue = _typeof$1(value) === 'object' ? frontEndUtils.regex.beautifyRoleText(value.roleName) : value;
|
|
24237
24429
|
var option = _typeof$1(value) === 'object' ? value : null;
|
|
@@ -24353,7 +24545,7 @@ var HierarchyMenu = function HierarchyMenu(props) {
|
|
|
24353
24545
|
};
|
|
24354
24546
|
|
|
24355
24547
|
var _excluded$2 = ["value", "handleChange", "yardOptions", "label", "disabled"];
|
|
24356
|
-
var YardNumberMenu = function YardNumberMenu(_ref) {
|
|
24548
|
+
var YardNumberMenu$1 = function YardNumberMenu(_ref) {
|
|
24357
24549
|
var value = _ref.value,
|
|
24358
24550
|
handleChange = _ref.handleChange,
|
|
24359
24551
|
yardOptions = _ref.yardOptions;
|
|
@@ -24382,7 +24574,7 @@ var YardNumberMenu = function YardNumberMenu(_ref) {
|
|
|
24382
24574
|
})));
|
|
24383
24575
|
};
|
|
24384
24576
|
|
|
24385
|
-
var EMPTY_PRINTERS
|
|
24577
|
+
var EMPTY_PRINTERS = {
|
|
24386
24578
|
barcode_label_printers: '',
|
|
24387
24579
|
check_printers: '',
|
|
24388
24580
|
standard_printers: '',
|
|
@@ -24404,7 +24596,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24404
24596
|
break;
|
|
24405
24597
|
}
|
|
24406
24598
|
selectedValue = value.selectedValue, option = value.option;
|
|
24407
|
-
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS
|
|
24599
|
+
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24408
24600
|
roleName = option && option.roleName || ''; //pathOr('', ['selectedRoleOption', 'roleName'], nextState)
|
|
24409
24601
|
isValidRole = self.state.roles.find(function (role) {
|
|
24410
24602
|
return role.roleName === roleName;
|
|
@@ -24421,8 +24613,8 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24421
24613
|
hierarchies: hierarchies,
|
|
24422
24614
|
selectedHierarchyOption: null,
|
|
24423
24615
|
selectedYardNumber: null,
|
|
24424
|
-
printersData: EMPTY_PRINTERS
|
|
24425
|
-
}, EMPTY_PRINTERS
|
|
24616
|
+
printersData: EMPTY_PRINTERS
|
|
24617
|
+
}, EMPTY_PRINTERS));
|
|
24426
24618
|
case 10:
|
|
24427
24619
|
return _context.abrupt("return", self.setState({
|
|
24428
24620
|
selectedRoleOption: option,
|
|
@@ -24433,7 +24625,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24433
24625
|
_context.next = 32;
|
|
24434
24626
|
break;
|
|
24435
24627
|
}
|
|
24436
|
-
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS
|
|
24628
|
+
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24437
24629
|
country = value.country, _value$yard = value.yard, yard = _value$yard === void 0 ? null : _value$yard;
|
|
24438
24630
|
countryId = country && country.split('-')[0];
|
|
24439
24631
|
if (!countryId) {
|
|
@@ -24466,8 +24658,8 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24466
24658
|
level: yard ? 'yard' : 'country'
|
|
24467
24659
|
},
|
|
24468
24660
|
selectedYardNumber: yard,
|
|
24469
|
-
printersData: EMPTY_PRINTERS
|
|
24470
|
-
}, EMPTY_PRINTERS
|
|
24661
|
+
printersData: EMPTY_PRINTERS
|
|
24662
|
+
}, EMPTY_PRINTERS));
|
|
24471
24663
|
case 30:
|
|
24472
24664
|
_context.next = 43;
|
|
24473
24665
|
break;
|
|
@@ -24476,7 +24668,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24476
24668
|
_context.next = 43;
|
|
24477
24669
|
break;
|
|
24478
24670
|
}
|
|
24479
|
-
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS
|
|
24671
|
+
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24480
24672
|
if (!(value !== self.state.selectedYardNumber && Boolean(value))) {
|
|
24481
24673
|
_context.next = 42;
|
|
24482
24674
|
break;
|
|
@@ -24496,8 +24688,8 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24496
24688
|
return _context.abrupt("return", self.setState(function (state) {
|
|
24497
24689
|
return _objectSpread2({
|
|
24498
24690
|
selectedYardNumber: value,
|
|
24499
|
-
printersData: EMPTY_PRINTERS
|
|
24500
|
-
}, EMPTY_PRINTERS
|
|
24691
|
+
printersData: EMPTY_PRINTERS
|
|
24692
|
+
}, EMPTY_PRINTERS);
|
|
24501
24693
|
}));
|
|
24502
24694
|
case 43:
|
|
24503
24695
|
self.setState(function (state) {
|
|
@@ -24651,23 +24843,23 @@ var selectedCountryA3code$1 = function selectedCountryA3code() {
|
|
|
24651
24843
|
var _storage$getSessionIt2;
|
|
24652
24844
|
return ((_storage$getSessionIt2 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code) || 'GBR';
|
|
24653
24845
|
};
|
|
24654
|
-
var activePrinters
|
|
24655
|
-
return storage$1.getLocalItem('dashboard', 'printers') || EMPTY_PRINTERS
|
|
24846
|
+
var activePrinters = function activePrinters() {
|
|
24847
|
+
return storage$1.getLocalItem('dashboard', 'printers') || EMPTY_PRINTERS;
|
|
24656
24848
|
};
|
|
24657
|
-
var makeKeyValue
|
|
24849
|
+
var makeKeyValue = function makeKeyValue(final, target) {
|
|
24658
24850
|
final[target.label] = target.printer_name;
|
|
24659
24851
|
return final;
|
|
24660
24852
|
};
|
|
24661
|
-
var formatActivePrintersForState
|
|
24853
|
+
var formatActivePrintersForState = function formatActivePrintersForState() {
|
|
24662
24854
|
var activePrinters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24663
24855
|
var printers = Array.isArray(activePrinters) ? activePrinters : [];
|
|
24664
|
-
return printers.reduce(makeKeyValue
|
|
24856
|
+
return printers.reduce(makeKeyValue, {});
|
|
24665
24857
|
};
|
|
24666
|
-
var activePhoneNumber
|
|
24858
|
+
var activePhoneNumber = function activePhoneNumber() {
|
|
24667
24859
|
var _storage$getLocalItem2;
|
|
24668
24860
|
return ((_storage$getLocalItem2 = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
24669
24861
|
};
|
|
24670
|
-
var ringCentralEnabled
|
|
24862
|
+
var ringCentralEnabled = function ringCentralEnabled() {
|
|
24671
24863
|
var _storage$getLocalItem3;
|
|
24672
24864
|
return ((_storage$getLocalItem3 = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
24673
24865
|
};
|
|
@@ -24704,7 +24896,7 @@ var getYardOptions = /*#__PURE__*/function () {
|
|
|
24704
24896
|
return _ref7.apply(this, arguments);
|
|
24705
24897
|
};
|
|
24706
24898
|
}();
|
|
24707
|
-
var filterRoles
|
|
24899
|
+
var filterRoles = function filterRoles(roles, invalidCodes) {
|
|
24708
24900
|
return compose(uniqBy$1(prop$1('roleName')), filter$1(compose(not$1, flip$3(includes$1)(invalidCodes), prop$1('countryCode'))))(roles);
|
|
24709
24901
|
};
|
|
24710
24902
|
var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
@@ -24718,8 +24910,8 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24718
24910
|
}
|
|
24719
24911
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
24720
24912
|
_defineProperty$2(_assertThisInitialized(_this), "state", _objectSpread2({
|
|
24721
|
-
phoneNumber: activePhoneNumber
|
|
24722
|
-
ringCentralEnabled: ringCentralEnabled
|
|
24913
|
+
phoneNumber: activePhoneNumber(),
|
|
24914
|
+
ringCentralEnabled: ringCentralEnabled(),
|
|
24723
24915
|
selectedYardNumber: selectedYardNumber$1(),
|
|
24724
24916
|
selectedCountryA3code: selectedCountryA3code$1(),
|
|
24725
24917
|
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$1.userRole),
|
|
@@ -24727,9 +24919,9 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24727
24919
|
selectedHierarchyOption: storage$1.getLocalItem('settings', 'selectedHierarchyOption'),
|
|
24728
24920
|
roles: [],
|
|
24729
24921
|
hierarchies: [],
|
|
24730
|
-
printersData: EMPTY_PRINTERS
|
|
24922
|
+
printersData: EMPTY_PRINTERS,
|
|
24731
24923
|
oldActivePrinters: null
|
|
24732
|
-
}, EMPTY_PRINTERS
|
|
24924
|
+
}, EMPTY_PRINTERS));
|
|
24733
24925
|
_defineProperty$2(_assertThisInitialized(_this), "getRCAvailability", /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
24734
24926
|
var response;
|
|
24735
24927
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
@@ -24741,8 +24933,8 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24741
24933
|
response = _context4.sent;
|
|
24742
24934
|
resetPhoneSettingsBasedOnRCStatus(response);
|
|
24743
24935
|
_this.setState({
|
|
24744
|
-
ringCentralEnabled: ringCentralEnabled
|
|
24745
|
-
phoneNumber: activePhoneNumber
|
|
24936
|
+
ringCentralEnabled: ringCentralEnabled(),
|
|
24937
|
+
phoneNumber: activePhoneNumber()
|
|
24746
24938
|
});
|
|
24747
24939
|
case 5:
|
|
24748
24940
|
case "end":
|
|
@@ -24775,12 +24967,12 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24775
24967
|
showLoading: false
|
|
24776
24968
|
});
|
|
24777
24969
|
if (firstTime && storage$1.getLocalItem('dashboard', 'printers')) {
|
|
24778
|
-
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters
|
|
24779
|
-
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters
|
|
24970
|
+
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters()), {}, {
|
|
24971
|
+
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters()) : _this.state.oldActivePrinters
|
|
24780
24972
|
}));
|
|
24781
24973
|
} else {
|
|
24782
24974
|
_activePrinters = getActivePrinters(printersData);
|
|
24783
|
-
update = formatActivePrintersForState
|
|
24975
|
+
update = formatActivePrintersForState(_activePrinters);
|
|
24784
24976
|
_this.setState(_objectSpread2({
|
|
24785
24977
|
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, update) : _this.state.oldActivePrinters
|
|
24786
24978
|
}, update));
|
|
@@ -24822,7 +25014,7 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24822
25014
|
case 2:
|
|
24823
25015
|
_roles = _context6.sent;
|
|
24824
25016
|
// MEA and UK are both valid in UK portal so filter out the rest
|
|
24825
|
-
roles = filterRoles
|
|
25017
|
+
roles = filterRoles(_roles, ['CAN', 'BRA', 'USA', 'IND']);
|
|
24826
25018
|
_context6.next = 6;
|
|
24827
25019
|
return fetcher.getHierarchyOptions(storage$1.userRole);
|
|
24828
25020
|
case 6:
|
|
@@ -24894,7 +25086,7 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24894
25086
|
}), /*#__PURE__*/React__default["default"].createElement("p", null, "Settings")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
24895
25087
|
className: "col-1-1 utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--inputRow",
|
|
24896
25088
|
"data-e2e": "LocationAndLanguageRow"
|
|
24897
|
-
}, /*#__PURE__*/React__default["default"].createElement(RoleSelector, {
|
|
25089
|
+
}, /*#__PURE__*/React__default["default"].createElement(RoleSelector$1, {
|
|
24898
25090
|
roles: roles,
|
|
24899
25091
|
value: selectedRole,
|
|
24900
25092
|
selectedCountryA3code: this.state.selectedCountryA3code,
|
|
@@ -24903,7 +25095,7 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24903
25095
|
hierarchies: hierarchies,
|
|
24904
25096
|
value: this.state.selectedHierarchyOption,
|
|
24905
25097
|
handleChange: this.handleInputChange.selectedHierarchyOption
|
|
24906
|
-
}), /*#__PURE__*/React__default["default"].createElement(YardNumberMenu, {
|
|
25098
|
+
}), /*#__PURE__*/React__default["default"].createElement(YardNumberMenu$1, {
|
|
24907
25099
|
yardOptions: yardOptions,
|
|
24908
25100
|
disabled: disableYardDropDown,
|
|
24909
25101
|
value: this.state.selectedYardNumber,
|
|
@@ -24933,64 +25125,195 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24933
25125
|
return SettingsView;
|
|
24934
25126
|
}(React__default["default"].Component);
|
|
24935
25127
|
|
|
24936
|
-
var
|
|
24937
|
-
|
|
24938
|
-
|
|
24939
|
-
|
|
24940
|
-
|
|
24941
|
-
|
|
25128
|
+
var unique = function unique(roles) {
|
|
25129
|
+
return roles.reduce(function (final, role) {
|
|
25130
|
+
var found = final.find(function (r) {
|
|
25131
|
+
return role.roleName === r.roleName;
|
|
25132
|
+
});
|
|
25133
|
+
if (found) return final;
|
|
25134
|
+
final.push(role);
|
|
25135
|
+
return final;
|
|
25136
|
+
}, []);
|
|
24942
25137
|
};
|
|
24943
|
-
var
|
|
24944
|
-
|
|
24945
|
-
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
|
|
24950
|
-
|
|
25138
|
+
var RoleSelector = function RoleSelector(_ref) {
|
|
25139
|
+
var handleChange = _ref.handleChange,
|
|
25140
|
+
value = _ref.value,
|
|
25141
|
+
roles = _ref.roles;
|
|
25142
|
+
return /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, {
|
|
25143
|
+
name: "role",
|
|
25144
|
+
options: unique(roles),
|
|
25145
|
+
onChange: function onChange(value) {
|
|
25146
|
+
var selectedValue = value && value.roleName ? value.roleName : value;
|
|
25147
|
+
handleChange({
|
|
25148
|
+
selectedValue: selectedValue
|
|
25149
|
+
});
|
|
25150
|
+
},
|
|
25151
|
+
displayOption: function displayOption(o) {
|
|
25152
|
+
return o.roleName && locale(frontEndUtils.regex.capitalizeFirstLetter(frontEndUtils.regex.beautifyRoleText(o.roleName)));
|
|
25153
|
+
},
|
|
25154
|
+
serializeOption: function serializeOption(o) {
|
|
25155
|
+
return o.roleName;
|
|
25156
|
+
},
|
|
25157
|
+
value: value && locale(frontEndUtils.regex.capitalizeFirstLetter(frontEndUtils.regex.beautifyRoleText(value))),
|
|
25158
|
+
placeholder: "Role",
|
|
25159
|
+
label: locale('Role'),
|
|
25160
|
+
required: true
|
|
25161
|
+
});
|
|
25162
|
+
};
|
|
25163
|
+
|
|
25164
|
+
var YardNumberMenu = function YardNumberMenu(_ref) {
|
|
25165
|
+
var handleChange = _ref.handleChange,
|
|
25166
|
+
value = _ref.value,
|
|
25167
|
+
yardOptions = _ref.yardOptions;
|
|
25168
|
+
return /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, {
|
|
25169
|
+
name: "facility",
|
|
25170
|
+
options: yardOptions,
|
|
25171
|
+
onChange: handleChange,
|
|
25172
|
+
displayOption: function displayOption(yard) {
|
|
25173
|
+
return "".concat(yard.yard_number, " - ").concat(yard.yard_name);
|
|
25174
|
+
},
|
|
25175
|
+
value: value,
|
|
25176
|
+
placeholder: "Facility",
|
|
25177
|
+
label: locale('Facility'),
|
|
25178
|
+
required: true
|
|
25179
|
+
});
|
|
25180
|
+
};
|
|
25181
|
+
|
|
25182
|
+
var COUNTRIES$1 = {
|
|
25183
|
+
DE: {
|
|
25184
|
+
name: 'Germany',
|
|
25185
|
+
code: 'DEU'
|
|
25186
|
+
},
|
|
25187
|
+
ES: {
|
|
25188
|
+
name: 'Spain',
|
|
25189
|
+
code: 'ESP'
|
|
25190
|
+
},
|
|
25191
|
+
FI: {
|
|
25192
|
+
name: 'Finland',
|
|
25193
|
+
code: 'FIN'
|
|
24951
25194
|
}
|
|
24952
25195
|
};
|
|
24953
|
-
var
|
|
24954
|
-
|
|
25196
|
+
var validCountry = function validCountry(value) {
|
|
25197
|
+
return value && includes$1(value, keys$3(COUNTRIES$1)) ? locale(COUNTRIES$1[value].name) : value || '';
|
|
25198
|
+
};
|
|
25199
|
+
var CountrySelector = function CountrySelector(_ref) {
|
|
25200
|
+
var handleChange = _ref.handleChange,
|
|
25201
|
+
value = _ref.value,
|
|
25202
|
+
countries = _ref.countries;
|
|
25203
|
+
return /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, {
|
|
25204
|
+
name: "country",
|
|
25205
|
+
options: countries,
|
|
25206
|
+
onChange: handleChange,
|
|
25207
|
+
displayOption: function displayOption(country) {
|
|
25208
|
+
if (!country || !COUNTRIES$1[country]) return country || '';
|
|
25209
|
+
return locale(COUNTRIES$1[country].name);
|
|
25210
|
+
},
|
|
25211
|
+
value: validCountry(value),
|
|
25212
|
+
placeholder: "Country",
|
|
25213
|
+
label: locale('Country'),
|
|
25214
|
+
required: true
|
|
25215
|
+
});
|
|
25216
|
+
};
|
|
25217
|
+
|
|
25218
|
+
var COUNTRIES = {
|
|
25219
|
+
DE: {
|
|
25220
|
+
name: 'Germany',
|
|
25221
|
+
code: 'DEU'
|
|
25222
|
+
},
|
|
25223
|
+
ES: {
|
|
25224
|
+
name: 'Spain',
|
|
25225
|
+
code: 'ESP'
|
|
25226
|
+
},
|
|
25227
|
+
FI: {
|
|
25228
|
+
name: 'Finland',
|
|
25229
|
+
code: 'FIN'
|
|
25230
|
+
}
|
|
25231
|
+
};
|
|
25232
|
+
var getRolesMap = function getRolesMap(userRoles) {
|
|
25233
|
+
var rolesMap = {};
|
|
25234
|
+
userRoles.map(function (obj) {
|
|
25235
|
+
if (has$2(obj.roleName, rolesMap)) rolesMap[obj.roleName] = [].concat(_toConsumableArray(rolesMap[obj.roleName]), [obj.hierarchyId]);else rolesMap[obj.roleName] = [obj.hierarchyId];
|
|
25236
|
+
});
|
|
25237
|
+
storage$1.setLocalItem('settings', rolesMap, 'rolesMap');
|
|
25238
|
+
return rolesMap;
|
|
25239
|
+
};
|
|
25240
|
+
var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
25241
|
+
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
25242
|
+
var promises, userRoles, result;
|
|
25243
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
25244
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25245
|
+
case 0:
|
|
25246
|
+
promises = keys$3(COUNTRIES).map(function (country) {
|
|
25247
|
+
return fetcher.getCobaltUserRoles(COUNTRIES[country].code);
|
|
25248
|
+
});
|
|
25249
|
+
_context.next = 3;
|
|
25250
|
+
return Promise.all(promises);
|
|
25251
|
+
case 3:
|
|
25252
|
+
userRoles = _context.sent;
|
|
25253
|
+
result = keys$3(COUNTRIES).map(function (country, index) {
|
|
25254
|
+
return {
|
|
25255
|
+
country: country,
|
|
25256
|
+
roles: userRoles[index]
|
|
25257
|
+
};
|
|
25258
|
+
}).filter(function (roleByCountry) {
|
|
25259
|
+
return !isEmpty$2(roleByCountry.roles);
|
|
25260
|
+
});
|
|
25261
|
+
return _context.abrupt("return", result);
|
|
25262
|
+
case 6:
|
|
25263
|
+
case "end":
|
|
25264
|
+
return _context.stop();
|
|
25265
|
+
}
|
|
25266
|
+
}, _callee);
|
|
25267
|
+
}));
|
|
25268
|
+
return function getUserRolesFromFetcher() {
|
|
25269
|
+
return _ref.apply(this, arguments);
|
|
25270
|
+
};
|
|
25271
|
+
}();
|
|
25272
|
+
var getSelectedYardNumberAndName = function getSelectedYardNumberAndName() {
|
|
25273
|
+
var _storage$getLocalItem = storage$1.getLocalItem('dashboard'),
|
|
25274
|
+
selectedYard = _storage$getLocalItem.selectedYard,
|
|
25275
|
+
yardList = _storage$getLocalItem.yardList;
|
|
25276
|
+
var selectedYardObject = head$1(filter$1(function (yard) {
|
|
25277
|
+
return yard.yard_number === selectedYard;
|
|
25278
|
+
}, yardList)) || {};
|
|
25279
|
+
return !isEmpty$2(selectedYardObject) ? "".concat(selectedYardObject.yard_number, " - ").concat(selectedYardObject.yard_name) : null;
|
|
25280
|
+
};
|
|
25281
|
+
var getAccessCountries = function getAccessCountries(userRoles) {
|
|
25282
|
+
return userRoles.map(function (rolesByCountry) {
|
|
25283
|
+
return rolesByCountry.country;
|
|
25284
|
+
});
|
|
25285
|
+
};
|
|
25286
|
+
var getActiveCountryObjByCountry = function getActiveCountryObjByCountry(userRoles, selectedCountry) {
|
|
25287
|
+
return userRoles.find(function (rolesByCountry) {
|
|
25288
|
+
return rolesByCountry.country === selectedCountry;
|
|
25289
|
+
});
|
|
25290
|
+
};
|
|
24955
25291
|
|
|
24956
25292
|
// Handles changes to all inputs.
|
|
24957
25293
|
var handleInputChange = function handleInputChange(self) {
|
|
24958
|
-
|
|
25294
|
+
self.state.selectedCountryA3code;
|
|
24959
25295
|
var handleChange = function handleChange(name) {
|
|
24960
25296
|
return function (value) {
|
|
24961
|
-
if (name === '
|
|
25297
|
+
if (name === 'selectedCountry') {
|
|
25298
|
+
return self.setState({
|
|
25299
|
+
selectedCountry: value
|
|
25300
|
+
});
|
|
25301
|
+
} else if (name === 'selectedRole') {
|
|
24962
25302
|
var selectedValue = value.selectedValue,
|
|
24963
25303
|
option = value.option;
|
|
24964
|
-
storage$1.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24965
25304
|
return self.setState({
|
|
24966
25305
|
selectedRoleOption: option,
|
|
24967
25306
|
selectedRole: selectedValue
|
|
24968
25307
|
});
|
|
24969
25308
|
} else if (name === 'selectedYardNumber') {
|
|
24970
|
-
|
|
24971
|
-
|
|
24972
|
-
|
|
24973
|
-
// Ensure we fetch the proper roles per the entered yard
|
|
24974
|
-
var oldSelectedYard = self.state.selectedYardNumber;
|
|
24975
|
-
fetcher.getYardNumbers(value).then(function (yards) {
|
|
24976
|
-
var currentYard = find$1(propEq$1('yard_number', parseInt(value)), yards);
|
|
24977
|
-
if (currentYard) yardCountryCode = currentYard.yard_country_code;
|
|
24978
|
-
self.fetchRoles(yardCountryCode);
|
|
24979
|
-
self.setState({
|
|
24980
|
-
selectedCountryA3code: yardCountryCode
|
|
24981
|
-
});
|
|
24982
|
-
if (value !== oldSelectedYard && Boolean(value)) {
|
|
24983
|
-
self.setState({
|
|
24984
|
-
printersData: EMPTY_PRINTERS
|
|
24985
|
-
});
|
|
24986
|
-
self.getActivePrinters(value, false, yardCountryCode);
|
|
24987
|
-
}
|
|
25309
|
+
return self.setState({
|
|
25310
|
+
selectedYardNumber: value
|
|
24988
25311
|
});
|
|
24989
|
-
|
|
24990
|
-
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
25312
|
+
} else if (name === 'selectedYardNumberAndName') {
|
|
25313
|
+
var yardNumber = value.yard_number;
|
|
25314
|
+
return self.setState({
|
|
25315
|
+
selectedYardNumber: yardNumber,
|
|
25316
|
+
selectedYardNumberAndName: value
|
|
24994
25317
|
});
|
|
24995
25318
|
}
|
|
24996
25319
|
self.setState(function (state) {
|
|
@@ -25003,131 +25326,39 @@ var handleInputChange = function handleInputChange(self) {
|
|
|
25003
25326
|
return final;
|
|
25004
25327
|
}, {});
|
|
25005
25328
|
};
|
|
25006
|
-
var getSelectedYard = function getSelectedYard(selectedNumber) {
|
|
25007
|
-
return storage$1.getLocalItem('login').yardList.find(function (yard) {
|
|
25008
|
-
return yard.number == selectedNumber;
|
|
25009
|
-
});
|
|
25010
|
-
};
|
|
25011
|
-
var pickUserSecurityLevel = function pickUserSecurityLevel() {
|
|
25012
|
-
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
25013
|
-
return obj.userSecurityLevel || '0';
|
|
25014
|
-
};
|
|
25015
25329
|
var saveSettings = function saveSettings(self) {
|
|
25016
|
-
return
|
|
25017
|
-
var
|
|
25018
|
-
|
|
25019
|
-
|
|
25020
|
-
|
|
25021
|
-
|
|
25022
|
-
|
|
25023
|
-
|
|
25024
|
-
|
|
25025
|
-
|
|
25026
|
-
|
|
25027
|
-
|
|
25028
|
-
|
|
25029
|
-
|
|
25030
|
-
|
|
25031
|
-
|
|
25032
|
-
selectedRole: storage$1.getLocalItem('settings').selectedRole,
|
|
25033
|
-
activePrinters: self.state.oldActivePrinters
|
|
25034
|
-
};
|
|
25035
|
-
dashboardState = storage$1.getLocalItem('dashboard');
|
|
25036
|
-
cleanedDashboardState = pickBy$1(function (val, key) {
|
|
25037
|
-
return !keysToBeDeleted.includes(key);
|
|
25038
|
-
}, dashboardState);
|
|
25039
|
-
storage$1.setLocalItem('dashboard', cleanedDashboardState);
|
|
25040
|
-
toPairs$1(self.state).forEach(function (_ref4) {
|
|
25041
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
25042
|
-
key = _ref5[0],
|
|
25043
|
-
value = _ref5[1];
|
|
25044
|
-
if (key.endsWith('_printers')) {
|
|
25045
|
-
printers[key] = (value || '').toUpperCase();
|
|
25046
|
-
} else {
|
|
25047
|
-
if (key === 'printersData') {
|
|
25048
|
-
value = JSON.stringify(value);
|
|
25049
|
-
}
|
|
25050
|
-
if (key === 'phoneNumber') {
|
|
25051
|
-
storage$1.setLocalItem('dashboard', value, 'phoneNumber');
|
|
25052
|
-
}
|
|
25053
|
-
}
|
|
25054
|
-
});
|
|
25055
|
-
_self$state = self.state, selectedYard = _self$state.selectedYardNumber, selectedRole = _self$state.selectedRole, selectedLanguage = _self$state.selectedLanguage, selectedCurrency = _self$state.selectedCurrency, roles = _self$state.roles, _self$state.selectedRoleOption;
|
|
25056
|
-
roleOptionFromState = roles.find(function (roleOption) {
|
|
25057
|
-
return frontEndUtils.regex.beautifyRoleText(roleOption.roleName) === selectedRole;
|
|
25058
|
-
}) || head$1(roles);
|
|
25059
|
-
roleName = propOr$1('', 'roleName', roleOptionFromState); // Update hierarchy on local storage when role changes
|
|
25060
|
-
if (roleOptionFromState) {
|
|
25061
|
-
_roleOptionFromState$ = roleOptionFromState.levelId, levelId = _roleOptionFromState$ === void 0 ? -1 : _roleOptionFromState$, _roleOptionFromState$2 = roleOptionFromState.hierarchyId, hierarchyId = _roleOptionFromState$2 === void 0 ? -1 : _roleOptionFromState$2;
|
|
25062
|
-
storage$1.setLocalItem('settings', {
|
|
25063
|
-
level: getHierarchyLevel(levelId),
|
|
25064
|
-
id: hierarchyId
|
|
25065
|
-
}, 'selectedHierarchy');
|
|
25066
|
-
}
|
|
25067
|
-
if (!(isInvalid(selectedYard) || isInvalid(selectedLanguage) || isInvalid(selectedCurrency))) {
|
|
25068
|
-
_context.next = 13;
|
|
25069
|
-
break;
|
|
25070
|
-
}
|
|
25071
|
-
return _context.abrupt("return");
|
|
25072
|
-
case 13:
|
|
25073
|
-
yard = self.yardsHistory.get(selectedYard)[selectedYard];
|
|
25074
|
-
storage$1.setSessionItem('dashboard', _objectSpread2(_objectSpread2({}, storage$1.getSessionItem('dashboard')), {}, {
|
|
25075
|
-
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
25076
|
-
selectedCountry: (_yard$yard_country_co = yard.yard_country_code) === null || _yard$yard_country_co === void 0 ? void 0 : _yard$yard_country_co.slice(0, 2),
|
|
25077
|
-
selectedCountryA3code: yard.yard_country_code,
|
|
25078
|
-
selectedYard: yard.yard_number,
|
|
25079
|
-
selectedTimeZone: yard.time_zone,
|
|
25080
|
-
language: selectedLanguage || 'en',
|
|
25081
|
-
selectedRole: roleName,
|
|
25082
|
-
printers: printers,
|
|
25083
|
-
yard: yard
|
|
25084
|
-
}));
|
|
25085
|
-
storage$1.setLocalItem('dashboard', printers, 'printers');
|
|
25086
|
-
storage$1.setLocalItem('dashboard', selectedLanguage || 'en', 'language');
|
|
25087
|
-
storage$1.setLocalItem('settings', roleName, 'selectedRole');
|
|
25088
|
-
storage$1.setLocalItem('lastSelectedYard', yard);
|
|
25089
|
-
storage$1.setLocalItem('dashboard', selectedCurrency || yard.yard_currency, 'selectedCurrency');
|
|
25090
|
-
securityLevel = pickUserSecurityLevel(getSelectedYard(selectedYard));
|
|
25091
|
-
storage$1.setSessionItem('securityLevel', Number(securityLevel));
|
|
25092
|
-
_context.next = 24;
|
|
25093
|
-
return fetcher.getUserScopes();
|
|
25094
|
-
case 24:
|
|
25095
|
-
userScopes = _context.sent;
|
|
25096
|
-
storage$1.setLocalItem('login', userScopes, 'userAppScopes');
|
|
25097
|
-
// persist user preferences
|
|
25098
|
-
_context.next = 28;
|
|
25099
|
-
return fetcher.setUserPreferences('oph', {
|
|
25100
|
-
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
25101
|
-
language: selectedLanguage || 'en',
|
|
25102
|
-
// TODO Remove this after remove role selection
|
|
25103
|
-
selectedRole: roleName,
|
|
25104
|
-
printers: printers,
|
|
25105
|
-
yard: yard,
|
|
25106
|
-
securityLevel: securityLevel
|
|
25107
|
-
}, 'USA');
|
|
25108
|
-
case 28:
|
|
25109
|
-
self.setState({
|
|
25110
|
-
oldActivePrinters: printers
|
|
25111
|
-
});
|
|
25112
|
-
newSettings = {
|
|
25113
|
-
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
25114
|
-
selectedYard: yard.yard_number,
|
|
25115
|
-
selectedCountry: (_yard$yard_country_co2 = yard.yard_country_code) === null || _yard$yard_country_co2 === void 0 ? void 0 : _yard$yard_country_co2.slice(0, 2),
|
|
25116
|
-
language: selectedLanguage || 'en',
|
|
25117
|
-
selectedRole: roleName,
|
|
25118
|
-
activePrinters: self.activePrinters
|
|
25119
|
-
};
|
|
25120
|
-
self.props.onSave(oldSettings, newSettings);
|
|
25121
|
-
case 31:
|
|
25122
|
-
case "end":
|
|
25123
|
-
return _context.stop();
|
|
25124
|
-
}
|
|
25125
|
-
}, _callee);
|
|
25126
|
-
}));
|
|
25127
|
-
return function (_x) {
|
|
25128
|
-
return _ref3.apply(this, arguments);
|
|
25330
|
+
return function () {
|
|
25331
|
+
var _self$state = self.state,
|
|
25332
|
+
selectedCountry = _self$state.selectedCountry,
|
|
25333
|
+
selectedRole = _self$state.selectedRole,
|
|
25334
|
+
selectedYard = _self$state.selectedYardNumber,
|
|
25335
|
+
language = _self$state.selectedLanguage,
|
|
25336
|
+
yardOptions = _self$state.yardOptions;
|
|
25337
|
+
if (!selectedCountry || !language || !selectedYard || !selectedRole) {
|
|
25338
|
+
return;
|
|
25339
|
+
}
|
|
25340
|
+
var selectedCountryA3code = COUNTRIES[selectedCountry].code;
|
|
25341
|
+
var dashboard = {
|
|
25342
|
+
language: language,
|
|
25343
|
+
selectedCountry: selectedCountry,
|
|
25344
|
+
selectedCountryA3code: selectedCountryA3code,
|
|
25345
|
+
selectedYard: selectedYard
|
|
25129
25346
|
};
|
|
25130
|
-
|
|
25347
|
+
localStorage.setItem('dashboard', JSON.stringify(dashboard));
|
|
25348
|
+
sessionStorage.setItem('dashboard', JSON.stringify(dashboard));
|
|
25349
|
+
storage$1.setLocalItem('dashboard', {
|
|
25350
|
+
yard_number: selectedYard
|
|
25351
|
+
}, 'yard');
|
|
25352
|
+
storage$1.setSessionItem('dashboard', {
|
|
25353
|
+
yard_number: selectedYard
|
|
25354
|
+
}, 'yard');
|
|
25355
|
+
storage$1.setLocalItem('dashboard', yardOptions, 'yardList');
|
|
25356
|
+
storage$1.setSessionItem('dashboard', yardOptions, 'yardList');
|
|
25357
|
+
storage$1.setLocalItem('settings', selectedRole, 'selectedRole');
|
|
25358
|
+
if (self.props.onSave) {
|
|
25359
|
+
self.props.onSave();
|
|
25360
|
+
}
|
|
25361
|
+
};
|
|
25131
25362
|
};
|
|
25132
25363
|
var selectedYardNumber = function selectedYardNumber() {
|
|
25133
25364
|
var _storage$getSessionIt;
|
|
@@ -25141,37 +25372,9 @@ var selectedLanguage = function selectedLanguage() {
|
|
|
25141
25372
|
var _storage$getSessionIt3;
|
|
25142
25373
|
return ((_storage$getSessionIt3 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt3 === void 0 ? void 0 : _storage$getSessionIt3.language) || 'en';
|
|
25143
25374
|
};
|
|
25144
|
-
var selectedCurrency = function selectedCurrency() {
|
|
25145
|
-
var _storage$getSessionIt4;
|
|
25146
|
-
return ((_storage$getSessionIt4 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCurrency) || 'USD';
|
|
25147
|
-
};
|
|
25148
25375
|
var selectedCountryA3code = function selectedCountryA3code() {
|
|
25149
|
-
var _storage$
|
|
25150
|
-
return ((_storage$
|
|
25151
|
-
};
|
|
25152
|
-
var activePrinters = function activePrinters() {
|
|
25153
|
-
var _storage$getLocalItem;
|
|
25154
|
-
return ((_storage$getLocalItem = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.printers) || EMPTY_PRINTERS;
|
|
25155
|
-
};
|
|
25156
|
-
var makeKeyValue = function makeKeyValue(final, target) {
|
|
25157
|
-
final[target.label] = target.printer_name;
|
|
25158
|
-
return final;
|
|
25159
|
-
};
|
|
25160
|
-
var formatActivePrintersForState = function formatActivePrintersForState() {
|
|
25161
|
-
var activePrinters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
25162
|
-
var printers = Array.isArray(activePrinters) ? activePrinters : [];
|
|
25163
|
-
return printers.reduce(makeKeyValue, {});
|
|
25164
|
-
};
|
|
25165
|
-
var activePhoneNumber = function activePhoneNumber() {
|
|
25166
|
-
var _storage$getLocalItem2;
|
|
25167
|
-
return ((_storage$getLocalItem2 = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
25168
|
-
};
|
|
25169
|
-
var ringCentralEnabled = function ringCentralEnabled() {
|
|
25170
|
-
var _storage$getLocalItem3;
|
|
25171
|
-
return ((_storage$getLocalItem3 = storage$1.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
25172
|
-
};
|
|
25173
|
-
var filterRoles = function filterRoles(roles, countryCode) {
|
|
25174
|
-
return compose(uniqBy$1(prop$1('roleName')), filter$1(propEq$1('countryCode', countryCode)))(roles);
|
|
25376
|
+
var _storage$getSessionIt4;
|
|
25377
|
+
return ((_storage$getSessionIt4 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCountryA3code) || 'USA';
|
|
25175
25378
|
};
|
|
25176
25379
|
var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
25177
25380
|
_inherits$2(SettingsView, _React$Component);
|
|
@@ -25183,126 +25386,215 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25183
25386
|
args[_key] = arguments[_key];
|
|
25184
25387
|
}
|
|
25185
25388
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
25186
|
-
_defineProperty$2(_assertThisInitialized(_this), "state",
|
|
25187
|
-
phoneNumber: activePhoneNumber(),
|
|
25188
|
-
ringCentralEnabled: ringCentralEnabled(),
|
|
25389
|
+
_defineProperty$2(_assertThisInitialized(_this), "state", {
|
|
25189
25390
|
selectedYardNumber: selectedYardNumber(),
|
|
25190
25391
|
selectedCountry: selectedCountry(),
|
|
25191
25392
|
selectedCountryA3code: selectedCountryA3code(),
|
|
25192
25393
|
selectedLanguage: selectedLanguage(),
|
|
25193
|
-
selectedCurrency: selectedCurrency(),
|
|
25194
25394
|
roles: [],
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
fetcher.getUserRoles(countryCode).then(function (_roles) {
|
|
25202
|
-
var roles = filterRoles(_roles, countryCode);
|
|
25203
|
-
var selectedRole = _this.state.selectedRole;
|
|
25204
|
-
_this.setState({
|
|
25205
|
-
roles: roles
|
|
25206
|
-
});
|
|
25207
|
-
if (selectedRole && !find$1(compose(equals$1(selectedRole), frontEndUtils.regex.beautifyRoleText, prop$1('roleName')), roles)) {
|
|
25208
|
-
_this.setState({
|
|
25209
|
-
selectedRole: ''
|
|
25210
|
-
});
|
|
25211
|
-
}
|
|
25212
|
-
}).catch(function (err) {
|
|
25213
|
-
_this.setState({
|
|
25214
|
-
roles: [],
|
|
25215
|
-
selectedRole: ''
|
|
25216
|
-
});
|
|
25217
|
-
});
|
|
25395
|
+
countries: [],
|
|
25396
|
+
userRoles: [],
|
|
25397
|
+
yardOptions: [],
|
|
25398
|
+
selectedYardNumberAndName: getSelectedYardNumberAndName() || null,
|
|
25399
|
+
selectedRole: storage$1.getLocalItem('settings').selectedRole || '',
|
|
25400
|
+
showLoading: false
|
|
25218
25401
|
});
|
|
25219
|
-
_defineProperty$2(_assertThisInitialized(_this), "
|
|
25220
|
-
var
|
|
25221
|
-
var
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
fromatted,
|
|
25226
|
-
_args2 = arguments;
|
|
25227
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
25228
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
25402
|
+
_defineProperty$2(_assertThisInitialized(_this), "fetchFacilititesForRole", /*#__PURE__*/function () {
|
|
25403
|
+
var _ref2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(roleName, activeCountryObj) {
|
|
25404
|
+
var _activeCountryObj$rol;
|
|
25405
|
+
var allFacilities, rolesMap, yardOptions;
|
|
25406
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
25407
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25229
25408
|
case 0:
|
|
25230
|
-
|
|
25231
|
-
|
|
25409
|
+
if (!(!roleName || !(activeCountryObj !== null && activeCountryObj !== void 0 && (_activeCountryObj$rol = activeCountryObj.roles) !== null && _activeCountryObj$rol !== void 0 && _activeCountryObj$rol.length))) {
|
|
25410
|
+
_context.next = 3;
|
|
25411
|
+
break;
|
|
25412
|
+
}
|
|
25232
25413
|
_this.setState({
|
|
25233
|
-
|
|
25234
|
-
showLoading: true
|
|
25414
|
+
yardOptions: []
|
|
25235
25415
|
});
|
|
25236
|
-
|
|
25237
|
-
|
|
25238
|
-
|
|
25239
|
-
|
|
25416
|
+
return _context.abrupt("return");
|
|
25417
|
+
case 3:
|
|
25418
|
+
if (!includes$1(roleName, pluck$1('roleName', (activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []))) {
|
|
25419
|
+
_context.next = 22;
|
|
25420
|
+
break;
|
|
25421
|
+
}
|
|
25422
|
+
_context.prev = 4;
|
|
25423
|
+
if (COUNTRIES[_this.state.selectedCountry]) {
|
|
25424
|
+
_context.next = 8;
|
|
25425
|
+
break;
|
|
25426
|
+
}
|
|
25240
25427
|
_this.setState({
|
|
25241
|
-
|
|
25242
|
-
loadingPrinters: false,
|
|
25243
|
-
showLoading: false
|
|
25428
|
+
yardOptions: []
|
|
25244
25429
|
});
|
|
25245
|
-
|
|
25246
|
-
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters()), {}, {
|
|
25247
|
-
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters()) : _this.state.oldActivePrinters
|
|
25248
|
-
}));
|
|
25249
|
-
} else {
|
|
25250
|
-
response = getActivePrinters(printersData);
|
|
25251
|
-
fromatted = formatActivePrintersForState(response);
|
|
25252
|
-
_this.setState(_objectSpread2({
|
|
25253
|
-
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, fromatted) : _this.state.oldActivePrinters
|
|
25254
|
-
}, fromatted));
|
|
25255
|
-
}
|
|
25430
|
+
return _context.abrupt("return");
|
|
25256
25431
|
case 8:
|
|
25432
|
+
_context.next = 10;
|
|
25433
|
+
return fetcher.getCobaltUserFacilities(COUNTRIES[_this.state.selectedCountry].code, roleName);
|
|
25434
|
+
case 10:
|
|
25435
|
+
allFacilities = _context.sent;
|
|
25436
|
+
rolesMap = getRolesMap((activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []);
|
|
25437
|
+
if (!includes$1(_this.state.selectedYardNumber, rolesMap[roleName])) {
|
|
25438
|
+
_this.setState({
|
|
25439
|
+
selectedYardNumber: '',
|
|
25440
|
+
selectedYardNumberAndName: ''
|
|
25441
|
+
});
|
|
25442
|
+
}
|
|
25443
|
+
yardOptions = filter$1(function (yard) {
|
|
25444
|
+
return includes$1(yard.yard_number, rolesMap[roleName]);
|
|
25445
|
+
}, allFacilities);
|
|
25446
|
+
_this.setState({
|
|
25447
|
+
yardOptions: yardOptions
|
|
25448
|
+
});
|
|
25449
|
+
_context.next = 20;
|
|
25450
|
+
break;
|
|
25451
|
+
case 17:
|
|
25452
|
+
_context.prev = 17;
|
|
25453
|
+
_context.t0 = _context["catch"](4);
|
|
25454
|
+
_this.setState({
|
|
25455
|
+
yardOptions: []
|
|
25456
|
+
});
|
|
25457
|
+
case 20:
|
|
25458
|
+
_context.next = 23;
|
|
25459
|
+
break;
|
|
25460
|
+
case 22:
|
|
25461
|
+
_this.setState({
|
|
25462
|
+
selectedRole: '',
|
|
25463
|
+
yardOptions: []
|
|
25464
|
+
});
|
|
25465
|
+
case 23:
|
|
25257
25466
|
case "end":
|
|
25258
|
-
return
|
|
25467
|
+
return _context.stop();
|
|
25259
25468
|
}
|
|
25260
|
-
},
|
|
25469
|
+
}, _callee, null, [[4, 17]]);
|
|
25261
25470
|
}));
|
|
25262
|
-
return function (_x2) {
|
|
25263
|
-
return
|
|
25471
|
+
return function (_x, _x2) {
|
|
25472
|
+
return _ref2.apply(this, arguments);
|
|
25264
25473
|
};
|
|
25265
25474
|
}());
|
|
25266
|
-
_defineProperty$2(_assertThisInitialized(_this), "updatePhoneNumber", function (phoneNumber) {
|
|
25267
|
-
_this.setState({
|
|
25268
|
-
phoneNumber: phoneNumber
|
|
25269
|
-
});
|
|
25270
|
-
});
|
|
25271
25475
|
_defineProperty$2(_assertThisInitialized(_this), "handleInputChange", handleInputChange(_assertThisInitialized(_this)));
|
|
25272
25476
|
_defineProperty$2(_assertThisInitialized(_this), "saveSettings", saveSettings(_assertThisInitialized(_this)));
|
|
25273
25477
|
_defineProperty$2(_assertThisInitialized(_this), "yardsHistory", new Map());
|
|
25274
|
-
_defineProperty$2(_assertThisInitialized(_this), "setPrinterData", function (name) {
|
|
25275
|
-
return function (value) {
|
|
25276
|
-
_this.setState(_defineProperty$2({}, name, value));
|
|
25277
|
-
};
|
|
25278
|
-
});
|
|
25279
25478
|
return _this;
|
|
25280
|
-
}
|
|
25281
|
-
// this.fetchRoles(this.state.selectedCountryA3code)
|
|
25282
|
-
// getRCExtensionStatus().then((response) => {
|
|
25283
|
-
// response && resetPhoneSettingsBasedOnRCStatus(response)
|
|
25284
|
-
// this.setState({
|
|
25285
|
-
// ringCentralEnabled: ringCentralEnabled(),
|
|
25286
|
-
// phoneNumber: activePhoneNumber(),
|
|
25287
|
-
// })
|
|
25288
|
-
// })
|
|
25289
|
-
// this.getActivePrinters(
|
|
25290
|
-
// this.state.selectedYardNumber,
|
|
25291
|
-
// true,
|
|
25292
|
-
// this.state.selectedCountryA3code,
|
|
25293
|
-
// )
|
|
25294
|
-
// }
|
|
25479
|
+
}
|
|
25295
25480
|
_createClass$2(SettingsView, [{
|
|
25296
|
-
key: "
|
|
25297
|
-
|
|
25298
|
-
|
|
25299
|
-
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
25305
|
-
|
|
25481
|
+
key: "componentWillMount",
|
|
25482
|
+
value: function () {
|
|
25483
|
+
var _componentWillMount = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
25484
|
+
var _activeCountryObj$rol2;
|
|
25485
|
+
var userRoles, countries, _this$state, selectedCountry, selectedRole, activeCountryObj, firstRole;
|
|
25486
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
25487
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
25488
|
+
case 0:
|
|
25489
|
+
_context2.next = 2;
|
|
25490
|
+
return getUserRolesFromFetcher();
|
|
25491
|
+
case 2:
|
|
25492
|
+
userRoles = _context2.sent;
|
|
25493
|
+
countries = getAccessCountries(userRoles);
|
|
25494
|
+
_this$state = this.state, selectedCountry = _this$state.selectedCountry, selectedRole = _this$state.selectedRole;
|
|
25495
|
+
if (!selectedCountry) {
|
|
25496
|
+
selectedCountry = head$1(countries) || '';
|
|
25497
|
+
}
|
|
25498
|
+
activeCountryObj = getActiveCountryObjByCountry(userRoles, selectedCountry);
|
|
25499
|
+
this.setState({
|
|
25500
|
+
selectedCountry: (activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.country) || selectedCountry,
|
|
25501
|
+
countries: countries,
|
|
25502
|
+
roles: (activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || [],
|
|
25503
|
+
userRoles: userRoles
|
|
25504
|
+
});
|
|
25505
|
+
if (!(selectedRole && activeCountryObj)) {
|
|
25506
|
+
_context2.next = 13;
|
|
25507
|
+
break;
|
|
25508
|
+
}
|
|
25509
|
+
_context2.next = 11;
|
|
25510
|
+
return this.fetchFacilititesForRole(selectedRole, activeCountryObj);
|
|
25511
|
+
case 11:
|
|
25512
|
+
_context2.next = 19;
|
|
25513
|
+
break;
|
|
25514
|
+
case 13:
|
|
25515
|
+
if (!((activeCountryObj === null || activeCountryObj === void 0 ? void 0 : (_activeCountryObj$rol2 = activeCountryObj.roles) === null || _activeCountryObj$rol2 === void 0 ? void 0 : _activeCountryObj$rol2.length) > 0)) {
|
|
25516
|
+
_context2.next = 19;
|
|
25517
|
+
break;
|
|
25518
|
+
}
|
|
25519
|
+
firstRole = activeCountryObj.roles[0];
|
|
25520
|
+
if (!firstRole) {
|
|
25521
|
+
_context2.next = 19;
|
|
25522
|
+
break;
|
|
25523
|
+
}
|
|
25524
|
+
this.setState({
|
|
25525
|
+
selectedRole: firstRole.roleName
|
|
25526
|
+
});
|
|
25527
|
+
_context2.next = 19;
|
|
25528
|
+
return this.fetchFacilititesForRole(firstRole.roleName, activeCountryObj);
|
|
25529
|
+
case 19:
|
|
25530
|
+
case "end":
|
|
25531
|
+
return _context2.stop();
|
|
25532
|
+
}
|
|
25533
|
+
}, _callee2, this);
|
|
25534
|
+
}));
|
|
25535
|
+
function componentWillMount() {
|
|
25536
|
+
return _componentWillMount.apply(this, arguments);
|
|
25537
|
+
}
|
|
25538
|
+
return componentWillMount;
|
|
25539
|
+
}()
|
|
25540
|
+
}, {
|
|
25541
|
+
key: "componentWillUpdate",
|
|
25542
|
+
value: function () {
|
|
25543
|
+
var _componentWillUpdate = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(nextProps, nextState) {
|
|
25544
|
+
var activeCountryObj, _activeCountryObj;
|
|
25545
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
25546
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
25547
|
+
case 0:
|
|
25548
|
+
if (!(nextState.selectedCountry !== this.state.selectedCountry)) {
|
|
25549
|
+
_context3.next = 5;
|
|
25550
|
+
break;
|
|
25551
|
+
}
|
|
25552
|
+
this.setState({
|
|
25553
|
+
selectedRole: null,
|
|
25554
|
+
selectedYardNumber: null,
|
|
25555
|
+
selectedYardNumberAndName: null,
|
|
25556
|
+
yardOptions: [],
|
|
25557
|
+
selectedLanguage: null
|
|
25558
|
+
});
|
|
25559
|
+
if (nextState.selectedCountry) {
|
|
25560
|
+
activeCountryObj = getActiveCountryObjByCountry(this.state.userRoles, nextState.selectedCountry);
|
|
25561
|
+
this.setState({
|
|
25562
|
+
roles: (activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []
|
|
25563
|
+
});
|
|
25564
|
+
} else {
|
|
25565
|
+
this.setState({
|
|
25566
|
+
roles: []
|
|
25567
|
+
});
|
|
25568
|
+
}
|
|
25569
|
+
_context3.next = 11;
|
|
25570
|
+
break;
|
|
25571
|
+
case 5:
|
|
25572
|
+
if (!(nextState.selectedRole !== this.state.selectedRole)) {
|
|
25573
|
+
_context3.next = 11;
|
|
25574
|
+
break;
|
|
25575
|
+
}
|
|
25576
|
+
this.setState({
|
|
25577
|
+
selectedYardNumber: null,
|
|
25578
|
+
selectedYardNumberAndName: null
|
|
25579
|
+
});
|
|
25580
|
+
if (!nextState.selectedRole) {
|
|
25581
|
+
_context3.next = 11;
|
|
25582
|
+
break;
|
|
25583
|
+
}
|
|
25584
|
+
_activeCountryObj = getActiveCountryObjByCountry(this.state.userRoles, nextState.selectedCountry);
|
|
25585
|
+
_context3.next = 11;
|
|
25586
|
+
return this.fetchFacilititesForRole(nextState.selectedRole, _activeCountryObj);
|
|
25587
|
+
case 11:
|
|
25588
|
+
case "end":
|
|
25589
|
+
return _context3.stop();
|
|
25590
|
+
}
|
|
25591
|
+
}, _callee3, this);
|
|
25592
|
+
}));
|
|
25593
|
+
function componentWillUpdate(_x3, _x4) {
|
|
25594
|
+
return _componentWillUpdate.apply(this, arguments);
|
|
25595
|
+
}
|
|
25596
|
+
return componentWillUpdate;
|
|
25597
|
+
}()
|
|
25306
25598
|
}, {
|
|
25307
25599
|
key: "render",
|
|
25308
25600
|
value: function render() {
|
|
@@ -25310,7 +25602,50 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25310
25602
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--settingsForm"
|
|
25311
25603
|
}, this.props.width > 760 && /*#__PURE__*/React__default["default"].createElement(ProfileDetails, {
|
|
25312
25604
|
logout: this.props.onLogoutItemClicked
|
|
25313
|
-
})
|
|
25605
|
+
}), /*#__PURE__*/React__default["default"].createElement("form", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
25606
|
+
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--settingsHeader"
|
|
25607
|
+
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
25608
|
+
name: "gear",
|
|
25609
|
+
variant: "solid"
|
|
25610
|
+
}), /*#__PURE__*/React__default["default"].createElement("p", null, "Settings")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
25611
|
+
className: "col-1-1 utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--inputRow",
|
|
25612
|
+
"data-e2e": "LocationAndLanguageRow"
|
|
25613
|
+
}, /*#__PURE__*/React__default["default"].createElement(CountrySelector, {
|
|
25614
|
+
countries: this.state.countries || [],
|
|
25615
|
+
value: this.state.selectedCountry,
|
|
25616
|
+
handleChange: this.handleInputChange.selectedCountry
|
|
25617
|
+
}), /*#__PURE__*/React__default["default"].createElement(RoleSelector, {
|
|
25618
|
+
roles: this.state.roles,
|
|
25619
|
+
value: this.state.selectedRole,
|
|
25620
|
+
handleChange: this.handleInputChange.selectedRole
|
|
25621
|
+
}), /*#__PURE__*/React__default["default"].createElement(YardNumberMenu, {
|
|
25622
|
+
handleChange: this.handleInputChange.selectedYardNumberAndName,
|
|
25623
|
+
value: this.state.selectedYardNumberAndName,
|
|
25624
|
+
yardOptions: this.state.yardOptions
|
|
25625
|
+
}), /*#__PURE__*/React__default["default"].createElement(LanguageMenu, {
|
|
25626
|
+
value: this.state.selectedLanguage,
|
|
25627
|
+
handleChange: this.handleInputChange.selectedLanguage,
|
|
25628
|
+
selectedCountry: this.state.selectedCountry,
|
|
25629
|
+
stack: "c"
|
|
25630
|
+
}))), /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
25631
|
+
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--settings-hr"
|
|
25632
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
25633
|
+
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--buttonBox",
|
|
25634
|
+
"data-e2e": "saveButton"
|
|
25635
|
+
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.Button, {
|
|
25636
|
+
primary: true,
|
|
25637
|
+
type: "submit",
|
|
25638
|
+
onClick: this.saveSettings
|
|
25639
|
+
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
25640
|
+
name: "floppy-disk",
|
|
25641
|
+
variant: "regular"
|
|
25642
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
25643
|
+
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--saveTxt"
|
|
25644
|
+
}, "Save"))), this.state.showLoading && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
25645
|
+
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--spinner"
|
|
25646
|
+
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.Spinner, {
|
|
25647
|
+
size: "60px"
|
|
25648
|
+
})));
|
|
25314
25649
|
}
|
|
25315
25650
|
}]);
|
|
25316
25651
|
return SettingsView;
|