@bigbinary/neeto-team-members-frontend 2.4.2 → 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, Select } 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, 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",
@@ -4124,6 +3817,7 @@ var tooltips$1 = {
4124
3817
  var validations$1 = {
4125
3818
  enterRoleName: "Please enter a valid role name.",
4126
3819
  filterInvalidEmails: "Click here to remove invalid emails.",
3820
+ limitExceeded: "You have exceeded the limit of {{limit}} characters for the {{what}}.",
4127
3821
  minOneEmail: "Please enter at least one email address.",
4128
3822
  roleRequired: "Please select a role.",
4129
3823
  validEmail: "Please ensure that all email addresses are valid."
@@ -4131,6 +3825,7 @@ var validations$1 = {
4131
3825
  var en = {
4132
3826
  alerts: alerts$1,
4133
3827
  buttons: buttons$1,
3828
+ columns: columns$1,
4134
3829
  common: common$1,
4135
3830
  helpers: helpers$1,
4136
3831
  metaNames: metaNames$1,
@@ -4146,12 +3841,12 @@ var alerts = {
4146
3841
  };
4147
3842
  var buttons = {
4148
3843
  cancel: "Annuler",
4149
- copyLink: "Copier le lien",
4150
- createLink: "Créer un lien",
4151
- inviteFrom: "Inviter de",
4152
3844
  proceed: "Procéder",
4153
- saveChanges: "Sauvegarder les modifications",
4154
- sendInvites: "Envoie des invitations"
3845
+ saveChanges: "Sauvegarder les modifications"
3846
+ };
3847
+ var columns = {
3848
+ search: "Colonnes de recherche",
3849
+ noColumnsFound: "Aucune colonne trouvée."
4155
3850
  };
4156
3851
  var common = {
4157
3852
  activate: "Activer",
@@ -4161,6 +3856,8 @@ var common = {
4161
3856
  add_: "Ajouter {{what}}",
4162
3857
  all: "Tous",
4163
3858
  all_: "tous les {{what}}",
3859
+ column_one: "Colonne",
3860
+ column_other: "Colonnes",
4164
3861
  deactivate: "Désactiver",
4165
3862
  deactivate_: "Désactiver le {{what}}",
4166
3863
  deactivated: "Désactivé",
@@ -4168,12 +3865,10 @@ var common = {
4168
3865
  "delete": "Effacer",
4169
3866
  delete_: "Supprimer le {{what}}",
4170
3867
  description: "La description",
4171
- download_: "Télécharger {{what}}",
4172
3868
  edit: "Éditer",
4173
3869
  edit_: "Modifier le {{what}}",
4174
3870
  email_one: "E-mail",
4175
3871
  email_other: "E-mails",
4176
- invite_: "Inviter des {{what}}",
4177
3872
  manage_: "Gérer {{what}}",
4178
3873
  name: "Nom",
4179
3874
  notFound_: "Désolé, aucun {{what}} n'a été trouvé.",
@@ -4182,26 +3877,11 @@ var common = {
4182
3877
  role_one: "Rôle",
4183
3878
  role_other: "Rôles",
4184
3879
  search_: "Rechercher des {{what}}",
4185
- settings: "Paramètres",
4186
- update_: "Mettre à jour le {{what}}",
4187
- upload_: "Importer des {{what}}"
3880
+ update_: "Mettre à jour le {{what}}"
4188
3881
  };
4189
3882
  var helpers = {
4190
- bulkInvite: "Invitation groupée à l'aide de CSV",
4191
3883
  configPermissions: "Configurez les autorisations pour les modules.",
4192
- copiedToClipboard: "Copié dans le presse-papier",
4193
- dropFilesHere: "Déposez les fichiers ici",
4194
- enterMultipleEmails: "Veuillez appuyer sur espace, tabulation ou entrée après avoir saisi une adresse e-mail.",
4195
- expiresIn: "Expire dans ",
4196
- files: "Fichiers",
4197
- getInviteLink: "Obtenir le lien d'invitation",
4198
- inviteLinkInstruction: "Toute personne s'inscrivant avec ce lien sera ajoutée à la liste des candidats.",
4199
- noOfRows: "Nombre de rangées",
4200
- status: "Statut",
4201
- uploaded: "Téléchargé",
4202
- uploadInstruction1: "Les fichiers doivent être au format CSV.",
4203
- uploadInstruction2: "Le fichier doit contenir les colonnes suivantes: <strong>{{what}}</strong>.",
4204
- 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."
4205
3885
  };
4206
3886
  var metaNames = {
4207
3887
  member_one: "Membre",
@@ -4224,7 +3904,9 @@ var tooltips = {
4224
3904
  noPermissionToRemoveRoles: "Veuillez demander à l'administrateur de vous autoriser à supprimer des rôles."
4225
3905
  };
4226
3906
  var validations = {
3907
+ enterRoleName: "Veuillez entrer le nom du rôle",
4227
3908
  filterInvalidEmails: "Cliquez ici pour supprimer les e-mails invalides.",
3909
+ limitExceeded: "Vous avez dépassé la limite de {{limit}} caractères pour le {{what}}.",
4228
3910
  minOneEmail: "Veuillez saisir au moins une adresse e-mail.",
4229
3911
  roleRequired: "Veuillez sélectionner un rôle.",
4230
3912
  validEmail: "Veuillez vous assurer que toutes les adresses e-mail sont valides."
@@ -4232,6 +3914,7 @@ var validations = {
4232
3914
  var fr = {
4233
3915
  alerts: alerts,
4234
3916
  buttons: buttons,
3917
+ columns: columns,
4235
3918
  common: common,
4236
3919
  helpers: helpers,
4237
3920
  metaNames: metaNames,
@@ -4288,7 +3971,7 @@ const getScrollBarWidth = () => {
4288
3971
  document.body.removeChild(outerElement);
4289
3972
  return w1 - w2;
4290
3973
  };
4291
- const noop$2 = () => {};
3974
+ const noop$1 = () => {};
4292
3975
  const slugify = string => string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
4293
3976
  .replace(/&/g, "-and-") // Replace & with 'and'
4294
3977
  .replace(/[^\w-]+/g, "") // Remove all non-word characters
@@ -4296,21 +3979,6 @@ const slugify = string => string.toString().toLowerCase().replace(/\s+/g, "-") /
4296
3979
  .replace(/^-+/, "") // Trim - from start of text
4297
3980
  .replace(/-+$/, ""); // Trim - from end of text
4298
3981
 
4299
- function _extends() {
4300
- _extends = Object.assign ? Object.assign.bind() : function (target) {
4301
- for (var i = 1; i < arguments.length; i++) {
4302
- var source = arguments[i];
4303
- for (var key in source) {
4304
- if (Object.prototype.hasOwnProperty.call(source, key)) {
4305
- target[key] = source[key];
4306
- }
4307
- }
4308
- }
4309
- return target;
4310
- };
4311
- return _extends.apply(this, arguments);
4312
- }
4313
-
4314
3982
  const SINGULAR = {
4315
3983
  count: 1
4316
3984
  };
@@ -4364,10 +4032,25 @@ var Subscribable = /*#__PURE__*/function () {
4364
4032
  return Subscribable;
4365
4033
  }();
4366
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
+
4367
4050
  // TYPES
4368
4051
  // UTILS
4369
4052
  var isServer = typeof window === 'undefined';
4370
- function noop$1() {
4053
+ function noop() {
4371
4054
  return undefined;
4372
4055
  }
4373
4056
  function functionalUpdate(updater, input) {
@@ -5230,7 +4913,7 @@ var Query = /*#__PURE__*/function () {
5230
4913
 
5231
4914
  var promise = this.promise;
5232
4915
  (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);
5233
- return promise ? promise.then(noop$1).catch(noop$1) : Promise.resolve();
4916
+ return promise ? promise.then(noop).catch(noop) : Promise.resolve();
5234
4917
  };
5235
4918
 
5236
4919
  _proto.destroy = function destroy() {
@@ -5804,7 +5487,7 @@ var Mutation = /*#__PURE__*/function () {
5804
5487
  _proto.cancel = function cancel() {
5805
5488
  if (this.retryer) {
5806
5489
  this.retryer.cancel();
5807
- return this.retryer.promise.then(noop$1).catch(noop$1);
5490
+ return this.retryer.promise.then(noop).catch(noop);
5808
5491
  }
5809
5492
 
5810
5493
  return Promise.resolve();
@@ -5920,7 +5603,7 @@ var Mutation = /*#__PURE__*/function () {
5920
5603
  _proto.dispatch = function dispatch(action) {
5921
5604
  var _this3 = this;
5922
5605
 
5923
- this.state = reducer$1(this.state, action);
5606
+ this.state = reducer(this.state, action);
5924
5607
  notifyManager.batch(function () {
5925
5608
  _this3.observers.forEach(function (observer) {
5926
5609
  observer.onMutationUpdate(action);
@@ -5944,7 +5627,7 @@ function getDefaultState() {
5944
5627
  };
5945
5628
  }
5946
5629
 
5947
- function reducer$1(state, action) {
5630
+ function reducer(state, action) {
5948
5631
  switch (action.type) {
5949
5632
  case 'failed':
5950
5633
  return _extends({}, state, {
@@ -6093,7 +5776,7 @@ var MutationCache = /*#__PURE__*/function (_Subscribable) {
6093
5776
  return notifyManager.batch(function () {
6094
5777
  return pausedMutations.reduce(function (promise, mutation) {
6095
5778
  return promise.then(function () {
6096
- return mutation.continue().catch(noop$1);
5779
+ return mutation.continue().catch(noop);
6097
5780
  });
6098
5781
  }, Promise.resolve());
6099
5782
  });
@@ -6376,7 +6059,7 @@ var QueryClient = /*#__PURE__*/function () {
6376
6059
  return query.cancel(cancelOptions);
6377
6060
  });
6378
6061
  });
6379
- return Promise.all(promises).then(noop$1).catch(noop$1);
6062
+ return Promise.all(promises).then(noop).catch(noop);
6380
6063
  };
6381
6064
 
6382
6065
  _proto.invalidateQueries = function invalidateQueries(arg1, arg2, arg3) {
@@ -6421,10 +6104,10 @@ var QueryClient = /*#__PURE__*/function () {
6421
6104
  }));
6422
6105
  });
6423
6106
  });
6424
- var promise = Promise.all(promises).then(noop$1);
6107
+ var promise = Promise.all(promises).then(noop);
6425
6108
 
6426
6109
  if (!(options == null ? void 0 : options.throwOnError)) {
6427
- promise = promise.catch(noop$1);
6110
+ promise = promise.catch(noop);
6428
6111
  }
6429
6112
 
6430
6113
  return promise;
@@ -6443,7 +6126,7 @@ var QueryClient = /*#__PURE__*/function () {
6443
6126
  };
6444
6127
 
6445
6128
  _proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3) {
6446
- return this.fetchQuery(arg1, arg2, arg3).then(noop$1).catch(noop$1);
6129
+ return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);
6447
6130
  };
6448
6131
 
6449
6132
  _proto.fetchInfiniteQuery = function fetchInfiniteQuery(arg1, arg2, arg3) {
@@ -6453,7 +6136,7 @@ var QueryClient = /*#__PURE__*/function () {
6453
6136
  };
6454
6137
 
6455
6138
  _proto.prefetchInfiniteQuery = function prefetchInfiniteQuery(arg1, arg2, arg3) {
6456
- return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop$1).catch(noop$1);
6139
+ return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);
6457
6140
  };
6458
6141
 
6459
6142
  _proto.cancelMutations = function cancelMutations() {
@@ -6464,7 +6147,7 @@ var QueryClient = /*#__PURE__*/function () {
6464
6147
  return mutation.cancel();
6465
6148
  });
6466
6149
  });
6467
- return Promise.all(promises).then(noop$1).catch(noop$1);
6150
+ return Promise.all(promises).then(noop).catch(noop);
6468
6151
  };
6469
6152
 
6470
6153
  _proto.resumePausedMutations = function resumePausedMutations() {
@@ -6768,7 +6451,7 @@ var QueryObserver = /*#__PURE__*/function (_Subscribable) {
6768
6451
  var promise = this.currentQuery.fetch(this.options, fetchOptions);
6769
6452
 
6770
6453
  if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {
6771
- promise = promise.catch(noop$1);
6454
+ promise = promise.catch(noop);
6772
6455
  }
6773
6456
 
6774
6457
  return promise;
@@ -7360,7 +7043,7 @@ function useMutation(arg1, arg2, arg3) {
7360
7043
  };
7361
7044
  }, []);
7362
7045
  var mutate = React.useCallback(function (variables, mutateOptions) {
7363
- obsRef.current.mutate(variables, mutateOptions).catch(noop$1);
7046
+ obsRef.current.mutate(variables, mutateOptions).catch(noop);
7364
7047
  }, []);
7365
7048
 
7366
7049
  if (currentResult.error && shouldThrowError(undefined, obsRef.current.options.useErrorBoundary, [currentResult.error])) {
@@ -7507,2296 +7190,115 @@ const withReactQuery = Component => {
7507
7190
  return QueryWrapper;
7508
7191
  };
7509
7192
 
7510
- var propTypes = {exports: {}};
7511
-
7512
- /**
7513
- * Copyright (c) 2013-present, Facebook, Inc.
7514
- *
7515
- * This source code is licensed under the MIT license found in the
7516
- * LICENSE file in the root directory of this source tree.
7517
- */
7193
+ /* eslint-disable @bigbinary/neeto/no-dangling-constants */
7194
+ const BASE_URL = "team_members";
7518
7195
 
7519
- 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
+ };
7520
7200
 
7521
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
7201
+ const DEFAULT_STALE_TIME = 300000; // 5 minutes
7522
7202
 
7523
- /**
7524
- * Copyright (c) 2013-present, Facebook, Inc.
7525
- *
7526
- * This source code is licensed under the MIT license found in the
7527
- * LICENSE file in the root directory of this source tree.
7528
- */
7203
+ const QUERY_KEYS = {
7204
+ TEAMS: "neeto-team-members-teams",
7205
+ ROLES: "neeto-team-members-roles",
7206
+ PERMISSIONS: "neeto-team-members-permissions"
7207
+ };
7529
7208
 
7530
- 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
+ };
7531
7218
 
7532
- function emptyFunction() {}
7533
- function emptyFunctionWithReset() {}
7534
- 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
+ };
7535
7231
 
7536
- var factoryWithThrowingShims = function() {
7537
- function shim(props, propName, componentName, location, propFullName, secret) {
7538
- if (secret === ReactPropTypesSecret) {
7539
- // It is still safe when called from React.
7540
- 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();
7541
7257
  }
7542
- var err = new Error(
7543
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
7544
- 'Use PropTypes.checkPropTypes() to call them. ' +
7545
- 'Read more at http://fb.me/use-check-prop-types'
7546
- );
7547
- err.name = 'Invariant Violation';
7548
- throw err;
7549
- } shim.isRequired = shim;
7550
- function getShim() {
7551
- return shim;
7552
- } // Important!
7553
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
7554
- var ReactPropTypes = {
7555
- array: shim,
7556
- bigint: shim,
7557
- bool: shim,
7558
- func: shim,
7559
- number: shim,
7560
- object: shim,
7561
- string: shim,
7562
- symbol: shim,
7563
-
7564
- any: shim,
7565
- arrayOf: getShim,
7566
- element: shim,
7567
- elementType: shim,
7568
- instanceOf: getShim,
7569
- node: shim,
7570
- objectOf: getShim,
7571
- oneOf: getShim,
7572
- oneOfType: getShim,
7573
- shape: getShim,
7574
- exact: getShim,
7575
-
7576
- checkPropTypes: emptyFunctionWithReset,
7577
- resetWarningCache: emptyFunction
7578
- };
7579
-
7580
- ReactPropTypes.PropTypes = ReactPropTypes;
7581
-
7582
- return ReactPropTypes;
7258
+ }, options));
7583
7259
  };
7584
-
7585
- /**
7586
- * Copyright (c) 2013-present, Facebook, Inc.
7587
- *
7588
- * This source code is licensed under the MIT license found in the
7589
- * LICENSE file in the root directory of this source tree.
7590
- */
7591
-
7592
- {
7593
- // By explicitly using `prop-types` you are opting into new production behavior.
7594
- // http://fb.me/prop-types-in-prod
7595
- propTypes.exports = factoryWithThrowingShims();
7596
- }
7597
-
7598
- /******************************************************************************
7599
- Copyright (c) Microsoft Corporation.
7600
-
7601
- Permission to use, copy, modify, and/or distribute this software for any
7602
- purpose with or without fee is hereby granted.
7603
-
7604
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7605
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7606
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7607
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7608
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7609
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7610
- PERFORMANCE OF THIS SOFTWARE.
7611
- ***************************************************************************** */
7612
-
7613
- function __awaiter(thisArg, _arguments, P, generator) {
7614
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7615
- return new (P || (P = Promise))(function (resolve, reject) {
7616
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7617
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7618
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7619
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7620
- });
7621
- }
7622
-
7623
- function __generator(thisArg, body) {
7624
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7625
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7626
- function verb(n) { return function (v) { return step([n, v]); }; }
7627
- function step(op) {
7628
- if (f) throw new TypeError("Generator is already executing.");
7629
- while (_) try {
7630
- 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;
7631
- if (y = 0, t) op = [op[0] & 2, t.value];
7632
- switch (op[0]) {
7633
- case 0: case 1: t = op; break;
7634
- case 4: _.label++; return { value: op[1], done: false };
7635
- case 5: _.label++; y = op[1]; op = [0]; continue;
7636
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
7637
- default:
7638
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7639
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7640
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7641
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7642
- if (t[2]) _.ops.pop();
7643
- _.trys.pop(); continue;
7644
- }
7645
- op = body.call(thisArg, _);
7646
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7647
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7648
- }
7649
- }
7650
-
7651
- function __read(o, n) {
7652
- var m = typeof Symbol === "function" && o[Symbol.iterator];
7653
- if (!m) return o;
7654
- var i = m.call(o), r, ar = [], e;
7655
- try {
7656
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7657
- }
7658
- catch (error) { e = { error: error }; }
7659
- finally {
7660
- try {
7661
- if (r && !r.done && (m = i["return"])) m.call(i);
7662
- }
7663
- finally { if (e) throw e.error; }
7664
- }
7665
- return ar;
7666
- }
7667
-
7668
- function __spreadArray(to, from, pack) {
7669
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
7670
- if (ar || !(i in from)) {
7671
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
7672
- ar[i] = from[i];
7673
- }
7674
- }
7675
- return to.concat(ar || Array.prototype.slice.call(from));
7676
- }
7677
-
7678
- var COMMON_MIME_TYPES = new Map([
7679
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
7680
- ['aac', 'audio/aac'],
7681
- ['abw', 'application/x-abiword'],
7682
- ['arc', 'application/x-freearc'],
7683
- ['avif', 'image/avif'],
7684
- ['avi', 'video/x-msvideo'],
7685
- ['azw', 'application/vnd.amazon.ebook'],
7686
- ['bin', 'application/octet-stream'],
7687
- ['bmp', 'image/bmp'],
7688
- ['bz', 'application/x-bzip'],
7689
- ['bz2', 'application/x-bzip2'],
7690
- ['cda', 'application/x-cdf'],
7691
- ['csh', 'application/x-csh'],
7692
- ['css', 'text/css'],
7693
- ['csv', 'text/csv'],
7694
- ['doc', 'application/msword'],
7695
- ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
7696
- ['eot', 'application/vnd.ms-fontobject'],
7697
- ['epub', 'application/epub+zip'],
7698
- ['gz', 'application/gzip'],
7699
- ['gif', 'image/gif'],
7700
- ['heic', 'image/heic'],
7701
- ['heif', 'image/heif'],
7702
- ['htm', 'text/html'],
7703
- ['html', 'text/html'],
7704
- ['ico', 'image/vnd.microsoft.icon'],
7705
- ['ics', 'text/calendar'],
7706
- ['jar', 'application/java-archive'],
7707
- ['jpeg', 'image/jpeg'],
7708
- ['jpg', 'image/jpeg'],
7709
- ['js', 'text/javascript'],
7710
- ['json', 'application/json'],
7711
- ['jsonld', 'application/ld+json'],
7712
- ['mid', 'audio/midi'],
7713
- ['midi', 'audio/midi'],
7714
- ['mjs', 'text/javascript'],
7715
- ['mp3', 'audio/mpeg'],
7716
- ['mp4', 'video/mp4'],
7717
- ['mpeg', 'video/mpeg'],
7718
- ['mpkg', 'application/vnd.apple.installer+xml'],
7719
- ['odp', 'application/vnd.oasis.opendocument.presentation'],
7720
- ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
7721
- ['odt', 'application/vnd.oasis.opendocument.text'],
7722
- ['oga', 'audio/ogg'],
7723
- ['ogv', 'video/ogg'],
7724
- ['ogx', 'application/ogg'],
7725
- ['opus', 'audio/opus'],
7726
- ['otf', 'font/otf'],
7727
- ['png', 'image/png'],
7728
- ['pdf', 'application/pdf'],
7729
- ['php', 'application/x-httpd-php'],
7730
- ['ppt', 'application/vnd.ms-powerpoint'],
7731
- ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
7732
- ['rar', 'application/vnd.rar'],
7733
- ['rtf', 'application/rtf'],
7734
- ['sh', 'application/x-sh'],
7735
- ['svg', 'image/svg+xml'],
7736
- ['swf', 'application/x-shockwave-flash'],
7737
- ['tar', 'application/x-tar'],
7738
- ['tif', 'image/tiff'],
7739
- ['tiff', 'image/tiff'],
7740
- ['ts', 'video/mp2t'],
7741
- ['ttf', 'font/ttf'],
7742
- ['txt', 'text/plain'],
7743
- ['vsd', 'application/vnd.visio'],
7744
- ['wav', 'audio/wav'],
7745
- ['weba', 'audio/webm'],
7746
- ['webm', 'video/webm'],
7747
- ['webp', 'image/webp'],
7748
- ['woff', 'font/woff'],
7749
- ['woff2', 'font/woff2'],
7750
- ['xhtml', 'application/xhtml+xml'],
7751
- ['xls', 'application/vnd.ms-excel'],
7752
- ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
7753
- ['xml', 'application/xml'],
7754
- ['xul', 'application/vnd.mozilla.xul+xml'],
7755
- ['zip', 'application/zip'],
7756
- ['7z', 'application/x-7z-compressed'],
7757
- // Others
7758
- ['mkv', 'video/x-matroska'],
7759
- ['mov', 'video/quicktime'],
7760
- ['msg', 'application/vnd.ms-outlook']
7761
- ]);
7762
- function toFileWithPath(file, path) {
7763
- var f = withMimeType(file);
7764
- if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
7765
- var webkitRelativePath = file.webkitRelativePath;
7766
- Object.defineProperty(f, 'path', {
7767
- value: typeof path === 'string'
7768
- ? path
7769
- // If <input webkitdirectory> is set,
7770
- // the File will have a {webkitRelativePath} property
7771
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
7772
- : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
7773
- ? webkitRelativePath
7774
- : file.name,
7775
- writable: false,
7776
- configurable: false,
7777
- enumerable: true
7778
- });
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();
7779
7278
  }
7780
- return f;
7781
- }
7782
- function withMimeType(file) {
7783
- var name = file.name;
7784
- var hasExtension = name && name.lastIndexOf('.') !== -1;
7785
- if (hasExtension && !file.type) {
7786
- var ext = name.split('.')
7787
- .pop().toLowerCase();
7788
- var type = COMMON_MIME_TYPES.get(ext);
7789
- if (type) {
7790
- Object.defineProperty(file, 'type', {
7791
- value: type,
7792
- writable: false,
7793
- configurable: false,
7794
- enumerable: true
7795
- });
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);
7796
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();
7797
7299
  }
7798
- return file;
7799
- }
7800
-
7801
- var FILES_TO_IGNORE = [
7802
- // Thumbnail cache files for macOS and Windows
7803
- '.DS_Store',
7804
- 'Thumbs.db' // Windows
7805
- ];
7806
- /**
7807
- * Convert a DragEvent's DataTrasfer object to a list of File objects
7808
- * NOTE: If some of the items are folders,
7809
- * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
7810
- *
7811
- * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
7812
- * and a list of File objects will be returned.
7813
- *
7814
- * @param evt
7815
- */
7816
- function fromEvent(evt) {
7817
- return __awaiter(this, void 0, void 0, function () {
7818
- return __generator(this, function (_a) {
7819
- if (isObject(evt) && isDataTransfer(evt.dataTransfer)) {
7820
- return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
7821
- }
7822
- else if (isChangeEvt(evt)) {
7823
- return [2 /*return*/, getInputFiles(evt)];
7824
- }
7825
- else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
7826
- return [2 /*return*/, getFsHandleFiles(evt)];
7827
- }
7828
- return [2 /*return*/, []];
7829
- });
7830
- });
7831
- }
7832
- function isDataTransfer(value) {
7833
- return isObject(value);
7834
- }
7835
- function isChangeEvt(value) {
7836
- return isObject(value) && isObject(value.target);
7837
- }
7838
- function isObject(v) {
7839
- return typeof v === 'object' && v !== null;
7840
- }
7841
- function getInputFiles(evt) {
7842
- return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
7843
- }
7844
- // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
7845
- function getFsHandleFiles(handles) {
7846
- return __awaiter(this, void 0, void 0, function () {
7847
- var files;
7848
- return __generator(this, function (_a) {
7849
- switch (_a.label) {
7850
- case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
7851
- case 1:
7852
- files = _a.sent();
7853
- return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
7854
- }
7855
- });
7856
- });
7857
- }
7858
- function getDataTransferFiles(dt, type) {
7859
- return __awaiter(this, void 0, void 0, function () {
7860
- var items, files;
7861
- return __generator(this, function (_a) {
7862
- switch (_a.label) {
7863
- case 0:
7864
- if (!dt.items) return [3 /*break*/, 2];
7865
- items = fromList(dt.items)
7866
- .filter(function (item) { return item.kind === 'file'; });
7867
- // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
7868
- // only 'dragstart' and 'drop' has access to the data (source node)
7869
- if (type !== 'drop') {
7870
- return [2 /*return*/, items];
7871
- }
7872
- return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
7873
- case 1:
7874
- files = _a.sent();
7875
- return [2 /*return*/, noIgnoredFiles(flatten(files))];
7876
- case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
7877
- .map(function (file) { return toFileWithPath(file); }))];
7878
- }
7879
- });
7880
- });
7881
- }
7882
- function noIgnoredFiles(files) {
7883
- return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
7884
- }
7885
- // IE11 does not support Array.from()
7886
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
7887
- // https://developer.mozilla.org/en-US/docs/Web/API/FileList
7888
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
7889
- function fromList(items) {
7890
- if (items === null) {
7891
- return [];
7892
- }
7893
- var files = [];
7894
- // tslint:disable: prefer-for-of
7895
- for (var i = 0; i < items.length; i++) {
7896
- var file = items[i];
7897
- files.push(file);
7898
- }
7899
- return files;
7900
- }
7901
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
7902
- function toFilePromises(item) {
7903
- if (typeof item.webkitGetAsEntry !== 'function') {
7904
- return fromDataTransferItem(item);
7905
- }
7906
- var entry = item.webkitGetAsEntry();
7907
- // Safari supports dropping an image node from a different window and can be retrieved using
7908
- // the DataTransferItem.getAsFile() API
7909
- // NOTE: FileSystemEntry.file() throws if trying to get the file
7910
- if (entry && entry.isDirectory) {
7911
- return fromDirEntry(entry);
7912
- }
7913
- return fromDataTransferItem(item);
7914
- }
7915
- function flatten(items) {
7916
- return items.reduce(function (acc, files) { return __spreadArray(__spreadArray([], __read(acc), false), __read((Array.isArray(files) ? flatten(files) : [files])), false); }, []);
7917
- }
7918
- function fromDataTransferItem(item) {
7919
- var file = item.getAsFile();
7920
- if (!file) {
7921
- return Promise.reject("".concat(item, " is not a File"));
7922
- }
7923
- var fwp = toFileWithPath(file);
7924
- return Promise.resolve(fwp);
7925
- }
7926
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
7927
- function fromEntry(entry) {
7928
- return __awaiter(this, void 0, void 0, function () {
7929
- return __generator(this, function (_a) {
7930
- return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
7931
- });
7932
- });
7933
- }
7934
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
7935
- function fromDirEntry(entry) {
7936
- var reader = entry.createReader();
7937
- return new Promise(function (resolve, reject) {
7938
- var entries = [];
7939
- function readEntries() {
7940
- var _this = this;
7941
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
7942
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
7943
- reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
7944
- var files, err_1, items;
7945
- return __generator(this, function (_a) {
7946
- switch (_a.label) {
7947
- case 0:
7948
- if (!!batch.length) return [3 /*break*/, 5];
7949
- _a.label = 1;
7950
- case 1:
7951
- _a.trys.push([1, 3, , 4]);
7952
- return [4 /*yield*/, Promise.all(entries)];
7953
- case 2:
7954
- files = _a.sent();
7955
- resolve(files);
7956
- return [3 /*break*/, 4];
7957
- case 3:
7958
- err_1 = _a.sent();
7959
- reject(err_1);
7960
- return [3 /*break*/, 4];
7961
- case 4: return [3 /*break*/, 6];
7962
- case 5:
7963
- items = Promise.all(batch.map(fromEntry));
7964
- entries.push(items);
7965
- // Continue reading
7966
- readEntries();
7967
- _a.label = 6;
7968
- case 6: return [2 /*return*/];
7969
- }
7970
- });
7971
- }); }, function (err) {
7972
- reject(err);
7973
- });
7974
- }
7975
- readEntries();
7976
- });
7977
- }
7978
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
7979
- function fromFileEntry(entry) {
7980
- return __awaiter(this, void 0, void 0, function () {
7981
- return __generator(this, function (_a) {
7982
- return [2 /*return*/, new Promise(function (resolve, reject) {
7983
- entry.file(function (file) {
7984
- var fwp = toFileWithPath(file, entry.fullPath);
7985
- resolve(fwp);
7986
- }, function (err) {
7987
- reject(err);
7988
- });
7989
- })];
7990
- });
7991
- });
7992
- }
7993
-
7994
- var _default = function (file, acceptedFiles) {
7995
- if (file && acceptedFiles) {
7996
- var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
7997
- var fileName = file.name || '';
7998
- var mimeType = (file.type || '').toLowerCase();
7999
- var baseMimeType = mimeType.replace(/\/.*$/, '');
8000
- return acceptedFilesArray.some(function (type) {
8001
- var validType = type.trim().toLowerCase();
8002
-
8003
- if (validType.charAt(0) === '.') {
8004
- return fileName.toLowerCase().endsWith(validType);
8005
- } else if (validType.endsWith('/*')) {
8006
- // This is something like a image/* mime type
8007
- return baseMimeType === validType.replace(/\/.*$/, '');
8008
- }
8009
-
8010
- return mimeType === validType;
8011
- });
8012
- }
8013
-
8014
- return true;
8015
- };
8016
-
8017
- function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); }
8018
-
8019
- 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."); }
8020
-
8021
- function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8022
-
8023
- function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
8024
-
8025
- 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; }
8026
-
8027
- 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; }
8028
-
8029
- 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; }
8030
-
8031
- function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
8032
-
8033
- 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."); }
8034
-
8035
- 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); }
8036
-
8037
- 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; }
8038
-
8039
- 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; }
8040
-
8041
- function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
8042
-
8043
- var FILE_INVALID_TYPE = "file-invalid-type";
8044
- var FILE_TOO_LARGE = "file-too-large";
8045
- var FILE_TOO_SMALL = "file-too-small";
8046
- var TOO_MANY_FILES = "too-many-files";
8047
-
8048
- var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
8049
- accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
8050
- var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
8051
- return {
8052
- code: FILE_INVALID_TYPE,
8053
- message: "File type must be ".concat(messageSuffix)
8054
- };
8055
- };
8056
- var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
8057
- return {
8058
- code: FILE_TOO_LARGE,
8059
- message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
8060
- };
8061
- };
8062
- var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
8063
- return {
8064
- code: FILE_TOO_SMALL,
8065
- message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
8066
- };
8067
- };
8068
- var TOO_MANY_FILES_REJECTION = {
8069
- code: TOO_MANY_FILES,
8070
- message: "Too many files"
8071
- }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
8072
- // that MIME type will always be accepted
8073
-
8074
- function fileAccepted(file, accept) {
8075
- var isAcceptable = file.type === "application/x-moz-file" || _default(file, accept);
8076
- return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
8077
- }
8078
- function fileMatchSize(file, minSize, maxSize) {
8079
- if (isDefined(file.size)) {
8080
- if (isDefined(minSize) && isDefined(maxSize)) {
8081
- if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
8082
- if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
8083
- } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
8084
- }
8085
-
8086
- return [true, null];
8087
- }
8088
-
8089
- function isDefined(value) {
8090
- return value !== undefined && value !== null;
8091
- }
8092
- /**
8093
- *
8094
- * @param {object} options
8095
- * @param {File[]} options.files
8096
- * @param {string|string[]} [options.accept]
8097
- * @param {number} [options.minSize]
8098
- * @param {number} [options.maxSize]
8099
- * @param {boolean} [options.multiple]
8100
- * @param {number} [options.maxFiles]
8101
- * @param {(f: File) => FileError|FileError[]|null} [options.validator]
8102
- * @returns
8103
- */
8104
-
8105
-
8106
- function allFilesAccepted(_ref) {
8107
- var files = _ref.files,
8108
- accept = _ref.accept,
8109
- minSize = _ref.minSize,
8110
- maxSize = _ref.maxSize,
8111
- multiple = _ref.multiple,
8112
- maxFiles = _ref.maxFiles,
8113
- validator = _ref.validator;
8114
-
8115
- if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
8116
- return false;
8117
- }
8118
-
8119
- return files.every(function (file) {
8120
- var _fileAccepted = fileAccepted(file, accept),
8121
- _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
8122
- accepted = _fileAccepted2[0];
8123
-
8124
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
8125
- _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
8126
- sizeMatch = _fileMatchSize2[0];
8127
-
8128
- var customErrors = validator ? validator(file) : null;
8129
- return accepted && sizeMatch && !customErrors;
8130
- });
8131
- } // React's synthetic events has event.isPropagationStopped,
8132
- // but to remain compatibility with other libs (Preact) fall back
8133
- // to check event.cancelBubble
8134
-
8135
- function isPropagationStopped(event) {
8136
- if (typeof event.isPropagationStopped === "function") {
8137
- return event.isPropagationStopped();
8138
- } else if (typeof event.cancelBubble !== "undefined") {
8139
- return event.cancelBubble;
8140
- }
8141
-
8142
- return false;
8143
- }
8144
- function isEvtWithFiles(event) {
8145
- if (!event.dataTransfer) {
8146
- return !!event.target && !!event.target.files;
8147
- } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
8148
- // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
8149
-
8150
-
8151
- return Array.prototype.some.call(event.dataTransfer.types, function (type) {
8152
- return type === "Files" || type === "application/x-moz-file";
8153
- });
8154
- }
8155
-
8156
- function onDocumentDragOver(event) {
8157
- event.preventDefault();
8158
- }
8159
-
8160
- function isIe(userAgent) {
8161
- return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
8162
- }
8163
-
8164
- function isEdge(userAgent) {
8165
- return userAgent.indexOf("Edge/") !== -1;
8166
- }
8167
-
8168
- function isIeOrEdge() {
8169
- var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
8170
- return isIe(userAgent) || isEdge(userAgent);
8171
- }
8172
- /**
8173
- * This is intended to be used to compose event handlers
8174
- * They are executed in order until one of them calls `event.isPropagationStopped()`.
8175
- * Note that the check is done on the first invoke too,
8176
- * meaning that if propagation was stopped before invoking the fns,
8177
- * no handlers will be executed.
8178
- *
8179
- * @param {Function} fns the event hanlder functions
8180
- * @return {Function} the event handler to add to an element
8181
- */
8182
-
8183
- function composeEventHandlers() {
8184
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
8185
- fns[_key] = arguments[_key];
8186
- }
8187
-
8188
- return function (event) {
8189
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8190
- args[_key2 - 1] = arguments[_key2];
8191
- }
8192
-
8193
- return fns.some(function (fn) {
8194
- if (!isPropagationStopped(event) && fn) {
8195
- fn.apply(void 0, [event].concat(args));
8196
- }
8197
-
8198
- return isPropagationStopped(event);
8199
- });
8200
- };
8201
- }
8202
- /**
8203
- * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
8204
- * is supported by the browser.
8205
- * @returns {boolean}
8206
- */
8207
-
8208
- function canUseFileSystemAccessAPI() {
8209
- return "showOpenFilePicker" in window;
8210
- }
8211
- /**
8212
- * Convert the `{accept}` dropzone prop to the
8213
- * `{types}` option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
8214
- *
8215
- * @param {AcceptProp} accept
8216
- * @returns {{accept: string[]}[]}
8217
- */
8218
-
8219
- function pickerOptionsFromAccept(accept) {
8220
- if (isDefined(accept)) {
8221
- var acceptForPicker = Object.entries(accept).filter(function (_ref2) {
8222
- var _ref3 = _slicedToArray$1(_ref2, 2),
8223
- mimeType = _ref3[0],
8224
- ext = _ref3[1];
8225
-
8226
- var ok = true;
8227
-
8228
- if (!isMIMEType(mimeType)) {
8229
- 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."));
8230
- ok = false;
8231
- }
8232
-
8233
- if (!Array.isArray(ext) || !ext.every(isExt)) {
8234
- console.warn("Skipped \"".concat(mimeType, "\" because an invalid file extension was provided."));
8235
- ok = false;
8236
- }
8237
-
8238
- return ok;
8239
- }).reduce(function (agg, _ref4) {
8240
- var _ref5 = _slicedToArray$1(_ref4, 2),
8241
- mimeType = _ref5[0],
8242
- ext = _ref5[1];
8243
-
8244
- return _objectSpread$9(_objectSpread$9({}, agg), {}, _defineProperty$1({}, mimeType, ext));
8245
- }, {});
8246
- return [{
8247
- accept: acceptForPicker
8248
- }];
8249
- }
8250
-
8251
- return accept;
8252
- }
8253
- /**
8254
- * Convert the `{accept}` dropzone prop to an array of MIME types/extensions.
8255
- * @param {AcceptProp} accept
8256
- * @returns {string}
8257
- */
8258
-
8259
- function acceptPropAsAcceptAttr(accept) {
8260
- if (isDefined(accept)) {
8261
- return Object.entries(accept).reduce(function (a, _ref6) {
8262
- var _ref7 = _slicedToArray$1(_ref6, 2),
8263
- mimeType = _ref7[0],
8264
- ext = _ref7[1];
8265
-
8266
- return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
8267
- }, []) // Silently discard invalid entries as pickerOptionsFromAccept warns about these
8268
- .filter(function (v) {
8269
- return isMIMEType(v) || isExt(v);
8270
- }).join(",");
8271
- }
8272
-
8273
- return undefined;
8274
- }
8275
- /**
8276
- * Check if v is an exception caused by aborting a request (e.g window.showOpenFilePicker()).
8277
- *
8278
- * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
8279
- * @param {any} v
8280
- * @returns {boolean} True if v is an abort exception.
8281
- */
8282
-
8283
- function isAbort(v) {
8284
- return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR);
8285
- }
8286
- /**
8287
- * Check if v is a security error.
8288
- *
8289
- * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
8290
- * @param {any} v
8291
- * @returns {boolean} True if v is a security error.
8292
- */
8293
-
8294
- function isSecurityError(v) {
8295
- return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
8296
- }
8297
- /**
8298
- * Check if v is a MIME type string.
8299
- *
8300
- * See accepted format: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers.
8301
- *
8302
- * @param {string} v
8303
- */
8304
-
8305
- function isMIMEType(v) {
8306
- return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v);
8307
- }
8308
- /**
8309
- * Check if v is a file extension.
8310
- * @param {string} v
8311
- */
8312
-
8313
- function isExt(v) {
8314
- return /^.*\.[\w]+$/.test(v);
8315
- }
8316
- /**
8317
- * @typedef {Object.<string, string[]>} AcceptProp
8318
- */
8319
-
8320
- /**
8321
- * @typedef {object} FileError
8322
- * @property {string} message
8323
- * @property {ErrorCode|string} code
8324
- */
8325
-
8326
- /**
8327
- * @typedef {"file-invalid-type"|"file-too-large"|"file-too-small"|"too-many-files"} ErrorCode
8328
- */
8329
-
8330
- var _excluded$3 = ["children"],
8331
- _excluded2$2 = ["open"],
8332
- _excluded3$1 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
8333
- _excluded4 = ["refKey", "onChange", "onClick"];
8334
-
8335
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8336
-
8337
- 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."); }
8338
-
8339
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8340
-
8341
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8342
-
8343
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8344
-
8345
- 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."); }
8346
-
8347
- 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); }
8348
-
8349
- 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; }
8350
-
8351
- 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; }
8352
-
8353
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8354
-
8355
- 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; }
8356
-
8357
- 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; }
8358
-
8359
- 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; }
8360
-
8361
- 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; }
8362
-
8363
- 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; }
8364
- /**
8365
- * Convenience wrapper component for the `useDropzone` hook
8366
- *
8367
- * ```jsx
8368
- * <Dropzone>
8369
- * {({getRootProps, getInputProps}) => (
8370
- * <div {...getRootProps()}>
8371
- * <input {...getInputProps()} />
8372
- * <p>Drag 'n' drop some files here, or click to select files</p>
8373
- * </div>
8374
- * )}
8375
- * </Dropzone>
8376
- * ```
8377
- */
8378
-
8379
- var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
8380
- var children = _ref.children,
8381
- params = _objectWithoutProperties(_ref, _excluded$3);
8382
-
8383
- var _useDropzone = useDropzone(params),
8384
- open = _useDropzone.open,
8385
- props = _objectWithoutProperties(_useDropzone, _excluded2$2);
8386
-
8387
- useImperativeHandle(ref, function () {
8388
- return {
8389
- open: open
8390
- };
8391
- }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
8392
-
8393
- return /*#__PURE__*/React.createElement(Fragment, null, children(_objectSpread$8(_objectSpread$8({}, props), {}, {
8394
- open: open
8395
- })));
8396
- });
8397
- Dropzone.displayName = "Dropzone"; // Add default props for react-docgen
8398
-
8399
- var defaultProps = {
8400
- disabled: false,
8401
- getFilesFromEvent: fromEvent,
8402
- maxSize: Infinity,
8403
- minSize: 0,
8404
- multiple: true,
8405
- maxFiles: 0,
8406
- preventDropOnDocument: true,
8407
- noClick: false,
8408
- noKeyboard: false,
8409
- noDrag: false,
8410
- noDragEventsBubbling: false,
8411
- validator: null,
8412
- useFsAccessApi: true,
8413
- autoFocus: false
8414
- };
8415
- Dropzone.defaultProps = defaultProps;
8416
- Dropzone.propTypes = {
8417
- /**
8418
- * Render function that exposes the dropzone state and prop getter fns
8419
- *
8420
- * @param {object} params
8421
- * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
8422
- * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
8423
- * @param {Function} params.open Open the native file selection dialog
8424
- * @param {boolean} params.isFocused Dropzone area is in focus
8425
- * @param {boolean} params.isFileDialogActive File dialog is opened
8426
- * @param {boolean} params.isDragActive Active drag is in progress
8427
- * @param {boolean} params.isDragAccept Dragged files are accepted
8428
- * @param {boolean} params.isDragReject Some dragged files are rejected
8429
- * @param {File[]} params.acceptedFiles Accepted files
8430
- * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
8431
- */
8432
- children: propTypes.exports.func,
8433
-
8434
- /**
8435
- * Set accepted file types.
8436
- * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
8437
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
8438
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
8439
- * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
8440
- */
8441
- accept: propTypes.exports.objectOf(propTypes.exports.arrayOf(propTypes.exports.string)),
8442
-
8443
- /**
8444
- * Allow drag 'n' drop (or selection from the file dialog) of multiple files
8445
- */
8446
- multiple: propTypes.exports.bool,
8447
-
8448
- /**
8449
- * If false, allow dropped items to take over the current browser window
8450
- */
8451
- preventDropOnDocument: propTypes.exports.bool,
8452
-
8453
- /**
8454
- * If true, disables click to open the native file selection dialog
8455
- */
8456
- noClick: propTypes.exports.bool,
8457
-
8458
- /**
8459
- * If true, disables SPACE/ENTER to open the native file selection dialog.
8460
- * Note that it also stops tracking the focus state.
8461
- */
8462
- noKeyboard: propTypes.exports.bool,
8463
-
8464
- /**
8465
- * If true, disables drag 'n' drop
8466
- */
8467
- noDrag: propTypes.exports.bool,
8468
-
8469
- /**
8470
- * If true, stops drag event propagation to parents
8471
- */
8472
- noDragEventsBubbling: propTypes.exports.bool,
8473
-
8474
- /**
8475
- * Minimum file size (in bytes)
8476
- */
8477
- minSize: propTypes.exports.number,
8478
-
8479
- /**
8480
- * Maximum file size (in bytes)
8481
- */
8482
- maxSize: propTypes.exports.number,
8483
-
8484
- /**
8485
- * Maximum accepted number of files
8486
- * The default value is 0 which means there is no limitation to how many files are accepted.
8487
- */
8488
- maxFiles: propTypes.exports.number,
8489
-
8490
- /**
8491
- * Enable/disable the dropzone
8492
- */
8493
- disabled: propTypes.exports.bool,
8494
-
8495
- /**
8496
- * Use this to provide a custom file aggregator
8497
- *
8498
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8499
- */
8500
- getFilesFromEvent: propTypes.exports.func,
8501
-
8502
- /**
8503
- * Cb for when closing the file dialog with no selection
8504
- */
8505
- onFileDialogCancel: propTypes.exports.func,
8506
-
8507
- /**
8508
- * Cb for when opening the file dialog
8509
- */
8510
- onFileDialogOpen: propTypes.exports.func,
8511
-
8512
- /**
8513
- * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
8514
- * to open the file picker instead of using an `<input type="file">` click event.
8515
- */
8516
- useFsAccessApi: propTypes.exports.bool,
8517
-
8518
- /**
8519
- * Set to true to focus the root element on render
8520
- */
8521
- autoFocus: propTypes.exports.bool,
8522
-
8523
- /**
8524
- * Cb for when the `dragenter` event occurs.
8525
- *
8526
- * @param {DragEvent} event
8527
- */
8528
- onDragEnter: propTypes.exports.func,
8529
-
8530
- /**
8531
- * Cb for when the `dragleave` event occurs
8532
- *
8533
- * @param {DragEvent} event
8534
- */
8535
- onDragLeave: propTypes.exports.func,
8536
-
8537
- /**
8538
- * Cb for when the `dragover` event occurs
8539
- *
8540
- * @param {DragEvent} event
8541
- */
8542
- onDragOver: propTypes.exports.func,
8543
-
8544
- /**
8545
- * Cb for when the `drop` event occurs.
8546
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
8547
- *
8548
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
8549
- * `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.
8550
- * If `multiple` is set to false and additional files are dropped,
8551
- * all files besides the first will be rejected.
8552
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
8553
- *
8554
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
8555
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
8556
- *
8557
- * `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.
8558
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
8559
- *
8560
- * ```js
8561
- * function onDrop(acceptedFiles) {
8562
- * const req = request.post('/upload')
8563
- * acceptedFiles.forEach(file => {
8564
- * req.attach(file.name, file)
8565
- * })
8566
- * req.end(callback)
8567
- * }
8568
- * ```
8569
- *
8570
- * @param {File[]} acceptedFiles
8571
- * @param {FileRejection[]} fileRejections
8572
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8573
- */
8574
- onDrop: propTypes.exports.func,
8575
-
8576
- /**
8577
- * Cb for when the `drop` event occurs.
8578
- * Note that if no files are accepted, this callback is not invoked.
8579
- *
8580
- * @param {File[]} files
8581
- * @param {(DragEvent|Event)} event
8582
- */
8583
- onDropAccepted: propTypes.exports.func,
8584
-
8585
- /**
8586
- * Cb for when the `drop` event occurs.
8587
- * Note that if no files are rejected, this callback is not invoked.
8588
- *
8589
- * @param {FileRejection[]} fileRejections
8590
- * @param {(DragEvent|Event)} event
8591
- */
8592
- onDropRejected: propTypes.exports.func,
8593
-
8594
- /**
8595
- * Cb for when there's some error from any of the promises.
8596
- *
8597
- * @param {Error} error
8598
- */
8599
- onError: propTypes.exports.func,
8600
-
8601
- /**
8602
- * Custom validation function. It must return null if there's no errors.
8603
- * @param {File} file
8604
- * @returns {FileError|FileError[]|null}
8605
- */
8606
- validator: propTypes.exports.func
8607
- };
8608
- var Dropzone$1 = Dropzone;
8609
- /**
8610
- * A function that is invoked for the `dragenter`,
8611
- * `dragover` and `dragleave` events.
8612
- * It is not invoked if the items are not files (such as link, text, etc.).
8613
- *
8614
- * @callback dragCb
8615
- * @param {DragEvent} event
8616
- */
8617
-
8618
- /**
8619
- * A function that is invoked for the `drop` or input change event.
8620
- * It is not invoked if the items are not files (such as link, text, etc.).
8621
- *
8622
- * @callback dropCb
8623
- * @param {File[]} acceptedFiles List of accepted files
8624
- * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
8625
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8626
- */
8627
-
8628
- /**
8629
- * A function that is invoked for the `drop` or input change event.
8630
- * It is not invoked if the items are files (such as link, text, etc.).
8631
- *
8632
- * @callback dropAcceptedCb
8633
- * @param {File[]} files List of accepted files that meet the given criteria
8634
- * (`accept`, `multiple`, `minSize`, `maxSize`)
8635
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8636
- */
8637
-
8638
- /**
8639
- * A function that is invoked for the `drop` or input change event.
8640
- *
8641
- * @callback dropRejectedCb
8642
- * @param {File[]} files List of rejected files that do not meet the given criteria
8643
- * (`accept`, `multiple`, `minSize`, `maxSize`)
8644
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8645
- */
8646
-
8647
- /**
8648
- * A function that is used aggregate files,
8649
- * in a asynchronous fashion, from drag or input change events.
8650
- *
8651
- * @callback getFilesFromEvent
8652
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
8653
- * @returns {(File[]|Promise<File[]>)}
8654
- */
8655
-
8656
- /**
8657
- * An object with the current dropzone state.
8658
- *
8659
- * @typedef {object} DropzoneState
8660
- * @property {boolean} isFocused Dropzone area is in focus
8661
- * @property {boolean} isFileDialogActive File dialog is opened
8662
- * @property {boolean} isDragActive Active drag is in progress
8663
- * @property {boolean} isDragAccept Dragged files are accepted
8664
- * @property {boolean} isDragReject Some dragged files are rejected
8665
- * @property {File[]} acceptedFiles Accepted files
8666
- * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
8667
- */
8668
-
8669
- /**
8670
- * An object with the dropzone methods.
8671
- *
8672
- * @typedef {object} DropzoneMethods
8673
- * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
8674
- * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
8675
- * @property {Function} open Open the native file selection dialog
8676
- */
8677
-
8678
- var initialState = {
8679
- isFocused: false,
8680
- isFileDialogActive: false,
8681
- isDragActive: false,
8682
- isDragAccept: false,
8683
- isDragReject: false,
8684
- acceptedFiles: [],
8685
- fileRejections: []
8686
- };
8687
- /**
8688
- * A React hook that creates a drag 'n' drop area.
8689
- *
8690
- * ```jsx
8691
- * function MyDropzone(props) {
8692
- * const {getRootProps, getInputProps} = useDropzone({
8693
- * onDrop: acceptedFiles => {
8694
- * // do something with the File objects, e.g. upload to some server
8695
- * }
8696
- * });
8697
- * return (
8698
- * <div {...getRootProps()}>
8699
- * <input {...getInputProps()} />
8700
- * <p>Drag and drop some files here, or click to select files</p>
8701
- * </div>
8702
- * )
8703
- * }
8704
- * ```
8705
- *
8706
- * @function useDropzone
8707
- *
8708
- * @param {object} props
8709
- * @param {import("./utils").AcceptProp} [props.accept] Set accepted file types.
8710
- * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
8711
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
8712
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
8713
- * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
8714
- * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
8715
- * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
8716
- * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
8717
- * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
8718
- * Note that it also stops tracking the focus state.
8719
- * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
8720
- * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
8721
- * @param {number} [props.minSize=0] Minimum file size (in bytes)
8722
- * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
8723
- * @param {boolean} [props.disabled=false] Enable/disable the dropzone
8724
- * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
8725
- * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
8726
- * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
8727
- * to open the file picker instead of using an `<input type="file">` click event.
8728
- * @param {boolean} autoFocus Set to true to auto focus the root element.
8729
- * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
8730
- * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
8731
- * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
8732
- * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
8733
- * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
8734
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
8735
- *
8736
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
8737
- * `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).
8738
- * If `multiple` is set to false and additional files are dropped,
8739
- * all files besides the first will be rejected.
8740
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
8741
- *
8742
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
8743
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
8744
- *
8745
- * `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.
8746
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
8747
- *
8748
- * ```js
8749
- * function onDrop(acceptedFiles) {
8750
- * const req = request.post('/upload')
8751
- * acceptedFiles.forEach(file => {
8752
- * req.attach(file.name, file)
8753
- * })
8754
- * req.end(callback)
8755
- * }
8756
- * ```
8757
- * @param {dropAcceptedCb} [props.onDropAccepted]
8758
- * @param {dropRejectedCb} [props.onDropRejected]
8759
- * @param {(error: Error) => void} [props.onError]
8760
- *
8761
- * @returns {DropzoneState & DropzoneMethods}
8762
- */
8763
-
8764
- function useDropzone() {
8765
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8766
-
8767
- var _defaultProps$props = _objectSpread$8(_objectSpread$8({}, defaultProps), props),
8768
- accept = _defaultProps$props.accept,
8769
- disabled = _defaultProps$props.disabled,
8770
- getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
8771
- maxSize = _defaultProps$props.maxSize,
8772
- minSize = _defaultProps$props.minSize,
8773
- multiple = _defaultProps$props.multiple,
8774
- maxFiles = _defaultProps$props.maxFiles,
8775
- onDragEnter = _defaultProps$props.onDragEnter,
8776
- onDragLeave = _defaultProps$props.onDragLeave,
8777
- onDragOver = _defaultProps$props.onDragOver,
8778
- onDrop = _defaultProps$props.onDrop,
8779
- onDropAccepted = _defaultProps$props.onDropAccepted,
8780
- onDropRejected = _defaultProps$props.onDropRejected,
8781
- onFileDialogCancel = _defaultProps$props.onFileDialogCancel,
8782
- onFileDialogOpen = _defaultProps$props.onFileDialogOpen,
8783
- useFsAccessApi = _defaultProps$props.useFsAccessApi,
8784
- autoFocus = _defaultProps$props.autoFocus,
8785
- preventDropOnDocument = _defaultProps$props.preventDropOnDocument,
8786
- noClick = _defaultProps$props.noClick,
8787
- noKeyboard = _defaultProps$props.noKeyboard,
8788
- noDrag = _defaultProps$props.noDrag,
8789
- noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling,
8790
- onError = _defaultProps$props.onError,
8791
- validator = _defaultProps$props.validator;
8792
-
8793
- var acceptAttr = useMemo(function () {
8794
- return acceptPropAsAcceptAttr(accept);
8795
- }, [accept]);
8796
- var pickerTypes = useMemo(function () {
8797
- return pickerOptionsFromAccept(accept);
8798
- }, [accept]);
8799
- var onFileDialogOpenCb = useMemo(function () {
8800
- return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
8801
- }, [onFileDialogOpen]);
8802
- var onFileDialogCancelCb = useMemo(function () {
8803
- return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
8804
- }, [onFileDialogCancel]);
8805
- /**
8806
- * @constant
8807
- * @type {React.MutableRefObject<HTMLElement>}
8808
- */
8809
-
8810
- var rootRef = useRef(null);
8811
- var inputRef = useRef(null);
8812
-
8813
- var _useReducer = useReducer(reducer, initialState),
8814
- _useReducer2 = _slicedToArray(_useReducer, 2),
8815
- state = _useReducer2[0],
8816
- dispatch = _useReducer2[1];
8817
-
8818
- var isFocused = state.isFocused,
8819
- isFileDialogActive = state.isFileDialogActive;
8820
- var fsAccessApiWorksRef = useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); // Update file dialog active state when the window is focused on
8821
-
8822
- var onWindowFocus = function onWindowFocus() {
8823
- // Execute the timeout only if the file dialog is opened in the browser
8824
- if (!fsAccessApiWorksRef.current && isFileDialogActive) {
8825
- setTimeout(function () {
8826
- if (inputRef.current) {
8827
- var files = inputRef.current.files;
8828
-
8829
- if (!files.length) {
8830
- dispatch({
8831
- type: "closeDialog"
8832
- });
8833
- onFileDialogCancelCb();
8834
- }
8835
- }
8836
- }, 300);
8837
- }
8838
- };
8839
-
8840
- useEffect(function () {
8841
- window.addEventListener("focus", onWindowFocus, false);
8842
- return function () {
8843
- window.removeEventListener("focus", onWindowFocus, false);
8844
- };
8845
- }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
8846
- var dragTargetsRef = useRef([]);
8847
-
8848
- var onDocumentDrop = function onDocumentDrop(event) {
8849
- if (rootRef.current && rootRef.current.contains(event.target)) {
8850
- // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
8851
- return;
8852
- }
8853
-
8854
- event.preventDefault();
8855
- dragTargetsRef.current = [];
8856
- };
8857
-
8858
- useEffect(function () {
8859
- if (preventDropOnDocument) {
8860
- document.addEventListener("dragover", onDocumentDragOver, false);
8861
- document.addEventListener("drop", onDocumentDrop, false);
8862
- }
8863
-
8864
- return function () {
8865
- if (preventDropOnDocument) {
8866
- document.removeEventListener("dragover", onDocumentDragOver);
8867
- document.removeEventListener("drop", onDocumentDrop);
8868
- }
8869
- };
8870
- }, [rootRef, preventDropOnDocument]); // Auto focus the root when autoFocus is true
8871
-
8872
- useEffect(function () {
8873
- if (!disabled && autoFocus && rootRef.current) {
8874
- rootRef.current.focus();
8875
- }
8876
-
8877
- return function () {};
8878
- }, [rootRef, autoFocus, disabled]);
8879
- var onErrCb = useCallback(function (e) {
8880
- if (onError) {
8881
- onError(e);
8882
- } else {
8883
- // Let the user know something's gone wrong if they haven't provided the onError cb.
8884
- console.error(e);
8885
- }
8886
- }, [onError]);
8887
- var onDragEnterCb = useCallback(function (event) {
8888
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
8889
-
8890
- event.persist();
8891
- stopPropagation(event);
8892
- dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
8893
-
8894
- if (isEvtWithFiles(event)) {
8895
- Promise.resolve(getFilesFromEvent(event)).then(function (files) {
8896
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
8897
- return;
8898
- }
8899
-
8900
- var fileCount = files.length;
8901
- var isDragAccept = fileCount > 0 && allFilesAccepted({
8902
- files: files,
8903
- accept: acceptAttr,
8904
- minSize: minSize,
8905
- maxSize: maxSize,
8906
- multiple: multiple,
8907
- maxFiles: maxFiles,
8908
- validator: validator
8909
- });
8910
- var isDragReject = fileCount > 0 && !isDragAccept;
8911
- dispatch({
8912
- isDragAccept: isDragAccept,
8913
- isDragReject: isDragReject,
8914
- isDragActive: true,
8915
- type: "setDraggedFiles"
8916
- });
8917
-
8918
- if (onDragEnter) {
8919
- onDragEnter(event);
8920
- }
8921
- }).catch(function (e) {
8922
- return onErrCb(e);
8923
- });
8924
- }
8925
- }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
8926
- var onDragOverCb = useCallback(function (event) {
8927
- event.preventDefault();
8928
- event.persist();
8929
- stopPropagation(event);
8930
- var hasFiles = isEvtWithFiles(event);
8931
-
8932
- if (hasFiles && event.dataTransfer) {
8933
- try {
8934
- event.dataTransfer.dropEffect = "copy";
8935
- } catch (_unused) {}
8936
- /* eslint-disable-line no-empty */
8937
-
8938
- }
8939
-
8940
- if (hasFiles && onDragOver) {
8941
- onDragOver(event);
8942
- }
8943
-
8944
- return false;
8945
- }, [onDragOver, noDragEventsBubbling]);
8946
- var onDragLeaveCb = useCallback(function (event) {
8947
- event.preventDefault();
8948
- event.persist();
8949
- stopPropagation(event); // Only deactivate once the dropzone and all children have been left
8950
-
8951
- var targets = dragTargetsRef.current.filter(function (target) {
8952
- return rootRef.current && rootRef.current.contains(target);
8953
- }); // Make sure to remove a target present multiple times only once
8954
- // (Firefox may fire dragenter/dragleave multiple times on the same element)
8955
-
8956
- var targetIdx = targets.indexOf(event.target);
8957
-
8958
- if (targetIdx !== -1) {
8959
- targets.splice(targetIdx, 1);
8960
- }
8961
-
8962
- dragTargetsRef.current = targets;
8963
-
8964
- if (targets.length > 0) {
8965
- return;
8966
- }
8967
-
8968
- dispatch({
8969
- type: "setDraggedFiles",
8970
- isDragActive: false,
8971
- isDragAccept: false,
8972
- isDragReject: false
8973
- });
8974
-
8975
- if (isEvtWithFiles(event) && onDragLeave) {
8976
- onDragLeave(event);
8977
- }
8978
- }, [rootRef, onDragLeave, noDragEventsBubbling]);
8979
- var setFiles = useCallback(function (files, event) {
8980
- var acceptedFiles = [];
8981
- var fileRejections = [];
8982
- files.forEach(function (file) {
8983
- var _fileAccepted = fileAccepted(file, acceptAttr),
8984
- _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
8985
- accepted = _fileAccepted2[0],
8986
- acceptError = _fileAccepted2[1];
8987
-
8988
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
8989
- _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
8990
- sizeMatch = _fileMatchSize2[0],
8991
- sizeError = _fileMatchSize2[1];
8992
-
8993
- var customErrors = validator ? validator(file) : null;
8994
-
8995
- if (accepted && sizeMatch && !customErrors) {
8996
- acceptedFiles.push(file);
8997
- } else {
8998
- var errors = [acceptError, sizeError];
8999
-
9000
- if (customErrors) {
9001
- errors = errors.concat(customErrors);
9002
- }
9003
-
9004
- fileRejections.push({
9005
- file: file,
9006
- errors: errors.filter(function (e) {
9007
- return e;
9008
- })
9009
- });
9010
- }
9011
- });
9012
-
9013
- if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
9014
- // Reject everything and empty accepted files
9015
- acceptedFiles.forEach(function (file) {
9016
- fileRejections.push({
9017
- file: file,
9018
- errors: [TOO_MANY_FILES_REJECTION]
9019
- });
9020
- });
9021
- acceptedFiles.splice(0);
9022
- }
9023
-
9024
- dispatch({
9025
- acceptedFiles: acceptedFiles,
9026
- fileRejections: fileRejections,
9027
- type: "setFiles"
9028
- });
9029
-
9030
- if (onDrop) {
9031
- onDrop(acceptedFiles, fileRejections, event);
9032
- }
9033
-
9034
- if (fileRejections.length > 0 && onDropRejected) {
9035
- onDropRejected(fileRejections, event);
9036
- }
9037
-
9038
- if (acceptedFiles.length > 0 && onDropAccepted) {
9039
- onDropAccepted(acceptedFiles, event);
9040
- }
9041
- }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
9042
- var onDropCb = useCallback(function (event) {
9043
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
9044
-
9045
- event.persist();
9046
- stopPropagation(event);
9047
- dragTargetsRef.current = [];
9048
-
9049
- if (isEvtWithFiles(event)) {
9050
- Promise.resolve(getFilesFromEvent(event)).then(function (files) {
9051
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
9052
- return;
9053
- }
9054
-
9055
- setFiles(files, event);
9056
- }).catch(function (e) {
9057
- return onErrCb(e);
9058
- });
9059
- }
9060
-
9061
- dispatch({
9062
- type: "reset"
9063
- });
9064
- }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
9065
-
9066
- var openFileDialog = useCallback(function () {
9067
- // No point to use FS access APIs if context is not secure
9068
- // https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#feature_detection
9069
- if (fsAccessApiWorksRef.current) {
9070
- dispatch({
9071
- type: "openDialog"
9072
- });
9073
- onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
9074
-
9075
- var opts = {
9076
- multiple: multiple,
9077
- types: pickerTypes
9078
- };
9079
- window.showOpenFilePicker(opts).then(function (handles) {
9080
- return getFilesFromEvent(handles);
9081
- }).then(function (files) {
9082
- setFiles(files, null);
9083
- dispatch({
9084
- type: "closeDialog"
9085
- });
9086
- }).catch(function (e) {
9087
- // AbortError means the user canceled
9088
- if (isAbort(e)) {
9089
- onFileDialogCancelCb(e);
9090
- dispatch({
9091
- type: "closeDialog"
9092
- });
9093
- } else if (isSecurityError(e)) {
9094
- fsAccessApiWorksRef.current = false; // CORS, so cannot use this API
9095
- // Try using the input
9096
-
9097
- if (inputRef.current) {
9098
- inputRef.current.value = null;
9099
- inputRef.current.click();
9100
- } else {
9101
- 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."));
9102
- }
9103
- } else {
9104
- onErrCb(e);
9105
- }
9106
- });
9107
- return;
9108
- }
9109
-
9110
- if (inputRef.current) {
9111
- dispatch({
9112
- type: "openDialog"
9113
- });
9114
- onFileDialogOpenCb();
9115
- inputRef.current.value = null;
9116
- inputRef.current.click();
9117
- }
9118
- }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
9119
-
9120
- var onKeyDownCb = useCallback(function (event) {
9121
- // Ignore keyboard events bubbling up the DOM tree
9122
- if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
9123
- return;
9124
- }
9125
-
9126
- if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
9127
- event.preventDefault();
9128
- openFileDialog();
9129
- }
9130
- }, [rootRef, openFileDialog]); // Update focus state for the dropzone
9131
-
9132
- var onFocusCb = useCallback(function () {
9133
- dispatch({
9134
- type: "focus"
9135
- });
9136
- }, []);
9137
- var onBlurCb = useCallback(function () {
9138
- dispatch({
9139
- type: "blur"
9140
- });
9141
- }, []); // Cb to open the file dialog when click occurs on the dropzone
9142
-
9143
- var onClickCb = useCallback(function () {
9144
- if (noClick) {
9145
- return;
9146
- } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
9147
- // to ensure React can handle state changes
9148
- // See: https://github.com/react-dropzone/react-dropzone/issues/450
9149
-
9150
-
9151
- if (isIeOrEdge()) {
9152
- setTimeout(openFileDialog, 0);
9153
- } else {
9154
- openFileDialog();
9155
- }
9156
- }, [noClick, openFileDialog]);
9157
-
9158
- var composeHandler = function composeHandler(fn) {
9159
- return disabled ? null : fn;
9160
- };
9161
-
9162
- var composeKeyboardHandler = function composeKeyboardHandler(fn) {
9163
- return noKeyboard ? null : composeHandler(fn);
9164
- };
9165
-
9166
- var composeDragHandler = function composeDragHandler(fn) {
9167
- return noDrag ? null : composeHandler(fn);
9168
- };
9169
-
9170
- var stopPropagation = function stopPropagation(event) {
9171
- if (noDragEventsBubbling) {
9172
- event.stopPropagation();
9173
- }
9174
- };
9175
-
9176
- var getRootProps = useMemo(function () {
9177
- return function () {
9178
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
9179
- _ref2$refKey = _ref2.refKey,
9180
- refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey,
9181
- role = _ref2.role,
9182
- onKeyDown = _ref2.onKeyDown,
9183
- onFocus = _ref2.onFocus,
9184
- onBlur = _ref2.onBlur,
9185
- onClick = _ref2.onClick,
9186
- onDragEnter = _ref2.onDragEnter,
9187
- onDragOver = _ref2.onDragOver,
9188
- onDragLeave = _ref2.onDragLeave,
9189
- onDrop = _ref2.onDrop,
9190
- rest = _objectWithoutProperties(_ref2, _excluded3$1);
9191
-
9192
- return _objectSpread$8(_objectSpread$8(_defineProperty({
9193
- onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
9194
- onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
9195
- onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
9196
- onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
9197
- onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
9198
- onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
9199
- onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
9200
- onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
9201
- role: typeof role === "string" && role !== "" ? role : "presentation"
9202
- }, refKey, rootRef), !disabled && !noKeyboard ? {
9203
- tabIndex: 0
9204
- } : {}), rest);
9205
- };
9206
- }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
9207
- var onInputElementClick = useCallback(function (event) {
9208
- event.stopPropagation();
9209
- }, []);
9210
- var getInputProps = useMemo(function () {
9211
- return function () {
9212
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
9213
- _ref3$refKey = _ref3.refKey,
9214
- refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
9215
- onChange = _ref3.onChange,
9216
- onClick = _ref3.onClick,
9217
- rest = _objectWithoutProperties(_ref3, _excluded4);
9218
-
9219
- var inputProps = _defineProperty({
9220
- accept: acceptAttr,
9221
- multiple: multiple,
9222
- type: "file",
9223
- style: {
9224
- display: "none"
9225
- },
9226
- onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
9227
- onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
9228
- tabIndex: -1
9229
- }, refKey, inputRef);
9230
-
9231
- return _objectSpread$8(_objectSpread$8({}, inputProps), rest);
9232
- };
9233
- }, [inputRef, accept, multiple, onDropCb, disabled]);
9234
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9235
- isFocused: isFocused && !disabled,
9236
- getRootProps: getRootProps,
9237
- getInputProps: getInputProps,
9238
- rootRef: rootRef,
9239
- inputRef: inputRef,
9240
- open: composeHandler(openFileDialog)
9241
- });
9242
- }
9243
- /**
9244
- * @param {DropzoneState} state
9245
- * @param {{type: string} & DropzoneState} action
9246
- * @returns {DropzoneState}
9247
- */
9248
-
9249
- function reducer(state, action) {
9250
- /* istanbul ignore next */
9251
- switch (action.type) {
9252
- case "focus":
9253
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9254
- isFocused: true
9255
- });
9256
-
9257
- case "blur":
9258
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9259
- isFocused: false
9260
- });
9261
-
9262
- case "openDialog":
9263
- return _objectSpread$8(_objectSpread$8({}, initialState), {}, {
9264
- isFileDialogActive: true
9265
- });
9266
-
9267
- case "closeDialog":
9268
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9269
- isFileDialogActive: false
9270
- });
9271
-
9272
- case "setDraggedFiles":
9273
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9274
- isDragActive: action.isDragActive,
9275
- isDragAccept: action.isDragAccept,
9276
- isDragReject: action.isDragReject
9277
- });
9278
-
9279
- case "setFiles":
9280
- return _objectSpread$8(_objectSpread$8({}, state), {}, {
9281
- acceptedFiles: action.acceptedFiles,
9282
- fileRejections: action.fileRejections
9283
- });
9284
-
9285
- case "reset":
9286
- return _objectSpread$8({}, initialState);
9287
-
9288
- default:
9289
- return state;
9290
- }
9291
- }
9292
-
9293
- function noop() {}
9294
-
9295
- const Uploader = _ref => {
9296
- let sampleFileUrl = _ref.sampleFileUrl,
9297
- csvColumns = _ref.csvColumns;
9298
- return /*#__PURE__*/React.createElement(Dropzone$1, {
9299
- onDrop: noop$2
9300
- }, _ref2 => {
9301
- let getRootProps = _ref2.getRootProps,
9302
- getInputProps = _ref2.getInputProps;
9303
- return /*#__PURE__*/React.createElement("div", _extends({}, getRootProps(), {
9304
- className: "ntm-invitations__dnd"
9305
- }), /*#__PURE__*/React.createElement("input", getInputProps()), /*#__PURE__*/React.createElement(Typography, {
9306
- style: "h3"
9307
- }, instance.t("helpers.dropFilesHere")), /*#__PURE__*/React.createElement(Typography, {
9308
- style: "body2"
9309
- }, instance.t("helpers.uploadInstruction1")), /*#__PURE__*/React.createElement(Typography, {
9310
- style: "body2"
9311
- }, /*#__PURE__*/React.createElement(Trans, {
9312
- i18nKey: "helpers.uploadInstruction2",
9313
- values: {
9314
- what: csvColumns.join(", ")
9315
- }
9316
- })), /*#__PURE__*/React.createElement(Typography, {
9317
- style: "body2"
9318
- }, instance.t("helpers.uploadInstruction3")), /*#__PURE__*/React.createElement(Button, {
9319
- style: "link",
9320
- type: "submit",
9321
- icon: Download,
9322
- iconPosition: "left",
9323
- label: instance.t("common.download_", {
9324
- what: "sample.csv"
9325
- }),
9326
- onClick: event => {
9327
- event.stopPropagation();
9328
- window.open(sampleFileUrl);
9329
- }
9330
- }));
9331
- });
9332
- };
9333
-
9334
- /* eslint-disable @bigbinary/neeto/no-dangling-constants */
9335
- const DATETIME_OPTIONS = {
9336
- year: "numeric",
9337
- month: "short",
9338
- day: "numeric",
9339
- hour: "numeric",
9340
- minute: "numeric"
9341
- };
9342
- const COLUMN_DATA = [{
9343
- title: instance.t("helpers.files"),
9344
- dataIndex: "filename",
9345
- key: "filename",
9346
- render: (filename, row) => /*#__PURE__*/React.createElement("a", {
9347
- href: row.download_url,
9348
- download: true,
9349
- className: "ntm-invitations__table-filename"
9350
- }, /*#__PURE__*/React.createElement(File, null), filename)
9351
- }, {
9352
- title: instance.t("helpers.status"),
9353
- dataIndex: "status",
9354
- key: "status",
9355
- render: status => /*#__PURE__*/React.createElement("p", {
9356
- className: classnames("ntm-invitations__table-status", {
9357
- "neeto-ui-text-error-500": status === "failed",
9358
- "neeto-ui-text-success-500": status === "processed"
9359
- })
9360
- }, status)
9361
- }, {
9362
- title: instance.t("helpers.noOfRows"),
9363
- dataIndex: "rows_count",
9364
- key: "rows_count",
9365
- render: rows_count => rows_count !== null && rows_count !== void 0 ? rows_count : "-",
9366
- width: 120,
9367
- align: "center"
9368
- }, {
9369
- title: instance.t("helpers.uploaded"),
9370
- dataIndex: "uploaded_by",
9371
- key: "uploaded_by",
9372
- render: (uploaded_by, row) => `${uploaded_by} at ${new Date(row.created_at).toLocaleString("en-US", DATETIME_OPTIONS)}`
9373
- }];
9374
- const SAMPLE_ROW_DATA = [{
9375
- key: "1",
9376
- filename: "sample-1.csv",
9377
- status: "processed",
9378
- rows_count: "10",
9379
- created_at: new Date(),
9380
- download_url: "https://example.com/sample.csv",
9381
- uploaded_by: "Oliver Smith"
9382
- }, {
9383
- key: "2",
9384
- filename: "sample-2.csv",
9385
- status: "failed",
9386
- rows_count: "20",
9387
- created_at: new Date(),
9388
- download_url: "https://example.com/sample-2.csv",
9389
- uploaded_by: "Sam Smith"
9390
- }, {
9391
- key: "3",
9392
- filename: "sample-3.csv",
9393
- status: "failed",
9394
- rows_count: "30",
9395
- created_at: new Date(),
9396
- download_url: "https://example.com/sample-3.csv",
9397
- uploaded_by: "Eve Smith"
9398
- }, {
9399
- key: "4",
9400
- filename: "sample-4.csv",
9401
- status: "processed",
9402
- rows_count: "40",
9403
- created_at: new Date(),
9404
- download_url: "https://example.com/sample-4.csv",
9405
- uploaded_by: "Anna Smith"
9406
- }, {
9407
- key: "5",
9408
- filename: "sample-5.csv",
9409
- status: "processed",
9410
- rows_count: "50",
9411
- created_at: new Date(),
9412
- download_url: "https://example.com/sample-5.csv",
9413
- uploaded_by: "Will Smith"
9414
- }];
9415
-
9416
- const Uploads = () => /*#__PURE__*/React.createElement("div", {
9417
- className: "ntm-invitations__table"
9418
- }, /*#__PURE__*/React.createElement(Table$1, {
9419
- fixedHeight: true,
9420
- rowData: SAMPLE_ROW_DATA,
9421
- columnData: COLUMN_DATA,
9422
- rowSelection: false
9423
- }));
9424
-
9425
- const Csv = _ref => {
9426
- let label = _ref.label,
9427
- sampleFileUrl = _ref.sampleFileUrl,
9428
- csvColumns = _ref.csvColumns,
9429
- setIsCSVInviteSelected = _ref.setIsCSVInviteSelected;
9430
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Button, {
9431
- size: "small",
9432
- style: "text",
9433
- icon: LeftArrow,
9434
- onClick: () => setIsCSVInviteSelected(false)
9435
- })), /*#__PURE__*/React.createElement(Modal.Body, {
9436
- className: "ntm-invitations__body"
9437
- }, /*#__PURE__*/React.createElement(Typography, {
9438
- style: "h4"
9439
- }, instance.t("common.upload_", {
9440
- what: label
9441
- })), /*#__PURE__*/React.createElement(Uploader, {
9442
- sampleFileUrl: sampleFileUrl,
9443
- csvColumns: csvColumns
9444
- })), /*#__PURE__*/React.createElement(Modal.Footer, {
9445
- className: "ntm-invitations__footer"
9446
- }, /*#__PURE__*/React.createElement(Uploads, null)));
9447
- };
9448
-
9449
- /* eslint-disable @bigbinary/neeto/no-dangling-constants */
9450
- const BASE_URL = "team_members";
9451
- const INVITATIONS_URL = "neeto_invitations";
9452
-
9453
- const fetch$3 = params => axios.get(`${INVITATIONS_URL}/invite_links`, {
9454
- params
9455
- });
9456
- const create$2 = payload => axios.post(`${INVITATIONS_URL}/invite_links`, payload);
9457
- const destroy$1 = (id, payload) => axios.delete(`${INVITATIONS_URL}/invite_links/${id}`, payload);
9458
- const inviteLinksApi = {
9459
- fetch: fetch$3,
9460
- create: create$2,
9461
- destroy: destroy$1
9462
- };
9463
-
9464
- const DEFAULT_STALE_TIME = 300000; // 5 minutes
9465
- const INVITATIONS_STALE_TIME = 3600000; //1 hour
9466
-
9467
- const QUERY_KEYS = {
9468
- TEAMS: "neeto-team-members-teams",
9469
- ROLES: "neeto-team-members-roles",
9470
- PERMISSIONS: "neeto-team-members-permissions",
9471
- INVITE_LINKS: "neeto-team-members-invite-links"
9472
- };
9473
-
9474
- 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; }
9475
- 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; }
9476
- const useFetchInviteLink = function () {
9477
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9478
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9479
- return useQuery([QUERY_KEYS.INVITE_LINKS, params], () => inviteLinksApi.fetch(params), _objectSpread$7({
9480
- staleTime: INVITATIONS_STALE_TIME,
9481
- select: prop("inviteLink"),
9482
- retry: false
9483
- }, options));
9484
- };
9485
- const useCreateInviteLink = () => useMutation(inviteLinksApi.create, {
9486
- onSuccess: _ref => {
9487
- let inviteLink = _ref.inviteLink;
9488
- const resourceType = inviteLink.resourceType,
9489
- resourceId = inviteLink.resourceId;
9490
- queryClient.setQueryData([QUERY_KEYS.INVITE_LINKS, {
9491
- resource_type: resourceType,
9492
- resource_id: resourceId
9493
- }], {
9494
- inviteLink
9495
- });
9496
- }
9497
- });
9498
- const useDestroyInviteLink = () => useMutation(inviteLinksApi.destroy, {
9499
- onSuccess: _ref2 => {
9500
- let inviteLink = _ref2.inviteLink;
9501
- const resourceType = inviteLink.resourceType,
9502
- resourceId = inviteLink.resourceId;
9503
- queryClient.invalidateQueries([QUERY_KEYS.INVITE_LINKS, {
9504
- resource_type: resourceType,
9505
- resource_id: resourceId
9506
- }]);
9507
- }
9508
- });
9509
-
9510
- var dist$1 = {exports: {}};
9511
-
9512
- (function (module, exports) {
9513
- !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);}])});
9514
- } (dist$1));
9515
-
9516
- const renderTime = time => {
9517
- if (time.days) return `${time.days}d ${time.hours}h`;else if (time.hours) return `${time.hours}h ${time.minutes}m`;
9518
- return `${time.minutes}m ${time.seconds}s`;
9519
- };
9520
-
9521
- const Timer = _ref => {
9522
- let expiresAt = _ref.expiresAt;
9523
- const _useTimer = dist$1.exports.useTimer({
9524
- expiryTimestamp: new Date(expiresAt)
9525
- }),
9526
- seconds = _useTimer.seconds,
9527
- minutes = _useTimer.minutes,
9528
- hours = _useTimer.hours,
9529
- days = _useTimer.days;
9530
- return /*#__PURE__*/React.createElement(Typography, {
9531
- style: "body3"
9532
- }, /*#__PURE__*/React.createElement(React.Fragment, null, instance.t("helpers.expiresIn"), renderTime({
9533
- days,
9534
- hours,
9535
- minutes,
9536
- seconds
9537
- })));
9538
- };
9539
-
9540
- const InviteLink = _ref => {
9541
- let resourceType = _ref.resourceType,
9542
- resourceId = _ref.resourceId;
9543
- const _useFetchInviteLink = useFetchInviteLink({
9544
- resource_type: resourceType,
9545
- resource_id: resourceId
9546
- }),
9547
- inviteLink = _useFetchInviteLink.data,
9548
- isLoading = _useFetchInviteLink.isLoading;
9549
- const _useCreateInviteLink = useCreateInviteLink(),
9550
- createInviteLink = _useCreateInviteLink.mutate,
9551
- isCreating = _useCreateInviteLink.isLoading;
9552
- const _useDestroyInviteLink = useDestroyInviteLink(),
9553
- deleteInviteLink = _useDestroyInviteLink.mutate,
9554
- isDeleting = _useDestroyInviteLink.isLoading;
9555
- const showInviteLink = inviteLink && new Date(inviteLink.expiresAt) > new Date();
9556
- const handleCopyInviteLink = () => {
9557
- navigator.clipboard.writeText(`${window.location.host}/neeto_invitations/${inviteLink.id}`);
9558
- Toastr.info(instance.t("helpers.copiedToClipboard"));
9559
- };
9560
- return /*#__PURE__*/React.createElement("div", {
9561
- className: "ntm-invitations__invite-link"
9562
- }, /*#__PURE__*/React.createElement("div", {
9563
- className: "ntm-invitations__invite-link-instructions"
9564
- }, /*#__PURE__*/React.createElement(Typography, {
9565
- style: "h4"
9566
- }, instance.t("helpers.getInviteLink")), /*#__PURE__*/React.createElement(Typography, {
9567
- style: "body2"
9568
- }, instance.t("helpers.inviteLinkInstruction"))), showInviteLink ? /*#__PURE__*/React.createElement("div", {
9569
- className: "ntm-invitations__invite-link-btns"
9570
- }, /*#__PURE__*/React.createElement(Timer, {
9571
- expiresAt: inviteLink.expiresAt
9572
- }), /*#__PURE__*/React.createElement(Button, {
9573
- style: "danger-text",
9574
- label: instance.t("common.delete"),
9575
- loading: isDeleting,
9576
- disabled: isDeleting,
9577
- onClick: () => deleteInviteLink(inviteLink.id)
9578
- }), /*#__PURE__*/React.createElement(Button, {
9579
- style: "primary",
9580
- label: instance.t("buttons.copyLink"),
9581
- onClick: handleCopyInviteLink
9582
- })) : /*#__PURE__*/React.createElement(Button, {
9583
- style: "secondary",
9584
- loading: isLoading || isCreating,
9585
- disabled: isLoading || isCreating,
9586
- label: instance.t("buttons.createLink"),
9587
- onClick: () => createInviteLink({
9588
- inviteLink: {
9589
- resourceType,
9590
- resourceId
9591
- }
9592
- })
9593
- }));
9594
- };
9595
-
9596
- const Normal = _ref => {
9597
- let label = _ref.label,
9598
- children = _ref.children,
9599
- submitButtonProps = _ref.submitButtonProps,
9600
- setIsCSVInviteSelected = _ref.setIsCSVInviteSelected,
9601
- isCSVInviteEnabled = _ref.isCSVInviteEnabled,
9602
- isInviteLinkEnabled = _ref.isInviteLinkEnabled,
9603
- _ref$inviteLinkProps = _ref.inviteLinkProps,
9604
- inviteLinkProps = _ref$inviteLinkProps === void 0 ? {} : _ref$inviteLinkProps;
9605
- const _useFormikContext = useFormikContext(),
9606
- isSubmitting = _useFormikContext.isSubmitting,
9607
- dirty = _useFormikContext.dirty;
9608
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement("div", {
9609
- className: "ntm-invitations__header"
9610
- })), /*#__PURE__*/React.createElement(Modal.Body, {
9611
- className: "ntm-invitations__body"
9612
- }, /*#__PURE__*/React.createElement("div", {
9613
- className: "ntm-invitations__body-header"
9614
- }, /*#__PURE__*/React.createElement(Typography, {
9615
- style: "h4"
9616
- }, instance.t("common.invite_", {
9617
- what: label.toLowerCase()
9618
- })), isCSVInviteEnabled && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
9619
- style: "body2"
9620
- }, instance.t("buttons.inviteFrom")), /*#__PURE__*/React.createElement(Button, {
9621
- style: "secondary",
9622
- icon: File,
9623
- onClick: () => setIsCSVInviteSelected(true),
9624
- tooltipProps: {
9625
- content: instance.t("helpers.bulkInvite"),
9626
- placement: "bottom"
9627
- }
9628
- }))), /*#__PURE__*/React.createElement(EmailInput, {
9629
- name: "emails",
9630
- label: null,
9631
- placeholder: instance.t("placeholders.email")
9632
- }), /*#__PURE__*/React.createElement(Button, _extends({
9633
- type: "submit",
9634
- label: instance.t("buttons.sendInvites"),
9635
- className: "ntm-invitations__submit-btn",
9636
- loading: isSubmitting,
9637
- disabled: !dirty || isSubmitting
9638
- }, submitButtonProps)), children), /*#__PURE__*/React.createElement(Modal.Footer, {
9639
- className: classnames({
9640
- "ntm-invitations__footer": isInviteLinkEnabled
9641
- })
9642
- }, isInviteLinkEnabled && /*#__PURE__*/React.createElement(InviteLink, inviteLinkProps)));
9643
- };
9644
-
9645
- const _excluded$2 = ["label", "isOpen", "onClose", "submitButtonProps", "csvColumns", "sampleFileUrl", "isCSVInviteEnabled", "isInviteLinkEnabled", "inviteLinkProps", "children"];
9646
- const Invitations = _ref => {
9647
- let _ref$label = _ref.label,
9648
- label = _ref$label === void 0 ? instance.t("metaNames.member", PLURAL) : _ref$label,
9649
- _ref$isOpen = _ref.isOpen,
9650
- isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
9651
- _ref$onClose = _ref.onClose,
9652
- onClose = _ref$onClose === void 0 ? noop$2 : _ref$onClose,
9653
- _ref$submitButtonProp = _ref.submitButtonProps,
9654
- submitButtonProps = _ref$submitButtonProp === void 0 ? {} : _ref$submitButtonProp,
9655
- _ref$csvColumns = _ref.csvColumns,
9656
- csvColumns = _ref$csvColumns === void 0 ? [] : _ref$csvColumns,
9657
- _ref$sampleFileUrl = _ref.sampleFileUrl,
9658
- sampleFileUrl = _ref$sampleFileUrl === void 0 ? "" : _ref$sampleFileUrl,
9659
- _ref$isCSVInviteEnabl = _ref.isCSVInviteEnabled,
9660
- isCSVInviteEnabled = _ref$isCSVInviteEnabl === void 0 ? true : _ref$isCSVInviteEnabl,
9661
- _ref$isInviteLinkEnab = _ref.isInviteLinkEnabled,
9662
- isInviteLinkEnabled = _ref$isInviteLinkEnab === void 0 ? true : _ref$isInviteLinkEnab,
9663
- _ref$inviteLinkProps = _ref.inviteLinkProps,
9664
- inviteLinkProps = _ref$inviteLinkProps === void 0 ? {} : _ref$inviteLinkProps,
9665
- children = _ref.children,
9666
- otherProps = _objectWithoutProperties$1(_ref, _excluded$2);
9667
- const _useState = useState(false),
9668
- _useState2 = _slicedToArray$2(_useState, 2),
9669
- isCSVInviteSelected = _useState2[0],
9670
- setIsCSVInviteSelected = _useState2[1];
9671
- const handleClose = () => {
9672
- onClose();
9673
- setIsCSVInviteSelected(false);
9674
- };
9675
- return /*#__PURE__*/React.createElement(Formik, {
9676
- initialValues: {
9677
- emails: []
9678
- },
9679
- onSubmit: noop$2
9680
- }, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Modal, _extends({
9681
- isOpen: isOpen,
9682
- onClose: handleClose,
9683
- size: "large"
9684
- }, otherProps), /*#__PURE__*/React.createElement("div", {
9685
- className: "ntm-invitations__wrapper"
9686
- }, isCSVInviteSelected ? /*#__PURE__*/React.createElement(Csv, {
9687
- label: label,
9688
- csvColumns: csvColumns,
9689
- sampleFileUrl: sampleFileUrl,
9690
- setIsCSVInviteSelected: setIsCSVInviteSelected
9691
- }) : /*#__PURE__*/React.createElement(Normal, {
9692
- label: label,
9693
- submitButtonProps: submitButtonProps,
9694
- setIsCSVInviteSelected: setIsCSVInviteSelected,
9695
- isCSVInviteEnabled: isCSVInviteEnabled,
9696
- isInviteLinkEnabled: isInviteLinkEnabled,
9697
- inviteLinkProps: inviteLinkProps
9698
- }, children)))));
9699
- };
9700
- var index$2 = withReactQuery(Invitations);
9701
-
9702
- const fetch$2 = () => axios.get(`${BASE_URL}/permissions`);
9703
- const permissionsApi = {
9704
- fetch: fetch$2
9705
- };
9706
-
9707
- 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; }
9708
- 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; }
9709
- const useFetchPermissions = function () {
9710
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9711
- return useQuery(QUERY_KEYS.PERMISSIONS, permissionsApi.fetch, _objectSpread$6({
9712
- staleTime: DEFAULT_STALE_TIME,
9713
- select: response => response.permissions || response.data.permissions
9714
- }, options));
9715
- };
9716
-
9717
- const fetch$1 = () => axios.get(`${BASE_URL}/organization_roles`);
9718
- const create$1 = payload => axios.post(`${BASE_URL}/organization_roles`, payload);
9719
- const update$1 = (id, payload) => axios.patch(`${BASE_URL}/organization_roles/${id}`, payload);
9720
- const destroy = (id, payload) => axios.delete(`${BASE_URL}/organization_roles/${id}`, {
9721
- data: payload
9722
- });
9723
- const organizationRolesApi = {
9724
- fetch: fetch$1,
9725
- create: create$1,
9726
- update: update$1,
9727
- destroy
9728
- };
9729
-
9730
- const _excluded$1 = ["onSuccess"],
9731
- _excluded2$1 = ["onSuccess"],
9732
- _excluded3 = ["onSuccess"];
9733
- 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; }
9734
- 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; }
9735
- const useFetchRoles = function () {
9736
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9737
- return useQuery(QUERY_KEYS.ROLES, organizationRolesApi.fetch, _objectSpread$5({
9738
- staleTime: DEFAULT_STALE_TIME,
9739
- select: response => response.organizationRoles || response.data.organizationRoles
9740
- }, options));
9741
- };
9742
- const useCreateRole = _ref => {
9743
- let onSuccess = _ref.onSuccess,
9744
- options = _objectWithoutProperties$1(_ref, _excluded$1);
9745
- return useMutation(organizationRolesApi.create, _objectSpread$5({
9746
- onSuccess: response => {
9747
- queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
9748
- if (!!cachedData.data && !!cachedData.data.organizationRoles) {
9749
- return modifyPath(["data", "organizationRoles"], prepend(response.data.organizationRole), cachedData);
9750
- }
9751
- return modifyPath(["organizationRoles"], prepend(response.organizationRole), cachedData);
9752
- });
9753
- Toastr.success(response.ntmNotice || response.data.ntmNotice);
9754
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
9755
- }
9756
- }, options));
9757
- };
9758
- const useUpdateRole = _ref2 => {
9759
- let onSuccess = _ref2.onSuccess,
9760
- options = _objectWithoutProperties$1(_ref2, _excluded2$1);
9761
- return useMutation(_ref3 => {
9762
- let id = _ref3.id,
9763
- payload = _ref3.payload;
9764
- return organizationRolesApi.update(id, payload);
9765
- }, _objectSpread$5({
9766
- onSuccess: response => {
9767
- queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
9768
- queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
9769
- if (!!cachedData.data && !!cachedData.data.organizationRoles) {
9770
- return assocPath(["data", "organizationRoles", findIndex(propEq("id", response.data.organizationRole.id), cachedData.data.organizationRoles)], response.data.organizationRole, cachedData);
9771
- }
9772
- return assocPath(["organizationRoles", findIndex(propEq("id", response.organizationRole.id), cachedData.organizationRoles)], response.organizationRole, cachedData);
9773
- });
9774
- Toastr.success(response.ntmNotice || response.data.ntmNotice);
9775
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
9776
- }
9777
- }, options));
9778
- };
9779
- const useDestroyRole = _ref4 => {
9780
- let _ref4$onSuccess = _ref4.onSuccess,
9781
- onSuccess = _ref4$onSuccess === void 0 ? noop$2 : _ref4$onSuccess,
9782
- options = _objectWithoutProperties$1(_ref4, _excluded3);
9783
- return useMutation(_ref5 => {
9784
- let id = _ref5.id,
9785
- payload = _ref5.payload;
9786
- return organizationRolesApi.destroy(id, payload);
9787
- }, _objectSpread$5({
9788
- onSuccess: response => {
9789
- queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
9790
- if (!!cachedData.data && !!cachedData.data.organizationRoles) {
9791
- return dissocPath(["data", "organizationRoles", findIndex(propEq("id", response.data.id), cachedData.data.organizationRoles)], cachedData);
9792
- }
9793
- return dissocPath(["organizationRoles", findIndex(propEq("id", response.id), cachedData.organizationRoles)], cachedData);
9794
- });
9795
- Toastr.success(response.ntmNotice || response.data.ntmNotice);
9796
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
9797
- }
9798
- }, options));
9799
- };
7300
+ }, options));
7301
+ };
9800
7302
 
9801
7303
  var dist = {exports: {}};
9802
7304
 
@@ -11239,16 +8741,63 @@ const getPermissionGroups = function () {
11239
8741
  return groupedPermissions;
11240
8742
  };
11241
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
+
11242
8788
  const ADD_ROLE_FORM_INITIAL_VALUES = {
11243
8789
  name: "",
11244
8790
  description: "",
11245
8791
  permissionIds: []
11246
8792
  };
11247
8793
  const ADD_ROLE_FORM_VALIDATION_SCHEMA = object({
11248
- name: string().trim().required(instance.t("validations.enterRoleName")),
8794
+ name: string().trim().max(40, instance.t("validations.limitExceeded", {
8795
+ what: instance.t("common.name").toLocaleLowerCase(),
8796
+ limit: 40
8797
+ })).required(instance.t("validations.enterRoleName")),
11249
8798
  description: string().trim().max(255, instance.t("validations.limitExceeded", {
11250
- what: instance.t("common.description"),
11251
- count: 255
8799
+ what: instance.t("common.description").toLocaleLowerCase(),
8800
+ limit: 255
11252
8801
  }))
11253
8802
  });
11254
8803
 
@@ -11308,13 +8857,14 @@ const Permissions = _ref => {
11308
8857
  };
11309
8858
 
11310
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; }
11311
- 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; }
11312
8861
  const New = _ref => {
11313
8862
  let isOpen = _ref.isOpen,
11314
8863
  onClose = _ref.onClose,
11315
8864
  permissions = _ref.permissions;
11316
8865
  const _useTranslation = useTranslation(),
11317
8866
  t = _useTranslation.t;
8867
+ const formReference = useRef(null);
11318
8868
  const _useCreateRole = useCreateRole({
11319
8869
  onSuccess: onClose
11320
8870
  }),
@@ -11337,16 +8887,19 @@ const New = _ref => {
11337
8887
  }, t("common.add_", {
11338
8888
  what: t("common.role", SINGULAR).toLocaleLowerCase()
11339
8889
  }))), /*#__PURE__*/React.createElement(Formik, {
11340
- validateOnChange: false,
11341
- validateOnBlur: false,
11342
8890
  initialValues: ADD_ROLE_FORM_INITIAL_VALUES,
11343
- validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA,
11344
- onSubmit: handleFormSubmit
8891
+ onSubmit: handleFormSubmit,
8892
+ validateOnBlur: false,
8893
+ validateOnChange: false,
8894
+ validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA
11345
8895
  }, _ref2 => {
11346
8896
  let dirty = _ref2.dirty;
11347
8897
  return /*#__PURE__*/React.createElement(Form, {
8898
+ ref: formReference,
11348
8899
  noValidate: true
11349
- }, /*#__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", {
11350
8903
  className: "ntm-roles-pane__body"
11351
8904
  }, /*#__PURE__*/React.createElement("div", {
11352
8905
  className: "ntm-roles-pane__body-wrapper"
@@ -11362,6 +8915,7 @@ const New = _ref => {
11362
8915
  }), /*#__PURE__*/React.createElement(Textarea, {
11363
8916
  "data-cy": "ntm-add-role-description-text-field",
11364
8917
  label: t("common.description"),
8918
+ maxLength: 255,
11365
8919
  name: "description",
11366
8920
  placeholder: t("placeholders.enter_", {
11367
8921
  what: t("common.description").toLocaleLowerCase()
@@ -11677,13 +9231,14 @@ const Delete = _ref => {
11677
9231
  };
11678
9232
 
11679
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; }
11680
- 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; }
11681
9235
  const Edit = _ref => {
11682
9236
  let isOpen = _ref.isOpen,
11683
9237
  onClose = _ref.onClose,
11684
9238
  selectedRole = _ref.selectedRole;
11685
9239
  const _useTranslation = useTranslation(),
11686
9240
  t = _useTranslation.t;
9241
+ const formReference = useRef(null);
11687
9242
  const _useUpdateRole = useUpdateRole({
11688
9243
  onSuccess: onClose
11689
9244
  }),
@@ -11704,24 +9259,29 @@ const Edit = _ref => {
11704
9259
  payload
11705
9260
  });
11706
9261
  };
11707
- return /*#__PURE__*/React.createElement(Modal, {
9262
+ return /*#__PURE__*/React.createElement(Pane, {
11708
9263
  isOpen: isOpen,
11709
9264
  onClose: onClose
11710
- }, /*#__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, {
11711
9271
  initialValues: initialValues,
11712
- validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA,
11713
- onSubmit: handleFormSubmit
9272
+ onSubmit: handleFormSubmit,
9273
+ validateOnBlur: false,
9274
+ validateOnChange: false,
9275
+ validationSchema: ADD_ROLE_FORM_VALIDATION_SCHEMA
11714
9276
  }, _ref2 => {
11715
9277
  let dirty = _ref2.dirty;
11716
9278
  return /*#__PURE__*/React.createElement(Form, {
9279
+ ref: formReference,
11717
9280
  noValidate: true
11718
- }, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Typography, {
11719
- "data-cy": "ntm-update-role-title",
11720
- style: "h2"
11721
- }, t("common.update_", {
11722
- what: t("common.role", SINGULAR).toLocaleLowerCase()
11723
- }))), /*#__PURE__*/React.createElement(Modal.Body, null, /*#__PURE__*/React.createElement("div", {
11724
- 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"
11725
9285
  }, /*#__PURE__*/React.createElement(Input, {
11726
9286
  required: true,
11727
9287
  "data-cy": "ntm-update-role-name-text-field",
@@ -11732,10 +9292,11 @@ const Edit = _ref => {
11732
9292
  }), /*#__PURE__*/React.createElement(Textarea, {
11733
9293
  "data-cy": "ntm-update-role-description-text-field",
11734
9294
  label: t("common.description"),
9295
+ maxLength: 255,
11735
9296
  name: "description",
11736
9297
  placeholder: t("placeholders.enterDescription")
11737
- }))), /*#__PURE__*/React.createElement(Modal.Footer, null, /*#__PURE__*/React.createElement("div", {
11738
- className: "ntm-roles-modal__footer"
9298
+ }))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement("div", {
9299
+ className: "ntm-roles-pane__footer"
11739
9300
  }, /*#__PURE__*/React.createElement(Button, {
11740
9301
  "data-cy": "ntm-update-role-submit-button",
11741
9302
  disabled: !dirty || isSubmitting,
@@ -11751,14 +9312,14 @@ const Edit = _ref => {
11751
9312
  }));
11752
9313
  };
11753
9314
 
11754
- const Columns = _ref => {
9315
+ const Columns$1 = _ref => {
11755
9316
  let config = _ref.config,
11756
9317
  filteredGroupPermissions = _ref.filteredGroupPermissions,
11757
9318
  filteredRoles = _ref.filteredRoles,
11758
9319
  roles = _ref.roles,
11759
9320
  setIsScrollPresent = _ref.setIsScrollPresent;
11760
9321
  const _useState = useState(DEFAULT_MANAGE_ROLE_VALUES),
11761
- _useState2 = _slicedToArray$2(_useState, 2),
9322
+ _useState2 = _slicedToArray(_useState, 2),
11762
9323
  manageRole = _useState2[0],
11763
9324
  setManageRole = _useState2[1];
11764
9325
  const categories = Object.keys(filteredGroupPermissions);
@@ -11898,15 +9459,15 @@ const Table = _ref => {
11898
9459
  const _useTranslation = useTranslation(),
11899
9460
  t = _useTranslation.t;
11900
9461
  const _useState = useState(""),
11901
- _useState2 = _slicedToArray$2(_useState, 2),
9462
+ _useState2 = _slicedToArray(_useState, 2),
11902
9463
  searchTerm = _useState2[0],
11903
9464
  setSearchTerm = _useState2[1];
11904
9465
  const _useState3 = useState(permissionGroups),
11905
- _useState4 = _slicedToArray$2(_useState3, 2),
9466
+ _useState4 = _slicedToArray(_useState3, 2),
11906
9467
  filteredGroupPermissions = _useState4[0],
11907
9468
  setFilteredGroupPermissions = _useState4[1];
11908
9469
  const _useState5 = useState(false),
11909
- _useState6 = _slicedToArray$2(_useState5, 2),
9470
+ _useState6 = _slicedToArray(_useState5, 2),
11910
9471
  isScrollPresent = _useState6[0],
11911
9472
  setIsScrollPresent = _useState6[1];
11912
9473
  const toggleDropdown = category => {
@@ -11914,7 +9475,7 @@ const Table = _ref => {
11914
9475
  };
11915
9476
  useEffect(() => {
11916
9477
  setFilteredGroupPermissions(fromPairs(toPairs(permissionGroups).map(_ref2 => {
11917
- let _ref3 = _slicedToArray$2(_ref2, 2),
9478
+ let _ref3 = _slicedToArray(_ref2, 2),
11918
9479
  category = _ref3[0],
11919
9480
  options = _ref3[1];
11920
9481
  return [category, modify("permissions", filter(_ref4 => {
@@ -11939,7 +9500,7 @@ const Table = _ref => {
11939
9500
  onClick: () => setIsNewRolePaneOpen(true),
11940
9501
  permissions: config === null || config === void 0 ? void 0 : config.permissions
11941
9502
  })
11942
- }) : /*#__PURE__*/React.createElement(Columns, {
9503
+ }) : /*#__PURE__*/React.createElement(Columns$1, {
11943
9504
  config: config,
11944
9505
  filteredGroupPermissions: filteredGroupPermissions,
11945
9506
  filteredRoles: filteredRoles,
@@ -11952,15 +9513,15 @@ const Roles = _ref => {
11952
9513
  var _config$permissions$v, _config$permissions, _config$permissions$v2, _config$permissions2;
11953
9514
  let config = _ref.config;
11954
9515
  const _useState = useState(""),
11955
- _useState2 = _slicedToArray$2(_useState, 2),
9516
+ _useState2 = _slicedToArray(_useState, 2),
11956
9517
  searchString = _useState2[0],
11957
9518
  setSearchString = _useState2[1];
11958
9519
  const _useState3 = useState([]),
11959
- _useState4 = _slicedToArray$2(_useState3, 2),
9520
+ _useState4 = _slicedToArray(_useState3, 2),
11960
9521
  filteredRoles = _useState4[0],
11961
9522
  setFilteredRoles = _useState4[1];
11962
9523
  const _useState5 = useState(false),
11963
- _useState6 = _slicedToArray$2(_useState5, 2),
9524
+ _useState6 = _slicedToArray(_useState5, 2),
11964
9525
  isNewRolePaneOpen = _useState6[0],
11965
9526
  setIsNewRolePaneOpen = _useState6[1];
11966
9527
  const _useFetchRoles = useFetchRoles({
@@ -12026,7 +9587,7 @@ const teamsApi = {
12026
9587
  const _excluded = ["onSuccess"],
12027
9588
  _excluded2 = ["onSuccess"];
12028
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; }
12029
- 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; }
12030
9591
  const useFetchMembers = function () {
12031
9592
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12032
9593
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -12038,7 +9599,7 @@ const useFetchMembers = function () {
12038
9599
  };
12039
9600
  const useCreateMember = _ref => {
12040
9601
  let onSuccess = _ref.onSuccess,
12041
- options = _objectWithoutProperties$1(_ref, _excluded);
9602
+ options = _objectWithoutProperties(_ref, _excluded);
12042
9603
  return useMutation(teamsApi.create, _objectSpread$2({
12043
9604
  onSuccess: response => {
12044
9605
  queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
@@ -12049,7 +9610,7 @@ const useCreateMember = _ref => {
12049
9610
  };
12050
9611
  const useUpdateMember = _ref2 => {
12051
9612
  let onSuccess = _ref2.onSuccess,
12052
- options = _objectWithoutProperties$1(_ref2, _excluded2);
9613
+ options = _objectWithoutProperties(_ref2, _excluded2);
12053
9614
  return useMutation(_ref3 => {
12054
9615
  let id = _ref3.id,
12055
9616
  payload = _ref3.payload;
@@ -12066,7 +9627,7 @@ const useUpdateMember = _ref2 => {
12066
9627
  const useDebounce = function (value) {
12067
9628
  let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 350;
12068
9629
  const _useState = useState(value),
12069
- _useState2 = _slicedToArray$2(_useState, 2),
9630
+ _useState2 = _slicedToArray(_useState, 2),
12070
9631
  debouncedValue = _useState2[0],
12071
9632
  setDebouncedValue = _useState2[1];
12072
9633
  useEffect(() => {
@@ -12081,7 +9642,7 @@ const Header = _ref => {
12081
9642
  let _ref$metaName = _ref.metaName,
12082
9643
  metaName = _ref$metaName === void 0 ? "" : _ref$metaName,
12083
9644
  _ref$onClick = _ref.onClick,
12084
- onClick = _ref$onClick === void 0 ? noop$2 : _ref$onClick,
9645
+ onClick = _ref$onClick === void 0 ? noop$1 : _ref$onClick,
12085
9646
  permissions = _ref.permissions;
12086
9647
  return /*#__PURE__*/React.createElement(Tooltip, {
12087
9648
  content: instance.t("tooltips.noPermissionToAddMember"),
@@ -12097,6 +9658,151 @@ const Header = _ref => {
12097
9658
  })));
12098
9659
  };
12099
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
+
12100
9806
  const Left = _ref => {
12101
9807
  let metaName = _ref.metaName,
12102
9808
  count = _ref.count;
@@ -12113,18 +9819,24 @@ Left.defaultProps = {
12113
9819
  count: 0
12114
9820
  };
12115
9821
  const Right = _ref2 => {
12116
- let rolesButtonProps = _ref2.rolesButtonProps;
12117
- const isVisible = !!rolesButtonProps;
12118
- const permissions = window.globalProps.permissions;
12119
- const hasRequiredPermissions = permissions && hasPermission(MANAGE_MEMBER_PERMISSIONS);
12120
- 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({
12121
9835
  "data-cy": "ntm-manage-roles-button",
12122
- label: instance.t("common.manage_", {
12123
- what: instance.t("common.role", PLURAL).toLocaleLowerCase()
12124
- }),
9836
+ label: MANAGE_ROLES_BUTTON_LABEL,
12125
9837
  size: "small",
12126
9838
  style: "secondary"
12127
- }, rolesButtonProps)) : null;
9839
+ }, rolesButtonProps)) : null);
12128
9840
  };
12129
9841
  const SubHeader = {
12130
9842
  Left,
@@ -12173,7 +9885,7 @@ const DEFAULT_FILTER_VALUES = {
12173
9885
  };
12174
9886
 
12175
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; }
12176
- 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; }
12177
9889
  const renderNameColumn = (_ref, diplayStatusTag) => {
12178
9890
  let displayName = _ref.displayName,
12179
9891
  imageUrl = _ref.profileImageUrl,
@@ -12288,6 +10000,7 @@ const getColumnData = _ref5 => {
12288
10000
  width: "25%",
12289
10001
  sorter: true
12290
10002
  }, {
10003
+ dataIndex: "actions",
12291
10004
  key: "icon_button",
12292
10005
  render: (_, props) => renderDropdownButton(props, handleUpdateStatus, handleUpdateRole, permissions),
12293
10006
  width: "10%"
@@ -12338,14 +10051,17 @@ const COUNTER_PROPS = {
12338
10051
  startsFrom: 4
12339
10052
  };
12340
10053
 
12341
- const renderInitialValues = selectedMember => ({
12342
- emails: selectedMember ? [{
12343
- label: selectedMember.email,
12344
- value: selectedMember.email,
12345
- valid: true
12346
- }] : [],
12347
- role: (selectedMember === null || selectedMember === void 0 ? void 0 : selectedMember.role) || ""
12348
- });
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
+ };
12349
10065
  const renderPayload = function (_ref) {
12350
10066
  let role = _ref.role,
12351
10067
  emails = _ref.emails;
@@ -12371,9 +10087,10 @@ const ManageMember = _ref => {
12371
10087
  roles = _ref$roles === void 0 ? [] : _ref$roles,
12372
10088
  selectedMember = _ref.selectedMember;
12373
10089
  const _useState = useState(false),
12374
- _useState2 = _slicedToArray$2(_useState, 2),
10090
+ _useState2 = _slicedToArray(_useState, 2),
12375
10091
  hasSubmitted = _useState2[0],
12376
10092
  setHasSubmitted = _useState2[1];
10093
+ const formReference = useRef(null);
12377
10094
  const onPaneClose = () => {
12378
10095
  onClose();
12379
10096
  setHasSubmitted(false);
@@ -12420,23 +10137,22 @@ const ManageMember = _ref => {
12420
10137
  }) : instance.t("common.add_", {
12421
10138
  what: instance.t(metaName, SINGULAR).toLocaleLowerCase()
12422
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, {
12423
- initialValues: renderInitialValues(selectedMember),
10140
+ enableReinitialize: true,
10141
+ initialValues: renderInitialValues(selectedMember, roles),
12424
10142
  onSubmit: handleAddMember,
12425
- validationSchema: VALIDATION_SCHEMA,
12426
- validateOnChange: hasSubmitted,
12427
10143
  validateOnBlur: hasSubmitted,
12428
- enableReinitialize: true
10144
+ validateOnChange: hasSubmitted,
10145
+ validationSchema: VALIDATION_SCHEMA
12429
10146
  }, _ref2 => {
12430
10147
  let values = _ref2.values,
12431
- setFieldValue = _ref2.setFieldValue,
12432
10148
  dirty = _ref2.dirty;
12433
10149
  const emails = values.emails,
12434
10150
  role = values.role;
12435
- const roleValue = role && {
12436
- label: role,
12437
- value: role
12438
- };
12439
- 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", {
12440
10156
  className: "ntm-members-pane__body"
12441
10157
  }, selectedMember ? /*#__PURE__*/React.createElement(Input, {
12442
10158
  "data-cy": "ntm-manage-member-email-input",
@@ -12454,23 +10170,35 @@ const ManageMember = _ref => {
12454
10170
  label: `${instance.t("common.email", PLURAL)}*`,
12455
10171
  name: "emails",
12456
10172
  placeholder: instance.t("placeholders.email")
12457
- }), /*#__PURE__*/React.createElement(Select, {
12458
- required: true,
12459
- "data-cy": "ntm-manage-member-role-select",
12460
- label: instance.t("common.role", SINGULAR),
12461
- name: "role",
12462
- onChange: _ref3 => {
12463
- let value = _ref3.value;
12464
- return setFieldValue("role", value);
12465
- },
12466
- options: roles.map(role => ({
12467
- label: role,
12468
- value: role
12469
- })),
12470
- placeholder: instance.t("placeholders.role"),
12471
- size: "medium",
12472
- value: roleValue
12473
- }))), /*#__PURE__*/React.createElement(Pane.Footer, {
10173
+ }), /*#__PURE__*/React.createElement(Radio, {
10174
+ stacked: true,
10175
+ className: "ntm-members-radio-group",
10176
+ "data-cy": "ntm-manage-member-roles-group",
10177
+ label: `${instance.t("common.role", SINGULAR)}*`,
10178
+ name: "role"
10179
+ }, roles.map(_ref3 => {
10180
+ let description = _ref3.description,
10181
+ id = _ref3.id,
10182
+ name = _ref3.name;
10183
+ return /*#__PURE__*/React.createElement("label", {
10184
+ className: "ntm-members-pane-radio-item__wrapper",
10185
+ htmlFor: slugify(name),
10186
+ key: id
10187
+ }, /*#__PURE__*/React.createElement(Radio.Item, {
10188
+ className: "ntm-members-pane-radio-item__label",
10189
+ "data-cy": "ntm-manage-member-roles-button",
10190
+ defaultChecked: identical(name, role),
10191
+ id: slugify(name),
10192
+ label: name,
10193
+ name: "role",
10194
+ value: name
10195
+ }), /*#__PURE__*/React.createElement(Typography, {
10196
+ className: "neeto-ui-input__help-text",
10197
+ "data-cy": "ntm-manage-member-roles-description",
10198
+ style: "body3",
10199
+ weight: "normal"
10200
+ }, description));
10201
+ })))), /*#__PURE__*/React.createElement(Pane.Footer, {
12474
10202
  className: "ntm-members-pane__footer"
12475
10203
  }, /*#__PURE__*/React.createElement(Button, {
12476
10204
  "data-cy": "ntm-manage-member-submit-button",
@@ -12511,24 +10239,28 @@ const Menu = _ref => {
12511
10239
  };
12512
10240
 
12513
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; }
12514
- 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; }
12515
10243
  const TeamMembers = _ref => {
12516
10244
  var _config$permissions$v, _config$permissions, _config$permissions$v2, _config$permissions2;
12517
10245
  let metaName = _ref.metaName,
12518
10246
  config = _ref.config;
12519
10247
  const _useState = useState(DEFAULT_IS_OPEN_VALUES),
12520
- _useState2 = _slicedToArray$2(_useState, 2),
10248
+ _useState2 = _slicedToArray(_useState, 2),
12521
10249
  isOpen = _useState2[0],
12522
10250
  setIsOpen = _useState2[1];
12523
10251
  const _useState3 = useState(DEFAULT_FILTER_VALUES),
12524
- _useState4 = _slicedToArray$2(_useState3, 2),
10252
+ _useState4 = _slicedToArray(_useState3, 2),
12525
10253
  filters = _useState4[0],
12526
10254
  setFilters = _useState4[1];
12527
10255
  const _useState5 = useState(null),
12528
- _useState6 = _slicedToArray$2(_useState5, 2),
10256
+ _useState6 = _slicedToArray(_useState5, 2),
12529
10257
  selectedMember = _useState6[0],
12530
10258
  setSelectedMember = _useState6[1];
12531
10259
  const debouncedSearch = useDebounce(filters.search, 750);
10260
+ const _useState7 = useState([]),
10261
+ _useState8 = _slicedToArray(_useState7, 2),
10262
+ columnData = _useState8[0],
10263
+ setColumnData = _useState8[1];
12532
10264
  const _useFetchMembers = useFetchMembers(_objectSpread(_objectSpread({}, filters), {}, {
12533
10265
  search: debouncedSearch.trim(),
12534
10266
  category: filters.category.toLowerCase()
@@ -12540,8 +10272,8 @@ const TeamMembers = _ref => {
12540
10272
  isMembersFetching = _useFetchMembers.isFetching;
12541
10273
  const _useFetchRoles = useFetchRoles({
12542
10274
  select: response => {
12543
- const roles = response.organizationRoles || response.data.organizationRoles;
12544
- return pluck("name", roles).sort((a, b) => a.localeCompare(b));
10275
+ var _ref2;
10276
+ return reverse((_ref2 = response.organizationRoles || response.data.organizationRoles) !== null && _ref2 !== void 0 ? _ref2 : []);
12545
10277
  },
12546
10278
  enabled: (_config$permissions$v2 = config === null || config === void 0 ? void 0 : (_config$permissions2 = config.permissions) === null || _config$permissions2 === void 0 ? void 0 : _config$permissions2.view) !== null && _config$permissions$v2 !== void 0 ? _config$permissions$v2 : DEFAULT_PERMISSION
12547
10279
  }),
@@ -12554,8 +10286,8 @@ const TeamMembers = _ref => {
12554
10286
  isUpdatingMember = _useUpdateMember.isLoading;
12555
10287
  const searchProps = {
12556
10288
  "data-cy": "ntm-search-members-input",
12557
- onChange: _ref2 => {
12558
- let value = _ref2.target.value;
10289
+ onChange: _ref3 => {
10290
+ let value = _ref3.target.value;
12559
10291
  return setFilters(mergeLeft({
12560
10292
  search: value,
12561
10293
  page: DEFAULT_PAGE_NUMBER
@@ -12590,6 +10322,14 @@ const TeamMembers = _ref => {
12590
10322
  setSelectedMember(user);
12591
10323
  setIsOpen(assoc("manageMember", true));
12592
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
+
12593
10333
  const handleAlertClose = () => {
12594
10334
  setIsOpen(assoc("alert", false));
12595
10335
  setSelectedMember(null);
@@ -12640,19 +10380,16 @@ const TeamMembers = _ref => {
12640
10380
  count: team === null || team === void 0 ? void 0 : team.membersCount
12641
10381
  }),
12642
10382
  rightActionBlock: /*#__PURE__*/React.createElement(SubHeader.Right, {
12643
- rolesButtonProps: config.rolesButtonProps
10383
+ columns: columns,
10384
+ rolesButtonProps: config.rolesButtonProps,
10385
+ setColumnData: setColumnData
12644
10386
  })
12645
10387
  }), (team === null || team === void 0 ? void 0 : team.membersCount) !== 0 ? /*#__PURE__*/React.createElement("div", {
12646
10388
  className: "ntm-members__table-wrapper"
12647
10389
  }, /*#__PURE__*/React.createElement(Table$1, {
12648
10390
  fixedHeight: true,
12649
10391
  allowRowClick: false,
12650
- columnData: getColumnData({
12651
- memberFilter: filters.category,
12652
- handleUpdateStatus,
12653
- handleUpdateRole,
12654
- permissions: config === null || config === void 0 ? void 0 : config.permissions
12655
- }),
10392
+ columnData: columnData,
12656
10393
  currentPageNumber: parseInt(filters.page, DEFAULT_RADIX),
12657
10394
  "data-cy": "ntm-members-table",
12658
10395
  defaultPageSize: parseInt(filters.results, DEFAULT_RADIX),
@@ -12703,8 +10440,8 @@ var index = withReactQuery(TeamMembers);
12703
10440
 
12704
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}}
12705
10442
 
12706
- 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}\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-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}";
12707
10444
  n(css,{});
12708
10445
 
12709
- export { index$2 as Invitations, index$1 as Roles, index as TeamMembers, hasPermission };
10446
+ export { index$1 as Roles, index as TeamMembers, hasPermission };
12710
10447
  //# sourceMappingURL=index.esm.js.map