@bigbinary/neeto-team-members-frontend 2.4.3 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
- import React, { createContext, useContext, createElement, isValidElement, cloneElement, useState, useRef, useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useReducer, useCallback } from 'react';
1
+ import React, { createContext, useContext, useState, useRef, useEffect, useMemo, useCallback } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
- import { useFormikContext, Formik, Form } from 'formik';
4
- import { Typography, Button, Table as Table$1, Modal, Toastr, Tooltip, Checkbox, Pane, Dropdown, Alert, Input as Input$1, PageLoader, Avatar, Tag } from '@bigbinary/neetoui';
5
- import { Download, File, LeftArrow, MenuHorizontal, Up, Down, Search } from '@bigbinary/neeto-icons';
6
- import classnames from 'classnames';
7
- import { EmailInput, Input, Textarea, Radio } from '@bigbinary/neetoui/formik';
8
3
  import axios from 'axios';
9
- import { prop, modifyPath, prepend, assocPath, findIndex, propEq, dissocPath, groupBy, keys, map, identical, modify, includes, fromPairs, toPairs, filter, isEmpty, clamp, toLower, mergeLeft, isNil, pluck, head, reverse, assoc } from 'ramda';
4
+ import { Toastr, Tooltip, Button, Typography, Checkbox, Pane, Dropdown, Alert, Input as Input$1, PageLoader, Label, Avatar, Tag, Table as Table$1 } from '@bigbinary/neetoui';
5
+ import { modifyPath, prepend, assocPath, findIndex, propEq, dissocPath, groupBy, is, prop, keys, map, identical, modify, includes, fromPairs, toPairs, filter, isEmpty, isNil, curry, complement, __, trim, toLower, identity, without, append, clamp, mergeLeft, pluck, head, reverse, assoc } from 'ramda';
10
6
  import { Header as Header$2, Container, MenuBar, SubHeader as SubHeader$1 } from '@bigbinary/neetoui/layouts';
7
+ import { useFormikContext, Formik, Form } from 'formik';
8
+ import { Input, Textarea, EmailInput, Radio } from '@bigbinary/neetoui/formik';
11
9
  import * as yup from 'yup';
12
10
  import { object, string } from 'yup';
11
+ import classnames from 'classnames';
12
+ import { MenuHorizontal, Up, Down, Search } from '@bigbinary/neeto-icons';
13
13
 
14
14
  function _typeof(obj) {
15
15
  "@babel/helpers - typeof";
@@ -93,7 +93,7 @@ function _getPrototypeOf(o) {
93
93
  return _getPrototypeOf(o);
94
94
  }
95
95
 
96
- function _defineProperty$2(obj, key, value) {
96
+ function _defineProperty(obj, key, value) {
97
97
  if (key in obj) {
98
98
  Object.defineProperty(obj, key, {
99
99
  value: value,
@@ -107,15 +107,15 @@ function _defineProperty$2(obj, key, value) {
107
107
  return obj;
108
108
  }
109
109
 
110
- function _arrayWithHoles$2(arr) {
110
+ function _arrayWithHoles(arr) {
111
111
  if (Array.isArray(arr)) return arr;
112
112
  }
113
113
 
114
- function _iterableToArray$2(iter) {
114
+ function _iterableToArray(iter) {
115
115
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
116
116
  }
117
117
 
118
- function _arrayLikeToArray$2(arr, len) {
118
+ function _arrayLikeToArray(arr, len) {
119
119
  if (len == null || len > arr.length) len = arr.length;
120
120
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
121
121
  arr2[i] = arr[i];
@@ -123,26 +123,26 @@ function _arrayLikeToArray$2(arr, len) {
123
123
  return arr2;
124
124
  }
125
125
 
126
- function _unsupportedIterableToArray$2(o, minLen) {
126
+ function _unsupportedIterableToArray(o, minLen) {
127
127
  if (!o) return;
128
- if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
128
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
129
129
  var n = Object.prototype.toString.call(o).slice(8, -1);
130
130
  if (n === "Object" && o.constructor) n = o.constructor.name;
131
131
  if (n === "Map" || n === "Set") return Array.from(o);
132
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
132
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
133
133
  }
134
134
 
135
- function _nonIterableRest$2() {
135
+ function _nonIterableRest() {
136
136
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
137
137
  }
138
138
 
139
139
  function _toArray(arr) {
140
- return _arrayWithHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest$2();
140
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
141
141
  }
142
142
 
143
- function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
143
+ function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
144
144
 
145
- function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$d(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
145
+ function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
146
146
 
147
147
  var consoleLogger = {
148
148
  type: 'logger',
@@ -229,7 +229,7 @@ var Logger = function () {
229
229
  }, {
230
230
  key: "create",
231
231
  value: function create(moduleName) {
232
- return new Logger(this.logger, _objectSpread$d(_objectSpread$d({}, {
232
+ return new Logger(this.logger, _objectSpread$9(_objectSpread$9({}, {
233
233
  prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
234
234
  }), this.options));
235
235
  }
@@ -455,7 +455,7 @@ function looksLikeObjectPath(key, nsSeparator, keySeparator) {
455
455
 
456
456
  function ownKeys$1$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
457
457
 
458
- function _objectSpread$1$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
458
+ function _objectSpread$1$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
459
459
 
460
460
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
461
461
 
@@ -700,7 +700,7 @@ var postProcessor = {
700
700
 
701
701
  function ownKeys$2$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
702
702
 
703
- function _objectSpread$2$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
703
+ function _objectSpread$2$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
704
704
 
705
705
  function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
706
706
 
@@ -1623,7 +1623,7 @@ var PluralResolver = function () {
1623
1623
 
1624
1624
  function ownKeys$3$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1625
1625
 
1626
- function _objectSpread$3$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1626
+ function _objectSpread$3$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1627
1627
 
1628
1628
  var Interpolator = function () {
1629
1629
  function Interpolator() {
@@ -1850,7 +1850,7 @@ var Interpolator = function () {
1850
1850
 
1851
1851
  function ownKeys$4$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1852
1852
 
1853
- function _objectSpread$4$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1853
+ function _objectSpread$4$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1854
1854
 
1855
1855
  function parseFormatStr(formatStr) {
1856
1856
  var formatName = formatStr.toLowerCase().trim();
@@ -2008,7 +2008,7 @@ var Formatter = function () {
2008
2008
 
2009
2009
  function ownKeys$5$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2010
2010
 
2011
- function _objectSpread$5$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2011
+ function _objectSpread$5$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2012
2012
 
2013
2013
  function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2014
2014
 
@@ -2352,13 +2352,13 @@ function transformOptions(options) {
2352
2352
 
2353
2353
  function ownKeys$6$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2354
2354
 
2355
- function _objectSpread$6$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2355
+ function _objectSpread$6$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2356
2356
 
2357
2357
  function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2358
2358
 
2359
2359
  function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2360
2360
 
2361
- function noop$3() {}
2361
+ function noop$2() {}
2362
2362
 
2363
2363
  function bindMemberFunctions(inst) {
2364
2364
  var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
@@ -2523,7 +2523,7 @@ var I18n = function (_EventEmitter) {
2523
2523
  }
2524
2524
 
2525
2525
  this.format = this.options.interpolation.format;
2526
- if (!callback) callback = noop$3;
2526
+ if (!callback) callback = noop$2;
2527
2527
 
2528
2528
  if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2529
2529
  var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
@@ -2584,7 +2584,7 @@ var I18n = function (_EventEmitter) {
2584
2584
  value: function loadResources(language) {
2585
2585
  var _this3 = this;
2586
2586
 
2587
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$3;
2587
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$2;
2588
2588
  var usedCallback = callback;
2589
2589
  var usedLng = typeof language === 'string' ? language : this.language;
2590
2590
  if (typeof language === 'function') usedCallback = language;
@@ -2632,7 +2632,7 @@ var I18n = function (_EventEmitter) {
2632
2632
  var deferred = defer();
2633
2633
  if (!lngs) lngs = this.languages;
2634
2634
  if (!ns) ns = this.options.ns;
2635
- if (!callback) callback = noop$3;
2635
+ if (!callback) callback = noop$2;
2636
2636
  this.services.backendConnector.reload(lngs, ns, function (err) {
2637
2637
  deferred.resolve();
2638
2638
  callback(err);
@@ -2911,7 +2911,7 @@ var I18n = function (_EventEmitter) {
2911
2911
  var _this8 = this;
2912
2912
 
2913
2913
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2914
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$3;
2914
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$2;
2915
2915
 
2916
2916
  var mergedOptions = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, this.options), options), {
2917
2917
  isClone: true
@@ -2962,7 +2962,7 @@ var I18n = function (_EventEmitter) {
2962
2962
  return I18n;
2963
2963
  }(EventEmitter);
2964
2964
 
2965
- _defineProperty$2(I18n, "createInstance", function () {
2965
+ _defineProperty(I18n, "createInstance", function () {
2966
2966
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2967
2967
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2968
2968
  return new I18n(options, callback);
@@ -3172,7 +3172,7 @@ var localStorageAvailable = function localStorageAvailable() {
3172
3172
  return hasLocalStorageSupport;
3173
3173
  };
3174
3174
 
3175
- var localStorage = {
3175
+ var localStorage$1 = {
3176
3176
  name: 'localStorage',
3177
3177
  lookup: function lookup(options) {
3178
3178
  var found;
@@ -3346,7 +3346,7 @@ var Browser = /*#__PURE__*/function () {
3346
3346
  this.i18nOptions = i18nOptions;
3347
3347
  this.addDetector(cookie$1);
3348
3348
  this.addDetector(querystring);
3349
- this.addDetector(localStorage);
3349
+ this.addDetector(localStorage$1);
3350
3350
  this.addDetector(sessionStorage);
3351
3351
  this.addDetector(navigator$1);
3352
3352
  this.addDetector(htmlTag);
@@ -3396,7 +3396,7 @@ var Browser = /*#__PURE__*/function () {
3396
3396
 
3397
3397
  Browser.type = 'languageDetector';
3398
3398
 
3399
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3399
+ function _objectWithoutPropertiesLoose(source, excluded) {
3400
3400
  if (source == null) return {};
3401
3401
  var target = {};
3402
3402
  var sourceKeys = Object.keys(source);
@@ -3409,9 +3409,9 @@ function _objectWithoutPropertiesLoose$1(source, excluded) {
3409
3409
  return target;
3410
3410
  }
3411
3411
 
3412
- function _objectWithoutProperties$1(source, excluded) {
3412
+ function _objectWithoutProperties(source, excluded) {
3413
3413
  if (source == null) return {};
3414
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3414
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3415
3415
  var key, i;
3416
3416
  if (Object.getOwnPropertySymbols) {
3417
3417
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3427,30 +3427,6 @@ function _objectWithoutProperties$1(source, excluded) {
3427
3427
 
3428
3428
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3429
3429
 
3430
- /**
3431
- * This file automatically generated from `pre-publish.js`.
3432
- * Do not manually edit.
3433
- */
3434
-
3435
- var voidElements = {
3436
- "area": true,
3437
- "base": true,
3438
- "br": true,
3439
- "col": true,
3440
- "embed": true,
3441
- "hr": true,
3442
- "img": true,
3443
- "input": true,
3444
- "link": true,
3445
- "meta": true,
3446
- "param": true,
3447
- "source": true,
3448
- "track": true,
3449
- "wbr": true
3450
- };
3451
-
3452
- var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=/^\s*$/,s=Object.create(null);function a(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c={parse:function(e,t){t||(t={}),t.components||(t.components=s);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a("",t)},"")}};
3453
-
3454
3430
  var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
3455
3431
  var htmlEntities = {
3456
3432
  '&amp;': '&',
@@ -3483,9 +3459,9 @@ var unescape = function unescape(text) {
3483
3459
  return text.replace(matchHtmlEntity, unescapeHtmlEntity);
3484
3460
  };
3485
3461
 
3486
- function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3462
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3487
3463
 
3488
- function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3464
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3489
3465
  var defaultOptions = {
3490
3466
  bindI18n: 'languageChanged',
3491
3467
  bindI18nStore: '',
@@ -3500,7 +3476,7 @@ var i18nInstance;
3500
3476
  var I18nContext = createContext();
3501
3477
  function setDefaults() {
3502
3478
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3503
- defaultOptions = _objectSpread$c(_objectSpread$c({}, defaultOptions), options);
3479
+ defaultOptions = _objectSpread$8(_objectSpread$8({}, defaultOptions), options);
3504
3480
  }
3505
3481
  function getDefaults() {
3506
3482
  return defaultOptions;
@@ -3624,275 +3600,7 @@ function hasLoadedNamespace(ns, i18n) {
3624
3600
  });
3625
3601
  }
3626
3602
 
3627
- var _excluded$4 = ["format"],
3628
- _excluded2$3 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
3629
-
3630
- function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3631
-
3632
- function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3633
-
3634
- function hasChildren(node, checkLength) {
3635
- if (!node) return false;
3636
- var base = node.props ? node.props.children : node.children;
3637
- if (checkLength) return base.length > 0;
3638
- return !!base;
3639
- }
3640
-
3641
- function getChildren(node) {
3642
- if (!node) return [];
3643
- return node.props ? node.props.children : node.children;
3644
- }
3645
-
3646
- function hasValidReactChildren(children) {
3647
- if (Object.prototype.toString.call(children) !== '[object Array]') return false;
3648
- return children.every(function (child) {
3649
- return isValidElement(child);
3650
- });
3651
- }
3652
-
3653
- function getAsArray(data) {
3654
- return Array.isArray(data) ? data : [data];
3655
- }
3656
-
3657
- function mergeProps(source, target) {
3658
- var newTarget = _objectSpread$b({}, target);
3659
-
3660
- newTarget.props = Object.assign(source.props, target.props);
3661
- return newTarget;
3662
- }
3663
-
3664
- function nodesToString(children, i18nOptions) {
3665
- if (!children) return '';
3666
- var stringNode = '';
3667
- var childrenArray = getAsArray(children);
3668
- var keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
3669
- childrenArray.forEach(function (child, childIndex) {
3670
- if (typeof child === 'string') {
3671
- stringNode += "".concat(child);
3672
- } else if (isValidElement(child)) {
3673
- var childPropsCount = Object.keys(child.props).length;
3674
- var shouldKeepChild = keepArray.indexOf(child.type) > -1;
3675
- var childChildren = child.props.children;
3676
-
3677
- if (!childChildren && shouldKeepChild && childPropsCount === 0) {
3678
- stringNode += "<".concat(child.type, "/>");
3679
- } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
3680
- stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
3681
- } else if (child.props.i18nIsDynamicList) {
3682
- stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
3683
- } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
3684
- stringNode += "<".concat(child.type, ">").concat(childChildren, "</").concat(child.type, ">");
3685
- } else {
3686
- var content = nodesToString(childChildren, i18nOptions);
3687
- stringNode += "<".concat(childIndex, ">").concat(content, "</").concat(childIndex, ">");
3688
- }
3689
- } else if (child === null) {
3690
- warn("Trans: the passed in value is invalid - seems you passed in a null child.");
3691
- } else if (_typeof(child) === 'object') {
3692
- var format = child.format,
3693
- clone = _objectWithoutProperties$1(child, _excluded$4);
3694
-
3695
- var keys = Object.keys(clone);
3696
-
3697
- if (keys.length === 1) {
3698
- var value = format ? "".concat(keys[0], ", ").concat(format) : keys[0];
3699
- stringNode += "{{".concat(value, "}}");
3700
- } else {
3701
- warn("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", child);
3702
- }
3703
- } else {
3704
- warn("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.", child);
3705
- }
3706
- });
3707
- return stringNode;
3708
- }
3709
-
3710
- function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
3711
- if (targetString === '') return [];
3712
- var keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
3713
- var emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
3714
- if (!children && !emptyChildrenButNeedsHandling) return [targetString];
3715
- var data = {};
3716
-
3717
- function getData(childs) {
3718
- var childrenArray = getAsArray(childs);
3719
- childrenArray.forEach(function (child) {
3720
- if (typeof child === 'string') return;
3721
- if (hasChildren(child)) getData(getChildren(child));else if (_typeof(child) === 'object' && !isValidElement(child)) Object.assign(data, child);
3722
- });
3723
- }
3724
-
3725
- getData(children);
3726
- var ast = c.parse("<0>".concat(targetString, "</0>"));
3727
-
3728
- var opts = _objectSpread$b(_objectSpread$b({}, data), combinedTOpts);
3729
-
3730
- function renderInner(child, node, rootReactNode) {
3731
- var childs = getChildren(child);
3732
- var mappedChildren = mapAST(childs, node.children, rootReactNode);
3733
- return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
3734
- }
3735
-
3736
- function pushTranslatedJSX(child, inner, mem, i, isVoid) {
3737
- if (child.dummy) child.children = inner;
3738
- mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3739
- key: i
3740
- }), isVoid ? undefined : inner));
3741
- }
3742
-
3743
- function mapAST(reactNode, astNode, rootReactNode) {
3744
- var reactNodes = getAsArray(reactNode);
3745
- var astNodes = getAsArray(astNode);
3746
- return astNodes.reduce(function (mem, node, i) {
3747
- var translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
3748
-
3749
- if (node.type === 'tag') {
3750
- var tmp = reactNodes[parseInt(node.name, 10)];
3751
- if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
3752
- if (!tmp) tmp = {};
3753
- var child = Object.keys(node.attrs).length !== 0 ? mergeProps({
3754
- props: node.attrs
3755
- }, tmp) : tmp;
3756
- var isElement = isValidElement(child);
3757
- var isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
3758
- var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof(child) === 'object' && child.dummy && !isElement;
3759
- var isKnownComponent = _typeof(children) === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
3760
-
3761
- if (typeof child === 'string') {
3762
- var value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
3763
- mem.push(value);
3764
- } else if (hasChildren(child) || isValidTranslationWithChildren) {
3765
- var inner = renderInner(child, node, rootReactNode);
3766
- pushTranslatedJSX(child, inner, mem, i);
3767
- } else if (isEmptyTransWithHTML) {
3768
- var _inner = mapAST(reactNodes, node.children, rootReactNode);
3769
-
3770
- mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3771
- key: i
3772
- }), _inner));
3773
- } else if (Number.isNaN(parseFloat(node.name))) {
3774
- if (isKnownComponent) {
3775
- var _inner2 = renderInner(child, node, rootReactNode);
3776
-
3777
- pushTranslatedJSX(child, _inner2, mem, i, node.voidElement);
3778
- } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
3779
- if (node.voidElement) {
3780
- mem.push(createElement(node.name, {
3781
- key: "".concat(node.name, "-").concat(i)
3782
- }));
3783
- } else {
3784
- var _inner3 = mapAST(reactNodes, node.children, rootReactNode);
3785
-
3786
- mem.push(createElement(node.name, {
3787
- key: "".concat(node.name, "-").concat(i)
3788
- }, _inner3));
3789
- }
3790
- } else if (node.voidElement) {
3791
- mem.push("<".concat(node.name, " />"));
3792
- } else {
3793
- var _inner4 = mapAST(reactNodes, node.children, rootReactNode);
3794
-
3795
- mem.push("<".concat(node.name, ">").concat(_inner4, "</").concat(node.name, ">"));
3796
- }
3797
- } else if (_typeof(child) === 'object' && !isElement) {
3798
- var content = node.children[0] ? translationContent : null;
3799
- if (content) mem.push(content);
3800
- } else if (node.children.length === 1 && translationContent) {
3801
- mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3802
- key: i
3803
- }), translationContent));
3804
- } else {
3805
- mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3806
- key: i
3807
- })));
3808
- }
3809
- } else if (node.type === 'text') {
3810
- var wrapTextNodes = i18nOptions.transWrapTextNodes;
3811
-
3812
- var _content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
3813
-
3814
- if (wrapTextNodes) {
3815
- mem.push(createElement(wrapTextNodes, {
3816
- key: "".concat(node.name, "-").concat(i)
3817
- }, _content));
3818
- } else {
3819
- mem.push(_content);
3820
- }
3821
- }
3822
-
3823
- return mem;
3824
- }, []);
3825
- }
3826
-
3827
- var result = mapAST([{
3828
- dummy: true,
3829
- children: children || []
3830
- }], ast, getAsArray(children || []));
3831
- return getChildren(result[0]);
3832
- }
3833
-
3834
- function Trans(_ref) {
3835
- var children = _ref.children,
3836
- count = _ref.count,
3837
- parent = _ref.parent,
3838
- i18nKey = _ref.i18nKey,
3839
- context = _ref.context,
3840
- _ref$tOptions = _ref.tOptions,
3841
- tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions,
3842
- values = _ref.values,
3843
- defaults = _ref.defaults,
3844
- components = _ref.components,
3845
- ns = _ref.ns,
3846
- i18nFromProps = _ref.i18n,
3847
- tFromProps = _ref.t,
3848
- shouldUnescape = _ref.shouldUnescape,
3849
- additionalProps = _objectWithoutProperties$1(_ref, _excluded2$3);
3850
-
3851
- var _ref2 = useContext(I18nContext) || {},
3852
- i18nFromContext = _ref2.i18n,
3853
- defaultNSFromContext = _ref2.defaultNS;
3854
-
3855
- var i18n = i18nFromProps || i18nFromContext || getI18n();
3856
-
3857
- if (!i18n) {
3858
- warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
3859
- return children;
3860
- }
3861
-
3862
- var t = tFromProps || i18n.t.bind(i18n) || function (k) {
3863
- return k;
3864
- };
3865
-
3866
- if (context) tOptions.context = context;
3867
-
3868
- var reactI18nextOptions = _objectSpread$b(_objectSpread$b({}, getDefaults()), i18n.options && i18n.options.react);
3869
-
3870
- var namespaces = ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
3871
- namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
3872
- var defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
3873
- var hashTransKey = reactI18nextOptions.hashTransKey;
3874
- var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
3875
- var interpolationOverride = values ? tOptions.interpolation : {
3876
- interpolation: _objectSpread$b(_objectSpread$b({}, tOptions.interpolation), {}, {
3877
- prefix: '#$?',
3878
- suffix: '?$#'
3879
- })
3880
- };
3881
-
3882
- var combinedTOpts = _objectSpread$b(_objectSpread$b(_objectSpread$b(_objectSpread$b({}, tOptions), {}, {
3883
- count: count
3884
- }, values), interpolationOverride), {}, {
3885
- defaultValue: defaultValue,
3886
- ns: namespaces
3887
- });
3888
-
3889
- var translation = key ? t(key, combinedTOpts) : defaultValue;
3890
- var content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
3891
- var useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
3892
- return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
3893
- }
3894
-
3895
- function _iterableToArrayLimit$2(arr, i) {
3603
+ function _iterableToArrayLimit(arr, i) {
3896
3604
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
3897
3605
  if (_i == null) return;
3898
3606
  var _arr = [];
@@ -3917,13 +3625,13 @@ function _iterableToArrayLimit$2(arr, i) {
3917
3625
  return _arr;
3918
3626
  }
3919
3627
 
3920
- function _slicedToArray$2(arr, i) {
3921
- return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2();
3628
+ function _slicedToArray(arr, i) {
3629
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
3922
3630
  }
3923
3631
 
3924
- function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3632
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3925
3633
 
3926
- function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3634
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3927
3635
 
3928
3636
  var usePrevious = function usePrevious(value, ignore) {
3929
3637
  var ref = useRef();
@@ -3960,7 +3668,7 @@ function useTranslation(ns) {
3960
3668
 
3961
3669
  if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
3962
3670
 
3963
- var i18nOptions = _objectSpread$a(_objectSpread$a(_objectSpread$a({}, getDefaults()), i18n.options.react), props);
3671
+ var i18nOptions = _objectSpread$7(_objectSpread$7(_objectSpread$7({}, getDefaults()), i18n.options.react), props);
3964
3672
 
3965
3673
  var useSuspense = i18nOptions.useSuspense,
3966
3674
  keyPrefix = i18nOptions.keyPrefix;
@@ -3976,7 +3684,7 @@ function useTranslation(ns) {
3976
3684
  }
3977
3685
 
3978
3686
  var _useState = useState(getT),
3979
- _useState2 = _slicedToArray$2(_useState, 2),
3687
+ _useState2 = _slicedToArray(_useState, 2),
3980
3688
  t = _useState2[0],
3981
3689
  setT = _useState2[1];
3982
3690
 
@@ -4042,12 +3750,12 @@ var alerts$1 = {
4042
3750
  };
4043
3751
  var buttons$1 = {
4044
3752
  cancel: "Cancel",
4045
- copyLink: "Copy link",
4046
- createLink: "Create link",
4047
- inviteFrom: "Invite from",
4048
3753
  proceed: "Proceed",
4049
- saveChanges: "Save changes",
4050
- sendInvites: "Send invites"
3754
+ saveChanges: "Save changes"
3755
+ };
3756
+ var columns$1 = {
3757
+ search: "Search columns",
3758
+ noColumnsFound: "No columns found."
4051
3759
  };
4052
3760
  var common$1 = {
4053
3761
  activate: "Activate",
@@ -4057,6 +3765,8 @@ var common$1 = {
4057
3765
  add_: "Add {{what}}",
4058
3766
  all: "All",
4059
3767
  all_: "All {{what}}",
3768
+ column_one: "Column",
3769
+ column_other: "Columns",
4060
3770
  deactivate: "Deactivate",
4061
3771
  deactivate_: "Deactivate {{what}}",
4062
3772
  deactivated: "Deactivated",
@@ -4064,12 +3774,10 @@ var common$1 = {
4064
3774
  "delete": "Delete",
4065
3775
  delete_: "Delete {{what}}",
4066
3776
  description: "Description",
4067
- download_: "Download {{what}}",
4068
3777
  edit: "Edit",
4069
3778
  edit_: "Edit {{what}}",
4070
3779
  email_one: "Email",
4071
3780
  email_other: "Emails",
4072
- invite_: "Invite {{what}}",
4073
3781
  manage_: "Manage {{what}}",
4074
3782
  name: "Name",
4075
3783
  notFound_: "Sorry, no {{what}} were found.",
@@ -4078,26 +3786,11 @@ var common$1 = {
4078
3786
  role_one: "Role",
4079
3787
  role_other: "Roles",
4080
3788
  search_: "Search {{what}}",
4081
- settings: "Settings",
4082
- update_: "Update {{what}}",
4083
- upload_: "Upload {{what}}"
3789
+ update_: "Update {{what}}"
4084
3790
  };
4085
3791
  var helpers$1 = {
4086
- bulkInvite: "Bulk invite using CSV",
4087
3792
  configPermissions: "Configure permissions for the modules.",
4088
- copiedToClipboard: "Copied to clipboard",
4089
- dropFilesHere: "Drop files here",
4090
- enterMultipleEmails: "Please press space, tab or enter key after entering an email address.",
4091
- expiresIn: "Expires in ",
4092
- files: "Files",
4093
- getInviteLink: "Get invite link",
4094
- inviteLinkInstruction: "Anyone signing up with this link will be added to the list of candidates.",
4095
- noOfRows: "No. of rows",
4096
- status: "Status",
4097
- uploaded: "Uploaded",
4098
- uploadInstruction1: "Files must be in CSV format.",
4099
- uploadInstruction2: "The file must contain the following columns: <strong>{{what}}</strong>.",
4100
- uploadInstruction3: "The first row must contain the header."
3793
+ enterMultipleEmails: "Please press space, tab or enter key after entering an email address."
4101
3794
  };
4102
3795
  var metaNames$1 = {
4103
3796
  agent_one: "Agent",
@@ -4132,6 +3825,7 @@ var validations$1 = {
4132
3825
  var en = {
4133
3826
  alerts: alerts$1,
4134
3827
  buttons: buttons$1,
3828
+ columns: columns$1,
4135
3829
  common: common$1,
4136
3830
  helpers: helpers$1,
4137
3831
  metaNames: metaNames$1,
@@ -4147,12 +3841,12 @@ var alerts = {
4147
3841
  };
4148
3842
  var buttons = {
4149
3843
  cancel: "Annuler",
4150
- copyLink: "Copier le lien",
4151
- createLink: "Créer un lien",
4152
- inviteFrom: "Inviter de",
4153
3844
  proceed: "Procéder",
4154
- saveChanges: "Sauvegarder les modifications",
4155
- sendInvites: "Envoie des invitations"
3845
+ saveChanges: "Sauvegarder les modifications"
3846
+ };
3847
+ var columns = {
3848
+ search: "Colonnes de recherche",
3849
+ noColumnsFound: "Aucune colonne trouvée."
4156
3850
  };
4157
3851
  var common = {
4158
3852
  activate: "Activer",
@@ -4162,6 +3856,8 @@ var common = {
4162
3856
  add_: "Ajouter {{what}}",
4163
3857
  all: "Tous",
4164
3858
  all_: "tous les {{what}}",
3859
+ column_one: "Colonne",
3860
+ column_other: "Colonnes",
4165
3861
  deactivate: "Désactiver",
4166
3862
  deactivate_: "Désactiver le {{what}}",
4167
3863
  deactivated: "Désactivé",
@@ -4169,12 +3865,10 @@ var common = {
4169
3865
  "delete": "Effacer",
4170
3866
  delete_: "Supprimer le {{what}}",
4171
3867
  description: "La description",
4172
- download_: "Télécharger {{what}}",
4173
3868
  edit: "Éditer",
4174
3869
  edit_: "Modifier le {{what}}",
4175
3870
  email_one: "E-mail",
4176
3871
  email_other: "E-mails",
4177
- invite_: "Inviter des {{what}}",
4178
3872
  manage_: "Gérer {{what}}",
4179
3873
  name: "Nom",
4180
3874
  notFound_: "Désolé, aucun {{what}} n'a été trouvé.",
@@ -4183,26 +3877,11 @@ var common = {
4183
3877
  role_one: "Rôle",
4184
3878
  role_other: "Rôles",
4185
3879
  search_: "Rechercher des {{what}}",
4186
- settings: "Paramètres",
4187
- update_: "Mettre à jour le {{what}}",
4188
- upload_: "Importer des {{what}}"
3880
+ update_: "Mettre à jour le {{what}}"
4189
3881
  };
4190
3882
  var helpers = {
4191
- bulkInvite: "Invitation groupée à l'aide de CSV",
4192
3883
  configPermissions: "Configurez les autorisations pour les modules.",
4193
- copiedToClipboard: "Copié dans le presse-papier",
4194
- dropFilesHere: "Déposez les fichiers ici",
4195
- enterMultipleEmails: "Veuillez appuyer sur espace, tabulation ou entrée après avoir saisi une adresse e-mail.",
4196
- expiresIn: "Expire dans ",
4197
- files: "Fichiers",
4198
- getInviteLink: "Obtenir le lien d'invitation",
4199
- inviteLinkInstruction: "Toute personne s'inscrivant avec ce lien sera ajoutée à la liste des candidats.",
4200
- noOfRows: "Nombre de rangées",
4201
- status: "Statut",
4202
- uploaded: "Téléchargé",
4203
- uploadInstruction1: "Les fichiers doivent être au format CSV.",
4204
- uploadInstruction2: "Le fichier doit contenir les colonnes suivantes: <strong>{{what}}</strong>.",
4205
- uploadInstruction3: "La première ligne doit contenir l'en-tête."
3884
+ enterMultipleEmails: "Veuillez appuyer sur espace, tabulation ou entrée après avoir saisi une adresse e-mail."
4206
3885
  };
4207
3886
  var metaNames = {
4208
3887
  member_one: "Membre",
@@ -4235,6 +3914,7 @@ var validations = {
4235
3914
  var fr = {
4236
3915
  alerts: alerts,
4237
3916
  buttons: buttons,
3917
+ columns: columns,
4238
3918
  common: common,
4239
3919
  helpers: helpers,
4240
3920
  metaNames: metaNames,
@@ -4291,7 +3971,7 @@ const getScrollBarWidth = () => {
4291
3971
  document.body.removeChild(outerElement);
4292
3972
  return w1 - w2;
4293
3973
  };
4294
- const noop$2 = () => {};
3974
+ const noop$1 = () => {};
4295
3975
  const slugify = string => string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
4296
3976
  .replace(/&/g, "-and-") // Replace & with 'and'
4297
3977
  .replace(/[^\w-]+/g, "") // Remove all non-word characters
@@ -4299,21 +3979,6 @@ const slugify = string => string.toString().toLowerCase().replace(/\s+/g, "-") /
4299
3979
  .replace(/^-+/, "") // Trim - from start of text
4300
3980
  .replace(/-+$/, ""); // Trim - from end of text
4301
3981
 
4302
- function _extends() {
4303
- _extends = Object.assign ? Object.assign.bind() : function (target) {
4304
- for (var i = 1; i < arguments.length; i++) {
4305
- var source = arguments[i];
4306
- for (var key in source) {
4307
- if (Object.prototype.hasOwnProperty.call(source, key)) {
4308
- target[key] = source[key];
4309
- }
4310
- }
4311
- }
4312
- return target;
4313
- };
4314
- return _extends.apply(this, arguments);
4315
- }
4316
-
4317
3982
  const SINGULAR = {
4318
3983
  count: 1
4319
3984
  };
@@ -4367,10 +4032,25 @@ var Subscribable = /*#__PURE__*/function () {
4367
4032
  return Subscribable;
4368
4033
  }();
4369
4034
 
4035
+ function _extends() {
4036
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
4037
+ for (var i = 1; i < arguments.length; i++) {
4038
+ var source = arguments[i];
4039
+ for (var key in source) {
4040
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
4041
+ target[key] = source[key];
4042
+ }
4043
+ }
4044
+ }
4045
+ return target;
4046
+ };
4047
+ return _extends.apply(this, arguments);
4048
+ }
4049
+
4370
4050
  // TYPES
4371
4051
  // UTILS
4372
4052
  var isServer = typeof window === 'undefined';
4373
- function noop$1() {
4053
+ function noop() {
4374
4054
  return undefined;
4375
4055
  }
4376
4056
  function functionalUpdate(updater, input) {
@@ -5233,7 +4913,7 @@ var Query = /*#__PURE__*/function () {
5233
4913
 
5234
4914
  var promise = this.promise;
5235
4915
  (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);
5236
- return promise ? promise.then(noop$1).catch(noop$1) : Promise.resolve();
4916
+ return promise ? promise.then(noop).catch(noop) : Promise.resolve();
5237
4917
  };
5238
4918
 
5239
4919
  _proto.destroy = function destroy() {
@@ -5807,7 +5487,7 @@ var Mutation = /*#__PURE__*/function () {
5807
5487
  _proto.cancel = function cancel() {
5808
5488
  if (this.retryer) {
5809
5489
  this.retryer.cancel();
5810
- return this.retryer.promise.then(noop$1).catch(noop$1);
5490
+ return this.retryer.promise.then(noop).catch(noop);
5811
5491
  }
5812
5492
 
5813
5493
  return Promise.resolve();
@@ -5923,7 +5603,7 @@ var Mutation = /*#__PURE__*/function () {
5923
5603
  _proto.dispatch = function dispatch(action) {
5924
5604
  var _this3 = this;
5925
5605
 
5926
- this.state = reducer$1(this.state, action);
5606
+ this.state = reducer(this.state, action);
5927
5607
  notifyManager.batch(function () {
5928
5608
  _this3.observers.forEach(function (observer) {
5929
5609
  observer.onMutationUpdate(action);
@@ -5947,7 +5627,7 @@ function getDefaultState() {
5947
5627
  };
5948
5628
  }
5949
5629
 
5950
- function reducer$1(state, action) {
5630
+ function reducer(state, action) {
5951
5631
  switch (action.type) {
5952
5632
  case 'failed':
5953
5633
  return _extends({}, state, {
@@ -6096,7 +5776,7 @@ var MutationCache = /*#__PURE__*/function (_Subscribable) {
6096
5776
  return notifyManager.batch(function () {
6097
5777
  return pausedMutations.reduce(function (promise, mutation) {
6098
5778
  return promise.then(function () {
6099
- return mutation.continue().catch(noop$1);
5779
+ return mutation.continue().catch(noop);
6100
5780
  });
6101
5781
  }, Promise.resolve());
6102
5782
  });
@@ -6379,7 +6059,7 @@ var QueryClient = /*#__PURE__*/function () {
6379
6059
  return query.cancel(cancelOptions);
6380
6060
  });
6381
6061
  });
6382
- return Promise.all(promises).then(noop$1).catch(noop$1);
6062
+ return Promise.all(promises).then(noop).catch(noop);
6383
6063
  };
6384
6064
 
6385
6065
  _proto.invalidateQueries = function invalidateQueries(arg1, arg2, arg3) {
@@ -6424,10 +6104,10 @@ var QueryClient = /*#__PURE__*/function () {
6424
6104
  }));
6425
6105
  });
6426
6106
  });
6427
- var promise = Promise.all(promises).then(noop$1);
6107
+ var promise = Promise.all(promises).then(noop);
6428
6108
 
6429
6109
  if (!(options == null ? void 0 : options.throwOnError)) {
6430
- promise = promise.catch(noop$1);
6110
+ promise = promise.catch(noop);
6431
6111
  }
6432
6112
 
6433
6113
  return promise;
@@ -6446,7 +6126,7 @@ var QueryClient = /*#__PURE__*/function () {
6446
6126
  };
6447
6127
 
6448
6128
  _proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3) {
6449
- return this.fetchQuery(arg1, arg2, arg3).then(noop$1).catch(noop$1);
6129
+ return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);
6450
6130
  };
6451
6131
 
6452
6132
  _proto.fetchInfiniteQuery = function fetchInfiniteQuery(arg1, arg2, arg3) {
@@ -6456,7 +6136,7 @@ var QueryClient = /*#__PURE__*/function () {
6456
6136
  };
6457
6137
 
6458
6138
  _proto.prefetchInfiniteQuery = function prefetchInfiniteQuery(arg1, arg2, arg3) {
6459
- return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop$1).catch(noop$1);
6139
+ return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);
6460
6140
  };
6461
6141
 
6462
6142
  _proto.cancelMutations = function cancelMutations() {
@@ -6467,7 +6147,7 @@ var QueryClient = /*#__PURE__*/function () {
6467
6147
  return mutation.cancel();
6468
6148
  });
6469
6149
  });
6470
- return Promise.all(promises).then(noop$1).catch(noop$1);
6150
+ return Promise.all(promises).then(noop).catch(noop);
6471
6151
  };
6472
6152
 
6473
6153
  _proto.resumePausedMutations = function resumePausedMutations() {
@@ -6771,7 +6451,7 @@ var QueryObserver = /*#__PURE__*/function (_Subscribable) {
6771
6451
  var promise = this.currentQuery.fetch(this.options, fetchOptions);
6772
6452
 
6773
6453
  if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {
6774
- promise = promise.catch(noop$1);
6454
+ promise = promise.catch(noop);
6775
6455
  }
6776
6456
 
6777
6457
  return promise;
@@ -7363,7 +7043,7 @@ function useMutation(arg1, arg2, arg3) {
7363
7043
  };
7364
7044
  }, []);
7365
7045
  var mutate = React.useCallback(function (variables, mutateOptions) {
7366
- obsRef.current.mutate(variables, mutateOptions).catch(noop$1);
7046
+ obsRef.current.mutate(variables, mutateOptions).catch(noop);
7367
7047
  }, []);
7368
7048
 
7369
7049
  if (currentResult.error && shouldThrowError(undefined, obsRef.current.options.useErrorBoundary, [currentResult.error])) {
@@ -7510,2298 +7190,115 @@ const withReactQuery = Component => {
7510
7190
  return QueryWrapper;
7511
7191
  };
7512
7192
 
7513
- var propTypes = {exports: {}};
7514
-
7515
- /**
7516
- * Copyright (c) 2013-present, Facebook, Inc.
7517
- *
7518
- * This source code is licensed under the MIT license found in the
7519
- * LICENSE file in the root directory of this source tree.
7520
- */
7193
+ /* eslint-disable @bigbinary/neeto/no-dangling-constants */
7194
+ const BASE_URL = "team_members";
7521
7195
 
7522
- var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
7196
+ const fetch$2 = () => axios.get(`${BASE_URL}/permissions`);
7197
+ const permissionsApi = {
7198
+ fetch: fetch$2
7199
+ };
7523
7200
 
7524
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
7201
+ const DEFAULT_STALE_TIME = 300000; // 5 minutes
7525
7202
 
7526
- /**
7527
- * Copyright (c) 2013-present, Facebook, Inc.
7528
- *
7529
- * This source code is licensed under the MIT license found in the
7530
- * LICENSE file in the root directory of this source tree.
7531
- */
7203
+ const QUERY_KEYS = {
7204
+ TEAMS: "neeto-team-members-teams",
7205
+ ROLES: "neeto-team-members-roles",
7206
+ PERMISSIONS: "neeto-team-members-permissions"
7207
+ };
7532
7208
 
7533
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
7209
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7210
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7211
+ const useFetchPermissions = function () {
7212
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7213
+ return useQuery(QUERY_KEYS.PERMISSIONS, permissionsApi.fetch, _objectSpread$6({
7214
+ staleTime: DEFAULT_STALE_TIME,
7215
+ select: response => response.permissions || response.data.permissions
7216
+ }, options));
7217
+ };
7534
7218
 
7535
- function emptyFunction() {}
7536
- function emptyFunctionWithReset() {}
7537
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
7219
+ const fetch$1 = () => axios.get(`${BASE_URL}/organization_roles`);
7220
+ const create$1 = payload => axios.post(`${BASE_URL}/organization_roles`, payload);
7221
+ const update$1 = (id, payload) => axios.patch(`${BASE_URL}/organization_roles/${id}`, payload);
7222
+ const destroy = (id, payload) => axios.delete(`${BASE_URL}/organization_roles/${id}`, {
7223
+ data: payload
7224
+ });
7225
+ const organizationRolesApi = {
7226
+ fetch: fetch$1,
7227
+ create: create$1,
7228
+ update: update$1,
7229
+ destroy
7230
+ };
7538
7231
 
7539
- var factoryWithThrowingShims = function() {
7540
- function shim(props, propName, componentName, location, propFullName, secret) {
7541
- if (secret === ReactPropTypesSecret) {
7542
- // It is still safe when called from React.
7543
- return;
7232
+ const _excluded$1 = ["onSuccess"],
7233
+ _excluded2$1 = ["onSuccess"],
7234
+ _excluded3 = ["onSuccess"];
7235
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7236
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7237
+ const useFetchRoles = function () {
7238
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7239
+ return useQuery(QUERY_KEYS.ROLES, organizationRolesApi.fetch, _objectSpread$5({
7240
+ staleTime: DEFAULT_STALE_TIME,
7241
+ select: response => response.organizationRoles || response.data.organizationRoles
7242
+ }, options));
7243
+ };
7244
+ const useCreateRole = _ref => {
7245
+ let onSuccess = _ref.onSuccess,
7246
+ options = _objectWithoutProperties(_ref, _excluded$1);
7247
+ return useMutation(organizationRolesApi.create, _objectSpread$5({
7248
+ onSuccess: response => {
7249
+ queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
7250
+ if (!!cachedData.data && !!cachedData.data.organizationRoles) {
7251
+ return modifyPath(["data", "organizationRoles"], prepend(response.data.organizationRole), cachedData);
7252
+ }
7253
+ return modifyPath(["organizationRoles"], prepend(response.organizationRole), cachedData);
7254
+ });
7255
+ Toastr.success(response.ntmNotice || response.data.ntmNotice);
7256
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
7544
7257
  }
7545
- var err = new Error(
7546
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
7547
- 'Use PropTypes.checkPropTypes() to call them. ' +
7548
- 'Read more at http://fb.me/use-check-prop-types'
7549
- );
7550
- err.name = 'Invariant Violation';
7551
- throw err;
7552
- } shim.isRequired = shim;
7553
- function getShim() {
7554
- return shim;
7555
- } // Important!
7556
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
7557
- var ReactPropTypes = {
7558
- array: shim,
7559
- bigint: shim,
7560
- bool: shim,
7561
- func: shim,
7562
- number: shim,
7563
- object: shim,
7564
- string: shim,
7565
- symbol: shim,
7566
-
7567
- any: shim,
7568
- arrayOf: getShim,
7569
- element: shim,
7570
- elementType: shim,
7571
- instanceOf: getShim,
7572
- node: shim,
7573
- objectOf: getShim,
7574
- oneOf: getShim,
7575
- oneOfType: getShim,
7576
- shape: getShim,
7577
- exact: getShim,
7578
-
7579
- checkPropTypes: emptyFunctionWithReset,
7580
- resetWarningCache: emptyFunction
7581
- };
7582
-
7583
- ReactPropTypes.PropTypes = ReactPropTypes;
7584
-
7585
- return ReactPropTypes;
7258
+ }, options));
7586
7259
  };
7587
-
7588
- /**
7589
- * Copyright (c) 2013-present, Facebook, Inc.
7590
- *
7591
- * This source code is licensed under the MIT license found in the
7592
- * LICENSE file in the root directory of this source tree.
7593
- */
7594
-
7595
- {
7596
- // By explicitly using `prop-types` you are opting into new production behavior.
7597
- // http://fb.me/prop-types-in-prod
7598
- propTypes.exports = factoryWithThrowingShims();
7599
- }
7600
-
7601
- /******************************************************************************
7602
- Copyright (c) Microsoft Corporation.
7603
-
7604
- Permission to use, copy, modify, and/or distribute this software for any
7605
- purpose with or without fee is hereby granted.
7606
-
7607
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7608
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7609
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7610
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7611
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7612
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7613
- PERFORMANCE OF THIS SOFTWARE.
7614
- ***************************************************************************** */
7615
-
7616
- function __awaiter(thisArg, _arguments, P, generator) {
7617
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7618
- return new (P || (P = Promise))(function (resolve, reject) {
7619
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7620
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7621
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7622
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7623
- });
7624
- }
7625
-
7626
- function __generator(thisArg, body) {
7627
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7628
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7629
- function verb(n) { return function (v) { return step([n, v]); }; }
7630
- function step(op) {
7631
- if (f) throw new TypeError("Generator is already executing.");
7632
- while (_) try {
7633
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
7634
- if (y = 0, t) op = [op[0] & 2, t.value];
7635
- switch (op[0]) {
7636
- case 0: case 1: t = op; break;
7637
- case 4: _.label++; return { value: op[1], done: false };
7638
- case 5: _.label++; y = op[1]; op = [0]; continue;
7639
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
7640
- default:
7641
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7642
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7643
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7644
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7645
- if (t[2]) _.ops.pop();
7646
- _.trys.pop(); continue;
7647
- }
7648
- op = body.call(thisArg, _);
7649
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7650
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7651
- }
7652
- }
7653
-
7654
- function __read(o, n) {
7655
- var m = typeof Symbol === "function" && o[Symbol.iterator];
7656
- if (!m) return o;
7657
- var i = m.call(o), r, ar = [], e;
7658
- try {
7659
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7660
- }
7661
- catch (error) { e = { error: error }; }
7662
- finally {
7663
- try {
7664
- if (r && !r.done && (m = i["return"])) m.call(i);
7665
- }
7666
- finally { if (e) throw e.error; }
7667
- }
7668
- return ar;
7669
- }
7670
-
7671
- function __spreadArray(to, from, pack) {
7672
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
7673
- if (ar || !(i in from)) {
7674
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
7675
- ar[i] = from[i];
7676
- }
7677
- }
7678
- return to.concat(ar || Array.prototype.slice.call(from));
7679
- }
7680
-
7681
- var COMMON_MIME_TYPES = new Map([
7682
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
7683
- ['aac', 'audio/aac'],
7684
- ['abw', 'application/x-abiword'],
7685
- ['arc', 'application/x-freearc'],
7686
- ['avif', 'image/avif'],
7687
- ['avi', 'video/x-msvideo'],
7688
- ['azw', 'application/vnd.amazon.ebook'],
7689
- ['bin', 'application/octet-stream'],
7690
- ['bmp', 'image/bmp'],
7691
- ['bz', 'application/x-bzip'],
7692
- ['bz2', 'application/x-bzip2'],
7693
- ['cda', 'application/x-cdf'],
7694
- ['csh', 'application/x-csh'],
7695
- ['css', 'text/css'],
7696
- ['csv', 'text/csv'],
7697
- ['doc', 'application/msword'],
7698
- ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
7699
- ['eot', 'application/vnd.ms-fontobject'],
7700
- ['epub', 'application/epub+zip'],
7701
- ['gz', 'application/gzip'],
7702
- ['gif', 'image/gif'],
7703
- ['heic', 'image/heic'],
7704
- ['heif', 'image/heif'],
7705
- ['htm', 'text/html'],
7706
- ['html', 'text/html'],
7707
- ['ico', 'image/vnd.microsoft.icon'],
7708
- ['ics', 'text/calendar'],
7709
- ['jar', 'application/java-archive'],
7710
- ['jpeg', 'image/jpeg'],
7711
- ['jpg', 'image/jpeg'],
7712
- ['js', 'text/javascript'],
7713
- ['json', 'application/json'],
7714
- ['jsonld', 'application/ld+json'],
7715
- ['mid', 'audio/midi'],
7716
- ['midi', 'audio/midi'],
7717
- ['mjs', 'text/javascript'],
7718
- ['mp3', 'audio/mpeg'],
7719
- ['mp4', 'video/mp4'],
7720
- ['mpeg', 'video/mpeg'],
7721
- ['mpkg', 'application/vnd.apple.installer+xml'],
7722
- ['odp', 'application/vnd.oasis.opendocument.presentation'],
7723
- ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
7724
- ['odt', 'application/vnd.oasis.opendocument.text'],
7725
- ['oga', 'audio/ogg'],
7726
- ['ogv', 'video/ogg'],
7727
- ['ogx', 'application/ogg'],
7728
- ['opus', 'audio/opus'],
7729
- ['otf', 'font/otf'],
7730
- ['png', 'image/png'],
7731
- ['pdf', 'application/pdf'],
7732
- ['php', 'application/x-httpd-php'],
7733
- ['ppt', 'application/vnd.ms-powerpoint'],
7734
- ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
7735
- ['rar', 'application/vnd.rar'],
7736
- ['rtf', 'application/rtf'],
7737
- ['sh', 'application/x-sh'],
7738
- ['svg', 'image/svg+xml'],
7739
- ['swf', 'application/x-shockwave-flash'],
7740
- ['tar', 'application/x-tar'],
7741
- ['tif', 'image/tiff'],
7742
- ['tiff', 'image/tiff'],
7743
- ['ts', 'video/mp2t'],
7744
- ['ttf', 'font/ttf'],
7745
- ['txt', 'text/plain'],
7746
- ['vsd', 'application/vnd.visio'],
7747
- ['wav', 'audio/wav'],
7748
- ['weba', 'audio/webm'],
7749
- ['webm', 'video/webm'],
7750
- ['webp', 'image/webp'],
7751
- ['woff', 'font/woff'],
7752
- ['woff2', 'font/woff2'],
7753
- ['xhtml', 'application/xhtml+xml'],
7754
- ['xls', 'application/vnd.ms-excel'],
7755
- ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
7756
- ['xml', 'application/xml'],
7757
- ['xul', 'application/vnd.mozilla.xul+xml'],
7758
- ['zip', 'application/zip'],
7759
- ['7z', 'application/x-7z-compressed'],
7760
- // Others
7761
- ['mkv', 'video/x-matroska'],
7762
- ['mov', 'video/quicktime'],
7763
- ['msg', 'application/vnd.ms-outlook']
7764
- ]);
7765
- function toFileWithPath(file, path) {
7766
- var f = withMimeType(file);
7767
- if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
7768
- var webkitRelativePath = file.webkitRelativePath;
7769
- Object.defineProperty(f, 'path', {
7770
- value: typeof path === 'string'
7771
- ? path
7772
- // If <input webkitdirectory> is set,
7773
- // the File will have a {webkitRelativePath} property
7774
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
7775
- : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
7776
- ? webkitRelativePath
7777
- : file.name,
7778
- writable: false,
7779
- configurable: false,
7780
- enumerable: true
7781
- });
7260
+ const useUpdateRole = _ref2 => {
7261
+ let onSuccess = _ref2.onSuccess,
7262
+ options = _objectWithoutProperties(_ref2, _excluded2$1);
7263
+ return useMutation(_ref3 => {
7264
+ let id = _ref3.id,
7265
+ payload = _ref3.payload;
7266
+ return organizationRolesApi.update(id, payload);
7267
+ }, _objectSpread$5({
7268
+ onSuccess: response => {
7269
+ queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
7270
+ queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
7271
+ if (!!cachedData.data && !!cachedData.data.organizationRoles) {
7272
+ return assocPath(["data", "organizationRoles", findIndex(propEq("id", response.data.organizationRole.id), cachedData.data.organizationRoles)], response.data.organizationRole, cachedData);
7273
+ }
7274
+ return assocPath(["organizationRoles", findIndex(propEq("id", response.organizationRole.id), cachedData.organizationRoles)], response.organizationRole, cachedData);
7275
+ });
7276
+ Toastr.success(response.ntmNotice || response.data.ntmNotice);
7277
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
7782
7278
  }
7783
- return f;
7784
- }
7785
- function withMimeType(file) {
7786
- var name = file.name;
7787
- var hasExtension = name && name.lastIndexOf('.') !== -1;
7788
- if (hasExtension && !file.type) {
7789
- var ext = name.split('.')
7790
- .pop().toLowerCase();
7791
- var type = COMMON_MIME_TYPES.get(ext);
7792
- if (type) {
7793
- Object.defineProperty(file, 'type', {
7794
- value: type,
7795
- writable: false,
7796
- configurable: false,
7797
- enumerable: true
7798
- });
7279
+ }, options));
7280
+ };
7281
+ const useDestroyRole = _ref4 => {
7282
+ let _ref4$onSuccess = _ref4.onSuccess,
7283
+ onSuccess = _ref4$onSuccess === void 0 ? noop$1 : _ref4$onSuccess,
7284
+ options = _objectWithoutProperties(_ref4, _excluded3);
7285
+ return useMutation(_ref5 => {
7286
+ let id = _ref5.id,
7287
+ payload = _ref5.payload;
7288
+ return organizationRolesApi.destroy(id, payload);
7289
+ }, _objectSpread$5({
7290
+ onSuccess: response => {
7291
+ queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
7292
+ if (!!cachedData.data && !!cachedData.data.organizationRoles) {
7293
+ return dissocPath(["data", "organizationRoles", findIndex(propEq("id", response.data.id), cachedData.data.organizationRoles)], cachedData);
7799
7294
  }
7295
+ return dissocPath(["organizationRoles", findIndex(propEq("id", response.id), cachedData.organizationRoles)], cachedData);
7296
+ });
7297
+ Toastr.success(response.ntmNotice || response.data.ntmNotice);
7298
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
7800
7299
  }
7801
- return file;
7802
- }
7803
-
7804
- var FILES_TO_IGNORE = [
7805
- // Thumbnail cache files for macOS and Windows
7806
- '.DS_Store',
7807
- 'Thumbs.db' // Windows
7808
- ];
7809
- /**
7810
- * Convert a DragEvent's DataTrasfer object to a list of File objects
7811
- * NOTE: If some of the items are folders,
7812
- * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
7813
- *
7814
- * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
7815
- * and a list of File objects will be returned.
7816
- *
7817
- * @param evt
7818
- */
7819
- function fromEvent(evt) {
7820
- return __awaiter(this, void 0, void 0, function () {
7821
- return __generator(this, function (_a) {
7822
- if (isObject(evt) && isDataTransfer(evt.dataTransfer)) {
7823
- return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
7824
- }
7825
- else if (isChangeEvt(evt)) {
7826
- return [2 /*return*/, getInputFiles(evt)];
7827
- }
7828
- else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
7829
- return [2 /*return*/, getFsHandleFiles(evt)];
7830
- }
7831
- return [2 /*return*/, []];
7832
- });
7833
- });
7834
- }
7835
- function isDataTransfer(value) {
7836
- return isObject(value);
7837
- }
7838
- function isChangeEvt(value) {
7839
- return isObject(value) && isObject(value.target);
7840
- }
7841
- function isObject(v) {
7842
- return typeof v === 'object' && v !== null;
7843
- }
7844
- function getInputFiles(evt) {
7845
- return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
7846
- }
7847
- // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
7848
- function getFsHandleFiles(handles) {
7849
- return __awaiter(this, void 0, void 0, function () {
7850
- var files;
7851
- return __generator(this, function (_a) {
7852
- switch (_a.label) {
7853
- case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
7854
- case 1:
7855
- files = _a.sent();
7856
- return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
7857
- }
7858
- });
7859
- });
7860
- }
7861
- function getDataTransferFiles(dt, type) {
7862
- return __awaiter(this, void 0, void 0, function () {
7863
- var items, files;
7864
- return __generator(this, function (_a) {
7865
- switch (_a.label) {
7866
- case 0:
7867
- if (!dt.items) return [3 /*break*/, 2];
7868
- items = fromList(dt.items)
7869
- .filter(function (item) { return item.kind === 'file'; });
7870
- // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
7871
- // only 'dragstart' and 'drop' has access to the data (source node)
7872
- if (type !== 'drop') {
7873
- return [2 /*return*/, items];
7874
- }
7875
- return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
7876
- case 1:
7877
- files = _a.sent();
7878
- return [2 /*return*/, noIgnoredFiles(flatten(files))];
7879
- case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
7880
- .map(function (file) { return toFileWithPath(file); }))];
7881
- }
7882
- });
7883
- });
7884
- }
7885
- function noIgnoredFiles(files) {
7886
- return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
7887
- }
7888
- // IE11 does not support Array.from()
7889
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
7890
- // https://developer.mozilla.org/en-US/docs/Web/API/FileList
7891
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
7892
- function fromList(items) {
7893
- if (items === null) {
7894
- return [];
7895
- }
7896
- var files = [];
7897
- // tslint:disable: prefer-for-of
7898
- for (var i = 0; i < items.length; i++) {
7899
- var file = items[i];
7900
- files.push(file);
7901
- }
7902
- return files;
7903
- }
7904
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
7905
- function toFilePromises(item) {
7906
- if (typeof item.webkitGetAsEntry !== 'function') {
7907
- return fromDataTransferItem(item);
7908
- }
7909
- var entry = item.webkitGetAsEntry();
7910
- // Safari supports dropping an image node from a different window and can be retrieved using
7911
- // the DataTransferItem.getAsFile() API
7912
- // NOTE: FileSystemEntry.file() throws if trying to get the file
7913
- if (entry && entry.isDirectory) {
7914
- return fromDirEntry(entry);
7915
- }
7916
- return fromDataTransferItem(item);
7917
- }
7918
- function flatten(items) {
7919
- return items.reduce(function (acc, files) { return __spreadArray(__spreadArray([], __read(acc), false), __read((Array.isArray(files) ? flatten(files) : [files])), false); }, []);
7920
- }
7921
- function fromDataTransferItem(item) {
7922
- var file = item.getAsFile();
7923
- if (!file) {
7924
- return Promise.reject("".concat(item, " is not a File"));
7925
- }
7926
- var fwp = toFileWithPath(file);
7927
- return Promise.resolve(fwp);
7928
- }
7929
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
7930
- function fromEntry(entry) {
7931
- return __awaiter(this, void 0, void 0, function () {
7932
- return __generator(this, function (_a) {
7933
- return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
7934
- });
7935
- });
7936
- }
7937
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
7938
- function fromDirEntry(entry) {
7939
- var reader = entry.createReader();
7940
- return new Promise(function (resolve, reject) {
7941
- var entries = [];
7942
- function readEntries() {
7943
- var _this = this;
7944
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
7945
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
7946
- reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
7947
- var files, err_1, items;
7948
- return __generator(this, function (_a) {
7949
- switch (_a.label) {
7950
- case 0:
7951
- if (!!batch.length) return [3 /*break*/, 5];
7952
- _a.label = 1;
7953
- case 1:
7954
- _a.trys.push([1, 3, , 4]);
7955
- return [4 /*yield*/, Promise.all(entries)];
7956
- case 2:
7957
- files = _a.sent();
7958
- resolve(files);
7959
- return [3 /*break*/, 4];
7960
- case 3:
7961
- err_1 = _a.sent();
7962
- reject(err_1);
7963
- return [3 /*break*/, 4];
7964
- case 4: return [3 /*break*/, 6];
7965
- case 5:
7966
- items = Promise.all(batch.map(fromEntry));
7967
- entries.push(items);
7968
- // Continue reading
7969
- readEntries();
7970
- _a.label = 6;
7971
- case 6: return [2 /*return*/];
7972
- }
7973
- });
7974
- }); }, function (err) {
7975
- reject(err);
7976
- });
7977
- }
7978
- readEntries();
7979
- });
7980
- }
7981
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
7982
- function fromFileEntry(entry) {
7983
- return __awaiter(this, void 0, void 0, function () {
7984
- return __generator(this, function (_a) {
7985
- return [2 /*return*/, new Promise(function (resolve, reject) {
7986
- entry.file(function (file) {
7987
- var fwp = toFileWithPath(file, entry.fullPath);
7988
- resolve(fwp);
7989
- }, function (err) {
7990
- reject(err);
7991
- });
7992
- })];
7993
- });
7994
- });
7995
- }
7996
-
7997
- var _default = function (file, acceptedFiles) {
7998
- if (file && acceptedFiles) {
7999
- var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
8000
- var fileName = file.name || '';
8001
- var mimeType = (file.type || '').toLowerCase();
8002
- var baseMimeType = mimeType.replace(/\/.*$/, '');
8003
- return acceptedFilesArray.some(function (type) {
8004
- var validType = type.trim().toLowerCase();
8005
-
8006
- if (validType.charAt(0) === '.') {
8007
- return fileName.toLowerCase().endsWith(validType);
8008
- } else if (validType.endsWith('/*')) {
8009
- // This is something like a image/* mime type
8010
- return baseMimeType === validType.replace(/\/.*$/, '');
8011
- }
8012
-
8013
- return mimeType === validType;
8014
- });
8015
- }
8016
-
8017
- return true;
8018
- };
8019
-
8020
- function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); }
8021
-
8022
- function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8023
-
8024
- function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8025
-
8026
- function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
8027
-
8028
- function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8029
-
8030
- function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$9(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8031
-
8032
- function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8033
-
8034
- function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
8035
-
8036
- function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8037
-
8038
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
8039
-
8040
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8041
-
8042
- function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
8043
-
8044
- function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
8045
-
8046
- var FILE_INVALID_TYPE = "file-invalid-type";
8047
- var FILE_TOO_LARGE = "file-too-large";
8048
- var FILE_TOO_SMALL = "file-too-small";
8049
- var TOO_MANY_FILES = "too-many-files";
8050
-
8051
- var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
8052
- accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
8053
- var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
8054
- return {
8055
- code: FILE_INVALID_TYPE,
8056
- message: "File type must be ".concat(messageSuffix)
8057
- };
8058
- };
8059
- var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
8060
- return {
8061
- code: FILE_TOO_LARGE,
8062
- message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
8063
- };
8064
- };
8065
- var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
8066
- return {
8067
- code: FILE_TOO_SMALL,
8068
- message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
8069
- };
8070
- };
8071
- var TOO_MANY_FILES_REJECTION = {
8072
- code: TOO_MANY_FILES,
8073
- message: "Too many files"
8074
- }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
8075
- // that MIME type will always be accepted
8076
-
8077
- function fileAccepted(file, accept) {
8078
- var isAcceptable = file.type === "application/x-moz-file" || _default(file, accept);
8079
- return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
8080
- }
8081
- function fileMatchSize(file, minSize, maxSize) {
8082
- if (isDefined(file.size)) {
8083
- if (isDefined(minSize) && isDefined(maxSize)) {
8084
- if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
8085
- if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
8086
- } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
8087
- }
8088
-
8089
- return [true, null];
8090
- }
8091
-
8092
- function isDefined(value) {
8093
- return value !== undefined && value !== null;
8094
- }
8095
- /**
8096
- *
8097
- * @param {object} options
8098
- * @param {File[]} options.files
8099
- * @param {string|string[]} [options.accept]
8100
- * @param {number} [options.minSize]
8101
- * @param {number} [options.maxSize]
8102
- * @param {boolean} [options.multiple]
8103
- * @param {number} [options.maxFiles]
8104
- * @param {(f: File) => FileError|FileError[]|null} [options.validator]
8105
- * @returns
8106
- */
8107
-
8108
-
8109
- function allFilesAccepted(_ref) {
8110
- var files = _ref.files,
8111
- accept = _ref.accept,
8112
- minSize = _ref.minSize,
8113
- maxSize = _ref.maxSize,
8114
- multiple = _ref.multiple,
8115
- maxFiles = _ref.maxFiles,
8116
- validator = _ref.validator;
8117
-
8118
- if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
8119
- return false;
8120
- }
8121
-
8122
- return files.every(function (file) {
8123
- var _fileAccepted = fileAccepted(file, accept),
8124
- _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
8125
- accepted = _fileAccepted2[0];
8126
-
8127
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
8128
- _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
8129
- sizeMatch = _fileMatchSize2[0];
8130
-
8131
- var customErrors = validator ? validator(file) : null;
8132
- return accepted && sizeMatch && !customErrors;
8133
- });
8134
- } // React's synthetic events has event.isPropagationStopped,
8135
- // but to remain compatibility with other libs (Preact) fall back
8136
- // to check event.cancelBubble
8137
-
8138
- function isPropagationStopped(event) {
8139
- if (typeof event.isPropagationStopped === "function") {
8140
- return event.isPropagationStopped();
8141
- } else if (typeof event.cancelBubble !== "undefined") {
8142
- return event.cancelBubble;
8143
- }
8144
-
8145
- return false;
8146
- }
8147
- function isEvtWithFiles(event) {
8148
- if (!event.dataTransfer) {
8149
- return !!event.target && !!event.target.files;
8150
- } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
8151
- // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
8152
-
8153
-
8154
- return Array.prototype.some.call(event.dataTransfer.types, function (type) {
8155
- return type === "Files" || type === "application/x-moz-file";
8156
- });
8157
- }
8158
-
8159
- function onDocumentDragOver(event) {
8160
- event.preventDefault();
8161
- }
8162
-
8163
- function isIe(userAgent) {
8164
- return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
8165
- }
8166
-
8167
- function isEdge(userAgent) {
8168
- return userAgent.indexOf("Edge/") !== -1;
8169
- }
8170
-
8171
- function isIeOrEdge() {
8172
- var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
8173
- return isIe(userAgent) || isEdge(userAgent);
8174
- }
8175
- /**
8176
- * This is intended to be used to compose event handlers
8177
- * They are executed in order until one of them calls `event.isPropagationStopped()`.
8178
- * Note that the check is done on the first invoke too,
8179
- * meaning that if propagation was stopped before invoking the fns,
8180
- * no handlers will be executed.
8181
- *
8182
- * @param {Function} fns the event hanlder functions
8183
- * @return {Function} the event handler to add to an element
8184
- */
8185
-
8186
- function composeEventHandlers() {
8187
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
8188
- fns[_key] = arguments[_key];
8189
- }
8190
-
8191
- return function (event) {
8192
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8193
- args[_key2 - 1] = arguments[_key2];
8194
- }
8195
-
8196
- return fns.some(function (fn) {
8197
- if (!isPropagationStopped(event) && fn) {
8198
- fn.apply(void 0, [event].concat(args));
8199
- }
8200
-
8201
- return isPropagationStopped(event);
8202
- });
8203
- };
8204
- }
8205
- /**
8206
- * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
8207
- * is supported by the browser.
8208
- * @returns {boolean}
8209
- */
8210
-
8211
- function canUseFileSystemAccessAPI() {
8212
- return "showOpenFilePicker" in window;
8213
- }
8214
- /**
8215
- * Convert the `{accept}` dropzone prop to the
8216
- * `{types}` option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
8217
- *
8218
- * @param {AcceptProp} accept
8219
- * @returns {{accept: string[]}[]}
8220
- */
8221
-
8222
- function pickerOptionsFromAccept(accept) {
8223
- if (isDefined(accept)) {
8224
- var acceptForPicker = Object.entries(accept).filter(function (_ref2) {
8225
- var _ref3 = _slicedToArray$1(_ref2, 2),
8226
- mimeType = _ref3[0],
8227
- ext = _ref3[1];
8228
-
8229
- var ok = true;
8230
-
8231
- if (!isMIMEType(mimeType)) {
8232
- console.warn("Skipped \"".concat(mimeType, "\" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types."));
8233
- ok = false;
8234
- }
8235
-
8236
- if (!Array.isArray(ext) || !ext.every(isExt)) {
8237
- console.warn("Skipped \"".concat(mimeType, "\" because an invalid file extension was provided."));
8238
- ok = false;
8239
- }
8240
-
8241
- return ok;
8242
- }).reduce(function (agg, _ref4) {
8243
- var _ref5 = _slicedToArray$1(_ref4, 2),
8244
- mimeType = _ref5[0],
8245
- ext = _ref5[1];
8246
-
8247
- return _objectSpread$9(_objectSpread$9({}, agg), {}, _defineProperty$1({}, mimeType, ext));
8248
- }, {});
8249
- return [{
8250
- // description is required due to https://crbug.com/1264708
8251
- description: "Files",
8252
- accept: acceptForPicker
8253
- }];
8254
- }
8255
-
8256
- return accept;
8257
- }
8258
- /**
8259
- * Convert the `{accept}` dropzone prop to an array of MIME types/extensions.
8260
- * @param {AcceptProp} accept
8261
- * @returns {string}
8262
- */
8263
-
8264
- function acceptPropAsAcceptAttr(accept) {
8265
- if (isDefined(accept)) {
8266
- return Object.entries(accept).reduce(function (a, _ref6) {
8267
- var _ref7 = _slicedToArray$1(_ref6, 2),
8268
- mimeType = _ref7[0],
8269
- ext = _ref7[1];
8270
-
8271
- return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
8272
- }, []) // Silently discard invalid entries as pickerOptionsFromAccept warns about these
8273
- .filter(function (v) {
8274
- return isMIMEType(v) || isExt(v);
8275
- }).join(",");
8276
- }
8277
-
8278
- return undefined;
8279
- }
8280
- /**
8281
- * Check if v is an exception caused by aborting a request (e.g window.showOpenFilePicker()).
8282
- *
8283
- * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
8284
- * @param {any} v
8285
- * @returns {boolean} True if v is an abort exception.
8286
- */
8287
-
8288
- function isAbort(v) {
8289
- return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR);
8290
- }
8291
- /**
8292
- * Check if v is a security error.
8293
- *
8294
- * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
8295
- * @param {any} v
8296
- * @returns {boolean} True if v is a security error.
8297
- */
8298
-
8299
- function isSecurityError(v) {
8300
- return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
8301
- }
8302
- /**
8303
- * Check if v is a MIME type string.
8304
- *
8305
- * See accepted format: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers.
8306
- *
8307
- * @param {string} v
8308
- */
8309
-
8310
- function isMIMEType(v) {
8311
- return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v);
8312
- }
8313
- /**
8314
- * Check if v is a file extension.
8315
- * @param {string} v
8316
- */
8317
-
8318
- function isExt(v) {
8319
- return /^.*\.[\w]+$/.test(v);
8320
- }
8321
- /**
8322
- * @typedef {Object.<string, string[]>} AcceptProp
8323
- */
8324
-
8325
- /**
8326
- * @typedef {object} FileError
8327
- * @property {string} message
8328
- * @property {ErrorCode|string} code
8329
- */
8330
-
8331
- /**
8332
- * @typedef {"file-invalid-type"|"file-too-large"|"file-too-small"|"too-many-files"} ErrorCode
8333
- */
8334
-
8335
- var _excluded$3 = ["children"],
8336
- _excluded2$2 = ["open"],
8337
- _excluded3$1 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
8338
- _excluded4 = ["refKey", "onChange", "onClick"];
8339
-
8340
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8341
-
8342
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8343
-
8344
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8345
-
8346
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8347
-
8348
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8349
-
8350
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8351
-
8352
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8353
-
8354
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8355
-
8356
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
8357
-
8358
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8359
-
8360
- function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8361
-
8362
- function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8363
-
8364
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8365
-
8366
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8367
-
8368
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8369
- /**
8370
- * Convenience wrapper component for the `useDropzone` hook
8371
- *
8372
- * ```jsx
8373
- * <Dropzone>
8374
- * {({getRootProps, getInputProps}) => (
8375
- * <div {...getRootProps()}>
8376
- * <input {...getInputProps()} />
8377
- * <p>Drag 'n' drop some files here, or click to select files</p>
8378
- * </div>
8379
- * )}
8380
- * </Dropzone>
8381
- * ```
8382
- */
8383
-
8384
- var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
8385
- var children = _ref.children,
8386
- params = _objectWithoutProperties(_ref, _excluded$3);
8387
-
8388
- var _useDropzone = useDropzone(params),
8389
- open = _useDropzone.open,
8390
- props = _objectWithoutProperties(_useDropzone, _excluded2$2);
8391
-
8392
- useImperativeHandle(ref, function () {
8393
- return {
8394
- open: open
8395
- };
8396
- }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
8397
-
8398
- return /*#__PURE__*/React.createElement(Fragment, null, children(_objectSpread$8(_objectSpread$8({}, props), {}, {
8399
- open: open
8400
- })));
8401
- });
8402
- Dropzone.displayName = "Dropzone"; // Add default props for react-docgen
8403
-
8404
- var defaultProps = {
8405
- disabled: false,
8406
- getFilesFromEvent: fromEvent,
8407
- maxSize: Infinity,
8408
- minSize: 0,
8409
- multiple: true,
8410
- maxFiles: 0,
8411
- preventDropOnDocument: true,
8412
- noClick: false,
8413
- noKeyboard: false,
8414
- noDrag: false,
8415
- noDragEventsBubbling: false,
8416
- validator: null,
8417
- useFsAccessApi: true,
8418
- autoFocus: false
8419
- };
8420
- Dropzone.defaultProps = defaultProps;
8421
- Dropzone.propTypes = {
8422
- /**
8423
- * Render function that exposes the dropzone state and prop getter fns
8424
- *
8425
- * @param {object} params
8426
- * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
8427
- * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
8428
- * @param {Function} params.open Open the native file selection dialog
8429
- * @param {boolean} params.isFocused Dropzone area is in focus
8430
- * @param {boolean} params.isFileDialogActive File dialog is opened
8431
- * @param {boolean} params.isDragActive Active drag is in progress
8432
- * @param {boolean} params.isDragAccept Dragged files are accepted
8433
- * @param {boolean} params.isDragReject Some dragged files are rejected
8434
- * @param {File[]} params.acceptedFiles Accepted files
8435
- * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
8436
- */
8437
- children: propTypes.exports.func,
8438
-
8439
- /**
8440
- * Set accepted file types.
8441
- * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
8442
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
8443
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
8444
- * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
8445
- */
8446
- accept: propTypes.exports.objectOf(propTypes.exports.arrayOf(propTypes.exports.string)),
8447
-
8448
- /**
8449
- * Allow drag 'n' drop (or selection from the file dialog) of multiple files
8450
- */
8451
- multiple: propTypes.exports.bool,
8452
-
8453
- /**
8454
- * If false, allow dropped items to take over the current browser window
8455
- */
8456
- preventDropOnDocument: propTypes.exports.bool,
8457
-
8458
- /**
8459
- * If true, disables click to open the native file selection dialog
8460
- */
8461
- noClick: propTypes.exports.bool,
8462
-
8463
- /**
8464
- * If true, disables SPACE/ENTER to open the native file selection dialog.
8465
- * Note that it also stops tracking the focus state.
8466
- */
8467
- noKeyboard: propTypes.exports.bool,
8468
-
8469
- /**
8470
- * If true, disables drag 'n' drop
8471
- */
8472
- noDrag: propTypes.exports.bool,
8473
-
8474
- /**
8475
- * If true, stops drag event propagation to parents
8476
- */
8477
- noDragEventsBubbling: propTypes.exports.bool,
8478
-
8479
- /**
8480
- * Minimum file size (in bytes)
8481
- */
8482
- minSize: propTypes.exports.number,
8483
-
8484
- /**
8485
- * Maximum file size (in bytes)
8486
- */
8487
- maxSize: propTypes.exports.number,
8488
-
8489
- /**
8490
- * Maximum accepted number of files
8491
- * The default value is 0 which means there is no limitation to how many files are accepted.
8492
- */
8493
- maxFiles: propTypes.exports.number,
8494
-
8495
- /**
8496
- * Enable/disable the dropzone
8497
- */
8498
- disabled: propTypes.exports.bool,
8499
-
8500
- /**
8501
- * Use this to provide a custom file aggregator
8502
- *
8503
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8504
- */
8505
- getFilesFromEvent: propTypes.exports.func,
8506
-
8507
- /**
8508
- * Cb for when closing the file dialog with no selection
8509
- */
8510
- onFileDialogCancel: propTypes.exports.func,
8511
-
8512
- /**
8513
- * Cb for when opening the file dialog
8514
- */
8515
- onFileDialogOpen: propTypes.exports.func,
8516
-
8517
- /**
8518
- * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
8519
- * to open the file picker instead of using an `<input type="file">` click event.
8520
- */
8521
- useFsAccessApi: propTypes.exports.bool,
8522
-
8523
- /**
8524
- * Set to true to focus the root element on render
8525
- */
8526
- autoFocus: propTypes.exports.bool,
8527
-
8528
- /**
8529
- * Cb for when the `dragenter` event occurs.
8530
- *
8531
- * @param {DragEvent} event
8532
- */
8533
- onDragEnter: propTypes.exports.func,
8534
-
8535
- /**
8536
- * Cb for when the `dragleave` event occurs
8537
- *
8538
- * @param {DragEvent} event
8539
- */
8540
- onDragLeave: propTypes.exports.func,
8541
-
8542
- /**
8543
- * Cb for when the `dragover` event occurs
8544
- *
8545
- * @param {DragEvent} event
8546
- */
8547
- onDragOver: propTypes.exports.func,
8548
-
8549
- /**
8550
- * Cb for when the `drop` event occurs.
8551
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
8552
- *
8553
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
8554
- * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
8555
- * If `multiple` is set to false and additional files are dropped,
8556
- * all files besides the first will be rejected.
8557
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
8558
- *
8559
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
8560
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
8561
- *
8562
- * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
8563
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
8564
- *
8565
- * ```js
8566
- * function onDrop(acceptedFiles) {
8567
- * const req = request.post('/upload')
8568
- * acceptedFiles.forEach(file => {
8569
- * req.attach(file.name, file)
8570
- * })
8571
- * req.end(callback)
8572
- * }
8573
- * ```
8574
- *
8575
- * @param {File[]} acceptedFiles
8576
- * @param {FileRejection[]} fileRejections
8577
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8578
- */
8579
- onDrop: propTypes.exports.func,
8580
-
8581
- /**
8582
- * Cb for when the `drop` event occurs.
8583
- * Note that if no files are accepted, this callback is not invoked.
8584
- *
8585
- * @param {File[]} files
8586
- * @param {(DragEvent|Event)} event
8587
- */
8588
- onDropAccepted: propTypes.exports.func,
8589
-
8590
- /**
8591
- * Cb for when the `drop` event occurs.
8592
- * Note that if no files are rejected, this callback is not invoked.
8593
- *
8594
- * @param {FileRejection[]} fileRejections
8595
- * @param {(DragEvent|Event)} event
8596
- */
8597
- onDropRejected: propTypes.exports.func,
8598
-
8599
- /**
8600
- * Cb for when there's some error from any of the promises.
8601
- *
8602
- * @param {Error} error
8603
- */
8604
- onError: propTypes.exports.func,
8605
-
8606
- /**
8607
- * Custom validation function. It must return null if there's no errors.
8608
- * @param {File} file
8609
- * @returns {FileError|FileError[]|null}
8610
- */
8611
- validator: propTypes.exports.func
8612
- };
8613
- var Dropzone$1 = Dropzone;
8614
- /**
8615
- * A function that is invoked for the `dragenter`,
8616
- * `dragover` and `dragleave` events.
8617
- * It is not invoked if the items are not files (such as link, text, etc.).
8618
- *
8619
- * @callback dragCb
8620
- * @param {DragEvent} event
8621
- */
8622
-
8623
- /**
8624
- * A function that is invoked for the `drop` or input change event.
8625
- * It is not invoked if the items are not files (such as link, text, etc.).
8626
- *
8627
- * @callback dropCb
8628
- * @param {File[]} acceptedFiles List of accepted files
8629
- * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
8630
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8631
- */
8632
-
8633
- /**
8634
- * A function that is invoked for the `drop` or input change event.
8635
- * It is not invoked if the items are files (such as link, text, etc.).
8636
- *
8637
- * @callback dropAcceptedCb
8638
- * @param {File[]} files List of accepted files that meet the given criteria
8639
- * (`accept`, `multiple`, `minSize`, `maxSize`)
8640
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8641
- */
8642
-
8643
- /**
8644
- * A function that is invoked for the `drop` or input change event.
8645
- *
8646
- * @callback dropRejectedCb
8647
- * @param {File[]} files List of rejected files that do not meet the given criteria
8648
- * (`accept`, `multiple`, `minSize`, `maxSize`)
8649
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8650
- */
8651
-
8652
- /**
8653
- * A function that is used aggregate files,
8654
- * in a asynchronous fashion, from drag or input change events.
8655
- *
8656
- * @callback getFilesFromEvent
8657
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8658
- * @returns {(File[]|Promise<File[]>)}
8659
- */
8660
-
8661
- /**
8662
- * An object with the current dropzone state.
8663
- *
8664
- * @typedef {object} DropzoneState
8665
- * @property {boolean} isFocused Dropzone area is in focus
8666
- * @property {boolean} isFileDialogActive File dialog is opened
8667
- * @property {boolean} isDragActive Active drag is in progress
8668
- * @property {boolean} isDragAccept Dragged files are accepted
8669
- * @property {boolean} isDragReject Some dragged files are rejected
8670
- * @property {File[]} acceptedFiles Accepted files
8671
- * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
8672
- */
8673
-
8674
- /**
8675
- * An object with the dropzone methods.
8676
- *
8677
- * @typedef {object} DropzoneMethods
8678
- * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
8679
- * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
8680
- * @property {Function} open Open the native file selection dialog
8681
- */
8682
-
8683
- var initialState = {
8684
- isFocused: false,
8685
- isFileDialogActive: false,
8686
- isDragActive: false,
8687
- isDragAccept: false,
8688
- isDragReject: false,
8689
- acceptedFiles: [],
8690
- fileRejections: []
8691
- };
8692
- /**
8693
- * A React hook that creates a drag 'n' drop area.
8694
- *
8695
- * ```jsx
8696
- * function MyDropzone(props) {
8697
- * const {getRootProps, getInputProps} = useDropzone({
8698
- * onDrop: acceptedFiles => {
8699
- * // do something with the File objects, e.g. upload to some server
8700
- * }
8701
- * });
8702
- * return (
8703
- * <div {...getRootProps()}>
8704
- * <input {...getInputProps()} />
8705
- * <p>Drag and drop some files here, or click to select files</p>
8706
- * </div>
8707
- * )
8708
- * }
8709
- * ```
8710
- *
8711
- * @function useDropzone
8712
- *
8713
- * @param {object} props
8714
- * @param {import("./utils").AcceptProp} [props.accept] Set accepted file types.
8715
- * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
8716
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
8717
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
8718
- * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
8719
- * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
8720
- * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
8721
- * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
8722
- * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
8723
- * Note that it also stops tracking the focus state.
8724
- * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
8725
- * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
8726
- * @param {number} [props.minSize=0] Minimum file size (in bytes)
8727
- * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
8728
- * @param {boolean} [props.disabled=false] Enable/disable the dropzone
8729
- * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
8730
- * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
8731
- * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
8732
- * to open the file picker instead of using an `<input type="file">` click event.
8733
- * @param {boolean} autoFocus Set to true to auto focus the root element.
8734
- * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
8735
- * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
8736
- * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
8737
- * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
8738
- * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
8739
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
8740
- *
8741
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
8742
- * `accept` must be an object with keys as a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) and the value an array of file extensions (optional).
8743
- * If `multiple` is set to false and additional files are dropped,
8744
- * all files besides the first will be rejected.
8745
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
8746
- *
8747
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
8748
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
8749
- *
8750
- * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
8751
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
8752
- *
8753
- * ```js
8754
- * function onDrop(acceptedFiles) {
8755
- * const req = request.post('/upload')
8756
- * acceptedFiles.forEach(file => {
8757
- * req.attach(file.name, file)
8758
- * })
8759
- * req.end(callback)
8760
- * }
8761
- * ```
8762
- * @param {dropAcceptedCb} [props.onDropAccepted]
8763
- * @param {dropRejectedCb} [props.onDropRejected]
8764
- * @param {(error: Error) => void} [props.onError]
8765
- *
8766
- * @returns {DropzoneState & DropzoneMethods}
8767
- */
8768
-
8769
- function useDropzone() {
8770
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8771
-
8772
- var _defaultProps$props = _objectSpread$8(_objectSpread$8({}, defaultProps), props),
8773
- accept = _defaultProps$props.accept,
8774
- disabled = _defaultProps$props.disabled,
8775
- getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
8776
- maxSize = _defaultProps$props.maxSize,
8777
- minSize = _defaultProps$props.minSize,
8778
- multiple = _defaultProps$props.multiple,
8779
- maxFiles = _defaultProps$props.maxFiles,
8780
- onDragEnter = _defaultProps$props.onDragEnter,
8781
- onDragLeave = _defaultProps$props.onDragLeave,
8782
- onDragOver = _defaultProps$props.onDragOver,
8783
- onDrop = _defaultProps$props.onDrop,
8784
- onDropAccepted = _defaultProps$props.onDropAccepted,
8785
- onDropRejected = _defaultProps$props.onDropRejected,
8786
- onFileDialogCancel = _defaultProps$props.onFileDialogCancel,
8787
- onFileDialogOpen = _defaultProps$props.onFileDialogOpen,
8788
- useFsAccessApi = _defaultProps$props.useFsAccessApi,
8789
- autoFocus = _defaultProps$props.autoFocus,
8790
- preventDropOnDocument = _defaultProps$props.preventDropOnDocument,
8791
- noClick = _defaultProps$props.noClick,
8792
- noKeyboard = _defaultProps$props.noKeyboard,
8793
- noDrag = _defaultProps$props.noDrag,
8794
- noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling,
8795
- onError = _defaultProps$props.onError,
8796
- validator = _defaultProps$props.validator;
8797
-
8798
- var acceptAttr = useMemo(function () {
8799
- return acceptPropAsAcceptAttr(accept);
8800
- }, [accept]);
8801
- var pickerTypes = useMemo(function () {
8802
- return pickerOptionsFromAccept(accept);
8803
- }, [accept]);
8804
- var onFileDialogOpenCb = useMemo(function () {
8805
- return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
8806
- }, [onFileDialogOpen]);
8807
- var onFileDialogCancelCb = useMemo(function () {
8808
- return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
8809
- }, [onFileDialogCancel]);
8810
- /**
8811
- * @constant
8812
- * @type {React.MutableRefObject<HTMLElement>}
8813
- */
8814
-
8815
- var rootRef = useRef(null);
8816
- var inputRef = useRef(null);
8817
-
8818
- var _useReducer = useReducer(reducer, initialState),
8819
- _useReducer2 = _slicedToArray(_useReducer, 2),
8820
- state = _useReducer2[0],
8821
- dispatch = _useReducer2[1];
8822
-
8823
- var isFocused = state.isFocused,
8824
- isFileDialogActive = state.isFileDialogActive;
8825
- var fsAccessApiWorksRef = useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); // Update file dialog active state when the window is focused on
8826
-
8827
- var onWindowFocus = function onWindowFocus() {
8828
- // Execute the timeout only if the file dialog is opened in the browser
8829
- if (!fsAccessApiWorksRef.current && isFileDialogActive) {
8830
- setTimeout(function () {
8831
- if (inputRef.current) {
8832
- var files = inputRef.current.files;
8833
-
8834
- if (!files.length) {
8835
- dispatch({
8836
- type: "closeDialog"
8837
- });
8838
- onFileDialogCancelCb();
8839
- }
8840
- }
8841
- }, 300);
8842
- }
8843
- };
8844
-
8845
- useEffect(function () {
8846
- window.addEventListener("focus", onWindowFocus, false);
8847
- return function () {
8848
- window.removeEventListener("focus", onWindowFocus, false);
8849
- };
8850
- }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
8851
- var dragTargetsRef = useRef([]);
8852
-
8853
- var onDocumentDrop = function onDocumentDrop(event) {
8854
- if (rootRef.current && rootRef.current.contains(event.target)) {
8855
- // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
8856
- return;
8857
- }
8858
-
8859
- event.preventDefault();
8860
- dragTargetsRef.current = [];
8861
- };
8862
-
8863
- useEffect(function () {
8864
- if (preventDropOnDocument) {
8865
- document.addEventListener("dragover", onDocumentDragOver, false);
8866
- document.addEventListener("drop", onDocumentDrop, false);
8867
- }
8868
-
8869
- return function () {
8870
- if (preventDropOnDocument) {
8871
- document.removeEventListener("dragover", onDocumentDragOver);
8872
- document.removeEventListener("drop", onDocumentDrop);
8873
- }
8874
- };
8875
- }, [rootRef, preventDropOnDocument]); // Auto focus the root when autoFocus is true
8876
-
8877
- useEffect(function () {
8878
- if (!disabled && autoFocus && rootRef.current) {
8879
- rootRef.current.focus();
8880
- }
8881
-
8882
- return function () {};
8883
- }, [rootRef, autoFocus, disabled]);
8884
- var onErrCb = useCallback(function (e) {
8885
- if (onError) {
8886
- onError(e);
8887
- } else {
8888
- // Let the user know something's gone wrong if they haven't provided the onError cb.
8889
- console.error(e);
8890
- }
8891
- }, [onError]);
8892
- var onDragEnterCb = useCallback(function (event) {
8893
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
8894
-
8895
- event.persist();
8896
- stopPropagation(event);
8897
- dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
8898
-
8899
- if (isEvtWithFiles(event)) {
8900
- Promise.resolve(getFilesFromEvent(event)).then(function (files) {
8901
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
8902
- return;
8903
- }
8904
-
8905
- var fileCount = files.length;
8906
- var isDragAccept = fileCount > 0 && allFilesAccepted({
8907
- files: files,
8908
- accept: acceptAttr,
8909
- minSize: minSize,
8910
- maxSize: maxSize,
8911
- multiple: multiple,
8912
- maxFiles: maxFiles,
8913
- validator: validator
8914
- });
8915
- var isDragReject = fileCount > 0 && !isDragAccept;
8916
- dispatch({
8917
- isDragAccept: isDragAccept,
8918
- isDragReject: isDragReject,
8919
- isDragActive: true,
8920
- type: "setDraggedFiles"
8921
- });
8922
-
8923
- if (onDragEnter) {
8924
- onDragEnter(event);
8925
- }
8926
- }).catch(function (e) {
8927
- return onErrCb(e);
8928
- });
8929
- }
8930
- }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
8931
- var onDragOverCb = useCallback(function (event) {
8932
- event.preventDefault();
8933
- event.persist();
8934
- stopPropagation(event);
8935
- var hasFiles = isEvtWithFiles(event);
8936
-
8937
- if (hasFiles && event.dataTransfer) {
8938
- try {
8939
- event.dataTransfer.dropEffect = "copy";
8940
- } catch (_unused) {}
8941
- /* eslint-disable-line no-empty */
8942
-
8943
- }
8944
-
8945
- if (hasFiles && onDragOver) {
8946
- onDragOver(event);
8947
- }
8948
-
8949
- return false;
8950
- }, [onDragOver, noDragEventsBubbling]);
8951
- var onDragLeaveCb = useCallback(function (event) {
8952
- event.preventDefault();
8953
- event.persist();
8954
- stopPropagation(event); // Only deactivate once the dropzone and all children have been left
8955
-
8956
- var targets = dragTargetsRef.current.filter(function (target) {
8957
- return rootRef.current && rootRef.current.contains(target);
8958
- }); // Make sure to remove a target present multiple times only once
8959
- // (Firefox may fire dragenter/dragleave multiple times on the same element)
8960
-
8961
- var targetIdx = targets.indexOf(event.target);
8962
-
8963
- if (targetIdx !== -1) {
8964
- targets.splice(targetIdx, 1);
8965
- }
8966
-
8967
- dragTargetsRef.current = targets;
8968
-
8969
- if (targets.length > 0) {
8970
- return;
8971
- }
8972
-
8973
- dispatch({
8974
- type: "setDraggedFiles",
8975
- isDragActive: false,
8976
- isDragAccept: false,
8977
- isDragReject: false
8978
- });
8979
-
8980
- if (isEvtWithFiles(event) && onDragLeave) {
8981
- onDragLeave(event);
8982
- }
8983
- }, [rootRef, onDragLeave, noDragEventsBubbling]);
8984
- var setFiles = useCallback(function (files, event) {
8985
- var acceptedFiles = [];
8986
- var fileRejections = [];
8987
- files.forEach(function (file) {
8988
- var _fileAccepted = fileAccepted(file, acceptAttr),
8989
- _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
8990
- accepted = _fileAccepted2[0],
8991
- acceptError = _fileAccepted2[1];
8992
-
8993
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
8994
- _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
8995
- sizeMatch = _fileMatchSize2[0],
8996
- sizeError = _fileMatchSize2[1];
8997
-
8998
- var customErrors = validator ? validator(file) : null;
8999
-
9000
- if (accepted && sizeMatch && !customErrors) {
9001
- acceptedFiles.push(file);
9002
- } else {
9003
- var errors = [acceptError, sizeError];
9004
-
9005
- if (customErrors) {
9006
- errors = errors.concat(customErrors);
9007
- }
9008
-
9009
- fileRejections.push({
9010
- file: file,
9011
- errors: errors.filter(function (e) {
9012
- return e;
9013
- })
9014
- });
9015
- }
9016
- });
9017
-
9018
- if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
9019
- // Reject everything and empty accepted files
9020
- acceptedFiles.forEach(function (file) {
9021
- fileRejections.push({
9022
- file: file,
9023
- errors: [TOO_MANY_FILES_REJECTION]
9024
- });
9025
- });
9026
- acceptedFiles.splice(0);
9027
- }
9028
-
9029
- dispatch({
9030
- acceptedFiles: acceptedFiles,
9031
- fileRejections: fileRejections,
9032
- type: "setFiles"
9033
- });
9034
-
9035
- if (onDrop) {
9036
- onDrop(acceptedFiles, fileRejections, event);
9037
- }
9038
-
9039
- if (fileRejections.length > 0 && onDropRejected) {
9040
- onDropRejected(fileRejections, event);
9041
- }
9042
-
9043
- if (acceptedFiles.length > 0 && onDropAccepted) {
9044
- onDropAccepted(acceptedFiles, event);
9045
- }
9046
- }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
9047
- var onDropCb = useCallback(function (event) {
9048
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
9049
-
9050
- event.persist();
9051
- stopPropagation(event);
9052
- dragTargetsRef.current = [];
9053
-
9054
- if (isEvtWithFiles(event)) {
9055
- Promise.resolve(getFilesFromEvent(event)).then(function (files) {
9056
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
9057
- return;
9058
- }
9059
-
9060
- setFiles(files, event);
9061
- }).catch(function (e) {
9062
- return onErrCb(e);
9063
- });
9064
- }
9065
-
9066
- dispatch({
9067
- type: "reset"
9068
- });
9069
- }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
9070
-
9071
- var openFileDialog = useCallback(function () {
9072
- // No point to use FS access APIs if context is not secure
9073
- // https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#feature_detection
9074
- if (fsAccessApiWorksRef.current) {
9075
- dispatch({
9076
- type: "openDialog"
9077
- });
9078
- onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
9079
-
9080
- var opts = {
9081
- multiple: multiple,
9082
- types: pickerTypes
9083
- };
9084
- window.showOpenFilePicker(opts).then(function (handles) {
9085
- return getFilesFromEvent(handles);
9086
- }).then(function (files) {
9087
- setFiles(files, null);
9088
- dispatch({
9089
- type: "closeDialog"
9090
- });
9091
- }).catch(function (e) {
9092
- // AbortError means the user canceled
9093
- if (isAbort(e)) {
9094
- onFileDialogCancelCb(e);
9095
- dispatch({
9096
- type: "closeDialog"
9097
- });
9098
- } else if (isSecurityError(e)) {
9099
- fsAccessApiWorksRef.current = false; // CORS, so cannot use this API
9100
- // Try using the input
9101
-
9102
- if (inputRef.current) {
9103
- inputRef.current.value = null;
9104
- inputRef.current.click();
9105
- } else {
9106
- onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."));
9107
- }
9108
- } else {
9109
- onErrCb(e);
9110
- }
9111
- });
9112
- return;
9113
- }
9114
-
9115
- if (inputRef.current) {
9116
- dispatch({
9117
- type: "openDialog"
9118
- });
9119
- onFileDialogOpenCb();
9120
- inputRef.current.value = null;
9121
- inputRef.current.click();
9122
- }
9123
- }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
9124
-
9125
- var onKeyDownCb = useCallback(function (event) {
9126
- // Ignore keyboard events bubbling up the DOM tree
9127
- if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
9128
- return;
9129
- }
9130
-
9131
- if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
9132
- event.preventDefault();
9133
- openFileDialog();
9134
- }
9135
- }, [rootRef, openFileDialog]); // Update focus state for the dropzone
9136
-
9137
- var onFocusCb = useCallback(function () {
9138
- dispatch({
9139
- type: "focus"
9140
- });
9141
- }, []);
9142
- var onBlurCb = useCallback(function () {
9143
- dispatch({
9144
- type: "blur"
9145
- });
9146
- }, []); // Cb to open the file dialog when click occurs on the dropzone
9147
-
9148
- var onClickCb = useCallback(function () {
9149
- if (noClick) {
9150
- return;
9151
- } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
9152
- // to ensure React can handle state changes
9153
- // See: https://github.com/react-dropzone/react-dropzone/issues/450
9154
-
9155
-
9156
- if (isIeOrEdge()) {
9157
- setTimeout(openFileDialog, 0);
9158
- } else {
9159
- openFileDialog();
9160
- }
9161
- }, [noClick, openFileDialog]);
9162
-
9163
- var composeHandler = function composeHandler(fn) {
9164
- return disabled ? null : fn;
9165
- };
9166
-
9167
- var composeKeyboardHandler = function composeKeyboardHandler(fn) {
9168
- return noKeyboard ? null : composeHandler(fn);
9169
- };
9170
-
9171
- var composeDragHandler = function composeDragHandler(fn) {
9172
- return noDrag ? null : composeHandler(fn);
9173
- };
9174
-
9175
- var stopPropagation = function stopPropagation(event) {
9176
- if (noDragEventsBubbling) {
9177
- event.stopPropagation();
9178
- }
9179
- };
9180
-
9181
- var getRootProps = useMemo(function () {
9182
- return function () {
9183
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
9184
- _ref2$refKey = _ref2.refKey,
9185
- refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey,
9186
- role = _ref2.role,
9187
- onKeyDown = _ref2.onKeyDown,
9188
- onFocus = _ref2.onFocus,
9189
- onBlur = _ref2.onBlur,
9190
- onClick = _ref2.onClick,
9191
- onDragEnter = _ref2.onDragEnter,
9192
- onDragOver = _ref2.onDragOver,
9193
- onDragLeave = _ref2.onDragLeave,
9194
- onDrop = _ref2.onDrop,
9195
- rest = _objectWithoutProperties(_ref2, _excluded3$1);
9196
-
9197
- return _objectSpread$8(_objectSpread$8(_defineProperty({
9198
- onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
9199
- onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
9200
- onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
9201
- onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
9202
- onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
9203
- onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
9204
- onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
9205
- onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
9206
- role: typeof role === "string" && role !== "" ? role : "presentation"
9207
- }, refKey, rootRef), !disabled && !noKeyboard ? {
9208
- tabIndex: 0
9209
- } : {}), rest);
9210
- };
9211
- }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
9212
- var onInputElementClick = useCallback(function (event) {
9213
- event.stopPropagation();
9214
- }, []);
9215
- var getInputProps = useMemo(function () {
9216
- return function () {
9217
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
9218
- _ref3$refKey = _ref3.refKey,
9219
- refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
9220
- onChange = _ref3.onChange,
9221
- onClick = _ref3.onClick,
9222
- rest = _objectWithoutProperties(_ref3, _excluded4);
9223
-
9224
- var inputProps = _defineProperty({
9225
- accept: acceptAttr,
9226
- multiple: multiple,
9227
- type: "file",
9228
- style: {
9229
- display: "none"
9230
- },
9231
- onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
9232
- onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
9233
- tabIndex: -1
9234
- }, refKey, inputRef);
9235
-
9236
- return _objectSpread$8(_objectSpread$8({}, inputProps), rest);
9237
- };
9238
- }, [inputRef, accept, multiple, onDropCb, disabled]);
9239
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9240
- isFocused: isFocused && !disabled,
9241
- getRootProps: getRootProps,
9242
- getInputProps: getInputProps,
9243
- rootRef: rootRef,
9244
- inputRef: inputRef,
9245
- open: composeHandler(openFileDialog)
9246
- });
9247
- }
9248
- /**
9249
- * @param {DropzoneState} state
9250
- * @param {{type: string} & DropzoneState} action
9251
- * @returns {DropzoneState}
9252
- */
9253
-
9254
- function reducer(state, action) {
9255
- /* istanbul ignore next */
9256
- switch (action.type) {
9257
- case "focus":
9258
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9259
- isFocused: true
9260
- });
9261
-
9262
- case "blur":
9263
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9264
- isFocused: false
9265
- });
9266
-
9267
- case "openDialog":
9268
- return _objectSpread$8(_objectSpread$8({}, initialState), {}, {
9269
- isFileDialogActive: true
9270
- });
9271
-
9272
- case "closeDialog":
9273
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9274
- isFileDialogActive: false
9275
- });
9276
-
9277
- case "setDraggedFiles":
9278
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9279
- isDragActive: action.isDragActive,
9280
- isDragAccept: action.isDragAccept,
9281
- isDragReject: action.isDragReject
9282
- });
9283
-
9284
- case "setFiles":
9285
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9286
- acceptedFiles: action.acceptedFiles,
9287
- fileRejections: action.fileRejections
9288
- });
9289
-
9290
- case "reset":
9291
- return _objectSpread$8({}, initialState);
9292
-
9293
- default:
9294
- return state;
9295
- }
9296
- }
9297
-
9298
- function noop() {}
9299
-
9300
- const Uploader = _ref => {
9301
- let sampleFileUrl = _ref.sampleFileUrl,
9302
- csvColumns = _ref.csvColumns;
9303
- return /*#__PURE__*/React.createElement(Dropzone$1, {
9304
- onDrop: noop$2
9305
- }, _ref2 => {
9306
- let getRootProps = _ref2.getRootProps,
9307
- getInputProps = _ref2.getInputProps;
9308
- return /*#__PURE__*/React.createElement("div", _extends({}, getRootProps(), {
9309
- className: "ntm-invitations__dnd"
9310
- }), /*#__PURE__*/React.createElement("input", getInputProps()), /*#__PURE__*/React.createElement(Typography, {
9311
- style: "h3"
9312
- }, instance.t("helpers.dropFilesHere")), /*#__PURE__*/React.createElement(Typography, {
9313
- style: "body2"
9314
- }, instance.t("helpers.uploadInstruction1")), /*#__PURE__*/React.createElement(Typography, {
9315
- style: "body2"
9316
- }, /*#__PURE__*/React.createElement(Trans, {
9317
- i18nKey: "helpers.uploadInstruction2",
9318
- values: {
9319
- what: csvColumns.join(", ")
9320
- }
9321
- })), /*#__PURE__*/React.createElement(Typography, {
9322
- style: "body2"
9323
- }, instance.t("helpers.uploadInstruction3")), /*#__PURE__*/React.createElement(Button, {
9324
- style: "link",
9325
- type: "submit",
9326
- icon: Download,
9327
- iconPosition: "left",
9328
- label: instance.t("common.download_", {
9329
- what: "sample.csv"
9330
- }),
9331
- onClick: event => {
9332
- event.stopPropagation();
9333
- window.open(sampleFileUrl);
9334
- }
9335
- }));
9336
- });
9337
- };
9338
-
9339
- /* eslint-disable @bigbinary/neeto/no-dangling-constants */
9340
- const DATETIME_OPTIONS = {
9341
- year: "numeric",
9342
- month: "short",
9343
- day: "numeric",
9344
- hour: "numeric",
9345
- minute: "numeric"
9346
- };
9347
- const COLUMN_DATA = [{
9348
- title: instance.t("helpers.files"),
9349
- dataIndex: "filename",
9350
- key: "filename",
9351
- render: (filename, row) => /*#__PURE__*/React.createElement("a", {
9352
- href: row.download_url,
9353
- download: true,
9354
- className: "ntm-invitations__table-filename"
9355
- }, /*#__PURE__*/React.createElement(File, null), filename)
9356
- }, {
9357
- title: instance.t("helpers.status"),
9358
- dataIndex: "status",
9359
- key: "status",
9360
- render: status => /*#__PURE__*/React.createElement("p", {
9361
- className: classnames("ntm-invitations__table-status", {
9362
- "neeto-ui-text-error-500": status === "failed",
9363
- "neeto-ui-text-success-500": status === "processed"
9364
- })
9365
- }, status)
9366
- }, {
9367
- title: instance.t("helpers.noOfRows"),
9368
- dataIndex: "rows_count",
9369
- key: "rows_count",
9370
- render: rows_count => rows_count !== null && rows_count !== void 0 ? rows_count : "-",
9371
- width: 120,
9372
- align: "center"
9373
- }, {
9374
- title: instance.t("helpers.uploaded"),
9375
- dataIndex: "uploaded_by",
9376
- key: "uploaded_by",
9377
- render: (uploaded_by, row) => `${uploaded_by} at ${new Date(row.created_at).toLocaleString("en-US", DATETIME_OPTIONS)}`
9378
- }];
9379
- const SAMPLE_ROW_DATA = [{
9380
- key: "1",
9381
- filename: "sample-1.csv",
9382
- status: "processed",
9383
- rows_count: "10",
9384
- created_at: new Date(),
9385
- download_url: "https://example.com/sample.csv",
9386
- uploaded_by: "Oliver Smith"
9387
- }, {
9388
- key: "2",
9389
- filename: "sample-2.csv",
9390
- status: "failed",
9391
- rows_count: "20",
9392
- created_at: new Date(),
9393
- download_url: "https://example.com/sample-2.csv",
9394
- uploaded_by: "Sam Smith"
9395
- }, {
9396
- key: "3",
9397
- filename: "sample-3.csv",
9398
- status: "failed",
9399
- rows_count: "30",
9400
- created_at: new Date(),
9401
- download_url: "https://example.com/sample-3.csv",
9402
- uploaded_by: "Eve Smith"
9403
- }, {
9404
- key: "4",
9405
- filename: "sample-4.csv",
9406
- status: "processed",
9407
- rows_count: "40",
9408
- created_at: new Date(),
9409
- download_url: "https://example.com/sample-4.csv",
9410
- uploaded_by: "Anna Smith"
9411
- }, {
9412
- key: "5",
9413
- filename: "sample-5.csv",
9414
- status: "processed",
9415
- rows_count: "50",
9416
- created_at: new Date(),
9417
- download_url: "https://example.com/sample-5.csv",
9418
- uploaded_by: "Will Smith"
9419
- }];
9420
-
9421
- const Uploads = () => /*#__PURE__*/React.createElement("div", {
9422
- className: "ntm-invitations__table"
9423
- }, /*#__PURE__*/React.createElement(Table$1, {
9424
- fixedHeight: true,
9425
- rowData: SAMPLE_ROW_DATA,
9426
- columnData: COLUMN_DATA,
9427
- rowSelection: false
9428
- }));
9429
-
9430
- const Csv = _ref => {
9431
- let label = _ref.label,
9432
- sampleFileUrl = _ref.sampleFileUrl,
9433
- csvColumns = _ref.csvColumns,
9434
- setIsCSVInviteSelected = _ref.setIsCSVInviteSelected;
9435
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Button, {
9436
- size: "small",
9437
- style: "text",
9438
- icon: LeftArrow,
9439
- onClick: () => setIsCSVInviteSelected(false)
9440
- })), /*#__PURE__*/React.createElement(Modal.Body, {
9441
- className: "ntm-invitations__body"
9442
- }, /*#__PURE__*/React.createElement(Typography, {
9443
- style: "h4"
9444
- }, instance.t("common.upload_", {
9445
- what: label
9446
- })), /*#__PURE__*/React.createElement(Uploader, {
9447
- sampleFileUrl: sampleFileUrl,
9448
- csvColumns: csvColumns
9449
- })), /*#__PURE__*/React.createElement(Modal.Footer, {
9450
- className: "ntm-invitations__footer"
9451
- }, /*#__PURE__*/React.createElement(Uploads, null)));
9452
- };
9453
-
9454
- /* eslint-disable @bigbinary/neeto/no-dangling-constants */
9455
- const BASE_URL = "team_members";
9456
- const INVITATIONS_URL = "neeto_invitations";
9457
-
9458
- const fetch$3 = params => axios.get(`${INVITATIONS_URL}/invite_links`, {
9459
- params
9460
- });
9461
- const create$2 = payload => axios.post(`${INVITATIONS_URL}/invite_links`, payload);
9462
- const destroy$1 = (id, payload) => axios.delete(`${INVITATIONS_URL}/invite_links/${id}`, payload);
9463
- const inviteLinksApi = {
9464
- fetch: fetch$3,
9465
- create: create$2,
9466
- destroy: destroy$1
9467
- };
9468
-
9469
- const DEFAULT_STALE_TIME = 300000; // 5 minutes
9470
- const INVITATIONS_STALE_TIME = 3600000; //1 hour
9471
-
9472
- const QUERY_KEYS = {
9473
- TEAMS: "neeto-team-members-teams",
9474
- ROLES: "neeto-team-members-roles",
9475
- PERMISSIONS: "neeto-team-members-permissions",
9476
- INVITE_LINKS: "neeto-team-members-invite-links"
9477
- };
9478
-
9479
- function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9480
- function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9481
- const useFetchInviteLink = function () {
9482
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9483
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9484
- return useQuery([QUERY_KEYS.INVITE_LINKS, params], () => inviteLinksApi.fetch(params), _objectSpread$7({
9485
- staleTime: INVITATIONS_STALE_TIME,
9486
- select: prop("inviteLink"),
9487
- retry: false
9488
- }, options));
9489
- };
9490
- const useCreateInviteLink = () => useMutation(inviteLinksApi.create, {
9491
- onSuccess: _ref => {
9492
- let inviteLink = _ref.inviteLink;
9493
- const resourceType = inviteLink.resourceType,
9494
- resourceId = inviteLink.resourceId;
9495
- queryClient.setQueryData([QUERY_KEYS.INVITE_LINKS, {
9496
- resource_type: resourceType,
9497
- resource_id: resourceId
9498
- }], {
9499
- inviteLink
9500
- });
9501
- }
9502
- });
9503
- const useDestroyInviteLink = () => useMutation(inviteLinksApi.destroy, {
9504
- onSuccess: _ref2 => {
9505
- let inviteLink = _ref2.inviteLink;
9506
- const resourceType = inviteLink.resourceType,
9507
- resourceId = inviteLink.resourceId;
9508
- queryClient.invalidateQueries([QUERY_KEYS.INVITE_LINKS, {
9509
- resource_type: resourceType,
9510
- resource_id: resourceId
9511
- }]);
9512
- }
9513
- });
9514
-
9515
- var dist$1 = {exports: {}};
9516
-
9517
- (function (module, exports) {
9518
- !function(e,t){module.exports=t(React);}("undefined"!=typeof self?self:commonjsGlobal,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(t,r){t.exports=e;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Validate=t.Time=void 0;var n=u(r(5)),o=u(r(6));function u(e){return e&&e.__esModule?e:{default:e}}t.Time=n.default,t.Validate=o.default;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.useInterval=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(r(7));t.useInterval=n.default;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.useTime=t.useStopwatch=t.useTimer=void 0;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e};t.default=function(e){if((0, o.useEffect)(function(){console.warn("react-timer-hook: default export useTimer is deprecated, use named exports { useTimer, useStopwatch, useTime } instead");},[]),e.expiryTimestamp){var t=(0, u.default)(e);return n({},t,{startTimer:t.start,stopTimer:t.pause,resetTimer:function(){}})}var r=(0, i.default)(e);return n({},r,{startTimer:r.start,stopTimer:r.pause,resetTimer:r.reset})};var o=r(0),u=c(r(4)),i=c(r(8)),a=c(r(9));function c(e){return e&&e.__esModule?e:{default:e}}t.useTimer=u.default,t.useStopwatch=i.default,t.useTime=a.default;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e;}finally{try{!n&&a.return&&a.return();}finally{if(o)throw u}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=function(e){var t=e.expiryTimestamp,r=e.onExpire,s=e.autoStart,l=void 0===s||s,d=(0, u.useState)(t),m=o(d,2),v=m[0],p=m[1],y=(0, u.useState)(i.Time.getSecondsFromExpiry(v)),T=o(y,2),g=T[0],b=T[1],h=(0, u.useState)(l),S=o(h,2),w=S[0],O=S[1],j=(0, u.useState)(l),x=o(j,2),_=x[0],M=x[1],P=(0, u.useState)(f(v)),F=o(P,2),E=F[0],k=F[1];function I(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];k(f(e)),M(t),O(t),p(e),b(i.Time.getSecondsFromExpiry(e));}function D(){var e=new Date;e.setMilliseconds(e.getMilliseconds()+1e3*g),I(e);}return (0, a.useInterval)(function(){E!==c&&k(c);var e=i.Time.getSecondsFromExpiry(v);b(e),e<=0&&(i.Validate.onExpire(r)&&r(),O(!1),k(null));},w?E:null),n({},i.Time.getTimeFromSeconds(g),{start:function(){_?(b(i.Time.getSecondsFromExpiry(v)),O(!0)):D();},pause:function(){O(!1);},resume:D,restart:I,isRunning:w})};var u=r(0),i=r(1),a=r(2),c=1e3;function f(e){if(!i.Validate.expiryTimestamp(e))return null;var t=i.Time.getSecondsFromExpiry(e),r=Math.floor(1e3*(t-Math.floor(t)));return r>0?r:c}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);}return n(e,null,[{key:"getTimeFromSeconds",value:function(e){var t=Math.ceil(e),r=Math.floor(t/86400),n=Math.floor(t%86400/3600),o=Math.floor(t%3600/60);return {seconds:Math.floor(t%60),minutes:o,hours:n,days:r}}},{key:"getSecondsFromExpiry",value:function(e,t){var r=e-(new Date).getTime();if(r>0){var n=r/1e3;return t?Math.round(n):n}return 0}},{key:"getSecondsFromPrevTime",value:function(e,t){var r=(new Date).getTime()-e;if(r>0){var n=r/1e3;return t?Math.round(n):n}return 0}},{key:"getSecondsFromTimeNow",value:function(){var e=new Date;return e.getTime()/1e3-60*e.getTimezoneOffset()}},{key:"getFormattedTimeFromSeconds",value:function(t,r){var n=e.getTimeFromSeconds(t),o=n.seconds,u=n.minutes,i=n.hours,a="",c=i;return "12-hour"===r&&(a=i>=12?"pm":"am",c=i%12),{seconds:o,minutes:u,hours:c,ampm:a}}}]),e}();t.default=o;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);}return n(e,null,[{key:"expiryTimestamp",value:function(e){var t=new Date(e).getTime()>0;return t||console.warn("react-timer-hook: { useTimer } Invalid expiryTimestamp settings",e),t}},{key:"onExpire",value:function(e){var t=e&&"function"==typeof e;return e&&!t&&console.warn("react-timer-hook: { useTimer } Invalid onExpire settings function",e),t}}]),e}();t.default=o;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=(0, n.useRef)();(0, n.useEffect)(function(){r.current=e;}),(0, n.useEffect)(function(){if(!t)return function(){};var e=setInterval(function(){r.current&&r.current();},t);return function(){return clearInterval(e)}},[t]);};var n=r(0);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e;}finally{try{!n&&a.return&&a.return();}finally{if(o)throw u}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=function(e){var t=e.autoStart,r=e.offsetTimestamp,c=(0, u.useState)(i.Time.getSecondsFromExpiry(r,!0)||0),f=o(c,2),s=f[0],l=f[1],d=(0, u.useState)(new Date),m=o(d,2),v=m[0],p=m[1],y=(0, u.useState)(s+i.Time.getSecondsFromPrevTime(v||0,!0)),T=o(y,2),g=T[0],b=T[1],h=(0, u.useState)(t),S=o(h,2),w=S[0],O=S[1];return (0, a.useInterval)(function(){b(s+i.Time.getSecondsFromPrevTime(v,!0));},w?1e3:null),n({},i.Time.getTimeFromSeconds(g),{start:function(){var e=new Date;p(e),O(!0),b(s+i.Time.getSecondsFromPrevTime(e,!0));},pause:function(){l(g),O(!1);},reset:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=i.Time.getSecondsFromExpiry(e,!0)||0,n=new Date;p(n),l(r),O(t),b(r+i.Time.getSecondsFromPrevTime(n,!0));},isRunning:w})};var u=r(0),i=r(1),a=r(2);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e;}finally{try{!n&&a.return&&a.return();}finally{if(o)throw u}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=function(e){var t=e.format,r=(0, u.useState)(i.Time.getSecondsFromTimeNow()),c=o(r,2),f=c[0],s=c[1];return (0, a.useInterval)(function(){s(i.Time.getSecondsFromTimeNow());},1e3),n({},i.Time.getFormattedTimeFromSeconds(f,t))};var u=r(0),i=r(1),a=r(2);}])});
9519
- } (dist$1));
9520
-
9521
- const renderTime = time => {
9522
- if (time.days) return `${time.days}d ${time.hours}h`;else if (time.hours) return `${time.hours}h ${time.minutes}m`;
9523
- return `${time.minutes}m ${time.seconds}s`;
9524
- };
9525
-
9526
- const Timer = _ref => {
9527
- let expiresAt = _ref.expiresAt;
9528
- const _useTimer = dist$1.exports.useTimer({
9529
- expiryTimestamp: new Date(expiresAt)
9530
- }),
9531
- seconds = _useTimer.seconds,
9532
- minutes = _useTimer.minutes,
9533
- hours = _useTimer.hours,
9534
- days = _useTimer.days;
9535
- return /*#__PURE__*/React.createElement(Typography, {
9536
- style: "body3"
9537
- }, /*#__PURE__*/React.createElement(React.Fragment, null, instance.t("helpers.expiresIn"), renderTime({
9538
- days,
9539
- hours,
9540
- minutes,
9541
- seconds
9542
- })));
9543
- };
9544
-
9545
- const InviteLink = _ref => {
9546
- let resourceType = _ref.resourceType,
9547
- resourceId = _ref.resourceId;
9548
- const _useFetchInviteLink = useFetchInviteLink({
9549
- resource_type: resourceType,
9550
- resource_id: resourceId
9551
- }),
9552
- inviteLink = _useFetchInviteLink.data,
9553
- isLoading = _useFetchInviteLink.isLoading;
9554
- const _useCreateInviteLink = useCreateInviteLink(),
9555
- createInviteLink = _useCreateInviteLink.mutate,
9556
- isCreating = _useCreateInviteLink.isLoading;
9557
- const _useDestroyInviteLink = useDestroyInviteLink(),
9558
- deleteInviteLink = _useDestroyInviteLink.mutate,
9559
- isDeleting = _useDestroyInviteLink.isLoading;
9560
- const showInviteLink = inviteLink && new Date(inviteLink.expiresAt) > new Date();
9561
- const handleCopyInviteLink = () => {
9562
- navigator.clipboard.writeText(`${window.location.host}/neeto_invitations/${inviteLink.id}`);
9563
- Toastr.info(instance.t("helpers.copiedToClipboard"));
9564
- };
9565
- return /*#__PURE__*/React.createElement("div", {
9566
- className: "ntm-invitations__invite-link"
9567
- }, /*#__PURE__*/React.createElement("div", {
9568
- className: "ntm-invitations__invite-link-instructions"
9569
- }, /*#__PURE__*/React.createElement(Typography, {
9570
- style: "h4"
9571
- }, instance.t("helpers.getInviteLink")), /*#__PURE__*/React.createElement(Typography, {
9572
- style: "body2"
9573
- }, instance.t("helpers.inviteLinkInstruction"))), showInviteLink ? /*#__PURE__*/React.createElement("div", {
9574
- className: "ntm-invitations__invite-link-btns"
9575
- }, /*#__PURE__*/React.createElement(Timer, {
9576
- expiresAt: inviteLink.expiresAt
9577
- }), /*#__PURE__*/React.createElement(Button, {
9578
- style: "danger-text",
9579
- label: instance.t("common.delete"),
9580
- loading: isDeleting,
9581
- disabled: isDeleting,
9582
- onClick: () => deleteInviteLink(inviteLink.id)
9583
- }), /*#__PURE__*/React.createElement(Button, {
9584
- style: "primary",
9585
- label: instance.t("buttons.copyLink"),
9586
- onClick: handleCopyInviteLink
9587
- })) : /*#__PURE__*/React.createElement(Button, {
9588
- style: "secondary",
9589
- loading: isLoading || isCreating,
9590
- disabled: isLoading || isCreating,
9591
- label: instance.t("buttons.createLink"),
9592
- onClick: () => createInviteLink({
9593
- inviteLink: {
9594
- resourceType,
9595
- resourceId
9596
- }
9597
- })
9598
- }));
9599
- };
9600
-
9601
- const Normal = _ref => {
9602
- let label = _ref.label,
9603
- children = _ref.children,
9604
- submitButtonProps = _ref.submitButtonProps,
9605
- setIsCSVInviteSelected = _ref.setIsCSVInviteSelected,
9606
- isCSVInviteEnabled = _ref.isCSVInviteEnabled,
9607
- isInviteLinkEnabled = _ref.isInviteLinkEnabled,
9608
- _ref$inviteLinkProps = _ref.inviteLinkProps,
9609
- inviteLinkProps = _ref$inviteLinkProps === void 0 ? {} : _ref$inviteLinkProps;
9610
- const _useFormikContext = useFormikContext(),
9611
- isSubmitting = _useFormikContext.isSubmitting,
9612
- dirty = _useFormikContext.dirty;
9613
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement("div", {
9614
- className: "ntm-invitations__header"
9615
- })), /*#__PURE__*/React.createElement(Modal.Body, {
9616
- className: "ntm-invitations__body"
9617
- }, /*#__PURE__*/React.createElement("div", {
9618
- className: "ntm-invitations__body-header"
9619
- }, /*#__PURE__*/React.createElement(Typography, {
9620
- style: "h4"
9621
- }, instance.t("common.invite_", {
9622
- what: label.toLowerCase()
9623
- })), isCSVInviteEnabled && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
9624
- style: "body2"
9625
- }, instance.t("buttons.inviteFrom")), /*#__PURE__*/React.createElement(Button, {
9626
- style: "secondary",
9627
- icon: File,
9628
- onClick: () => setIsCSVInviteSelected(true),
9629
- tooltipProps: {
9630
- content: instance.t("helpers.bulkInvite"),
9631
- placement: "bottom"
9632
- }
9633
- }))), /*#__PURE__*/React.createElement(EmailInput, {
9634
- name: "emails",
9635
- label: null,
9636
- placeholder: instance.t("placeholders.email")
9637
- }), /*#__PURE__*/React.createElement(Button, _extends({
9638
- type: "submit",
9639
- label: instance.t("buttons.sendInvites"),
9640
- className: "ntm-invitations__submit-btn",
9641
- loading: isSubmitting,
9642
- disabled: !dirty || isSubmitting
9643
- }, submitButtonProps)), children), /*#__PURE__*/React.createElement(Modal.Footer, {
9644
- className: classnames({
9645
- "ntm-invitations__footer": isInviteLinkEnabled
9646
- })
9647
- }, isInviteLinkEnabled && /*#__PURE__*/React.createElement(InviteLink, inviteLinkProps)));
9648
- };
9649
-
9650
- const _excluded$2 = ["label", "isOpen", "onClose", "submitButtonProps", "csvColumns", "sampleFileUrl", "isCSVInviteEnabled", "isInviteLinkEnabled", "inviteLinkProps", "children"];
9651
- const Invitations = _ref => {
9652
- let _ref$label = _ref.label,
9653
- label = _ref$label === void 0 ? instance.t("metaNames.member", PLURAL) : _ref$label,
9654
- _ref$isOpen = _ref.isOpen,
9655
- isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
9656
- _ref$onClose = _ref.onClose,
9657
- onClose = _ref$onClose === void 0 ? noop$2 : _ref$onClose,
9658
- _ref$submitButtonProp = _ref.submitButtonProps,
9659
- submitButtonProps = _ref$submitButtonProp === void 0 ? {} : _ref$submitButtonProp,
9660
- _ref$csvColumns = _ref.csvColumns,
9661
- csvColumns = _ref$csvColumns === void 0 ? [] : _ref$csvColumns,
9662
- _ref$sampleFileUrl = _ref.sampleFileUrl,
9663
- sampleFileUrl = _ref$sampleFileUrl === void 0 ? "" : _ref$sampleFileUrl,
9664
- _ref$isCSVInviteEnabl = _ref.isCSVInviteEnabled,
9665
- isCSVInviteEnabled = _ref$isCSVInviteEnabl === void 0 ? true : _ref$isCSVInviteEnabl,
9666
- _ref$isInviteLinkEnab = _ref.isInviteLinkEnabled,
9667
- isInviteLinkEnabled = _ref$isInviteLinkEnab === void 0 ? true : _ref$isInviteLinkEnab,
9668
- _ref$inviteLinkProps = _ref.inviteLinkProps,
9669
- inviteLinkProps = _ref$inviteLinkProps === void 0 ? {} : _ref$inviteLinkProps,
9670
- children = _ref.children,
9671
- otherProps = _objectWithoutProperties$1(_ref, _excluded$2);
9672
- const _useState = useState(false),
9673
- _useState2 = _slicedToArray$2(_useState, 2),
9674
- isCSVInviteSelected = _useState2[0],
9675
- setIsCSVInviteSelected = _useState2[1];
9676
- const handleClose = () => {
9677
- onClose();
9678
- setIsCSVInviteSelected(false);
9679
- };
9680
- return /*#__PURE__*/React.createElement(Formik, {
9681
- initialValues: {
9682
- emails: []
9683
- },
9684
- onSubmit: noop$2
9685
- }, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Modal, _extends({
9686
- isOpen: isOpen,
9687
- onClose: handleClose,
9688
- size: "large"
9689
- }, otherProps), /*#__PURE__*/React.createElement("div", {
9690
- className: "ntm-invitations__wrapper"
9691
- }, isCSVInviteSelected ? /*#__PURE__*/React.createElement(Csv, {
9692
- label: label,
9693
- csvColumns: csvColumns,
9694
- sampleFileUrl: sampleFileUrl,
9695
- setIsCSVInviteSelected: setIsCSVInviteSelected
9696
- }) : /*#__PURE__*/React.createElement(Normal, {
9697
- label: label,
9698
- submitButtonProps: submitButtonProps,
9699
- setIsCSVInviteSelected: setIsCSVInviteSelected,
9700
- isCSVInviteEnabled: isCSVInviteEnabled,
9701
- isInviteLinkEnabled: isInviteLinkEnabled,
9702
- inviteLinkProps: inviteLinkProps
9703
- }, children)))));
9704
- };
9705
- var index$2 = withReactQuery(Invitations);
9706
-
9707
- const fetch$2 = () => axios.get(`${BASE_URL}/permissions`);
9708
- const permissionsApi = {
9709
- fetch: fetch$2
9710
- };
9711
-
9712
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9713
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9714
- const useFetchPermissions = function () {
9715
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9716
- return useQuery(QUERY_KEYS.PERMISSIONS, permissionsApi.fetch, _objectSpread$6({
9717
- staleTime: DEFAULT_STALE_TIME,
9718
- select: response => response.permissions || response.data.permissions
9719
- }, options));
9720
- };
9721
-
9722
- const fetch$1 = () => axios.get(`${BASE_URL}/organization_roles`);
9723
- const create$1 = payload => axios.post(`${BASE_URL}/organization_roles`, payload);
9724
- const update$1 = (id, payload) => axios.patch(`${BASE_URL}/organization_roles/${id}`, payload);
9725
- const destroy = (id, payload) => axios.delete(`${BASE_URL}/organization_roles/${id}`, {
9726
- data: payload
9727
- });
9728
- const organizationRolesApi = {
9729
- fetch: fetch$1,
9730
- create: create$1,
9731
- update: update$1,
9732
- destroy
9733
- };
9734
-
9735
- const _excluded$1 = ["onSuccess"],
9736
- _excluded2$1 = ["onSuccess"],
9737
- _excluded3 = ["onSuccess"];
9738
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9739
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9740
- const useFetchRoles = function () {
9741
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9742
- return useQuery(QUERY_KEYS.ROLES, organizationRolesApi.fetch, _objectSpread$5({
9743
- staleTime: DEFAULT_STALE_TIME,
9744
- select: response => response.organizationRoles || response.data.organizationRoles
9745
- }, options));
9746
- };
9747
- const useCreateRole = _ref => {
9748
- let onSuccess = _ref.onSuccess,
9749
- options = _objectWithoutProperties$1(_ref, _excluded$1);
9750
- return useMutation(organizationRolesApi.create, _objectSpread$5({
9751
- onSuccess: response => {
9752
- queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
9753
- if (!!cachedData.data && !!cachedData.data.organizationRoles) {
9754
- return modifyPath(["data", "organizationRoles"], prepend(response.data.organizationRole), cachedData);
9755
- }
9756
- return modifyPath(["organizationRoles"], prepend(response.organizationRole), cachedData);
9757
- });
9758
- Toastr.success(response.ntmNotice || response.data.ntmNotice);
9759
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
9760
- }
9761
- }, options));
9762
- };
9763
- const useUpdateRole = _ref2 => {
9764
- let onSuccess = _ref2.onSuccess,
9765
- options = _objectWithoutProperties$1(_ref2, _excluded2$1);
9766
- return useMutation(_ref3 => {
9767
- let id = _ref3.id,
9768
- payload = _ref3.payload;
9769
- return organizationRolesApi.update(id, payload);
9770
- }, _objectSpread$5({
9771
- onSuccess: response => {
9772
- queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
9773
- queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
9774
- if (!!cachedData.data && !!cachedData.data.organizationRoles) {
9775
- return assocPath(["data", "organizationRoles", findIndex(propEq("id", response.data.organizationRole.id), cachedData.data.organizationRoles)], response.data.organizationRole, cachedData);
9776
- }
9777
- return assocPath(["organizationRoles", findIndex(propEq("id", response.organizationRole.id), cachedData.organizationRoles)], response.organizationRole, cachedData);
9778
- });
9779
- Toastr.success(response.ntmNotice || response.data.ntmNotice);
9780
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
9781
- }
9782
- }, options));
9783
- };
9784
- const useDestroyRole = _ref4 => {
9785
- let _ref4$onSuccess = _ref4.onSuccess,
9786
- onSuccess = _ref4$onSuccess === void 0 ? noop$2 : _ref4$onSuccess,
9787
- options = _objectWithoutProperties$1(_ref4, _excluded3);
9788
- return useMutation(_ref5 => {
9789
- let id = _ref5.id,
9790
- payload = _ref5.payload;
9791
- return organizationRolesApi.destroy(id, payload);
9792
- }, _objectSpread$5({
9793
- onSuccess: response => {
9794
- queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
9795
- if (!!cachedData.data && !!cachedData.data.organizationRoles) {
9796
- return dissocPath(["data", "organizationRoles", findIndex(propEq("id", response.data.id), cachedData.data.organizationRoles)], cachedData);
9797
- }
9798
- return dissocPath(["organizationRoles", findIndex(propEq("id", response.id), cachedData.organizationRoles)], cachedData);
9799
- });
9800
- Toastr.success(response.ntmNotice || response.data.ntmNotice);
9801
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
9802
- }
9803
- }, options));
9804
- };
7300
+ }, options));
7301
+ };
9805
7302
 
9806
7303
  var dist = {exports: {}};
9807
7304
 
@@ -11244,6 +8741,50 @@ const getPermissionGroups = function () {
11244
8741
  return groupedPermissions;
11245
8742
  };
11246
8743
 
8744
+ const transformObjectToDotNotation = function (object) {
8745
+ let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
8746
+ let result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
8747
+ const errorKey = Object.keys(object).find(key => !!object[key]);
8748
+ if (!errorKey) return;
8749
+ const value = object[errorKey];
8750
+ if (!value) return;
8751
+ const nextKey = prefix ? `${prefix}.${errorKey}` : errorKey;
8752
+ is(Object, value) ? transformObjectToDotNotation(value, nextKey, result) : result.push(nextKey);
8753
+
8754
+ // eslint-disable-next-line consistent-return
8755
+ return result;
8756
+ };
8757
+ const getErrorFieldName = formikErrors => {
8758
+ var _transformObjectToDot;
8759
+ return (_transformObjectToDot = transformObjectToDotNotation(formikErrors)) === null || _transformObjectToDot === void 0 ? void 0 : _transformObjectToDot[0];
8760
+ };
8761
+
8762
+ const ScrollToErrorField = _ref => {
8763
+ let formRef = _ref.formRef;
8764
+ const _useFormikContext = useFormikContext(),
8765
+ submitCount = _useFormikContext.submitCount,
8766
+ isValid = _useFormikContext.isValid,
8767
+ errors = _useFormikContext.errors;
8768
+ const isValidatedReference = useRef(false);
8769
+ useEffect(() => {
8770
+ isValidatedReference.current = false;
8771
+ }, [submitCount]);
8772
+ useEffect(() => {
8773
+ if (!formRef.current) return;
8774
+ if (isValidatedReference.current || isValid) return;
8775
+ isValidatedReference.current = true;
8776
+ const fieldErrorNames = getErrorFieldName(errors);
8777
+ if (fieldErrorNames.length <= 0) return;
8778
+ const errorFormElement = [...formRef.current.elements].find(element => element.name === fieldErrorNames);
8779
+ errorFormElement === null || errorFormElement === void 0 ? void 0 : errorFormElement.scrollIntoView({
8780
+ behavior: "smooth",
8781
+ block: "center"
8782
+ });
8783
+ }, [submitCount, errors]); // eslint-disable-line react-hooks/exhaustive-deps
8784
+
8785
+ return null;
8786
+ };
8787
+
11247
8788
  const ADD_ROLE_FORM_INITIAL_VALUES = {
11248
8789
  name: "",
11249
8790
  description: "",
@@ -11316,13 +8857,14 @@ const Permissions = _ref => {
11316
8857
  };
11317
8858
 
11318
8859
  function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11319
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8860
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11320
8861
  const New = _ref => {
11321
8862
  let isOpen = _ref.isOpen,
11322
8863
  onClose = _ref.onClose,
11323
8864
  permissions = _ref.permissions;
11324
8865
  const _useTranslation = useTranslation(),
11325
8866
  t = _useTranslation.t;
8867
+ const formReference = useRef(null);
11326
8868
  const _useCreateRole = useCreateRole({
11327
8869
  onSuccess: onClose
11328
8870
  }),
@@ -11345,16 +8887,19 @@ const New = _ref => {
11345
8887
  }, t("common.add_", {
11346
8888
  what: t("common.role", SINGULAR).toLocaleLowerCase()
11347
8889
  }))), /*#__PURE__*/React.createElement(Formik, {
11348
- validateOnChange: false,
11349
- validateOnBlur: false,
11350
8890
  initialValues: ADD_ROLE_FORM_INITIAL_VALUES,
11351
- validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA,
11352
- onSubmit: handleFormSubmit
8891
+ onSubmit: handleFormSubmit,
8892
+ validateOnBlur: false,
8893
+ validateOnChange: false,
8894
+ validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA
11353
8895
  }, _ref2 => {
11354
8896
  let dirty = _ref2.dirty;
11355
8897
  return /*#__PURE__*/React.createElement(Form, {
8898
+ ref: formReference,
11356
8899
  noValidate: true
11357
- }, /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
8900
+ }, /*#__PURE__*/React.createElement(ScrollToErrorField, {
8901
+ formRef: formReference
8902
+ }), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
11358
8903
  className: "ntm-roles-pane__body"
11359
8904
  }, /*#__PURE__*/React.createElement("div", {
11360
8905
  className: "ntm-roles-pane__body-wrapper"
@@ -11686,13 +9231,14 @@ const Delete = _ref => {
11686
9231
  };
11687
9232
 
11688
9233
  function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11689
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9234
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11690
9235
  const Edit = _ref => {
11691
9236
  let isOpen = _ref.isOpen,
11692
9237
  onClose = _ref.onClose,
11693
9238
  selectedRole = _ref.selectedRole;
11694
9239
  const _useTranslation = useTranslation(),
11695
9240
  t = _useTranslation.t;
9241
+ const formReference = useRef(null);
11696
9242
  const _useUpdateRole = useUpdateRole({
11697
9243
  onSuccess: onClose
11698
9244
  }),
@@ -11713,24 +9259,29 @@ const Edit = _ref => {
11713
9259
  payload
11714
9260
  });
11715
9261
  };
11716
- return /*#__PURE__*/React.createElement(Modal, {
9262
+ return /*#__PURE__*/React.createElement(Pane, {
11717
9263
  isOpen: isOpen,
11718
9264
  onClose: onClose
11719
- }, /*#__PURE__*/React.createElement(Formik, {
9265
+ }, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
9266
+ "data-cy": "ntm-update-role-title",
9267
+ style: "h2"
9268
+ }, t("common.update_", {
9269
+ what: t("common.role", SINGULAR).toLocaleLowerCase()
9270
+ }))), /*#__PURE__*/React.createElement(Formik, {
11720
9271
  initialValues: initialValues,
11721
- validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA,
11722
- onSubmit: handleFormSubmit
9272
+ onSubmit: handleFormSubmit,
9273
+ validateOnBlur: false,
9274
+ validateOnChange: false,
9275
+ validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA
11723
9276
  }, _ref2 => {
11724
9277
  let dirty = _ref2.dirty;
11725
9278
  return /*#__PURE__*/React.createElement(Form, {
9279
+ ref: formReference,
11726
9280
  noValidate: true
11727
- }, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Typography, {
11728
- "data-cy": "ntm-update-role-title",
11729
- style: "h2"
11730
- }, t("common.update_", {
11731
- what: t("common.role", SINGULAR).toLocaleLowerCase()
11732
- }))), /*#__PURE__*/React.createElement(Modal.Body, null, /*#__PURE__*/React.createElement("div", {
11733
- className: "ntm-roles-modal__body"
9281
+ }, /*#__PURE__*/React.createElement(ScrollToErrorField, {
9282
+ formRef: formReference
9283
+ }), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
9284
+ className: "ntm-roles-pane__body"
11734
9285
  }, /*#__PURE__*/React.createElement(Input, {
11735
9286
  required: true,
11736
9287
  "data-cy": "ntm-update-role-name-text-field",
@@ -11744,8 +9295,8 @@ const Edit = _ref => {
11744
9295
  maxLength: 255,
11745
9296
  name: "description",
11746
9297
  placeholder: t("placeholders.enterDescription")
11747
- }))), /*#__PURE__*/React.createElement(Modal.Footer, null, /*#__PURE__*/React.createElement("div", {
11748
- className: "ntm-roles-modal__footer"
9298
+ }))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement("div", {
9299
+ className: "ntm-roles-pane__footer"
11749
9300
  }, /*#__PURE__*/React.createElement(Button, {
11750
9301
  "data-cy": "ntm-update-role-submit-button",
11751
9302
  disabled: !dirty || isSubmitting,
@@ -11761,14 +9312,14 @@ const Edit = _ref => {
11761
9312
  }));
11762
9313
  };
11763
9314
 
11764
- const Columns = _ref => {
9315
+ const Columns$1 = _ref => {
11765
9316
  let config = _ref.config,
11766
9317
  filteredGroupPermissions = _ref.filteredGroupPermissions,
11767
9318
  filteredRoles = _ref.filteredRoles,
11768
9319
  roles = _ref.roles,
11769
9320
  setIsScrollPresent = _ref.setIsScrollPresent;
11770
9321
  const _useState = useState(DEFAULT_MANAGE_ROLE_VALUES),
11771
- _useState2 = _slicedToArray$2(_useState, 2),
9322
+ _useState2 = _slicedToArray(_useState, 2),
11772
9323
  manageRole = _useState2[0],
11773
9324
  setManageRole = _useState2[1];
11774
9325
  const categories = Object.keys(filteredGroupPermissions);
@@ -11908,15 +9459,15 @@ const Table = _ref => {
11908
9459
  const _useTranslation = useTranslation(),
11909
9460
  t = _useTranslation.t;
11910
9461
  const _useState = useState(""),
11911
- _useState2 = _slicedToArray$2(_useState, 2),
9462
+ _useState2 = _slicedToArray(_useState, 2),
11912
9463
  searchTerm = _useState2[0],
11913
9464
  setSearchTerm = _useState2[1];
11914
9465
  const _useState3 = useState(permissionGroups),
11915
- _useState4 = _slicedToArray$2(_useState3, 2),
9466
+ _useState4 = _slicedToArray(_useState3, 2),
11916
9467
  filteredGroupPermissions = _useState4[0],
11917
9468
  setFilteredGroupPermissions = _useState4[1];
11918
9469
  const _useState5 = useState(false),
11919
- _useState6 = _slicedToArray$2(_useState5, 2),
9470
+ _useState6 = _slicedToArray(_useState5, 2),
11920
9471
  isScrollPresent = _useState6[0],
11921
9472
  setIsScrollPresent = _useState6[1];
11922
9473
  const toggleDropdown = category => {
@@ -11924,7 +9475,7 @@ const Table = _ref => {
11924
9475
  };
11925
9476
  useEffect(() => {
11926
9477
  setFilteredGroupPermissions(fromPairs(toPairs(permissionGroups).map(_ref2 => {
11927
- let _ref3 = _slicedToArray$2(_ref2, 2),
9478
+ let _ref3 = _slicedToArray(_ref2, 2),
11928
9479
  category = _ref3[0],
11929
9480
  options = _ref3[1];
11930
9481
  return [category, modify("permissions", filter(_ref4 => {
@@ -11949,7 +9500,7 @@ const Table = _ref => {
11949
9500
  onClick: () => setIsNewRolePaneOpen(true),
11950
9501
  permissions: config === null || config === void 0 ? void 0 : config.permissions
11951
9502
  })
11952
- }) : /*#__PURE__*/React.createElement(Columns, {
9503
+ }) : /*#__PURE__*/React.createElement(Columns$1, {
11953
9504
  config: config,
11954
9505
  filteredGroupPermissions: filteredGroupPermissions,
11955
9506
  filteredRoles: filteredRoles,
@@ -11962,15 +9513,15 @@ const Roles = _ref => {
11962
9513
  var _config$permissions$v, _config$permissions, _config$permissions$v2, _config$permissions2;
11963
9514
  let config = _ref.config;
11964
9515
  const _useState = useState(""),
11965
- _useState2 = _slicedToArray$2(_useState, 2),
9516
+ _useState2 = _slicedToArray(_useState, 2),
11966
9517
  searchString = _useState2[0],
11967
9518
  setSearchString = _useState2[1];
11968
9519
  const _useState3 = useState([]),
11969
- _useState4 = _slicedToArray$2(_useState3, 2),
9520
+ _useState4 = _slicedToArray(_useState3, 2),
11970
9521
  filteredRoles = _useState4[0],
11971
9522
  setFilteredRoles = _useState4[1];
11972
9523
  const _useState5 = useState(false),
11973
- _useState6 = _slicedToArray$2(_useState5, 2),
9524
+ _useState6 = _slicedToArray(_useState5, 2),
11974
9525
  isNewRolePaneOpen = _useState6[0],
11975
9526
  setIsNewRolePaneOpen = _useState6[1];
11976
9527
  const _useFetchRoles = useFetchRoles({
@@ -12036,7 +9587,7 @@ const teamsApi = {
12036
9587
  const _excluded = ["onSuccess"],
12037
9588
  _excluded2 = ["onSuccess"];
12038
9589
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12039
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9590
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12040
9591
  const useFetchMembers = function () {
12041
9592
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12042
9593
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -12048,7 +9599,7 @@ const useFetchMembers = function () {
12048
9599
  };
12049
9600
  const useCreateMember = _ref => {
12050
9601
  let onSuccess = _ref.onSuccess,
12051
- options = _objectWithoutProperties$1(_ref, _excluded);
9602
+ options = _objectWithoutProperties(_ref, _excluded);
12052
9603
  return useMutation(teamsApi.create, _objectSpread$2({
12053
9604
  onSuccess: response => {
12054
9605
  queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
@@ -12059,7 +9610,7 @@ const useCreateMember = _ref => {
12059
9610
  };
12060
9611
  const useUpdateMember = _ref2 => {
12061
9612
  let onSuccess = _ref2.onSuccess,
12062
- options = _objectWithoutProperties$1(_ref2, _excluded2);
9613
+ options = _objectWithoutProperties(_ref2, _excluded2);
12063
9614
  return useMutation(_ref3 => {
12064
9615
  let id = _ref3.id,
12065
9616
  payload = _ref3.payload;
@@ -12076,7 +9627,7 @@ const useUpdateMember = _ref2 => {
12076
9627
  const useDebounce = function (value) {
12077
9628
  let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 350;
12078
9629
  const _useState = useState(value),
12079
- _useState2 = _slicedToArray$2(_useState, 2),
9630
+ _useState2 = _slicedToArray(_useState, 2),
12080
9631
  debouncedValue = _useState2[0],
12081
9632
  setDebouncedValue = _useState2[1];
12082
9633
  useEffect(() => {
@@ -12091,7 +9642,7 @@ const Header = _ref => {
12091
9642
  let _ref$metaName = _ref.metaName,
12092
9643
  metaName = _ref$metaName === void 0 ? "" : _ref$metaName,
12093
9644
  _ref$onClick = _ref.onClick,
12094
- onClick = _ref$onClick === void 0 ? noop$2 : _ref$onClick,
9645
+ onClick = _ref$onClick === void 0 ? noop$1 : _ref$onClick,
12095
9646
  permissions = _ref.permissions;
12096
9647
  return /*#__PURE__*/React.createElement(Tooltip, {
12097
9648
  content: instance.t("tooltips.noPermissionToAddMember"),
@@ -12107,6 +9658,151 @@ const Header = _ref => {
12107
9658
  })));
12108
9659
  };
12109
9660
 
9661
+ const getStorageValue = (key, defaultValue) => {
9662
+ const saved = localStorage.getItem(key);
9663
+ return JSON.parse(saved) || defaultValue;
9664
+ };
9665
+ const useLocalStorage = (key, defaultValue) => {
9666
+ const _useState = useState(() => getStorageValue(key, defaultValue)),
9667
+ _useState2 = _slicedToArray(_useState, 2),
9668
+ storedValue = _useState2[0],
9669
+ setStoredValue = _useState2[1];
9670
+ const setValue = value => {
9671
+ if (isNil(value)) {
9672
+ localStorage.removeItem(key);
9673
+ } else {
9674
+ localStorage.setItem(key, JSON.stringify(value));
9675
+ }
9676
+ setStoredValue(value);
9677
+ };
9678
+ return [storedValue, setValue];
9679
+ };
9680
+
9681
+ const matchesImpl = function (pattern, object) {
9682
+ let __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
9683
+ if (object === pattern) return true;
9684
+ if (typeof pattern === "function" && pattern(object, __parent)) return true;
9685
+ if (isNil(pattern) || isNil(object)) return false;
9686
+ if (typeof pattern !== "object") return false;
9687
+ return Object.entries(pattern).every(_ref => {
9688
+ let _ref2 = _slicedToArray(_ref, 2),
9689
+ key = _ref2[0],
9690
+ value = _ref2[1];
9691
+ return matchesImpl(value, object[key], __parent);
9692
+ });
9693
+ };
9694
+ const matches = curry((pattern, object) => matchesImpl(pattern, object));
9695
+ const isNotEmpty = complement(isEmpty);
9696
+ const removeBy = curry((pattern, array) => array.filter(complement(matches(pattern))));
9697
+ const removeFixedColumns = (fixedColumns, columnData) => removeBy({
9698
+ dataIndex: includes(__, fixedColumns)
9699
+ }, columnData);
9700
+ const filterBySearchTerm = (searchTerm, columns) => filter(_ref3 => {
9701
+ let title = _ref3.title;
9702
+ return includes(trim(toLower(searchTerm)), trim(toLower(title)));
9703
+ }, columns);
9704
+
9705
+ const Columns = _ref => {
9706
+ let actionBlock = _ref.actionBlock,
9707
+ _ref$checkboxProps = _ref.checkboxProps,
9708
+ checkboxProps = _ref$checkboxProps === void 0 ? {} : _ref$checkboxProps,
9709
+ _ref$columnData = _ref.columnData,
9710
+ columnData = _ref$columnData === void 0 ? [] : _ref$columnData,
9711
+ _ref$dropdownProps = _ref.dropdownProps,
9712
+ dropdownProps = _ref$dropdownProps === void 0 ? {} : _ref$dropdownProps,
9713
+ _ref$fixedColumns = _ref.fixedColumns,
9714
+ fixedColumns = _ref$fixedColumns === void 0 ? [] : _ref$fixedColumns,
9715
+ _ref$isSearchable = _ref.isSearchable,
9716
+ isSearchable = _ref$isSearchable === void 0 ? false : _ref$isSearchable,
9717
+ _ref$localStorageKey = _ref.localStorageKey,
9718
+ localStorageKey = _ref$localStorageKey === void 0 ? "" : _ref$localStorageKey,
9719
+ _ref$noColumnMessage = _ref.noColumnMessage,
9720
+ noColumnMessage = _ref$noColumnMessage === void 0 ? "No columns found!" : _ref$noColumnMessage,
9721
+ _ref$onChange = _ref.onChange,
9722
+ onChange = _ref$onChange === void 0 ? identity : _ref$onChange,
9723
+ _ref$searchProps = _ref.searchProps,
9724
+ searchProps = _ref$searchProps === void 0 ? {} : _ref$searchProps;
9725
+ // @ts-ignore
9726
+ const Divider = Dropdown.Divider,
9727
+ Menu = Dropdown.Menu,
9728
+ MenuItem = Dropdown.MenuItem;
9729
+ const _useLocalStorage = useLocalStorage(localStorageKey, []),
9730
+ _useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
9731
+ hiddenColumns = _useLocalStorage2[0],
9732
+ setHiddenColumns = _useLocalStorage2[1];
9733
+ const _useState = useState(""),
9734
+ _useState2 = _slicedToArray(_useState, 2),
9735
+ searchTerm = _useState2[0],
9736
+ setSearchTerm = _useState2[1];
9737
+ const columns = removeFixedColumns(fixedColumns, columnData);
9738
+ const filteredColumns = filterBySearchTerm(searchTerm, columns);
9739
+ const handleChange = _ref2 => {
9740
+ let _ref2$target = _ref2.target,
9741
+ dataIndex = _ref2$target.name,
9742
+ checked = _ref2$target.checked;
9743
+ return checked ? setHiddenColumns(without([dataIndex], hiddenColumns)) : setHiddenColumns(append(dataIndex, hiddenColumns));
9744
+ };
9745
+ const handleSearch = _ref3 => {
9746
+ let value = _ref3.target.value;
9747
+ return setSearchTerm(value);
9748
+ };
9749
+ useEffect(() => {
9750
+ onChange(removeBy({
9751
+ dataIndex: includes(__, hiddenColumns)
9752
+ }, columnData));
9753
+ }, [columnData, hiddenColumns]); // eslint-disable-line react-hooks/exhaustive-deps
9754
+
9755
+ return /*#__PURE__*/React.createElement(Dropdown, _extends({
9756
+ buttonSize: "medium",
9757
+ buttonStyle: "secondary",
9758
+ closeOnSelect: false,
9759
+ label: "Columns",
9760
+ onClose: () => setSearchTerm(""),
9761
+ position: "bottom-end"
9762
+ }, dropdownProps), /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement("div", null, isSearchable && /*#__PURE__*/React.createElement(Input$1, _extends({
9763
+ className: "neeto-ui-px-3 neeto-ui-py-2",
9764
+ "data-cy": "neeto-ui-columns-search",
9765
+ onChange: handleSearch,
9766
+ placeholder: "Search columns",
9767
+ prefix: /*#__PURE__*/React.createElement(Search, null),
9768
+ type: "search",
9769
+ value: searchTerm
9770
+ }, searchProps)), isNotEmpty(filteredColumns) ? filteredColumns.map(_ref4 => {
9771
+ let dataIndex = _ref4.dataIndex,
9772
+ key = _ref4.key,
9773
+ title = _ref4.title;
9774
+ return /*#__PURE__*/React.createElement(MenuItem, {
9775
+ key: key
9776
+ }, /*#__PURE__*/React.createElement(Label, {
9777
+ className: "neeto-ui-w-full neeto-ui-px-3 neeto-ui-py-2 hover:neeto-ui-bg-gray-200 neeto-ui-cursor-pointer",
9778
+ htmlFor: dataIndex
9779
+ }, /*#__PURE__*/React.createElement(Checkbox, _extends({
9780
+ id: dataIndex,
9781
+ name: dataIndex,
9782
+ checked: !hiddenColumns.includes(dataIndex),
9783
+ "data-cy": "neeto-ui-columns-checkbox",
9784
+ label: title,
9785
+ onChange: handleChange
9786
+ }, checkboxProps))));
9787
+ }) : /*#__PURE__*/React.createElement("span", {
9788
+ className: "neeto-ui-flex neeto-ui-flex-col neeto-ui-items-center neeto-ui-p-2"
9789
+ }, noColumnMessage), !!actionBlock && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), actionBlock))));
9790
+ };
9791
+
9792
+ const FIXED_COLUMNS = ["actions"];
9793
+ const COLUMNS_DROPDOWN_PROPS = {
9794
+ buttonProps: {
9795
+ size: "small"
9796
+ },
9797
+ label: instance.t("common.column", PLURAL)
9798
+ };
9799
+ const COLUMNS_SEARCH_PROPS = {
9800
+ placeholder: instance.t("columns.search")
9801
+ };
9802
+ const MANAGE_ROLES_BUTTON_LABEL = instance.t("common.manage_", {
9803
+ what: instance.t("common.role", PLURAL).toLocaleLowerCase()
9804
+ });
9805
+
12110
9806
  const Left = _ref => {
12111
9807
  let metaName = _ref.metaName,
12112
9808
  count = _ref.count;
@@ -12123,18 +9819,24 @@ Left.defaultProps = {
12123
9819
  count: 0
12124
9820
  };
12125
9821
  const Right = _ref2 => {
12126
- let rolesButtonProps = _ref2.rolesButtonProps;
12127
- const isVisible = !!rolesButtonProps;
12128
- const permissions = window.globalProps.permissions;
12129
- const hasRequiredPermissions = permissions && hasPermission(MANAGE_MEMBER_PERMISSIONS);
12130
- return isVisible && hasRequiredPermissions ? /*#__PURE__*/React.createElement(Button, _extends({
9822
+ let columns = _ref2.columns,
9823
+ rolesButtonProps = _ref2.rolesButtonProps,
9824
+ setColumnData = _ref2.setColumnData;
9825
+ const isRolesButtonVisible = !!rolesButtonProps;
9826
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Columns, {
9827
+ columnData: columns,
9828
+ dropdownProps: COLUMNS_DROPDOWN_PROPS,
9829
+ fixedColumns: FIXED_COLUMNS,
9830
+ localStorageKey: "NTM_MEMBERS_TABLE_HIDDEN_COLUMNS",
9831
+ noColumnMessage: instance.t("columns.noColumnsFound"),
9832
+ onChange: setColumnData,
9833
+ searchProps: COLUMNS_SEARCH_PROPS
9834
+ }), isRolesButtonVisible ? /*#__PURE__*/React.createElement(Button, _extends({
12131
9835
  "data-cy": "ntm-manage-roles-button",
12132
- label: instance.t("common.manage_", {
12133
- what: instance.t("common.role", PLURAL).toLocaleLowerCase()
12134
- }),
9836
+ label: MANAGE_ROLES_BUTTON_LABEL,
12135
9837
  size: "small",
12136
9838
  style: "secondary"
12137
- }, rolesButtonProps)) : null;
9839
+ }, rolesButtonProps)) : null);
12138
9840
  };
12139
9841
  const SubHeader = {
12140
9842
  Left,
@@ -12183,7 +9885,7 @@ const DEFAULT_FILTER_VALUES = {
12183
9885
  };
12184
9886
 
12185
9887
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12186
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9888
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12187
9889
  const renderNameColumn = (_ref, diplayStatusTag) => {
12188
9890
  let displayName = _ref.displayName,
12189
9891
  imageUrl = _ref.profileImageUrl,
@@ -12298,6 +10000,7 @@ const getColumnData = _ref5 => {
12298
10000
  width: "25%",
12299
10001
  sorter: true
12300
10002
  }, {
10003
+ dataIndex: "actions",
12301
10004
  key: "icon_button",
12302
10005
  render: (_, props) => renderDropdownButton(props, handleUpdateStatus, handleUpdateRole, permissions),
12303
10006
  width: "10%"
@@ -12348,14 +10051,17 @@ const COUNTER_PROPS = {
12348
10051
  startsFrom: 4
12349
10052
  };
12350
10053
 
12351
- const renderInitialValues = selectedMember => ({
12352
- emails: selectedMember ? [{
12353
- label: selectedMember.email,
12354
- value: selectedMember.email,
12355
- valid: true
12356
- }] : [],
12357
- role: (selectedMember === null || selectedMember === void 0 ? void 0 : selectedMember.role) || ""
12358
- });
10054
+ const renderInitialValues = (selectedMember, roles) => {
10055
+ var _roles$;
10056
+ return {
10057
+ emails: selectedMember ? [{
10058
+ label: selectedMember.email,
10059
+ value: selectedMember.email,
10060
+ valid: true
10061
+ }] : [],
10062
+ role: (selectedMember === null || selectedMember === void 0 ? void 0 : selectedMember.role) || ((_roles$ = roles[1]) === null || _roles$ === void 0 ? void 0 : _roles$.name) || ""
10063
+ };
10064
+ };
12359
10065
  const renderPayload = function (_ref) {
12360
10066
  let role = _ref.role,
12361
10067
  emails = _ref.emails;
@@ -12381,9 +10087,10 @@ const ManageMember = _ref => {
12381
10087
  roles = _ref$roles === void 0 ? [] : _ref$roles,
12382
10088
  selectedMember = _ref.selectedMember;
12383
10089
  const _useState = useState(false),
12384
- _useState2 = _slicedToArray$2(_useState, 2),
10090
+ _useState2 = _slicedToArray(_useState, 2),
12385
10091
  hasSubmitted = _useState2[0],
12386
10092
  setHasSubmitted = _useState2[1];
10093
+ const formReference = useRef(null);
12387
10094
  const onPaneClose = () => {
12388
10095
  onClose();
12389
10096
  setHasSubmitted(false);
@@ -12430,18 +10137,22 @@ const ManageMember = _ref => {
12430
10137
  }) : instance.t("common.add_", {
12431
10138
  what: instance.t(metaName, SINGULAR).toLocaleLowerCase()
12432
10139
  }))), config !== null && config !== void 0 && (_config$manageMember = config.manageMember) !== null && _config$manageMember !== void 0 && _config$manageMember.component ? config.manageMember.component(manageMemberProps) : /*#__PURE__*/React.createElement(Formik, {
12433
- initialValues: renderInitialValues(selectedMember),
10140
+ enableReinitialize: true,
10141
+ initialValues: renderInitialValues(selectedMember, roles),
12434
10142
  onSubmit: handleAddMember,
12435
- validationSchema: VALIDATION_SCHEMA,
12436
- validateOnChange: hasSubmitted,
12437
10143
  validateOnBlur: hasSubmitted,
12438
- enableReinitialize: true
10144
+ validateOnChange: hasSubmitted,
10145
+ validationSchema: VALIDATION_SCHEMA
12439
10146
  }, _ref2 => {
12440
10147
  let values = _ref2.values,
12441
10148
  dirty = _ref2.dirty;
12442
10149
  const emails = values.emails,
12443
10150
  role = values.role;
12444
- return /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
10151
+ return /*#__PURE__*/React.createElement(Form, {
10152
+ ref: formReference
10153
+ }, /*#__PURE__*/React.createElement(ScrollToErrorField, {
10154
+ formRef: formReference
10155
+ }), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
12445
10156
  className: "ntm-members-pane__body"
12446
10157
  }, selectedMember ? /*#__PURE__*/React.createElement(Input, {
12447
10158
  "data-cy": "ntm-manage-member-email-input",
@@ -12460,23 +10171,24 @@ const ManageMember = _ref => {
12460
10171
  name: "emails",
12461
10172
  placeholder: instance.t("placeholders.email")
12462
10173
  }), /*#__PURE__*/React.createElement(Radio, {
12463
- className: "ntm-members-radio-group",
12464
10174
  stacked: true,
10175
+ className: "ntm-members-radio-group",
12465
10176
  "data-cy": "ntm-manage-member-roles-group",
12466
10177
  label: `${instance.t("common.role", SINGULAR)}*`,
12467
10178
  name: "role"
12468
10179
  }, roles.map(_ref3 => {
12469
10180
  let description = _ref3.description,
10181
+ id = _ref3.id,
12470
10182
  name = _ref3.name;
12471
10183
  return /*#__PURE__*/React.createElement("label", {
12472
10184
  className: "ntm-members-pane-radio-item__wrapper",
12473
- htmlFor: name,
12474
- key: name
10185
+ htmlFor: slugify(name),
10186
+ key: id
12475
10187
  }, /*#__PURE__*/React.createElement(Radio.Item, {
12476
- checked: name === role,
12477
10188
  className: "ntm-members-pane-radio-item__label",
12478
10189
  "data-cy": "ntm-manage-member-roles-button",
12479
- id: name,
10190
+ defaultChecked: identical(name, role),
10191
+ id: slugify(name),
12480
10192
  label: name,
12481
10193
  name: "role",
12482
10194
  value: name
@@ -12527,24 +10239,28 @@ const Menu = _ref => {
12527
10239
  };
12528
10240
 
12529
10241
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12530
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10242
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12531
10243
  const TeamMembers = _ref => {
12532
10244
  var _config$permissions$v, _config$permissions, _config$permissions$v2, _config$permissions2;
12533
10245
  let metaName = _ref.metaName,
12534
10246
  config = _ref.config;
12535
10247
  const _useState = useState(DEFAULT_IS_OPEN_VALUES),
12536
- _useState2 = _slicedToArray$2(_useState, 2),
10248
+ _useState2 = _slicedToArray(_useState, 2),
12537
10249
  isOpen = _useState2[0],
12538
10250
  setIsOpen = _useState2[1];
12539
10251
  const _useState3 = useState(DEFAULT_FILTER_VALUES),
12540
- _useState4 = _slicedToArray$2(_useState3, 2),
10252
+ _useState4 = _slicedToArray(_useState3, 2),
12541
10253
  filters = _useState4[0],
12542
10254
  setFilters = _useState4[1];
12543
10255
  const _useState5 = useState(null),
12544
- _useState6 = _slicedToArray$2(_useState5, 2),
10256
+ _useState6 = _slicedToArray(_useState5, 2),
12545
10257
  selectedMember = _useState6[0],
12546
10258
  setSelectedMember = _useState6[1];
12547
10259
  const debouncedSearch = useDebounce(filters.search, 750);
10260
+ const _useState7 = useState([]),
10261
+ _useState8 = _slicedToArray(_useState7, 2),
10262
+ columnData = _useState8[0],
10263
+ setColumnData = _useState8[1];
12548
10264
  const _useFetchMembers = useFetchMembers(_objectSpread(_objectSpread({}, filters), {}, {
12549
10265
  search: debouncedSearch.trim(),
12550
10266
  category: filters.category.toLowerCase()
@@ -12606,6 +10322,14 @@ const TeamMembers = _ref => {
12606
10322
  setSelectedMember(user);
12607
10323
  setIsOpen(assoc("manageMember", true));
12608
10324
  };
10325
+ const columns = useMemo(() => getColumnData({
10326
+ memberFilter: filters.category,
10327
+ handleUpdateStatus,
10328
+ handleUpdateRole,
10329
+ permissions: config === null || config === void 0 ? void 0 : config.permissions
10330
+ }), [] // eslint-disable-line react-hooks/exhaustive-deps
10331
+ );
10332
+
12609
10333
  const handleAlertClose = () => {
12610
10334
  setIsOpen(assoc("alert", false));
12611
10335
  setSelectedMember(null);
@@ -12656,19 +10380,16 @@ const TeamMembers = _ref => {
12656
10380
  count: team === null || team === void 0 ? void 0 : team.membersCount
12657
10381
  }),
12658
10382
  rightActionBlock: /*#__PURE__*/React.createElement(SubHeader.Right, {
12659
- rolesButtonProps: config.rolesButtonProps
10383
+ columns: columns,
10384
+ rolesButtonProps: config.rolesButtonProps,
10385
+ setColumnData: setColumnData
12660
10386
  })
12661
10387
  }), (team === null || team === void 0 ? void 0 : team.membersCount) !== 0 ? /*#__PURE__*/React.createElement("div", {
12662
10388
  className: "ntm-members__table-wrapper"
12663
10389
  }, /*#__PURE__*/React.createElement(Table$1, {
12664
10390
  fixedHeight: true,
12665
10391
  allowRowClick: false,
12666
- columnData: getColumnData({
12667
- memberFilter: filters.category,
12668
- handleUpdateStatus,
12669
- handleUpdateRole,
12670
- permissions: config === null || config === void 0 ? void 0 : config.permissions
12671
- }),
10392
+ columnData: columnData,
12672
10393
  currentPageNumber: parseInt(filters.page, DEFAULT_RADIX),
12673
10394
  "data-cy": "ntm-members-table",
12674
10395
  defaultPageSize: parseInt(filters.results, DEFAULT_RADIX),
@@ -12719,8 +10440,8 @@ var index = withReactQuery(TeamMembers);
12719
10440
 
12720
10441
  var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
12721
10442
 
12722
- var css = ":root {\n --ntm-roles-table-default-scroll: 15px;\n}\n\n.ntm-dropdown__button {\n border-radius: 0 !important;\n font-weight: var(--neeto-ui-font-normal);\n min-height: 34px;\n min-width: 150px;\n text-align: left;\n width: 100%;\n}\n\n.ntm-scrollbar__inner {\n width: 100%;\n height: 200px;\n}\n.ntm-scrollbar__outer {\n position: \"absolute\";\n top: 0px;\n left: 0px;\n width: 200px;\n height: 150px;\n overflow: \"hidden\";\n visibility: \"hidden\";\n}\n\n.ntm-empty-state {\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n}\n.ntm-empty-state__image {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 2rem;\n}\n.ntm-empty-state__title--with-action-block {\n margin-bottom: 1rem;\n}\n.ntm-empty-state__action-block {\n display: flex;\n justify-content: center;\n}\n\n.ntm-members {\n overflow: auto;\n width: 100%;\n}\n.ntm-members-wrapper {\n display: flex;\n}\n.ntm-members-page-loader {\n width: 100%;\n height: 100vh;\n}\n.ntm-members__table-wrapper {\n height: calc(100vh - 205px);\n width: 100%;\n}\n.ntm-members-table__column {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n.ntm-members-pane__header {\n margin-bottom: 0.5rem;\n}\n.ntm-members-pane__body {\n width: 100%;\n padding-bottom: 1rem;\n}\n.ntm-members-pane__body > * + * {\n margin-top: 1rem;\n}\n.ntm-members-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-members-radio-group {\n width: 100%;\n}\n.ntm-members-radio-group .neeto-ui-radio__container--stacked {\n width: 100%;\n}\n\n.ntm-members-pane-radio-item__wrapper {\n width: 100%;\n cursor: pointer;\n padding: 16px 0px !important;\n border-bottom: 1px solid rgb(var(--neeto-ui-gray-200));\n}\n.ntm-members-pane-radio-item__label {\n margin-bottom: 0 !important;\n}\n.ntm-members-pane-radio-item__description {\n color: rgb(var(--neeto-ui-gray-700));\n}\n\n.ntm-roles-header {\n border-bottom: 1px solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table__wrapper {\n width: 100%;\n height: calc(100vh - var(--neeto-ui-main-header-height));\n display: flex;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar {\n width: 396px;\n min-width: 396px;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__search {\n padding: 24px 24px 16px;\n height: 72px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list {\n height: calc(\n 100vh - var(--neeto-ui-main-header-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 12px 8px;\n min-height: 48px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item.ntm-roles-table-sidebar__list-item--highlighted {\n background-color: rgb(var(--neeto-ui-primary-100));\n padding: 12px 8px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item:not(.ntm-roles-table-sidebar__list-item--highlighted) {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns {\n width: calc(\n 100vw - var(--neeto-ui-sidebar-width) - 396px - 24px\n );\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__cell {\n width: 100%;\n min-width: 200px;\n min-height: 48px;\n padding: 12px 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox-wrapper {\n position: absolute;\n height: 1rem;\n width: 1rem;\n margin: auto;\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox {\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header {\n display: flex;\n align-items: center;\n overflow-x: auto;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table__cell {\n height: 72px;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header-cell__container {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n gap: 1rem;\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__dropdown {\n margin: 3px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__role-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows {\n width: 100%;\n height: calc(\n 100vh - var(--neeto-ui-main-header-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n scrollbar-width: none;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb {\n background: rgb(var(--neeto-ui-gray-300));\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb:hover {\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-track {\n background: rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row {\n display: flex;\n align-items: center;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell {\n overflow: hidden;\n position: relative;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell p {\n opacity: 0;\n width: 340px;\n min-width: 340px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row.ntm-roles-table__row--highlighted .ntm-roles-table__cell {\n background-color: rgb(var(--neeto-ui-primary-100));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row:not(.ntm-roles-table__row--highlighted) .ntm-roles-table__cell {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table-sidebar__drop-down-button {\n color: rgb(var(--neeto-ui-gray-600));\n cursor: pointer;\n}\n\n.ntm-roles-modal__body > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-modal__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-pane__body {\n width: 100%;\n margin-bottom: 1.5rem;\n}\n.ntm-roles-pane__body-wrapper > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-pane__body > * + * {\n margin-top: 1.5rem;\n}\n.ntm-roles-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-permission > * + * {\n margin: 0.5rem;\n}\n.ntm-roles-permission__heading {\n color: rgb(var(--neeto-ui-gray-500));\n text-transform: uppercase;\n}\n.ntm-roles-permission__card {\n background-color: rgb(var(--neeto-ui-white));\n border-radius: var(--neeto-ui-rounded);\n border-width: 1px;\n border-color: rgb(var(--neeto-ui-gray-300));\n cursor: pointer;\n display: flex;\n gap: 0.75rem;\n padding: 1rem 0.75rem;\n}\n.ntm-roles-permission__card--description {\n flex-grow: 1;\n}\n.ntm-roles-permission__card--checkbox {\n padding: 0 0.5rem;\n}\n\n.ntm-invitations__wrapper .ntm-invitations__header {\n height: 28px;\n}\n.ntm-invitations__wrapper .ntm-invitations__body {\n display: flex;\n flex-direction: column;\n}\n.ntm-invitations__wrapper .ntm-invitations__body > * {\n margin-bottom: 8px;\n}\n.ntm-invitations__wrapper .ntm-invitations__body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n.ntm-invitations__wrapper .ntm-invitations__body-header div {\n display: flex;\n align-items: center;\n}\n.ntm-invitations__wrapper .ntm-invitations__body-header div p {\n margin-right: 8px;\n}\n.ntm-invitations__wrapper .ntm-invitations__body .ntm-invitations__dnd {\n color: rgb(var(--neeto-ui-gray-700));\n background: rgb(var(--neeto-ui-gray-100));\n padding: 20px 40px;\n border: 1px dashed;\n border-radius: 6px;\n cursor: pointer;\n counter-reset: dnd-counter;\n}\n.ntm-invitations__wrapper .ntm-invitations__body .ntm-invitations__dnd h3 {\n margin-bottom: 8px;\n text-align: center !important;\n}\n.ntm-invitations__wrapper .ntm-invitations__body .ntm-invitations__dnd p::before {\n counter-increment: dnd-counter;\n content: counter(dnd-counter) \". \";\n}\n.ntm-invitations__wrapper .ntm-invitations__body .ntm-invitations__submit-btn {\n align-self: end !important;\n margin-top: 16px;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer {\n background: rgb(var(--neeto-ui-gray-100));\n margin-top: 24px;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__invite-link {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__invite-link-instructions {\n display: flex;\n flex-direction: column;\n width: 50%;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__invite-link-instructions h4 {\n margin-bottom: 8px;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__invite-link-btns {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n font-weight: bold;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__invite-link-btns > button:first-child {\n margin-right: 8px;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__invite-link-btns p {\n font-weight: normal;\n color: rgb(var(--neeto-ui-gray-700));\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__table {\n max-height: 192px;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__table-filename {\n display: flex;\n align-items: center;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__table-filename svg {\n margin-right: 4px;\n}\n.ntm-invitations__wrapper .ntm-invitations__footer .ntm-invitations__table-status {\n text-transform: capitalize;\n}";
10443
+ var css = ":root {\n --ntm-roles-table-default-scroll: 15px;\n}\n\n.ntm-dropdown__button {\n border-radius: 0 !important;\n font-weight: var(--neeto-ui-font-normal);\n min-height: 34px;\n min-width: 150px;\n text-align: left;\n width: 100%;\n}\n\n.ntm-scrollbar__inner {\n width: 100%;\n height: 200px;\n}\n.ntm-scrollbar__outer {\n position: \"absolute\";\n top: 0px;\n left: 0px;\n width: 200px;\n height: 150px;\n overflow: \"hidden\";\n visibility: \"hidden\";\n}\n\n.ntm-empty-state {\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n}\n.ntm-empty-state__image {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 2rem;\n}\n.ntm-empty-state__title--with-action-block {\n margin-bottom: 1rem;\n}\n.ntm-empty-state__action-block {\n display: flex;\n justify-content: center;\n}\n\n.ntm-members {\n overflow: auto;\n width: 100%;\n}\n.ntm-members-wrapper {\n display: flex;\n}\n.ntm-members-page-loader {\n width: 100%;\n height: 100vh;\n}\n.ntm-members__table-wrapper {\n height: calc(100vh - 205px);\n width: 100%;\n}\n.ntm-members-table__column {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n.ntm-members-pane__header {\n margin-bottom: 0.5rem;\n}\n.ntm-members-pane__body {\n width: 100%;\n padding-bottom: 1rem;\n}\n.ntm-members-pane__body > * + * {\n margin-top: 1rem;\n}\n.ntm-members-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-members-radio-group {\n width: 100%;\n}\n.ntm-members-radio-group .neeto-ui-radio__container--stacked {\n width: 100%;\n}\n\n.ntm-members-pane-radio-item__wrapper {\n width: 100%;\n cursor: pointer;\n padding: 16px 0px !important;\n border-bottom: 1px solid rgb(var(--neeto-ui-gray-200));\n}\n.ntm-members-pane-radio-item__wrapper:first-child {\n padding-top: 0px !important;\n}\n.ntm-members-pane-radio-item__label {\n margin-bottom: 0 !important;\n}\n.ntm-members-pane-radio-item__description {\n color: rgb(var(--neeto-ui-gray-700));\n}\n\n.ntm-roles-header {\n border-bottom: 1px solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table__wrapper {\n width: 100%;\n height: calc(100vh - var(--neeto-ui-main-header-height));\n display: flex;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar {\n width: 396px;\n min-width: 396px;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__search {\n padding: 24px 24px 16px;\n height: 72px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list {\n height: calc(\n 100vh - var(--neeto-ui-main-header-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 12px 8px;\n min-height: 48px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item.ntm-roles-table-sidebar__list-item--highlighted {\n background-color: rgb(var(--neeto-ui-primary-100));\n padding: 12px 8px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item:not(.ntm-roles-table-sidebar__list-item--highlighted) {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns {\n width: calc(\n 100vw - var(--neeto-ui-sidebar-width) - 396px - 24px\n );\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__cell {\n width: 100%;\n min-width: 200px;\n min-height: 48px;\n padding: 12px 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox-wrapper {\n position: absolute;\n height: 1rem;\n width: 1rem;\n margin: auto;\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox {\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header {\n display: flex;\n align-items: center;\n overflow-x: auto;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table__cell {\n height: 72px;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header-cell__container {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n gap: 1rem;\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__dropdown {\n margin: 3px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__role-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows {\n width: 100%;\n height: calc(\n 100vh - var(--neeto-ui-main-header-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n scrollbar-width: none;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb {\n background: rgb(var(--neeto-ui-gray-300));\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb:hover {\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-track {\n background: rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row {\n display: flex;\n align-items: center;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell {\n overflow: hidden;\n position: relative;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell p {\n opacity: 0;\n width: 340px;\n min-width: 340px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row.ntm-roles-table__row--highlighted .ntm-roles-table__cell {\n background-color: rgb(var(--neeto-ui-primary-100));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row:not(.ntm-roles-table__row--highlighted) .ntm-roles-table__cell {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table-sidebar__drop-down-button {\n color: rgb(var(--neeto-ui-gray-600));\n cursor: pointer;\n}\n\n.ntm-roles-modal__body > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-modal__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-pane__body {\n width: 100%;\n margin-bottom: 1.5rem;\n}\n.ntm-roles-pane__body-wrapper > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-pane__body > * + * {\n margin-top: 1.5rem;\n}\n.ntm-roles-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-permission > * + * {\n margin: 0.5rem;\n}\n.ntm-roles-permission__heading {\n color: rgb(var(--neeto-ui-gray-500));\n text-transform: uppercase;\n}\n.ntm-roles-permission__card {\n background-color: rgb(var(--neeto-ui-white));\n align-items: center;\n border-radius: var(--neeto-ui-rounded);\n border-width: 1px;\n border-color: rgb(var(--neeto-ui-gray-300));\n cursor: pointer;\n display: flex;\n gap: 0.75rem;\n padding: 1rem 0.75rem;\n}\n.ntm-roles-permission__card--description {\n flex-grow: 1;\n}\n.ntm-roles-permission__card--checkbox {\n padding: 0 0.5rem;\n}\n\ntd.ant-table-column-sort {\n background: transparent;\n}";
12723
10444
  n(css,{});
12724
10445
 
12725
- export { index$2 as Invitations, index$1 as Roles, index as TeamMembers, hasPermission };
10446
+ export { index$1 as Roles, index as TeamMembers, hasPermission };
12726
10447
  //# sourceMappingURL=index.esm.js.map