@bigbinary/neeto-api-keys-frontend 1.1.14 → 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/app/javascript/src/translations/en.json +5 -2
- package/dist/index.cjs.js +318 -261
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +309 -252
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
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 HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
7
8
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
8
9
|
import Button from '@bigbinary/neetoui/Button';
|
|
9
10
|
import { useTranslation, Trans } from 'react-i18next';
|
|
11
|
+
import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
10
12
|
import { useQuery } from 'react-query';
|
|
11
13
|
import axios from 'axios';
|
|
12
14
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
@@ -24,25 +26,52 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
24
26
|
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
25
27
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
26
28
|
import * as yup from 'yup';
|
|
29
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
27
30
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
28
31
|
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
29
32
|
import NeetoUITable from '@bigbinary/neetoui/Table';
|
|
30
33
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
31
34
|
import { useHistory } from 'react-router-dom';
|
|
32
35
|
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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;
|
|
46
75
|
}
|
|
47
76
|
|
|
48
77
|
function _arrayWithHoles(arr) {
|
|
@@ -101,6 +130,7 @@ function _slicedToArray(arr, i) {
|
|
|
101
130
|
}
|
|
102
131
|
|
|
103
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");
|
|
104
134
|
|
|
105
135
|
var fetch = function fetch(params) {
|
|
106
136
|
return axios.get(API_KEYS_BASE_URL, {
|
|
@@ -220,23 +250,25 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
220
250
|
dataIndex: "label",
|
|
221
251
|
width: 400,
|
|
222
252
|
render: function render(label, apiKey) {
|
|
223
|
-
return /*#__PURE__*/
|
|
224
|
-
className: "flex items-center justify-between space-x-3"
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
menuItems: getMenuItems({
|
|
232
|
-
onEdit: function onEdit() {
|
|
233
|
-
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"
|
|
234
261
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
262
|
+
menuItems: getMenuItems({
|
|
263
|
+
onEdit: function onEdit() {
|
|
264
|
+
return handleEdit(apiKey);
|
|
265
|
+
},
|
|
266
|
+
onDelete: function onDelete() {
|
|
267
|
+
return handleDelete(apiKey);
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
})]
|
|
271
|
+
});
|
|
240
272
|
}
|
|
241
273
|
}, {
|
|
242
274
|
title: t("neetoApiKeys.table.headers.token"),
|
|
@@ -244,14 +276,16 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
244
276
|
dataIndex: "token",
|
|
245
277
|
width: 400,
|
|
246
278
|
render: function render(token) {
|
|
247
|
-
return /*#__PURE__*/
|
|
248
|
-
className: "flex items-center justify-between gap-x-3"
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|
+
});
|
|
255
289
|
}
|
|
256
290
|
}, {
|
|
257
291
|
title: t("neetoApiKeys.table.headers.status"),
|
|
@@ -259,11 +293,13 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
259
293
|
width: 144,
|
|
260
294
|
render: function render(_, _ref3) {
|
|
261
295
|
var expiresAt = _ref3.expiresAt;
|
|
262
|
-
return isPresent(expiresAt) && isInPast(expiresAt) ? /*#__PURE__*/
|
|
263
|
-
style: "warning"
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
+
});
|
|
267
303
|
}
|
|
268
304
|
}, {
|
|
269
305
|
title: t("neetoApiKeys.table.headers.expiresAt"),
|
|
@@ -271,9 +307,10 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
271
307
|
dataIndex: "expiresAt",
|
|
272
308
|
width: 200,
|
|
273
309
|
render: function render(expiresAt) {
|
|
274
|
-
return isPresent(expiresAt) ? formatExpiry(expiresAt) : /*#__PURE__*/
|
|
275
|
-
style: "body2"
|
|
276
|
-
|
|
310
|
+
return isPresent(expiresAt) ? formatExpiry(expiresAt) : /*#__PURE__*/jsx(Typography, {
|
|
311
|
+
style: "body2",
|
|
312
|
+
children: t("neetoApiKeys.common.never")
|
|
313
|
+
});
|
|
277
314
|
}
|
|
278
315
|
}, {
|
|
279
316
|
title: t("neetoApiKeys.table.headers.createdAt"),
|
|
@@ -281,9 +318,10 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
281
318
|
dataIndex: "createdAt",
|
|
282
319
|
width: 200,
|
|
283
320
|
render: function render(createdAt) {
|
|
284
|
-
return isPresent(createdAt) ? dateFormat.dateTime(createdAt) : /*#__PURE__*/
|
|
285
|
-
style: "body2"
|
|
286
|
-
|
|
321
|
+
return isPresent(createdAt) ? dateFormat.dateTime(createdAt) : /*#__PURE__*/jsx(Typography, {
|
|
322
|
+
style: "body2",
|
|
323
|
+
children: t("neetoApiKeys.common.never")
|
|
324
|
+
});
|
|
287
325
|
}
|
|
288
326
|
}];
|
|
289
327
|
};
|
|
@@ -291,6 +329,8 @@ var getStartOfTime = function getStartOfTime(time, unit) {
|
|
|
291
329
|
return dayjs(time).startOf(unit);
|
|
292
330
|
};
|
|
293
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; }
|
|
294
334
|
var DatePicker = function DatePicker(_ref) {
|
|
295
335
|
var defaultValue = _ref.defaultValue,
|
|
296
336
|
disabledDate = _ref.disabledDate,
|
|
@@ -299,29 +339,30 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
299
339
|
name = _ref.name,
|
|
300
340
|
_ref$disabled = _ref.disabled,
|
|
301
341
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
302
|
-
return /*#__PURE__*/
|
|
303
|
-
name: name
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
+
}
|
|
325
366
|
});
|
|
326
367
|
};
|
|
327
368
|
|
|
@@ -333,50 +374,59 @@ var Form = withT(function (_ref) {
|
|
|
333
374
|
onClose = _ref.onClose,
|
|
334
375
|
onSubmit = _ref.onSubmit,
|
|
335
376
|
initialFocusRef = _ref.initialFocusRef;
|
|
336
|
-
return /*#__PURE__*/
|
|
377
|
+
return /*#__PURE__*/jsx(NeetoUIForm, {
|
|
337
378
|
formikProps: {
|
|
338
379
|
validationSchema: VALIDATION_SCHEMA,
|
|
339
380
|
initialValues: initialValues,
|
|
340
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
|
+
});
|
|
341
429
|
}
|
|
342
|
-
}, function (_ref2) {
|
|
343
|
-
var setFieldValue = _ref2.setFieldValue,
|
|
344
|
-
_ref2$values = _ref2.values,
|
|
345
|
-
_ref2$values2 = _ref2$values === void 0 ? {} : _ref2$values,
|
|
346
|
-
hasNoExpiry = _ref2$values2.hasNoExpiry,
|
|
347
|
-
expiresAt = _ref2$values2.expiresAt;
|
|
348
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
|
|
349
|
-
className: "w-full space-y-4"
|
|
350
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
351
|
-
autoFocus: true,
|
|
352
|
-
label: t("neetoApiKeys.fields.label"),
|
|
353
|
-
name: "label",
|
|
354
|
-
placeholder: t("neetoApiKeys.placeholders.label"),
|
|
355
|
-
ref: initialFocusRef
|
|
356
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
357
|
-
className: "space-y-2"
|
|
358
|
-
}, !hasNoExpiry && /*#__PURE__*/React.createElement(DatePicker, {
|
|
359
|
-
defaultValue: expiresAt,
|
|
360
|
-
disabledDate: function disabledDate(date) {
|
|
361
|
-
return date < NEXT_DAY;
|
|
362
|
-
},
|
|
363
|
-
label: t("neetoApiKeys.fields.expiryDate"),
|
|
364
|
-
name: "expiresAt",
|
|
365
|
-
placeholder: t("neetoApiKeys.placeholders.selectExpiryDate")
|
|
366
|
-
}), /*#__PURE__*/React.createElement(Checkbox, {
|
|
367
|
-
checked: hasNoExpiry,
|
|
368
|
-
label: t("neetoApiKeys.fields.neverExpire"),
|
|
369
|
-
name: "hasNoExpiry",
|
|
370
|
-
onChange: function onChange() {
|
|
371
|
-
setFieldValue("expiresAt", null);
|
|
372
|
-
setFieldValue("hasNoExpiry", !hasNoExpiry);
|
|
373
|
-
}
|
|
374
|
-
})))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement(ActionBlock, {
|
|
375
|
-
isSubmitting: isSubmitting,
|
|
376
|
-
cancelButtonProps: {
|
|
377
|
-
onClick: onClose
|
|
378
|
-
}
|
|
379
|
-
})));
|
|
380
430
|
});
|
|
381
431
|
});
|
|
382
432
|
|
|
@@ -389,63 +439,33 @@ var Create = function Create(_ref) {
|
|
|
389
439
|
isCreating = _useCreateApiKey.isLoading;
|
|
390
440
|
var _useTranslation = useTranslation(),
|
|
391
441
|
t = _useTranslation.t;
|
|
392
|
-
return /*#__PURE__*/
|
|
442
|
+
return /*#__PURE__*/jsxs(Pane, {
|
|
393
443
|
initialFocusRef: initialFocusRef,
|
|
444
|
+
isOpen: isOpen,
|
|
394
445
|
onClose: onClose,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
+
});
|
|
404
465
|
};
|
|
405
466
|
|
|
406
|
-
function
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
410
|
-
return typeof o;
|
|
411
|
-
} : function (o) {
|
|
412
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
413
|
-
}, _typeof(o);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function _toPrimitive(input, hint) {
|
|
417
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
418
|
-
var prim = input[Symbol.toPrimitive];
|
|
419
|
-
if (prim !== undefined) {
|
|
420
|
-
var res = prim.call(input, hint || "default");
|
|
421
|
-
if (_typeof(res) !== "object") return res;
|
|
422
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
423
|
-
}
|
|
424
|
-
return (hint === "string" ? String : Number)(input);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function _toPropertyKey(arg) {
|
|
428
|
-
var key = _toPrimitive(arg, "string");
|
|
429
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function _defineProperty(obj, key, value) {
|
|
433
|
-
key = _toPropertyKey(key);
|
|
434
|
-
if (key in obj) {
|
|
435
|
-
Object.defineProperty(obj, key, {
|
|
436
|
-
value: value,
|
|
437
|
-
enumerable: true,
|
|
438
|
-
configurable: true,
|
|
439
|
-
writable: true
|
|
440
|
-
});
|
|
441
|
-
} else {
|
|
442
|
-
obj[key] = value;
|
|
443
|
-
}
|
|
444
|
-
return obj;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
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; }
|
|
448
|
-
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; }
|
|
449
469
|
var Update = function Update(_ref) {
|
|
450
470
|
var onClose = _ref.onClose,
|
|
451
471
|
apiKey = _ref.apiKey;
|
|
@@ -461,22 +481,33 @@ var Update = function Update(_ref) {
|
|
|
461
481
|
payload: values
|
|
462
482
|
});
|
|
463
483
|
};
|
|
464
|
-
var initialValues = _objectSpread(_objectSpread({}, apiKey), {}, {
|
|
484
|
+
var initialValues = _objectSpread$2(_objectSpread$2({}, apiKey), {}, {
|
|
465
485
|
hasNoExpiry: isNotPresent(apiKey.expiresAt)
|
|
466
486
|
});
|
|
467
|
-
return /*#__PURE__*/
|
|
487
|
+
return /*#__PURE__*/jsxs(Pane, {
|
|
468
488
|
initialFocusRef: initialFocusRef,
|
|
469
489
|
onClose: onClose,
|
|
470
|
-
isOpen: isNotEmpty(apiKey)
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
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
|
+
});
|
|
480
511
|
};
|
|
481
512
|
|
|
482
513
|
var getPageFromSearchParams = function getPageFromSearchParams() {
|
|
@@ -531,6 +562,8 @@ var usePagination = function usePagination(_ref) {
|
|
|
531
562
|
};
|
|
532
563
|
};
|
|
533
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; }
|
|
534
567
|
var Table = function Table(_ref) {
|
|
535
568
|
var handleDelete = _ref.handleDelete,
|
|
536
569
|
handleEdit = _ref.handleEdit,
|
|
@@ -565,38 +598,52 @@ var Table = function Table(_ref) {
|
|
|
565
598
|
totalCount = _useFetchApiKeys$data2.totalCount,
|
|
566
599
|
isLoading = _useFetchApiKeys.isLoading,
|
|
567
600
|
isFetching = _useFetchApiKeys.isFetching;
|
|
568
|
-
if (isLoading) return /*#__PURE__*/
|
|
601
|
+
if (isLoading) return /*#__PURE__*/jsx(PageLoader, {});
|
|
569
602
|
if (isEmpty(apiKeys)) {
|
|
570
|
-
return /*#__PURE__*/
|
|
571
|
-
className: "flex h-full w-full items-center justify-center"
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|
+
}
|
|
577
623
|
}
|
|
578
|
-
},
|
|
579
|
-
|
|
580
|
-
title: t("neetoApiKeys.noData.title")
|
|
581
|
-
}, noDataProps)), ";");
|
|
624
|
+
}, noDataProps)), ";"]
|
|
625
|
+
});
|
|
582
626
|
}
|
|
583
|
-
return /*#__PURE__*/
|
|
584
|
-
hasPagination: totalCount > DEFAULT_PAGE_SIZE
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
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
|
+
});
|
|
598
643
|
};
|
|
599
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; }
|
|
600
647
|
var ApiKeys = function ApiKeys(_ref) {
|
|
601
648
|
var noDataProps = _ref.noDataProps,
|
|
602
649
|
headerProps = _ref.headerProps;
|
|
@@ -622,56 +669,66 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
622
669
|
}),
|
|
623
670
|
deleteApiKey = _useDeleteApiKey.mutate,
|
|
624
671
|
isDeleting = _useDeleteApiKey.isLoading;
|
|
625
|
-
return /*#__PURE__*/
|
|
626
|
-
className: "flex h-full w-full flex-col"
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
placeholder: t("neetoApiKeys.placeholders.search")
|
|
637
|
-
}
|
|
638
|
-
}, headerProps)), /*#__PURE__*/React.createElement(Table, {
|
|
639
|
-
handleDelete: setApiKeyToBeDeleted,
|
|
640
|
-
handleEdit: setApiKeyToBeEdited,
|
|
641
|
-
searchTerm: searchTerm,
|
|
642
|
-
setIsCreatePaneOpen: setIsCreatePaneOpen,
|
|
643
|
-
noDataProps: noDataProps
|
|
644
|
-
}), /*#__PURE__*/React.createElement(Alert, {
|
|
645
|
-
isOpen: isNotEmpty(apiKeyToBeDeleted),
|
|
646
|
-
isSubmitting: isDeleting,
|
|
647
|
-
submitButtonLabel: t("neetoApiKeys.buttons.delete"),
|
|
648
|
-
title: t("neetoApiKeys.alert.titles.deleteApiKey"),
|
|
649
|
-
message: /*#__PURE__*/React.createElement(Trans, {
|
|
650
|
-
components: {
|
|
651
|
-
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")
|
|
652
683
|
},
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
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({});
|
|
716
|
+
},
|
|
717
|
+
onSubmit: function onSubmit() {
|
|
718
|
+
return deleteApiKey(apiKeyToBeDeleted.id);
|
|
656
719
|
}
|
|
657
|
-
}),
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}), /*#__PURE__*/React.createElement(Update, {
|
|
670
|
-
apiKey: apiKeyToBeEdited,
|
|
671
|
-
onClose: function onClose() {
|
|
672
|
-
return setApiKeyToBeEdited({});
|
|
673
|
-
}
|
|
674
|
-
}));
|
|
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
|
+
});
|
|
675
732
|
};
|
|
676
733
|
var index = withTitle(ApiKeys, t("neetoApiKeys.common.apiKey", PLURAL));
|
|
677
734
|
|