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