@bigbinary/neeto-api-keys-frontend 3.2.0-beta2 → 3.2.1
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/ar.json +4 -2
- package/app/javascript/src/translations/bg.json +4 -2
- package/app/javascript/src/translations/ca.json +4 -2
- package/app/javascript/src/translations/cs.json +4 -2
- package/app/javascript/src/translations/da.json +4 -2
- package/app/javascript/src/translations/de.json +4 -2
- package/app/javascript/src/translations/en.json +2 -0
- package/app/javascript/src/translations/es-MX.json +4 -2
- package/app/javascript/src/translations/es.json +4 -2
- package/app/javascript/src/translations/et.json +4 -2
- package/app/javascript/src/translations/fi.json +4 -2
- package/app/javascript/src/translations/fil.json +4 -2
- package/app/javascript/src/translations/fr.json +4 -2
- package/app/javascript/src/translations/he.json +4 -2
- package/app/javascript/src/translations/hi.json +4 -2
- package/app/javascript/src/translations/hr.json +4 -2
- package/app/javascript/src/translations/hu.json +4 -2
- package/app/javascript/src/translations/id.json +4 -2
- package/app/javascript/src/translations/it.json +4 -2
- package/app/javascript/src/translations/ja.json +4 -2
- package/app/javascript/src/translations/ko.json +4 -2
- package/app/javascript/src/translations/lv.json +4 -2
- package/app/javascript/src/translations/nl.json +4 -2
- package/app/javascript/src/translations/pl.json +4 -2
- package/app/javascript/src/translations/pt-BR.json +4 -2
- package/app/javascript/src/translations/pt.json +4 -2
- package/app/javascript/src/translations/ro.json +4 -2
- package/app/javascript/src/translations/ru.json +4 -2
- package/app/javascript/src/translations/sk.json +4 -2
- package/app/javascript/src/translations/sl.json +4 -2
- package/app/javascript/src/translations/sv.json +4 -2
- package/app/javascript/src/translations/th.json +4 -2
- package/app/javascript/src/translations/tr.json +4 -2
- package/app/javascript/src/translations/uk.json +4 -2
- package/app/javascript/src/translations/vi.json +4 -2
- package/app/javascript/src/translations/zh-CN.json +4 -2
- package/app/javascript/src/translations/zh-TW.json +4 -2
- package/dist/.ready +1 -1
- package/dist/ApiKeys.js +200 -24
- package/dist/ApiKeys.js.map +1 -1
- package/dist/cjs/ApiKeys.js +199 -23
- package/dist/cjs/ApiKeys.js.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/ApiKeys.js +210 -23
- package/dist/cjs/v2/ApiKeys.js.map +1 -1
- package/dist/cjs/v2/index.js +1 -0
- package/dist/cjs/v2/index.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/v2/ApiKeys.js +212 -25
- package/dist/v2/ApiKeys.js.map +1 -1
- package/dist/v2/index.js +1 -0
- package/dist/v2/index.js.map +1 -1
- package/package.json +13 -13
package/dist/v2/ApiKeys.js
CHANGED
|
@@ -2,8 +2,8 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import { useRef, useMemo, useState, useEffect } from 'react';
|
|
4
4
|
import { t } from 'i18next';
|
|
5
|
-
import { Typography, Badge, DatePicker as DatePicker$1, Sheet, Spinner, Empty, DataTable,
|
|
6
|
-
import { isPresent, humanize,
|
|
5
|
+
import { Button, Typography, Badge, DatePicker as DatePicker$1, Sheet, Avatar, Spinner, Empty, DataTable, Alert } from '@bigbinary/neeto-atoms';
|
|
6
|
+
import { isPresent, humanize, isNotEmpty, isNotPresent } from '@bigbinary/neeto-cist';
|
|
7
7
|
import { DEFAULT_PAGE_SIZE, PLURAL } from '@bigbinary/neeto-commons-frontend/v2/constants';
|
|
8
8
|
import { withTitle, useQueryParams, useDebounce } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
9
9
|
import { dayjs, dateFormat, getQueryParams } from '@bigbinary/neeto-commons-frontend/v2/utils';
|
|
@@ -21,6 +21,7 @@ import { globalProps } from '@bigbinary/neeto-commons-frontend/v2/initializers';
|
|
|
21
21
|
import CopyToClipboardButton from '@bigbinary/neeto-molecules/v2/CopyToClipboardButton';
|
|
22
22
|
import MoreDropdown from '@bigbinary/neeto-molecules/v2/MoreDropdown';
|
|
23
23
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
24
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
24
25
|
import { KeyRound } from 'lucide-react';
|
|
25
26
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
26
27
|
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
@@ -81,6 +82,9 @@ var MASKED_TOKEN_LENGTH = 20;
|
|
|
81
82
|
var isInPast = function isInPast(date) {
|
|
82
83
|
return dayjs(date).isBefore(dayjs());
|
|
83
84
|
};
|
|
85
|
+
var isExpired = function isExpired(expiresAt) {
|
|
86
|
+
return isPresent(expiresAt) && isInPast(expiresAt);
|
|
87
|
+
};
|
|
84
88
|
var partlyHideToken = function partlyHideToken(key) {
|
|
85
89
|
var prefixMatch = key.match(/^([A-Z]+-)/);
|
|
86
90
|
if (prefixMatch) {
|
|
@@ -114,6 +118,7 @@ var getMenuItems = function getMenuItems(_ref) {
|
|
|
114
118
|
var buildColumnData = function buildColumnData(_ref2) {
|
|
115
119
|
var handleDelete = _ref2.handleDelete,
|
|
116
120
|
handleEdit = _ref2.handleEdit,
|
|
121
|
+
handleView = _ref2.handleView,
|
|
117
122
|
isZapierAvailable = _ref2.isZapierAvailable;
|
|
118
123
|
var columns = [{
|
|
119
124
|
id: "label",
|
|
@@ -127,11 +132,14 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
127
132
|
var apiKey = row.original;
|
|
128
133
|
return /*#__PURE__*/jsxs("div", {
|
|
129
134
|
className: "flex items-center justify-between gap-x-3",
|
|
130
|
-
children: [/*#__PURE__*/jsx(
|
|
131
|
-
className: "min-w-0
|
|
135
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
136
|
+
className: "min-w-0 shrink justify-start text-left [&>span]:min-w-0 [&>span>span]:truncate",
|
|
132
137
|
"data-testid": "api-keys-label-field",
|
|
133
138
|
title: label,
|
|
134
|
-
variant: "
|
|
139
|
+
variant: "link",
|
|
140
|
+
onClick: function onClick() {
|
|
141
|
+
return handleView(apiKey);
|
|
142
|
+
},
|
|
135
143
|
children: label
|
|
136
144
|
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
137
145
|
menuItems: getMenuItems({
|
|
@@ -192,7 +200,7 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
192
200
|
cell: function cell(_ref6) {
|
|
193
201
|
var row = _ref6.row;
|
|
194
202
|
var expiresAt = row.original.expiresAt;
|
|
195
|
-
return
|
|
203
|
+
return isExpired(expiresAt) ? /*#__PURE__*/jsx(Badge, {
|
|
196
204
|
variant: "amber",
|
|
197
205
|
children: t("neetoApiKeys.tags.expired")
|
|
198
206
|
}) : /*#__PURE__*/jsx(Badge, {
|
|
@@ -255,7 +263,8 @@ var getStartOfTime = function getStartOfTime(time, unit) {
|
|
|
255
263
|
};
|
|
256
264
|
|
|
257
265
|
var DatePicker = function DatePicker(_ref) {
|
|
258
|
-
var
|
|
266
|
+
var dataTestId = _ref.dataTestId,
|
|
267
|
+
defaultValue = _ref.defaultValue,
|
|
259
268
|
disabledDate = _ref.disabledDate,
|
|
260
269
|
label = _ref.label,
|
|
261
270
|
placeholder = _ref.placeholder,
|
|
@@ -272,6 +281,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
272
281
|
setFieldValue = _ref2$form.setFieldValue,
|
|
273
282
|
setFieldTouched = _ref2$form.setFieldTouched;
|
|
274
283
|
return /*#__PURE__*/jsx(DatePicker$1, {
|
|
284
|
+
dataTestId: dataTestId,
|
|
275
285
|
defaultValue: defaultValue,
|
|
276
286
|
disabled: disabled,
|
|
277
287
|
disabledDate: disabledDate,
|
|
@@ -342,9 +352,9 @@ var getExpirationDate = function getExpirationDate(type) {
|
|
|
342
352
|
}
|
|
343
353
|
};
|
|
344
354
|
|
|
345
|
-
function ownKeys$
|
|
346
|
-
function _objectSpread$
|
|
347
|
-
var Item = RadioGroup.Item;
|
|
355
|
+
function ownKeys$4(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; }
|
|
356
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
357
|
+
var Item$1 = RadioGroup.Item;
|
|
348
358
|
var Form = function Form(_ref) {
|
|
349
359
|
var _ref$initialValues = _ref.initialValues,
|
|
350
360
|
initialValues = _ref$initialValues === void 0 ? INITIAL_VALUES : _ref$initialValues,
|
|
@@ -358,7 +368,7 @@ var Form = function Form(_ref) {
|
|
|
358
368
|
isZapierAvailable = _ref$isZapierAvailabl === void 0 ? false : _ref$isZapierAvailabl;
|
|
359
369
|
var _useTranslation = useTranslation(),
|
|
360
370
|
t = _useTranslation.t;
|
|
361
|
-
var formInitialValues = _objectSpread$
|
|
371
|
+
var formInitialValues = _objectSpread$4(_objectSpread$4({}, initialValues), {}, {
|
|
362
372
|
expirationType: getInitialExpirationType({
|
|
363
373
|
isEdit: isEdit,
|
|
364
374
|
values: initialValues
|
|
@@ -390,6 +400,7 @@ var Form = function Form(_ref) {
|
|
|
390
400
|
children: [/*#__PURE__*/jsx(Input, {
|
|
391
401
|
autoFocus: true,
|
|
392
402
|
required: true,
|
|
403
|
+
dataTestId: "name",
|
|
393
404
|
label: t("neetoApiKeys.fields.label"),
|
|
394
405
|
name: "label",
|
|
395
406
|
placeholder: t("neetoApiKeys.placeholders.label"),
|
|
@@ -397,24 +408,29 @@ var Form = function Form(_ref) {
|
|
|
397
408
|
}), /*#__PURE__*/jsxs("div", {
|
|
398
409
|
className: "space-y-4",
|
|
399
410
|
children: [!isEdit && isZapierAvailable && /*#__PURE__*/jsxs(RadioGroup, {
|
|
411
|
+
dataTestId: "type",
|
|
400
412
|
label: t("neetoApiKeys.common.type"),
|
|
401
413
|
name: "type",
|
|
402
414
|
orientation: "vertical",
|
|
403
|
-
children: [/*#__PURE__*/jsx(Item, {
|
|
415
|
+
children: [/*#__PURE__*/jsx(Item$1, {
|
|
416
|
+
dataTestId: "general",
|
|
404
417
|
label: t("neetoApiKeys.common.general"),
|
|
405
418
|
name: "type",
|
|
406
419
|
value: API_KEY_TYPES.GENERAL
|
|
407
|
-
}), /*#__PURE__*/jsx(Item, {
|
|
420
|
+
}), /*#__PURE__*/jsx(Item$1, {
|
|
421
|
+
dataTestId: "zapier",
|
|
408
422
|
label: t("neetoApiKeys.common.zapier"),
|
|
409
423
|
name: "type",
|
|
410
424
|
value: API_KEY_TYPES.ZAPIER
|
|
411
425
|
})]
|
|
412
426
|
}), type === API_KEY_TYPES.GENERAL && /*#__PURE__*/jsx(Textarea, {
|
|
427
|
+
dataTestId: "notes",
|
|
413
428
|
label: t("neetoApiKeys.fields.notes"),
|
|
414
429
|
name: "notes",
|
|
415
430
|
placeholder: t("neetoApiKeys.placeholders.notes")
|
|
416
431
|
}), type === API_KEY_TYPES.GENERAL && /*#__PURE__*/jsxs(Fragment, {
|
|
417
432
|
children: [/*#__PURE__*/jsxs(RadioGroup, {
|
|
433
|
+
dataTestId: "token-expiration",
|
|
418
434
|
label: t("neetoApiKeys.fields.tokenExpiration"),
|
|
419
435
|
name: "expirationType",
|
|
420
436
|
orientation: "vertical",
|
|
@@ -433,32 +449,39 @@ var Form = function Form(_ref) {
|
|
|
433
449
|
type: expirationType
|
|
434
450
|
});
|
|
435
451
|
},
|
|
436
|
-
children: [/*#__PURE__*/jsx(Item, {
|
|
452
|
+
children: [/*#__PURE__*/jsx(Item$1, {
|
|
453
|
+
dataTestId: "7-days",
|
|
437
454
|
name: "expirationType",
|
|
438
455
|
value: EXPIRATION_OPTIONS.SEVEN_DAYS,
|
|
439
456
|
label: t("neetoApiKeys.fields.expirationOptions.sevenDays")
|
|
440
|
-
}), /*#__PURE__*/jsx(Item, {
|
|
457
|
+
}), /*#__PURE__*/jsx(Item$1, {
|
|
458
|
+
dataTestId: "30-days",
|
|
441
459
|
name: "expirationType",
|
|
442
460
|
value: EXPIRATION_OPTIONS.THIRTY_DAYS,
|
|
443
461
|
label: t("neetoApiKeys.fields.expirationOptions.thirtyDays")
|
|
444
|
-
}), /*#__PURE__*/jsx(Item, {
|
|
462
|
+
}), /*#__PURE__*/jsx(Item$1, {
|
|
463
|
+
dataTestId: "90-days",
|
|
445
464
|
name: "expirationType",
|
|
446
465
|
value: EXPIRATION_OPTIONS.NINETY_DAYS,
|
|
447
466
|
label: t("neetoApiKeys.fields.expirationOptions.ninetyDays")
|
|
448
|
-
}), /*#__PURE__*/jsx(Item, {
|
|
467
|
+
}), /*#__PURE__*/jsx(Item$1, {
|
|
468
|
+
dataTestId: "1-year",
|
|
449
469
|
name: "expirationType",
|
|
450
470
|
value: EXPIRATION_OPTIONS.ONE_YEAR,
|
|
451
471
|
label: t("neetoApiKeys.fields.expirationOptions.oneYear")
|
|
452
|
-
}), /*#__PURE__*/jsx(Item, {
|
|
472
|
+
}), /*#__PURE__*/jsx(Item$1, {
|
|
473
|
+
dataTestId: "no-expiration",
|
|
453
474
|
label: t("neetoApiKeys.fields.expirationOptions.never"),
|
|
454
475
|
name: "expirationType",
|
|
455
476
|
value: EXPIRATION_OPTIONS.NEVER
|
|
456
|
-
}), /*#__PURE__*/jsx(Item, {
|
|
477
|
+
}), /*#__PURE__*/jsx(Item$1, {
|
|
478
|
+
dataTestId: "custom",
|
|
457
479
|
name: "expirationType",
|
|
458
480
|
value: EXPIRATION_OPTIONS.CUSTOM,
|
|
459
481
|
label: t("neetoApiKeys.fields.expirationOptions.custom")
|
|
460
482
|
})]
|
|
461
483
|
}), expirationType === EXPIRATION_OPTIONS.CUSTOM && /*#__PURE__*/jsx(DatePicker, {
|
|
484
|
+
dataTestId: "expiry-date",
|
|
462
485
|
defaultValue: expiresAt,
|
|
463
486
|
disabledDate: function disabledDate(date) {
|
|
464
487
|
return date < NEXT_DAY;
|
|
@@ -520,6 +543,147 @@ var Create = function Create(_ref) {
|
|
|
520
543
|
});
|
|
521
544
|
};
|
|
522
545
|
|
|
546
|
+
var _excluded = ["label", "children"];
|
|
547
|
+
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; }
|
|
548
|
+
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), true).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; }
|
|
549
|
+
var Item = function Item(_ref) {
|
|
550
|
+
var label = _ref.label,
|
|
551
|
+
children = _ref.children,
|
|
552
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
553
|
+
return /*#__PURE__*/jsxs("div", _objectSpread$3(_objectSpread$3({
|
|
554
|
+
className: "space-y-1"
|
|
555
|
+
}, otherProps), {}, {
|
|
556
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
557
|
+
color: "muted",
|
|
558
|
+
variant: "body3",
|
|
559
|
+
weight: "medium",
|
|
560
|
+
children: label
|
|
561
|
+
}), /*#__PURE__*/jsx("div", {
|
|
562
|
+
className: "min-w-0",
|
|
563
|
+
children: children
|
|
564
|
+
})]
|
|
565
|
+
}));
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
var Details = function Details(_ref) {
|
|
569
|
+
var apiKey = _ref.apiKey,
|
|
570
|
+
_ref$isZapierAvailabl = _ref.isZapierAvailable,
|
|
571
|
+
isZapierAvailable = _ref$isZapierAvailabl === void 0 ? false : _ref$isZapierAvailabl,
|
|
572
|
+
onClose = _ref.onClose,
|
|
573
|
+
_onEdit = _ref.onEdit,
|
|
574
|
+
_onDelete = _ref.onDelete;
|
|
575
|
+
var _useTranslation = useTranslation(),
|
|
576
|
+
t = _useTranslation.t;
|
|
577
|
+
var label = apiKey.label,
|
|
578
|
+
token = apiKey.token,
|
|
579
|
+
notes = apiKey.notes,
|
|
580
|
+
type = apiKey.type,
|
|
581
|
+
expiresAt = apiKey.expiresAt,
|
|
582
|
+
createdAt = apiKey.createdAt,
|
|
583
|
+
creator = apiKey.creator;
|
|
584
|
+
return /*#__PURE__*/jsxs(Sheet, {
|
|
585
|
+
onClose: onClose,
|
|
586
|
+
isOpen: isNotEmpty(apiKey),
|
|
587
|
+
children: [/*#__PURE__*/jsx(Sheet.Header, {
|
|
588
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
589
|
+
className: "flex items-center gap-x-2",
|
|
590
|
+
children: [/*#__PURE__*/jsx(Sheet.Title, {
|
|
591
|
+
className: "min-w-0 break-words",
|
|
592
|
+
"data-testid": "api-key-details-title",
|
|
593
|
+
children: label
|
|
594
|
+
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
595
|
+
menuItems: getMenuItems({
|
|
596
|
+
onEdit: function onEdit() {
|
|
597
|
+
return _onEdit(apiKey);
|
|
598
|
+
},
|
|
599
|
+
onDelete: function onDelete() {
|
|
600
|
+
return _onDelete(apiKey);
|
|
601
|
+
},
|
|
602
|
+
isEditVisible: type === API_KEY_TYPES.GENERAL
|
|
603
|
+
})
|
|
604
|
+
})]
|
|
605
|
+
})
|
|
606
|
+
}), /*#__PURE__*/jsx(Sheet.Body, {
|
|
607
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
608
|
+
className: "w-full space-y-6",
|
|
609
|
+
children: [/*#__PURE__*/jsx(Item, {
|
|
610
|
+
label: t("neetoApiKeys.table.headers.token"),
|
|
611
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
612
|
+
className: "flex items-center gap-x-3",
|
|
613
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
614
|
+
className: "min-w-0 truncate",
|
|
615
|
+
"data-testid": "api-key-details-token",
|
|
616
|
+
variant: "body2",
|
|
617
|
+
children: isPresent(token) && partlyHideToken(token)
|
|
618
|
+
}), /*#__PURE__*/jsx(CopyToClipboardButton, {
|
|
619
|
+
value: token
|
|
620
|
+
})]
|
|
621
|
+
})
|
|
622
|
+
}), isZapierAvailable && /*#__PURE__*/jsx(Item, {
|
|
623
|
+
label: t("neetoApiKeys.table.headers.type"),
|
|
624
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
625
|
+
variant: "body2",
|
|
626
|
+
children: humanize(type !== null && type !== void 0 ? type : "")
|
|
627
|
+
})
|
|
628
|
+
}), /*#__PURE__*/jsx(Item, {
|
|
629
|
+
label: t("neetoApiKeys.table.headers.status"),
|
|
630
|
+
children: isExpired(expiresAt) ? /*#__PURE__*/jsx(Badge, {
|
|
631
|
+
variant: "amber",
|
|
632
|
+
children: t("neetoApiKeys.tags.expired")
|
|
633
|
+
}) : /*#__PURE__*/jsx(Badge, {
|
|
634
|
+
variant: "green",
|
|
635
|
+
children: t("neetoApiKeys.tags.active")
|
|
636
|
+
})
|
|
637
|
+
}), isPresent(notes) && /*#__PURE__*/jsx(Item, {
|
|
638
|
+
label: t("neetoApiKeys.table.headers.notes"),
|
|
639
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
640
|
+
className: "whitespace-pre-wrap break-words",
|
|
641
|
+
"data-testid": "api-key-details-notes",
|
|
642
|
+
variant: "body2",
|
|
643
|
+
children: notes
|
|
644
|
+
})
|
|
645
|
+
}), /*#__PURE__*/jsx(Item, {
|
|
646
|
+
label: t("neetoApiKeys.table.headers.expiresAt"),
|
|
647
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
648
|
+
"data-testid": "api-key-details-expires-at",
|
|
649
|
+
variant: "body2",
|
|
650
|
+
children: isPresent(expiresAt) ? formatExpiry(expiresAt) : t("neetoApiKeys.common.never")
|
|
651
|
+
})
|
|
652
|
+
}), /*#__PURE__*/jsx(Item, {
|
|
653
|
+
label: t("neetoApiKeys.table.headers.createdAt"),
|
|
654
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
655
|
+
"data-testid": "api-key-details-created-at",
|
|
656
|
+
variant: "body2",
|
|
657
|
+
children: isPresent(createdAt) && dateFormat.dateTime(createdAt)
|
|
658
|
+
})
|
|
659
|
+
}), /*#__PURE__*/jsx(Item, {
|
|
660
|
+
label: t("neetoApiKeys.fields.createdBy"),
|
|
661
|
+
children: isPresent(creator) ? /*#__PURE__*/jsxs("div", {
|
|
662
|
+
className: "flex items-center gap-x-2",
|
|
663
|
+
"data-testid": "api-key-details-created-by",
|
|
664
|
+
children: [/*#__PURE__*/jsx(Avatar, {
|
|
665
|
+
size: "sm",
|
|
666
|
+
user: {
|
|
667
|
+
name: creator.name,
|
|
668
|
+
imageUrl: creator.profileImageUrl
|
|
669
|
+
}
|
|
670
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
671
|
+
className: "min-w-0 truncate",
|
|
672
|
+
variant: "body2",
|
|
673
|
+
children: creator.name
|
|
674
|
+
})]
|
|
675
|
+
}) : /*#__PURE__*/jsx(Typography, {
|
|
676
|
+
color: "muted",
|
|
677
|
+
"data-testid": "api-key-details-created-by",
|
|
678
|
+
variant: "body2",
|
|
679
|
+
children: t("neetoApiKeys.common.notAvailable")
|
|
680
|
+
})
|
|
681
|
+
})]
|
|
682
|
+
})
|
|
683
|
+
})]
|
|
684
|
+
});
|
|
685
|
+
};
|
|
686
|
+
|
|
523
687
|
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; }
|
|
524
688
|
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), true).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; }
|
|
525
689
|
var Update = function Update(_ref) {
|
|
@@ -574,6 +738,7 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
574
738
|
var Table = function Table(_ref) {
|
|
575
739
|
var handleDelete = _ref.handleDelete,
|
|
576
740
|
handleEdit = _ref.handleEdit,
|
|
741
|
+
handleView = _ref.handleView,
|
|
577
742
|
currentPage = _ref.currentPage,
|
|
578
743
|
setIsCreatePaneOpen = _ref.setIsCreatePaneOpen,
|
|
579
744
|
_ref$noDataProps = _ref.noDataProps,
|
|
@@ -589,9 +754,10 @@ var Table = function Table(_ref) {
|
|
|
589
754
|
return buildColumnData({
|
|
590
755
|
handleDelete: handleDelete,
|
|
591
756
|
handleEdit: handleEdit,
|
|
757
|
+
handleView: handleView,
|
|
592
758
|
isZapierAvailable: isZapierAvailable
|
|
593
759
|
});
|
|
594
|
-
}, [handleDelete, handleEdit, isZapierAvailable]);
|
|
760
|
+
}, [handleDelete, handleEdit, handleView, isZapierAvailable]);
|
|
595
761
|
if (isLoading) {
|
|
596
762
|
return /*#__PURE__*/jsx("div", {
|
|
597
763
|
className: "flex h-full w-full items-center justify-center",
|
|
@@ -629,8 +795,8 @@ var Table = function Table(_ref) {
|
|
|
629
795
|
children: /*#__PURE__*/jsx(DataTable, {
|
|
630
796
|
columns: columns,
|
|
631
797
|
currentPage: currentPage,
|
|
632
|
-
data: (data === null || data === void 0 ? void 0 : data.apiKeys) || [],
|
|
633
798
|
enableColumnFreeze: true,
|
|
799
|
+
data: (data === null || data === void 0 ? void 0 : data.apiKeys) || [],
|
|
634
800
|
loading: isFetching,
|
|
635
801
|
pageSize: DEFAULT_PAGE_SIZE,
|
|
636
802
|
totalCount: data === null || data === void 0 ? void 0 : data.totalCount
|
|
@@ -656,10 +822,14 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
656
822
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
657
823
|
apiKeyToBeEdited = _useState4[0],
|
|
658
824
|
setApiKeyToBeEdited = _useState4[1];
|
|
659
|
-
var _useState5 = useState(
|
|
825
|
+
var _useState5 = useState({}),
|
|
660
826
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
661
|
-
|
|
662
|
-
|
|
827
|
+
apiKeyToBeViewed = _useState6[0],
|
|
828
|
+
setApiKeyToBeViewed = _useState6[1];
|
|
829
|
+
var _useState7 = useState(false),
|
|
830
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
831
|
+
isCreatePaneOpen = _useState8[0],
|
|
832
|
+
setIsCreatePaneOpen = _useState8[1];
|
|
663
833
|
var _useTranslation = useTranslation(),
|
|
664
834
|
t = _useTranslation.t;
|
|
665
835
|
var _useQueryParams = useQueryParams(),
|
|
@@ -700,6 +870,14 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
700
870
|
var showFilters = isPresent(debouncedSearchTerm) || (data === null || data === void 0 ? void 0 : data.totalCount) > 0;
|
|
701
871
|
var _data$isZapierAvailab = data.isZapierAvailable,
|
|
702
872
|
isZapierAvailable = _data$isZapierAvailab === void 0 ? false : _data$isZapierAvailab;
|
|
873
|
+
var handleEditFromDetails = function handleEditFromDetails(apiKey) {
|
|
874
|
+
setApiKeyToBeViewed({});
|
|
875
|
+
setApiKeyToBeEdited(apiKey);
|
|
876
|
+
};
|
|
877
|
+
var handleDeleteFromDetails = function handleDeleteFromDetails(apiKey) {
|
|
878
|
+
setApiKeyToBeViewed({});
|
|
879
|
+
setApiKeyToBeDeleted(apiKey);
|
|
880
|
+
};
|
|
703
881
|
return /*#__PURE__*/jsxs("div", {
|
|
704
882
|
className: "flex h-full w-full flex-col",
|
|
705
883
|
children: [/*#__PURE__*/jsx(Header, _objectSpread({
|
|
@@ -748,7 +926,8 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
748
926
|
noDataProps: noDataProps,
|
|
749
927
|
setIsCreatePaneOpen: setIsCreatePaneOpen,
|
|
750
928
|
handleDelete: setApiKeyToBeDeleted,
|
|
751
|
-
handleEdit: setApiKeyToBeEdited
|
|
929
|
+
handleEdit: setApiKeyToBeEdited,
|
|
930
|
+
handleView: setApiKeyToBeViewed
|
|
752
931
|
}), /*#__PURE__*/jsx(Alert, {
|
|
753
932
|
isOpen: isNotEmpty(apiKeyToBeDeleted),
|
|
754
933
|
isSubmitting: isDeleting,
|
|
@@ -781,6 +960,14 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
781
960
|
onClose: function onClose() {
|
|
782
961
|
return setIsCreatePaneOpen(false);
|
|
783
962
|
}
|
|
963
|
+
}), /*#__PURE__*/jsx(Details, {
|
|
964
|
+
isZapierAvailable: isZapierAvailable,
|
|
965
|
+
apiKey: apiKeyToBeViewed,
|
|
966
|
+
onClose: function onClose() {
|
|
967
|
+
return setApiKeyToBeViewed({});
|
|
968
|
+
},
|
|
969
|
+
onDelete: handleDeleteFromDetails,
|
|
970
|
+
onEdit: handleEditFromDetails
|
|
784
971
|
}), /*#__PURE__*/jsx(Update, {
|
|
785
972
|
helpDocUrl: helpDocUrl,
|
|
786
973
|
apiKey: apiKeyToBeEdited,
|