@bigbinary/neeto-molecules 1.1.28 → 1.1.30

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.
@@ -1,17 +1,17 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useState } from 'react';
3
- import { useMutationWithInvalidation, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/react-utils';
4
- import { Check, Close, MenuVertical, MenuHorizontal, Warning } from '@bigbinary/neeto-icons';
5
- import { Typography, Button as Button$1, Dropdown, Tooltip, Alert, Checkbox, Callout } from '@bigbinary/neetoui';
6
- import { useTranslation, Trans } from 'react-i18next';
3
+ import { Delete, Warning } from '@bigbinary/neeto-icons';
4
+ import { Typography, Button, Callout, Alert } from '@bigbinary/neetoui';
5
+ import { Input, Select, Form, BlockNavigation, Checkbox, Button as Button$1 } from '@bigbinary/neetoui/formik';
6
+ import { Trans, useTranslation } from 'react-i18next';
7
+ import { FieldArray } from 'formik';
8
+ import { withT, useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
7
9
  import { t as t$1 } from 'i18next';
8
- import { Form, Input, Select, Button } from '@bigbinary/neetoui/formik';
9
- import { isNil, isNotNil, assoc, mergeRight } from 'ramda';
10
+ import * as yup from 'yup';
11
+ import { Validator, IPv4, IPv6 } from 'ip-num';
12
+ import { isNil, isNotNil, assoc } from 'ramda';
10
13
  import { useQuery } from 'react-query';
11
14
  import axios from 'axios';
12
- import { Validator, IPv4, IPv6 } from 'ip-num';
13
- import * as yup from 'yup';
14
- import { truncate } from '@bigbinary/neeto-cist';
15
15
 
16
16
  function _arrayWithHoles(arr) {
17
17
  if (Array.isArray(arr)) return arr;
@@ -163,11 +163,11 @@ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r
163
163
  var css = ".neeto-molecules-pageloader__wrapper{height:100%;position:relative;width:100%}.neeto-molecules-pageloader__wrapper .neeto-molecules-pageloader{height:100%;left:0;position:absolute;top:0;width:100%}.neeto-molecules-pageloader__wrapper .neeto-molecules-pageloader__content{height:66px;margin-bottom:16px;overflow:hidden;padding:8px;position:relative;width:66px}.neeto-molecules-pageloader__wrapper .neeto-molecules-pageloader__text{color:rgb(var(--neeto-ui-gray-800));font-size:1.25rem;line-height:1.75rem;margin-bottom:4rem;text-align:center}.neeto-molecules-pageloader__spinner{display:flex;gap:2px;height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.neeto-molecules-pageloader__spinner>div{animation:neeto-ui-stretch-delay 1.2s ease-in-out infinite;background-color:#fff;border-radius:2px;display:inline-flex;height:100%;width:2px}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect2{animation-delay:-1.1s}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect3{animation-delay:-1s}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect4{animation-delay:-.9s}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect5{animation-delay:-.8s}@keyframes neeto-ui-stretch-delay{0%,40%,to{transform:scaleY(.4);-webkit-transform:scaleY(.4)}20%{transform:scaleY(1);-webkit-transform:scaleY(1)}}";
164
164
  n(css,{});
165
165
 
166
- var _excluded$3 = ["text"];
166
+ var _excluded = ["text"];
167
167
  var PageLoader = function PageLoader(_ref) {
168
168
  var _ref$text = _ref.text,
169
169
  text = _ref$text === void 0 ? "" : _ref$text,
170
- otherProps = _objectWithoutProperties(_ref, _excluded$3);
170
+ otherProps = _objectWithoutProperties(_ref, _excluded);
171
171
  return /*#__PURE__*/React__default.createElement("div", _extends$1({
172
172
  className: "neeto-molecules-pageloader__wrapper"
173
173
  }, otherProps), /*#__PURE__*/React__default.createElement("div", {
@@ -196,74 +196,14 @@ var PageLoader = function PageLoader(_ref) {
196
196
  };
197
197
  var PageLoader$1 = /*#__PURE__*/React__default.memo(PageLoader);
198
198
 
199
- var IP_RESTRICTIONS_ENGINE_BASE_URL = "ip_restrictions/api/v1";
200
- var QUERY_KEYS = {
201
- IP_RESTRICTION: "IP_RESTRICTION",
202
- ALLOWED_IP_RANGES: "ALLOWED_IP_RANGES",
203
- CURRENT_IP: "CURRENT_IP"
204
- };
205
- var TRUNCATE_LENGTH = 18;
206
- var ADDRESS_TYPE_SELECT_OPTIONS = [{
207
- label: t$1("neetoMolecules.ipRestriction.ipv4"),
208
- value: "ipv4"
209
- }, {
210
- label: t$1("neetoMolecules.ipRestriction.ipv6"),
211
- value: "ipv6"
212
- }];
213
- var INITIAL_VALUES = {
214
- ipStart: "",
215
- ipEnd: "",
216
- addressType: ADDRESS_TYPE_SELECT_OPTIONS[0].value
217
- };
218
-
219
- var allowedIpRangesUrl = "".concat(IP_RESTRICTIONS_ENGINE_BASE_URL, "/allowed_ips");
220
- var fetch = function fetch() {
221
- return axios.get(allowedIpRangesUrl);
222
- };
223
- var create = function create(payload) {
224
- return axios.post(allowedIpRangesUrl, {
225
- allowedIpRange: payload
226
- });
227
- };
228
- var destroy = function destroy(id) {
229
- return axios["delete"]("".concat(allowedIpRangesUrl, "/").concat(id));
230
- };
231
- var update$1 = function update(_ref) {
232
- var id = _ref.id,
233
- payload = _ref.payload;
234
- return axios.patch("".concat(allowedIpRangesUrl, "/").concat(id), {
235
- allowedIpRange: payload
236
- });
237
- };
238
- var allowedIpRangesApi = {
239
- fetch: fetch,
240
- create: create,
241
- destroy: destroy,
242
- update: update$1
243
- };
244
-
245
- var ALLOWED_IP_RANGES = QUERY_KEYS.ALLOWED_IP_RANGES;
246
- var useFetchAllowedIpRanges = function useFetchAllowedIpRanges() {
247
- return useQuery([ALLOWED_IP_RANGES], function () {
248
- return allowedIpRangesApi.fetch();
249
- });
250
- };
251
- var useCreateAllowedIpRanges = function useCreateAllowedIpRanges() {
252
- return useMutationWithInvalidation(allowedIpRangesApi.create, {
253
- keysToInvalidate: [ALLOWED_IP_RANGES]
254
- });
255
- };
256
- var useDestroyAllowedIpRanges = function useDestroyAllowedIpRanges() {
257
- return useMutationWithInvalidation(allowedIpRangesApi.destroy, {
258
- keysToInvalidate: [ALLOWED_IP_RANGES]
259
- });
260
- };
261
- var useUpdateAllowedIpRanges = function useUpdateAllowedIpRanges() {
262
- return useMutationWithInvalidation(allowedIpRangesApi.update, {
263
- keysToInvalidate: [ALLOWED_IP_RANGES]
264
- });
199
+ // We need to apply a transformation for the label. Hence disabling this lint warning.
200
+ // eslint-disable-next-line @bigbinary/neeto/use-functions-and-hooks-from-neeto-commons-frontend
201
+ var toLabelAndValue = function toLabelAndValue(value) {
202
+ return {
203
+ label: humanizeIpAddressFormat(value),
204
+ value: value
205
+ };
265
206
  };
266
-
267
207
  var isValidIPv4String = function isValidIPv4String(ip) {
268
208
  return isNotNil(ip) && Validator.isValidIPv4String(ip)[0];
269
209
  };
@@ -338,337 +278,95 @@ var humanizeIpAddressFormat = function humanizeIpAddressFormat(addressFormat) {
338
278
  };
339
279
  return addressFormats[addressFormat];
340
280
  };
341
- var buildInitialValue = function buildInitialValue(values) {
342
- var labelAndValue = {
343
- label: humanizeIpAddressFormat(values.addressType),
344
- value: values.addressType
281
+ var buildInitialValue = function buildInitialValue(isIpRestrictionEnabled, allowedIpRanges) {
282
+ return {
283
+ ipRestriction: isIpRestrictionEnabled,
284
+ allowedIpRanges: buildAllowedIpRangesFormData(allowedIpRanges)
345
285
  };
346
- return assoc("addressType", labelAndValue, values);
347
286
  };
348
-
349
- var FormRow = function FormRow(_ref) {
350
- var data = _ref.data,
351
- isAddNew = _ref.isAddNew,
352
- onCollapse = _ref.onCollapse;
353
- var _useCreateAllowedIpRa = useCreateAllowedIpRanges(),
354
- createAllowedIpRange = _useCreateAllowedIpRa.mutate;
355
- var _useUpdateAllowedIpRa = useUpdateAllowedIpRanges(),
356
- updateAllowedIpRange = _useUpdateAllowedIpRa.mutate;
357
- var _useTranslation = useTranslation(),
358
- t = _useTranslation.t;
359
- var handleSubmit = function handleSubmit(values) {
360
- var payload = assoc("addressType", values.addressType.value, values);
361
- if (isAddNew) {
362
- createAllowedIpRange(payload);
363
- } else {
364
- updateAllowedIpRange({
365
- id: data.id,
366
- payload: payload
367
- });
368
- }
369
- onCollapse();
370
- };
371
- return /*#__PURE__*/React__default.createElement(Form, {
372
- "data-cy": "allowed-ip-range-form",
373
- formikProps: {
374
- initialValues: buildInitialValue(data),
375
- validationSchema: getIpRestrictionValidationSchema(),
376
- onSubmit: handleSubmit
377
- }
378
- }, function (_ref2) {
379
- var isSubmitting = _ref2.isSubmitting;
380
- return /*#__PURE__*/React__default.createElement("div", {
381
- className: "neeto-ui-bg-white neeto-ui-rounded-lg grid grid-cols-12 gap-4 p-3"
382
- }, /*#__PURE__*/React__default.createElement(Input, {
383
- autoFocus: true,
384
- className: "col-span-4 text-left",
385
- "data-cy": "ip-start-text-field",
386
- name: "ipStart",
387
- placeholder: t("neetoMolecules.ipRestriction.ipStart")
388
- }), /*#__PURE__*/React__default.createElement(Input, {
389
- className: "col-span-4 text-left",
390
- "data-cy": "ip-end-text-field",
391
- name: "ipEnd",
392
- placeholder: t("neetoMolecules.ipRestriction.ipEnd")
393
- }), /*#__PURE__*/React__default.createElement(Select, {
394
- className: "col-span-2 text-left",
395
- name: "addressType",
396
- options: ADDRESS_TYPE_SELECT_OPTIONS
397
- }), /*#__PURE__*/React__default.createElement("div", {
398
- className: "col-span-2 flex items-start justify-center gap-1"
399
- }, /*#__PURE__*/React__default.createElement(Button, {
400
- "data-cy": "save-changes-button",
401
- "data-testid": "save-changes-button",
402
- disabled: isSubmitting,
403
- icon: Check,
404
- style: "text",
405
- tooltipProps: {
406
- content: "Submit",
407
- position: "top"
408
- },
409
- type: "submit"
410
- }), /*#__PURE__*/React__default.createElement(Button$1, {
411
- "data-cy": "ip-cancel-button",
412
- icon: Close,
413
- style: "text",
414
- type: "reset",
415
- tooltipProps: {
416
- content: t("neetoMolecules.common.actions.cancel"),
417
- position: "top"
418
- },
419
- onClick: onCollapse
420
- })));
287
+ var buildAllowedIpRangesFormData = function buildAllowedIpRangesFormData(allowedIpRanges) {
288
+ return allowedIpRanges.map(function (allowedIpRange) {
289
+ return assoc("addressType", toLabelAndValue(allowedIpRange.addressType), allowedIpRange);
421
290
  });
422
291
  };
423
-
424
- function _typeof(obj) {
425
- "@babel/helpers - typeof";
426
-
427
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
428
- return typeof obj;
429
- } : function (obj) {
430
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
431
- }, _typeof(obj);
432
- }
433
-
434
- function _toPrimitive(input, hint) {
435
- if (_typeof(input) !== "object" || input === null) return input;
436
- var prim = input[Symbol.toPrimitive];
437
- if (prim !== undefined) {
438
- var res = prim.call(input, hint || "default");
439
- if (_typeof(res) !== "object") return res;
440
- throw new TypeError("@@toPrimitive must return a primitive value.");
441
- }
442
- return (hint === "string" ? String : Number)(input);
443
- }
444
-
445
- function _toPropertyKey(arg) {
446
- var key = _toPrimitive(arg, "string");
447
- return _typeof(key) === "symbol" ? key : String(key);
448
- }
449
-
450
- function _defineProperty(obj, key, value) {
451
- key = _toPropertyKey(key);
452
- if (key in obj) {
453
- Object.defineProperty(obj, key, {
454
- value: value,
455
- enumerable: true,
456
- configurable: true,
457
- writable: true
458
- });
459
- } else {
460
- obj[key] = value;
461
- }
462
- return obj;
463
- }
464
-
465
- var MENU_ITEM_TYPES = {
466
- menuItem: "menuItem",
467
- divider: "divider"
468
- };
469
- var DEFAULT_TOOLTIP_PROPS = {
470
- disabled: true,
471
- position: "bottom"
472
- };
473
-
474
- var _excluded$2 = ["label", "key"],
475
- _excluded2 = ["isVisible", "key"];
476
- var MenuItem$1 = Dropdown.MenuItem,
477
- Menu$1 = Dropdown.Menu;
478
- var Submenu = function Submenu(_ref) {
479
- var label = _ref.label,
480
- key = _ref.key,
481
- menuItemProps = _objectWithoutProperties(_ref, _excluded$2);
482
- return /*#__PURE__*/React__default.createElement(Dropdown, _extends$1({
483
- customTarget: /*#__PURE__*/React__default.createElement(MenuItem$1.Button, null, label),
484
- key: key,
485
- position: "left",
486
- trigger: "hover"
487
- }, menuItemProps.dropdownProps), /*#__PURE__*/React__default.createElement(Menu$1, null, menuItemProps.menuItems.map(function (_ref2) {
488
- var _ref2$isVisible = _ref2.isVisible,
489
- isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
490
- key = _ref2.key,
491
- menuItemProps = _objectWithoutProperties(_ref2, _excluded2);
492
- if (!isVisible) return null;
493
- return /*#__PURE__*/React__default.createElement(MoreDropdownMenuItem, _extends$1({
494
- key: key
495
- }, menuItemProps));
496
- })));
292
+ var buildIpRestrictionPayload = function buildIpRestrictionPayload(values) {
293
+ var allowedIpRangesWithTransformedAddressType = values.allowedIpRanges.map(function (allowedIpRange) {
294
+ return assoc("addressType", allowedIpRange.addressType.value, allowedIpRange);
295
+ });
296
+ return {
297
+ isIpRestrictionEnabled: values.ipRestriction,
298
+ allowedIpRanges: allowedIpRangesWithTransformedAddressType
299
+ };
497
300
  };
498
301
 
499
- var _excluded$1 = ["onClick", "label", "type", "hasSubItems"];
500
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
501
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
502
- var MenuItem = Dropdown.MenuItem,
503
- Divider = Dropdown.Divider;
504
- var MoreDropdownMenuItem = function MoreDropdownMenuItem(_ref) {
505
- var onClick = _ref.onClick,
506
- label = _ref.label,
507
- _ref$type = _ref.type,
508
- type = _ref$type === void 0 ? MENU_ITEM_TYPES.menuItem : _ref$type,
509
- _ref$hasSubItems = _ref.hasSubItems,
510
- hasSubItems = _ref$hasSubItems === void 0 ? false : _ref$hasSubItems,
511
- menuItemProps = _objectWithoutProperties(_ref, _excluded$1);
512
- if (type === MENU_ITEM_TYPES.divider) {
513
- return /*#__PURE__*/React__default.createElement(Divider, null);
514
- }
515
- if (hasSubItems) {
516
- return /*#__PURE__*/React__default.createElement(Submenu, _objectSpread$1({
517
- label: label
518
- }, menuItemProps));
519
- }
520
- return /*#__PURE__*/React__default.createElement(MenuItem.Button, _objectSpread$1({
521
- onClick: onClick
522
- }, menuItemProps), label);
302
+ var IP_RESTRICTIONS_ENGINE_BASE_URL = "ip_restrictions/api/v1";
303
+ var QUERY_KEYS = {
304
+ IP_RESTRICTION: "IP_RESTRICTION",
305
+ ALLOWED_IP_RANGES: "ALLOWED_IP_RANGES",
306
+ CURRENT_IP: "CURRENT_IP"
523
307
  };
524
-
525
- var _excluded = ["isVisible", "key"];
526
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
527
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
528
- var Menu = Dropdown.Menu;
529
- var MoreDropdown = function MoreDropdown(_ref) {
530
- var _ref$dropdownButtonPr = _ref.dropdownButtonProps,
531
- dropdownButtonProps = _ref$dropdownButtonPr === void 0 ? {} : _ref$dropdownButtonPr,
532
- _ref$isVertical = _ref.isVertical,
533
- isVertical = _ref$isVertical === void 0 ? false : _ref$isVertical,
534
- _ref$isDisabled = _ref.isDisabled,
535
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
536
- _ref$dropdownProps = _ref.dropdownProps,
537
- dropdownProps = _ref$dropdownProps === void 0 ? {} : _ref$dropdownProps,
538
- menuTopChildren = _ref.menuTopChildren,
539
- menuBottomChildren = _ref.menuBottomChildren,
540
- _ref$menuItems = _ref.menuItems,
541
- menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems;
542
- var tooltipProps = mergeRight(DEFAULT_TOOLTIP_PROPS, dropdownButtonProps.tooltipProps);
543
- var targetIcon = isVertical ? MenuVertical : MenuHorizontal;
544
- var isDropdownDisabled = isDisabled || dropdownProps.disabled;
545
- if (isDropdownDisabled && !tooltipProps.disabled) {
546
- return /*#__PURE__*/React__default.createElement(Tooltip, tooltipProps, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(Button$1, _extends$1({
547
- disabled: true,
548
- "data-testid": "nui-dropdown-button",
549
- icon: targetIcon,
550
- iconPosition: "right",
551
- size: "medium",
552
- style: "text"
553
- }, dropdownButtonProps))));
554
- }
555
- return /*#__PURE__*/React__default.createElement(Dropdown, _extends$1({
556
- autoWidth: true,
557
- className: "flex",
558
- disabled: isDisabled,
559
- icon: targetIcon,
560
- buttonProps: _objectSpread({
561
- className: "min-h-0 flex-shrink-0",
562
- style: "text"
563
- }, dropdownButtonProps)
564
- }, dropdownProps), /*#__PURE__*/React__default.createElement(Menu, null, menuTopChildren, menuItems.map(function (_ref2) {
565
- var _ref2$isVisible = _ref2.isVisible,
566
- isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
567
- key = _ref2.key,
568
- menuItemProps = _objectWithoutProperties(_ref2, _excluded);
569
- if (!isVisible) return null;
570
- return /*#__PURE__*/React__default.createElement(MoreDropdownMenuItem, _extends$1({
571
- key: key
572
- }, menuItemProps));
573
- }), menuBottomChildren));
308
+ var ADDRESS_TYPE_SELECT_OPTIONS = [{
309
+ label: t$1("neetoMolecules.ipRestriction.ipv4"),
310
+ value: "ipv4"
311
+ }, {
312
+ label: t$1("neetoMolecules.ipRestriction.ipv6"),
313
+ value: "ipv6"
314
+ }];
315
+ ({
316
+ ipStart: "",
317
+ ipEnd: "",
318
+ addressType: ADDRESS_TYPE_SELECT_OPTIONS[0].value
319
+ });
320
+ var VALIDATION_SCHEMA = yup.object().shape({
321
+ ipRestriction: yup["boolean"](),
322
+ allowedIpRanges: yup.array().of(getIpRestrictionValidationSchema())
323
+ });
324
+ var NEW_ALLOWED_IP_RANGE = {
325
+ ipStart: "",
326
+ ipEnd: "",
327
+ addressType: null,
328
+ createdAt: new Date().toISOString()
574
329
  };
575
330
 
576
- var Row = function Row(_ref) {
577
- var data = _ref.data,
578
- setEditingRow = _ref.setEditingRow;
579
- var _useState = useState(false),
580
- _useState2 = _slicedToArray(_useState, 2),
581
- isDeleteIpRangeAlertOpen = _useState2[0],
582
- setIsDeleteIpRangeAlertOpen = _useState2[1];
583
- var _useDestroyAllowedIpR = useDestroyAllowedIpRanges(),
584
- destroyAllowedIpRange = _useDestroyAllowedIpR.mutate;
585
- var _useTranslation = useTranslation(),
586
- t = _useTranslation.t;
587
- var handleDelete = function handleDelete() {
588
- destroyAllowedIpRange(data.id);
589
- setIsDeleteIpRangeAlertOpen(false);
590
- };
331
+ var AllowedIpRange = withT(function (_ref) {
332
+ var t = _ref.t,
333
+ index = _ref.index,
334
+ arrayHelpers = _ref.arrayHelpers;
591
335
  return /*#__PURE__*/React__default.createElement("div", {
592
- className: "neeto-ui-bg-white neeto-ui-rounded-lg grid grid-cols-12 items-center gap-4 p-3",
593
- "data-cy": "ip-range-row"
594
- }, /*#__PURE__*/React__default.createElement(Tooltip, {
595
- content: data.ipStart,
596
- disabled: data.ipStart.length < TRUNCATE_LENGTH,
597
- position: "top"
598
- }, /*#__PURE__*/React__default.createElement(Typography, {
599
- className: "col-span-4",
600
- "data-cy": "ip-range-start-value",
601
- style: "body2"
602
- }, truncate(data.ipStart, TRUNCATE_LENGTH))), /*#__PURE__*/React__default.createElement(Tooltip, {
603
- content: data.ipEnd,
604
- disabled: data.ipEnd.length < TRUNCATE_LENGTH,
605
- position: "top"
606
- }, /*#__PURE__*/React__default.createElement(Typography, {
607
- className: "col-span-4",
608
- "data-cy": "ip-range-end-value",
609
- style: "body2"
610
- }, truncate(data.ipEnd, TRUNCATE_LENGTH))), /*#__PURE__*/React__default.createElement(Typography, {
611
- className: "col-span-2",
612
- "data-cy": "ip-range-end-value",
613
- style: "body2"
614
- }, humanizeIpAddressFormat(data.addressType)), /*#__PURE__*/React__default.createElement("div", {
336
+ className: "neeto-ui-bg-white neeto-ui-rounded-lg grid grid-cols-12 gap-4 p-3"
337
+ }, /*#__PURE__*/React__default.createElement(Input, {
338
+ className: "col-span-4 text-left",
339
+ "data-cy": "ip-start-text-field",
340
+ name: "allowedIpRanges.".concat(index, ".ipStart"),
341
+ placeholder: t("neetoMolecules.ipRestriction.ipStart")
342
+ }), /*#__PURE__*/React__default.createElement(Input, {
343
+ className: "col-span-4 text-left",
344
+ "data-cy": "ip-end-text-field",
345
+ name: "allowedIpRanges.".concat(index, ".ipEnd"),
346
+ placeholder: t("neetoMolecules.ipRestriction.ipEnd")
347
+ }), /*#__PURE__*/React__default.createElement(Select, {
348
+ className: "col-span-2 text-left",
349
+ "data-testid": "address-type-select-field",
350
+ name: "allowedIpRanges.".concat(index, ".addressType"),
351
+ options: ADDRESS_TYPE_SELECT_OPTIONS
352
+ }), /*#__PURE__*/React__default.createElement("div", {
615
353
  className: "col-span-2 flex justify-center"
616
- }, /*#__PURE__*/React__default.createElement(MoreDropdown, {
617
- dropdownButtonProps: {
618
- "data-testid": "ip-range-actions-dropdown"
619
- },
620
- dropdownProps: {
621
- position: "bottom-end"
622
- },
623
- menuItems: [{
624
- "data-cy": "ip-range-edit-button",
625
- key: "ip-range-edit-button",
626
- label: t("neetoMolecules.common.actions.edit"),
627
- onClick: function onClick() {
628
- return setEditingRow(data.id);
629
- }
630
- }, {
631
- "data-cy": "ip-range-delete-button",
632
- key: "ip-range-delete-button",
633
- label: t("neetoMolecules.common.actions.delete"),
634
- onClick: function onClick() {
635
- return setIsDeleteIpRangeAlertOpen(true);
636
- }
637
- }]
638
- }), /*#__PURE__*/React__default.createElement(Alert, {
639
- isOpen: isDeleteIpRangeAlertOpen,
640
- submitButtonLabel: t("neetoMolecules.common.actions.delete"),
641
- message: /*#__PURE__*/React__default.createElement(Trans, {
642
- i18nKey: "neetoMolecules.ipRestriction.allowedIpRangeConfirmation",
643
- values: {
644
- ipStart: data.ipStart,
645
- ipEnd: data.ipEnd
646
- }
647
- }),
648
- title: t("neetoMolecules.common.deleteAlert.title", {
649
- entity: t("neetoMolecules.ipRestriction.allowedIpRangeConfirmationTitle")
650
- }),
651
- onClose: function onClose() {
652
- return setIsDeleteIpRangeAlertOpen(false);
354
+ }, /*#__PURE__*/React__default.createElement(Button, {
355
+ "data-testid": "allowed-ip-range-delete-btn",
356
+ icon: Delete,
357
+ style: "text",
358
+ tooltipProps: {
359
+ content: t("neetoMolecules.common.actions.discard"),
360
+ position: "top"
653
361
  },
654
- onSubmit: handleDelete
362
+ onClick: function onClick() {
363
+ return arrayHelpers.remove(index);
364
+ }
655
365
  })));
656
- };
657
- var Row$1 = /*#__PURE__*/React__default.memo(Row);
366
+ });
658
367
 
659
- var AllowedIpRanges = function AllowedIpRanges() {
660
- var _useState = useState(""),
661
- _useState2 = _slicedToArray(_useState, 2),
662
- editingRow = _useState2[0],
663
- setEditingRow = _useState2[1];
664
- var _useState3 = useState(false),
665
- _useState4 = _slicedToArray(_useState3, 2),
666
- showAddNew = _useState4[0],
667
- setShowAddNew = _useState4[1];
668
- var _useTranslation = useTranslation(),
669
- t = _useTranslation.t;
670
- var _useFetchAllowedIpRan = useFetchAllowedIpRanges(),
671
- allowedIpRanges = _useFetchAllowedIpRan.data;
368
+ var AllowedIpRanges = withT(function (_ref) {
369
+ var t = _ref.t;
672
370
  return /*#__PURE__*/React__default.createElement("div", {
673
371
  className: "space-y-6",
674
372
  "data-cy": "allowed-ip-range-container"
@@ -682,46 +380,37 @@ var AllowedIpRanges = function AllowedIpRanges() {
682
380
  }, /*#__PURE__*/React__default.createElement(Typography, {
683
381
  className: "neeto-ui-text-gray-700 col-span-4 uppercase",
684
382
  style: "h6"
685
- }, t("neetoMolecules.ipRestriction.ipStart")), /*#__PURE__*/React__default.createElement(Typography, {
383
+ }, t("neetoMolecules.ipRestriction.ipStart"), "*"), /*#__PURE__*/React__default.createElement(Typography, {
686
384
  className: "neeto-ui-text-gray-700 col-span-4 uppercase",
687
385
  style: "h6"
688
- }, t("neetoMolecules.ipRestriction.ipEnd")), /*#__PURE__*/React__default.createElement(Typography, {
386
+ }, t("neetoMolecules.ipRestriction.ipEnd"), "*"), /*#__PURE__*/React__default.createElement(Typography, {
689
387
  className: "neeto-ui-text-gray-700 col-span-2 uppercase",
690
388
  style: "h6"
691
- }, t("neetoMolecules.ipRestriction.type")), /*#__PURE__*/React__default.createElement(Typography, {
389
+ }, t("neetoMolecules.ipRestriction.type"), "*"), /*#__PURE__*/React__default.createElement(Typography, {
692
390
  className: "neeto-ui-text-gray-700 col-span-2 text-center uppercase",
693
391
  style: "h6"
694
392
  }, t("neetoMolecules.ipRestriction.actions"))), /*#__PURE__*/React__default.createElement("div", {
695
393
  className: "w-full space-y-2"
696
- }, allowedIpRanges === null || allowedIpRanges === void 0 ? void 0 : allowedIpRanges.map(function (allowedIpRange) {
697
- return editingRow === allowedIpRange.id ? /*#__PURE__*/React__default.createElement(FormRow, {
698
- data: allowedIpRange,
699
- isAddNew: false,
700
- key: allowedIpRange.id,
701
- onCollapse: function onCollapse() {
702
- return setEditingRow("");
394
+ }, /*#__PURE__*/React__default.createElement(FieldArray, {
395
+ name: "allowedIpRanges"
396
+ }, function (arrayHelpers) {
397
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, arrayHelpers.form.values.allowedIpRanges.map(function (allowedIpRange, index) {
398
+ return /*#__PURE__*/React__default.createElement(AllowedIpRange, {
399
+ allowedIpRange: allowedIpRange,
400
+ arrayHelpers: arrayHelpers,
401
+ index: index,
402
+ key: allowedIpRange.createdAt
403
+ });
404
+ }), /*#__PURE__*/React__default.createElement(Button, {
405
+ "data-cy": "add-allowed-ip-range-button",
406
+ label: t("neetoMolecules.ipRestriction.addNew"),
407
+ style: "link",
408
+ onClick: function onClick() {
409
+ return arrayHelpers.push(NEW_ALLOWED_IP_RANGE);
703
410
  }
704
- }) : /*#__PURE__*/React__default.createElement(Row$1, {
705
- data: allowedIpRange,
706
- key: allowedIpRange.id,
707
- setEditingRow: setEditingRow
708
- });
709
- }), showAddNew && /*#__PURE__*/React__default.createElement(FormRow, {
710
- isAddNew: true,
711
- data: INITIAL_VALUES,
712
- onCollapse: function onCollapse() {
713
- return setShowAddNew(false);
714
- }
715
- })), /*#__PURE__*/React__default.createElement(Button$1, {
716
- "data-cy": "add-allowed-ip-range-button",
717
- disabled: showAddNew,
718
- label: t("neetoMolecules.ipRestriction.addNew"),
719
- style: "link",
720
- onClick: function onClick() {
721
- return setShowAddNew(true);
722
- }
723
- })));
724
- };
411
+ }));
412
+ }))));
413
+ });
725
414
  var AllowedIpRanges$1 = /*#__PURE__*/React__default.memo(AllowedIpRanges);
726
415
 
727
416
  var show$1 = function show(params) {
@@ -744,25 +433,51 @@ var CurrentIp = function CurrentIp() {
744
433
  var _useShowCurrentIp = useShowCurrentIp(),
745
434
  data = _useShowCurrentIp.data,
746
435
  isLoading = _useShowCurrentIp.isLoading;
747
- var _useTranslation = useTranslation(),
748
- t = _useTranslation.t;
749
436
  return /*#__PURE__*/React__default.createElement("div", {
750
437
  className: "flex flex-wrap items-baseline gap-1",
751
438
  "data-cy": "current-ip-container"
752
- }, /*#__PURE__*/React__default.createElement(Typography, {
753
- "data-cy": "current-ip-heading",
754
- style: "body2"
755
- }, t("neetoMolecules.ipRestriction.currentIpTitle")), /*#__PURE__*/React__default.createElement(Typography, {
756
- "data-cy": "current-ip-value",
757
- style: "h4",
758
- weight: "semibold"
759
- }, isLoading ? "..." : data.ip), /*#__PURE__*/React__default.createElement(Typography, {
760
- "data-cy": "current-ip-description",
761
- style: "body2"
762
- }, t("neetoMolecules.ipRestriction.currentIpDescription")));
439
+ }, /*#__PURE__*/React__default.createElement(Typography, null, /*#__PURE__*/React__default.createElement(Trans, {
440
+ i18nKey: "neetoMolecules.ipRestriction.currentIpMessage",
441
+ values: {
442
+ ip: isLoading ? "..." : data.ip
443
+ }
444
+ })));
763
445
  };
764
446
  var CurrentIp$1 = /*#__PURE__*/React__default.memo(CurrentIp);
765
447
 
448
+ var allowedIpRangesUrl = "".concat(IP_RESTRICTIONS_ENGINE_BASE_URL, "/allowed_ips");
449
+ var fetch = function fetch() {
450
+ return axios.get(allowedIpRangesUrl);
451
+ };
452
+ var create = function create(payload) {
453
+ return axios.post(allowedIpRangesUrl, {
454
+ allowedIpRange: payload
455
+ });
456
+ };
457
+ var destroy = function destroy(id) {
458
+ return axios["delete"]("".concat(allowedIpRangesUrl, "/").concat(id));
459
+ };
460
+ var update$1 = function update(_ref) {
461
+ var id = _ref.id,
462
+ payload = _ref.payload;
463
+ return axios.patch("".concat(allowedIpRangesUrl, "/").concat(id), {
464
+ allowedIpRange: payload
465
+ });
466
+ };
467
+ var allowedIpRangesApi = {
468
+ fetch: fetch,
469
+ create: create,
470
+ destroy: destroy,
471
+ update: update$1
472
+ };
473
+
474
+ var ALLOWED_IP_RANGES$1 = QUERY_KEYS.ALLOWED_IP_RANGES;
475
+ var useFetchAllowedIpRanges = function useFetchAllowedIpRanges(options) {
476
+ return useQuery([ALLOWED_IP_RANGES$1], function () {
477
+ return allowedIpRangesApi.fetch();
478
+ }, options);
479
+ };
480
+
766
481
  var ipRestrictionUrl = "".concat(IP_RESTRICTIONS_ENGINE_BASE_URL, "/ip_restriction");
767
482
  var update = function update(params) {
768
483
  return axios.patch(ipRestrictionUrl, {
@@ -777,7 +492,8 @@ var ipRestrictionApi = {
777
492
  show: show
778
493
  };
779
494
 
780
- var IP_RESTRICTION = QUERY_KEYS.IP_RESTRICTION;
495
+ var IP_RESTRICTION = QUERY_KEYS.IP_RESTRICTION,
496
+ ALLOWED_IP_RANGES = QUERY_KEYS.ALLOWED_IP_RANGES;
781
497
  var useShowIpRestriction = function useShowIpRestriction() {
782
498
  return useQuery([IP_RESTRICTION], function () {
783
499
  return ipRestrictionApi.show();
@@ -785,101 +501,141 @@ var useShowIpRestriction = function useShowIpRestriction() {
785
501
  };
786
502
  var useUpdateIpRestriction = function useUpdateIpRestriction() {
787
503
  return useMutationWithInvalidation(ipRestrictionApi.update, {
788
- keysToInvalidate: [IP_RESTRICTION]
504
+ keysToInvalidate: [IP_RESTRICTION, ALLOWED_IP_RANGES]
789
505
  });
790
506
  };
791
507
 
792
508
  var IpRestriction = function IpRestriction() {
793
509
  var _useTranslation = useTranslation(),
794
510
  t = _useTranslation.t;
795
- var _useShowIpRestriction = useShowIpRestriction(),
796
- data = _useShowIpRestriction.data,
797
- isFetching = _useShowIpRestriction.isLoading;
798
511
  var _useState = useState(false),
799
512
  _useState2 = _slicedToArray(_useState, 2),
800
513
  isAlertOpen = _useState2[0],
801
514
  setIsAlertOpen = _useState2[1];
802
- var _useStateWithDependen = useStateWithDependency((data === null || data === void 0 ? void 0 : data.isIpRestrictionEnabled) || false, [data]),
803
- _useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
804
- isIpRestrictionVisible = _useStateWithDependen2[0],
805
- setIsIpRestrictionVisible = _useStateWithDependen2[1];
515
+ var _useShowIpRestriction = useShowIpRestriction(),
516
+ _useShowIpRestriction2 = _useShowIpRestriction.data,
517
+ _useShowIpRestriction3 = _useShowIpRestriction2 === void 0 ? {} : _useShowIpRestriction2,
518
+ isIpRestrictionEnabled = _useShowIpRestriction3.isIpRestrictionEnabled,
519
+ isFetchingIpRestriction = _useShowIpRestriction.isLoading;
520
+ var _useFetchAllowedIpRan = useFetchAllowedIpRanges({
521
+ enabled: isIpRestrictionEnabled
522
+ }),
523
+ allowedIpRanges = _useFetchAllowedIpRan.data,
524
+ isFetchingAllowedIpRanges = _useFetchAllowedIpRan.isLoading,
525
+ isRefetching = _useFetchAllowedIpRan.isRefetching;
806
526
  var _useUpdateIpRestricti = useUpdateIpRestriction(),
807
527
  updateIpRestriction = _useUpdateIpRestricti.mutate,
808
528
  isUpdating = _useUpdateIpRestricti.isLoading;
809
- if (isFetching) {
529
+ if (isFetchingIpRestriction || isFetchingAllowedIpRanges || isRefetching) {
810
530
  return /*#__PURE__*/React__default.createElement("div", {
811
531
  className: "h-screen"
812
532
  }, /*#__PURE__*/React__default.createElement(PageLoader$1, null));
813
533
  }
814
- var updateIpRestrictionStatus = function updateIpRestrictionStatus() {
815
- return updateIpRestriction({
816
- isIpRestrictionEnabled: isIpRestrictionVisible
817
- }, {
534
+ var handleSubmit = function handleSubmit(values, formikBag) {
535
+ if (values.ipRestriction) setIsAlertOpen(true);else handleUpdateIpRestriction(values, formikBag);
536
+ };
537
+ var handleCloseAlert = function handleCloseAlert(setSubmitting) {
538
+ setIsAlertOpen(false);
539
+ setSubmitting(false);
540
+ };
541
+ var handleUpdateIpRestriction = function handleUpdateIpRestriction(values, _ref) {
542
+ var setSubmitting = _ref.setSubmitting,
543
+ resetForm = _ref.resetForm;
544
+ updateIpRestriction(buildIpRestrictionPayload(values), {
818
545
  onSuccess: function onSuccess() {
819
- return setIsAlertOpen(false);
546
+ setIsAlertOpen(false);
547
+ setSubmitting(false);
548
+ resetForm({
549
+ values: values
550
+ });
551
+ },
552
+ onError: function onError() {
553
+ setIsAlertOpen(false);
554
+ setSubmitting(false);
820
555
  }
821
556
  });
822
557
  };
823
- var handleOnChange = function handleOnChange() {
824
- if (data.isIpRestrictionEnabled) {
825
- updateIpRestriction({
826
- isIpRestrictionEnabled: false
827
- }, {
828
- onSuccess: function onSuccess() {
829
- return setIsIpRestrictionVisible(false);
830
- }
831
- });
832
- } else {
833
- setIsIpRestrictionVisible(function (previousState) {
834
- return !previousState;
835
- });
836
- }
837
- };
838
- return /*#__PURE__*/React__default.createElement("div", {
839
- className: "neeto-ui-bg-white neeto-ui-border-gray-200 neeto-ui-rounded-lg mx-auto mb-4 w-full overflow-hidden border sm:max-w-screen-sm md:max-w-screen-md lg:max-w-3xl",
840
- "data-cy": "ip-restrictions-card"
841
- }, /*#__PURE__*/React__default.createElement("div", {
842
- className: "space-y-2 p-6"
843
- }, /*#__PURE__*/React__default.createElement(Checkbox, {
844
- checked: isIpRestrictionVisible,
845
- className: "flex-grow-0",
846
- "data-cy": "enable-ip-restriction-checkbox",
847
- disabled: isFetching || isUpdating,
848
- label: /*#__PURE__*/React__default.createElement(Typography, {
849
- style: "h3"
850
- }, t("neetoMolecules.ipRestriction.switchLabel")),
851
- onChange: handleOnChange
852
- }), /*#__PURE__*/React__default.createElement(Typography, {
853
- "data-cy": "ip-restriction-description",
854
- style: "body2"
855
- }, t("neetoMolecules.ipRestriction.description"))), isIpRestrictionVisible && /*#__PURE__*/React__default.createElement("div", {
856
- className: "neeto-ui-bg-gray-100 w-full space-y-6 p-6"
857
- }, /*#__PURE__*/React__default.createElement(CurrentIp$1, null), /*#__PURE__*/React__default.createElement(AllowedIpRanges$1, null), /*#__PURE__*/React__default.createElement(Callout, {
858
- icon: Warning,
859
- style: "warning"
860
- }, /*#__PURE__*/React__default.createElement("div", {
861
- className: "leading-2 block whitespace-pre-wrap py-1"
862
- }, /*#__PURE__*/React__default.createElement(Trans, {
863
- i18nKey: "neetoMolecules.ipRestriction.warningMessage"
864
- }))), /*#__PURE__*/React__default.createElement(Button$1, {
865
- "data-cy": "ip-restriction-save-changes",
866
- label: t("neetoMolecules.common.actions.saveChanges"),
867
- onClick: function onClick() {
868
- return setIsAlertOpen(true);
558
+ return /*#__PURE__*/React__default.createElement(Form, {
559
+ className: "mx-auto mb-4 w-full sm:max-w-screen-sm md:max-w-screen-md lg:max-w-3xl",
560
+ formikProps: {
561
+ initialValues: buildInitialValue(isIpRestrictionEnabled, allowedIpRanges),
562
+ validationSchema: VALIDATION_SCHEMA,
563
+ validateOnBlur: true,
564
+ enableReinitialize: true,
565
+ onSubmit: handleSubmit
869
566
  }
870
- }), /*#__PURE__*/React__default.createElement(Alert, {
871
- isOpen: isAlertOpen,
872
- isSubmitting: isUpdating,
873
- title: t("neetoMolecules.ipRestriction.enableAlert.title"),
874
- message: /*#__PURE__*/React__default.createElement(Trans, {
875
- i18nKey: "neetoMolecules.ipRestriction.enableAlert.message"
876
- }),
877
- submitButtonLabel: t("neetoMolecules.ipRestriction.enableAlert.submitButtonLabel"),
878
- onClose: function onClose() {
879
- return setIsAlertOpen(false);
880
- },
881
- onSubmit: updateIpRestrictionStatus
882
- })));
567
+ }, function (_ref2) {
568
+ var values = _ref2.values,
569
+ dirty = _ref2.dirty,
570
+ setFieldValue = _ref2.setFieldValue,
571
+ resetForm = _ref2.resetForm,
572
+ setSubmitting = _ref2.setSubmitting;
573
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(BlockNavigation, null), /*#__PURE__*/React__default.createElement("div", {
574
+ className: "neeto-ui-bg-white neeto-ui-border-gray-200 neeto-ui-rounded-lg mx-auto mb-4 w-full overflow-hidden border sm:max-w-screen-sm md:max-w-screen-md lg:max-w-3xl",
575
+ "data-cy": "ip-restrictions-card"
576
+ }, /*#__PURE__*/React__default.createElement("div", {
577
+ className: "space-y-2 p-6"
578
+ }, /*#__PURE__*/React__default.createElement(Checkbox, {
579
+ checked: values.ipRestriction,
580
+ className: "flex-grow-0",
581
+ "data-cy": "enable-ip-restriction-checkbox",
582
+ disabled: isFetchingIpRestriction || isUpdating,
583
+ name: "ipRestriction",
584
+ label: /*#__PURE__*/React__default.createElement(Typography, {
585
+ style: "h3"
586
+ }, t("neetoMolecules.ipRestriction.switchLabel")),
587
+ onChange: function onChange() {
588
+ return setFieldValue("ipRestriction", !values.ipRestriction);
589
+ }
590
+ }), /*#__PURE__*/React__default.createElement(Typography, {
591
+ "data-cy": "ip-restriction-description",
592
+ style: "body2"
593
+ }, t("neetoMolecules.ipRestriction.description"))), values.ipRestriction && /*#__PURE__*/React__default.createElement("div", {
594
+ className: "neeto-ui-bg-gray-100 w-full space-y-6 p-6"
595
+ }, /*#__PURE__*/React__default.createElement(CurrentIp$1, null), /*#__PURE__*/React__default.createElement(AllowedIpRanges$1, null), /*#__PURE__*/React__default.createElement(Callout, {
596
+ icon: Warning,
597
+ style: "warning"
598
+ }, /*#__PURE__*/React__default.createElement("div", {
599
+ className: "leading-2 block whitespace-pre-wrap py-1"
600
+ }, /*#__PURE__*/React__default.createElement(Trans, {
601
+ i18nKey: "neetoMolecules.ipRestriction.warningMessage"
602
+ }))))), /*#__PURE__*/React__default.createElement("div", {
603
+ className: "align-center flex justify-between"
604
+ }, dirty && /*#__PURE__*/React__default.createElement(Typography, {
605
+ className: "neeto-ui-text-error-500"
606
+ }, t("neetoMolecules.ipRestriction.validations.unsavedChanges")), /*#__PURE__*/React__default.createElement("div", {
607
+ className: "ml-auto flex justify-between"
608
+ }, /*#__PURE__*/React__default.createElement(Button, {
609
+ className: "mr-2",
610
+ disabled: !dirty,
611
+ label: t("neetoMolecules.common.actions.reset"),
612
+ style: "secondary",
613
+ type: "reset",
614
+ onClick: resetForm
615
+ }), /*#__PURE__*/React__default.createElement(Button$1, {
616
+ "data-cy": "ip-restriction-save-changes",
617
+ "data-testid": "save-changes-button",
618
+ isLoading: isUpdating,
619
+ type: "submit"
620
+ }, t("neetoMolecules.common.actions.saveChanges")))), /*#__PURE__*/React__default.createElement(Alert, {
621
+ isOpen: isAlertOpen,
622
+ isSubmitting: isUpdating,
623
+ title: t("neetoMolecules.ipRestriction.enableAlert.title"),
624
+ message: /*#__PURE__*/React__default.createElement(Trans, {
625
+ i18nKey: "neetoMolecules.ipRestriction.enableAlert.message"
626
+ }),
627
+ submitButtonLabel: t("neetoMolecules.ipRestriction.enableAlert.submitButtonLabel"),
628
+ onClose: function onClose() {
629
+ return handleCloseAlert(setSubmitting);
630
+ },
631
+ onSubmit: function onSubmit() {
632
+ return handleUpdateIpRestriction(values, {
633
+ setSubmitting: setSubmitting,
634
+ resetForm: resetForm
635
+ });
636
+ }
637
+ }));
638
+ });
883
639
  };
884
640
  var index = /*#__PURE__*/React__default.memo(IpRestriction);
885
641