@bigbinary/neeto-molecules 1.3.9 → 1.3.11

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.
Files changed (119) hide show
  1. package/dist/NavigationHeader.js +6 -6
  2. package/dist/NavigationHeader.js.map +1 -1
  3. package/dist/PublishBlock.js +1 -1
  4. package/dist/PublishBlock.js.map +1 -1
  5. package/dist/cjs/Breadcrumbs.js +51 -0
  6. package/dist/cjs/Breadcrumbs.js.map +1 -0
  7. package/dist/cjs/BrowserSupport.js +426 -0
  8. package/dist/cjs/BrowserSupport.js.map +1 -0
  9. package/dist/cjs/Builder.js +712 -0
  10. package/dist/cjs/Builder.js.map +1 -0
  11. package/dist/cjs/CalendarView.js +549 -0
  12. package/dist/cjs/CalendarView.js.map +1 -0
  13. package/dist/cjs/Codeblock.js +251 -0
  14. package/dist/cjs/Codeblock.js.map +1 -0
  15. package/dist/cjs/Columns.js +248 -0
  16. package/dist/cjs/Columns.js.map +1 -0
  17. package/dist/cjs/ConfirmationModal.js +120 -0
  18. package/dist/cjs/ConfirmationModal.js.map +1 -0
  19. package/dist/cjs/Container.js +1218 -0
  20. package/dist/cjs/Container.js.map +1 -0
  21. package/dist/cjs/CopyToClipboardButton.js +215 -0
  22. package/dist/cjs/CopyToClipboardButton.js.map +1 -0
  23. package/dist/cjs/CustomDomain.js +743 -0
  24. package/dist/cjs/CustomDomain.js.map +1 -0
  25. package/dist/cjs/CustomDomainDashboard.js +2348 -0
  26. package/dist/cjs/CustomDomainDashboard.js.map +1 -0
  27. package/dist/cjs/DateFormat.js +53 -0
  28. package/dist/cjs/DateFormat.js.map +1 -0
  29. package/dist/cjs/DateRangeFilter.js +236 -0
  30. package/dist/cjs/DateRangeFilter.js.map +1 -0
  31. package/dist/cjs/DocumentEditor.js +283 -0
  32. package/dist/cjs/DocumentEditor.js.map +1 -0
  33. package/dist/cjs/DownloadMobileAppCallout.js +45 -0
  34. package/dist/cjs/DownloadMobileAppCallout.js.map +1 -0
  35. package/dist/cjs/DynamicVariables.js +189 -0
  36. package/dist/cjs/DynamicVariables.js.map +1 -0
  37. package/dist/cjs/EmailForm.js +2057 -0
  38. package/dist/cjs/EmailForm.js.map +1 -0
  39. package/dist/cjs/EmailPreview.js +1319 -0
  40. package/dist/cjs/EmailPreview.js.map +1 -0
  41. package/dist/cjs/ErrorPage.js +188 -0
  42. package/dist/cjs/ErrorPage.js.map +1 -0
  43. package/dist/cjs/Header.js +179 -0
  44. package/dist/cjs/Header.js.map +1 -0
  45. package/dist/cjs/IconPicker.js +324 -0
  46. package/dist/cjs/IconPicker.js.map +1 -0
  47. package/dist/cjs/ImageWithFallback.js +188 -0
  48. package/dist/cjs/ImageWithFallback.js.map +1 -0
  49. package/dist/cjs/InlineInput.js +734 -0
  50. package/dist/cjs/InlineInput.js.map +1 -0
  51. package/dist/cjs/IntegrationCard.js +400 -0
  52. package/dist/cjs/IntegrationCard.js.map +1 -0
  53. package/dist/cjs/IntegrationDisconnectAlert.js +89 -0
  54. package/dist/cjs/IntegrationDisconnectAlert.js.map +1 -0
  55. package/dist/cjs/IntegrationWalkthroughModal.js +50 -0
  56. package/dist/cjs/IntegrationWalkthroughModal.js.map +1 -0
  57. package/dist/cjs/IpRestriction.js +683 -0
  58. package/dist/cjs/IpRestriction.js.map +1 -0
  59. package/dist/cjs/KeyboardShortcuts.js +370 -0
  60. package/dist/cjs/KeyboardShortcuts.js.map +1 -0
  61. package/dist/cjs/LoginPage.js +620 -0
  62. package/dist/cjs/LoginPage.js.map +1 -0
  63. package/dist/cjs/MenuBar.js +1468 -0
  64. package/dist/cjs/MenuBar.js.map +1 -0
  65. package/dist/cjs/Metadata.js +215 -0
  66. package/dist/cjs/Metadata.js.map +1 -0
  67. package/dist/cjs/MoreDropdown.js +210 -0
  68. package/dist/cjs/MoreDropdown.js.map +1 -0
  69. package/dist/cjs/NavigationHeader.js +867 -0
  70. package/dist/cjs/NavigationHeader.js.map +1 -0
  71. package/dist/cjs/NeetoWidget.js +1078 -0
  72. package/dist/cjs/NeetoWidget.js.map +1 -0
  73. package/dist/cjs/PageLoader.js +159 -0
  74. package/dist/cjs/PageLoader.js.map +1 -0
  75. package/dist/cjs/PhoneNumber.js +492 -0
  76. package/dist/cjs/PhoneNumber.js.map +1 -0
  77. package/dist/cjs/PublishBlock.js +165 -0
  78. package/dist/cjs/PublishBlock.js.map +1 -0
  79. package/dist/cjs/PublishYourItem.js +1239 -0
  80. package/dist/cjs/PublishYourItem.js.map +1 -0
  81. package/dist/cjs/Rename.js +625 -0
  82. package/dist/cjs/Rename.js.map +1 -0
  83. package/dist/cjs/ResponsiveDevicePicker.js +200 -0
  84. package/dist/cjs/ResponsiveDevicePicker.js.map +1 -0
  85. package/dist/cjs/Schedule.js +1130 -0
  86. package/dist/cjs/Schedule.js.map +1 -0
  87. package/dist/cjs/Scrollable.js +129 -0
  88. package/dist/cjs/Scrollable.js.map +1 -0
  89. package/dist/cjs/Search.js +217 -0
  90. package/dist/cjs/Search.js.map +1 -0
  91. package/dist/cjs/Security.js +1930 -0
  92. package/dist/cjs/Security.js.map +1 -0
  93. package/dist/cjs/SendToFields.js +353 -0
  94. package/dist/cjs/SendToFields.js.map +1 -0
  95. package/dist/cjs/Settings.js +492 -0
  96. package/dist/cjs/Settings.js.map +1 -0
  97. package/dist/cjs/ShareViaEmail.js +2005 -0
  98. package/dist/cjs/ShareViaEmail.js.map +1 -0
  99. package/dist/cjs/ShareViaLink.js +729 -0
  100. package/dist/cjs/ShareViaLink.js.map +1 -0
  101. package/dist/cjs/Sidebar.js +930 -0
  102. package/dist/cjs/Sidebar.js.map +1 -0
  103. package/dist/cjs/SubHeader.js +224 -0
  104. package/dist/cjs/SubHeader.js.map +1 -0
  105. package/dist/cjs/SuffixedInput.js +216 -0
  106. package/dist/cjs/SuffixedInput.js.map +1 -0
  107. package/dist/cjs/TableWrapper.js +33 -0
  108. package/dist/cjs/TableWrapper.js.map +1 -0
  109. package/dist/cjs/Taxonomy.js +2125 -0
  110. package/dist/cjs/Taxonomy.js.map +1 -0
  111. package/dist/cjs/ThemeSidebar.js +2052 -0
  112. package/dist/cjs/ThemeSidebar.js.map +1 -0
  113. package/dist/cjs/TimeFormat.js +55 -0
  114. package/dist/cjs/TimeFormat.js.map +1 -0
  115. package/dist/cjs/TimezoneMismatchModal.js +176 -0
  116. package/dist/cjs/TimezoneMismatchModal.js.map +1 -0
  117. package/dist/cjs/ToggleFeatureCard.js +330 -0
  118. package/dist/cjs/ToggleFeatureCard.js.map +1 -0
  119. package/package.json +2 -1
@@ -0,0 +1,743 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var neetoCist = require('@bigbinary/neeto-cist');
5
+ var constants = require('@bigbinary/neeto-commons-frontend/constants');
6
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
7
+ var neetoIcons = require('@bigbinary/neeto-icons');
8
+ var neetoui = require('@bigbinary/neetoui');
9
+ var reactI18next = require('react-i18next');
10
+ var formik = require('formik');
11
+ var formik$1 = require('@bigbinary/neetoui/formik');
12
+ var CopyToClipboardButton = require('@bigbinary/neeto-molecules/CopyToClipboardButton');
13
+ var i18next = require('i18next');
14
+ var ramda = require('ramda');
15
+ var classnames = require('classnames');
16
+ var Yup = require('yup');
17
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
18
+ var reactQuery = require('react-query');
19
+ var axios = require('axios');
20
+
21
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
+
23
+ function _interopNamespace(e) {
24
+ if (e && e.__esModule) return e;
25
+ var n = Object.create(null);
26
+ if (e) {
27
+ Object.keys(e).forEach(function (k) {
28
+ if (k !== 'default') {
29
+ var d = Object.getOwnPropertyDescriptor(e, k);
30
+ Object.defineProperty(n, k, d.get ? d : {
31
+ enumerable: true,
32
+ get: function () { return e[k]; }
33
+ });
34
+ }
35
+ });
36
+ }
37
+ n["default"] = e;
38
+ return Object.freeze(n);
39
+ }
40
+
41
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
+ var CopyToClipboardButton__default = /*#__PURE__*/_interopDefaultLegacy(CopyToClipboardButton);
43
+ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
44
+ var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
45
+ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
46
+
47
+ function _arrayWithHoles(arr) {
48
+ if (Array.isArray(arr)) return arr;
49
+ }
50
+
51
+ function _iterableToArrayLimit(r, l) {
52
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
53
+ if (null != t) {
54
+ var e,
55
+ n,
56
+ i,
57
+ u,
58
+ a = [],
59
+ f = !0,
60
+ o = !1;
61
+ try {
62
+ if (i = (t = t.call(r)).next, 0 === l) {
63
+ if (Object(t) !== t) return;
64
+ f = !1;
65
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
66
+ } catch (r) {
67
+ o = !0, n = r;
68
+ } finally {
69
+ try {
70
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
71
+ } finally {
72
+ if (o) throw n;
73
+ }
74
+ }
75
+ return a;
76
+ }
77
+ }
78
+
79
+ function _arrayLikeToArray(arr, len) {
80
+ if (len == null || len > arr.length) len = arr.length;
81
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
82
+ return arr2;
83
+ }
84
+
85
+ function _unsupportedIterableToArray(o, minLen) {
86
+ if (!o) return;
87
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
88
+ var n = Object.prototype.toString.call(o).slice(8, -1);
89
+ if (n === "Object" && o.constructor) n = o.constructor.name;
90
+ if (n === "Map" || n === "Set") return Array.from(o);
91
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
92
+ }
93
+
94
+ function _nonIterableRest() {
95
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
96
+ }
97
+
98
+ function _slicedToArray(arr, i) {
99
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
100
+ }
101
+
102
+ var DeleteAlert = function DeleteAlert(_ref) {
103
+ var onClose = _ref.onClose,
104
+ onSubmit = _ref.onSubmit,
105
+ isOpen = _ref.isOpen,
106
+ isSubmitting = _ref.isSubmitting,
107
+ hostname = _ref.hostname;
108
+ var _useTranslation = reactI18next.useTranslation(),
109
+ t = _useTranslation.t;
110
+ return /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
111
+ cancelButtonLabel: t("neetoMolecules.common.actions.cancel"),
112
+ isOpen: isOpen,
113
+ isSubmitting: isSubmitting,
114
+ submitButtonLabel: t("neetoMolecules.common.actions.delete"),
115
+ title: t("neetoMolecules.customDomain.delete"),
116
+ message: /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
117
+ i18nKey: "neetoMolecules.customDomain.alertMessage",
118
+ values: {
119
+ hostname: hostname
120
+ }
121
+ }),
122
+ onClose: onClose,
123
+ onSubmit: onSubmit
124
+ });
125
+ };
126
+
127
+ var HOSTNAME_REGEX = /^(?!-)[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+/;
128
+ var INITIAL_VALUES = {
129
+ hostname: ""
130
+ };
131
+
132
+ function _objectWithoutPropertiesLoose(source, excluded) {
133
+ if (source == null) return {};
134
+ var target = {};
135
+ var sourceKeys = Object.keys(source);
136
+ var key, i;
137
+ for (i = 0; i < sourceKeys.length; i++) {
138
+ key = sourceKeys[i];
139
+ if (excluded.indexOf(key) >= 0) continue;
140
+ target[key] = source[key];
141
+ }
142
+ return target;
143
+ }
144
+
145
+ function _objectWithoutProperties(source, excluded) {
146
+ if (source == null) return {};
147
+ var target = _objectWithoutPropertiesLoose(source, excluded);
148
+ var key, i;
149
+ if (Object.getOwnPropertySymbols) {
150
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
151
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
152
+ key = sourceSymbolKeys[i];
153
+ if (excluded.indexOf(key) >= 0) continue;
154
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
155
+ target[key] = source[key];
156
+ }
157
+ }
158
+ return target;
159
+ }
160
+
161
+ function _typeof(o) {
162
+ "@babel/helpers - typeof";
163
+
164
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
165
+ return typeof o;
166
+ } : function (o) {
167
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
168
+ }, _typeof(o);
169
+ }
170
+
171
+ function _toPrimitive(input, hint) {
172
+ if (_typeof(input) !== "object" || input === null) return input;
173
+ var prim = input[Symbol.toPrimitive];
174
+ if (prim !== undefined) {
175
+ var res = prim.call(input, hint || "default");
176
+ if (_typeof(res) !== "object") return res;
177
+ throw new TypeError("@@toPrimitive must return a primitive value.");
178
+ }
179
+ return (hint === "string" ? String : Number)(input);
180
+ }
181
+
182
+ function _toPropertyKey(arg) {
183
+ var key = _toPrimitive(arg, "string");
184
+ return _typeof(key) === "symbol" ? key : String(key);
185
+ }
186
+
187
+ function _defineProperty(obj, key, value) {
188
+ key = _toPropertyKey(key);
189
+ if (key in obj) {
190
+ Object.defineProperty(obj, key, {
191
+ value: value,
192
+ enumerable: true,
193
+ configurable: true,
194
+ writable: true
195
+ });
196
+ } else {
197
+ obj[key] = value;
198
+ }
199
+ return obj;
200
+ }
201
+
202
+ function _extends() {
203
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
204
+ for (var i = 1; i < arguments.length; i++) {
205
+ var source = arguments[i];
206
+ for (var key in source) {
207
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
208
+ target[key] = source[key];
209
+ }
210
+ }
211
+ }
212
+ return target;
213
+ };
214
+ return _extends.apply(this, arguments);
215
+ }
216
+
217
+ var MENU_ITEM_TYPES = {
218
+ menuItem: "menuItem",
219
+ divider: "divider"
220
+ };
221
+ var DEFAULT_TOOLTIP_PROPS = {
222
+ disabled: true,
223
+ position: "bottom"
224
+ };
225
+
226
+ var _excluded$2 = ["label", "key"],
227
+ _excluded2 = ["isVisible", "key"];
228
+ var MenuItem$1 = neetoui.Dropdown.MenuItem,
229
+ Menu$1 = neetoui.Dropdown.Menu;
230
+ var Submenu = function Submenu(_ref) {
231
+ var label = _ref.label,
232
+ key = _ref.key,
233
+ menuItemProps = _objectWithoutProperties(_ref, _excluded$2);
234
+ return /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, _extends({
235
+ customTarget: /*#__PURE__*/React__default["default"].createElement(MenuItem$1.Button, null, label),
236
+ key: key,
237
+ position: "left",
238
+ trigger: "hover"
239
+ }, menuItemProps.dropdownProps), /*#__PURE__*/React__default["default"].createElement(Menu$1, null, menuItemProps.menuItems.map(function (_ref2) {
240
+ var _ref2$isVisible = _ref2.isVisible,
241
+ isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
242
+ key = _ref2.key,
243
+ menuItemProps = _objectWithoutProperties(_ref2, _excluded2);
244
+ if (!isVisible) return null;
245
+ return /*#__PURE__*/React__default["default"].createElement(MoreDropdownMenuItem, _extends({
246
+ key: key
247
+ }, menuItemProps));
248
+ })));
249
+ };
250
+
251
+ var _excluded$1 = ["onClick", "label", "type", "hasSubItems"];
252
+ 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; }
253
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
254
+ var MenuItem = neetoui.Dropdown.MenuItem,
255
+ Divider = neetoui.Dropdown.Divider;
256
+ var MoreDropdownMenuItem = function MoreDropdownMenuItem(_ref) {
257
+ var onClick = _ref.onClick,
258
+ label = _ref.label,
259
+ _ref$type = _ref.type,
260
+ type = _ref$type === void 0 ? MENU_ITEM_TYPES.menuItem : _ref$type,
261
+ _ref$hasSubItems = _ref.hasSubItems,
262
+ hasSubItems = _ref$hasSubItems === void 0 ? false : _ref$hasSubItems,
263
+ menuItemProps = _objectWithoutProperties(_ref, _excluded$1);
264
+ if (type === MENU_ITEM_TYPES.divider) {
265
+ return /*#__PURE__*/React__default["default"].createElement(Divider, null);
266
+ }
267
+ if (hasSubItems) {
268
+ return /*#__PURE__*/React__default["default"].createElement(Submenu, _objectSpread$2({
269
+ label: label
270
+ }, menuItemProps));
271
+ }
272
+ return /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, _objectSpread$2({
273
+ onClick: onClick
274
+ }, menuItemProps), label);
275
+ };
276
+
277
+ var _excluded = ["isVisible", "key"];
278
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
279
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
280
+ var Menu = neetoui.Dropdown.Menu;
281
+ var MoreDropdown = function MoreDropdown(_ref) {
282
+ var _ref$dropdownButtonPr = _ref.dropdownButtonProps,
283
+ dropdownButtonProps = _ref$dropdownButtonPr === void 0 ? {} : _ref$dropdownButtonPr,
284
+ _ref$isVertical = _ref.isVertical,
285
+ isVertical = _ref$isVertical === void 0 ? false : _ref$isVertical,
286
+ _ref$isDisabled = _ref.isDisabled,
287
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
288
+ _ref$dropdownProps = _ref.dropdownProps,
289
+ dropdownProps = _ref$dropdownProps === void 0 ? {} : _ref$dropdownProps,
290
+ menuTopChildren = _ref.menuTopChildren,
291
+ menuBottomChildren = _ref.menuBottomChildren,
292
+ _ref$menuItems = _ref.menuItems,
293
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems;
294
+ var tooltipProps = ramda.mergeRight(DEFAULT_TOOLTIP_PROPS, dropdownButtonProps.tooltipProps);
295
+ var targetIcon = isVertical ? neetoIcons.MenuVertical : neetoIcons.MenuHorizontal;
296
+ var isDropdownDisabled = isDisabled || dropdownProps.disabled;
297
+ if (isDropdownDisabled && !tooltipProps.disabled) {
298
+ return /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, tooltipProps, /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends({
299
+ disabled: true,
300
+ "data-cy": "more-dropdown-button",
301
+ "data-testid": "nui-dropdown-button",
302
+ icon: targetIcon,
303
+ iconPosition: "right",
304
+ size: "medium",
305
+ style: "text"
306
+ }, dropdownButtonProps))));
307
+ }
308
+ return /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, _extends({
309
+ autoWidth: true,
310
+ className: "flex",
311
+ disabled: isDisabled,
312
+ icon: targetIcon,
313
+ buttonProps: _objectSpread$1({
314
+ className: "min-h-0 flex-shrink-0",
315
+ style: "text"
316
+ }, dropdownButtonProps)
317
+ }, dropdownProps), /*#__PURE__*/React__default["default"].createElement(Menu, null, menuTopChildren, menuItems.map(function (_ref2) {
318
+ var _ref2$isVisible = _ref2.isVisible,
319
+ isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
320
+ key = _ref2.key,
321
+ menuItemProps = _objectWithoutProperties(_ref2, _excluded);
322
+ if (!isVisible) return null;
323
+ return /*#__PURE__*/React__default["default"].createElement(MoreDropdownMenuItem, _extends({
324
+ key: key
325
+ }, menuItemProps));
326
+ }), menuBottomChildren));
327
+ };
328
+
329
+ var TagBlock = function TagBlock(_ref) {
330
+ var status = _ref.status,
331
+ _ref$stacked = _ref.stacked,
332
+ stacked = _ref$stacked === void 0 ? false : _ref$stacked;
333
+ var _useTranslation = reactI18next.useTranslation(),
334
+ t = _useTranslation.t;
335
+ var isDomainValidated = status === "active" || status === "pending_cname_validation";
336
+ var camelCasedStatus = neetoCist.snakeToCamelCase(status || "");
337
+ return /*#__PURE__*/React__default["default"].createElement("div", {
338
+ className: classnames__default["default"]("flex gap-2", {
339
+ "flex-col items-start": stacked
340
+ })
341
+ }, status === "failed" ? /*#__PURE__*/React__default["default"].createElement(neetoui.Tag, {
342
+ indicatorStyle: "danger",
343
+ label: t("neetoMolecules.customDomain.status.".concat(camelCasedStatus)),
344
+ style: "secondary"
345
+ }) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Tag, {
346
+ "data-cy": "".concat(utils.hyphenize(status), "-tag-container"),
347
+ indicatorStyle: isDomainValidated ? "success" : "warning",
348
+ style: "secondary",
349
+ label: t("neetoMolecules.customDomain.status.domain.".concat(camelCasedStatus))
350
+ }), isDomainValidated && /*#__PURE__*/React__default["default"].createElement("div", {
351
+ className: classnames__default["default"]("flex items-center justify-between gap-2", {
352
+ "w-full": stacked
353
+ })
354
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Tag, {
355
+ "data-cy": "".concat(utils.hyphenize(status), "-tag-container"),
356
+ indicatorStyle: status === "active" ? "success" : "warning",
357
+ style: "secondary",
358
+ label: t("neetoMolecules.customDomain.status.cname.".concat(camelCasedStatus))
359
+ }))));
360
+ };
361
+ var TagBlock$1 = /*#__PURE__*/React__default["default"].memo(TagBlock);
362
+
363
+ var recordData = function recordData(customDomain) {
364
+ var status = customDomain.status,
365
+ hostname = customDomain.hostname,
366
+ dnsTarget = customDomain.dnsTarget,
367
+ cnameValidationParams = customDomain.cnameValidationParams;
368
+ var isDomainValidated = status === "active" || status === "pending_cname_validation";
369
+ var recordName = isDomainValidated ? hostname : cnameValidationParams === null || cnameValidationParams === void 0 ? void 0 : cnameValidationParams.name;
370
+ var recordValue = isDomainValidated ? dnsTarget : cnameValidationParams === null || cnameValidationParams === void 0 ? void 0 : cnameValidationParams.value;
371
+ var recordType = isDomainValidated ? i18next.t("neetoMolecules.customDomain.cname") : i18next.t("neetoMolecules.customDomain.domainValidationCname");
372
+ var recordDescription = isDomainValidated ? i18next.t("neetoMolecules.customDomain.validation.desc", {
373
+ record: recordType
374
+ }) : i18next.t("neetoMolecules.customDomain.validation.desc", {
375
+ record: recordType,
376
+ proxyMessage: i18next.t("neetoMolecules.customDomain.validation.proxyMessage")
377
+ });
378
+ var recordNameLabel = i18next.t("neetoMolecules.customDomain.validation.record", {
379
+ record: recordType,
380
+ type: i18next.t("neetoMolecules.common.name")
381
+ });
382
+ var recordValueLabel = i18next.t("neetoMolecules.customDomain.validation.record", {
383
+ record: recordType,
384
+ type: i18next.t("neetoMolecules.common.value")
385
+ });
386
+ return {
387
+ recordName: recordName,
388
+ recordValue: recordValue,
389
+ recordDescription: recordDescription,
390
+ recordNameLabel: recordNameLabel,
391
+ recordValueLabel: recordValueLabel
392
+ };
393
+ };
394
+
395
+ var Record = function Record(_ref) {
396
+ var customDomain = _ref.customDomain;
397
+ var _recordData = recordData(customDomain),
398
+ recordName = _recordData.recordName,
399
+ recordValue = _recordData.recordValue,
400
+ recordDescription = _recordData.recordDescription,
401
+ recordNameLabel = _recordData.recordNameLabel,
402
+ recordValueLabel = _recordData.recordValueLabel;
403
+ return /*#__PURE__*/React__default["default"].createElement("div", {
404
+ className: "mt-6 grid gap-4"
405
+ }, customDomain.status !== "active" && /*#__PURE__*/React__default["default"].createElement(neetoui.Callout, {
406
+ icon: neetoIcons.Info,
407
+ style: "info"
408
+ }, recordDescription), /*#__PURE__*/React__default["default"].createElement(neetoui.Input, {
409
+ disabled: true,
410
+ "data-cy": utils.joinHyphenCase(recordNameLabel),
411
+ label: recordNameLabel,
412
+ value: recordName,
413
+ suffix: /*#__PURE__*/React__default["default"].createElement(CopyToClipboardButton__default["default"], {
414
+ size: "small",
415
+ style: "text",
416
+ value: recordName
417
+ })
418
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Input, {
419
+ disabled: true,
420
+ "data-cy": utils.joinHyphenCase(recordValueLabel),
421
+ label: recordValueLabel,
422
+ value: recordValue,
423
+ suffix: /*#__PURE__*/React__default["default"].createElement(CopyToClipboardButton__default["default"], {
424
+ size: "small",
425
+ style: "text",
426
+ value: recordValue
427
+ })
428
+ }));
429
+ };
430
+ var Record$1 = /*#__PURE__*/React__default["default"].memo(Record);
431
+
432
+ var StatusInfo = function StatusInfo() {
433
+ var helpUrl = "https://help.".concat(globalProps.appName.toLowerCase(), ".com/articles/custom-domains");
434
+ return /*#__PURE__*/React__default["default"].createElement("div", {
435
+ className: "space-y-6"
436
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
437
+ className: "neeto-ui-rounded neeto-ui-bg-gray-100 neeto-ui-text-gray-700 space-y-3 p-4"
438
+ }, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
439
+ i18nKey: "neetoMolecules.customDomain.messageBlock.dnsStatus",
440
+ components: {
441
+ a: /*#__PURE__*/React__default["default"].createElement("a", {
442
+ className: "neeto-ui-btn--style-link",
443
+ href: helpUrl,
444
+ rel: "noreferrer",
445
+ target: "_blank"
446
+ })
447
+ }
448
+ })));
449
+ };
450
+ var StatusInfo$1 = /*#__PURE__*/React__default["default"].memo(StatusInfo);
451
+
452
+ var getCustomDomainValidationSchema = function getCustomDomainValidationSchema() {
453
+ return Yup__namespace.object().shape({
454
+ hostname: Yup__namespace.string().required(i18next.t("neetoMolecules.customDomain.formikValidation.required")).matches(HOSTNAME_REGEX, i18next.t("neetoMolecules.customDomain.formikValidation.valid"))
455
+ });
456
+ };
457
+
458
+ var getUrlwithId = function getUrlwithId(url, id) {
459
+ return id ? "".concat(url, "/").concat(id) : url;
460
+ };
461
+ var fetchCustomDomains = function fetchCustomDomains(_ref) {
462
+ var url = _ref.url,
463
+ params = _ref.params;
464
+ return axios__default["default"].get(url, {
465
+ params: params
466
+ });
467
+ };
468
+ var updateCustomDomain = function updateCustomDomain(url, id) {
469
+ return axios__default["default"].patch(getUrlwithId(url, id));
470
+ };
471
+ var createCustomDomain = function createCustomDomain(url, payload) {
472
+ return axios__default["default"].post(url, payload);
473
+ };
474
+ var deleteCustomDomain = function deleteCustomDomain(url, id) {
475
+ return axios__default["default"]["delete"](getUrlwithId(url, id));
476
+ };
477
+ var validateDomain = function validateDomain(url, id) {
478
+ return axios__default["default"].patch("".concat(getUrlwithId(url, id), "/validate_domain"));
479
+ };
480
+ var validateCname = function validateCname(url, id) {
481
+ return axios__default["default"].patch("".concat(getUrlwithId(url, id), "/validate_cname"));
482
+ };
483
+ var customDomainApi = {
484
+ createCustomDomain: createCustomDomain,
485
+ deleteCustomDomain: deleteCustomDomain,
486
+ validateDomain: validateDomain,
487
+ fetchCustomDomains: fetchCustomDomains,
488
+ validateCname: validateCname,
489
+ updateCustomDomain: updateCustomDomain
490
+ };
491
+
492
+ var DOMAIN_QUERY_KEY = "custom-domain";
493
+
494
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
495
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
496
+ var useCreateCustomDomain = function useCreateCustomDomain(url) {
497
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
498
+ return reactUtils.useMutationWithInvalidation(function (payload) {
499
+ return customDomainApi.createCustomDomain(url, payload);
500
+ }, _objectSpread({
501
+ keysToInvalidate: [DOMAIN_QUERY_KEY]
502
+ }, options));
503
+ };
504
+ var useDeleteCustomDomain = function useDeleteCustomDomain(url) {
505
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
506
+ return reactUtils.useMutationWithInvalidation(function (id) {
507
+ return customDomainApi.deleteCustomDomain(url, id);
508
+ }, _objectSpread({
509
+ keysToInvalidate: [DOMAIN_QUERY_KEY]
510
+ }, options));
511
+ };
512
+ var useFetchCustomDomains = function useFetchCustomDomains(params) {
513
+ return reactQuery.useQuery([DOMAIN_QUERY_KEY, _objectSpread({}, params)], function () {
514
+ return customDomainApi.fetchCustomDomains(params);
515
+ });
516
+ };
517
+ var useValidateDomain = function useValidateDomain(url) {
518
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
519
+ return reactUtils.useMutationWithInvalidation(function (id) {
520
+ return customDomainApi.validateDomain(url, id);
521
+ }, _objectSpread({
522
+ keysToInvalidate: [DOMAIN_QUERY_KEY]
523
+ }, options));
524
+ };
525
+ var useValidateCname = function useValidateCname(url) {
526
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
527
+ return reactUtils.useMutationWithInvalidation(function (id) {
528
+ return customDomainApi.validateCname(url, id);
529
+ }, _objectSpread({
530
+ keysToInvalidate: [DOMAIN_QUERY_KEY]
531
+ }, options));
532
+ };
533
+ var useUpdateCustomDomain = function useUpdateCustomDomain(url) {
534
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
535
+ return reactUtils.useMutationWithInvalidation(function (id) {
536
+ return customDomainApi.updateCustomDomain(url, id);
537
+ }, _objectSpread({
538
+ keysToInvalidate: [DOMAIN_QUERY_KEY]
539
+ }, options));
540
+ };
541
+
542
+ var Manage = function Manage(_ref) {
543
+ var isOpen = _ref.isOpen,
544
+ onClose = _ref.onClose,
545
+ customDomain = _ref.customDomain,
546
+ setCustomDomain = _ref.setCustomDomain,
547
+ url = _ref.url,
548
+ hasOne = _ref.hasOne;
549
+ var _useTranslation = reactI18next.useTranslation(),
550
+ t = _useTranslation.t;
551
+ var initialFocusRef = React.useRef(null);
552
+ var customDomainId = hasOne ? null : customDomain === null || customDomain === void 0 ? void 0 : customDomain.id;
553
+ var _useCreateCustomDomai = useCreateCustomDomain(url),
554
+ createCustomDomain = _useCreateCustomDomai.mutate,
555
+ isCreating = _useCreateCustomDomai.isLoading;
556
+ var _useValidateDomain = useValidateDomain(url),
557
+ validateDomain = _useValidateDomain.mutate,
558
+ isValidating = _useValidateDomain.isLoading;
559
+ var _useValidateCname = useValidateCname(url),
560
+ validateCname = _useValidateCname.mutate,
561
+ isCnameValidating = _useValidateCname.isLoading;
562
+ var _useUpdateCustomDomai = useUpdateCustomDomain(url),
563
+ updateCustomDomain = _useUpdateCustomDomai.mutate,
564
+ isUpdating = _useUpdateCustomDomai.isLoading;
565
+ var handleSubmit = function handleSubmit(values) {
566
+ return createCustomDomain(values, {
567
+ onSuccess: function onSuccess(values) {
568
+ return setCustomDomain(values);
569
+ }
570
+ });
571
+ };
572
+ var handleValidateDomain = function handleValidateDomain() {
573
+ return validateDomain(customDomainId, {
574
+ onSuccess: function onSuccess(values) {
575
+ return setCustomDomain(values);
576
+ }
577
+ });
578
+ };
579
+ var handleValidateCname = function handleValidateCname() {
580
+ validateCname(customDomainId, {
581
+ onSuccess: function onSuccess(data) {
582
+ return setCustomDomain(data);
583
+ }
584
+ });
585
+ };
586
+ var handleUpdateCname = function handleUpdateCname() {
587
+ updateCustomDomain(customDomainId, {
588
+ onSuccess: function onSuccess(data) {
589
+ return setCustomDomain(data);
590
+ }
591
+ });
592
+ };
593
+ return /*#__PURE__*/React__default["default"].createElement(neetoui.Pane, {
594
+ initialFocusRef: initialFocusRef,
595
+ isOpen: isOpen,
596
+ onClose: onClose
597
+ }, /*#__PURE__*/React__default["default"].createElement(formik.Formik, {
598
+ enableReinitialize: true,
599
+ initialValues: customDomain || INITIAL_VALUES,
600
+ validationSchema: getCustomDomainValidationSchema(),
601
+ onSubmit: handleSubmit
602
+ }, function (_ref2) {
603
+ var dirty = _ref2.dirty;
604
+ return /*#__PURE__*/React__default["default"].createElement(formik.Form, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Header, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
605
+ "data-cy": "add-custom-domain-pane-heading",
606
+ style: "h2",
607
+ weight: "semibold"
608
+ }, neetoCist.isNotEmpty(customDomain) ? t("neetoMolecules.customDomain.edit") : t("neetoMolecules.customDomain.addNew"))), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Body, null, /*#__PURE__*/React__default["default"].createElement("div", {
609
+ className: "w-full space-y-6"
610
+ }, neetoCist.isNotEmpty(customDomain) && /*#__PURE__*/React__default["default"].createElement(TagBlock$1, {
611
+ stacked: true,
612
+ handleValidateCname: handleValidateCname,
613
+ isCnameRecordsAdded: customDomain.addedCnameAt,
614
+ status: customDomain.status
615
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
616
+ className: "space-y-2"
617
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
618
+ required: true,
619
+ htmlFor: "hostname"
620
+ }, neetoCist.isNotEmpty(customDomain) ? t("neetoMolecules.customDomain.customDomain", constants.SINGULAR) : t("neetoMolecules.customDomain.label")), /*#__PURE__*/React__default["default"].createElement("div", {
621
+ className: "flex items-start gap-2"
622
+ }, /*#__PURE__*/React__default["default"].createElement(formik$1.Input, {
623
+ "data-cy": "custom-domain-input-field",
624
+ disabled: neetoCist.isNotEmpty(customDomain),
625
+ name: "hostname",
626
+ placeholder: t("neetoMolecules.customDomain.placeholder"),
627
+ ref: initialFocusRef
628
+ }), !neetoCist.isNotEmpty(customDomain) && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
629
+ "data-cy": "submit-custom-domain-button",
630
+ "data-testid": "submit-custom-domain-button",
631
+ disabled: !dirty || isCreating,
632
+ icon: neetoIcons.Check,
633
+ loading: isCreating,
634
+ style: "primary",
635
+ type: "submit"
636
+ }))), neetoCist.isNotEmpty(customDomain) && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Record$1, {
637
+ customDomain: customDomain
638
+ }), customDomain.status === "pending_domain_validation" && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
639
+ "data-cy": "validate-domain-button",
640
+ disabled: isValidating,
641
+ loading: isValidating,
642
+ label: t("neetoMolecules.customDomain.validation.buttonLabel.domain"),
643
+ onClick: handleValidateDomain
644
+ }), customDomain.status === "pending_cname_validation" && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
645
+ "data-cy": "validate-cname-record-button",
646
+ loading: isCnameValidating || isUpdating,
647
+ label: t("neetoMolecules.customDomain.validation.buttonLabel.cnameAdded"),
648
+ onClick: handleUpdateCname
649
+ }), /*#__PURE__*/React__default["default"].createElement(StatusInfo$1, null)))));
650
+ }));
651
+ };
652
+
653
+ var CustomDomain = function CustomDomain(_ref) {
654
+ var url = _ref.url,
655
+ iconOnly = _ref.iconOnly;
656
+ var _useState = React.useState(false),
657
+ _useState2 = _slicedToArray(_useState, 2),
658
+ isPaneOpen = _useState2[0],
659
+ setIsPaneOpen = _useState2[1];
660
+ var _useState3 = React.useState(false),
661
+ _useState4 = _slicedToArray(_useState3, 2),
662
+ isAlertOpen = _useState4[0],
663
+ setIsAlertOpen = _useState4[1];
664
+ var _useTranslation = reactI18next.useTranslation(),
665
+ t = _useTranslation.t;
666
+ var _useFetchCustomDomain = useFetchCustomDomains({
667
+ url: url
668
+ }),
669
+ customDomain = _useFetchCustomDomain.data,
670
+ isLoading = _useFetchCustomDomain.isLoading;
671
+ var _useDeleteCustomDomai = useDeleteCustomDomain(url, {
672
+ onSettled: function onSettled() {
673
+ return setIsAlertOpen(false);
674
+ }
675
+ }),
676
+ deleteCustomDomain = _useDeleteCustomDomai.mutate,
677
+ isDeleting = _useDeleteCustomDomai.isLoading;
678
+ var actions = [{
679
+ key: "edit",
680
+ label: t("neetoMolecules.common.actions.edit"),
681
+ onClick: function onClick() {
682
+ return setIsPaneOpen(true);
683
+ }
684
+ }, {
685
+ key: "delete",
686
+ label: t("neetoMolecules.common.actions.delete"),
687
+ onClick: function onClick() {
688
+ return setIsAlertOpen(true);
689
+ }
690
+ }];
691
+ if (isLoading) return /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null);
692
+ return /*#__PURE__*/React__default["default"].createElement("div", null, neetoCist.isNotEmpty(customDomain) ? /*#__PURE__*/React__default["default"].createElement("div", {
693
+ className: "flex flex-row items-center"
694
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Tag, {
695
+ "data-cy": "".concat(utils.hyphenize(customDomain.status), "-tag-container"),
696
+ label: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
697
+ style: customDomain.status === "active" ? "success" : "warning"
698
+ }), /*#__PURE__*/React__default["default"].createElement(MoreDropdown, {
699
+ dropdownProps: {
700
+ autoWidth: true
701
+ },
702
+ menuItems: actions,
703
+ dropdownButtonProps: {
704
+ "data-testid": "nui-dropdown-icon",
705
+ strategy: "fixed",
706
+ "data-cy": "custom-domain-menu-button"
707
+ }
708
+ })) : /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
709
+ icon: iconOnly && neetoIcons.CustomDomain,
710
+ style: "text",
711
+ label: iconOnly ? "" : t("neetoMolecules.common.actions.add", {
712
+ entity: t("neetoMolecules.customDomain.customDomain", constants.SINGULAR).toLowerCase()
713
+ }),
714
+ tooltipProps: iconOnly && {
715
+ content: t("neetoMolecules.customDomain.customDomain", constants.SINGULAR)
716
+ },
717
+ onClick: function onClick() {
718
+ return setIsPaneOpen(true);
719
+ }
720
+ }), /*#__PURE__*/React__default["default"].createElement(Manage, {
721
+ hasOne: true,
722
+ customDomain: customDomain,
723
+ url: url,
724
+ isOpen: isPaneOpen,
725
+ setCustomDomain: neetoCist.noop,
726
+ onClose: function onClose() {
727
+ return setIsPaneOpen(false);
728
+ }
729
+ }), /*#__PURE__*/React__default["default"].createElement(DeleteAlert, {
730
+ hostname: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
731
+ isOpen: isAlertOpen,
732
+ isSubmitting: isDeleting,
733
+ onClose: function onClose() {
734
+ return setIsAlertOpen(false);
735
+ },
736
+ onSubmit: function onSubmit() {
737
+ return deleteCustomDomain();
738
+ }
739
+ }));
740
+ };
741
+
742
+ module.exports = CustomDomain;
743
+ //# sourceMappingURL=CustomDomain.js.map