@bigbinary/neeto-custom-domains-frontend 3.0.2 → 3.0.4

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.
@@ -39,8 +39,9 @@
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. ",
41
41
  "nameServerMessage": "View <Link>help article</Link> for adding DNS record in {{dnsProvider,anyCase}}.",
42
- "domainRedirectionInfo": "It can take up to 2-24 hours for your custom domain to start working. Please visit your site in 24 hours from now and if after 24 hours <strong>{{hostname}}</strong> is not working then please view <Link>help article</Link> for more information and contact us.",
43
- "domainValidationInfo": "DNS record not found, if you added the DNS record in last 24 hours then please wait sometime and try it again. Verifying your domain usually only takes a few hours, but in some cases can take up to 24-48 hours.",
42
+ "domainValidationInfo": "DNS record not found, if you added the DNS record in last 24 hours then please wait sometime and try it again. Validating a domain takes around a few hours, but in some cases can take up to 24-48 hours. <br/><br/>You don't have to keep coming to validate the DNS entry. We will continue validating the entry periodically, and when your custom domain is ready, we will email you.",
43
+ "domainValidationFailedForKnownProvider": "DNS record validation failed even after 48 hours. This is probably due to an incorrect configuration of DNS records with your provider. <br/><br/> Please <Login>log in</Login> to your {{dnsProvider,anyCase}} account and add the DNS record by copying the exact settings listed above. View <Link>help article</Link> for adding DNS record in {{dnsProvider,anyCase}}. <br/><br/> If you have verified the records configured with your provider and are still facing issues then contact our support.",
44
+ "domainValidationFailedForUnknownProvider": "DNS record validation failed even after 48 hours. This is probably due to an incorrect configuration of DNS records with your provider. <br/><br/> Go to your DNS provider and add the DNS record by copying the exact settings listed above. View <Link>help article</Link> to understand how to add a DNS record. <br/><br/> If you have verified the records configured with your provider and are still facing issues then contact our support.",
44
45
  "certificateProvisionFailed": "The DNS record was found but we are facing some issues with provisioning certificate for your domain. Please try again later.",
45
46
  "learnMoreMessage": "Learn about <button>how to setup custom domains</button>",
46
47
  "domainCreation": {
@@ -52,6 +53,8 @@
52
53
  "successMessage": "Custom domain successfully validated.",
53
54
  "buttonLabel": {
54
55
  "domain": "Validate",
56
+ "validateManually": "Validate manually",
57
+ "revalidate": "Retry Validation",
55
58
  "updateDomain": "Go back and use a subdomain"
56
59
  }
57
60
  },
@@ -74,6 +77,10 @@
74
77
  },
75
78
  "toolTips": {
76
79
  "customDomain": "Add domain of your choice in case you do not prefer to use the default neeto domain."
80
+ },
81
+ "noData": {
82
+ "title": "There are no custom domains to show.",
83
+ "helpText": "Here is how you can <helpLink>setting up a custom domain</helpLink>."
77
84
  }
78
85
  }
79
- }
86
+ }
@@ -5,7 +5,7 @@ import { withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-u
5
5
  import Container from '@bigbinary/neeto-molecules/Container';
6
6
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
7
7
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
8
- import { useQuery } from '@tanstack/react-query';
8
+ import { useQuery, useQueryClient } from '@tanstack/react-query';
9
9
  import useMutationWithInvalidation from '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
10
10
  import axios from 'axios';
11
11
  import Alert from '@bigbinary/neetoui/Alert';
@@ -18,6 +18,7 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
18
18
  import Button from '@bigbinary/neetoui/Button';
19
19
  import Typography from '@bigbinary/neetoui/Typography';
20
20
  import Tag from '@bigbinary/neetoui/Tag';
21
+ import NoData from '@bigbinary/neetoui/NoData';
21
22
  import Pane from '@bigbinary/neetoui/Pane';
22
23
  import Stepper from '@bigbinary/neetoui/Stepper';
23
24
  import Callout from '@bigbinary/neetoui/Callout';
@@ -130,7 +131,8 @@ var DeleteAlert = withT(function (_ref) {
130
131
 
131
132
  var STATUS_TAG_STYLES = {
132
133
  active: "success",
133
- pending: "warning"
134
+ pending: "warning",
135
+ failed: "danger"
134
136
  };
135
137
 
136
138
  var Domain = withT(function (_ref) {
@@ -140,13 +142,7 @@ var Domain = withT(function (_ref) {
140
142
  customDomain = _ref.customDomain,
141
143
  openDeleteAlert = _ref.openDeleteAlert,
142
144
  helpDocUrl = _ref.helpDocUrl;
143
- return /*#__PURE__*/jsx(CardLayout, {
144
- actionBlock: !isCustomDomainAdded && /*#__PURE__*/jsx(Button, {
145
- label: t("neetoCustomDomains.actions.add", {
146
- what: t("neetoCustomDomains.customDomain", SINGULAR)
147
- }),
148
- onClick: openPane
149
- }),
145
+ return isCustomDomainAdded ? /*#__PURE__*/jsx(CardLayout, {
150
146
  title: t("neetoCustomDomains.connectionTitle"),
151
147
  children: /*#__PURE__*/jsxs("div", {
152
148
  className: "space-y-1",
@@ -156,13 +152,13 @@ var Domain = withT(function (_ref) {
156
152
  className: "flex items-center space-x-2",
157
153
  children: [/*#__PURE__*/jsx(Typography, {
158
154
  style: "body2",
159
- children: isCustomDomainAdded ? customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname : t("neetoCustomDomains.noDomainConnected")
160
- }), isCustomDomainAdded && /*#__PURE__*/jsx(Tag, {
155
+ children: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname
156
+ }), /*#__PURE__*/jsx(Tag, {
161
157
  "data-cy": "".concat(hyphenize(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status), "-tag-container"),
162
158
  style: STATUS_TAG_STYLES[customDomain === null || customDomain === void 0 ? void 0 : customDomain.status],
163
159
  label: t("neetoCustomDomains.status.domain.".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status))
164
160
  })]
165
- }), isCustomDomainAdded && /*#__PURE__*/jsx(MoreDropdown, {
161
+ }), /*#__PURE__*/jsx(MoreDropdown, {
166
162
  dropdownButtonProps: {
167
163
  "data-testid": "nui-dropdown-icon-".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id)
168
164
  },
@@ -196,6 +192,28 @@ var Domain = withT(function (_ref) {
196
192
  })
197
193
  })]
198
194
  })
195
+ }) : /*#__PURE__*/jsx("div", {
196
+ className: "flex h-full w-full items-center justify-center",
197
+ children: /*#__PURE__*/jsx(NoData, {
198
+ className: "w-full",
199
+ title: t("neetoCustomDomains.noData.title"),
200
+ helpText: /*#__PURE__*/jsx(Trans, {
201
+ i18nKey: "neetoCustomDomains.noData.helpText",
202
+ components: {
203
+ helpLink: /*#__PURE__*/jsx(Button, {
204
+ href: helpDocUrl,
205
+ style: "link",
206
+ target: "_blank"
207
+ })
208
+ }
209
+ }),
210
+ primaryButtonProps: {
211
+ label: t("neetoCustomDomains.actions.add", {
212
+ what: t("neetoCustomDomains.customDomain", SINGULAR)
213
+ }),
214
+ onClick: openPane
215
+ }
216
+ })
199
217
  });
200
218
  });
201
219
 
@@ -206,6 +224,7 @@ var INITIAL_VALUES = {
206
224
  var CURRENT_STEP = {
207
225
  notAdded: 0,
208
226
  pending: 1,
227
+ failed: 1,
209
228
  active: 2
210
229
  };
211
230
  var STEPS = [{
@@ -741,7 +760,7 @@ var dnsProviderData = function dnsProviderData(hostname) {
741
760
  };
742
761
 
743
762
  var Validation = function Validation(_ref) {
744
- var _dnsHelpDocs$dnsProvi, _dnsHelpDocs$dnsProvi2, _dnsHelpDocs$unknown;
763
+ var _dnsHelpDocs$dnsProvi, _dnsHelpDocs$dnsProvi2, _dnsHelpDocs$unknown, _dnsHelpDocs$dnsProvi3, _dnsHelpDocs$dnsProvi4, _dnsHelpDocs$unknown2, _dnsHelpDocs$dnsProvi5, _dnsHelpDocs$dnsProvi6, _dnsHelpDocs$unknown3;
745
764
  var customDomain = _ref.customDomain,
746
765
  onClose = _ref.onClose,
747
766
  url = _ref.url,
@@ -752,6 +771,7 @@ var Validation = function Validation(_ref) {
752
771
  dnsTarget = customDomain.dnsTarget,
753
772
  status = customDomain.status,
754
773
  dnsProvider = customDomain.dnsProvider;
774
+ var queryClient = useQueryClient();
755
775
  var _useState = useState(""),
756
776
  _useState2 = _slicedToArray(_useState, 2),
757
777
  errorKey = _useState2[0],
@@ -763,6 +783,9 @@ var Validation = function Validation(_ref) {
763
783
  onError: function onError(_ref2) {
764
784
  var response = _ref2.response;
765
785
  setErrorKey(response.data.error);
786
+ queryClient.invalidateQueries({
787
+ queryKey: [DOMAIN_QUERY_KEY]
788
+ });
766
789
  },
767
790
  onSuccess: function onSuccess() {
768
791
  Toastr.success(t("neetoCustomDomains.validation.successMessage"));
@@ -827,11 +850,62 @@ var Validation = function Validation(_ref) {
827
850
  x: '100%'
828
851
  }
829
852
  })
830
- }), isNotEmpty(errorKey) && /*#__PURE__*/jsx(Callout, {
853
+ }), status === "failed" && /*#__PURE__*/jsx(Callout, {
854
+ style: STATUS_TAG_STYLES[status],
855
+ children: /*#__PURE__*/jsx(Typography, {
856
+ style: "body2",
857
+ children: dnsProvider !== "unknown" ? /*#__PURE__*/jsx(Trans, {
858
+ i18nKey: "neetoCustomDomains.domainValidationFailedForKnownProvider",
859
+ values: {
860
+ dnsProvider: dnsProviderInfo.name
861
+ },
862
+ components: {
863
+ Login: /*#__PURE__*/jsx(Button, {
864
+ href: dnsProviderInfo.loginUrl,
865
+ rel: "noreferrer",
866
+ style: "link",
867
+ target: "_blank"
868
+ }),
869
+ Link: /*#__PURE__*/jsx(Button, {
870
+ 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],
871
+ rel: "noreferrer",
872
+ style: "link",
873
+ target: "_blank"
874
+ }),
875
+ br: /*#__PURE__*/jsx("br", {})
876
+ }
877
+ }) : /*#__PURE__*/jsx(Trans, {
878
+ i18nKey: "neetoCustomDomains.domainValidationFailedForUnknownProvider",
879
+ values: {
880
+ dnsProvider: dnsProviderInfo.name
881
+ },
882
+ components: {
883
+ Login: /*#__PURE__*/jsx(Button, {
884
+ href: dnsProviderInfo.loginUrl,
885
+ rel: "noreferrer",
886
+ style: "link",
887
+ target: "_blank"
888
+ }),
889
+ Link: /*#__PURE__*/jsx(Button, {
890
+ 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],
891
+ rel: "noreferrer",
892
+ style: "link",
893
+ target: "_blank"
894
+ }),
895
+ br: /*#__PURE__*/jsx("br", {})
896
+ }
897
+ })
898
+ })
899
+ }), isNotEmpty(errorKey) && status === "pending" && /*#__PURE__*/jsx(Callout, {
831
900
  style: STATUS_TAG_STYLES[status],
832
901
  children: /*#__PURE__*/jsx(Typography, {
833
902
  style: "body2",
834
- children: t(errorKey)
903
+ children: /*#__PURE__*/jsx(Trans, {
904
+ i18nKey: errorKey,
905
+ components: {
906
+ br: /*#__PURE__*/jsx("br", {})
907
+ }
908
+ })
835
909
  })
836
910
  })]
837
911
  }), /*#__PURE__*/jsx(Pane.Footer, {
@@ -840,7 +914,7 @@ var Validation = function Validation(_ref) {
840
914
  children: [/*#__PURE__*/jsx(Button, {
841
915
  "data-cy": "validate-domain-button",
842
916
  disabled: isValidating || isDomainValidated,
843
- label: t("neetoCustomDomains.validation.buttonLabel.domain"),
917
+ label: status === "failed" ? t("neetoCustomDomains.validation.buttonLabel.revalidate") : isNotEmpty(errorKey) ? t("neetoCustomDomains.validation.buttonLabel.validateManually") : t("neetoCustomDomains.validation.buttonLabel.domain"),
844
918
  loading: isValidating,
845
919
  onClick: validateDomain
846
920
  }), /*#__PURE__*/jsx(Button, {
@@ -988,7 +1062,7 @@ var CustomDomain = function CustomDomain(_ref) {
988
1062
  openPane: openPane,
989
1063
  size: headerSize
990
1064
  }), /*#__PURE__*/jsx("div", {
991
- className: "flex w-full justify-center",
1065
+ className: "flex w-full justify-center h-full",
992
1066
  children: /*#__PURE__*/jsx(Domain, {
993
1067
  customDomain: customDomain,
994
1068
  helpDocUrl: helpDocUrl,