@live-change/user-frontend 0.8.35 → 0.8.36

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.
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div v-if="additionalScopes.length > 0" class="w-full flex flex-row justify-content-center">
3
+ <div class="surface-card border-round shadow-2 p-4 w-30rem">
4
+ <div class="text-900 font-medium mb-3 text-xl mb-4">Google API Access</div>
5
+ <div v-if="currentAccess.length > 0">
6
+ <p class="mt-0 p-0 line-height-3">
7
+ You are currently granting us access to the following Google API features:
8
+ </p>
9
+ <ul>
10
+ <li v-for="scope in currentAccess">
11
+ {{ scope.split('/').pop() }}
12
+ </li>
13
+ </ul>
14
+ </div>
15
+ <div>
16
+ <p>
17
+ To use this feature, you need to grant us access to the Google APIs listed below:
18
+ </p>
19
+ <ul>
20
+ <li v-for="scope in additionalScopes" class="font-semibold text-gray-700">
21
+ {{ scope.split('/').pop().toUpperCase() }} API
22
+ </li>
23
+ </ul>
24
+ <p>
25
+ Click the button below to go to the Google page where you can grant access.
26
+ </p>
27
+ </div>
28
+ <router-link
29
+ @click="handleClick"
30
+ :to="{ name: 'user:googleAuthScopes', params: {
31
+ action: 'addOfflineAccessToken',
32
+ accessType: 'offline',
33
+ scopes: allScopes
34
+ } }">
35
+ <Button icon="pi pi-key" label="Google Authentication" />
36
+ </router-link>
37
+ </div>
38
+ </div>
39
+ <slot v-else></slot>
40
+ </template>
41
+
42
+ <script setup>
43
+
44
+ import Button from 'primevue/button'
45
+
46
+ import { onMounted, ref } from 'vue'
47
+ const isMounted = ref(false)
48
+ onMounted(() => isMounted.value = true)
49
+
50
+ import { computed, toRefs } from 'vue'
51
+ import { usePath, live } from "@live-change/vue3-ssr"
52
+
53
+ import { useRoute } from "vue-router"
54
+ const route = useRoute()
55
+
56
+ const savedRoute = route.fullPath
57
+
58
+ const props = defineProps({
59
+ scopes: {
60
+ type: Array,
61
+ required: true
62
+ },
63
+ saveRoute:{
64
+ type: Boolean,
65
+ default: false
66
+ }
67
+ })
68
+ const { scopes, saveRoute } = toRefs(props)
69
+
70
+ const path = usePath()
71
+ const [ offlineAccess ] = await Promise.all([
72
+ live(path.googleAuthentication.myUserOfflineAccess({}))
73
+ ])
74
+
75
+ const currentAccess = computed(() => offlineAccess.value?.scopes ?? [])
76
+ const additionalScopes = computed(() => scopes.value.filter(
77
+ scope => !currentAccess.value.includes(scope)
78
+ ))
79
+
80
+ const allScopes = computed(() => [...currentAccess.value, ...additionalScopes.value])
81
+
82
+ function handleClick() {
83
+ if(saveRoute.value) {
84
+ localStorage.afterGoogleAccessGained = savedRoute
85
+ }
86
+ }
87
+
88
+ </script>
89
+
90
+ <style>
91
+
92
+ </style>
@@ -51,7 +51,7 @@
51
51
  setTimeout(() => {
52
52
  if (afterGoogleAccessGained.value) {
53
53
  localStorage.removeItem('afterGoogleAccessGained')
54
- router.push(afterSignIn.value)
54
+ router.push(afterGoogleAccessGained.value)
55
55
  }
56
56
  }, redirectTime - Date.now())
57
57
  })
@@ -4,10 +4,10 @@ export function routes(config = {}) {
4
4
  return [
5
5
 
6
6
  route({ name: 'user:google-access-gained', path: prefix + 'google-offline-access-gained',
7
- component: () => import("./AccessGained.vue"), meta: { signedIn: true } }),
7
+ component: () => import("./GoogleAccessGained.vue"), meta: { signedIn: true } }),
8
8
 
9
9
  route({ name: 'user:get-google-access', path: prefix + 'get-google-access/:scopes*',
10
- component: () => import("./GetAccess.vue"), meta: { signedIn: true }, props: true }),
10
+ component: () => import("./GoogleAccess.vue"), meta: { signedIn: true }, props: true }),
11
11
 
12
12
  ]
13
13
  }
package/index.js CHANGED
@@ -14,4 +14,7 @@ export { UserIcon }
14
14
  import Password from "./front/src/password/Password.vue"
15
15
  export { Password }
16
16
 
17
+ import GoogleAccess from './front/src/google-access/GoogleAccess.vue'
18
+ export { GoogleAccess }
19
+
17
20
  export * from "./front/src/router.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.8.35",
3
+ "version": "0.8.36",
4
4
  "scripts": {
5
5
  "memDev": "node --inspect --expose-gc server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
@@ -22,29 +22,29 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/cli": "^0.8.35",
26
- "@live-change/dao": "^0.8.35",
27
- "@live-change/dao-vue3": "^0.8.35",
28
- "@live-change/dao-websocket": "^0.8.35",
29
- "@live-change/email-service": "^0.8.35",
30
- "@live-change/framework": "^0.8.35",
31
- "@live-change/identicon-service": "^0.8.35",
32
- "@live-change/image-frontend": "^0.8.35",
33
- "@live-change/message-authentication-service": "^0.8.35",
34
- "@live-change/notification-service": "^0.8.35",
35
- "@live-change/password-authentication-service": "^0.8.35",
36
- "@live-change/pattern": "^0.8.35",
37
- "@live-change/secret-code-service": "^0.8.35",
38
- "@live-change/secret-link-service": "^0.8.35",
39
- "@live-change/security-frontend": "^0.8.35",
40
- "@live-change/security-service": "^0.8.35",
41
- "@live-change/session-service": "^0.8.35",
42
- "@live-change/timer-service": "^0.8.35",
43
- "@live-change/upload-service": "^0.8.35",
44
- "@live-change/user-identification-service": "^0.8.35",
45
- "@live-change/user-service": "^0.8.35",
46
- "@live-change/vue3-components": "^0.8.35",
47
- "@live-change/vue3-ssr": "^0.8.35",
25
+ "@live-change/cli": "^0.8.36",
26
+ "@live-change/dao": "^0.8.36",
27
+ "@live-change/dao-vue3": "^0.8.36",
28
+ "@live-change/dao-websocket": "^0.8.36",
29
+ "@live-change/email-service": "^0.8.36",
30
+ "@live-change/framework": "^0.8.36",
31
+ "@live-change/identicon-service": "^0.8.36",
32
+ "@live-change/image-frontend": "^0.8.36",
33
+ "@live-change/message-authentication-service": "^0.8.36",
34
+ "@live-change/notification-service": "^0.8.36",
35
+ "@live-change/password-authentication-service": "^0.8.36",
36
+ "@live-change/pattern": "^0.8.36",
37
+ "@live-change/secret-code-service": "^0.8.36",
38
+ "@live-change/secret-link-service": "^0.8.36",
39
+ "@live-change/security-frontend": "^0.8.36",
40
+ "@live-change/security-service": "^0.8.36",
41
+ "@live-change/session-service": "^0.8.36",
42
+ "@live-change/timer-service": "^0.8.36",
43
+ "@live-change/upload-service": "^0.8.36",
44
+ "@live-change/user-identification-service": "^0.8.36",
45
+ "@live-change/user-service": "^0.8.36",
46
+ "@live-change/vue3-components": "^0.8.36",
47
+ "@live-change/vue3-ssr": "^0.8.36",
48
48
  "@vueuse/core": "^10.11.0",
49
49
  "codeceptjs-assert": "^0.0.5",
50
50
  "codeceptjs-video-helper": "0.1.3",
@@ -65,7 +65,7 @@
65
65
  "wtfnode": "^0.9.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@live-change/codeceptjs-helper": "^0.8.35",
68
+ "@live-change/codeceptjs-helper": "^0.8.36",
69
69
  "codeceptjs": "^3.5.12",
70
70
  "generate-password": "1.7.1",
71
71
  "playwright": "^1.41.2",
@@ -76,5 +76,5 @@
76
76
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
77
77
  "license": "BSD-3-Clause",
78
78
  "description": "",
79
- "gitHead": "90fbb746dc7270895daf17b437ca48c0b0a01c01"
79
+ "gitHead": "24694d1687f0ab2d6eb7edd95e5274428cfd44eb"
80
80
  }
@@ -1,72 +0,0 @@
1
- <template>
2
- <div class="w-full">
3
- <div class="surface-card border-round shadow-2 p-4">
4
- <div class="text-900 font-medium mb-3 text-xl mb-4">Google Api Access</div>
5
- <p class="mt-0 p-0 line-height-3">
6
- Your current access:
7
- </p>
8
- <ul>
9
- <li v-for="scope in currentAccess">
10
- {{ scope.split('/').pop() }}
11
- </li>
12
- </ul>
13
- <p>
14
- We need access to additional scopes:
15
- </p>
16
- <ul>
17
- <li v-for="scope in additionalScopes">
18
- {{ scope.split('/').pop() }}
19
- </li>
20
- </ul>
21
- <p>
22
- Please click the button below to grant access.
23
- </p>
24
- <router-link
25
- :to="{ name: 'user:googleAuthScopes', params: {
26
- action: 'addOfflineAccessToken',
27
- accessType: 'offline',
28
- scopes: allScopes
29
- } }">
30
- <Button icon="pi pi-key" label="Google Authentication" />
31
- </router-link>
32
- </div>
33
-
34
- </div>
35
- </template>
36
-
37
- <script setup>
38
-
39
- import Button from 'primevue/button'
40
-
41
- import { onMounted, ref } from 'vue'
42
- const isMounted = ref(false)
43
- onMounted(() => isMounted.value = true)
44
-
45
- import { computed, toRefs } from 'vue'
46
- import { usePath, live } from "@live-change/vue3-ssr"
47
-
48
- const props = defineProps({
49
- scopes: {
50
- type: Array,
51
- required: true
52
- }
53
- })
54
- const { scopes } = toRefs(props)
55
-
56
- const path = usePath()
57
- const [ offlineAccess ] = await Promise.all([
58
- live(path.googleAuthentication.myUserOfflineAccess({}))
59
- ])
60
-
61
- const currentAccess = computed(() => offlineAccess.value.scopes)
62
- const additionalScopes = computed(() => scopes.value.filter(
63
- scope => !currentAccess.value.includes(scope)
64
- ))
65
-
66
- const allScopes = computed(() => [...currentAccess.value, ...additionalScopes.value])
67
-
68
- </script>
69
-
70
- <style>
71
-
72
- </style>