@live-change/user-frontend 0.8.35 → 0.8.37

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2024 Michał Łaszczewski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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.37",
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.37",
26
+ "@live-change/dao": "^0.8.37",
27
+ "@live-change/dao-vue3": "^0.8.37",
28
+ "@live-change/dao-websocket": "^0.8.37",
29
+ "@live-change/email-service": "^0.8.37",
30
+ "@live-change/framework": "^0.8.37",
31
+ "@live-change/identicon-service": "^0.8.37",
32
+ "@live-change/image-frontend": "^0.8.37",
33
+ "@live-change/message-authentication-service": "^0.8.37",
34
+ "@live-change/notification-service": "^0.8.37",
35
+ "@live-change/password-authentication-service": "^0.8.37",
36
+ "@live-change/pattern": "^0.8.37",
37
+ "@live-change/secret-code-service": "^0.8.37",
38
+ "@live-change/secret-link-service": "^0.8.37",
39
+ "@live-change/security-frontend": "^0.8.37",
40
+ "@live-change/security-service": "^0.8.37",
41
+ "@live-change/session-service": "^0.8.37",
42
+ "@live-change/timer-service": "^0.8.37",
43
+ "@live-change/upload-service": "^0.8.37",
44
+ "@live-change/user-identification-service": "^0.8.37",
45
+ "@live-change/user-service": "^0.8.37",
46
+ "@live-change/vue3-components": "^0.8.37",
47
+ "@live-change/vue3-ssr": "^0.8.37",
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.37",
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": "8b97a83258a3eccd08534d0376015781c4eefdec"
80
80
  }
package/LICENSE.md DELETED
@@ -1,11 +0,0 @@
1
- Copyright 2019-2024 Michał Łaszczewski
2
-
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
-
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
-
7
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
9
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
-
11
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -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>