@bigbinary/neeto-custom-domains-frontend 3.0.10 → 3.1.1
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/app/javascript/src/translations/de.json +96 -0
- package/app/javascript/src/translations/en.json +10 -1
- package/app/javascript/src/translations/es.json +96 -0
- package/app/javascript/src/translations/fr.json +96 -0
- package/dist/CustomDomain.js +446 -183
- package/dist/CustomDomain.js.map +1 -1
- package/dist/cjs/CustomDomain.js +444 -181
- package/dist/cjs/CustomDomain.js.map +1 -1
- package/dist/cjs/index.js +6 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/CustomDomain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import { useState, memo } from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { createElement, useState, useEffect, memo } from 'react';
|
|
3
|
+
import { isPresent, truncate, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
4
4
|
import { withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
5
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
6
6
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
@@ -12,34 +12,35 @@ import Alert from '@bigbinary/neetoui/Alert';
|
|
|
12
12
|
import { Trans, useTranslation } from 'react-i18next';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
import { SINGULAR } from '@bigbinary/neeto-commons-frontend/constants';
|
|
15
|
-
import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
|
|
16
15
|
import { hyphenize } from '@bigbinary/neeto-commons-frontend/utils/general';
|
|
16
|
+
import Redirection from '@bigbinary/neeto-icons/Redirection';
|
|
17
|
+
import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
|
|
17
18
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
18
19
|
import Button from '@bigbinary/neetoui/Button';
|
|
19
20
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
20
21
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
21
22
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
23
|
+
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
22
24
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
23
25
|
import Stepper from '@bigbinary/neetoui/Stepper';
|
|
24
26
|
import Callout from '@bigbinary/neetoui/Callout';
|
|
25
27
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
26
28
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
27
|
-
import
|
|
29
|
+
import Form from '@bigbinary/neetoui/formik/Form';
|
|
30
|
+
import Radio from '@bigbinary/neetoui/formik/Radio';
|
|
28
31
|
import { t } from 'i18next';
|
|
32
|
+
import psl from 'psl';
|
|
33
|
+
import { isNil } from 'ramda';
|
|
29
34
|
import * as Yup from 'yup';
|
|
30
35
|
import Table from '@bigbinary/neetoui/Table';
|
|
31
36
|
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
32
|
-
import { isNil } from 'ramda';
|
|
33
37
|
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
34
|
-
import psl from 'psl';
|
|
35
38
|
import NeetoHeader from '@bigbinary/neeto-molecules/Header';
|
|
36
39
|
|
|
37
40
|
var getUrlwithId = function getUrlwithId(url, id) {
|
|
38
41
|
return id ? "".concat(url, "/").concat(id) : url;
|
|
39
42
|
};
|
|
40
|
-
var fetchCustomDomain =
|
|
41
|
-
return axios.get(url);
|
|
42
|
-
};
|
|
43
|
+
var fetchCustomDomain = axios.get;
|
|
43
44
|
var updateCustomDomain = function updateCustomDomain(url, id) {
|
|
44
45
|
return axios.patch(getUrlwithId(url, id));
|
|
45
46
|
};
|
|
@@ -48,8 +49,8 @@ var createCustomDomain = function createCustomDomain(url, payload) {
|
|
|
48
49
|
showToastr: false
|
|
49
50
|
});
|
|
50
51
|
};
|
|
51
|
-
var deleteCustomDomain = function deleteCustomDomain(url) {
|
|
52
|
-
return axios["delete"](getUrlwithId(url));
|
|
52
|
+
var deleteCustomDomain = function deleteCustomDomain(url, hostname) {
|
|
53
|
+
return axios["delete"](getUrlwithId(url, hostname));
|
|
53
54
|
};
|
|
54
55
|
var validateDomain = function validateDomain(url) {
|
|
55
56
|
return axios.patch("".concat(url, "/validate_domain"), undefined, {
|
|
@@ -70,27 +71,27 @@ var domainsApi = {
|
|
|
70
71
|
|
|
71
72
|
var DOMAIN_QUERY_KEY = "custom-domain";
|
|
72
73
|
|
|
73
|
-
function ownKeys$
|
|
74
|
-
function _objectSpread$
|
|
74
|
+
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; }
|
|
75
|
+
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; }
|
|
75
76
|
var useCreateCustomDomain = function useCreateCustomDomain(url) {
|
|
76
77
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
77
78
|
return useMutationWithInvalidation(function (payload) {
|
|
78
79
|
return domainsApi.createCustomDomain(url, payload);
|
|
79
|
-
}, _objectSpread$
|
|
80
|
+
}, _objectSpread$2({
|
|
80
81
|
keysToInvalidate: [[DOMAIN_QUERY_KEY]]
|
|
81
82
|
}, options));
|
|
82
83
|
};
|
|
83
|
-
var useDeleteCustomDomain = function useDeleteCustomDomain(url) {
|
|
84
|
-
var options = arguments.length >
|
|
85
|
-
return useMutationWithInvalidation(function (
|
|
86
|
-
return domainsApi.deleteCustomDomain(url,
|
|
87
|
-
}, _objectSpread$
|
|
84
|
+
var useDeleteCustomDomain = function useDeleteCustomDomain(url, hostname) {
|
|
85
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
86
|
+
return useMutationWithInvalidation(function () {
|
|
87
|
+
return domainsApi.deleteCustomDomain(url, hostname);
|
|
88
|
+
}, _objectSpread$2({
|
|
88
89
|
keysToInvalidate: [[DOMAIN_QUERY_KEY]]
|
|
89
90
|
}, options));
|
|
90
91
|
};
|
|
91
92
|
var useFetchCustomDomain = function useFetchCustomDomain(params) {
|
|
92
93
|
return useQuery({
|
|
93
|
-
queryKey: [DOMAIN_QUERY_KEY, _objectSpread$
|
|
94
|
+
queryKey: [DOMAIN_QUERY_KEY, _objectSpread$2({}, params)],
|
|
94
95
|
queryFn: function queryFn() {
|
|
95
96
|
return domainsApi.fetchCustomDomain(params);
|
|
96
97
|
},
|
|
@@ -107,7 +108,7 @@ var useValidateDomain = function useValidateDomain(url) {
|
|
|
107
108
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
108
109
|
return useMutationWithInvalidation(function () {
|
|
109
110
|
return domainsApi.validateDomain(url);
|
|
110
|
-
}, _objectSpread$
|
|
111
|
+
}, _objectSpread$2({
|
|
111
112
|
keysToInvalidate: [[DOMAIN_QUERY_KEY]]
|
|
112
113
|
}, options));
|
|
113
114
|
};
|
|
@@ -142,51 +143,81 @@ var STATUS_TAG_STYLES = {
|
|
|
142
143
|
failed: "danger"
|
|
143
144
|
};
|
|
144
145
|
|
|
145
|
-
var Domain =
|
|
146
|
-
var
|
|
147
|
-
isCustomDomainAdded = _ref.isCustomDomainAdded,
|
|
146
|
+
var Domain = function Domain(_ref) {
|
|
147
|
+
var isCustomDomainAdded = _ref.isCustomDomainAdded,
|
|
148
148
|
openPane = _ref.openPane,
|
|
149
|
-
|
|
149
|
+
customDomains = _ref.customDomains,
|
|
150
150
|
openDeleteAlert = _ref.openDeleteAlert,
|
|
151
|
-
helpDocUrl = _ref.helpDocUrl
|
|
151
|
+
helpDocUrl = _ref.helpDocUrl,
|
|
152
|
+
setSelectedCustomDomain = _ref.setSelectedCustomDomain;
|
|
153
|
+
var _useTranslation = useTranslation(),
|
|
154
|
+
t = _useTranslation.t;
|
|
155
|
+
var handleEditClick = function handleEditClick(customDomain) {
|
|
156
|
+
setSelectedCustomDomain(customDomain);
|
|
157
|
+
openPane();
|
|
158
|
+
};
|
|
159
|
+
var handleDeleteClick = function handleDeleteClick(customDomain) {
|
|
160
|
+
setSelectedCustomDomain(customDomain);
|
|
161
|
+
openDeleteAlert();
|
|
162
|
+
};
|
|
152
163
|
return isCustomDomainAdded ? /*#__PURE__*/jsx(CardLayout, {
|
|
153
164
|
title: t("neetoCustomDomains.connectionTitle"),
|
|
154
165
|
children: /*#__PURE__*/jsxs("div", {
|
|
155
166
|
className: "space-y-1",
|
|
156
|
-
children: [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
className: "flex items-center
|
|
160
|
-
children: [/*#__PURE__*/
|
|
161
|
-
|
|
162
|
-
children:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
children: [customDomains === null || customDomains === void 0 ? void 0 : customDomains.map(function (customDomain, index) {
|
|
168
|
+
var _customDomain$redirec, _customDomain$redirec2;
|
|
169
|
+
return /*#__PURE__*/jsxs("div", {
|
|
170
|
+
className: "neeto-ui-border-gray-200 neeto-ui-rounded neeto-ui-bg-gray-50 flex items-center justify-between border p-2",
|
|
171
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
172
|
+
className: "flex items-center space-x-2",
|
|
173
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
174
|
+
style: "body2",
|
|
175
|
+
children: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname
|
|
176
|
+
}), /*#__PURE__*/jsx(Tag, {
|
|
177
|
+
"data-cy": "".concat(hyphenize(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status), "-tag-container"),
|
|
178
|
+
style: STATUS_TAG_STYLES[customDomain === null || customDomain === void 0 ? void 0 : customDomain.status],
|
|
179
|
+
label: t("neetoCustomDomains.status.domain.".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status))
|
|
180
|
+
})]
|
|
181
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
182
|
+
className: "flex items-center gap-2",
|
|
183
|
+
children: [(customDomain === null || customDomain === void 0 ? void 0 : customDomain.redirection) && /*#__PURE__*/jsx(Tooltip, {
|
|
184
|
+
content: t("neetoCustomDomains.redirectionTooltipDescription", {
|
|
185
|
+
fromDomain: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
|
|
186
|
+
toDomain: customDomain === null || customDomain === void 0 || (_customDomain$redirec = customDomain.redirection) === null || _customDomain$redirec === void 0 ? void 0 : _customDomain$redirec.toHostname
|
|
187
|
+
}),
|
|
188
|
+
children: /*#__PURE__*/jsx(Tag, {
|
|
189
|
+
icon: Redirection,
|
|
190
|
+
label: customDomain === null || customDomain === void 0 || (_customDomain$redirec2 = customDomain.redirection) === null || _customDomain$redirec2 === void 0 ? void 0 : _customDomain$redirec2.toHostname,
|
|
191
|
+
style: "secondary"
|
|
192
|
+
})
|
|
193
|
+
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
194
|
+
dropdownButtonProps: {
|
|
195
|
+
"data-testid": "nui-dropdown-icon-".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id),
|
|
196
|
+
"data-cy": "custom-domains-more-dropdown-button"
|
|
197
|
+
},
|
|
198
|
+
dropdownProps: {
|
|
199
|
+
position: "bottom-end",
|
|
200
|
+
strategy: "fixed",
|
|
201
|
+
autoWidth: true
|
|
202
|
+
},
|
|
203
|
+
menuItems: [{
|
|
204
|
+
label: t("neetoCustomDomains.actions.edit"),
|
|
205
|
+
onClick: function onClick() {
|
|
206
|
+
return handleEditClick(customDomain);
|
|
207
|
+
},
|
|
208
|
+
key: "edit-custom-domain-button",
|
|
209
|
+
"data-cy": "edit-custom-domain-button"
|
|
210
|
+
}, {
|
|
211
|
+
label: t("neetoCustomDomains.actions.delete"),
|
|
212
|
+
onClick: function onClick() {
|
|
213
|
+
return handleDeleteClick(customDomain);
|
|
214
|
+
},
|
|
215
|
+
key: "delete-custom-domain",
|
|
216
|
+
"data-cy": "delete-custom-domain-button"
|
|
217
|
+
}]
|
|
218
|
+
})]
|
|
167
219
|
})]
|
|
168
|
-
}
|
|
169
|
-
dropdownButtonProps: {
|
|
170
|
-
"data-testid": "nui-dropdown-icon-".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id),
|
|
171
|
-
"data-cy": "custom-domains-more-dropdown-button"
|
|
172
|
-
},
|
|
173
|
-
dropdownProps: {
|
|
174
|
-
position: "bottom-end",
|
|
175
|
-
strategy: "fixed",
|
|
176
|
-
autoWidth: true
|
|
177
|
-
},
|
|
178
|
-
menuItems: [{
|
|
179
|
-
label: t("neetoCustomDomains.actions.edit"),
|
|
180
|
-
onClick: openPane,
|
|
181
|
-
key: "edit-custom-domain-button",
|
|
182
|
-
"data-cy": "edit-custom-domain-button"
|
|
183
|
-
}, {
|
|
184
|
-
label: t("neetoCustomDomains.actions.delete"),
|
|
185
|
-
onClick: openDeleteAlert,
|
|
186
|
-
key: "delete-custom-domain",
|
|
187
|
-
"data-cy": "delete-custom-domain-button"
|
|
188
|
-
}]
|
|
189
|
-
})]
|
|
220
|
+
}, index);
|
|
190
221
|
}), /*#__PURE__*/jsx(Typography, {
|
|
191
222
|
style: "body2",
|
|
192
223
|
children: /*#__PURE__*/jsx(Trans, {
|
|
@@ -225,7 +256,7 @@ var Domain = withT(function (_ref) {
|
|
|
225
256
|
}
|
|
226
257
|
})
|
|
227
258
|
});
|
|
228
|
-
}
|
|
259
|
+
};
|
|
229
260
|
|
|
230
261
|
var HOSTNAME_REGEX = /^(https?:\/\/)?([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}(\/\S*)?$/;
|
|
231
262
|
var INITIAL_VALUES = {
|
|
@@ -233,38 +264,157 @@ var INITIAL_VALUES = {
|
|
|
233
264
|
};
|
|
234
265
|
var CURRENT_STEP = {
|
|
235
266
|
notAdded: 0,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
267
|
+
strategy: 1,
|
|
268
|
+
pending: 2,
|
|
269
|
+
failed: 2,
|
|
270
|
+
active: 3
|
|
239
271
|
};
|
|
240
272
|
var STEPS = [{
|
|
241
273
|
id: 1,
|
|
242
274
|
label: "Add domain"
|
|
243
275
|
}, {
|
|
244
276
|
id: 2,
|
|
277
|
+
label: "Strategy"
|
|
278
|
+
}, {
|
|
279
|
+
id: 3,
|
|
245
280
|
label: "Validate domain"
|
|
246
281
|
}];
|
|
282
|
+
var STRATEGY_INITIAL_VALUES = {
|
|
283
|
+
strategy: "rootToWww"
|
|
284
|
+
};
|
|
247
285
|
|
|
286
|
+
var isRootLevelDomain = function isRootLevelDomain(hostname) {
|
|
287
|
+
return isNil(psl.parse(hostname).subdomain);
|
|
288
|
+
};
|
|
248
289
|
var getCustomDomainValidationSchema = function getCustomDomainValidationSchema() {
|
|
249
290
|
return Yup.object().shape({
|
|
250
291
|
hostname: Yup.string().required(t("neetoCustomDomains.formikValidation.required")).matches(HOSTNAME_REGEX, t("neetoCustomDomains.formikValidation.valid"))
|
|
251
292
|
});
|
|
252
293
|
};
|
|
294
|
+
var strategyValidationSchema = Yup.object().shape({
|
|
295
|
+
strategy: Yup.string().required()
|
|
296
|
+
});
|
|
297
|
+
var strategyOptions = [{
|
|
298
|
+
value: "rootToWww",
|
|
299
|
+
label: "neetoCustomDomains.validation.strategy.rootToWww",
|
|
300
|
+
additionalLabelContent: /*#__PURE__*/jsx(Tooltip, {
|
|
301
|
+
content: t("neetoCustomDomains.validation.strategy.recommendedDescription"),
|
|
302
|
+
children: /*#__PURE__*/jsx(Tag, {
|
|
303
|
+
label: t("neetoCustomDomains.validation.strategy.recommended"),
|
|
304
|
+
style: "info"
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
}, {
|
|
308
|
+
value: "wwwToRoot",
|
|
309
|
+
label: "neetoCustomDomains.validation.strategy.wwwToRoot"
|
|
310
|
+
}, {
|
|
311
|
+
value: "onlyAddRoot",
|
|
312
|
+
label: "neetoCustomDomains.validation.strategy.onlyAddRoot"
|
|
313
|
+
}];
|
|
314
|
+
|
|
315
|
+
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; }
|
|
316
|
+
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; }
|
|
317
|
+
var Strategy = withT(function (_ref) {
|
|
318
|
+
var t = _ref.t,
|
|
319
|
+
hostname = _ref.hostname,
|
|
320
|
+
subdomainPlaceholder = _ref.subdomainPlaceholder,
|
|
321
|
+
handleSubmit = _ref.handleSubmit,
|
|
322
|
+
errorData = _ref.errorData,
|
|
323
|
+
isSubmitting = _ref.isSubmitting,
|
|
324
|
+
setPrimaryDomain = _ref.setPrimaryDomain,
|
|
325
|
+
onClose = _ref.onClose;
|
|
326
|
+
return /*#__PURE__*/jsxs(Form, {
|
|
327
|
+
formikProps: {
|
|
328
|
+
initialValues: STRATEGY_INITIAL_VALUES,
|
|
329
|
+
validationSchema: strategyValidationSchema,
|
|
330
|
+
onSubmit: handleSubmit,
|
|
331
|
+
onReset: function onReset() {
|
|
332
|
+
setPrimaryDomain({});
|
|
333
|
+
onClose();
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
337
|
+
className: "space-y-4",
|
|
338
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
339
|
+
className: "space-y-4",
|
|
340
|
+
children: [/*#__PURE__*/jsx(Radio, {
|
|
341
|
+
stacked: true,
|
|
342
|
+
name: "strategy",
|
|
343
|
+
children: strategyOptions.map(function (_ref2, index) {
|
|
344
|
+
var value = _ref2.value,
|
|
345
|
+
label = _ref2.label,
|
|
346
|
+
AdditionalLabelContent = _ref2.additionalLabelContent;
|
|
347
|
+
return /*#__PURE__*/createElement(Radio.Item, {
|
|
348
|
+
value: value,
|
|
349
|
+
key: index,
|
|
350
|
+
name: "strategy",
|
|
351
|
+
label: /*#__PURE__*/jsxs("span", {
|
|
352
|
+
className: "flex items-center gap-1",
|
|
353
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
354
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
355
|
+
i18nKey: label,
|
|
356
|
+
values: {
|
|
357
|
+
hostname: hostname
|
|
358
|
+
}
|
|
359
|
+
})
|
|
360
|
+
}), AdditionalLabelContent]
|
|
361
|
+
})
|
|
362
|
+
});
|
|
363
|
+
})
|
|
364
|
+
}), (errorData === null || errorData === void 0 ? void 0 : errorData.key) && /*#__PURE__*/jsx(Callout, {
|
|
365
|
+
style: "warning",
|
|
366
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
367
|
+
style: "body2",
|
|
368
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
369
|
+
i18nKey: errorData === null || errorData === void 0 ? void 0 : errorData.key,
|
|
370
|
+
values: _objectSpread$1(_objectSpread$1({}, errorData), {}, {
|
|
371
|
+
subdomainPlaceholder: subdomainPlaceholder
|
|
372
|
+
}),
|
|
373
|
+
components: {
|
|
374
|
+
Link: /*#__PURE__*/jsx(Button, {
|
|
375
|
+
href: errorData === null || errorData === void 0 ? void 0 : errorData.pageUrl,
|
|
376
|
+
rel: "noreferrer",
|
|
377
|
+
style: "link",
|
|
378
|
+
target: "_blank"
|
|
379
|
+
})
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
})
|
|
383
|
+
})]
|
|
384
|
+
})
|
|
385
|
+
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
386
|
+
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
387
|
+
isSubmitting: isSubmitting,
|
|
388
|
+
cancelButtonProps: {
|
|
389
|
+
label: t("neetoCustomDomains.actions.cancel")
|
|
390
|
+
},
|
|
391
|
+
submitButtonProps: {
|
|
392
|
+
label: t("neetoCustomDomains.actions.continue"),
|
|
393
|
+
disabled: false,
|
|
394
|
+
"data-cy": "custom-domain-strategy-continue-button"
|
|
395
|
+
}
|
|
396
|
+
})
|
|
397
|
+
})]
|
|
398
|
+
});
|
|
399
|
+
});
|
|
253
400
|
|
|
254
401
|
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; }
|
|
255
402
|
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; }
|
|
256
403
|
var DomainField = function DomainField(_ref) {
|
|
257
|
-
var
|
|
258
|
-
onCreate = _ref.onCreate,
|
|
404
|
+
var onCreate = _ref.onCreate,
|
|
259
405
|
url = _ref.url,
|
|
260
406
|
onClose = _ref.onClose,
|
|
261
|
-
subdomainPlaceholder = _ref.subdomainPlaceholder
|
|
407
|
+
subdomainPlaceholder = _ref.subdomainPlaceholder,
|
|
408
|
+
setPrimaryDomain = _ref.setPrimaryDomain,
|
|
409
|
+
errorData = _ref.errorData,
|
|
410
|
+
setErrorData = _ref.setErrorData;
|
|
262
411
|
var _useTranslation = useTranslation(),
|
|
263
412
|
t = _useTranslation.t;
|
|
264
|
-
var _useState = useState(
|
|
413
|
+
var _useState = useState(""),
|
|
265
414
|
_useState2 = _slicedToArray(_useState, 2),
|
|
266
|
-
|
|
267
|
-
|
|
415
|
+
hostname = _useState2[0],
|
|
416
|
+
setHostname = _useState2[1];
|
|
417
|
+
var wwwHostname = "www.".concat(hostname);
|
|
268
418
|
var _useCreateCustomDomai = useCreateCustomDomain(url, {
|
|
269
419
|
onError: function onError(_ref2) {
|
|
270
420
|
var response = _ref2.response;
|
|
@@ -272,7 +422,28 @@ var DomainField = function DomainField(_ref) {
|
|
|
272
422
|
}
|
|
273
423
|
}),
|
|
274
424
|
createCustomDomain = _useCreateCustomDomai.mutate,
|
|
275
|
-
|
|
425
|
+
isCreatingCustomDomain = _useCreateCustomDomai.isPending;
|
|
426
|
+
var handleDomainCreation = function handleDomainCreation(payload) {
|
|
427
|
+
return createCustomDomain(payload, {
|
|
428
|
+
onSuccess: function onSuccess(values) {
|
|
429
|
+
onCreate === null || onCreate === void 0 || onCreate(values);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
var handleStrategy = {
|
|
434
|
+
rootToWww: {
|
|
435
|
+
hostname: hostname,
|
|
436
|
+
toHostname: wwwHostname
|
|
437
|
+
},
|
|
438
|
+
wwwToRoot: {
|
|
439
|
+
hostname: wwwHostname,
|
|
440
|
+
toHostname: hostname
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
444
|
+
var strategy = _ref3.strategy;
|
|
445
|
+
return handleDomainCreation(handleStrategy[strategy]);
|
|
446
|
+
};
|
|
276
447
|
var getHostname = function getHostname(url) {
|
|
277
448
|
try {
|
|
278
449
|
var parsedUrl = new URL(url);
|
|
@@ -281,28 +452,46 @@ var DomainField = function DomainField(_ref) {
|
|
|
281
452
|
return url;
|
|
282
453
|
}
|
|
283
454
|
};
|
|
284
|
-
var
|
|
285
|
-
var hostname =
|
|
455
|
+
var handleDomainSubmission = function handleDomainSubmission(_ref4) {
|
|
456
|
+
var hostname = _ref4.hostname;
|
|
457
|
+
setErrorData({});
|
|
286
458
|
var parsedHostname = getHostname(hostname);
|
|
287
|
-
|
|
459
|
+
setPrimaryDomain({
|
|
460
|
+
hostname: parsedHostname
|
|
461
|
+
});
|
|
462
|
+
if (isRootLevelDomain(hostname)) {
|
|
463
|
+
return setHostname(parsedHostname);
|
|
464
|
+
}
|
|
465
|
+
return handleDomainCreation({
|
|
288
466
|
hostname: parsedHostname
|
|
289
|
-
};
|
|
290
|
-
createCustomDomain(payload, {
|
|
291
|
-
onSuccess: function onSuccess(values) {
|
|
292
|
-
onCreate === null || onCreate === void 0 || onCreate(values);
|
|
293
|
-
}
|
|
294
467
|
});
|
|
295
468
|
};
|
|
296
|
-
|
|
469
|
+
var handleCancel = function handleCancel() {
|
|
470
|
+
setPrimaryDomain();
|
|
471
|
+
onClose();
|
|
472
|
+
};
|
|
473
|
+
if (hostname) {
|
|
474
|
+
return /*#__PURE__*/jsx(Strategy, {
|
|
475
|
+
errorData: errorData,
|
|
476
|
+
handleSubmit: handleSubmit,
|
|
477
|
+
hostname: hostname,
|
|
478
|
+
onClose: onClose,
|
|
479
|
+
onCreate: onCreate,
|
|
480
|
+
setPrimaryDomain: setPrimaryDomain,
|
|
481
|
+
subdomainPlaceholder: subdomainPlaceholder,
|
|
482
|
+
url: url,
|
|
483
|
+
isSubmitting: isCreatingCustomDomain
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
return /*#__PURE__*/jsx(Form, {
|
|
297
487
|
className: "flex-col space-y-6",
|
|
298
488
|
formikProps: {
|
|
299
|
-
|
|
300
|
-
initialValues: customDomain || INITIAL_VALUES,
|
|
489
|
+
initialValues: INITIAL_VALUES,
|
|
301
490
|
validationSchema: getCustomDomainValidationSchema(),
|
|
302
|
-
onSubmit:
|
|
491
|
+
onSubmit: handleDomainSubmission
|
|
303
492
|
},
|
|
304
|
-
children: function children(
|
|
305
|
-
var dirty =
|
|
493
|
+
children: function children(_ref5) {
|
|
494
|
+
var dirty = _ref5.dirty;
|
|
306
495
|
return /*#__PURE__*/jsxs("div", {
|
|
307
496
|
className: "w-full",
|
|
308
497
|
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
@@ -312,7 +501,6 @@ var DomainField = function DomainField(_ref) {
|
|
|
312
501
|
required: true,
|
|
313
502
|
className: "w-full",
|
|
314
503
|
"data-cy": "custom-domain-input-field",
|
|
315
|
-
disabled: isNotEmpty(customDomain),
|
|
316
504
|
label: t("neetoCustomDomains.label"),
|
|
317
505
|
name: "hostname",
|
|
318
506
|
placeholder: t("neetoCustomDomains.placeholder", {
|
|
@@ -324,6 +512,9 @@ var DomainField = function DomainField(_ref) {
|
|
|
324
512
|
style: "body2",
|
|
325
513
|
children: /*#__PURE__*/jsx(Trans, {
|
|
326
514
|
i18nKey: errorData === null || errorData === void 0 ? void 0 : errorData.key,
|
|
515
|
+
values: _objectSpread(_objectSpread({}, errorData), {}, {
|
|
516
|
+
subdomainPlaceholder: subdomainPlaceholder
|
|
517
|
+
}),
|
|
327
518
|
components: {
|
|
328
519
|
Link: /*#__PURE__*/jsx(Button, {
|
|
329
520
|
href: errorData === null || errorData === void 0 ? void 0 : errorData.pageUrl,
|
|
@@ -331,10 +522,7 @@ var DomainField = function DomainField(_ref) {
|
|
|
331
522
|
style: "link",
|
|
332
523
|
target: "_blank"
|
|
333
524
|
})
|
|
334
|
-
}
|
|
335
|
-
values: _objectSpread(_objectSpread({}, errorData), {}, {
|
|
336
|
-
subdomainPlaceholder: subdomainPlaceholder
|
|
337
|
-
})
|
|
525
|
+
}
|
|
338
526
|
})
|
|
339
527
|
})
|
|
340
528
|
})]
|
|
@@ -342,14 +530,13 @@ var DomainField = function DomainField(_ref) {
|
|
|
342
530
|
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
343
531
|
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
344
532
|
cancelButtonProps: {
|
|
345
|
-
onClick:
|
|
533
|
+
onClick: handleCancel
|
|
346
534
|
},
|
|
347
|
-
isSubmitting: isCreating,
|
|
348
535
|
submitButtonProps: {
|
|
349
536
|
label: t("neetoCustomDomains.actions.continue"),
|
|
350
537
|
"data-cy": "submit-custom-domain-button",
|
|
351
538
|
"data-testid": "submit-custom-domain-button",
|
|
352
|
-
disabled: !dirty
|
|
539
|
+
disabled: !dirty
|
|
353
540
|
}
|
|
354
541
|
})
|
|
355
542
|
})]
|
|
@@ -364,9 +551,6 @@ var getDnsProviderData = function getDnsProviderData(dnsProvider) {
|
|
|
364
551
|
var hostname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unknown";
|
|
365
552
|
return dnsProviderData(hostname)[dnsProvider];
|
|
366
553
|
};
|
|
367
|
-
var isRootLevelDomain = function isRootLevelDomain(hostname) {
|
|
368
|
-
return isNil(psl.parse(hostname).subdomain);
|
|
369
|
-
};
|
|
370
554
|
var commonColumnData = function commonColumnData(dnsProvider) {
|
|
371
555
|
var dnsProviderInfo = getDnsProviderData(dnsProvider);
|
|
372
556
|
return [{
|
|
@@ -478,8 +662,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
478
662
|
},
|
|
479
663
|
values: {
|
|
480
664
|
ttl: {
|
|
481
|
-
rootDomain: "
|
|
482
|
-
subdomain: "
|
|
665
|
+
rootDomain: "1 min",
|
|
666
|
+
subdomain: "1 min"
|
|
483
667
|
},
|
|
484
668
|
type: {
|
|
485
669
|
rootDomain: "CNAME",
|
|
@@ -503,8 +687,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
503
687
|
},
|
|
504
688
|
values: {
|
|
505
689
|
ttl: {
|
|
506
|
-
rootDomain: "
|
|
507
|
-
subdomain: "
|
|
690
|
+
rootDomain: "1 min",
|
|
691
|
+
subdomain: "1 min"
|
|
508
692
|
},
|
|
509
693
|
type: {
|
|
510
694
|
rootDomain: "ALIAS",
|
|
@@ -557,15 +741,19 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
557
741
|
subdomain: "60"
|
|
558
742
|
},
|
|
559
743
|
type: {
|
|
560
|
-
rootDomain: "
|
|
744
|
+
rootDomain: "A",
|
|
561
745
|
subdomain: "CNAME"
|
|
562
746
|
},
|
|
563
747
|
name: {
|
|
564
|
-
rootDomain:
|
|
748
|
+
rootDomain: "@",
|
|
565
749
|
subdomain: psl.parse(hostname).subdomain
|
|
750
|
+
},
|
|
751
|
+
target: {
|
|
752
|
+
rootDomain: "34.233.85.113",
|
|
753
|
+
subdomain: "dns.neetodeployapp.com"
|
|
566
754
|
}
|
|
567
755
|
},
|
|
568
|
-
hasRootLevelDomainSupport:
|
|
756
|
+
hasRootLevelDomainSupport: true
|
|
569
757
|
},
|
|
570
758
|
godaddy: {
|
|
571
759
|
name: "GoDaddy",
|
|
@@ -582,15 +770,19 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
582
770
|
subdomain: "1/2 Hour"
|
|
583
771
|
},
|
|
584
772
|
type: {
|
|
585
|
-
rootDomain: "
|
|
773
|
+
rootDomain: "A",
|
|
586
774
|
subdomain: "CNAME"
|
|
587
775
|
},
|
|
588
776
|
name: {
|
|
589
|
-
rootDomain:
|
|
777
|
+
rootDomain: "@",
|
|
590
778
|
subdomain: psl.parse(hostname).subdomain
|
|
779
|
+
},
|
|
780
|
+
target: {
|
|
781
|
+
rootDomain: "34.233.85.113",
|
|
782
|
+
subdomain: "dns.neetodeployapp.com"
|
|
591
783
|
}
|
|
592
784
|
},
|
|
593
|
-
hasRootLevelDomainSupport:
|
|
785
|
+
hasRootLevelDomainSupport: true
|
|
594
786
|
},
|
|
595
787
|
squarespace: {
|
|
596
788
|
name: "Squarespace",
|
|
@@ -633,15 +825,19 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
633
825
|
subdomain: "30 minutes"
|
|
634
826
|
},
|
|
635
827
|
type: {
|
|
636
|
-
rootDomain: "
|
|
828
|
+
rootDomain: "A",
|
|
637
829
|
subdomain: "CNAME"
|
|
638
830
|
},
|
|
639
831
|
name: {
|
|
640
|
-
rootDomain:
|
|
832
|
+
rootDomain: "",
|
|
641
833
|
subdomain: psl.parse(hostname).subdomain
|
|
834
|
+
},
|
|
835
|
+
target: {
|
|
836
|
+
rootDomain: "34.233.85.113",
|
|
837
|
+
subdomain: "dns.neetodeployapp.com"
|
|
642
838
|
}
|
|
643
839
|
},
|
|
644
|
-
hasRootLevelDomainSupport:
|
|
840
|
+
hasRootLevelDomainSupport: true
|
|
645
841
|
},
|
|
646
842
|
porkbun: {
|
|
647
843
|
name: "Porkbun",
|
|
@@ -708,15 +904,19 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
708
904
|
subdomain: "60"
|
|
709
905
|
},
|
|
710
906
|
type: {
|
|
711
|
-
rootDomain: "
|
|
907
|
+
rootDomain: "A",
|
|
712
908
|
subdomain: "CNAME"
|
|
713
909
|
},
|
|
714
910
|
name: {
|
|
715
|
-
rootDomain:
|
|
911
|
+
rootDomain: "",
|
|
716
912
|
subdomain: psl.parse(hostname).subdomain
|
|
913
|
+
},
|
|
914
|
+
target: {
|
|
915
|
+
rootDomain: "34.233.85.113",
|
|
916
|
+
subdomain: "dns.neetodeployapp.com"
|
|
717
917
|
}
|
|
718
918
|
},
|
|
719
|
-
hasRootLevelDomainSupport:
|
|
919
|
+
hasRootLevelDomainSupport: true
|
|
720
920
|
},
|
|
721
921
|
strato: {
|
|
722
922
|
name: "Strato",
|
|
@@ -728,7 +928,7 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
728
928
|
},
|
|
729
929
|
values: {
|
|
730
930
|
type: {
|
|
731
|
-
rootDomain: "
|
|
931
|
+
rootDomain: "A",
|
|
732
932
|
subdomain: "CNAME"
|
|
733
933
|
},
|
|
734
934
|
ttl: {
|
|
@@ -736,11 +936,15 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
736
936
|
subdomain: "-"
|
|
737
937
|
},
|
|
738
938
|
name: {
|
|
739
|
-
rootDomain:
|
|
939
|
+
rootDomain: hostname,
|
|
740
940
|
subdomain: (_psl$parse = psl.parse(hostname)) === null || _psl$parse === void 0 ? void 0 : _psl$parse.subdomain
|
|
941
|
+
},
|
|
942
|
+
target: {
|
|
943
|
+
rootDomain: "34.233.85.113",
|
|
944
|
+
subdomain: "dns.neetodeployapp.com"
|
|
741
945
|
}
|
|
742
946
|
},
|
|
743
|
-
hasRootLevelDomainSupport:
|
|
947
|
+
hasRootLevelDomainSupport: true
|
|
744
948
|
},
|
|
745
949
|
microsoft: {
|
|
746
950
|
name: "Microsoft 365",
|
|
@@ -769,7 +973,7 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
769
973
|
subdomain: "dns.neetodeployapp.com"
|
|
770
974
|
}
|
|
771
975
|
},
|
|
772
|
-
hasRootLevelDomainSupport:
|
|
976
|
+
hasRootLevelDomainSupport: true
|
|
773
977
|
},
|
|
774
978
|
unknown: {
|
|
775
979
|
name: "this provider",
|
|
@@ -786,31 +990,35 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
786
990
|
subdomain: "1m"
|
|
787
991
|
},
|
|
788
992
|
type: {
|
|
789
|
-
rootDomain: "
|
|
993
|
+
rootDomain: "A",
|
|
790
994
|
subdomain: "CNAME"
|
|
791
995
|
},
|
|
792
996
|
name: {
|
|
793
997
|
rootDomain: "@",
|
|
794
998
|
subdomain: psl.parse(hostname).subdomain
|
|
999
|
+
},
|
|
1000
|
+
target: {
|
|
1001
|
+
rootDomain: "34.233.85.113",
|
|
1002
|
+
subdomain: "dns.neetodeployapp.com"
|
|
795
1003
|
}
|
|
796
1004
|
},
|
|
797
|
-
hasRootLevelDomainSupport:
|
|
1005
|
+
hasRootLevelDomainSupport: true
|
|
798
1006
|
}
|
|
799
1007
|
};
|
|
800
1008
|
};
|
|
801
1009
|
|
|
802
1010
|
var Validation = function Validation(_ref) {
|
|
803
1011
|
var _dnsHelpDocs$dnsProvi, _dnsHelpDocs$dnsProvi2, _dnsHelpDocs$unknown, _dnsHelpDocs$dnsProvi3, _dnsHelpDocs$dnsProvi4, _dnsHelpDocs$unknown2, _dnsHelpDocs$dnsProvi5, _dnsHelpDocs$dnsProvi6, _dnsHelpDocs$unknown3;
|
|
804
|
-
var
|
|
1012
|
+
var customDomains = _ref.customDomains,
|
|
805
1013
|
onClose = _ref.onClose,
|
|
806
1014
|
url = _ref.url,
|
|
807
|
-
dnsHelpDocs = _ref.dnsHelpDocs
|
|
1015
|
+
dnsHelpDocs = _ref.dnsHelpDocs,
|
|
1016
|
+
primaryDomain = _ref.primaryDomain;
|
|
808
1017
|
var _useTranslation = useTranslation(),
|
|
809
1018
|
t = _useTranslation.t;
|
|
810
|
-
var hostname =
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
dnsProvider = customDomain.dnsProvider;
|
|
1019
|
+
var hostname = primaryDomain.hostname,
|
|
1020
|
+
status = primaryDomain.status,
|
|
1021
|
+
dnsProvider = primaryDomain.dnsProvider;
|
|
814
1022
|
var queryClient = useQueryClient();
|
|
815
1023
|
var _useState = useState(""),
|
|
816
1024
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -840,33 +1048,27 @@ var Validation = function Validation(_ref) {
|
|
|
840
1048
|
return /*#__PURE__*/jsxs("div", {
|
|
841
1049
|
children: [/*#__PURE__*/jsxs(Pane.Body, {
|
|
842
1050
|
className: "space-y-4",
|
|
843
|
-
children: [/*#__PURE__*/
|
|
1051
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
844
1052
|
className: "space-y-2",
|
|
845
|
-
children:
|
|
846
|
-
style: "h4",
|
|
847
|
-
weight: "medium",
|
|
848
|
-
children: t("neetoCustomDomains.cnameRecordTitle", {
|
|
849
|
-
domainName: hostname
|
|
850
|
-
})
|
|
851
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
1053
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
852
1054
|
style: "body2",
|
|
853
1055
|
children: dnsProvider !== "unknown" ? /*#__PURE__*/jsx(Trans, {
|
|
854
1056
|
i18nKey: "neetoCustomDomains.dnsProviderCnameRecordInfo",
|
|
855
1057
|
values: {
|
|
856
|
-
dnsProvider: dnsProviderInfo.name
|
|
1058
|
+
dnsProvider: dnsProviderInfo === null || dnsProviderInfo === void 0 ? void 0 : dnsProviderInfo.name
|
|
857
1059
|
},
|
|
858
1060
|
components: {
|
|
859
1061
|
Login: /*#__PURE__*/jsx(Button, {
|
|
860
|
-
href: dnsProviderInfo.loginUrl,
|
|
1062
|
+
href: dnsProviderInfo === null || dnsProviderInfo === void 0 ? void 0 : dnsProviderInfo.loginUrl,
|
|
861
1063
|
rel: "noreferrer",
|
|
862
1064
|
style: "link",
|
|
863
1065
|
target: "_blank"
|
|
864
1066
|
}),
|
|
865
1067
|
Link: /*#__PURE__*/jsx(Button, {
|
|
866
|
-
href: (_dnsHelpDocs$dnsProvi = (_dnsHelpDocs$dnsProvi2 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi2 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi2[domainType]) !== null && _dnsHelpDocs$dnsProvi !== void 0 ? _dnsHelpDocs$dnsProvi : (_dnsHelpDocs$unknown = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown === void 0 ? void 0 : _dnsHelpDocs$unknown[domainType],
|
|
867
1068
|
rel: "noreferrer",
|
|
868
1069
|
style: "link",
|
|
869
|
-
target: "_blank"
|
|
1070
|
+
target: "_blank",
|
|
1071
|
+
href: (_dnsHelpDocs$dnsProvi = (_dnsHelpDocs$dnsProvi2 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi2 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi2[domainType]) !== null && _dnsHelpDocs$dnsProvi !== void 0 ? _dnsHelpDocs$dnsProvi : (_dnsHelpDocs$unknown = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown === void 0 ? void 0 : _dnsHelpDocs$unknown[domainType]
|
|
870
1072
|
})
|
|
871
1073
|
}
|
|
872
1074
|
}) : /*#__PURE__*/jsx(Trans, {
|
|
@@ -880,18 +1082,23 @@ var Validation = function Validation(_ref) {
|
|
|
880
1082
|
})
|
|
881
1083
|
}
|
|
882
1084
|
})
|
|
883
|
-
})
|
|
1085
|
+
})
|
|
884
1086
|
}), /*#__PURE__*/jsx("div", {
|
|
885
1087
|
className: "space-y-1",
|
|
886
1088
|
children: /*#__PURE__*/jsx(Table, {
|
|
887
1089
|
allowRowClick: false,
|
|
888
1090
|
columnData: columnData(dnsProvider),
|
|
889
1091
|
enableColumnFreeze: false,
|
|
890
|
-
rowData: rowData(dnsProvider, hostname, dnsTarget),
|
|
891
1092
|
rowSelection: false,
|
|
892
1093
|
scroll: {
|
|
893
|
-
x:
|
|
894
|
-
}
|
|
1094
|
+
x: "100%"
|
|
1095
|
+
},
|
|
1096
|
+
rowData: customDomains.map(function (_ref3) {
|
|
1097
|
+
var hostname = _ref3.hostname,
|
|
1098
|
+
dnsTarget = _ref3.dnsTarget,
|
|
1099
|
+
dnsProvider = _ref3.dnsProvider;
|
|
1100
|
+
return rowData(dnsProvider, hostname, dnsTarget);
|
|
1101
|
+
}).flat()
|
|
895
1102
|
})
|
|
896
1103
|
}), status === "failed" && /*#__PURE__*/jsx(Callout, {
|
|
897
1104
|
style: STATUS_TAG_STYLES[status],
|
|
@@ -910,10 +1117,10 @@ var Validation = function Validation(_ref) {
|
|
|
910
1117
|
target: "_blank"
|
|
911
1118
|
}),
|
|
912
1119
|
Link: /*#__PURE__*/jsx(Button, {
|
|
913
|
-
href: (_dnsHelpDocs$dnsProvi3 = (_dnsHelpDocs$dnsProvi4 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi4 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi4[domainType]) !== null && _dnsHelpDocs$dnsProvi3 !== void 0 ? _dnsHelpDocs$dnsProvi3 : (_dnsHelpDocs$unknown2 = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown2 === void 0 ? void 0 : _dnsHelpDocs$unknown2[domainType],
|
|
914
1120
|
rel: "noreferrer",
|
|
915
1121
|
style: "link",
|
|
916
|
-
target: "_blank"
|
|
1122
|
+
target: "_blank",
|
|
1123
|
+
href: (_dnsHelpDocs$dnsProvi3 = (_dnsHelpDocs$dnsProvi4 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi4 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi4[domainType]) !== null && _dnsHelpDocs$dnsProvi3 !== void 0 ? _dnsHelpDocs$dnsProvi3 : (_dnsHelpDocs$unknown2 = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown2 === void 0 ? void 0 : _dnsHelpDocs$unknown2[domainType]
|
|
917
1124
|
}),
|
|
918
1125
|
br: /*#__PURE__*/jsx("br", {})
|
|
919
1126
|
}
|
|
@@ -930,10 +1137,10 @@ var Validation = function Validation(_ref) {
|
|
|
930
1137
|
target: "_blank"
|
|
931
1138
|
}),
|
|
932
1139
|
Link: /*#__PURE__*/jsx(Button, {
|
|
933
|
-
href: (_dnsHelpDocs$dnsProvi5 = (_dnsHelpDocs$dnsProvi6 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi6 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi6[domainType]) !== null && _dnsHelpDocs$dnsProvi5 !== void 0 ? _dnsHelpDocs$dnsProvi5 : (_dnsHelpDocs$unknown3 = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown3 === void 0 ? void 0 : _dnsHelpDocs$unknown3[domainType],
|
|
934
1140
|
rel: "noreferrer",
|
|
935
1141
|
style: "link",
|
|
936
|
-
target: "_blank"
|
|
1142
|
+
target: "_blank",
|
|
1143
|
+
href: (_dnsHelpDocs$dnsProvi5 = (_dnsHelpDocs$dnsProvi6 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi6 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi6[domainType]) !== null && _dnsHelpDocs$dnsProvi5 !== void 0 ? _dnsHelpDocs$dnsProvi5 : (_dnsHelpDocs$unknown3 = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown3 === void 0 ? void 0 : _dnsHelpDocs$unknown3[domainType]
|
|
937
1144
|
}),
|
|
938
1145
|
br: /*#__PURE__*/jsx("br", {})
|
|
939
1146
|
}
|
|
@@ -944,10 +1151,10 @@ var Validation = function Validation(_ref) {
|
|
|
944
1151
|
children: /*#__PURE__*/jsx(Typography, {
|
|
945
1152
|
style: "body2",
|
|
946
1153
|
children: /*#__PURE__*/jsx(Trans, {
|
|
947
|
-
i18nKey: errorKey,
|
|
948
1154
|
components: {
|
|
949
1155
|
br: /*#__PURE__*/jsx("br", {})
|
|
950
|
-
}
|
|
1156
|
+
},
|
|
1157
|
+
i18nKey: errorKey
|
|
951
1158
|
})
|
|
952
1159
|
})
|
|
953
1160
|
})]
|
|
@@ -957,11 +1164,12 @@ var Validation = function Validation(_ref) {
|
|
|
957
1164
|
children: [/*#__PURE__*/jsx(Button, {
|
|
958
1165
|
"data-cy": "validate-domain-button",
|
|
959
1166
|
disabled: isValidating || isDomainValidated,
|
|
960
|
-
label: status === "failed" ? t("neetoCustomDomains.validation.buttonLabel.revalidate") : isNotEmpty(errorKey) ? t("neetoCustomDomains.validation.buttonLabel.validateManually") : t("neetoCustomDomains.validation.buttonLabel.domain"),
|
|
961
1167
|
loading: isValidating,
|
|
1168
|
+
label: status === "failed" ? t("neetoCustomDomains.validation.buttonLabel.revalidate") : isNotEmpty(errorKey) ? t("neetoCustomDomains.validation.buttonLabel.validateManually") : t("neetoCustomDomains.validation.buttonLabel.domain"),
|
|
962
1169
|
onClick: validateDomain
|
|
963
1170
|
}), /*#__PURE__*/jsx(Button, {
|
|
964
1171
|
label: t("neetoCustomDomains.actions.cancel"),
|
|
1172
|
+
"data-cy": "cancel-button",
|
|
965
1173
|
style: "text",
|
|
966
1174
|
onClick: onClose
|
|
967
1175
|
})]
|
|
@@ -971,19 +1179,38 @@ var Validation = function Validation(_ref) {
|
|
|
971
1179
|
};
|
|
972
1180
|
|
|
973
1181
|
var DomainPane = function DomainPane(_ref) {
|
|
974
|
-
var
|
|
1182
|
+
var customDomains = _ref.customDomains,
|
|
975
1183
|
isOpen = _ref.isOpen,
|
|
976
1184
|
onClose = _ref.onClose,
|
|
977
1185
|
onCreate = _ref.onCreate,
|
|
978
1186
|
url = _ref.url,
|
|
979
|
-
isCustomDomainAdded = _ref.isCustomDomainAdded,
|
|
980
1187
|
helpDocUrl = _ref.helpDocUrl,
|
|
981
1188
|
dnsHelpDocs = _ref.dnsHelpDocs,
|
|
982
1189
|
subdomainPlaceholder = _ref.subdomainPlaceholder;
|
|
983
1190
|
var _useTranslation = useTranslation(),
|
|
984
1191
|
t = _useTranslation.t;
|
|
985
|
-
var
|
|
986
|
-
|
|
1192
|
+
var _useState = useState(customDomains[0]),
|
|
1193
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1194
|
+
primaryDomain = _useState2[0],
|
|
1195
|
+
setPrimaryDomain = _useState2[1];
|
|
1196
|
+
var _useState3 = useState({}),
|
|
1197
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1198
|
+
errorData = _useState4[0],
|
|
1199
|
+
setErrorData = _useState4[1];
|
|
1200
|
+
var _useFetchCustomDomain = useFetchCustomDomain(url),
|
|
1201
|
+
isLoading = _useFetchCustomDomain.isLoading;
|
|
1202
|
+
useEffect(function () {
|
|
1203
|
+
var domain = customDomains.find(function (_ref2) {
|
|
1204
|
+
var hostname = _ref2.hostname;
|
|
1205
|
+
return isRootLevelDomain(hostname);
|
|
1206
|
+
}) || customDomains[0];
|
|
1207
|
+
setPrimaryDomain(domain);
|
|
1208
|
+
}, [customDomains]);
|
|
1209
|
+
var getCurrentStep = function getCurrentStep(domain) {
|
|
1210
|
+
if (!domain) return "notAdded";
|
|
1211
|
+
if (domain !== null && domain !== void 0 && domain.hostname && !(domain !== null && domain !== void 0 && domain.status)) return "strategy";
|
|
1212
|
+
return domain === null || domain === void 0 ? void 0 : domain.status;
|
|
1213
|
+
};
|
|
987
1214
|
return /*#__PURE__*/jsxs(Pane, {
|
|
988
1215
|
isOpen: isOpen,
|
|
989
1216
|
onClose: onClose,
|
|
@@ -996,24 +1223,47 @@ var DomainPane = function DomainPane(_ref) {
|
|
|
996
1223
|
}), /*#__PURE__*/jsx("div", {
|
|
997
1224
|
className: "-ml-2",
|
|
998
1225
|
children: /*#__PURE__*/jsx(Stepper, {
|
|
999
|
-
activeIndex: CURRENT_STEP[
|
|
1226
|
+
activeIndex: CURRENT_STEP[getCurrentStep(primaryDomain)],
|
|
1000
1227
|
setActiveIndex: noop,
|
|
1001
1228
|
steps: STEPS
|
|
1002
1229
|
})
|
|
1230
|
+
}), primaryDomain && /*#__PURE__*/jsx(Typography, {
|
|
1231
|
+
style: "h4",
|
|
1232
|
+
weight: "medium",
|
|
1233
|
+
children: t("neetoCustomDomains.cnameRecordTitle", {
|
|
1234
|
+
domainName: primaryDomain.hostname
|
|
1235
|
+
})
|
|
1003
1236
|
})]
|
|
1004
|
-
}),
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1237
|
+
}), function (_primaryDomain$hostna) {
|
|
1238
|
+
var currentStep = getCurrentStep(primaryDomain);
|
|
1239
|
+
var isStrategyStep = CURRENT_STEP[currentStep] === 1;
|
|
1240
|
+
var isSubdomain = !isRootLevelDomain((_primaryDomain$hostna = primaryDomain === null || primaryDomain === void 0 ? void 0 : primaryDomain.hostname) !== null && _primaryDomain$hostna !== void 0 ? _primaryDomain$hostna : "");
|
|
1241
|
+
var shouldShowLoader = isLoading || isStrategyStep && isSubdomain;
|
|
1242
|
+
if (shouldShowLoader) {
|
|
1243
|
+
return /*#__PURE__*/jsx(PageLoader, {});
|
|
1244
|
+
}
|
|
1245
|
+
if (CURRENT_STEP[getCurrentStep(primaryDomain)] > 1) {
|
|
1246
|
+
return /*#__PURE__*/jsx(Validation, {
|
|
1247
|
+
customDomains: customDomains,
|
|
1248
|
+
dnsHelpDocs: dnsHelpDocs,
|
|
1249
|
+
helpDocUrl: helpDocUrl,
|
|
1250
|
+
onClose: onClose,
|
|
1251
|
+
onCreate: onCreate,
|
|
1252
|
+
primaryDomain: primaryDomain,
|
|
1253
|
+
subdomainPlaceholder: subdomainPlaceholder,
|
|
1254
|
+
url: url
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
return /*#__PURE__*/jsx(DomainField, {
|
|
1258
|
+
errorData: errorData,
|
|
1259
|
+
onClose: onClose,
|
|
1260
|
+
onCreate: onCreate,
|
|
1261
|
+
setErrorData: setErrorData,
|
|
1262
|
+
setPrimaryDomain: setPrimaryDomain,
|
|
1263
|
+
subdomainPlaceholder: subdomainPlaceholder,
|
|
1264
|
+
url: url
|
|
1265
|
+
});
|
|
1266
|
+
}()]
|
|
1017
1267
|
});
|
|
1018
1268
|
};
|
|
1019
1269
|
|
|
@@ -1021,31 +1271,36 @@ var Header = function Header(_ref) {
|
|
|
1021
1271
|
var openPane = _ref.openPane,
|
|
1022
1272
|
breadcrumbs = _ref.breadcrumbs,
|
|
1023
1273
|
isCustomDomainAdded = _ref.isCustomDomainAdded,
|
|
1274
|
+
setSelectedCustomDomain = _ref.setSelectedCustomDomain,
|
|
1024
1275
|
helpDocUrl = _ref.helpDocUrl,
|
|
1025
1276
|
_ref$size = _ref.size,
|
|
1026
1277
|
size = _ref$size === void 0 ? "large" : _ref$size;
|
|
1027
1278
|
var _useTranslation = useTranslation(),
|
|
1028
1279
|
t = _useTranslation.t;
|
|
1280
|
+
var handleClick = function handleClick() {
|
|
1281
|
+
setSelectedCustomDomain({});
|
|
1282
|
+
openPane();
|
|
1283
|
+
};
|
|
1029
1284
|
return /*#__PURE__*/jsx(NeetoHeader, {
|
|
1030
1285
|
breadcrumbs: breadcrumbs,
|
|
1031
1286
|
size: size,
|
|
1032
1287
|
"data-testid": "custom-domain-header",
|
|
1033
1288
|
title: t("neetoCustomDomains.customDomain", SINGULAR),
|
|
1034
|
-
titleHelpPopoverProps: {
|
|
1035
|
-
title: t("neetoCustomDomains.customDomain", SINGULAR),
|
|
1036
|
-
description: t("neetoCustomDomains.toolTips.customDomain"),
|
|
1037
|
-
helpLinkProps: {
|
|
1038
|
-
href: helpDocUrl
|
|
1039
|
-
}
|
|
1040
|
-
},
|
|
1041
1289
|
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
1042
1290
|
"data-cy": "add-new-custom-domain-button",
|
|
1043
1291
|
disabled: isCustomDomainAdded,
|
|
1044
1292
|
label: t("neetoCustomDomains.actions.add", {
|
|
1045
1293
|
what: t("neetoCustomDomains.customDomain", SINGULAR)
|
|
1046
1294
|
}),
|
|
1047
|
-
onClick:
|
|
1048
|
-
})
|
|
1295
|
+
onClick: handleClick
|
|
1296
|
+
}),
|
|
1297
|
+
titleHelpPopoverProps: {
|
|
1298
|
+
title: t("neetoCustomDomains.customDomain", SINGULAR),
|
|
1299
|
+
description: t("neetoCustomDomains.toolTips.customDomain"),
|
|
1300
|
+
helpLinkProps: {
|
|
1301
|
+
href: helpDocUrl
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1049
1304
|
});
|
|
1050
1305
|
};
|
|
1051
1306
|
var Header$1 = /*#__PURE__*/memo(Header);
|
|
@@ -1069,11 +1324,17 @@ var CustomDomain = function CustomDomain(_ref) {
|
|
|
1069
1324
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1070
1325
|
isAlertOpen = _useState4[0],
|
|
1071
1326
|
setIsAlertOpen = _useState4[1];
|
|
1327
|
+
var _useState5 = useState({}),
|
|
1328
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1329
|
+
selectedCustomDomain = _useState6[0],
|
|
1330
|
+
setSelectedCustomDomain = _useState6[1];
|
|
1072
1331
|
var _useFetchCustomDomain = useFetchCustomDomain(url),
|
|
1073
1332
|
_useFetchCustomDomain2 = _useFetchCustomDomain.data,
|
|
1074
|
-
|
|
1333
|
+
_useFetchCustomDomain3 = _useFetchCustomDomain2 === void 0 ? {} : _useFetchCustomDomain2,
|
|
1334
|
+
_useFetchCustomDomain4 = _useFetchCustomDomain3.customDomains,
|
|
1335
|
+
customDomains = _useFetchCustomDomain4 === void 0 ? [] : _useFetchCustomDomain4,
|
|
1075
1336
|
isLoading = _useFetchCustomDomain.isLoading;
|
|
1076
|
-
var _useDeleteCustomDomai = useDeleteCustomDomain(url, {
|
|
1337
|
+
var _useDeleteCustomDomai = useDeleteCustomDomain(url, selectedCustomDomain === null || selectedCustomDomain === void 0 ? void 0 : selectedCustomDomain.hostname, {
|
|
1077
1338
|
onSettled: function onSettled() {
|
|
1078
1339
|
setIsAlertOpen(false);
|
|
1079
1340
|
}
|
|
@@ -1089,7 +1350,7 @@ var CustomDomain = function CustomDomain(_ref) {
|
|
|
1089
1350
|
var openDeleteAlert = function openDeleteAlert() {
|
|
1090
1351
|
return setIsAlertOpen(true);
|
|
1091
1352
|
};
|
|
1092
|
-
var isCustomDomainAdded = isNotEmpty(
|
|
1353
|
+
var isCustomDomainAdded = isNotEmpty(customDomains);
|
|
1093
1354
|
if (isLoading) {
|
|
1094
1355
|
return /*#__PURE__*/jsx("div", {
|
|
1095
1356
|
className: "h-screen w-full",
|
|
@@ -1103,29 +1364,31 @@ var CustomDomain = function CustomDomain(_ref) {
|
|
|
1103
1364
|
helpDocUrl: helpDocUrl,
|
|
1104
1365
|
isCustomDomainAdded: isCustomDomainAdded,
|
|
1105
1366
|
openPane: openPane,
|
|
1367
|
+
setSelectedCustomDomain: setSelectedCustomDomain,
|
|
1106
1368
|
size: headerSize
|
|
1107
1369
|
}), /*#__PURE__*/jsx("div", {
|
|
1108
1370
|
className: "flex w-full justify-center h-full",
|
|
1109
1371
|
children: /*#__PURE__*/jsx(Domain, {
|
|
1110
|
-
|
|
1372
|
+
customDomains: customDomains,
|
|
1111
1373
|
helpDocUrl: helpDocUrl,
|
|
1112
1374
|
isCustomDomainAdded: isCustomDomainAdded,
|
|
1113
1375
|
openDeleteAlert: openDeleteAlert,
|
|
1114
|
-
openPane: openPane
|
|
1376
|
+
openPane: openPane,
|
|
1377
|
+
setSelectedCustomDomain: setSelectedCustomDomain
|
|
1115
1378
|
})
|
|
1116
1379
|
})]
|
|
1117
1380
|
}), /*#__PURE__*/jsx(DomainPane, {
|
|
1118
|
-
|
|
1381
|
+
customDomains: customDomains,
|
|
1119
1382
|
dnsHelpDocs: dnsHelpDocs,
|
|
1120
1383
|
helpDocUrl: helpDocUrl,
|
|
1121
|
-
isCustomDomainAdded: isCustomDomainAdded,
|
|
1122
1384
|
onCreate: onCreate,
|
|
1123
1385
|
url: url,
|
|
1386
|
+
customDomain: selectedCustomDomain,
|
|
1124
1387
|
isOpen: isPaneOpen,
|
|
1125
|
-
|
|
1126
|
-
|
|
1388
|
+
subdomainPlaceholder: subdomainPlaceholder || appName,
|
|
1389
|
+
onClose: closePane
|
|
1127
1390
|
}), /*#__PURE__*/jsx(DeleteAlert, {
|
|
1128
|
-
hostname:
|
|
1391
|
+
hostname: selectedCustomDomain === null || selectedCustomDomain === void 0 ? void 0 : selectedCustomDomain.hostname,
|
|
1129
1392
|
isOpen: isAlertOpen,
|
|
1130
1393
|
isSubmitting: isDeleting,
|
|
1131
1394
|
onClose: function onClose() {
|