@dargmuesli/nuxt-vio 3.0.0-beta.2 → 3.0.0-beta.3

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.
@@ -80,6 +80,32 @@ export const getHost = (req: IncomingMessage) => {
80
80
  return req.headers.host
81
81
  }
82
82
 
83
+ export const getServiceHref = ({
84
+ host,
85
+ isSsr = true,
86
+ name,
87
+ port,
88
+ stagingHost,
89
+ }: {
90
+ host: string
91
+ isSsr?: boolean
92
+ name?: string
93
+ port?: number
94
+ stagingHost?: string
95
+ }) => {
96
+ const nameSubdomain = name?.replaceAll('_', '-')
97
+ const nameSubdomainString = nameSubdomain ? `${nameSubdomain}.` : ''
98
+ const portString = port ? `:${port}` : ''
99
+
100
+ if (stagingHost) {
101
+ return `https://${nameSubdomainString}${stagingHost}`
102
+ } else if (isSsr && process.server) {
103
+ return `http://${name}${portString}`
104
+ } else {
105
+ return `https://${nameSubdomainString}${getDomainTldPort(host)}`
106
+ }
107
+ }
108
+
83
109
  export const getTimezone = async (event: H3Event) =>
84
110
  getCookie(event, TIMEZONE_COOKIE_NAME) ||
85
111
  (