@bigbinary/neeto-custom-domains-frontend 3.2.1 → 3.3.0
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 +65 -8
- package/app/javascript/src/translations/en.json +7 -5
- package/dist/.ready +1 -0
- package/dist/CustomDomain.js +704 -9710
- package/dist/CustomDomain.js.map +1 -1
- package/dist/cjs/CustomDomain.js +701 -9707
- package/dist/cjs/CustomDomain.js.map +1 -1
- package/dist/cjs/index.js +3 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/package.json +30 -32
package/README.md
CHANGED
|
@@ -68,30 +68,87 @@ end
|
|
|
68
68
|
All common controller logic is extracted to the engine. However, we still need
|
|
69
69
|
to load some records from the host app controller.
|
|
70
70
|
|
|
71
|
+
If the custom domain is associated with `Organization`, add a
|
|
72
|
+
`Api::V1::CustomDomainable` concern in the host app and include it in the
|
|
73
|
+
controller. This keeps the loader reusable across controllers that need it.
|
|
74
|
+
|
|
71
75
|
```ruby
|
|
72
|
-
|
|
76
|
+
# app/controllers/concerns/api/v1/custom_domainable.rb
|
|
77
|
+
module Api::V1::CustomDomainable
|
|
78
|
+
extend ActiveSupport::Concern
|
|
79
|
+
|
|
73
80
|
private
|
|
74
81
|
|
|
75
|
-
# If custom_domain is associated to Organization
|
|
76
82
|
def load_custom_domainable!
|
|
77
83
|
@custom_domainable = organization
|
|
78
84
|
end
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```ruby
|
|
89
|
+
class Api::V1::Admin::CustomDomainsController < NeetoCustomDomainsEngine::DomainsController
|
|
90
|
+
include Api::V1::CustomDomainable
|
|
91
|
+
end
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If the custom domain is associated with another resource (eg. `Site`), define
|
|
95
|
+
`load_custom_domainable!` directly in the controller instead:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
class Api::V1::Admin::CustomDomainsController < NeetoCustomDomainsEngine::DomainsController
|
|
99
|
+
private
|
|
79
100
|
|
|
80
|
-
# If custom_domain is associated to other resources (eg: site)
|
|
81
101
|
def load_custom_domainable!
|
|
82
102
|
@custom_domainable = organization.sites.find(params[:site_id])
|
|
83
103
|
end
|
|
84
104
|
end
|
|
85
105
|
```
|
|
86
106
|
|
|
87
|
-
3.
|
|
107
|
+
3. Add a `CustomDomainConcern` model concern
|
|
108
|
+
|
|
109
|
+
The engine's `NeetoCustomDomainsEngine::Domain` model needs `custom_domain_url`
|
|
110
|
+
and `organization` to be available on the domain record — they are used, for
|
|
111
|
+
example, when generating links in notification emails and when pushing the
|
|
112
|
+
domain to NeetoTower.
|
|
113
|
+
|
|
114
|
+
Define the concern in the host app at the exact path below. The engine
|
|
115
|
+
auto-includes it via `include CustomDomainConcern if defined?(CustomDomainConcern)`,
|
|
116
|
+
so no initializer or manual patching is needed — Rails autoloading handles it.
|
|
117
|
+
|
|
118
|
+
The path returned by `custom_domain_url` is product-specific. Point it at
|
|
119
|
+
wherever the custom domain settings page is mounted in your product's admin
|
|
120
|
+
panel (the example below uses NeetoQuiz's path; replace it for your product).
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
# app/models/concerns/custom_domain_concern.rb
|
|
124
|
+
module CustomDomainConcern
|
|
125
|
+
extend ActiveSupport::Concern
|
|
126
|
+
|
|
127
|
+
def custom_domain_url
|
|
128
|
+
root_url = organization.root_url
|
|
129
|
+
# Replace this path with the route to the custom domain settings page
|
|
130
|
+
# in your product's admin panel.
|
|
131
|
+
"#{root_url}/admin/admin-panel/custom-domain"
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def organization
|
|
135
|
+
custom_domainable
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
If the `custom_domainable` is not the `Organization` itself (eg. `Site`),
|
|
141
|
+
update `organization` to traverse to the owning organization (eg.
|
|
142
|
+
`custom_domainable.organization`).
|
|
143
|
+
|
|
144
|
+
4. Include the following module to your application's `config/routes.rb` file:
|
|
88
145
|
|
|
89
146
|
```ruby
|
|
90
147
|
include NeetoCustomDomainsEngine::Routes::Draw
|
|
91
148
|
|
|
92
149
|
```
|
|
93
150
|
|
|
94
|
-
|
|
151
|
+
5. Define required routes.
|
|
95
152
|
|
|
96
153
|
```ruby
|
|
97
154
|
# config/routes.rb
|
|
@@ -101,7 +158,7 @@ custom_domains_routes :acme
|
|
|
101
158
|
custom_domains_routes :domain
|
|
102
159
|
```
|
|
103
160
|
|
|
104
|
-
|
|
161
|
+
6. Add frontend component. `url` should be the api to the custom domains
|
|
105
162
|
controller.
|
|
106
163
|
|
|
107
164
|
```js
|
|
@@ -193,7 +250,7 @@ const CustomDomain = () => {
|
|
|
193
250
|
export default CustomDomain;
|
|
194
251
|
```
|
|
195
252
|
|
|
196
|
-
|
|
253
|
+
7. Mount the `CustomDomain` component at the desired path.
|
|
197
254
|
|
|
198
255
|
##### ENV variables
|
|
199
256
|
|
|
@@ -230,4 +287,4 @@ guide for details on how to publish.
|
|
|
230
287
|
- NeetoInvoice
|
|
231
288
|
- NeetoChat
|
|
232
289
|
- NeetoRunner
|
|
233
|
-
|
|
290
|
+
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"notFound": "There are no custom domains to show.",
|
|
33
33
|
"tooltipContent": "Delete currently added custom domain to add a new one.",
|
|
34
34
|
"placeholder": "{{subdomainPlaceholder,anyCase}}.yourbusiness.com",
|
|
35
|
-
"activeTooltipDescription": "Your custom domain is active.",
|
|
36
|
-
"pendingTooltipDescription": "Your custom domain
|
|
35
|
+
"activeTooltipDescription": "Your custom domain is verified and active.",
|
|
36
|
+
"pendingTooltipDescription": "Your custom domain has pending validation. DNS changes can take up to 48 hours to propagate.",
|
|
37
37
|
"failedTooltipDescription": "Your custom domain is failed to validate. Please try again later.",
|
|
38
|
-
"redirectionTooltipDescription": "Your custom domain is active. Visiting <b>{{fromDomain}}</b> will redirect you to <b>{{toDomain}}</b>.",
|
|
38
|
+
"redirectionTooltipDescription": "Your custom domain is verified and active. Visiting <b>{{fromDomain}}</b> will redirect you to <b>{{toDomain}}</b>.",
|
|
39
39
|
"cname": "CNAME",
|
|
40
40
|
"label": "Domain name",
|
|
41
41
|
"domainValidation": "Domain validation",
|
|
@@ -95,8 +95,10 @@
|
|
|
95
95
|
"customDomain": "Add domain of your choice in case you do not prefer to use the default Neeto domain."
|
|
96
96
|
},
|
|
97
97
|
"noData": {
|
|
98
|
-
"title": "
|
|
99
|
-
"
|
|
98
|
+
"title": "Setup your custom domain",
|
|
99
|
+
"helpTextDefault": "Add your custom domain to have a personalized URL.",
|
|
100
|
+
"helpTextDisconnected": "To learn how to set up a custom domain, visit this <Link>help article</Link>.",
|
|
101
|
+
"helpTextConnected": "To learn more about custom domains, visit this <Link>help article</Link>."
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
}
|
package/dist/.ready
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Built at 2026-05-28T19:41:52.619Z
|