@bigbinary/neeto-custom-domains-frontend 1.1.0 → 1.2.0-beta2
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/README.md +70 -91
- package/app/javascript/src/translations/en.json +19 -10
- package/dist/CustomDomainDashboard.js +40 -905
- package/dist/CustomDomainDashboard.js.map +1 -1
- package/dist/cjs/CustomDomainDashboard.js +44 -955
- package/dist/cjs/CustomDomainDashboard.js.map +1 -1
- package/dist/cjs/index.js +539 -32
- package/dist/cjs/index.js.map +1 -1
- package/dist/index-6d441e24.js +959 -0
- package/dist/index-6d441e24.js.map +1 -0
- package/dist/index-a5a14202.js +903 -0
- package/dist/index-a5a14202.js.map +1 -0
- package/dist/index.js +500 -31
- package/dist/index.js.map +1 -1
- package/package.json +16 -18
- package/types.d.ts +3 -1
package/README.md
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
# neeto-custom-domains-
|
|
1
|
+
# neeto-custom-domains-nano
|
|
2
2
|
|
|
3
|
-
The `neeto-custom-domains-
|
|
3
|
+
The `neeto-custom-domains-nano` manages custom domains across neeto
|
|
4
|
+
applications.
|
|
4
5
|
|
|
5
6
|
## Contents
|
|
6
|
-
1. [Development with Host application](#development-with-host-application)
|
|
7
|
-
- [Engine](#engine)
|
|
8
|
-
- [Installation](#installation)
|
|
9
|
-
- [Usage](#usage)
|
|
10
|
-
2. [Instructions for publishing](#instructions-for-publishing)
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
1. [Development with Host application](#development-with-host-application)
|
|
9
|
+
2. [Instructions for publishing](#instructions-for-publishing)
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
## Development with Host application
|
|
15
12
|
|
|
16
13
|
The engine provides the backend setup for neetoCustomDomains.
|
|
17
14
|
|
|
@@ -33,13 +30,7 @@ end
|
|
|
33
30
|
bundle install
|
|
34
31
|
```
|
|
35
32
|
|
|
36
|
-
3.
|
|
37
|
-
|
|
38
|
-
```ruby
|
|
39
|
-
mount NeetoCustomDomainsEngine::Engine => "/custom_domains"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
4. Run migrations
|
|
33
|
+
3. Run migrations
|
|
43
34
|
|
|
44
35
|
```
|
|
45
36
|
rails neeto-custom-domains-engine:install:migrations
|
|
@@ -48,28 +39,21 @@ rails db:migrate
|
|
|
48
39
|
|
|
49
40
|
#### Usage
|
|
50
41
|
|
|
51
|
-
The steps below depend on the association that we use. In some cases, we need to attach multiple custom domains to a model, while in other cases, we only need a single custom domain. We have to make necessary configurations depending on this.
|
|
52
|
-
|
|
53
|
-
Let's say we have a "Site" model, and we want to publish our site on a custom domain.
|
|
54
|
-
|
|
55
|
-
##### Configure `has_one` association
|
|
56
|
-
|
|
57
|
-
The site only needs to be published in a single custom domain, so we chose `has_one` association.
|
|
58
|
-
|
|
59
42
|
1. Add association
|
|
60
43
|
|
|
61
44
|
```ruby
|
|
62
|
-
class
|
|
45
|
+
class Organization > ApplicationRecord
|
|
63
46
|
has_one :custom_domain, as: :custom_domainable, class_name: "NeetoCustomDomainsEngine::Domain", dependent: :destroy
|
|
64
47
|
end
|
|
65
48
|
```
|
|
66
49
|
|
|
67
50
|
2. Add controller
|
|
68
51
|
|
|
69
|
-
All common controller logic is extracted to the engine. However, we still need
|
|
52
|
+
All common controller logic is extracted to the engine. However, we still need
|
|
53
|
+
to load some records from the host app controller.
|
|
70
54
|
|
|
71
55
|
```ruby
|
|
72
|
-
class Api::V1::
|
|
56
|
+
class Api::V1::Admin::CustomDomainsController < NeetoCustomDomainsEngine::DomainsController
|
|
73
57
|
private
|
|
74
58
|
|
|
75
59
|
def load_custom_domainable!
|
|
@@ -82,78 +66,73 @@ class Api::V1::Sites::CustomDomainsController < NeetoCustomDomainsEngine::Domain
|
|
|
82
66
|
end
|
|
83
67
|
```
|
|
84
68
|
|
|
85
|
-
3.
|
|
69
|
+
3. Include the following module to your application's `config/routes.rb` file:
|
|
86
70
|
|
|
87
71
|
```ruby
|
|
88
72
|
include NeetoCustomDomainsEngine::Routes::Draw
|
|
89
73
|
|
|
90
|
-
scope module: :sites do
|
|
91
|
-
custom_domains_routes(route: :custom_domain)
|
|
92
|
-
end
|
|
93
|
-
```
|
|
94
|
-
4. Add front-end component
|
|
95
|
-
|
|
96
|
-
```js
|
|
97
|
-
import { CustomDomain } from "@bigbinary/neeto-molecules/CustomDomain";
|
|
98
74
|
```
|
|
99
|
-
For more info related to front-end component: https://github.com/bigbinary/neeto-molecules/blob/main/docs/components.md#customdomain
|
|
100
75
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
The site needs to be published in multiple custom domains, so we chose `has_many` association.
|
|
104
|
-
|
|
105
|
-
1. Add association
|
|
76
|
+
4. Define required routes.
|
|
106
77
|
|
|
107
78
|
```ruby
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
end
|
|
111
|
-
```
|
|
79
|
+
# config/routes.rb
|
|
80
|
+
custom_domains_routes :acme
|
|
112
81
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
class Api::V1::Sites::CustomDomainsController < NeetoCustomDomainsEngine::DomainsController
|
|
116
|
-
private
|
|
117
|
-
|
|
118
|
-
def load_custom_domainable!
|
|
119
|
-
@custom_domainable = organization.sites.find(params[:site_id])
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def load_custom_domain!
|
|
123
|
-
@custom_domain = @custom_domainable.custom_domains.find(params[:id])
|
|
124
|
-
end
|
|
125
|
-
end
|
|
82
|
+
# routes/admin.rb
|
|
83
|
+
custom_domains_routes :domain
|
|
126
84
|
```
|
|
127
85
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
```ruby
|
|
131
|
-
include NeetoCustomDomainsEngine::Routes::Draw
|
|
132
|
-
|
|
133
|
-
scope module: :sites do
|
|
134
|
-
custom_domains_routes(route: :custom_domain)
|
|
135
|
-
end
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
4. Add front-end component
|
|
86
|
+
5. Add frontend component. `url` should be the api to the custom domains
|
|
87
|
+
controller.
|
|
139
88
|
|
|
140
89
|
```js
|
|
141
|
-
import {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
90
|
+
import { CustomDomain as NeetoCustomDomainDashboard } from "@bigbinary/neeto-custom-domains-frontend";
|
|
91
|
+
import { BASE_API_V1_URL, SINGULAR } from "neetocommons/constants";
|
|
92
|
+
import HelpPopover from "neetomolecules/HelpPopover";
|
|
93
|
+
import { useTranslation } from "react-i18next";
|
|
94
|
+
|
|
95
|
+
import routes from "routes";
|
|
96
|
+
import { EVENTS } from "src/constants";
|
|
97
|
+
import { CUSTOM_DOMAIN_HELP_DOC_URL } from "src/constants/urls";
|
|
98
|
+
|
|
99
|
+
const CustomDomain = () => {
|
|
100
|
+
const { t } = useTranslation();
|
|
101
|
+
|
|
102
|
+
const breadcrumbs = [
|
|
103
|
+
{ link: routes.admin.settings.index, text: t("titles.settings") },
|
|
104
|
+
{
|
|
105
|
+
link: routes.admin.settings.customDomain,
|
|
106
|
+
text: t("neetoCustomDomains.customDomain", SINGULAR),
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
const title = (
|
|
111
|
+
<div className="flex items-center gap-x-2">
|
|
112
|
+
{t("neetoCustomDomains.customDomain", SINGULAR)}
|
|
113
|
+
<HelpPopover
|
|
114
|
+
description={t("neetoCustomDomains.toolTips.customDomain")}
|
|
115
|
+
helpLinkProps={{ href: CUSTOM_DOMAIN_HELP_DOC_URL }}
|
|
116
|
+
popoverProps={{ position: "top" }}
|
|
117
|
+
title={t("neetoCustomDomains.customDomain", SINGULAR)}
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div className="w-full">
|
|
124
|
+
<NeetoCustomDomainDashboard
|
|
125
|
+
headerProps={{ breadcrumbs, title }}
|
|
126
|
+
url={`${BASE_API_V1_URL}/custom_domain`}
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default CustomDomain;
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
6. Mount the `CustomDomain` component at the desired apth.
|
|
157
136
|
|
|
158
137
|
##### ENV variables
|
|
159
138
|
|
|
@@ -162,13 +141,13 @@ For the working of this engine we need the following env variables.
|
|
|
162
141
|
```
|
|
163
142
|
LETS_ENCRYPT_PRIVATE_KEY: < For requesting SSL certificates >
|
|
164
143
|
LETS_ENCRYPT_DIRECTORY_URL: < For requesting SSL certificates >
|
|
165
|
-
LETS_ENCRYPT_VALIDATION_DOMAIN_ACCESS_TOKEN: < For domain authentication>
|
|
166
|
-
LETS_ENCRYPT_VALIDATION_DOMAIN_ID: < For domain authentication>
|
|
167
|
-
LETS_ENCRYPT_VALIDATION_DOMAIN_NAME: < For domain authentication>
|
|
168
144
|
LETS_ENCRYPT_APP_NAME: < For pushing SSL certificate and custom domains >
|
|
169
|
-
|
|
145
|
+
NEETO_DEPLOY_APP: < To identify in which platform the app is deployed NeetoDEploy/Heroku>
|
|
146
|
+
NEETO_DEPLOY_AUTH_TOKEN: <For pushing SSL certificate and custom domains>
|
|
170
147
|
```
|
|
171
148
|
|
|
172
149
|
## Instructions for Publishing
|
|
173
150
|
|
|
174
|
-
Consult the
|
|
151
|
+
Consult the
|
|
152
|
+
[building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages)
|
|
153
|
+
guide for details on how to publish.
|
|
@@ -13,27 +13,33 @@
|
|
|
13
13
|
"delete": "Delete",
|
|
14
14
|
"edit": "Edit",
|
|
15
15
|
"continue": "Continue",
|
|
16
|
-
"done": "Done"
|
|
16
|
+
"done": "Done",
|
|
17
|
+
"add": "Add {{what}}"
|
|
17
18
|
},
|
|
18
19
|
"customDomain_one": "Custom domain",
|
|
19
20
|
"customDomain_other": "Custom domains",
|
|
20
21
|
"customDomainWithCount_one": "{{count}} custom domain",
|
|
21
22
|
"customDomainWithCount_other": "{{count}} custom domains",
|
|
22
23
|
"settings": "Custom domain settings",
|
|
24
|
+
"connectionTitle": "Connected custom domain",
|
|
25
|
+
"noDomainConnected": "No custom domain connected",
|
|
26
|
+
"readHelpArticle": "<Link>Read more</Link> to learn more about setting up custom domain",
|
|
23
27
|
"yourDomain": "Your domain",
|
|
24
|
-
"addNew": "Add
|
|
28
|
+
"addNew": "Add custom domain",
|
|
25
29
|
"delete": "Delete custom domain?",
|
|
26
30
|
"search": "Search custom domains",
|
|
27
31
|
"notFound": "There are no custom domains to show.",
|
|
28
|
-
"placeholder": "
|
|
32
|
+
"placeholder": "Enter your domain",
|
|
29
33
|
"cname": "CNAME",
|
|
30
|
-
"label": "
|
|
34
|
+
"label": "Domain name",
|
|
31
35
|
"domainValidation": "Domain validation",
|
|
32
36
|
"domainRedirection": "Domain redirection",
|
|
33
|
-
"
|
|
37
|
+
"cnameRecordTitle": " Add the DNS record to your DNS provider",
|
|
38
|
+
"cnameRecordInfo": "Go to your DNS provider and create the following DNS record by copying the exact settings listed below. Do not enable proxy for the record. View <Link>help article</Link> for more information.",
|
|
34
39
|
"proxyMessage": " Do not enable proxy for the record.",
|
|
35
40
|
"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.",
|
|
36
|
-
"domainValidationInfo": "CNAME record not found, if you added CNAME 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.
|
|
41
|
+
"domainValidationInfo": "CNAME record not found, if you added CNAME 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
|
+
"certificateProvisionFailed": "CNAME record found but we are facing some issues with provisioning certificate for your domain. Please try again",
|
|
37
43
|
"learnMoreMessage": "Learn about <button>how to setup custom domains</button>",
|
|
38
44
|
"cnameAdded": "I have added redirection CNAME record",
|
|
39
45
|
"validation": {
|
|
@@ -44,9 +50,9 @@
|
|
|
44
50
|
},
|
|
45
51
|
"status": {
|
|
46
52
|
"domain": {
|
|
47
|
-
"active": "
|
|
48
|
-
"
|
|
49
|
-
"
|
|
53
|
+
"active": "Active",
|
|
54
|
+
"pending": "Pending",
|
|
55
|
+
"failed": "Failed"
|
|
50
56
|
},
|
|
51
57
|
"cname": {
|
|
52
58
|
"active": "Domain redirected",
|
|
@@ -58,6 +64,9 @@
|
|
|
58
64
|
"formikValidation": {
|
|
59
65
|
"required": "Domain is required",
|
|
60
66
|
"valid": "Please add valid domain or URL"
|
|
67
|
+
},
|
|
68
|
+
"toolTips":{
|
|
69
|
+
"customDomain": "Add domain of your choice in case you do not prefer to use the default neeto domain."
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
|
-
}
|
|
72
|
+
}
|