@bigbinary/neeto-custom-domains-frontend 1.1.0

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.
@@ -0,0 +1,958 @@
1
+ 'use strict';
2
+
3
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
+ var react = require('react');
5
+ var neetoCist = require('@bigbinary/neeto-cist');
6
+ var useDebounce = require('@bigbinary/neeto-commons-frontend/react-utils/useDebounce');
7
+ var Container = require('@bigbinary/neeto-molecules/Container');
8
+ var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
9
+ var SubHeader = require('@bigbinary/neeto-molecules/SubHeader');
10
+ var TableWrapper = require('@bigbinary/neeto-molecules/TableWrapper');
11
+ var Table = require('@bigbinary/neetoui/Table');
12
+ var Typography = require('@bigbinary/neetoui/Typography');
13
+ var NoData = require('@bigbinary/neetoui/NoData');
14
+ var Button = require('@bigbinary/neetoui/Button');
15
+ var reactI18next = require('react-i18next');
16
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
17
+ var reactQuery = require('@tanstack/react-query');
18
+ var useMutationWithInvalidation = require('@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation');
19
+ var axios = require('axios');
20
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
21
+ var Alert = require('@bigbinary/neetoui/Alert');
22
+ var jsxRuntime = require('react/jsx-runtime');
23
+ var constants = require('@bigbinary/neeto-commons-frontend/constants');
24
+ var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
25
+ var general = require('@bigbinary/neeto-commons-frontend/utils/general');
26
+ var NeetoHeader = require('@bigbinary/neeto-molecules/Header');
27
+ var Pane = require('@bigbinary/neetoui/Pane');
28
+ var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
29
+ var Input = require('@bigbinary/neetoui/formik/Input');
30
+ var FormikForm = require('@bigbinary/neetoui/formik/Form');
31
+ var i18next = require('i18next');
32
+ var Yup = require('yup');
33
+ var Checkbox = require('@bigbinary/neetoui/Checkbox');
34
+ var Callout = require('@bigbinary/neetoui/Callout');
35
+ var Stepper = require('@bigbinary/neetoui/Stepper');
36
+ var CopyToClipboardButton = require('@bigbinary/neeto-molecules/CopyToClipboardButton');
37
+ var Tag = require('@bigbinary/neetoui/Tag');
38
+ var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
39
+ var Toastr = require('@bigbinary/neetoui/Toastr');
40
+ var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
41
+ var classnames = require('classnames');
42
+
43
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
44
+
45
+ function _interopNamespace(e) {
46
+ if (e && e.__esModule) return e;
47
+ var n = Object.create(null);
48
+ if (e) {
49
+ Object.keys(e).forEach(function (k) {
50
+ if (k !== 'default') {
51
+ var d = Object.getOwnPropertyDescriptor(e, k);
52
+ Object.defineProperty(n, k, d.get ? d : {
53
+ enumerable: true,
54
+ get: function () { return e[k]; }
55
+ });
56
+ }
57
+ });
58
+ }
59
+ n["default"] = e;
60
+ return Object.freeze(n);
61
+ }
62
+
63
+ var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
64
+ var useDebounce__default = /*#__PURE__*/_interopDefaultLegacy(useDebounce);
65
+ var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
66
+ var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
67
+ var SubHeader__default = /*#__PURE__*/_interopDefaultLegacy(SubHeader);
68
+ var TableWrapper__default = /*#__PURE__*/_interopDefaultLegacy(TableWrapper);
69
+ var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
70
+ var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
71
+ var NoData__default = /*#__PURE__*/_interopDefaultLegacy(NoData);
72
+ var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
73
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
74
+ var useMutationWithInvalidation__default = /*#__PURE__*/_interopDefaultLegacy(useMutationWithInvalidation);
75
+ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
76
+ var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
77
+ var withT__default = /*#__PURE__*/_interopDefaultLegacy(withT);
78
+ var NeetoHeader__default = /*#__PURE__*/_interopDefaultLegacy(NeetoHeader);
79
+ var Pane__default = /*#__PURE__*/_interopDefaultLegacy(Pane);
80
+ var ActionBlock__default = /*#__PURE__*/_interopDefaultLegacy(ActionBlock);
81
+ var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
82
+ var FormikForm__default = /*#__PURE__*/_interopDefaultLegacy(FormikForm);
83
+ var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
84
+ var Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(Checkbox);
85
+ var Callout__default = /*#__PURE__*/_interopDefaultLegacy(Callout);
86
+ var Stepper__default = /*#__PURE__*/_interopDefaultLegacy(Stepper);
87
+ var CopyToClipboardButton__default = /*#__PURE__*/_interopDefaultLegacy(CopyToClipboardButton);
88
+ var Tag__default = /*#__PURE__*/_interopDefaultLegacy(Tag);
89
+ var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
90
+ var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
91
+ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
92
+
93
+ var getUrlwithId = function getUrlwithId(url, id) {
94
+ return id ? "".concat(url, "/").concat(id) : url;
95
+ };
96
+ var fetchCustomDomains = function fetchCustomDomains(_ref) {
97
+ var url = _ref.url,
98
+ params = _ref.params;
99
+ return axios__default["default"].get(url, {
100
+ params: params
101
+ });
102
+ };
103
+ var updateCustomDomain = function updateCustomDomain(url, id) {
104
+ return axios__default["default"].patch(getUrlwithId(url, id));
105
+ };
106
+ var createCustomDomain = function createCustomDomain(url, payload) {
107
+ return axios__default["default"].post(url, payload);
108
+ };
109
+ var deleteCustomDomain = function deleteCustomDomain(url, id) {
110
+ return axios__default["default"]["delete"](getUrlwithId(url, id));
111
+ };
112
+ var validateDomain = function validateDomain(url, id) {
113
+ return axios__default["default"].patch("".concat(getUrlwithId(url, id), "/validate_domain"), undefined, {
114
+ showToastr: false
115
+ });
116
+ };
117
+ var validateCname = function validateCname(url, id) {
118
+ return axios__default["default"].patch("".concat(getUrlwithId(url, id), "/validate_cname"));
119
+ };
120
+ var domainsApi = {
121
+ createCustomDomain: createCustomDomain,
122
+ deleteCustomDomain: deleteCustomDomain,
123
+ validateDomain: validateDomain,
124
+ fetchCustomDomains: fetchCustomDomains,
125
+ validateCname: validateCname,
126
+ updateCustomDomain: updateCustomDomain
127
+ };
128
+
129
+ var DOMAIN_QUERY_KEY = "custom-domain";
130
+
131
+ 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; }
132
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](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; }
133
+ var useCreateCustomDomain = function useCreateCustomDomain(url) {
134
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
135
+ return useMutationWithInvalidation__default["default"](function (payload) {
136
+ return domainsApi.createCustomDomain(url, payload);
137
+ }, _objectSpread$3({
138
+ keysToInvalidate: [[DOMAIN_QUERY_KEY]]
139
+ }, options));
140
+ };
141
+ var useDeleteCustomDomain = function useDeleteCustomDomain(url) {
142
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
143
+ return useMutationWithInvalidation__default["default"](function (id) {
144
+ return domainsApi.deleteCustomDomain(url, id);
145
+ }, _objectSpread$3({
146
+ keysToInvalidate: [[DOMAIN_QUERY_KEY]]
147
+ }, options));
148
+ };
149
+ var useFetchCustomDomains = function useFetchCustomDomains(params) {
150
+ return reactQuery.useQuery({
151
+ queryKey: [DOMAIN_QUERY_KEY, _objectSpread$3({}, params)],
152
+ queryFn: function queryFn() {
153
+ return domainsApi.fetchCustomDomains(params);
154
+ }
155
+ });
156
+ };
157
+ var useValidateDomain = function useValidateDomain(url) {
158
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
159
+ return useMutationWithInvalidation__default["default"](function (id) {
160
+ return domainsApi.validateDomain(url, id);
161
+ }, _objectSpread$3({
162
+ keysToInvalidate: [[DOMAIN_QUERY_KEY]]
163
+ }, options));
164
+ };
165
+ var useUpdateCustomDomain = function useUpdateCustomDomain(url) {
166
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
167
+ return useMutationWithInvalidation__default["default"](function (id) {
168
+ return domainsApi.updateCustomDomain(url, id);
169
+ }, _objectSpread$3({
170
+ keysToInvalidate: [[DOMAIN_QUERY_KEY]]
171
+ }, options));
172
+ };
173
+
174
+ var DeleteAlert = reactUtils.withT(function (_ref) {
175
+ var t = _ref.t,
176
+ onClose = _ref.onClose,
177
+ onSubmit = _ref.onSubmit,
178
+ isOpen = _ref.isOpen,
179
+ isSubmitting = _ref.isSubmitting,
180
+ hostname = _ref.hostname;
181
+ return /*#__PURE__*/jsxRuntime.jsx(Alert__default["default"], {
182
+ isOpen: isOpen,
183
+ isSubmitting: isSubmitting,
184
+ onClose: onClose,
185
+ onSubmit: onSubmit,
186
+ cancelButtonLabel: t("neetoCustomDomains.actions.cancel"),
187
+ submitButtonLabel: t("neetoCustomDomains.actions.delete"),
188
+ title: t("neetoCustomDomains.delete"),
189
+ message: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
190
+ i18nKey: "neetoCustomDomains.alertMessage",
191
+ values: {
192
+ hostname: hostname
193
+ }
194
+ })
195
+ });
196
+ });
197
+
198
+ 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; }
199
+ 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__default["default"](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; }
200
+ var Header = withT__default["default"](function (_ref) {
201
+ var t = _ref.t,
202
+ setIsPaneOpen = _ref.setIsPaneOpen,
203
+ searchTerm = _ref.searchTerm,
204
+ setSearchTerm = _ref.setSearchTerm,
205
+ headerProps = _ref.headerProps,
206
+ isFiltersVisible = _ref.isFiltersVisible;
207
+ return /*#__PURE__*/jsxRuntime.jsx(NeetoHeader__default["default"], _objectSpread$2({
208
+ "data-testid": "custom-domain-header",
209
+ title: t("neetoCustomDomains.customDomain", constants.PLURAL),
210
+ actionBlock: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
211
+ "data-cy": "add-new-custom-domain-button",
212
+ label: t("neetoCustomDomains.addNew"),
213
+ onClick: function onClick() {
214
+ return setIsPaneOpen(true);
215
+ }
216
+ }),
217
+ searchProps: isFiltersVisible && {
218
+ value: searchTerm,
219
+ onChange: general.withEventTargetValue(setSearchTerm),
220
+ placeholder: t("neetoCustomDomains.search"),
221
+ "data-cy": "custom-domain-search-field",
222
+ className: "w-56"
223
+ }
224
+ }, headerProps));
225
+ });
226
+ var Header$1 = /*#__PURE__*/react.memo(Header);
227
+
228
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
229
+
230
+ var css = ".neeto-molecule-custom-domain-pane{width:min(90%,1280px)}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9jb21wb25lbnRzL0N1c3RvbURvbWFpbkRhc2hib2FyZC9NYW5hZ2UvY3VzdG9tLWRvbWFpbi5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG1DQUNFLHFCQUNGIiwic291cmNlc0NvbnRlbnQiOlsiLm5lZXRvLW1vbGVjdWxlLWN1c3RvbS1kb21haW4tcGFuZSB7XG4gIHdpZHRoOiBtaW4oOTAlLCAxMjgwcHgpO1xufVxuIl19 */";
231
+ n(css,{});
232
+
233
+ var HOSTNAME_REGEX = /^(https?:\/\/)?([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}(\/\S*)?$/;
234
+ var INITIAL_VALUES = {
235
+ hostname: ""
236
+ };
237
+ var STATUS_INDEX = ["pending_domain_validation", "pending_cname_validation", "active"];
238
+ var DOMAIN_VALIDATION_STATUS = "pending_domain_validation";
239
+ var STEPS = [{
240
+ id: 1,
241
+ label: "Domain validation"
242
+ }, {
243
+ id: 2,
244
+ label: "Domain redirection"
245
+ }];
246
+
247
+ var getCustomDomainValidationSchema = function getCustomDomainValidationSchema() {
248
+ return Yup__namespace.object().shape({
249
+ hostname: Yup__namespace.string().required(i18next.t("neetoCustomDomains.formikValidation.required")).matches(HOSTNAME_REGEX, i18next.t("neetoCustomDomains.formikValidation.valid"))
250
+ });
251
+ };
252
+
253
+ var DomainField = function DomainField(_ref) {
254
+ var customDomain = _ref.customDomain,
255
+ onCreate = _ref.onCreate,
256
+ url = _ref.url,
257
+ setCustomDomain = _ref.setCustomDomain,
258
+ onClose = _ref.onClose;
259
+ var _useTranslation = reactI18next.useTranslation(),
260
+ t = _useTranslation.t;
261
+ var _useCreateCustomDomai = useCreateCustomDomain(url),
262
+ createCustomDomain = _useCreateCustomDomai.mutate,
263
+ isCreating = _useCreateCustomDomai.isPending;
264
+ var getHostname = function getHostname(url) {
265
+ try {
266
+ var parsedUrl = new URL(url);
267
+ return parsedUrl.hostname;
268
+ } catch (_unused) {
269
+ return url;
270
+ }
271
+ };
272
+ var handleSubmit = function handleSubmit(_ref2) {
273
+ var hostname = _ref2.hostname;
274
+ var parsedHostname = getHostname(hostname);
275
+ var payload = {
276
+ hostname: parsedHostname
277
+ };
278
+ createCustomDomain(payload, {
279
+ onSuccess: function onSuccess(values) {
280
+ setCustomDomain(values);
281
+ onCreate === null || onCreate === void 0 ? void 0 : onCreate(values);
282
+ }
283
+ });
284
+ };
285
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
286
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Header, {
287
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
288
+ style: "h2",
289
+ children: t("neetoCustomDomains.addNew")
290
+ })
291
+ }), /*#__PURE__*/jsxRuntime.jsx(FormikForm__default["default"], {
292
+ className: "flex-col space-y-6",
293
+ formikProps: {
294
+ enableReinitialize: true,
295
+ initialValues: customDomain || INITIAL_VALUES,
296
+ validationSchema: getCustomDomainValidationSchema(),
297
+ onSubmit: handleSubmit
298
+ },
299
+ children: function children(_ref3) {
300
+ var dirty = _ref3.dirty;
301
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
302
+ className: "w-full",
303
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Body, {
304
+ children: /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
305
+ required: true,
306
+ className: "w-full",
307
+ "data-cy": "custom-domain-input-field",
308
+ disabled: neetoCist.isNotEmpty(customDomain),
309
+ label: t("neetoCustomDomains.label"),
310
+ name: "hostname",
311
+ placeholder: t("neetoCustomDomains.placeholder")
312
+ })
313
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Footer, {
314
+ children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock__default["default"], {
315
+ cancelButtonProps: {
316
+ onClick: onClose
317
+ },
318
+ isSubmitting: isCreating,
319
+ submitButtonProps: {
320
+ label: t("neetoCustomDomains.actions.continue"),
321
+ "data-cy": "submit-custom-domain-button",
322
+ "data-testid": "submit-custom-domain-button",
323
+ disabled: !dirty || isCreating
324
+ }
325
+ })
326
+ })]
327
+ });
328
+ }
329
+ })]
330
+ });
331
+ };
332
+
333
+ var Common = reactUtils.withT(function (_ref) {
334
+ var t = _ref.t,
335
+ currentStep = _ref.currentStep,
336
+ handleStepChange = _ref.handleStepChange,
337
+ hostname = _ref.hostname;
338
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
339
+ className: "mb-6 w-full space-y-6",
340
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
341
+ className: "-ml-2",
342
+ children: /*#__PURE__*/jsxRuntime.jsx(Stepper__default["default"], {
343
+ activeIndex: currentStep,
344
+ setActiveIndex: handleStepChange,
345
+ steps: STEPS
346
+ })
347
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
348
+ className: "space-y-1",
349
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
350
+ style: "h4",
351
+ children: t("neetoCustomDomains.yourDomain")
352
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
353
+ style: "body1",
354
+ children: hostname
355
+ })]
356
+ })]
357
+ });
358
+ });
359
+
360
+ var columnData = function columnData() {
361
+ return [{
362
+ title: i18next.t("neetoCustomDomains.common.record"),
363
+ key: "record",
364
+ dataIndex: "record",
365
+ width: "90px",
366
+ render: function render() {
367
+ return /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
368
+ style: "body2",
369
+ children: i18next.t("neetoCustomDomains.cname")
370
+ });
371
+ }
372
+ }, {
373
+ title: i18next.t("neetoCustomDomains.common.name"),
374
+ dataIndex: "name",
375
+ width: "35%",
376
+ key: "name",
377
+ render: function render(name, _) {
378
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
379
+ className: "flex items-center justify-between gap-1",
380
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
381
+ className: "min-w-0 truncate",
382
+ style: "body2",
383
+ children: name
384
+ }), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton__default["default"], {
385
+ className: "flex-shrink-0",
386
+ size: "small",
387
+ style: "secondary",
388
+ value: name
389
+ })]
390
+ });
391
+ }
392
+ }, {
393
+ title: i18next.t("neetoCustomDomains.common.value"),
394
+ dataIndex: "value",
395
+ width: "35%",
396
+ key: "value",
397
+ render: function render(value, _) {
398
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
399
+ className: "flex items-center justify-between gap-1",
400
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
401
+ className: "min-w-0 truncate",
402
+ style: "body2",
403
+ children: value
404
+ }), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton__default["default"], {
405
+ value: value,
406
+ className: "flex-shrink-0",
407
+ size: "small",
408
+ style: "secondary"
409
+ })]
410
+ });
411
+ }
412
+ }, {
413
+ title: i18next.t("neetoCustomDomains.common.status"),
414
+ dataIndex: "status",
415
+ key: "status",
416
+ width: "130px",
417
+ render: function render(status) {
418
+ return /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
419
+ label: i18next.t("neetoCustomDomains.common.".concat(status)),
420
+ style: status === "success" ? "success" : "warning"
421
+ });
422
+ }
423
+ }];
424
+ };
425
+
426
+ var HELP_DOC_URL = "https://help.".concat(initializers.globalProps.appName.toLowerCase(), ".com/articles/custom-domains");
427
+
428
+ var Redirection = function Redirection(_ref) {
429
+ var customDomain = _ref.customDomain,
430
+ onClose = _ref.onClose,
431
+ setCustomDomain = _ref.setCustomDomain,
432
+ url = _ref.url,
433
+ currentStep = _ref.currentStep,
434
+ handleStepChange = _ref.handleStepChange,
435
+ incrementStep = _ref.incrementStep,
436
+ hasOne = _ref.hasOne;
437
+ var _useTranslation = reactI18next.useTranslation(),
438
+ t = _useTranslation.t;
439
+ var id = customDomain.id,
440
+ hostname = customDomain.hostname,
441
+ dnsTarget = customDomain.dnsTarget,
442
+ addedCnameAt = customDomain.addedCnameAt,
443
+ status = customDomain.status;
444
+ var cnameAdded = neetoCist.isPresent(addedCnameAt);
445
+ var customDomainId = hasOne ? null : id;
446
+ var _useState = react.useState(cnameAdded),
447
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
448
+ addedRedirectionCname = _useState2[0],
449
+ setAddedRedirectionCname = _useState2[1];
450
+ var _useUpdateCustomDomai = useUpdateCustomDomain(url),
451
+ updateCustomDomain = _useUpdateCustomDomai.mutate,
452
+ isUpdating = _useUpdateCustomDomai.isPending;
453
+ var handleUpdateCname = function handleUpdateCname() {
454
+ addedRedirectionCname && updateCustomDomain(customDomainId, {
455
+ onSuccess: function onSuccess(data) {
456
+ incrementStep();
457
+ setCustomDomain(data);
458
+ }
459
+ });
460
+ };
461
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
462
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Body, {
463
+ children: [/*#__PURE__*/jsxRuntime.jsx(Common, {
464
+ currentStep: currentStep,
465
+ handleStepChange: handleStepChange,
466
+ hostname: hostname
467
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
468
+ className: "mb-6 w-full space-y-6",
469
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
470
+ className: "space-y-1",
471
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
472
+ style: "h4",
473
+ children: t("neetoCustomDomains.domainRedirection")
474
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
475
+ style: "body2",
476
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
477
+ i18nKey: "neetoCustomDomains.cnameRecordInfo",
478
+ components: {
479
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
480
+ href: HELP_DOC_URL,
481
+ rel: "noreferrer",
482
+ style: "link",
483
+ target: "_blank"
484
+ })
485
+ }
486
+ })
487
+ })]
488
+ }), /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
489
+ className: "pb-0",
490
+ children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
491
+ allowRowClick: false,
492
+ columnData: columnData(),
493
+ rowSelection: false,
494
+ rowData: [{
495
+ name: hostname,
496
+ value: dnsTarget,
497
+ status: status === "active" ? "success" : "pending"
498
+ }]
499
+ })
500
+ }), /*#__PURE__*/jsxRuntime.jsx(Checkbox__default["default"], {
501
+ checked: addedRedirectionCname,
502
+ "data-testid": "cname-added-custom-domain-checkbox",
503
+ disabled: cnameAdded,
504
+ label: t("neetoCustomDomains.cnameAdded"),
505
+ onChange: function onChange() {
506
+ return setAddedRedirectionCname(function (value) {
507
+ return !value;
508
+ });
509
+ }
510
+ })]
511
+ }), cnameAdded && /*#__PURE__*/jsxRuntime.jsx(Callout__default["default"], {
512
+ style: "warning",
513
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
514
+ style: "body2",
515
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
516
+ i18nKey: "neetoCustomDomains.domainRedirectionInfo",
517
+ values: {
518
+ hostname: hostname
519
+ },
520
+ components: {
521
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
522
+ href: HELP_DOC_URL,
523
+ rel: "noreferrer",
524
+ style: "link",
525
+ target: "_blank"
526
+ })
527
+ }
528
+ })
529
+ })
530
+ })]
531
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Footer, {
532
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
533
+ className: "flex items-center gap-2",
534
+ children: [status !== "active" ? /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
535
+ disabled: isUpdating || !addedRedirectionCname,
536
+ label: t("neetoCustomDomains.actions.continue"),
537
+ loading: isUpdating,
538
+ onClick: handleUpdateCname
539
+ }) : /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
540
+ label: t("neetoCustomDomains.actions.done"),
541
+ onClick: onClose
542
+ }), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
543
+ label: t("neetoCustomDomains.actions.cancel"),
544
+ style: "text",
545
+ onClick: onClose
546
+ })]
547
+ })
548
+ })]
549
+ });
550
+ };
551
+
552
+ 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; }
553
+ 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__default["default"](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; }
554
+ var Validation = function Validation(_ref) {
555
+ var customDomain = _ref.customDomain,
556
+ onClose = _ref.onClose,
557
+ setCustomDomain = _ref.setCustomDomain,
558
+ url = _ref.url,
559
+ currentStep = _ref.currentStep,
560
+ handleStepChange = _ref.handleStepChange,
561
+ incrementStep = _ref.incrementStep,
562
+ hasOne = _ref.hasOne;
563
+ var _useTranslation = reactI18next.useTranslation(),
564
+ t = _useTranslation.t;
565
+ var id = customDomain.id,
566
+ hostname = customDomain.hostname,
567
+ cnameValidationParams = customDomain.cnameValidationParams,
568
+ status = customDomain.status;
569
+ var isDomainValidated = status !== "pending_domain_validation";
570
+ var customDomainId = hasOne ? null : id;
571
+ var _useState = react.useState(false),
572
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
573
+ showValidationWarning = _useState2[0],
574
+ setShowValidationWarning = _useState2[1];
575
+ var _useValidateDomain = useValidateDomain(url),
576
+ validateDomain = _useValidateDomain.mutate,
577
+ isValidating = _useValidateDomain.isPending;
578
+ var handleValidateDomain = function handleValidateDomain() {
579
+ return validateDomain(customDomainId, {
580
+ onError: function onError() {
581
+ setShowValidationWarning(true);
582
+ },
583
+ onSuccess: function onSuccess(values) {
584
+ Toastr__default["default"].success(t("neetoCustomDomains.validation.successMessage"));
585
+ incrementStep();
586
+ setCustomDomain(values);
587
+ }
588
+ });
589
+ };
590
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
591
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Body, {
592
+ children: [/*#__PURE__*/jsxRuntime.jsx(Common, {
593
+ currentStep: currentStep,
594
+ handleStepChange: handleStepChange,
595
+ hostname: hostname
596
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
597
+ className: "mb-6 w-full space-y-6",
598
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
599
+ className: "space-y-1",
600
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
601
+ style: "h4",
602
+ children: t("neetoCustomDomains.domainValidation")
603
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
604
+ style: "body2",
605
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
606
+ i18nKey: "neetoCustomDomains.cnameRecordInfo",
607
+ components: {
608
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
609
+ href: HELP_DOC_URL,
610
+ rel: "noreferrer",
611
+ style: "link",
612
+ target: "_blank"
613
+ })
614
+ },
615
+ values: {
616
+ proxyMessage: t("neetoCustomDomains.proxyMessage")
617
+ }
618
+ })
619
+ })]
620
+ }), /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
621
+ className: "pb-0",
622
+ children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
623
+ allowRowClick: false,
624
+ columnData: columnData(),
625
+ rowSelection: false,
626
+ rowData: [_objectSpread$1(_objectSpread$1({}, cnameValidationParams), {}, {
627
+ status: isDomainValidated ? "success" : "pending"
628
+ })]
629
+ })
630
+ })]
631
+ }), showValidationWarning && /*#__PURE__*/jsxRuntime.jsx(Callout__default["default"], {
632
+ style: "warning",
633
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
634
+ style: "body2",
635
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
636
+ i18nKey: "neetoCustomDomains.domainValidationInfo",
637
+ components: {
638
+ Link: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
639
+ href: HELP_DOC_URL,
640
+ rel: "noreferrer",
641
+ style: "link",
642
+ target: "_blank"
643
+ })
644
+ }
645
+ })
646
+ })
647
+ })]
648
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Footer, {
649
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
650
+ className: "flex items-center gap-2",
651
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
652
+ disabled: isValidating,
653
+ loading: isValidating,
654
+ "data-cy": isDomainValidated ? "continue-button" : "validate-domain-button",
655
+ label: isDomainValidated ? t("neetoCustomDomains.actions.continue") : t("neetoCustomDomains.validation.buttonLabel.domain"),
656
+ onClick: isDomainValidated ? incrementStep : handleValidateDomain
657
+ }), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
658
+ label: t("neetoCustomDomains.actions.cancel"),
659
+ style: "text",
660
+ onClick: onClose
661
+ })]
662
+ })
663
+ })]
664
+ });
665
+ };
666
+
667
+ 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; }
668
+ 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__default["default"](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; }
669
+ var Settings = function Settings(_ref) {
670
+ var customDomain = _ref.customDomain,
671
+ url = _ref.url,
672
+ onClose = _ref.onClose,
673
+ setCustomDomain = _ref.setCustomDomain,
674
+ hasOne = _ref.hasOne;
675
+ var _useTranslation = reactI18next.useTranslation(),
676
+ t = _useTranslation.t;
677
+ var status = customDomain.status;
678
+ var _useState = react.useState(STATUS_INDEX.indexOf(status)),
679
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
680
+ currentStep = _useState2[0],
681
+ setCurrentStep = _useState2[1];
682
+ var isNotValidationStep = STATUS_INDEX[currentStep] !== DOMAIN_VALIDATION_STATUS;
683
+ var handleStepChange = function handleStepChange(index) {
684
+ status !== DOMAIN_VALIDATION_STATUS && setCurrentStep(index);
685
+ };
686
+ var incrementStep = function incrementStep() {
687
+ return setCurrentStep(function (step) {
688
+ return step + 1;
689
+ });
690
+ };
691
+ var recordProps = {
692
+ currentStep: currentStep,
693
+ customDomain: customDomain,
694
+ handleStepChange: handleStepChange,
695
+ onClose: onClose,
696
+ setCustomDomain: setCustomDomain,
697
+ url: url,
698
+ incrementStep: incrementStep,
699
+ hasOne: hasOne
700
+ };
701
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
702
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Header, {
703
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
704
+ style: "h2",
705
+ children: t("neetoCustomDomains.settings")
706
+ })
707
+ }), isNotValidationStep ? /*#__PURE__*/jsxRuntime.jsx(Redirection, _objectSpread({}, recordProps)) : /*#__PURE__*/jsxRuntime.jsx(Validation, _objectSpread({}, recordProps))]
708
+ });
709
+ };
710
+
711
+ var Manage = function Manage(_ref) {
712
+ var isOpen = _ref.isOpen,
713
+ onClose = _ref.onClose,
714
+ customDomain = _ref.customDomain,
715
+ setCustomDomain = _ref.setCustomDomain,
716
+ url = _ref.url,
717
+ hasOne = _ref.hasOne,
718
+ onCreate = _ref.onCreate;
719
+ return /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"], {
720
+ isOpen: isOpen,
721
+ onClose: onClose,
722
+ className: "neeto-molecule-custom-domain-pane",
723
+ size: "large",
724
+ children: customDomain !== null && customDomain !== void 0 && customDomain.id ? /*#__PURE__*/jsxRuntime.jsx(Settings, {
725
+ customDomain: customDomain,
726
+ hasOne: hasOne,
727
+ onClose: onClose,
728
+ setCustomDomain: setCustomDomain,
729
+ url: url
730
+ }) : /*#__PURE__*/jsxRuntime.jsx(DomainField, {
731
+ customDomain: customDomain,
732
+ onClose: onClose,
733
+ onCreate: onCreate,
734
+ setCustomDomain: setCustomDomain,
735
+ url: url
736
+ })
737
+ });
738
+ };
739
+
740
+ var TagBlock = function TagBlock(_ref) {
741
+ var status = _ref.status,
742
+ _ref$stacked = _ref.stacked,
743
+ stacked = _ref$stacked === void 0 ? false : _ref$stacked;
744
+ var _useTranslation = reactI18next.useTranslation(),
745
+ t = _useTranslation.t;
746
+ var isDomainValidated = status === "active" || status === "pending_cname_validation";
747
+ var camelCasedStatus = neetoCist.snakeToCamelCase(status || "");
748
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
749
+ className: classnames__default["default"]("flex gap-2", {
750
+ "flex-col items-start": stacked
751
+ }),
752
+ children: status === "failed" ? /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
753
+ label: t("neetoCustomDomains.status.".concat(camelCasedStatus)),
754
+ style: "danger"
755
+ }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
756
+ children: [/*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
757
+ "data-cy": "".concat(general.hyphenize(status), "-tag-container"),
758
+ label: t("neetoCustomDomains.status.domain.".concat(camelCasedStatus)),
759
+ style: isDomainValidated ? "success" : "warning"
760
+ }), isDomainValidated && /*#__PURE__*/jsxRuntime.jsx("div", {
761
+ className: classnames__default["default"]("flex items-center justify-between gap-2", {
762
+ "w-full": stacked
763
+ }),
764
+ children: /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
765
+ "data-cy": "".concat(general.hyphenize(status), "-tag-container"),
766
+ label: t("neetoCustomDomains.status.cname.".concat(camelCasedStatus)),
767
+ style: status === "active" ? "success" : "warning"
768
+ })
769
+ })]
770
+ })
771
+ });
772
+ };
773
+ var TagBlock$1 = /*#__PURE__*/react.memo(TagBlock);
774
+
775
+ var renderColumnData = function renderColumnData(enableManagePane, enableDeleteAlert) {
776
+ return [{
777
+ title: i18next.t("neetoCustomDomains.customDomain", constants.SINGULAR),
778
+ dataIndex: "hostname",
779
+ key: "hostname",
780
+ width: "60%",
781
+ render: function render(hostName, customDomain) {
782
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
783
+ className: "flex items-center justify-between gap-x-3",
784
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
785
+ "data-cy": "hostname-button",
786
+ label: hostName,
787
+ style: "link",
788
+ onClick: function onClick() {
789
+ return enableManagePane(customDomain);
790
+ }
791
+ }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown__default["default"], {
792
+ dropdownButtonProps: {
793
+ "data-testid": "nui-dropdown-icon-".concat(customDomain.id)
794
+ },
795
+ dropdownProps: {
796
+ position: "bottom-end",
797
+ strategy: "fixed",
798
+ autoWidth: true
799
+ },
800
+ menuItems: [{
801
+ label: i18next.t("neetoCustomDomains.actions.edit"),
802
+ onClick: function onClick() {
803
+ return enableManagePane(customDomain);
804
+ },
805
+ key: "edit-custom-domain-button"
806
+ }, {
807
+ label: i18next.t("neetoCustomDomains.actions.delete"),
808
+ onClick: function onClick() {
809
+ return enableDeleteAlert(customDomain);
810
+ },
811
+ key: "delete-custom-domain"
812
+ }]
813
+ })]
814
+ });
815
+ }
816
+ }, {
817
+ title: i18next.t("neetoCustomDomains.common.status"),
818
+ dataIndex: "status",
819
+ key: "status",
820
+ render: function render(status) {
821
+ return /*#__PURE__*/jsxRuntime.jsx(TagBlock$1, {
822
+ status: status
823
+ });
824
+ },
825
+ width: "40%"
826
+ }];
827
+ };
828
+
829
+ var CustomDomainDashboard = function CustomDomainDashboard(_ref) {
830
+ var _data$customDomains, _data$customDomains2;
831
+ var headerProps = _ref.headerProps,
832
+ url = _ref.url,
833
+ onCreate = _ref.onCreate;
834
+ var _useState = react.useState(""),
835
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
836
+ searchTerm = _useState2[0],
837
+ setSearchTerm = _useState2[1];
838
+ var _useState3 = react.useState(false),
839
+ _useState4 = _slicedToArray__default["default"](_useState3, 2),
840
+ isPaneOpen = _useState4[0],
841
+ setIsPaneOpen = _useState4[1];
842
+ var _useState5 = react.useState({}),
843
+ _useState6 = _slicedToArray__default["default"](_useState5, 2),
844
+ customDomain = _useState6[0],
845
+ setCustomDomain = _useState6[1];
846
+ var _useState7 = react.useState(false),
847
+ _useState8 = _slicedToArray__default["default"](_useState7, 2),
848
+ isAlertOpen = _useState8[0],
849
+ setIsAlertOpen = _useState8[1];
850
+ var _useTranslation = reactI18next.useTranslation(),
851
+ t = _useTranslation.t;
852
+ var debouncedSearchTerm = useDebounce__default["default"](searchTerm, 500);
853
+ var _useFetchCustomDomain = useFetchCustomDomains({
854
+ url: url,
855
+ params: {
856
+ searchTerm: debouncedSearchTerm
857
+ }
858
+ }),
859
+ data = _useFetchCustomDomain.data,
860
+ isLoading = _useFetchCustomDomain.isLoading;
861
+ var isFiltersVisible = neetoCist.isNotEmpty(data === null || data === void 0 ? void 0 : data.customDomains) || neetoCist.isPresent(searchTerm);
862
+ var _useDeleteCustomDomai = useDeleteCustomDomain(url, {
863
+ onSettled: function onSettled() {
864
+ setIsAlertOpen(false);
865
+ setCustomDomain({});
866
+ }
867
+ }),
868
+ deleteCustomDomain = _useDeleteCustomDomai.mutate,
869
+ isDeleting = _useDeleteCustomDomai.isPending;
870
+ var enableManagePane = function enableManagePane(customDomain) {
871
+ setCustomDomain(customDomain);
872
+ setIsPaneOpen(true);
873
+ };
874
+ var enableDeleteAlert = function enableDeleteAlert(customDomain) {
875
+ setCustomDomain(customDomain);
876
+ setIsAlertOpen(true);
877
+ };
878
+ var disableManagePane = function disableManagePane() {
879
+ setIsPaneOpen(false);
880
+ setCustomDomain({});
881
+ };
882
+ var disableDeleteAlert = function disableDeleteAlert() {
883
+ setIsAlertOpen(false);
884
+ setCustomDomain({});
885
+ };
886
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
887
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
888
+ children: [/*#__PURE__*/jsxRuntime.jsx(Header$1, {
889
+ headerProps: headerProps,
890
+ isFiltersVisible: isFiltersVisible,
891
+ searchTerm: searchTerm,
892
+ setIsPaneOpen: setIsPaneOpen,
893
+ setSearchTerm: setSearchTerm
894
+ }), isLoading && /*#__PURE__*/jsxRuntime.jsx("div", {
895
+ className: "h-screen w-full",
896
+ children: /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {})
897
+ }), !isLoading && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
898
+ children: [/*#__PURE__*/jsxRuntime.jsx(SubHeader__default["default"], {
899
+ leftActionBlock: !!(data !== null && data !== void 0 && (_data$customDomains = data.customDomains) !== null && _data$customDomains !== void 0 && _data$customDomains.length) && /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
900
+ className: "neeto-ui-gray-800 font-semibold",
901
+ component: "h4",
902
+ children: t("neetoCustomDomains.customDomainWithCount", {
903
+ count: data === null || data === void 0 ? void 0 : (_data$customDomains2 = data.customDomains) === null || _data$customDomains2 === void 0 ? void 0 : _data$customDomains2.length
904
+ })
905
+ })
906
+ }), neetoCist.isNotEmpty(data === null || data === void 0 ? void 0 : data.customDomains) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
907
+ children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
908
+ fixedHeight: true,
909
+ allowRowClick: false,
910
+ rowData: data === null || data === void 0 ? void 0 : data.customDomains,
911
+ rowSelection: false,
912
+ columnData: renderColumnData(enableManagePane, enableDeleteAlert)
913
+ })
914
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
915
+ className: "flex h-full w-full flex-grow items-center justify-center",
916
+ children: /*#__PURE__*/jsxRuntime.jsx(NoData__default["default"], {
917
+ title: t("neetoCustomDomains.notFound"),
918
+ helpText: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
919
+ i18nKey: "neetoCustomDomains.learnMoreMessage",
920
+ components: {
921
+ button: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
922
+ href: "https://help.neetosite.com/p/a-95ad5b03",
923
+ style: "link",
924
+ target: "_blank"
925
+ })
926
+ }
927
+ }),
928
+ primaryButtonProps: {
929
+ label: t("neetoCustomDomains.addNew"),
930
+ onClick: function onClick() {
931
+ return setIsPaneOpen(true);
932
+ }
933
+ }
934
+ })
935
+ })]
936
+ })]
937
+ }), /*#__PURE__*/jsxRuntime.jsx(Manage, {
938
+ customDomain: customDomain,
939
+ onCreate: onCreate,
940
+ setCustomDomain: setCustomDomain,
941
+ url: url,
942
+ hasOne: false,
943
+ isOpen: isPaneOpen,
944
+ onClose: disableManagePane
945
+ }), /*#__PURE__*/jsxRuntime.jsx(DeleteAlert, {
946
+ hostname: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
947
+ isOpen: isAlertOpen,
948
+ isSubmitting: isDeleting,
949
+ onClose: disableDeleteAlert,
950
+ onSubmit: function onSubmit() {
951
+ return deleteCustomDomain(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id);
952
+ }
953
+ })]
954
+ });
955
+ };
956
+
957
+ module.exports = CustomDomainDashboard;
958
+ //# sourceMappingURL=CustomDomainDashboard.js.map