@bigbinary/neeto-commons-frontend 2.0.9 → 2.0.11

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/utils.cjs.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var axios = require('axios');
6
6
  var ramda = require('ramda');
7
+ var neetoui = require('@bigbinary/neetoui');
7
8
  var i18next = require('i18next');
8
9
  var require$$0 = require('util');
9
10
  var dayjs = require('dayjs');
@@ -903,6 +904,7 @@ var $concat$1 = bind.call(Function.call, Array.prototype.concat);
903
904
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
904
905
  var $replace$1 = bind.call(Function.call, String.prototype.replace);
905
906
  var $strSlice = bind.call(Function.call, String.prototype.slice);
907
+ var $exec = bind.call(Function.call, RegExp.prototype.exec);
906
908
 
907
909
  /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
908
910
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
@@ -958,6 +960,9 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
958
960
  throw new $TypeError$1('"allowMissing" argument must be a boolean');
959
961
  }
960
962
 
963
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
964
+ throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
965
+ }
961
966
  var parts = stringToPath(name);
962
967
  var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
963
968
 
@@ -1164,8 +1169,9 @@ function addNumericSeparator(num, str) {
1164
1169
  return $replace.call(str, sepRegex, '$&_');
1165
1170
  }
1166
1171
 
1167
- var inspectCustom = util_inspect.custom;
1168
- var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
1172
+ var utilInspect = util_inspect;
1173
+ var inspectCustom = utilInspect.custom;
1174
+ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
1169
1175
 
1170
1176
  var objectInspect = function inspect_(obj, options, depth, seen) {
1171
1177
  var opts = options || {};
@@ -1255,7 +1261,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
1255
1261
  return inspect_(value, opts, depth + 1, seen);
1256
1262
  }
1257
1263
 
1258
- if (typeof obj === 'function') {
1264
+ if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
1259
1265
  var name = nameOf(obj);
1260
1266
  var keys = arrObjKeys(obj, inspect);
1261
1267
  return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
@@ -1285,15 +1291,15 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
1285
1291
  }
1286
1292
  if (isError(obj)) {
1287
1293
  var parts = arrObjKeys(obj, inspect);
1288
- if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
1294
+ if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
1289
1295
  return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1290
1296
  }
1291
1297
  if (parts.length === 0) { return '[' + String(obj) + ']'; }
1292
1298
  return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1293
1299
  }
1294
1300
  if (typeof obj === 'object' && customInspect) {
1295
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
1296
- return obj[inspectSymbol]();
1301
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
1302
+ return utilInspect(obj, { depth: maxDepth - depth });
1297
1303
  } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1298
1304
  return obj.inspect();
1299
1305
  }
@@ -2633,8 +2639,6 @@ var copyToClipboard = /*#__PURE__*/function () {
2633
2639
  showToastr,
2634
2640
  _ref2$message,
2635
2641
  message,
2636
- _require,
2637
- Toastr,
2638
2642
  textArea,
2639
2643
  _args = arguments;
2640
2644
 
@@ -2643,27 +2647,21 @@ var copyToClipboard = /*#__PURE__*/function () {
2643
2647
  switch (_context.prev = _context.next) {
2644
2648
  case 0:
2645
2649
  _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref2$showToastr = _ref2.showToastr, showToastr = _ref2$showToastr === void 0 ? true : _ref2$showToastr, _ref2$message = _ref2.message, message = _ref2$message === void 0 ? i18next__default["default"].t("neetoCommons.toastr.success.copiedToClipboard") : _ref2$message;
2646
-
2647
- /*
2648
- This is a workaround to prevent the jest tests from failing. Once the issue in neetoUI
2649
- https://github.com/bigbinary/neeto-ui/issues/1175 is resolved, this import can be moved to the top of the file.
2650
- */
2651
- _require = require("@bigbinary/neetoui"), Toastr = _require.Toastr;
2652
- _context.prev = 2;
2650
+ _context.prev = 1;
2653
2651
 
2654
2652
  if (!(navigator.clipboard && window.isSecureContext)) {
2655
- _context.next = 8;
2653
+ _context.next = 7;
2656
2654
  break;
2657
2655
  }
2658
2656
 
2659
- _context.next = 6;
2657
+ _context.next = 5;
2660
2658
  return navigator.clipboard.writeText(text);
2661
2659
 
2662
- case 6:
2663
- _context.next = 18;
2660
+ case 5:
2661
+ _context.next = 17;
2664
2662
  break;
2665
2663
 
2666
- case 8:
2664
+ case 7:
2667
2665
  textArea = document.createElement("textarea");
2668
2666
  textArea.value = text;
2669
2667
  textArea.style.top = "0";
@@ -2675,22 +2673,22 @@ var copyToClipboard = /*#__PURE__*/function () {
2675
2673
  document.execCommand("copy");
2676
2674
  document.body.removeChild(textArea);
2677
2675
 
2678
- case 18:
2679
- showToastr && Toastr.success(message);
2680
- _context.next = 24;
2676
+ case 17:
2677
+ showToastr && neetoui.Toastr.success(message);
2678
+ _context.next = 23;
2681
2679
  break;
2682
2680
 
2683
- case 21:
2684
- _context.prev = 21;
2685
- _context.t0 = _context["catch"](2);
2686
- Toastr.error(_context.t0);
2681
+ case 20:
2682
+ _context.prev = 20;
2683
+ _context.t0 = _context["catch"](1);
2684
+ neetoui.Toastr.error(_context.t0);
2687
2685
 
2688
- case 24:
2686
+ case 23:
2689
2687
  case "end":
2690
2688
  return _context.stop();
2691
2689
  }
2692
2690
  }
2693
- }, _callee, null, [[2, 21]]);
2691
+ }, _callee, null, [[1, 20]]);
2694
2692
  }));
2695
2693
 
2696
2694
  return function copyToClipboard(_x) {
package/utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import { values, curry, toPairs, pipe, omit, isEmpty } from 'ramda';
3
+ import { Toastr } from '@bigbinary/neetoui';
3
4
  import i18next from 'i18next';
4
5
  import require$$0 from 'util';
5
6
  import dayjs from 'dayjs';
@@ -890,6 +891,7 @@ var $concat$1 = bind.call(Function.call, Array.prototype.concat);
890
891
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
891
892
  var $replace$1 = bind.call(Function.call, String.prototype.replace);
892
893
  var $strSlice = bind.call(Function.call, String.prototype.slice);
894
+ var $exec = bind.call(Function.call, RegExp.prototype.exec);
893
895
 
894
896
  /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
895
897
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
@@ -945,6 +947,9 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
945
947
  throw new $TypeError$1('"allowMissing" argument must be a boolean');
946
948
  }
947
949
 
950
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
951
+ throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
952
+ }
948
953
  var parts = stringToPath(name);
949
954
  var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
950
955
 
@@ -1151,8 +1156,9 @@ function addNumericSeparator(num, str) {
1151
1156
  return $replace.call(str, sepRegex, '$&_');
1152
1157
  }
1153
1158
 
1154
- var inspectCustom = util_inspect.custom;
1155
- var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
1159
+ var utilInspect = util_inspect;
1160
+ var inspectCustom = utilInspect.custom;
1161
+ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
1156
1162
 
1157
1163
  var objectInspect = function inspect_(obj, options, depth, seen) {
1158
1164
  var opts = options || {};
@@ -1242,7 +1248,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
1242
1248
  return inspect_(value, opts, depth + 1, seen);
1243
1249
  }
1244
1250
 
1245
- if (typeof obj === 'function') {
1251
+ if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
1246
1252
  var name = nameOf(obj);
1247
1253
  var keys = arrObjKeys(obj, inspect);
1248
1254
  return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
@@ -1272,15 +1278,15 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
1272
1278
  }
1273
1279
  if (isError(obj)) {
1274
1280
  var parts = arrObjKeys(obj, inspect);
1275
- if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
1281
+ if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
1276
1282
  return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1277
1283
  }
1278
1284
  if (parts.length === 0) { return '[' + String(obj) + ']'; }
1279
1285
  return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1280
1286
  }
1281
1287
  if (typeof obj === 'object' && customInspect) {
1282
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
1283
- return obj[inspectSymbol]();
1288
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
1289
+ return utilInspect(obj, { depth: maxDepth - depth });
1284
1290
  } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1285
1291
  return obj.inspect();
1286
1292
  }
@@ -2620,8 +2626,6 @@ var copyToClipboard = /*#__PURE__*/function () {
2620
2626
  showToastr,
2621
2627
  _ref2$message,
2622
2628
  message,
2623
- _require,
2624
- Toastr,
2625
2629
  textArea,
2626
2630
  _args = arguments;
2627
2631
 
@@ -2630,27 +2634,21 @@ var copyToClipboard = /*#__PURE__*/function () {
2630
2634
  switch (_context.prev = _context.next) {
2631
2635
  case 0:
2632
2636
  _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref2$showToastr = _ref2.showToastr, showToastr = _ref2$showToastr === void 0 ? true : _ref2$showToastr, _ref2$message = _ref2.message, message = _ref2$message === void 0 ? i18next.t("neetoCommons.toastr.success.copiedToClipboard") : _ref2$message;
2633
-
2634
- /*
2635
- This is a workaround to prevent the jest tests from failing. Once the issue in neetoUI
2636
- https://github.com/bigbinary/neeto-ui/issues/1175 is resolved, this import can be moved to the top of the file.
2637
- */
2638
- _require = require("@bigbinary/neetoui"), Toastr = _require.Toastr;
2639
- _context.prev = 2;
2637
+ _context.prev = 1;
2640
2638
 
2641
2639
  if (!(navigator.clipboard && window.isSecureContext)) {
2642
- _context.next = 8;
2640
+ _context.next = 7;
2643
2641
  break;
2644
2642
  }
2645
2643
 
2646
- _context.next = 6;
2644
+ _context.next = 5;
2647
2645
  return navigator.clipboard.writeText(text);
2648
2646
 
2649
- case 6:
2650
- _context.next = 18;
2647
+ case 5:
2648
+ _context.next = 17;
2651
2649
  break;
2652
2650
 
2653
- case 8:
2651
+ case 7:
2654
2652
  textArea = document.createElement("textarea");
2655
2653
  textArea.value = text;
2656
2654
  textArea.style.top = "0";
@@ -2662,22 +2660,22 @@ var copyToClipboard = /*#__PURE__*/function () {
2662
2660
  document.execCommand("copy");
2663
2661
  document.body.removeChild(textArea);
2664
2662
 
2665
- case 18:
2663
+ case 17:
2666
2664
  showToastr && Toastr.success(message);
2667
- _context.next = 24;
2665
+ _context.next = 23;
2668
2666
  break;
2669
2667
 
2670
- case 21:
2671
- _context.prev = 21;
2672
- _context.t0 = _context["catch"](2);
2668
+ case 20:
2669
+ _context.prev = 20;
2670
+ _context.t0 = _context["catch"](1);
2673
2671
  Toastr.error(_context.t0);
2674
2672
 
2675
- case 24:
2673
+ case 23:
2676
2674
  case "end":
2677
2675
  return _context.stop();
2678
2676
  }
2679
2677
  }
2680
- }, _callee, null, [[2, 21]]);
2678
+ }, _callee, null, [[1, 20]]);
2681
2679
  }));
2682
2680
 
2683
2681
  return function copyToClipboard(_x) {