@bigbinary/neeto-custom-domains-frontend 2.0.2 → 2.1.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,591 +1,43 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
- var react = require('react');
7
- var neetoCist = require('@bigbinary/neeto-cist');
8
- var Container = require('@bigbinary/neeto-molecules/Container');
9
- var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
10
- var CustomDomainDashboard = require('../index-6d441e24.js');
11
- var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
12
- var Alert = require('@bigbinary/neetoui/Alert');
13
- var reactI18next = require('react-i18next');
14
- var jsxRuntime = require('react/jsx-runtime');
15
- var constants = require('@bigbinary/neeto-commons-frontend/constants');
16
- var general = require('@bigbinary/neeto-commons-frontend/utils/general');
17
- var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
18
- var Button = require('@bigbinary/neetoui/Button');
19
- var Typography = require('@bigbinary/neetoui/Typography');
20
- var Tag = require('@bigbinary/neetoui/Tag');
21
- var Pane = require('@bigbinary/neetoui/Pane');
22
- var Stepper = require('@bigbinary/neetoui/Stepper');
23
- var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
24
- var Input = require('@bigbinary/neetoui/formik/Input');
25
- var FormikForm = require('@bigbinary/neetoui/formik/Form');
26
- var i18next = require('i18next');
27
- var Yup = require('yup');
28
- var Table = require('@bigbinary/neetoui/Table');
29
- var Toastr = require('@bigbinary/neetoui/Toastr');
30
- var Callout = require('@bigbinary/neetoui/Callout');
31
- var psl = require('psl');
32
- var CopyToClipboardButton = require('@bigbinary/neeto-molecules/CopyToClipboardButton');
33
- var NeetoHeader = require('@bigbinary/neeto-molecules/Header');
34
- var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
3
+ var CustomDomain = require('./CustomDomain.js');
35
4
  var WelcomeScreen = require('./WelcomeScreen.js');
36
- require('@bigbinary/neeto-commons-frontend/react-utils/useDebounce');
37
- require('@bigbinary/neeto-molecules/SubHeader');
38
- require('@bigbinary/neeto-molecules/TableWrapper');
39
- require('@bigbinary/neetoui/NoData');
5
+ require('@babel/runtime/helpers/slicedToArray');
6
+ require('react');
7
+ require('@bigbinary/neeto-cist');
8
+ require('@bigbinary/neeto-commons-frontend/react-utils');
9
+ require('@bigbinary/neeto-molecules/Container');
10
+ require('@bigbinary/neeto-molecules/PageLoader');
40
11
  require('@babel/runtime/helpers/defineProperty');
41
12
  require('@tanstack/react-query');
42
13
  require('@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation');
43
14
  require('axios');
44
- require('@bigbinary/neeto-commons-frontend/react-utils/withT');
45
- require('@bigbinary/neetoui/Checkbox');
46
- require('@bigbinary/neeto-commons-frontend/initializers');
47
- require('classnames');
48
-
49
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
50
-
51
- function _interopNamespace(e) {
52
- if (e && e.__esModule) return e;
53
- var n = Object.create(null);
54
- if (e) {
55
- Object.keys(e).forEach(function (k) {
56
- if (k !== 'default') {
57
- var d = Object.getOwnPropertyDescriptor(e, k);
58
- Object.defineProperty(n, k, d.get ? d : {
59
- enumerable: true,
60
- get: function () { return e[k]; }
61
- });
62
- }
63
- });
64
- }
65
- n["default"] = e;
66
- return Object.freeze(n);
67
- }
68
-
69
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
70
- var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
71
- var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
72
- var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
73
- var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
74
- var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
75
- var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
76
- var Tag__default = /*#__PURE__*/_interopDefaultLegacy(Tag);
77
- var Pane__default = /*#__PURE__*/_interopDefaultLegacy(Pane);
78
- var Stepper__default = /*#__PURE__*/_interopDefaultLegacy(Stepper);
79
- var ActionBlock__default = /*#__PURE__*/_interopDefaultLegacy(ActionBlock);
80
- var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
81
- var FormikForm__default = /*#__PURE__*/_interopDefaultLegacy(FormikForm);
82
- var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
83
- var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
84
- var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
85
- var Callout__default = /*#__PURE__*/_interopDefaultLegacy(Callout);
86
- var psl__default = /*#__PURE__*/_interopDefaultLegacy(psl);
87
- var CopyToClipboardButton__default = /*#__PURE__*/_interopDefaultLegacy(CopyToClipboardButton);
88
- var NeetoHeader__default = /*#__PURE__*/_interopDefaultLegacy(NeetoHeader);
89
- var HelpPopover__default = /*#__PURE__*/_interopDefaultLegacy(HelpPopover);
90
-
91
- var DeleteAlert = reactUtils.withT(function (_ref) {
92
- var t = _ref.t,
93
- onClose = _ref.onClose,
94
- onSubmit = _ref.onSubmit,
95
- isOpen = _ref.isOpen,
96
- isSubmitting = _ref.isSubmitting,
97
- hostname = _ref.hostname;
98
- return /*#__PURE__*/jsxRuntime.jsx(Alert__default["default"], {
99
- isOpen: isOpen,
100
- isSubmitting: isSubmitting,
101
- onClose: onClose,
102
- onSubmit: onSubmit,
103
- cancelButtonLabel: t("neetoCustomDomains.actions.cancel"),
104
- submitButtonLabel: t("neetoCustomDomains.actions.delete"),
105
- title: t("neetoCustomDomains.delete"),
106
- message: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
107
- i18nKey: "neetoCustomDomains.alertMessage",
108
- values: {
109
- hostname: hostname
110
- }
111
- })
112
- });
113
- });
114
-
115
- var STATUS_TAG_STYLES = {
116
- active: "success",
117
- pending: "warning"
118
- };
119
-
120
- var Domain = reactUtils.withT(function (_ref) {
121
- var t = _ref.t,
122
- isCustomDomainAdded = _ref.isCustomDomainAdded,
123
- openPane = _ref.openPane,
124
- customDomain = _ref.customDomain,
125
- openDeleteAlert = _ref.openDeleteAlert,
126
- helpDocUrl = _ref.helpDocUrl;
127
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
128
- className: "neeto-ui-border-gray-300 neeto-ui-rounded w-1/2 space-y-2 space-y-4 border p-6",
129
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
130
- style: "h2",
131
- children: t("neetoCustomDomains.connectionTitle")
132
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
133
- className: "space-y-1",
134
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
135
- className: "neeto-ui-border-gray-200 neeto-ui-rounded neeto-ui-bg-gray-50 flex items-center justify-between border border p-2",
136
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
137
- className: "flex items-center space-x-2",
138
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
139
- style: "body2",
140
- children: isCustomDomainAdded ? customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname : t("neetoCustomDomains.noDomainConnected")
141
- }), isCustomDomainAdded && /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
142
- "data-cy": "".concat(general.hyphenize(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status), "-tag-container"),
143
- style: STATUS_TAG_STYLES[customDomain === null || customDomain === void 0 ? void 0 : customDomain.status],
144
- label: t("neetoCustomDomains.status.domain.".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status))
145
- })]
146
- }), isCustomDomainAdded && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown__default["default"], {
147
- dropdownButtonProps: {
148
- "data-testid": "nui-dropdown-icon-".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id)
149
- },
150
- dropdownProps: {
151
- position: "bottom-end",
152
- strategy: "fixed",
153
- autoWidth: true
154
- },
155
- menuItems: [{
156
- label: t("neetoCustomDomains.actions.edit"),
157
- onClick: openPane,
158
- key: "edit-custom-domain-button"
159
- }, {
160
- label: t("neetoCustomDomains.actions.delete"),
161
- onClick: openDeleteAlert,
162
- key: "delete-custom-domain"
163
- }]
164
- })]
165
- }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
166
- style: "body3",
167
- children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
168
- i18nKey: "neetoCustomDomains.readHelpArticle",
169
- components: {
170
- Link: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
171
- href: helpDocUrl,
172
- rel: "noreferrer",
173
- style: "link",
174
- target: "_blank"
175
- })
176
- }
177
- })
178
- })]
179
- }), !isCustomDomainAdded && /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
180
- label: t("neetoCustomDomains.actions.add", {
181
- what: t("neetoCustomDomains.customDomain", constants.SINGULAR)
182
- }),
183
- onClick: openPane
184
- })]
185
- });
186
- });
187
-
188
- var HOSTNAME_REGEX = /^(https?:\/\/)?([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}(\/\S*)?$/;
189
- var INITIAL_VALUES = {
190
- hostname: ""
191
- };
192
- var CURRENT_STEP = {
193
- notAdded: 0,
194
- pending: 1,
195
- active: 2
196
- };
197
- var STEPS = [{
198
- id: 1,
199
- label: "Add domain"
200
- }, {
201
- id: 2,
202
- label: "Validate domain"
203
- }];
15
+ require('@bigbinary/neetoui/Alert');
16
+ require('react-i18next');
17
+ require('react/jsx-runtime');
18
+ require('@bigbinary/neeto-commons-frontend/constants');
19
+ require('@bigbinary/neeto-commons-frontend/utils/general');
20
+ require('@bigbinary/neeto-molecules/MoreDropdown');
21
+ require('@bigbinary/neetoui/Button');
22
+ require('@bigbinary/neetoui/Typography');
23
+ require('@bigbinary/neetoui/Tag');
24
+ require('@bigbinary/neetoui/Pane');
25
+ require('@bigbinary/neetoui/Stepper');
26
+ require('@bigbinary/neetoui/Callout');
27
+ require('@bigbinary/neetoui/formik/ActionBlock');
28
+ require('@bigbinary/neetoui/formik/Input');
29
+ require('@bigbinary/neetoui/formik/Form');
30
+ require('i18next');
31
+ require('yup');
32
+ require('@bigbinary/neetoui/Table');
33
+ require('@bigbinary/neetoui/Toastr');
34
+ require('@bigbinary/neeto-molecules/CopyToClipboardButton');
35
+ require('psl');
36
+ require('@bigbinary/neeto-molecules/Header');
37
+ require('@bigbinary/neeto-molecules/HelpPopover');
204
38
 
205
- var getCustomDomainValidationSchema = function getCustomDomainValidationSchema() {
206
- return Yup__namespace.object().shape({
207
- hostname: Yup__namespace.string().required(i18next.t("neetoCustomDomains.formikValidation.required")).matches(HOSTNAME_REGEX, i18next.t("neetoCustomDomains.formikValidation.valid"))
208
- });
209
- };
210
39
 
211
- var DomainField = function DomainField(_ref) {
212
- var customDomain = _ref.customDomain,
213
- onCreate = _ref.onCreate,
214
- url = _ref.url,
215
- onClose = _ref.onClose;
216
- var _useTranslation = reactI18next.useTranslation(),
217
- t = _useTranslation.t;
218
- var _useCreateCustomDomai = CustomDomainDashboard.useCreateCustomDomain(url),
219
- createCustomDomain = _useCreateCustomDomai.mutate,
220
- isCreating = _useCreateCustomDomai.isPending;
221
- var getHostname = function getHostname(url) {
222
- try {
223
- var parsedUrl = new URL(url);
224
- return parsedUrl.hostname;
225
- } catch (_unused) {
226
- return url;
227
- }
228
- };
229
- var handleSubmit = function handleSubmit(_ref2) {
230
- var hostname = _ref2.hostname;
231
- var parsedHostname = getHostname(hostname);
232
- var payload = {
233
- hostname: parsedHostname
234
- };
235
- createCustomDomain(payload, {
236
- onSuccess: function onSuccess(values) {
237
- onCreate === null || onCreate === void 0 ? void 0 : onCreate(values);
238
- }
239
- });
240
- };
241
- return /*#__PURE__*/jsxRuntime.jsx(FormikForm__default["default"], {
242
- className: "flex-col space-y-6",
243
- formikProps: {
244
- enableReinitialize: true,
245
- initialValues: customDomain || INITIAL_VALUES,
246
- validationSchema: getCustomDomainValidationSchema(),
247
- onSubmit: handleSubmit
248
- },
249
- children: function children(_ref3) {
250
- var dirty = _ref3.dirty;
251
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
252
- className: "w-full",
253
- children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Body, {
254
- children: /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
255
- required: true,
256
- className: "w-full",
257
- "data-cy": "custom-domain-input-field",
258
- disabled: neetoCist.isNotEmpty(customDomain),
259
- label: t("neetoCustomDomains.label"),
260
- name: "hostname",
261
- placeholder: t("neetoCustomDomains.placeholder")
262
- })
263
- }), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Footer, {
264
- children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock__default["default"], {
265
- cancelButtonProps: {
266
- onClick: onClose
267
- },
268
- isSubmitting: isCreating,
269
- submitButtonProps: {
270
- label: t("neetoCustomDomains.actions.continue"),
271
- "data-cy": "submit-custom-domain-button",
272
- "data-testid": "submit-custom-domain-button",
273
- disabled: !dirty || isCreating
274
- }
275
- })
276
- })]
277
- });
278
- }
279
- });
280
- };
281
40
 
282
- var columnData = function columnData() {
283
- return [{
284
- title: i18next.t("neetoCustomDomains.common.record"),
285
- key: "record",
286
- dataIndex: "record",
287
- width: "18%",
288
- render: function render() {
289
- return /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
290
- style: "body2",
291
- children: i18next.t("neetoCustomDomains.cname")
292
- });
293
- }
294
- }, {
295
- title: i18next.t("neetoCustomDomains.common.name"),
296
- dataIndex: "name",
297
- width: "35%",
298
- key: "name",
299
- render: function render(name, _) {
300
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
301
- className: "flex items-center justify-between gap-1",
302
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
303
- className: "min-w-0 truncate",
304
- style: "body2",
305
- children: name
306
- }), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton__default["default"], {
307
- className: "flex-shrink-0",
308
- size: "small",
309
- style: "secondary",
310
- value: name
311
- })]
312
- });
313
- }
314
- }, {
315
- title: i18next.t("neetoCustomDomains.common.value"),
316
- dataIndex: "value",
317
- width: "35%",
318
- key: "value",
319
- render: function render(value, _) {
320
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
321
- className: "flex items-center justify-between gap-1",
322
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
323
- className: "min-w-0 truncate",
324
- style: "body2",
325
- children: neetoCist.truncate(value, 20)
326
- }), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton__default["default"], {
327
- value: value,
328
- className: "flex-shrink-0",
329
- size: "small",
330
- style: "secondary"
331
- })]
332
- });
333
- }
334
- }];
335
- };
336
-
337
- var Validation = function Validation(_ref) {
338
- var customDomain = _ref.customDomain,
339
- onClose = _ref.onClose,
340
- url = _ref.url,
341
- helpDocUrl = _ref.helpDocUrl;
342
- var hostname = customDomain.hostname,
343
- dnsTarget = customDomain.dnsTarget,
344
- status = customDomain.status;
345
- var _useTranslation = reactI18next.useTranslation(),
346
- t = _useTranslation.t;
347
- var isDomainValidated = status === "active";
348
- var _useState = react.useState(""),
349
- _useState2 = _slicedToArray__default["default"](_useState, 2),
350
- errorKey = _useState2[0],
351
- setErrorKey = _useState2[1];
352
- var _useValidateDomain = CustomDomainDashboard.useValidateDomain(url, {
353
- onError: function onError(_ref2) {
354
- var response = _ref2.response;
355
- setErrorKey(response.data.error);
356
- },
357
- onSuccess: function onSuccess() {
358
- Toastr__default["default"].success(t("neetoCustomDomains.validation.successMessage"));
359
- onClose();
360
- }
361
- }),
362
- validateDomain = _useValidateDomain.mutate,
363
- isValidating = _useValidateDomain.isPending;
364
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
365
- children: [/*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Body, {
366
- className: "space-y-4",
367
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
368
- className: "space-y-2",
369
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
370
- style: "h4",
371
- weight: "medium",
372
- children: t("neetoCustomDomains.cnameRecordTitle")
373
- }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
374
- style: "body2",
375
- children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
376
- i18nKey: "neetoCustomDomains.cnameRecordInfo",
377
- components: {
378
- Link: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
379
- href: helpDocUrl,
380
- rel: "noreferrer",
381
- style: "link",
382
- target: "_blank"
383
- })
384
- },
385
- values: {
386
- proxyMessage: t("neetoCustomDomains.proxyMessage")
387
- }
388
- })
389
- })]
390
- }), /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
391
- allowRowClick: false,
392
- columnData: columnData(),
393
- rowSelection: false,
394
- rowData: [{
395
- name: psl__default["default"].parse(hostname).subdomain || hostname,
396
- value: dnsTarget
397
- }]
398
- }), neetoCist.isNotEmpty(errorKey) && /*#__PURE__*/jsxRuntime.jsx(Callout__default["default"], {
399
- style: STATUS_TAG_STYLES[status],
400
- children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
401
- style: "body2",
402
- children: t(errorKey)
403
- })
404
- })]
405
- }), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Footer, {
406
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
407
- className: "flex items-center gap-2",
408
- children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
409
- "data-cy": "validate-domain-button",
410
- disabled: isValidating || isDomainValidated,
411
- label: t("neetoCustomDomains.validation.buttonLabel.domain"),
412
- loading: isValidating,
413
- onClick: validateDomain
414
- }), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
415
- label: t("neetoCustomDomains.actions.cancel"),
416
- style: "text",
417
- onClick: onClose
418
- })]
419
- })
420
- })]
421
- });
422
- };
423
-
424
- var DomainPane = function DomainPane(_ref) {
425
- var customDomain = _ref.customDomain,
426
- isOpen = _ref.isOpen,
427
- onClose = _ref.onClose,
428
- onCreate = _ref.onCreate,
429
- url = _ref.url,
430
- isCustomDomainAdded = _ref.isCustomDomainAdded,
431
- helpDocUrl = _ref.helpDocUrl;
432
- var _useTranslation = reactI18next.useTranslation(),
433
- t = _useTranslation.t;
434
- var _customDomain$status = customDomain.status,
435
- status = _customDomain$status === void 0 ? "notAdded" : _customDomain$status;
436
- return /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"], {
437
- isOpen: isOpen,
438
- onClose: onClose,
439
- size: "large",
440
- children: [/*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Header, {
441
- className: "space-y-2",
442
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
443
- style: "h2",
444
- children: t("neetoCustomDomains.addNew")
445
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
446
- className: "-ml-2",
447
- children: /*#__PURE__*/jsxRuntime.jsx(Stepper__default["default"], {
448
- activeIndex: CURRENT_STEP[status],
449
- setActiveIndex: neetoCist.noop,
450
- steps: STEPS
451
- })
452
- })]
453
- }), isCustomDomainAdded ? /*#__PURE__*/jsxRuntime.jsx(Validation, {
454
- customDomain: customDomain,
455
- helpDocUrl: helpDocUrl,
456
- onClose: onClose,
457
- url: url
458
- }) : /*#__PURE__*/jsxRuntime.jsx(DomainField, {
459
- customDomain: customDomain,
460
- onClose: onClose,
461
- onCreate: onCreate,
462
- url: url
463
- })]
464
- });
465
- };
466
-
467
- var Header = function Header(_ref) {
468
- var openPane = _ref.openPane,
469
- breadcrumbs = _ref.breadcrumbs,
470
- isCustomDomainAdded = _ref.isCustomDomainAdded,
471
- helpDocUrl = _ref.helpDocUrl,
472
- _ref$size = _ref.size,
473
- size = _ref$size === void 0 ? "large" : _ref$size;
474
- var _useTranslation = reactI18next.useTranslation(),
475
- t = _useTranslation.t;
476
- var title = /*#__PURE__*/jsxRuntime.jsxs("div", {
477
- className: "flex items-center gap-x-2",
478
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
479
- style: "h2",
480
- children: t("neetoCustomDomains.customDomain", constants.SINGULAR)
481
- }), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
482
- description: t("neetoCustomDomains.toolTips.customDomain"),
483
- helpLinkProps: {
484
- href: helpDocUrl
485
- },
486
- popoverProps: {
487
- position: "top"
488
- },
489
- title: t("neetoCustomDomains.customDomain", constants.SINGULAR)
490
- })]
491
- });
492
- return /*#__PURE__*/jsxRuntime.jsx(NeetoHeader__default["default"], {
493
- breadcrumbs: breadcrumbs,
494
- size: size,
495
- title: title,
496
- "data-testid": "custom-domain-header",
497
- actionBlock: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
498
- "data-cy": "add-new-custom-domain-button",
499
- disabled: isCustomDomainAdded,
500
- label: t("neetoCustomDomains.actions.add", {
501
- what: t("neetoCustomDomains.customDomain", constants.SINGULAR)
502
- }),
503
- onClick: openPane
504
- })
505
- });
506
- };
507
- var Header$1 = /*#__PURE__*/react.memo(Header);
508
-
509
- var CustomDomain = function CustomDomain(_ref) {
510
- var breadcrumbs = _ref.breadcrumbs,
511
- url = _ref.url,
512
- onCreate = _ref.onCreate,
513
- helpDocUrl = _ref.helpDocUrl,
514
- headerSize = _ref.headerSize;
515
- var _useState = react.useState(false),
516
- _useState2 = _slicedToArray__default["default"](_useState, 2),
517
- isPaneOpen = _useState2[0],
518
- setIsPaneOpen = _useState2[1];
519
- var _useState3 = react.useState(false),
520
- _useState4 = _slicedToArray__default["default"](_useState3, 2),
521
- isAlertOpen = _useState4[0],
522
- setIsAlertOpen = _useState4[1];
523
- var _useFetchCustomDomain = CustomDomainDashboard.useFetchCustomDomain(url),
524
- _useFetchCustomDomain2 = _useFetchCustomDomain.data,
525
- customDomain = _useFetchCustomDomain2 === void 0 ? {} : _useFetchCustomDomain2,
526
- isLoading = _useFetchCustomDomain.isLoading;
527
- var _useDeleteCustomDomai = CustomDomainDashboard.useDeleteCustomDomain(url, {
528
- onSettled: function onSettled() {
529
- setIsAlertOpen(false);
530
- }
531
- }),
532
- deleteCustomDomain = _useDeleteCustomDomai.mutate,
533
- isDeleting = _useDeleteCustomDomai.isPending;
534
- var openPane = function openPane() {
535
- return setIsPaneOpen(true);
536
- };
537
- var closePane = function closePane() {
538
- return setIsPaneOpen(false);
539
- };
540
- var openDeleteAlert = function openDeleteAlert() {
541
- return setIsAlertOpen(true);
542
- };
543
- var isCustomDomainAdded = neetoCist.isNotEmpty(customDomain);
544
- if (isLoading) {
545
- return /*#__PURE__*/jsxRuntime.jsx("div", {
546
- className: "h-screen w-full",
547
- children: /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {})
548
- });
549
- }
550
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
551
- children: [/*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
552
- children: [/*#__PURE__*/jsxRuntime.jsx(Header$1, {
553
- breadcrumbs: breadcrumbs,
554
- helpDocUrl: helpDocUrl,
555
- isCustomDomainAdded: isCustomDomainAdded,
556
- openPane: openPane,
557
- size: headerSize
558
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
559
- className: "mt-10 flex w-full justify-center",
560
- children: /*#__PURE__*/jsxRuntime.jsx(Domain, {
561
- customDomain: customDomain,
562
- helpDocUrl: helpDocUrl,
563
- isCustomDomainAdded: isCustomDomainAdded,
564
- openDeleteAlert: openDeleteAlert,
565
- openPane: openPane
566
- })
567
- })]
568
- }), /*#__PURE__*/jsxRuntime.jsx(DomainPane, {
569
- customDomain: customDomain,
570
- helpDocUrl: helpDocUrl,
571
- isCustomDomainAdded: isCustomDomainAdded,
572
- onCreate: onCreate,
573
- url: url,
574
- isOpen: isPaneOpen,
575
- onClose: closePane
576
- }), /*#__PURE__*/jsxRuntime.jsx(DeleteAlert, {
577
- hostname: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
578
- isOpen: isAlertOpen,
579
- isSubmitting: isDeleting,
580
- onClose: function onClose() {
581
- return setIsAlertOpen(false);
582
- },
583
- onSubmit: deleteCustomDomain
584
- })]
585
- });
586
- };
587
-
588
- exports.CustomDomainDashboard = CustomDomainDashboard.CustomDomainDashboard;
589
- exports.WelcomeScreen = WelcomeScreen;
590
41
  exports.CustomDomain = CustomDomain;
42
+ exports.WelcomeScreen = WelcomeScreen;
591
43
  //# sourceMappingURL=index.js.map