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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/app.config.ts +34 -33
  2. package/components/{_ → vio/_}/VioApp.vue +20 -6
  3. package/components/{_ → vio/_}/VioError.vue +1 -1
  4. package/components/{_ → vio/_}/VioLink.vue +2 -2
  5. package/components/{layout → vio/layout}/VioLayout.vue +1 -1
  6. package/components/{page → vio/page}/VioPageLegalNotice.vue +9 -7
  7. package/components/{page → vio/page}/VioPagePrivacyPolicy.vue +18 -11
  8. package/composables/useAppLayout.ts +11 -17
  9. package/composables/useFavicons.ts +3 -31
  10. package/composables/useGetServiceHref.ts +2 -28
  11. package/composables/useHeadDefault.ts +13 -26
  12. package/error.vue +2 -0
  13. package/nuxt.config.ts +12 -10
  14. package/package.json +9 -12
  15. package/plugins/dayjs.ts +0 -12
  16. package/store/auth.ts +32 -0
  17. package/tailwind.config.ts +0 -2
  18. package/types/api.d.ts +7 -0
  19. package/types/fetch.d.ts +8 -0
  20. package/types/modules/gql.d.ts +6 -0
  21. package/types/modules/graphql.d.ts +6 -0
  22. package/utils/constants.ts +1 -0
  23. package/utils/networking.ts +26 -0
  24. package/LICENSE +0 -674
  25. package/composables/useHeadLayout.ts +0 -67
  26. /package/components/{button → vio/button}/VioButton.vue +0 -0
  27. /package/components/{button → vio/button}/VioButtonColored.vue +0 -0
  28. /package/components/{card → vio/card}/VioCard.vue +0 -0
  29. /package/components/{card → vio/card}/state/VioCardState.vue +0 -0
  30. /package/components/{card → vio/card}/state/VioCardStateAlert.vue +0 -0
  31. /package/components/{form → vio/form}/VioForm.vue +0 -0
  32. /package/components/{form → vio/form}/VioFormCheckbox.vue +0 -0
  33. /package/components/{form → vio/form}/input/VioFormInput.vue +0 -0
  34. /package/components/{form → vio/form}/input/VioFormInputIconWrapper.vue +0 -0
  35. /package/components/{form → vio/form}/input/VioFormInputUrl.vue +0 -0
  36. /package/components/{form → vio/form}/input/state/VioFormInputState.vue +0 -0
  37. /package/components/{form → vio/form}/input/state/VioFormInputStateError.vue +0 -0
  38. /package/components/{form → vio/form}/input/state/VioFormInputStateInfo.vue +0 -0
  39. /package/components/{icon → vio/icon}/IconArrowRight.vue +0 -0
  40. /package/components/{icon → vio/icon}/IconCalendar.vue +0 -0
  41. /package/components/{icon → vio/icon}/IconChatOutline.vue +0 -0
  42. /package/components/{icon → vio/icon}/IconChatSolid.vue +0 -0
  43. /package/components/{icon → vio/icon}/IconCheckCircle.vue +0 -0
  44. /package/components/{icon → vio/icon}/IconContainer.vue +0 -0
  45. /package/components/{icon → vio/icon}/IconDownload.vue +0 -0
  46. /package/components/{icon → vio/icon}/IconExclamationCircle.vue +0 -0
  47. /package/components/{icon → vio/icon}/IconHome.vue +0 -0
  48. /package/components/{icon → vio/icon}/IconHourglass.vue +0 -0
  49. /package/components/{icon → vio/icon}/IconLightbulb.vue +0 -0
  50. /package/components/{icon → vio/icon}/IconLogo.vue +0 -0
  51. /package/components/{icon → vio/icon}/IconMixcloud.vue +0 -0
  52. /package/components/{icon → vio/icon}/IconMusic.vue +0 -0
  53. /package/components/{icon → vio/icon}/IconPlay.vue +0 -0
  54. /package/components/{icon → vio/icon}/IconShare.vue +0 -0
  55. /package/components/{layout → vio/layout}/VioLayoutBreadcrumbs.vue +0 -0
  56. /package/components/{layout → vio/layout}/VioLayoutFooter.vue +0 -0
  57. /package/components/{layout → vio/layout}/VioLayoutFooterCategory.vue +0 -0
  58. /package/components/{layout → vio/layout}/VioLayoutHeader.vue +0 -0
  59. /package/components/{layout → vio/layout}/VioLayoutHr.vue +0 -0
  60. /package/components/{layout → vio/layout}/VioLayoutSpanList.vue +0 -0
  61. /package/components/{loader → vio/loader}/indicator/VioLoaderIndicator.vue +0 -0
  62. /package/components/{loader → vio/loader}/indicator/VioLoaderIndicatorPing.vue +0 -0
  63. /package/components/{loader → vio/loader}/indicator/VioLoaderIndicatorSpinner.vue +0 -0
package/store/auth.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { decodeJwt, JWTPayload } from 'jose'
2
+ import { defineStore } from 'pinia'
3
+ import { ref } from 'vue'
4
+
5
+ export const useVioAuthStore = defineStore('vio-auth', () => {
6
+ const jwt = ref<string>()
7
+ const jwtDecoded = ref<JWTPayload>()
8
+ const signedInUsername = ref<string>()
9
+
10
+ const jwtRemove = () => jwtSet(undefined)
11
+
12
+ const jwtSet = (jwtNew?: string) => {
13
+ const jwtDecodedNew = jwtNew !== undefined ? decodeJwt(jwtNew) : undefined
14
+
15
+ jwt.value = jwtNew
16
+ jwtDecoded.value = jwtDecodedNew
17
+ signedInUsername.value =
18
+ jwtDecodedNew?.role === 'vio_account' &&
19
+ jwtDecodedNew.exp !== undefined &&
20
+ jwtDecodedNew.exp > Math.floor(Date.now() / 1000)
21
+ ? (jwtDecodedNew.username as string | undefined)
22
+ : undefined
23
+ }
24
+
25
+ return {
26
+ jwt,
27
+ jwtDecoded,
28
+ signedInUsername,
29
+ jwtRemove,
30
+ jwtSet,
31
+ }
32
+ })
@@ -2,7 +2,6 @@ import { Config } from 'tailwindcss'
2
2
  import colors from 'tailwindcss/colors'
3
3
  import { PluginAPI } from 'tailwindcss/types/config'
4
4
  import formsPlugin from '@tailwindcss/forms'
5
- import lineClampPlugin from '@tailwindcss/line-clamp'
6
5
  import typographyPlugin from '@tailwindcss/typography'
7
6
 
8
7
  const heading = (theme: PluginAPI['theme']): Record<string, string> => ({
@@ -54,7 +53,6 @@ export default {
54
53
  darkMode: 'class',
55
54
  plugins: [
56
55
  formsPlugin,
57
- lineClampPlugin,
58
56
  typographyPlugin,
59
57
  ({ addBase, addComponents, addUtilities, theme }: PluginAPI) => {
60
58
  addBase({
package/types/api.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export type BackendError = CombinedError | { errcode: string; message: string }
2
+
3
+ export type ApiData = ComputedRef<{
4
+ data?: Object
5
+ errors: BackendError[]
6
+ isFetching: boolean
7
+ }>
@@ -0,0 +1,8 @@
1
+ export interface StrapiResult<T> {
2
+ data: CollectionItem<T>[]
3
+ meta: {
4
+ pagination: {
5
+ total: number
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ declare module '*.gql' {
2
+ import { DocumentNode } from 'graphql'
3
+
4
+ const content: DocumentNode
5
+ export default content
6
+ }
@@ -0,0 +1,6 @@
1
+ declare module '*.graphql' {
2
+ import { DocumentNode } from 'graphql'
3
+
4
+ const content: DocumentNode
5
+ export default content
6
+ }
@@ -1,5 +1,6 @@
1
1
  export const SITE_NAME = 'Vio'
2
2
 
3
+ export const CACHE_VERSION = 'bOXMwoKlJr'
3
4
  export const COOKIE_PREFIX = SITE_NAME.toLocaleLowerCase()
4
5
  export const COOKIE_SEPARATOR = '_'
5
6
  export const FETCH_RETRY_AMOUNT = 3
@@ -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
  (