@bigbinary/neeto-api-keys-frontend 1.1.13 → 1.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,37 +1,77 @@
1
- import React, { useRef, useState, useEffect } from 'react';
1
+ import { useRef, useState, useEffect } from 'react';
2
2
  import { t } from 'i18next';
3
- import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
4
3
  import { isPresent, isNotPresent, isNotEmpty } from '@bigbinary/neeto-cist';
4
+ import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
5
5
  import { useMutationWithInvalidation, withT, useDebounce, withTitle, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
6
6
  import Header from '@bigbinary/neeto-molecules/Header';
7
- import { Typography, Tag, DatePicker as DatePicker$1, Pane, NoData, Table as Table$1, Button, Alert } from '@bigbinary/neetoui';
7
+ import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
8
+ import Alert from '@bigbinary/neetoui/Alert';
9
+ import Button from '@bigbinary/neetoui/Button';
8
10
  import { useTranslation, Trans } from 'react-i18next';
11
+ import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
9
12
  import { useQuery } from 'react-query';
10
13
  import axios from 'axios';
11
- import { Form as Form$1, Input, Checkbox, ActionBlock } from '@bigbinary/neetoui/formik';
14
+ import Pane from '@bigbinary/neetoui/Pane';
15
+ import Typography from '@bigbinary/neetoui/Typography';
16
+ import NeetoUIForm from '@bigbinary/neetoui/formik/Form';
17
+ import Input from '@bigbinary/neetoui/formik/Input';
18
+ import Checkbox from '@bigbinary/neetoui/formik/Checkbox';
19
+ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
12
20
  import { Field } from 'formik';
21
+ import NeetoUIDatePicker from '@bigbinary/neetoui/DatePicker';
13
22
  import { prop, isEmpty } from 'ramda';
23
+ import dayjs from 'dayjs';
14
24
  import { dateFormat, getQueryParams, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
15
25
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
16
26
  import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
27
+ import Tag from '@bigbinary/neetoui/Tag';
17
28
  import * as yup from 'yup';
29
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
18
30
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
19
31
  import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
32
+ import NeetoUITable from '@bigbinary/neetoui/Table';
33
+ import NoData from '@bigbinary/neetoui/NoData';
20
34
  import { useHistory } from 'react-router-dom';
21
35
 
22
- function _extends() {
23
- _extends = Object.assign ? Object.assign.bind() : function (target) {
24
- for (var i = 1; i < arguments.length; i++) {
25
- var source = arguments[i];
26
- for (var key in source) {
27
- if (Object.prototype.hasOwnProperty.call(source, key)) {
28
- target[key] = source[key];
29
- }
30
- }
31
- }
32
- return target;
33
- };
34
- return _extends.apply(this, arguments);
36
+ function _typeof(o) {
37
+ "@babel/helpers - typeof";
38
+
39
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
40
+ return typeof o;
41
+ } : function (o) {
42
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
43
+ }, _typeof(o);
44
+ }
45
+
46
+ function _toPrimitive(input, hint) {
47
+ if (_typeof(input) !== "object" || input === null) return input;
48
+ var prim = input[Symbol.toPrimitive];
49
+ if (prim !== undefined) {
50
+ var res = prim.call(input, hint || "default");
51
+ if (_typeof(res) !== "object") return res;
52
+ throw new TypeError("@@toPrimitive must return a primitive value.");
53
+ }
54
+ return (hint === "string" ? String : Number)(input);
55
+ }
56
+
57
+ function _toPropertyKey(arg) {
58
+ var key = _toPrimitive(arg, "string");
59
+ return _typeof(key) === "symbol" ? key : String(key);
60
+ }
61
+
62
+ function _defineProperty(obj, key, value) {
63
+ key = _toPropertyKey(key);
64
+ if (key in obj) {
65
+ Object.defineProperty(obj, key, {
66
+ value: value,
67
+ enumerable: true,
68
+ configurable: true,
69
+ writable: true
70
+ });
71
+ } else {
72
+ obj[key] = value;
73
+ }
74
+ return obj;
35
75
  }
36
76
 
37
77
  function _arrayWithHoles(arr) {
@@ -90,6 +130,7 @@ function _slicedToArray(arr, i) {
90
130
  }
91
131
 
92
132
  var API_KEYS_BASE_URL = "/neeto_api_keys_engine/api/v1/api_keys";
133
+ var HELP_DOC_URL = "https://help.".concat(globalProps$1.appName.toLowerCase(), ".com/articles/api-keys");
93
134
 
94
135
  var fetch = function fetch(params) {
95
136
  return axios.get(API_KEYS_BASE_URL, {
@@ -155,23 +196,6 @@ var useDeleteApiKey = function useDeleteApiKey(onSuccess) {
155
196
  });
156
197
  };
157
198
 
158
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
159
-
160
- function getDefaultExportFromCjs (x) {
161
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
162
- }
163
-
164
- var dayjs_min = {exports: {}};
165
-
166
- dayjs_min.exports;
167
-
168
- (function (module, exports) {
169
- !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
170
- } (dayjs_min, dayjs_min.exports));
171
-
172
- var dayjs_minExports = dayjs_min.exports;
173
- var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
174
-
175
199
  var INITIAL_VALUES = {
176
200
  expiresAt: null,
177
201
  label: "",
@@ -226,23 +250,25 @@ var buildColumnData = function buildColumnData(_ref2) {
226
250
  dataIndex: "label",
227
251
  width: 400,
228
252
  render: function render(label, apiKey) {
229
- return /*#__PURE__*/React.createElement("div", {
230
- className: "flex items-center justify-between space-x-3"
231
- }, /*#__PURE__*/React.createElement(Typography, {
232
- style: "body2"
233
- }, label), /*#__PURE__*/React.createElement(MoreDropdown, {
234
- dropdownProps: {
235
- strategy: "fixed"
236
- },
237
- menuItems: getMenuItems({
238
- onEdit: function onEdit() {
239
- return handleEdit(apiKey);
253
+ return /*#__PURE__*/jsxs("div", {
254
+ className: "flex items-center justify-between space-x-3",
255
+ children: [/*#__PURE__*/jsx(Typography, {
256
+ style: "body2",
257
+ children: label
258
+ }), /*#__PURE__*/jsx(MoreDropdown, {
259
+ dropdownProps: {
260
+ strategy: "fixed"
240
261
  },
241
- onDelete: function onDelete() {
242
- return handleDelete(apiKey);
243
- }
244
- })
245
- }));
262
+ menuItems: getMenuItems({
263
+ onEdit: function onEdit() {
264
+ return handleEdit(apiKey);
265
+ },
266
+ onDelete: function onDelete() {
267
+ return handleDelete(apiKey);
268
+ }
269
+ })
270
+ })]
271
+ });
246
272
  }
247
273
  }, {
248
274
  title: t("neetoApiKeys.table.headers.token"),
@@ -250,14 +276,16 @@ var buildColumnData = function buildColumnData(_ref2) {
250
276
  dataIndex: "token",
251
277
  width: 400,
252
278
  render: function render(token) {
253
- return /*#__PURE__*/React.createElement("div", {
254
- className: "flex items-center justify-between gap-x-3"
255
- }, /*#__PURE__*/React.createElement(Typography, {
256
- style: "body2"
257
- }, partlyHideToken(token)), /*#__PURE__*/React.createElement(CopyToClipboardButton, {
258
- style: "text",
259
- value: token
260
- }));
279
+ return /*#__PURE__*/jsxs("div", {
280
+ className: "flex items-center justify-between gap-x-3",
281
+ children: [/*#__PURE__*/jsx(Typography, {
282
+ style: "body2",
283
+ children: partlyHideToken(token)
284
+ }), /*#__PURE__*/jsx(CopyToClipboardButton, {
285
+ style: "text",
286
+ value: token
287
+ })]
288
+ });
261
289
  }
262
290
  }, {
263
291
  title: t("neetoApiKeys.table.headers.status"),
@@ -265,11 +293,13 @@ var buildColumnData = function buildColumnData(_ref2) {
265
293
  width: 144,
266
294
  render: function render(_, _ref3) {
267
295
  var expiresAt = _ref3.expiresAt;
268
- return isPresent(expiresAt) && isInPast(expiresAt) ? /*#__PURE__*/React.createElement(Tag, {
269
- style: "warning"
270
- }, t("neetoApiKeys.tags.expired")) : /*#__PURE__*/React.createElement(Tag, {
271
- style: "success"
272
- }, t("neetoApiKeys.tags.active"));
296
+ return isPresent(expiresAt) && isInPast(expiresAt) ? /*#__PURE__*/jsx(Tag, {
297
+ style: "warning",
298
+ children: t("neetoApiKeys.tags.expired")
299
+ }) : /*#__PURE__*/jsx(Tag, {
300
+ style: "success",
301
+ children: t("neetoApiKeys.tags.active")
302
+ });
273
303
  }
274
304
  }, {
275
305
  title: t("neetoApiKeys.table.headers.expiresAt"),
@@ -277,9 +307,10 @@ var buildColumnData = function buildColumnData(_ref2) {
277
307
  dataIndex: "expiresAt",
278
308
  width: 200,
279
309
  render: function render(expiresAt) {
280
- return isPresent(expiresAt) ? formatExpiry(expiresAt) : /*#__PURE__*/React.createElement(Typography, {
281
- style: "body2"
282
- }, t("neetoApiKeys.common.never"));
310
+ return isPresent(expiresAt) ? formatExpiry(expiresAt) : /*#__PURE__*/jsx(Typography, {
311
+ style: "body2",
312
+ children: t("neetoApiKeys.common.never")
313
+ });
283
314
  }
284
315
  }, {
285
316
  title: t("neetoApiKeys.table.headers.createdAt"),
@@ -287,9 +318,10 @@ var buildColumnData = function buildColumnData(_ref2) {
287
318
  dataIndex: "createdAt",
288
319
  width: 200,
289
320
  render: function render(createdAt) {
290
- return isPresent(createdAt) ? dateFormat.dateTime(createdAt) : /*#__PURE__*/React.createElement(Typography, {
291
- style: "body2"
292
- }, t("neetoApiKeys.common.never"));
321
+ return isPresent(createdAt) ? dateFormat.dateTime(createdAt) : /*#__PURE__*/jsx(Typography, {
322
+ style: "body2",
323
+ children: t("neetoApiKeys.common.never")
324
+ });
293
325
  }
294
326
  }];
295
327
  };
@@ -297,6 +329,8 @@ var getStartOfTime = function getStartOfTime(time, unit) {
297
329
  return dayjs(time).startOf(unit);
298
330
  };
299
331
 
332
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
333
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
300
334
  var DatePicker = function DatePicker(_ref) {
301
335
  var defaultValue = _ref.defaultValue,
302
336
  disabledDate = _ref.disabledDate,
@@ -305,29 +339,30 @@ var DatePicker = function DatePicker(_ref) {
305
339
  name = _ref.name,
306
340
  _ref$disabled = _ref.disabled,
307
341
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
308
- return /*#__PURE__*/React.createElement(Field, {
309
- name: name
310
- }, function (_ref2) {
311
- var _globalProps;
312
- var field = _ref2.field,
313
- meta = _ref2.meta,
314
- setFieldValue = _ref2.form.setFieldValue;
315
- return /*#__PURE__*/React.createElement(DatePicker$1, _extends({
316
- disabled: disabled,
317
- disabledDate: disabledDate,
318
- label: label,
319
- placeholder: placeholder,
320
- defaultValue: defaultValue,
321
- allowClear: false,
322
- className: "w-full",
323
- error: meta.touched && meta.error,
324
- format: (_globalProps = globalProps) === null || _globalProps === void 0 || (_globalProps = _globalProps.user) === null || _globalProps === void 0 ? void 0 : _globalProps.dateFormat,
325
- getPopupContainer: prop("parentNode")
326
- }, field, {
327
- onChange: function onChange(date) {
328
- setFieldValue(field.name, getStartOfTime(date, "day"));
329
- }
330
- }));
342
+ return /*#__PURE__*/jsx(Field, {
343
+ name: name,
344
+ children: function children(_ref2) {
345
+ var _globalProps;
346
+ var field = _ref2.field,
347
+ meta = _ref2.meta,
348
+ setFieldValue = _ref2.form.setFieldValue;
349
+ return /*#__PURE__*/jsx(NeetoUIDatePicker, _objectSpread$3(_objectSpread$3({
350
+ disabled: disabled,
351
+ disabledDate: disabledDate,
352
+ label: label,
353
+ placeholder: placeholder,
354
+ defaultValue: defaultValue,
355
+ allowClear: false,
356
+ className: "w-full",
357
+ error: meta.touched && meta.error,
358
+ format: (_globalProps = globalProps) === null || _globalProps === void 0 || (_globalProps = _globalProps.user) === null || _globalProps === void 0 ? void 0 : _globalProps.dateFormat,
359
+ getPopupContainer: prop("parentNode")
360
+ }, field), {}, {
361
+ onChange: function onChange(date) {
362
+ setFieldValue(field.name, getStartOfTime(date, "day"));
363
+ }
364
+ }));
365
+ }
331
366
  });
332
367
  };
333
368
 
@@ -339,50 +374,59 @@ var Form = withT(function (_ref) {
339
374
  onClose = _ref.onClose,
340
375
  onSubmit = _ref.onSubmit,
341
376
  initialFocusRef = _ref.initialFocusRef;
342
- return /*#__PURE__*/React.createElement(Form$1, {
377
+ return /*#__PURE__*/jsx(NeetoUIForm, {
343
378
  formikProps: {
344
379
  validationSchema: VALIDATION_SCHEMA,
345
380
  initialValues: initialValues,
346
381
  onSubmit: onSubmit
382
+ },
383
+ children: function children(_ref2) {
384
+ var setFieldValue = _ref2.setFieldValue,
385
+ _ref2$values = _ref2.values,
386
+ _ref2$values2 = _ref2$values === void 0 ? {} : _ref2$values,
387
+ hasNoExpiry = _ref2$values2.hasNoExpiry,
388
+ expiresAt = _ref2$values2.expiresAt;
389
+ return /*#__PURE__*/jsxs(Fragment, {
390
+ children: [/*#__PURE__*/jsx(Pane.Body, {
391
+ children: /*#__PURE__*/jsxs("div", {
392
+ className: "w-full space-y-4",
393
+ children: [/*#__PURE__*/jsx(Input, {
394
+ autoFocus: true,
395
+ label: t("neetoApiKeys.fields.label"),
396
+ name: "label",
397
+ placeholder: t("neetoApiKeys.placeholders.label"),
398
+ ref: initialFocusRef
399
+ }), /*#__PURE__*/jsxs("div", {
400
+ className: "space-y-2",
401
+ children: [!hasNoExpiry && /*#__PURE__*/jsx(DatePicker, {
402
+ defaultValue: expiresAt,
403
+ disabledDate: function disabledDate(date) {
404
+ return date < NEXT_DAY;
405
+ },
406
+ label: t("neetoApiKeys.fields.expiryDate"),
407
+ name: "expiresAt",
408
+ placeholder: t("neetoApiKeys.placeholders.selectExpiryDate")
409
+ }), /*#__PURE__*/jsx(Checkbox, {
410
+ checked: hasNoExpiry,
411
+ label: t("neetoApiKeys.fields.neverExpire"),
412
+ name: "hasNoExpiry",
413
+ onChange: function onChange() {
414
+ setFieldValue("expiresAt", null);
415
+ setFieldValue("hasNoExpiry", !hasNoExpiry);
416
+ }
417
+ })]
418
+ })]
419
+ })
420
+ }), /*#__PURE__*/jsx(Pane.Footer, {
421
+ children: /*#__PURE__*/jsx(ActionBlock, {
422
+ isSubmitting: isSubmitting,
423
+ cancelButtonProps: {
424
+ onClick: onClose
425
+ }
426
+ })
427
+ })]
428
+ });
347
429
  }
348
- }, function (_ref2) {
349
- var setFieldValue = _ref2.setFieldValue,
350
- _ref2$values = _ref2.values,
351
- _ref2$values2 = _ref2$values === void 0 ? {} : _ref2$values,
352
- hasNoExpiry = _ref2$values2.hasNoExpiry,
353
- expiresAt = _ref2$values2.expiresAt;
354
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
355
- className: "w-full space-y-4"
356
- }, /*#__PURE__*/React.createElement(Input, {
357
- autoFocus: true,
358
- label: t("neetoApiKeys.fields.label"),
359
- name: "label",
360
- placeholder: t("neetoApiKeys.placeholders.label"),
361
- ref: initialFocusRef
362
- }), /*#__PURE__*/React.createElement("div", {
363
- className: "space-y-2"
364
- }, !hasNoExpiry && /*#__PURE__*/React.createElement(DatePicker, {
365
- defaultValue: expiresAt,
366
- disabledDate: function disabledDate(date) {
367
- return date < NEXT_DAY;
368
- },
369
- label: t("neetoApiKeys.fields.expiryDate"),
370
- name: "expiresAt",
371
- placeholder: t("neetoApiKeys.placeholders.selectExpiryDate")
372
- }), /*#__PURE__*/React.createElement(Checkbox, {
373
- checked: hasNoExpiry,
374
- label: t("neetoApiKeys.fields.neverExpire"),
375
- name: "hasNoExpiry",
376
- onChange: function onChange() {
377
- setFieldValue("expiresAt", null);
378
- setFieldValue("hasNoExpiry", !hasNoExpiry);
379
- }
380
- })))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement(ActionBlock, {
381
- isSubmitting: isSubmitting,
382
- cancelButtonProps: {
383
- onClick: onClose
384
- }
385
- })));
386
430
  });
387
431
  });
388
432
 
@@ -395,63 +439,33 @@ var Create = function Create(_ref) {
395
439
  isCreating = _useCreateApiKey.isLoading;
396
440
  var _useTranslation = useTranslation(),
397
441
  t = _useTranslation.t;
398
- return /*#__PURE__*/React.createElement(Pane, {
399
- initialFocusRef: initialFocusRef,
400
- onClose: onClose,
401
- isOpen: isOpen
402
- }, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
403
- style: "h2"
404
- }, t("neetoApiKeys.headers.createApiKey"))), /*#__PURE__*/React.createElement(Form, {
442
+ return /*#__PURE__*/jsxs(Pane, {
405
443
  initialFocusRef: initialFocusRef,
444
+ isOpen: isOpen,
406
445
  onClose: onClose,
407
- isSubmitting: isCreating,
408
- onSubmit: createApiKey
409
- }));
446
+ children: [/*#__PURE__*/jsx(Pane.Header, {
447
+ children: /*#__PURE__*/jsxs(Typography, {
448
+ style: "h2",
449
+ children: [t("neetoApiKeys.headers.createApiKey"), /*#__PURE__*/jsx(HelpPopover, {
450
+ className: "ml-2",
451
+ description: t("neetoApiKeys.tooltips.apiKeysDescription"),
452
+ helpLinkProps: {
453
+ href: HELP_DOC_URL
454
+ },
455
+ title: t("neetoApiKeys.tooltips.apiKeys")
456
+ })]
457
+ })
458
+ }), /*#__PURE__*/jsx(Form, {
459
+ initialFocusRef: initialFocusRef,
460
+ onClose: onClose,
461
+ isSubmitting: isCreating,
462
+ onSubmit: createApiKey
463
+ })]
464
+ });
410
465
  };
411
466
 
412
- function _typeof(o) {
413
- "@babel/helpers - typeof";
414
-
415
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
416
- return typeof o;
417
- } : function (o) {
418
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
419
- }, _typeof(o);
420
- }
421
-
422
- function _toPrimitive(input, hint) {
423
- if (_typeof(input) !== "object" || input === null) return input;
424
- var prim = input[Symbol.toPrimitive];
425
- if (prim !== undefined) {
426
- var res = prim.call(input, hint || "default");
427
- if (_typeof(res) !== "object") return res;
428
- throw new TypeError("@@toPrimitive must return a primitive value.");
429
- }
430
- return (hint === "string" ? String : Number)(input);
431
- }
432
-
433
- function _toPropertyKey(arg) {
434
- var key = _toPrimitive(arg, "string");
435
- return _typeof(key) === "symbol" ? key : String(key);
436
- }
437
-
438
- function _defineProperty(obj, key, value) {
439
- key = _toPropertyKey(key);
440
- if (key in obj) {
441
- Object.defineProperty(obj, key, {
442
- value: value,
443
- enumerable: true,
444
- configurable: true,
445
- writable: true
446
- });
447
- } else {
448
- obj[key] = value;
449
- }
450
- return obj;
451
- }
452
-
453
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
454
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
467
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
468
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
455
469
  var Update = function Update(_ref) {
456
470
  var onClose = _ref.onClose,
457
471
  apiKey = _ref.apiKey;
@@ -467,22 +481,33 @@ var Update = function Update(_ref) {
467
481
  payload: values
468
482
  });
469
483
  };
470
- var initialValues = _objectSpread(_objectSpread({}, apiKey), {}, {
484
+ var initialValues = _objectSpread$2(_objectSpread$2({}, apiKey), {}, {
471
485
  hasNoExpiry: isNotPresent(apiKey.expiresAt)
472
486
  });
473
- return /*#__PURE__*/React.createElement(Pane, {
487
+ return /*#__PURE__*/jsxs(Pane, {
474
488
  initialFocusRef: initialFocusRef,
475
489
  onClose: onClose,
476
- isOpen: isNotEmpty(apiKey)
477
- }, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
478
- style: "h2"
479
- }, t("neetoApiKeys.headers.updateApiKey"))), /*#__PURE__*/React.createElement(Form, {
480
- initialValues: initialValues,
481
- onClose: onClose,
482
- initialFocusRef: initialFocusRef,
483
- isSubmitting: isUpdating,
484
- onSubmit: handleUpdate
485
- }));
490
+ isOpen: isNotEmpty(apiKey),
491
+ children: [/*#__PURE__*/jsx(Pane.Header, {
492
+ children: /*#__PURE__*/jsxs(Typography, {
493
+ style: "h2",
494
+ children: [t("neetoApiKeys.headers.updateApiKey"), /*#__PURE__*/jsx(HelpPopover, {
495
+ className: "ml-2",
496
+ description: t("neetoApiKeys.tooltips.apiKeysDescription"),
497
+ helpLinkProps: {
498
+ href: HELP_DOC_URL
499
+ },
500
+ title: t("neetoApiKeys.tooltips.apiKeys")
501
+ })]
502
+ })
503
+ }), /*#__PURE__*/jsx(Form, {
504
+ initialFocusRef: initialFocusRef,
505
+ initialValues: initialValues,
506
+ onClose: onClose,
507
+ isSubmitting: isUpdating,
508
+ onSubmit: handleUpdate
509
+ })]
510
+ });
486
511
  };
487
512
 
488
513
  var getPageFromSearchParams = function getPageFromSearchParams() {
@@ -537,6 +562,8 @@ var usePagination = function usePagination(_ref) {
537
562
  };
538
563
  };
539
564
 
565
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
566
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
540
567
  var Table = function Table(_ref) {
541
568
  var handleDelete = _ref.handleDelete,
542
569
  handleEdit = _ref.handleEdit,
@@ -571,38 +598,52 @@ var Table = function Table(_ref) {
571
598
  totalCount = _useFetchApiKeys$data2.totalCount,
572
599
  isLoading = _useFetchApiKeys.isLoading,
573
600
  isFetching = _useFetchApiKeys.isFetching;
574
- if (isLoading) return /*#__PURE__*/React.createElement(PageLoader, null);
601
+ if (isLoading) return /*#__PURE__*/jsx(PageLoader, {});
575
602
  if (isEmpty(apiKeys)) {
576
- return /*#__PURE__*/React.createElement("div", {
577
- className: "flex h-full w-full items-center justify-center"
578
- }, /*#__PURE__*/React.createElement(NoData, _extends({
579
- primaryButtonProps: {
580
- label: t("neetoApiKeys.buttons.addApiKey"),
581
- onClick: function onClick() {
582
- return setIsCreatePaneOpen(true);
603
+ return /*#__PURE__*/jsxs("div", {
604
+ className: "flex h-full w-full items-center justify-center",
605
+ children: [/*#__PURE__*/jsx(NoData, _objectSpread$1({
606
+ className: "w-full",
607
+ title: t("neetoApiKeys.noData.title"),
608
+ helpText: /*#__PURE__*/jsx(Trans, {
609
+ i18nKey: "neetoApiKeys.noData.helpText",
610
+ components: {
611
+ helpLink: /*#__PURE__*/jsx(Button, {
612
+ href: HELP_DOC_URL,
613
+ style: "link",
614
+ target: "_blank"
615
+ })
616
+ }
617
+ }),
618
+ primaryButtonProps: {
619
+ label: t("neetoApiKeys.buttons.addApiKey"),
620
+ onClick: function onClick() {
621
+ return setIsCreatePaneOpen(true);
622
+ }
583
623
  }
584
- },
585
- className: "w-full",
586
- title: t("neetoApiKeys.noData.title")
587
- }, noDataProps)), ";");
624
+ }, noDataProps)), ";"]
625
+ });
588
626
  }
589
- return /*#__PURE__*/React.createElement(TableWrapper, {
590
- hasPagination: totalCount > DEFAULT_PAGE_SIZE
591
- }, /*#__PURE__*/React.createElement(Table$1, {
592
- fixedHeight: true,
593
- columnData: buildColumnData({
594
- handleDelete: handleDelete,
595
- handleEdit: handleEdit
596
- }),
597
- currentPageNumber: currentPage,
598
- defaultPageSize: DEFAULT_PAGE_SIZE,
599
- handlePageChange: handlePageChange,
600
- loading: isFetching,
601
- rowData: apiKeys,
602
- totalCount: totalCount
603
- }));
627
+ return /*#__PURE__*/jsx(TableWrapper, {
628
+ hasPagination: totalCount > DEFAULT_PAGE_SIZE,
629
+ children: /*#__PURE__*/jsx(NeetoUITable, {
630
+ handlePageChange: handlePageChange,
631
+ totalCount: totalCount,
632
+ fixedHeight: true,
633
+ columnData: buildColumnData({
634
+ handleDelete: handleDelete,
635
+ handleEdit: handleEdit
636
+ }),
637
+ currentPageNumber: currentPage,
638
+ defaultPageSize: DEFAULT_PAGE_SIZE,
639
+ loading: isFetching,
640
+ rowData: apiKeys
641
+ })
642
+ });
604
643
  };
605
644
 
645
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
646
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
606
647
  var ApiKeys = function ApiKeys(_ref) {
607
648
  var noDataProps = _ref.noDataProps,
608
649
  headerProps = _ref.headerProps;
@@ -628,56 +669,66 @@ var ApiKeys = function ApiKeys(_ref) {
628
669
  }),
629
670
  deleteApiKey = _useDeleteApiKey.mutate,
630
671
  isDeleting = _useDeleteApiKey.isLoading;
631
- return /*#__PURE__*/React.createElement("div", {
632
- className: "flex h-full w-full flex-col"
633
- }, /*#__PURE__*/React.createElement(Header, _extends({
634
- title: t("neetoApiKeys.common.apiKey", PLURAL),
635
- actionBlock: /*#__PURE__*/React.createElement(Button, {
636
- label: t("neetoApiKeys.buttons.addApiKey"),
637
- onClick: function onClick() {
638
- return setIsCreatePaneOpen(true);
639
- }
640
- }),
641
- searchProps: {
642
- placeholder: t("neetoApiKeys.placeholders.search")
643
- }
644
- }, headerProps)), /*#__PURE__*/React.createElement(Table, {
645
- handleDelete: setApiKeyToBeDeleted,
646
- handleEdit: setApiKeyToBeEdited,
647
- searchTerm: searchTerm,
648
- setIsCreatePaneOpen: setIsCreatePaneOpen,
649
- noDataProps: noDataProps
650
- }), /*#__PURE__*/React.createElement(Alert, {
651
- isOpen: isNotEmpty(apiKeyToBeDeleted),
652
- isSubmitting: isDeleting,
653
- submitButtonLabel: t("neetoApiKeys.buttons.delete"),
654
- title: t("neetoApiKeys.alert.titles.deleteApiKey"),
655
- message: /*#__PURE__*/React.createElement(Trans, {
656
- components: {
657
- bold: /*#__PURE__*/React.createElement("strong", null)
672
+ return /*#__PURE__*/jsxs("div", {
673
+ className: "flex h-full w-full flex-col",
674
+ children: [/*#__PURE__*/jsx(Header, _objectSpread({
675
+ actionBlock: /*#__PURE__*/jsx(Button, {
676
+ label: t("neetoApiKeys.buttons.addApiKey"),
677
+ onClick: function onClick() {
678
+ return setIsCreatePaneOpen(true);
679
+ }
680
+ }),
681
+ searchProps: {
682
+ placeholder: t("neetoApiKeys.placeholders.search")
683
+ },
684
+ title: /*#__PURE__*/jsxs("div", {
685
+ className: "flex items-center gap-x-2",
686
+ children: [t("neetoApiKeys.common.apiKey", PLURAL), /*#__PURE__*/jsx(HelpPopover, {
687
+ description: t("neetoApiKeys.tooltips.apiKeysDescription"),
688
+ helpLinkProps: {
689
+ href: HELP_DOC_URL
690
+ },
691
+ title: t("neetoApiKeys.tooltips.apiKeys")
692
+ })]
693
+ })
694
+ }, headerProps)), /*#__PURE__*/jsx(Table, {
695
+ noDataProps: noDataProps,
696
+ searchTerm: searchTerm,
697
+ setIsCreatePaneOpen: setIsCreatePaneOpen,
698
+ handleDelete: setApiKeyToBeDeleted,
699
+ handleEdit: setApiKeyToBeEdited
700
+ }), /*#__PURE__*/jsx(Alert, {
701
+ isOpen: isNotEmpty(apiKeyToBeDeleted),
702
+ isSubmitting: isDeleting,
703
+ submitButtonLabel: t("neetoApiKeys.buttons.delete"),
704
+ title: t("neetoApiKeys.alert.titles.deleteApiKey"),
705
+ message: /*#__PURE__*/jsx(Trans, {
706
+ components: {
707
+ bold: /*#__PURE__*/jsx("strong", {})
708
+ },
709
+ i18nKey: "neetoApiKeys.alert.descriptions.deleteApiKey",
710
+ values: {
711
+ name: apiKeyToBeDeleted.label
712
+ }
713
+ }),
714
+ onClose: function onClose() {
715
+ return setApiKeyToBeDeleted({});
658
716
  },
659
- i18nKey: "neetoApiKeys.alert.descriptions.deleteApiKey",
660
- values: {
661
- name: apiKeyToBeDeleted.label
717
+ onSubmit: function onSubmit() {
718
+ return deleteApiKey(apiKeyToBeDeleted.id);
662
719
  }
663
- }),
664
- onClose: function onClose() {
665
- return setApiKeyToBeDeleted({});
666
- },
667
- onSubmit: function onSubmit() {
668
- return deleteApiKey(apiKeyToBeDeleted.id);
669
- }
670
- }), /*#__PURE__*/React.createElement(Create, {
671
- isOpen: isCreatePaneOpen,
672
- onClose: function onClose() {
673
- return setIsCreatePaneOpen(false);
674
- }
675
- }), /*#__PURE__*/React.createElement(Update, {
676
- apiKey: apiKeyToBeEdited,
677
- onClose: function onClose() {
678
- return setApiKeyToBeEdited({});
679
- }
680
- }));
720
+ }), /*#__PURE__*/jsx(Create, {
721
+ isOpen: isCreatePaneOpen,
722
+ onClose: function onClose() {
723
+ return setIsCreatePaneOpen(false);
724
+ }
725
+ }), /*#__PURE__*/jsx(Update, {
726
+ apiKey: apiKeyToBeEdited,
727
+ onClose: function onClose() {
728
+ return setApiKeyToBeEdited({});
729
+ }
730
+ })]
731
+ });
681
732
  };
682
733
  var index = withTitle(ApiKeys, t("neetoApiKeys.common.apiKey", PLURAL));
683
734