@bigbinary/neeto-custom-domains-frontend 2.1.0-beta2 → 2.1.0-beta3
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/en.json +5 -3
- package/dist/CustomDomain.js +96 -18
- package/dist/CustomDomain.js.map +1 -1
- package/dist/cjs/CustomDomain.js +95 -17
- package/dist/cjs/CustomDomain.js.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"label": "Domain name",
|
|
35
35
|
"domainValidation": "Domain validation",
|
|
36
36
|
"domainRedirection": "Domain redirection",
|
|
37
|
-
"cnameRecordTitle": "
|
|
37
|
+
"cnameRecordTitle": "Set up DNS records for the domain {{domainName}} in your DNS provider",
|
|
38
38
|
"cnameRecordInfo": "Go to your DNS provider and add the following DNS record by copying the exact settings listed below. View <Link>help article</Link> to understand how to add a DNS record.",
|
|
39
39
|
"dnsProviderCnameRecordInfo": "We have detected that {{dnsProvider,anyCase}} is your DNS provider. Please <Login>log in</Login> to your {{dnsProvider,anyCase}} account and add the following DNS record by copying the exact settings listed below. View <Link>help article</Link> for adding DNS record in {{dnsProvider,anyCase}}.",
|
|
40
40
|
"proxyMessage": " Do not enable proxy for the record. ",
|
|
@@ -49,9 +49,11 @@
|
|
|
49
49
|
"existInProduction": "Custom domain <strong>{{hostname}}</strong> is already configured for the workspace <strong>{{workspace}}</strong>. Please <Link>login</Link> to that workspace and remove custom domain before trying to add the same domain here. please contact support if you are not part of this workspace."
|
|
50
50
|
},
|
|
51
51
|
"validation": {
|
|
52
|
+
"rootDomainUnsupported": "<Callout><span>{{providerName,anyCase}} doesn't allow you to set a CNAME record for the root domain. However, you can set up your custom domain for a subdomain. <br/><br/>This means that, if you try to set up <strong>https://{{rootDomain}}</strong>, {{provider,anyCase}} will not allow it. However, you can have a subdomain like <strong>https://schedule.{{rootDomain}}</strong>, and {{provider,anyCase}} will allow you to setup a custom domain.</span></Callout>",
|
|
52
53
|
"successMessage": "Custom domain successfully validated.",
|
|
53
54
|
"buttonLabel": {
|
|
54
|
-
"domain": "Validate"
|
|
55
|
+
"domain": "Validate",
|
|
56
|
+
"updateDomain": "Go back and use a subdomain"
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
"status": {
|
|
@@ -75,4 +77,4 @@
|
|
|
75
77
|
"customDomain": "Add domain of your choice in case you do not prefer to use the default neeto domain."
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
}
|
|
80
|
+
}
|
package/dist/CustomDomain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useState, memo } from 'react';
|
|
3
|
-
import { isNotEmpty, isPresent, truncate, noop } from '@bigbinary/neeto-cist';
|
|
3
|
+
import { isNotEmpty, isPresent, truncate, capitalize, 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';
|
|
@@ -27,8 +27,10 @@ import { t } from 'i18next';
|
|
|
27
27
|
import * as Yup from 'yup';
|
|
28
28
|
import Table from '@bigbinary/neetoui/Table';
|
|
29
29
|
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
30
|
+
import { isNil } from 'ramda';
|
|
30
31
|
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
31
32
|
import psl from 'psl';
|
|
33
|
+
import Info from '@bigbinary/neeto-icons/Info';
|
|
32
34
|
import NeetoHeader from '@bigbinary/neeto-molecules/Header';
|
|
33
35
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
34
36
|
|
|
@@ -332,6 +334,9 @@ var getDnsProviderData = function getDnsProviderData(dnsProvider) {
|
|
|
332
334
|
var hostname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
333
335
|
return dnsProviderData(hostname)[dnsProvider];
|
|
334
336
|
};
|
|
337
|
+
var isRootLevelDomain = function isRootLevelDomain(hostname) {
|
|
338
|
+
return isNil(psl.parse(hostname).subdomain);
|
|
339
|
+
};
|
|
335
340
|
var commonColumnData = function commonColumnData(dnsProvider) {
|
|
336
341
|
var dnsProviderInfo = getDnsProviderData(dnsProvider);
|
|
337
342
|
return [{
|
|
@@ -402,7 +407,7 @@ var columnData = function columnData(dnsProvider) {
|
|
|
402
407
|
});
|
|
403
408
|
}
|
|
404
409
|
};
|
|
405
|
-
var
|
|
410
|
+
var networkSolutionsRefersToColumn = {
|
|
406
411
|
title: "Refers to",
|
|
407
412
|
dataIndex: "proxy",
|
|
408
413
|
width: "20%",
|
|
@@ -414,7 +419,7 @@ var columnData = function columnData(dnsProvider) {
|
|
|
414
419
|
}
|
|
415
420
|
};
|
|
416
421
|
dnsProvider === "cloudflare" && commonColumns.splice(3, 0, cloudflareProxyColumn);
|
|
417
|
-
dnsProvider === "networksolutions" && commonColumns.splice(1, 0,
|
|
422
|
+
dnsProvider === "networksolutions" && commonColumns.splice(1, 0, networkSolutionsRefersToColumn);
|
|
418
423
|
return commonColumns;
|
|
419
424
|
};
|
|
420
425
|
var rowData = function rowData(dnsProvider, hostname, dnsTarget) {
|
|
@@ -452,7 +457,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
452
457
|
rootDomain: "@",
|
|
453
458
|
subdomain: psl.parse(hostname).subdomain
|
|
454
459
|
}
|
|
455
|
-
}
|
|
460
|
+
},
|
|
461
|
+
hasRootLevelDomainSupport: true
|
|
456
462
|
},
|
|
457
463
|
namecheap: {
|
|
458
464
|
name: "Namecheap",
|
|
@@ -476,7 +482,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
476
482
|
rootDomain: "@",
|
|
477
483
|
subdomain: psl.parse(hostname).subdomain
|
|
478
484
|
}
|
|
479
|
-
}
|
|
485
|
+
},
|
|
486
|
+
hasRootLevelDomainSupport: true
|
|
480
487
|
},
|
|
481
488
|
hostinger: {
|
|
482
489
|
name: "Hostinger",
|
|
@@ -500,7 +507,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
500
507
|
rootDomain: "@",
|
|
501
508
|
subdomain: psl.parse(hostname).subdomain
|
|
502
509
|
}
|
|
503
|
-
}
|
|
510
|
+
},
|
|
511
|
+
hasRootLevelDomainSupport: true
|
|
504
512
|
},
|
|
505
513
|
digitalocean: {
|
|
506
514
|
name: "DigitalOcean",
|
|
@@ -524,7 +532,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
524
532
|
rootDomain: psl.parse(hostname).domain,
|
|
525
533
|
subdomain: psl.parse(hostname).subdomain
|
|
526
534
|
}
|
|
527
|
-
}
|
|
535
|
+
},
|
|
536
|
+
hasRootLevelDomainSupport: false
|
|
528
537
|
},
|
|
529
538
|
godaddy: {
|
|
530
539
|
name: "GoDaddy",
|
|
@@ -548,7 +557,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
548
557
|
rootDomain: psl.parse(hostname).domain,
|
|
549
558
|
subdomain: psl.parse(hostname).subdomain
|
|
550
559
|
}
|
|
551
|
-
}
|
|
560
|
+
},
|
|
561
|
+
hasRootLevelDomainSupport: false
|
|
552
562
|
},
|
|
553
563
|
squarespace: {
|
|
554
564
|
name: "Squarespace",
|
|
@@ -572,7 +582,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
572
582
|
rootDomain: "@",
|
|
573
583
|
subdomain: psl.parse(hostname).subdomain
|
|
574
584
|
}
|
|
575
|
-
}
|
|
585
|
+
},
|
|
586
|
+
hasRootLevelDomainSupport: true
|
|
576
587
|
},
|
|
577
588
|
wix: {
|
|
578
589
|
name: "Wix",
|
|
@@ -597,7 +608,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
597
608
|
rootDomain: psl.parse(hostname).domain,
|
|
598
609
|
subdomain: psl.parse(hostname).subdomain
|
|
599
610
|
}
|
|
600
|
-
}
|
|
611
|
+
},
|
|
612
|
+
hasRootLevelDomainSupport: false
|
|
601
613
|
},
|
|
602
614
|
porkbun: {
|
|
603
615
|
name: "Porkbun",
|
|
@@ -605,7 +617,7 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
605
617
|
header: {
|
|
606
618
|
type: "Type",
|
|
607
619
|
name: "Host",
|
|
608
|
-
target: "Answer",
|
|
620
|
+
target: "Answer/Value",
|
|
609
621
|
ttl: "TTL"
|
|
610
622
|
},
|
|
611
623
|
values: {
|
|
@@ -621,7 +633,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
621
633
|
rootDomain: psl.parse(hostname).domain,
|
|
622
634
|
subdomain: psl.parse(hostname).subdomain
|
|
623
635
|
}
|
|
624
|
-
}
|
|
636
|
+
},
|
|
637
|
+
hasRootLevelDomainSupport: true
|
|
625
638
|
},
|
|
626
639
|
networksolutions: {
|
|
627
640
|
name: "Network Solutions",
|
|
@@ -645,7 +658,8 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
645
658
|
rootDomain: "@",
|
|
646
659
|
subdomain: psl.parse(hostname).subdomain
|
|
647
660
|
}
|
|
648
|
-
}
|
|
661
|
+
},
|
|
662
|
+
hasRootLevelDomainSupport: true
|
|
649
663
|
},
|
|
650
664
|
aws: {
|
|
651
665
|
name: "AWS",
|
|
@@ -669,9 +683,11 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
669
683
|
rootDomain: psl.parse(hostname).domain,
|
|
670
684
|
subdomain: psl.parse(hostname).subdomain
|
|
671
685
|
}
|
|
672
|
-
}
|
|
686
|
+
},
|
|
687
|
+
hasRootLevelDomainSupport: false
|
|
673
688
|
},
|
|
674
689
|
unknown: {
|
|
690
|
+
name: "this provider",
|
|
675
691
|
loginUrl: "https://dash.cloudflare.com/login",
|
|
676
692
|
header: {
|
|
677
693
|
type: "Type",
|
|
@@ -692,11 +708,62 @@ var dnsProviderData = function dnsProviderData(hostname) {
|
|
|
692
708
|
rootDomain: "@",
|
|
693
709
|
subdomain: psl.parse(hostname).subdomain
|
|
694
710
|
}
|
|
695
|
-
}
|
|
711
|
+
},
|
|
712
|
+
hasRootLevelDomainSupport: false
|
|
696
713
|
}
|
|
697
714
|
};
|
|
698
715
|
};
|
|
699
716
|
|
|
717
|
+
var RootLevelDomainFallback = function RootLevelDomainFallback(_ref) {
|
|
718
|
+
var _dnsProviderData, _dnsProviderData2;
|
|
719
|
+
var t = _ref.t,
|
|
720
|
+
dnsProvider = _ref.dnsProvider,
|
|
721
|
+
onClose = _ref.onClose,
|
|
722
|
+
url = _ref.url,
|
|
723
|
+
hostname = _ref.hostname;
|
|
724
|
+
var _useDeleteCustomDomai = useDeleteCustomDomain(url, {
|
|
725
|
+
onSettled: function onSettled() {
|
|
726
|
+
}
|
|
727
|
+
}),
|
|
728
|
+
deleteCustomDomain = _useDeleteCustomDomai.mutate,
|
|
729
|
+
isDeleting = _useDeleteCustomDomai.isPending;
|
|
730
|
+
return /*#__PURE__*/jsxs("div", {
|
|
731
|
+
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
732
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
733
|
+
i18nKey: "neetoCustomDomains.validation.rootDomainUnsupported",
|
|
734
|
+
values: {
|
|
735
|
+
provider: (_dnsProviderData = dnsProviderData(hostname)) === null || _dnsProviderData === void 0 || (_dnsProviderData = _dnsProviderData[dnsProvider]) === null || _dnsProviderData === void 0 ? void 0 : _dnsProviderData.name,
|
|
736
|
+
providerName: capitalize((_dnsProviderData2 = dnsProviderData(hostname)) === null || _dnsProviderData2 === void 0 || (_dnsProviderData2 = _dnsProviderData2[dnsProvider]) === null || _dnsProviderData2 === void 0 ? void 0 : _dnsProviderData2.name),
|
|
737
|
+
rootDomain: hostname
|
|
738
|
+
},
|
|
739
|
+
components: {
|
|
740
|
+
br: /*#__PURE__*/jsx("br", {}),
|
|
741
|
+
span: /*#__PURE__*/jsx("span", {}),
|
|
742
|
+
Callout: /*#__PURE__*/jsx(Callout, {
|
|
743
|
+
icon: Info,
|
|
744
|
+
style: "info"
|
|
745
|
+
})
|
|
746
|
+
}
|
|
747
|
+
})
|
|
748
|
+
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
749
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
750
|
+
className: "flex items-center gap-2",
|
|
751
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
752
|
+
"data-cy": "update-custom-domain-button",
|
|
753
|
+
label: t("neetoCustomDomains.validation.buttonLabel.updateDomain"),
|
|
754
|
+
onClick: deleteCustomDomain,
|
|
755
|
+
loading: isDeleting
|
|
756
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
757
|
+
label: t("neetoCustomDomains.actions.cancel"),
|
|
758
|
+
style: "text",
|
|
759
|
+
onClick: onClose
|
|
760
|
+
})]
|
|
761
|
+
})
|
|
762
|
+
})]
|
|
763
|
+
});
|
|
764
|
+
};
|
|
765
|
+
var RootLevelDomainFallback$1 = withT(RootLevelDomainFallback);
|
|
766
|
+
|
|
700
767
|
var Validation = function Validation(_ref) {
|
|
701
768
|
var customDomain = _ref.customDomain,
|
|
702
769
|
onClose = _ref.onClose,
|
|
@@ -714,6 +781,7 @@ var Validation = function Validation(_ref) {
|
|
|
714
781
|
setErrorKey = _useState2[1];
|
|
715
782
|
var isDomainValidated = status === "active";
|
|
716
783
|
var dnsProviderInfo = getDnsProviderData(dnsProvider);
|
|
784
|
+
var domainType = isRootLevelDomain(hostname) ? "rootDomain" : "subdomain";
|
|
717
785
|
var _useValidateDomain = useValidateDomain(url, {
|
|
718
786
|
onError: function onError(_ref2) {
|
|
719
787
|
var response = _ref2.response;
|
|
@@ -726,6 +794,14 @@ var Validation = function Validation(_ref) {
|
|
|
726
794
|
}),
|
|
727
795
|
validateDomain = _useValidateDomain.mutate,
|
|
728
796
|
isValidating = _useValidateDomain.isPending;
|
|
797
|
+
if (isRootLevelDomain(hostname) && !dnsProviderInfo.hasRootLevelDomainSupport) {
|
|
798
|
+
return /*#__PURE__*/jsx(RootLevelDomainFallback$1, {
|
|
799
|
+
dnsProvider: dnsProvider,
|
|
800
|
+
onClose: onClose,
|
|
801
|
+
url: url,
|
|
802
|
+
hostname: hostname
|
|
803
|
+
});
|
|
804
|
+
}
|
|
729
805
|
return /*#__PURE__*/jsxs("div", {
|
|
730
806
|
children: [/*#__PURE__*/jsxs(Pane.Body, {
|
|
731
807
|
className: "space-y-4",
|
|
@@ -734,7 +810,9 @@ var Validation = function Validation(_ref) {
|
|
|
734
810
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
735
811
|
style: "h4",
|
|
736
812
|
weight: "medium",
|
|
737
|
-
children: t("neetoCustomDomains.cnameRecordTitle"
|
|
813
|
+
children: t("neetoCustomDomains.cnameRecordTitle", {
|
|
814
|
+
domainName: hostname
|
|
815
|
+
})
|
|
738
816
|
}), /*#__PURE__*/jsx(Typography, {
|
|
739
817
|
style: "body2",
|
|
740
818
|
children: dnsProvider !== "unknown" ? /*#__PURE__*/jsx(Trans, {
|
|
@@ -750,7 +828,7 @@ var Validation = function Validation(_ref) {
|
|
|
750
828
|
target: "_blank"
|
|
751
829
|
}),
|
|
752
830
|
Link: /*#__PURE__*/jsx(Button, {
|
|
753
|
-
href: dnsHelpDocs[dnsProvider],
|
|
831
|
+
href: dnsHelpDocs[dnsProvider][domainType],
|
|
754
832
|
rel: "noreferrer",
|
|
755
833
|
style: "link",
|
|
756
834
|
target: "_blank"
|
|
@@ -760,7 +838,7 @@ var Validation = function Validation(_ref) {
|
|
|
760
838
|
i18nKey: "neetoCustomDomains.cnameRecordInfo",
|
|
761
839
|
components: {
|
|
762
840
|
Link: /*#__PURE__*/jsx(Button, {
|
|
763
|
-
href: dnsHelpDocs[dnsProvider],
|
|
841
|
+
href: dnsHelpDocs[dnsProvider][domainType],
|
|
764
842
|
rel: "noreferrer",
|
|
765
843
|
style: "link",
|
|
766
844
|
target: "_blank"
|