@bigbinary/neeto-molecules 3.15.30 → 3.15.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,650 +0,0 @@
1
- import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
2
- import Alert from '@bigbinary/neetoui/Alert';
3
- import { Trans, useTranslation } from 'react-i18next';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import Pane from '@bigbinary/neetoui/Pane';
6
- import { n } from './inject-css-DmrvuTKK.js';
7
- import { isNotEmpty, isPresent } from '@bigbinary/neeto-cist';
8
- import Typography from '@bigbinary/neetoui/Typography';
9
- import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
10
- import Input from '@bigbinary/neetoui/formik/Input';
11
- import Form from '@bigbinary/neetoui/formik/Form';
12
- import { t } from 'i18next';
13
- import * as yup from 'yup';
14
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
15
- import { useQuery } from '@tanstack/react-query';
16
- import useMutationWithInvalidation from '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
17
- import axios from 'axios';
18
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
19
- import { useState } from 'react';
20
- import Table from '@bigbinary/neetoui/Table';
21
- import Button from '@bigbinary/neetoui/Button';
22
- import Checkbox from '@bigbinary/neetoui/Checkbox';
23
- import Callout from '@bigbinary/neetoui/Callout';
24
- import TableWrapper from './TableWrapper.js';
25
- import Stepper from '@bigbinary/neetoui/Stepper';
26
- import Tag from '@bigbinary/neetoui/Tag';
27
- import CopyToClipboardButton from './CopyToClipboardButton.js';
28
- import Toastr from '@bigbinary/neetoui/Toastr';
29
-
30
- var DeleteAlert = withT(function (_ref) {
31
- var t = _ref.t,
32
- onClose = _ref.onClose,
33
- onSubmit = _ref.onSubmit,
34
- isOpen = _ref.isOpen,
35
- isSubmitting = _ref.isSubmitting,
36
- hostname = _ref.hostname;
37
- return /*#__PURE__*/jsx(Alert, {
38
- isOpen: isOpen,
39
- isSubmitting: isSubmitting,
40
- onClose: onClose,
41
- onSubmit: onSubmit,
42
- cancelButtonLabel: t("neetoMolecules.common.actions.cancel"),
43
- submitButtonLabel: t("neetoMolecules.common.actions.delete"),
44
- title: t("neetoMolecules.customDomain.delete"),
45
- message: /*#__PURE__*/jsx(Trans, {
46
- i18nKey: "neetoMolecules.customDomain.alertMessage",
47
- values: {
48
- hostname: hostname
49
- }
50
- })
51
- });
52
- });
53
-
54
- var css = ".neeto-molecule-custom-domain-pane{width:min(90%,1280px)}";
55
- n(css,{});
56
-
57
- var HOSTNAME_REGEX = /^(https?:\/\/)?([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}(\/\S*)?$/;
58
- var INITIAL_VALUES = {
59
- hostname: ""
60
- };
61
- var STATUS_INDEX = ["pending_domain_validation", "pending_cname_validation", "active"];
62
- var DOMAIN_VALIDATION_STATUS = "pending_domain_validation";
63
- var STEPS = [{
64
- id: 1,
65
- label: "Domain validation"
66
- }, {
67
- id: 2,
68
- label: "Domain redirection"
69
- }];
70
-
71
- var getCustomDomainValidationSchema = function getCustomDomainValidationSchema() {
72
- return yup.object().shape({
73
- hostname: yup.string().required(t("neetoMolecules.customDomain.formikValidation.required")).matches(HOSTNAME_REGEX, t("neetoMolecules.customDomain.formikValidation.valid"))
74
- });
75
- };
76
-
77
- var getUrlwithId = function getUrlwithId(url, id) {
78
- return id ? "".concat(url, "/").concat(id) : url;
79
- };
80
- var fetchCustomDomains = function fetchCustomDomains(_ref) {
81
- var url = _ref.url,
82
- params = _ref.params;
83
- return axios.get(url, {
84
- params: params
85
- });
86
- };
87
- var updateCustomDomain = function updateCustomDomain(url, id) {
88
- return axios.patch(getUrlwithId(url, id));
89
- };
90
- var createCustomDomain = function createCustomDomain(url, payload) {
91
- return axios.post(url, payload);
92
- };
93
- var deleteCustomDomain = function deleteCustomDomain(url, id) {
94
- return axios["delete"](getUrlwithId(url, id));
95
- };
96
- var validateDomain = function validateDomain(url, id) {
97
- return axios.patch("".concat(getUrlwithId(url, id), "/validate_domain"), undefined, {
98
- showToastr: false
99
- });
100
- };
101
- var validateCname = function validateCname(url, id) {
102
- return axios.patch("".concat(getUrlwithId(url, id), "/validate_cname"));
103
- };
104
- var customDomainApi = {
105
- createCustomDomain: createCustomDomain,
106
- deleteCustomDomain: deleteCustomDomain,
107
- validateDomain: validateDomain,
108
- fetchCustomDomains: fetchCustomDomains,
109
- validateCname: validateCname,
110
- updateCustomDomain: updateCustomDomain
111
- };
112
-
113
- var DOMAIN_QUERY_KEY = "custom-domain";
114
- var HELP_DOC_URL = "https://help.".concat(globalProps.appName.toLowerCase(), ".com/articles/custom-domains");
115
- var DEFAULT_HELP_POPOVER_PROPS = {
116
- description: t("neetoMolecules.customDomain.description")
117
- };
118
-
119
- 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; }
120
- 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; }
121
- var useCreateCustomDomain = function useCreateCustomDomain(url) {
122
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
123
- return useMutationWithInvalidation(function (payload) {
124
- return customDomainApi.createCustomDomain(url, payload);
125
- }, _objectSpread$2({
126
- keysToInvalidate: [[DOMAIN_QUERY_KEY]]
127
- }, options));
128
- };
129
- var useDeleteCustomDomain = function useDeleteCustomDomain(url) {
130
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
131
- return useMutationWithInvalidation(function (id) {
132
- return customDomainApi.deleteCustomDomain(url, id);
133
- }, _objectSpread$2({
134
- keysToInvalidate: [[DOMAIN_QUERY_KEY]]
135
- }, options));
136
- };
137
- var useFetchCustomDomains = function useFetchCustomDomains(params) {
138
- return useQuery({
139
- queryKey: [DOMAIN_QUERY_KEY, _objectSpread$2({}, params)],
140
- queryFn: function queryFn() {
141
- return customDomainApi.fetchCustomDomains(params);
142
- }
143
- });
144
- };
145
- var useValidateDomain = function useValidateDomain(url) {
146
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
147
- return useMutationWithInvalidation(function (id) {
148
- return customDomainApi.validateDomain(url, id);
149
- }, _objectSpread$2({
150
- keysToInvalidate: [[DOMAIN_QUERY_KEY]]
151
- }, options));
152
- };
153
- var useUpdateCustomDomain = function useUpdateCustomDomain(url) {
154
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
155
- return useMutationWithInvalidation(function (id) {
156
- return customDomainApi.updateCustomDomain(url, id);
157
- }, _objectSpread$2({
158
- keysToInvalidate: [[DOMAIN_QUERY_KEY]]
159
- }, options));
160
- };
161
-
162
- var DomainField = function DomainField(_ref) {
163
- var customDomain = _ref.customDomain,
164
- onCreate = _ref.onCreate,
165
- url = _ref.url,
166
- setCustomDomain = _ref.setCustomDomain,
167
- onClose = _ref.onClose;
168
- var _useTranslation = useTranslation(),
169
- t = _useTranslation.t;
170
- var _useCreateCustomDomai = useCreateCustomDomain(url),
171
- createCustomDomain = _useCreateCustomDomai.mutate,
172
- isCreating = _useCreateCustomDomai.isPending;
173
- var getHostname = function getHostname(url) {
174
- try {
175
- var parsedUrl = new URL(url);
176
- return parsedUrl.hostname;
177
- } catch (_unused) {
178
- return url;
179
- }
180
- };
181
- var handleSubmit = function handleSubmit(_ref2) {
182
- var hostname = _ref2.hostname;
183
- var parsedHostname = getHostname(hostname);
184
- var payload = {
185
- hostname: parsedHostname
186
- };
187
- createCustomDomain(payload, {
188
- onSuccess: function onSuccess(values) {
189
- setCustomDomain(values);
190
- onCreate === null || onCreate === void 0 || onCreate(values);
191
- }
192
- });
193
- };
194
- return /*#__PURE__*/jsxs(Fragment, {
195
- children: [/*#__PURE__*/jsx(Pane.Header, {
196
- children: /*#__PURE__*/jsx(Typography, {
197
- style: "h2",
198
- children: t("neetoMolecules.customDomain.addNew")
199
- })
200
- }), /*#__PURE__*/jsx(Form, {
201
- className: "flex-col space-y-6",
202
- formikProps: {
203
- enableReinitialize: true,
204
- initialValues: customDomain || INITIAL_VALUES,
205
- validationSchema: getCustomDomainValidationSchema(),
206
- onSubmit: handleSubmit
207
- },
208
- children: function children(_ref3) {
209
- var dirty = _ref3.dirty;
210
- return /*#__PURE__*/jsxs("div", {
211
- className: "w-full",
212
- children: [/*#__PURE__*/jsx(Pane.Body, {
213
- children: /*#__PURE__*/jsx(Input, {
214
- required: true,
215
- className: "w-full",
216
- "data-cy": "custom-domain-input-field",
217
- disabled: isNotEmpty(customDomain),
218
- label: t("neetoMolecules.customDomain.label"),
219
- name: "hostname",
220
- placeholder: t("neetoMolecules.customDomain.placeholder")
221
- })
222
- }), /*#__PURE__*/jsx(Pane.Footer, {
223
- children: /*#__PURE__*/jsx(ActionBlock, {
224
- cancelButtonProps: {
225
- onClick: onClose
226
- },
227
- isSubmitting: isCreating,
228
- submitButtonProps: {
229
- label: t("neetoMolecules.common.actions.continue"),
230
- "data-cy": "submit-custom-domain-button",
231
- "data-testid": "submit-custom-domain-button",
232
- disabled: !dirty || isCreating
233
- }
234
- })
235
- })]
236
- });
237
- }
238
- })]
239
- });
240
- };
241
-
242
- var Common = withT(function (_ref) {
243
- var t = _ref.t,
244
- currentStep = _ref.currentStep,
245
- handleStepChange = _ref.handleStepChange,
246
- hostname = _ref.hostname;
247
- return /*#__PURE__*/jsxs("div", {
248
- className: "mb-6 w-full space-y-6",
249
- children: [/*#__PURE__*/jsx("div", {
250
- className: "-ml-2",
251
- children: /*#__PURE__*/jsx(Stepper, {
252
- activeIndex: currentStep,
253
- setActiveIndex: handleStepChange,
254
- steps: STEPS
255
- })
256
- }), /*#__PURE__*/jsxs("div", {
257
- className: "space-y-1",
258
- children: [/*#__PURE__*/jsx(Typography, {
259
- style: "h4",
260
- children: t("neetoMolecules.customDomain.yourDomain")
261
- }), /*#__PURE__*/jsx(Typography, {
262
- style: "body1",
263
- children: hostname
264
- })]
265
- })]
266
- });
267
- });
268
-
269
- var columnData = function columnData() {
270
- return [{
271
- title: t("neetoMolecules.common.record"),
272
- key: "record",
273
- dataIndex: "record",
274
- width: 150,
275
- render: function render() {
276
- return /*#__PURE__*/jsx(Typography, {
277
- style: "body2",
278
- children: t("neetoMolecules.customDomain.cname")
279
- });
280
- }
281
- }, {
282
- title: t("neetoMolecules.common.name"),
283
- dataIndex: "name",
284
- key: "name",
285
- render: function render(name, _) {
286
- return /*#__PURE__*/jsxs("div", {
287
- className: "flex items-center justify-between gap-1",
288
- children: [/*#__PURE__*/jsx(Typography, {
289
- className: "min-w-0 truncate",
290
- style: "body2",
291
- children: name
292
- }), /*#__PURE__*/jsx(CopyToClipboardButton, {
293
- className: "flex-shrink-0",
294
- size: "small",
295
- style: "secondary",
296
- value: name
297
- })]
298
- });
299
- }
300
- }, {
301
- title: t("neetoMolecules.common.value"),
302
- dataIndex: "value",
303
- key: "value",
304
- render: function render(value, _) {
305
- return /*#__PURE__*/jsxs("div", {
306
- className: "flex items-center justify-between gap-1",
307
- children: [/*#__PURE__*/jsx(Typography, {
308
- className: "min-w-0 truncate",
309
- style: "body2",
310
- children: value
311
- }), /*#__PURE__*/jsx(CopyToClipboardButton, {
312
- value: value,
313
- className: "flex-shrink-0",
314
- size: "small",
315
- style: "secondary"
316
- })]
317
- });
318
- }
319
- }, {
320
- title: t("neetoMolecules.common.status"),
321
- dataIndex: "status",
322
- key: "status",
323
- width: 150,
324
- render: function render(status) {
325
- return /*#__PURE__*/jsx(Tag, {
326
- label: t("neetoMolecules.common.".concat(status)),
327
- style: status === "success" ? "success" : "warning"
328
- });
329
- }
330
- }];
331
- };
332
-
333
- var Redirection = function Redirection(_ref) {
334
- var customDomain = _ref.customDomain,
335
- onClose = _ref.onClose,
336
- setCustomDomain = _ref.setCustomDomain,
337
- url = _ref.url,
338
- currentStep = _ref.currentStep,
339
- handleStepChange = _ref.handleStepChange,
340
- incrementStep = _ref.incrementStep,
341
- hasOne = _ref.hasOne;
342
- var _useTranslation = useTranslation(),
343
- t = _useTranslation.t;
344
- var id = customDomain.id,
345
- hostname = customDomain.hostname,
346
- dnsTarget = customDomain.dnsTarget,
347
- addedCnameAt = customDomain.addedCnameAt,
348
- status = customDomain.status;
349
- var cnameAdded = isPresent(addedCnameAt);
350
- var customDomainId = hasOne ? null : id;
351
- var _useState = useState(cnameAdded),
352
- _useState2 = _slicedToArray(_useState, 2),
353
- addedRedirectionCname = _useState2[0],
354
- setAddedRedirectionCname = _useState2[1];
355
- var _useUpdateCustomDomai = useUpdateCustomDomain(url),
356
- updateCustomDomain = _useUpdateCustomDomai.mutate,
357
- isUpdating = _useUpdateCustomDomai.isPending;
358
- var handleUpdateCname = function handleUpdateCname() {
359
- addedRedirectionCname && updateCustomDomain(customDomainId, {
360
- onSuccess: function onSuccess(data) {
361
- incrementStep();
362
- setCustomDomain(data);
363
- }
364
- });
365
- };
366
- return /*#__PURE__*/jsxs(Fragment, {
367
- children: [/*#__PURE__*/jsxs(Pane.Body, {
368
- children: [/*#__PURE__*/jsx(Common, {
369
- currentStep: currentStep,
370
- handleStepChange: handleStepChange,
371
- hostname: hostname
372
- }), /*#__PURE__*/jsxs("div", {
373
- className: "mb-6 w-full space-y-6",
374
- children: [/*#__PURE__*/jsxs("div", {
375
- className: "space-y-1",
376
- children: [/*#__PURE__*/jsx(Typography, {
377
- style: "h4",
378
- children: t("neetoMolecules.customDomain.domainRedirection")
379
- }), /*#__PURE__*/jsx(Typography, {
380
- style: "body2",
381
- children: /*#__PURE__*/jsx(Trans, {
382
- i18nKey: "neetoMolecules.customDomain.cnameRecordInfo",
383
- components: {
384
- Link: /*#__PURE__*/jsx(Button, {
385
- href: HELP_DOC_URL,
386
- rel: "noreferrer",
387
- style: "link",
388
- target: "_blank"
389
- })
390
- }
391
- })
392
- })]
393
- }), /*#__PURE__*/jsx(TableWrapper, {
394
- className: "pb-0",
395
- children: /*#__PURE__*/jsx(Table, {
396
- allowRowClick: false,
397
- columnData: columnData(),
398
- rowSelection: false,
399
- rowData: [{
400
- id: hostname,
401
- name: hostname,
402
- value: dnsTarget,
403
- status: status === "active" ? "success" : "pending"
404
- }]
405
- })
406
- }), /*#__PURE__*/jsx(Checkbox, {
407
- checked: addedRedirectionCname,
408
- "data-testid": "cname-added-custom-domain-checkbox",
409
- disabled: cnameAdded,
410
- label: t("neetoMolecules.customDomain.cnameAdded"),
411
- onChange: function onChange() {
412
- return setAddedRedirectionCname(function (value) {
413
- return !value;
414
- });
415
- }
416
- })]
417
- }), cnameAdded && /*#__PURE__*/jsx(Callout, {
418
- style: "warning",
419
- children: /*#__PURE__*/jsx(Typography, {
420
- style: "body2",
421
- children: /*#__PURE__*/jsx(Trans, {
422
- i18nKey: "neetoMolecules.customDomain.domainRedirectionInfo",
423
- values: {
424
- hostname: hostname
425
- },
426
- components: {
427
- Link: /*#__PURE__*/jsx(Button, {
428
- href: HELP_DOC_URL,
429
- rel: "noreferrer",
430
- style: "link",
431
- target: "_blank"
432
- })
433
- }
434
- })
435
- })
436
- })]
437
- }), /*#__PURE__*/jsx(Pane.Footer, {
438
- children: /*#__PURE__*/jsxs("div", {
439
- className: "flex items-center gap-2",
440
- children: [status !== "active" ? /*#__PURE__*/jsx(Button, {
441
- disabled: isUpdating || !addedRedirectionCname,
442
- label: t("neetoMolecules.common.actions.continue"),
443
- loading: isUpdating,
444
- onClick: handleUpdateCname
445
- }) : /*#__PURE__*/jsx(Button, {
446
- label: t("neetoMolecules.common.actions.done"),
447
- onClick: onClose
448
- }), /*#__PURE__*/jsx(Button, {
449
- label: t("neetoMolecules.common.actions.cancel"),
450
- style: "text",
451
- onClick: onClose
452
- })]
453
- })
454
- })]
455
- });
456
- };
457
-
458
- 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; }
459
- 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; }
460
- var Validation = function Validation(_ref) {
461
- var _cnameValidationParam;
462
- var customDomain = _ref.customDomain,
463
- onClose = _ref.onClose,
464
- setCustomDomain = _ref.setCustomDomain,
465
- url = _ref.url,
466
- currentStep = _ref.currentStep,
467
- handleStepChange = _ref.handleStepChange,
468
- incrementStep = _ref.incrementStep,
469
- hasOne = _ref.hasOne;
470
- var _useTranslation = useTranslation(),
471
- t = _useTranslation.t;
472
- var id = customDomain.id,
473
- hostname = customDomain.hostname,
474
- cnameValidationParams = customDomain.cnameValidationParams,
475
- status = customDomain.status;
476
- var isDomainValidated = status !== "pending_domain_validation";
477
- var customDomainId = hasOne ? null : id;
478
- var _useState = useState(false),
479
- _useState2 = _slicedToArray(_useState, 2),
480
- showValidationWarning = _useState2[0],
481
- setShowValidationWarning = _useState2[1];
482
- var _useValidateDomain = useValidateDomain(url),
483
- validateDomain = _useValidateDomain.mutate,
484
- isValidating = _useValidateDomain.isPending;
485
- var handleValidateDomain = function handleValidateDomain() {
486
- return validateDomain(customDomainId, {
487
- onError: function onError() {
488
- setShowValidationWarning(true);
489
- },
490
- onSuccess: function onSuccess(values) {
491
- Toastr.success(t("neetoMolecules.customDomain.validation.successMessage"));
492
- incrementStep();
493
- setCustomDomain(values);
494
- }
495
- });
496
- };
497
- return /*#__PURE__*/jsxs(Fragment, {
498
- children: [/*#__PURE__*/jsxs(Pane.Body, {
499
- children: [/*#__PURE__*/jsx(Common, {
500
- currentStep: currentStep,
501
- handleStepChange: handleStepChange,
502
- hostname: hostname
503
- }), /*#__PURE__*/jsxs("div", {
504
- className: "mb-6 w-full space-y-6",
505
- children: [/*#__PURE__*/jsxs("div", {
506
- className: "space-y-1",
507
- children: [/*#__PURE__*/jsx(Typography, {
508
- style: "h4",
509
- children: t("neetoMolecules.customDomain.domainValidation")
510
- }), /*#__PURE__*/jsx(Typography, {
511
- style: "body2",
512
- children: /*#__PURE__*/jsx(Trans, {
513
- i18nKey: "neetoMolecules.customDomain.cnameRecordInfo",
514
- components: {
515
- Link: /*#__PURE__*/jsx(Button, {
516
- href: HELP_DOC_URL,
517
- rel: "noreferrer",
518
- style: "link",
519
- target: "_blank"
520
- })
521
- },
522
- values: {
523
- proxyMessage: t("neetoMolecules.customDomain.proxyMessage")
524
- }
525
- })
526
- })]
527
- }), /*#__PURE__*/jsx(TableWrapper, {
528
- className: "pb-0",
529
- children: /*#__PURE__*/jsx(Table, {
530
- allowRowClick: false,
531
- columnData: columnData(),
532
- enableColumnFreeze: false,
533
- rowSelection: false,
534
- rowData: [_objectSpread$1(_objectSpread$1({}, cnameValidationParams), {}, {
535
- id: (_cnameValidationParam = cnameValidationParams.id) !== null && _cnameValidationParam !== void 0 ? _cnameValidationParam : cnameValidationParams.value,
536
- status: isDomainValidated ? "success" : "pending"
537
- })]
538
- })
539
- })]
540
- }), showValidationWarning && /*#__PURE__*/jsx(Callout, {
541
- style: "warning",
542
- children: /*#__PURE__*/jsx(Typography, {
543
- style: "body2",
544
- children: /*#__PURE__*/jsx(Trans, {
545
- i18nKey: "neetoMolecules.customDomain.domainValidationInfo",
546
- components: {
547
- Link: /*#__PURE__*/jsx(Button, {
548
- href: HELP_DOC_URL,
549
- rel: "noreferrer",
550
- style: "link",
551
- target: "_blank"
552
- })
553
- }
554
- })
555
- })
556
- })]
557
- }), /*#__PURE__*/jsx(Pane.Footer, {
558
- children: /*#__PURE__*/jsxs("div", {
559
- className: "flex items-center gap-2",
560
- children: [/*#__PURE__*/jsx(Button, {
561
- disabled: isValidating,
562
- loading: isValidating,
563
- "data-cy": isDomainValidated ? "continue-button" : "validate-domain-button",
564
- label: isDomainValidated ? t("neetoMolecules.common.actions.continue") : t("neetoMolecules.customDomain.validation.buttonLabel.domain"),
565
- onClick: isDomainValidated ? incrementStep : handleValidateDomain
566
- }), /*#__PURE__*/jsx(Button, {
567
- label: t("neetoMolecules.common.actions.cancel"),
568
- style: "text",
569
- onClick: onClose
570
- })]
571
- })
572
- })]
573
- });
574
- };
575
-
576
- 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; }
577
- 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; }
578
- var Settings = function Settings(_ref) {
579
- var customDomain = _ref.customDomain,
580
- url = _ref.url,
581
- onClose = _ref.onClose,
582
- setCustomDomain = _ref.setCustomDomain,
583
- hasOne = _ref.hasOne;
584
- var _useTranslation = useTranslation(),
585
- t = _useTranslation.t;
586
- var status = customDomain.status;
587
- var _useState = useState(STATUS_INDEX.indexOf(status)),
588
- _useState2 = _slicedToArray(_useState, 2),
589
- currentStep = _useState2[0],
590
- setCurrentStep = _useState2[1];
591
- var isNotValidationStep = STATUS_INDEX[currentStep] !== DOMAIN_VALIDATION_STATUS;
592
- var handleStepChange = function handleStepChange(index) {
593
- status !== DOMAIN_VALIDATION_STATUS && setCurrentStep(index);
594
- };
595
- var incrementStep = function incrementStep() {
596
- return setCurrentStep(function (step) {
597
- return step + 1;
598
- });
599
- };
600
- var recordProps = {
601
- currentStep: currentStep,
602
- customDomain: customDomain,
603
- handleStepChange: handleStepChange,
604
- onClose: onClose,
605
- setCustomDomain: setCustomDomain,
606
- url: url,
607
- incrementStep: incrementStep,
608
- hasOne: hasOne
609
- };
610
- return /*#__PURE__*/jsxs(Fragment, {
611
- children: [/*#__PURE__*/jsx(Pane.Header, {
612
- children: /*#__PURE__*/jsx(Typography, {
613
- style: "h2",
614
- children: t("neetoMolecules.customDomain.settings")
615
- })
616
- }), isNotValidationStep ? /*#__PURE__*/jsx(Redirection, _objectSpread({}, recordProps)) : /*#__PURE__*/jsx(Validation, _objectSpread({}, recordProps))]
617
- });
618
- };
619
-
620
- var Manage = function Manage(_ref) {
621
- var isOpen = _ref.isOpen,
622
- onClose = _ref.onClose,
623
- customDomain = _ref.customDomain,
624
- setCustomDomain = _ref.setCustomDomain,
625
- url = _ref.url,
626
- hasOne = _ref.hasOne,
627
- onCreate = _ref.onCreate;
628
- return /*#__PURE__*/jsx(Pane, {
629
- isOpen: isOpen,
630
- onClose: onClose,
631
- className: "neeto-molecule-custom-domain-pane",
632
- size: "large",
633
- children: customDomain !== null && customDomain !== void 0 && customDomain.id ? /*#__PURE__*/jsx(Settings, {
634
- customDomain: customDomain,
635
- hasOne: hasOne,
636
- onClose: onClose,
637
- setCustomDomain: setCustomDomain,
638
- url: url
639
- }) : /*#__PURE__*/jsx(DomainField, {
640
- customDomain: customDomain,
641
- onClose: onClose,
642
- onCreate: onCreate,
643
- setCustomDomain: setCustomDomain,
644
- url: url
645
- })
646
- });
647
- };
648
-
649
- export { DeleteAlert as D, Manage as M, useDeleteCustomDomain as a, DEFAULT_HELP_POPOVER_PROPS as b, useFetchCustomDomains as u };
650
- //# sourceMappingURL=index-7O-LlcxR.js.map