@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/cjs/v2/ApiKeys.js
CHANGED
|
@@ -23,6 +23,7 @@ var initializers = require('@bigbinary/neeto-commons-frontend/v2/initializers');
|
|
|
23
23
|
var CopyToClipboardButton = require('@bigbinary/neeto-molecules/v2/CopyToClipboardButton');
|
|
24
24
|
var MoreDropdown = require('@bigbinary/neeto-molecules/v2/MoreDropdown');
|
|
25
25
|
var jsxRuntime = require('react/jsx-runtime');
|
|
26
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
26
27
|
var lucideReact = require('lucide-react');
|
|
27
28
|
require('@bigbinary/neeto-commons-frontend/constants');
|
|
28
29
|
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
@@ -102,6 +103,9 @@ var MASKED_TOKEN_LENGTH = 20;
|
|
|
102
103
|
var isInPast = function isInPast(date) {
|
|
103
104
|
return utils.dayjs(date).isBefore(utils.dayjs());
|
|
104
105
|
};
|
|
106
|
+
var isExpired = function isExpired(expiresAt) {
|
|
107
|
+
return neetoCist.isPresent(expiresAt) && isInPast(expiresAt);
|
|
108
|
+
};
|
|
105
109
|
var partlyHideToken = function partlyHideToken(key) {
|
|
106
110
|
var prefixMatch = key.match(/^([A-Z]+-)/);
|
|
107
111
|
if (prefixMatch) {
|
|
@@ -135,6 +139,7 @@ var getMenuItems = function getMenuItems(_ref) {
|
|
|
135
139
|
var buildColumnData = function buildColumnData(_ref2) {
|
|
136
140
|
var handleDelete = _ref2.handleDelete,
|
|
137
141
|
handleEdit = _ref2.handleEdit,
|
|
142
|
+
handleView = _ref2.handleView,
|
|
138
143
|
isZapierAvailable = _ref2.isZapierAvailable;
|
|
139
144
|
var columns = [{
|
|
140
145
|
id: "label",
|
|
@@ -148,11 +153,14 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
148
153
|
var apiKey = row.original;
|
|
149
154
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
150
155
|
className: "flex items-center justify-between gap-x-3",
|
|
151
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.
|
|
152
|
-
className: "min-w-0
|
|
156
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
157
|
+
className: "min-w-0 shrink justify-start text-left [&>span]:min-w-0 [&>span>span]:truncate",
|
|
153
158
|
"data-testid": "api-keys-label-field",
|
|
154
159
|
title: label,
|
|
155
|
-
variant: "
|
|
160
|
+
variant: "link",
|
|
161
|
+
onClick: function onClick() {
|
|
162
|
+
return handleView(apiKey);
|
|
163
|
+
},
|
|
156
164
|
children: label
|
|
157
165
|
}), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
|
|
158
166
|
menuItems: getMenuItems({
|
|
@@ -213,7 +221,7 @@ var buildColumnData = function buildColumnData(_ref2) {
|
|
|
213
221
|
cell: function cell(_ref6) {
|
|
214
222
|
var row = _ref6.row;
|
|
215
223
|
var expiresAt = row.original.expiresAt;
|
|
216
|
-
return
|
|
224
|
+
return isExpired(expiresAt) ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
217
225
|
variant: "amber",
|
|
218
226
|
children: i18next.t("neetoApiKeys.tags.expired")
|
|
219
227
|
}) : /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
@@ -276,7 +284,8 @@ var getStartOfTime = function getStartOfTime(time, unit) {
|
|
|
276
284
|
};
|
|
277
285
|
|
|
278
286
|
var DatePicker = function DatePicker(_ref) {
|
|
279
|
-
var
|
|
287
|
+
var dataTestId = _ref.dataTestId,
|
|
288
|
+
defaultValue = _ref.defaultValue,
|
|
280
289
|
disabledDate = _ref.disabledDate,
|
|
281
290
|
label = _ref.label,
|
|
282
291
|
placeholder = _ref.placeholder,
|
|
@@ -293,6 +302,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
293
302
|
setFieldValue = _ref2$form.setFieldValue,
|
|
294
303
|
setFieldTouched = _ref2$form.setFieldTouched;
|
|
295
304
|
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DatePicker, {
|
|
305
|
+
dataTestId: dataTestId,
|
|
296
306
|
defaultValue: defaultValue,
|
|
297
307
|
disabled: disabled,
|
|
298
308
|
disabledDate: disabledDate,
|
|
@@ -363,9 +373,9 @@ var getExpirationDate = function getExpirationDate(type) {
|
|
|
363
373
|
}
|
|
364
374
|
};
|
|
365
375
|
|
|
366
|
-
function ownKeys$
|
|
367
|
-
function _objectSpread$
|
|
368
|
-
var Item = formik$1.RadioGroup.Item;
|
|
376
|
+
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; }
|
|
377
|
+
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; }
|
|
378
|
+
var Item$1 = formik$1.RadioGroup.Item;
|
|
369
379
|
var Form = function Form(_ref) {
|
|
370
380
|
var _ref$initialValues = _ref.initialValues,
|
|
371
381
|
initialValues = _ref$initialValues === void 0 ? INITIAL_VALUES : _ref$initialValues,
|
|
@@ -379,7 +389,7 @@ var Form = function Form(_ref) {
|
|
|
379
389
|
isZapierAvailable = _ref$isZapierAvailabl === void 0 ? false : _ref$isZapierAvailabl;
|
|
380
390
|
var _useTranslation = reactI18next.useTranslation(),
|
|
381
391
|
t = _useTranslation.t;
|
|
382
|
-
var formInitialValues = _objectSpread$
|
|
392
|
+
var formInitialValues = _objectSpread$4(_objectSpread$4({}, initialValues), {}, {
|
|
383
393
|
expirationType: getInitialExpirationType({
|
|
384
394
|
isEdit: isEdit,
|
|
385
395
|
values: initialValues
|
|
@@ -411,6 +421,7 @@ var Form = function Form(_ref) {
|
|
|
411
421
|
children: [/*#__PURE__*/jsxRuntime.jsx(formik$1.Input, {
|
|
412
422
|
autoFocus: true,
|
|
413
423
|
required: true,
|
|
424
|
+
dataTestId: "name",
|
|
414
425
|
label: t("neetoApiKeys.fields.label"),
|
|
415
426
|
name: "label",
|
|
416
427
|
placeholder: t("neetoApiKeys.placeholders.label"),
|
|
@@ -418,24 +429,29 @@ var Form = function Form(_ref) {
|
|
|
418
429
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
419
430
|
className: "space-y-4",
|
|
420
431
|
children: [!isEdit && isZapierAvailable && /*#__PURE__*/jsxRuntime.jsxs(formik$1.RadioGroup, {
|
|
432
|
+
dataTestId: "type",
|
|
421
433
|
label: t("neetoApiKeys.common.type"),
|
|
422
434
|
name: "type",
|
|
423
435
|
orientation: "vertical",
|
|
424
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
436
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
437
|
+
dataTestId: "general",
|
|
425
438
|
label: t("neetoApiKeys.common.general"),
|
|
426
439
|
name: "type",
|
|
427
440
|
value: API_KEY_TYPES.GENERAL
|
|
428
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
441
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
442
|
+
dataTestId: "zapier",
|
|
429
443
|
label: t("neetoApiKeys.common.zapier"),
|
|
430
444
|
name: "type",
|
|
431
445
|
value: API_KEY_TYPES.ZAPIER
|
|
432
446
|
})]
|
|
433
447
|
}), type === API_KEY_TYPES.GENERAL && /*#__PURE__*/jsxRuntime.jsx(formik$1.Textarea, {
|
|
448
|
+
dataTestId: "notes",
|
|
434
449
|
label: t("neetoApiKeys.fields.notes"),
|
|
435
450
|
name: "notes",
|
|
436
451
|
placeholder: t("neetoApiKeys.placeholders.notes")
|
|
437
452
|
}), type === API_KEY_TYPES.GENERAL && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
438
453
|
children: [/*#__PURE__*/jsxRuntime.jsxs(formik$1.RadioGroup, {
|
|
454
|
+
dataTestId: "token-expiration",
|
|
439
455
|
label: t("neetoApiKeys.fields.tokenExpiration"),
|
|
440
456
|
name: "expirationType",
|
|
441
457
|
orientation: "vertical",
|
|
@@ -454,32 +470,39 @@ var Form = function Form(_ref) {
|
|
|
454
470
|
type: expirationType
|
|
455
471
|
});
|
|
456
472
|
},
|
|
457
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
473
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
474
|
+
dataTestId: "7-days",
|
|
458
475
|
name: "expirationType",
|
|
459
476
|
value: EXPIRATION_OPTIONS.SEVEN_DAYS,
|
|
460
477
|
label: t("neetoApiKeys.fields.expirationOptions.sevenDays")
|
|
461
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
478
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
479
|
+
dataTestId: "30-days",
|
|
462
480
|
name: "expirationType",
|
|
463
481
|
value: EXPIRATION_OPTIONS.THIRTY_DAYS,
|
|
464
482
|
label: t("neetoApiKeys.fields.expirationOptions.thirtyDays")
|
|
465
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
483
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
484
|
+
dataTestId: "90-days",
|
|
466
485
|
name: "expirationType",
|
|
467
486
|
value: EXPIRATION_OPTIONS.NINETY_DAYS,
|
|
468
487
|
label: t("neetoApiKeys.fields.expirationOptions.ninetyDays")
|
|
469
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
488
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
489
|
+
dataTestId: "1-year",
|
|
470
490
|
name: "expirationType",
|
|
471
491
|
value: EXPIRATION_OPTIONS.ONE_YEAR,
|
|
472
492
|
label: t("neetoApiKeys.fields.expirationOptions.oneYear")
|
|
473
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
493
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
494
|
+
dataTestId: "no-expiration",
|
|
474
495
|
label: t("neetoApiKeys.fields.expirationOptions.never"),
|
|
475
496
|
name: "expirationType",
|
|
476
497
|
value: EXPIRATION_OPTIONS.NEVER
|
|
477
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
498
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item$1, {
|
|
499
|
+
dataTestId: "custom",
|
|
478
500
|
name: "expirationType",
|
|
479
501
|
value: EXPIRATION_OPTIONS.CUSTOM,
|
|
480
502
|
label: t("neetoApiKeys.fields.expirationOptions.custom")
|
|
481
503
|
})]
|
|
482
504
|
}), expirationType === EXPIRATION_OPTIONS.CUSTOM && /*#__PURE__*/jsxRuntime.jsx(DatePicker, {
|
|
505
|
+
dataTestId: "expiry-date",
|
|
483
506
|
defaultValue: expiresAt,
|
|
484
507
|
disabledDate: function disabledDate(date) {
|
|
485
508
|
return date < NEXT_DAY;
|
|
@@ -541,6 +564,147 @@ var Create = function Create(_ref) {
|
|
|
541
564
|
});
|
|
542
565
|
};
|
|
543
566
|
|
|
567
|
+
var _excluded = ["label", "children"];
|
|
568
|
+
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; }
|
|
569
|
+
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; }
|
|
570
|
+
var Item = function Item(_ref) {
|
|
571
|
+
var label = _ref.label,
|
|
572
|
+
children = _ref.children,
|
|
573
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
574
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$3(_objectSpread$3({
|
|
575
|
+
className: "space-y-1"
|
|
576
|
+
}, otherProps), {}, {
|
|
577
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
578
|
+
color: "muted",
|
|
579
|
+
variant: "body3",
|
|
580
|
+
weight: "medium",
|
|
581
|
+
children: label
|
|
582
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
583
|
+
className: "min-w-0",
|
|
584
|
+
children: children
|
|
585
|
+
})]
|
|
586
|
+
}));
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
var Details = function Details(_ref) {
|
|
590
|
+
var apiKey = _ref.apiKey,
|
|
591
|
+
_ref$isZapierAvailabl = _ref.isZapierAvailable,
|
|
592
|
+
isZapierAvailable = _ref$isZapierAvailabl === void 0 ? false : _ref$isZapierAvailabl,
|
|
593
|
+
onClose = _ref.onClose,
|
|
594
|
+
_onEdit = _ref.onEdit,
|
|
595
|
+
_onDelete = _ref.onDelete;
|
|
596
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
597
|
+
t = _useTranslation.t;
|
|
598
|
+
var label = apiKey.label,
|
|
599
|
+
token = apiKey.token,
|
|
600
|
+
notes = apiKey.notes,
|
|
601
|
+
type = apiKey.type,
|
|
602
|
+
expiresAt = apiKey.expiresAt,
|
|
603
|
+
createdAt = apiKey.createdAt,
|
|
604
|
+
creator = apiKey.creator;
|
|
605
|
+
return /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Sheet, {
|
|
606
|
+
onClose: onClose,
|
|
607
|
+
isOpen: neetoCist.isNotEmpty(apiKey),
|
|
608
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Header, {
|
|
609
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
610
|
+
className: "flex items-center gap-x-2",
|
|
611
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Title, {
|
|
612
|
+
className: "min-w-0 break-words",
|
|
613
|
+
"data-testid": "api-key-details-title",
|
|
614
|
+
children: label
|
|
615
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
|
|
616
|
+
menuItems: getMenuItems({
|
|
617
|
+
onEdit: function onEdit() {
|
|
618
|
+
return _onEdit(apiKey);
|
|
619
|
+
},
|
|
620
|
+
onDelete: function onDelete() {
|
|
621
|
+
return _onDelete(apiKey);
|
|
622
|
+
},
|
|
623
|
+
isEditVisible: type === API_KEY_TYPES.GENERAL
|
|
624
|
+
})
|
|
625
|
+
})]
|
|
626
|
+
})
|
|
627
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Body, {
|
|
628
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
629
|
+
className: "w-full space-y-6",
|
|
630
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
631
|
+
label: t("neetoApiKeys.table.headers.token"),
|
|
632
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
633
|
+
className: "flex items-center gap-x-3",
|
|
634
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
635
|
+
className: "min-w-0 truncate",
|
|
636
|
+
"data-testid": "api-key-details-token",
|
|
637
|
+
variant: "body2",
|
|
638
|
+
children: neetoCist.isPresent(token) && partlyHideToken(token)
|
|
639
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
|
|
640
|
+
value: token
|
|
641
|
+
})]
|
|
642
|
+
})
|
|
643
|
+
}), isZapierAvailable && /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
644
|
+
label: t("neetoApiKeys.table.headers.type"),
|
|
645
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
646
|
+
variant: "body2",
|
|
647
|
+
children: neetoCist.humanize(type !== null && type !== void 0 ? type : "")
|
|
648
|
+
})
|
|
649
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
650
|
+
label: t("neetoApiKeys.table.headers.status"),
|
|
651
|
+
children: isExpired(expiresAt) ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
652
|
+
variant: "amber",
|
|
653
|
+
children: t("neetoApiKeys.tags.expired")
|
|
654
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
655
|
+
variant: "green",
|
|
656
|
+
children: t("neetoApiKeys.tags.active")
|
|
657
|
+
})
|
|
658
|
+
}), neetoCist.isPresent(notes) && /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
659
|
+
label: t("neetoApiKeys.table.headers.notes"),
|
|
660
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
661
|
+
className: "whitespace-pre-wrap break-words",
|
|
662
|
+
"data-testid": "api-key-details-notes",
|
|
663
|
+
variant: "body2",
|
|
664
|
+
children: notes
|
|
665
|
+
})
|
|
666
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
667
|
+
label: t("neetoApiKeys.table.headers.expiresAt"),
|
|
668
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
669
|
+
"data-testid": "api-key-details-expires-at",
|
|
670
|
+
variant: "body2",
|
|
671
|
+
children: neetoCist.isPresent(expiresAt) ? formatExpiry(expiresAt) : t("neetoApiKeys.common.never")
|
|
672
|
+
})
|
|
673
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
674
|
+
label: t("neetoApiKeys.table.headers.createdAt"),
|
|
675
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
676
|
+
"data-testid": "api-key-details-created-at",
|
|
677
|
+
variant: "body2",
|
|
678
|
+
children: neetoCist.isPresent(createdAt) && utils.dateFormat.dateTime(createdAt)
|
|
679
|
+
})
|
|
680
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
681
|
+
label: t("neetoApiKeys.fields.createdBy"),
|
|
682
|
+
children: neetoCist.isPresent(creator) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
683
|
+
className: "flex items-center gap-x-2",
|
|
684
|
+
"data-testid": "api-key-details-created-by",
|
|
685
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Avatar, {
|
|
686
|
+
size: "sm",
|
|
687
|
+
user: {
|
|
688
|
+
name: creator.name,
|
|
689
|
+
imageUrl: creator.profileImageUrl
|
|
690
|
+
}
|
|
691
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
692
|
+
className: "min-w-0 truncate",
|
|
693
|
+
variant: "body2",
|
|
694
|
+
children: creator.name
|
|
695
|
+
})]
|
|
696
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
697
|
+
color: "muted",
|
|
698
|
+
"data-testid": "api-key-details-created-by",
|
|
699
|
+
variant: "body2",
|
|
700
|
+
children: t("neetoApiKeys.common.notAvailable")
|
|
701
|
+
})
|
|
702
|
+
})]
|
|
703
|
+
})
|
|
704
|
+
})]
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
|
|
544
708
|
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; }
|
|
545
709
|
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; }
|
|
546
710
|
var Update = function Update(_ref) {
|
|
@@ -595,6 +759,7 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
595
759
|
var Table = function Table(_ref) {
|
|
596
760
|
var handleDelete = _ref.handleDelete,
|
|
597
761
|
handleEdit = _ref.handleEdit,
|
|
762
|
+
handleView = _ref.handleView,
|
|
598
763
|
currentPage = _ref.currentPage,
|
|
599
764
|
setIsCreatePaneOpen = _ref.setIsCreatePaneOpen,
|
|
600
765
|
_ref$noDataProps = _ref.noDataProps,
|
|
@@ -610,9 +775,10 @@ var Table = function Table(_ref) {
|
|
|
610
775
|
return buildColumnData({
|
|
611
776
|
handleDelete: handleDelete,
|
|
612
777
|
handleEdit: handleEdit,
|
|
778
|
+
handleView: handleView,
|
|
613
779
|
isZapierAvailable: isZapierAvailable
|
|
614
780
|
});
|
|
615
|
-
}, [handleDelete, handleEdit, isZapierAvailable]);
|
|
781
|
+
}, [handleDelete, handleEdit, handleView, isZapierAvailable]);
|
|
616
782
|
if (isLoading) {
|
|
617
783
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
618
784
|
className: "flex h-full w-full items-center justify-center",
|
|
@@ -650,8 +816,8 @@ var Table = function Table(_ref) {
|
|
|
650
816
|
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DataTable, {
|
|
651
817
|
columns: columns,
|
|
652
818
|
currentPage: currentPage,
|
|
653
|
-
data: (data === null || data === void 0 ? void 0 : data.apiKeys) || [],
|
|
654
819
|
enableColumnFreeze: true,
|
|
820
|
+
data: (data === null || data === void 0 ? void 0 : data.apiKeys) || [],
|
|
655
821
|
loading: isFetching,
|
|
656
822
|
pageSize: constants.DEFAULT_PAGE_SIZE,
|
|
657
823
|
totalCount: data === null || data === void 0 ? void 0 : data.totalCount
|
|
@@ -677,10 +843,14 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
677
843
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
678
844
|
apiKeyToBeEdited = _useState4[0],
|
|
679
845
|
setApiKeyToBeEdited = _useState4[1];
|
|
680
|
-
var _useState5 = react.useState(
|
|
846
|
+
var _useState5 = react.useState({}),
|
|
681
847
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
682
|
-
|
|
683
|
-
|
|
848
|
+
apiKeyToBeViewed = _useState6[0],
|
|
849
|
+
setApiKeyToBeViewed = _useState6[1];
|
|
850
|
+
var _useState7 = react.useState(false),
|
|
851
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
852
|
+
isCreatePaneOpen = _useState8[0],
|
|
853
|
+
setIsCreatePaneOpen = _useState8[1];
|
|
684
854
|
var _useTranslation = reactI18next.useTranslation(),
|
|
685
855
|
t = _useTranslation.t;
|
|
686
856
|
var _useQueryParams = reactUtils.useQueryParams(),
|
|
@@ -721,6 +891,14 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
721
891
|
var showFilters = neetoCist.isPresent(debouncedSearchTerm) || (data === null || data === void 0 ? void 0 : data.totalCount) > 0;
|
|
722
892
|
var _data$isZapierAvailab = data.isZapierAvailable,
|
|
723
893
|
isZapierAvailable = _data$isZapierAvailab === void 0 ? false : _data$isZapierAvailab;
|
|
894
|
+
var handleEditFromDetails = function handleEditFromDetails(apiKey) {
|
|
895
|
+
setApiKeyToBeViewed({});
|
|
896
|
+
setApiKeyToBeEdited(apiKey);
|
|
897
|
+
};
|
|
898
|
+
var handleDeleteFromDetails = function handleDeleteFromDetails(apiKey) {
|
|
899
|
+
setApiKeyToBeViewed({});
|
|
900
|
+
setApiKeyToBeDeleted(apiKey);
|
|
901
|
+
};
|
|
724
902
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
725
903
|
className: "flex h-full w-full flex-col",
|
|
726
904
|
children: [/*#__PURE__*/jsxRuntime.jsx(Header, _objectSpread({
|
|
@@ -769,7 +947,8 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
769
947
|
noDataProps: noDataProps,
|
|
770
948
|
setIsCreatePaneOpen: setIsCreatePaneOpen,
|
|
771
949
|
handleDelete: setApiKeyToBeDeleted,
|
|
772
|
-
handleEdit: setApiKeyToBeEdited
|
|
950
|
+
handleEdit: setApiKeyToBeEdited,
|
|
951
|
+
handleView: setApiKeyToBeViewed
|
|
773
952
|
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Alert, {
|
|
774
953
|
isOpen: neetoCist.isNotEmpty(apiKeyToBeDeleted),
|
|
775
954
|
isSubmitting: isDeleting,
|
|
@@ -802,6 +981,14 @@ var ApiKeys = function ApiKeys(_ref) {
|
|
|
802
981
|
onClose: function onClose() {
|
|
803
982
|
return setIsCreatePaneOpen(false);
|
|
804
983
|
}
|
|
984
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Details, {
|
|
985
|
+
isZapierAvailable: isZapierAvailable,
|
|
986
|
+
apiKey: apiKeyToBeViewed,
|
|
987
|
+
onClose: function onClose() {
|
|
988
|
+
return setApiKeyToBeViewed({});
|
|
989
|
+
},
|
|
990
|
+
onDelete: handleDeleteFromDetails,
|
|
991
|
+
onEdit: handleEditFromDetails
|
|
805
992
|
}), /*#__PURE__*/jsxRuntime.jsx(Update, {
|
|
806
993
|
helpDocUrl: helpDocUrl,
|
|
807
994
|
apiKey: apiKeyToBeEdited,
|