@hostlink/nuxt-light 0.0.73 → 0.0.75
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 +18 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.d.ts +3 -3
- package/dist/module.json +1 -1
- package/dist/runtime/components/l-app.vue +17 -4
- package/dist/runtime/components/l-login.vue +62 -4
- package/dist/types.d.mts +15 -0
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -104,3 +104,21 @@ npm run release
|
|
|
104
104
|
</l-app>
|
|
105
105
|
</template>
|
|
106
106
|
```
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## Google Sigin
|
|
111
|
+
nuxt.config.ts
|
|
112
|
+
```js
|
|
113
|
+
app: {
|
|
114
|
+
head: {
|
|
115
|
+
script: [
|
|
116
|
+
{
|
|
117
|
+
src: 'https://accounts.google.com/gsi/client',
|
|
118
|
+
async: true,
|
|
119
|
+
defer: true,
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
package/dist/module.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
interface ModuleOptions {
|
|
4
|
-
}
|
|
3
|
+
interface ModuleOptions {
|
|
4
|
+
}
|
|
5
5
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
6
6
|
|
|
7
|
-
export { ModuleOptions, _default as default };
|
|
7
|
+
export { type ModuleOptions, _default as default };
|
package/dist/module.json
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useRuntimeConfig } from 'nuxt/app'
|
|
3
3
|
import { setApiUrl } from '@hostlink/light'
|
|
4
|
-
import {
|
|
4
|
+
import { Dialog } from 'quasar'
|
|
5
5
|
import { q } from '../'
|
|
6
|
-
const route = useRoute()
|
|
7
6
|
const config = useRuntimeConfig();
|
|
8
7
|
setApiUrl(config?.public?.apiBase ?? '/api/');
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
let app = null
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
app = (await q({ app: ['company', 'companyLogo', 'logged', 'twoFactorAuthentication', 'googleClientId'] })).app;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
Dialog.create({
|
|
16
|
+
title: 'Error',
|
|
17
|
+
message: 'Error loading api data. Please reload the page.',
|
|
18
|
+
ok: 'Reload',
|
|
19
|
+
}).onOk(() => {
|
|
20
|
+
window.location.reload();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
12
25
|
</script>
|
|
13
26
|
<template>
|
|
14
27
|
<q-layout v-if="!app.logged">
|
|
15
28
|
<q-page-container class="bg-grey-2" style="color:#1f1f1f">
|
|
16
29
|
<q-page padding>
|
|
17
30
|
<l-login :company="app.company" :company-logo="app.companyLogo"
|
|
18
|
-
:twoFactorAuthentication="app.twoFactorAuthentication"></l-login>
|
|
31
|
+
:twoFactorAuthentication="app.twoFactorAuthentication" :google-client-id="app.googleClientId"></l-login>
|
|
19
32
|
</q-page>
|
|
20
33
|
</q-page-container>
|
|
21
34
|
</q-layout>
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, reactive } from 'vue'
|
|
3
|
-
import { useQuasar } from 'quasar';
|
|
2
|
+
import { ref, reactive, onMounted } from 'vue'
|
|
3
|
+
import { useQuasar, Notify } from 'quasar';
|
|
4
4
|
import { useI18n } from 'vue-i18n';
|
|
5
5
|
import { m, notify } from '../';
|
|
6
6
|
|
|
7
|
+
import { useRuntimeConfig } from 'nuxt/app';
|
|
8
|
+
|
|
7
9
|
import { login, webauthnLogin } from '@hostlink/light';
|
|
8
10
|
|
|
11
|
+
const config = useRuntimeConfig();
|
|
12
|
+
|
|
9
13
|
|
|
10
|
-
defineProps({
|
|
14
|
+
const props = defineProps({
|
|
11
15
|
company: String,
|
|
12
16
|
companyLogo: String,
|
|
13
|
-
twoFactorAuthentication: Boolean
|
|
17
|
+
twoFactorAuthentication: Boolean,
|
|
18
|
+
googleClientId: String
|
|
14
19
|
})
|
|
15
20
|
|
|
16
21
|
const i18n = useI18n();
|
|
@@ -119,6 +124,54 @@ const bioLogin = async () => {
|
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
}
|
|
127
|
+
const handleGoogleCredentialResponse = async (response) => {
|
|
128
|
+
try {
|
|
129
|
+
await m("googleLogin", { credential: response.credential });
|
|
130
|
+
window.self.location.reload();
|
|
131
|
+
} catch (e) {
|
|
132
|
+
notify(e.message, "negative");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
onMounted(() => {
|
|
137
|
+
if (props.googleClientId) {
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if (!window.google) {
|
|
141
|
+
Notify.create({
|
|
142
|
+
message: "Google login is not available", //set script https://accounts.google.com/gsi/client in nuuxt.config.js
|
|
143
|
+
color: "negative",
|
|
144
|
+
icon: "sym_o_error",
|
|
145
|
+
position: "top",
|
|
146
|
+
timeout: 2000
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//google
|
|
153
|
+
google.accounts.id.initialize({
|
|
154
|
+
client_id: props.googleClientId,
|
|
155
|
+
callback: handleGoogleCredentialResponse,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
google.accounts.id.renderButton(
|
|
159
|
+
document.getElementById('g_id_signin'),
|
|
160
|
+
{
|
|
161
|
+
type: 'profile',
|
|
162
|
+
shape: 'pill',
|
|
163
|
+
theme: 'outline',
|
|
164
|
+
text: 'signin_with',
|
|
165
|
+
size: 'large',
|
|
166
|
+
logo_alignment: 'left'
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
|
|
122
175
|
|
|
123
176
|
</script>
|
|
124
177
|
|
|
@@ -145,5 +198,10 @@ const bioLogin = async () => {
|
|
|
145
198
|
<l-btn v-if="hasBioLogin" outline rounded color="primary" icon="sym_o_fingerprint" @click="bioLogin" />
|
|
146
199
|
<l-btn label="Forget password" outline rounded color="primary" icon="sym_o_lock_reset" @click="forgetPassword" />
|
|
147
200
|
</q-card-actions>
|
|
201
|
+
<q-card-actions v-if="props.googleClientId">
|
|
202
|
+
<div>
|
|
203
|
+
<div id="g_id_signin"></div>
|
|
204
|
+
</div>
|
|
205
|
+
</q-card-actions>
|
|
148
206
|
</q-card>
|
|
149
207
|
</template>
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { ModuleOptions } from './module'
|
|
3
|
+
|
|
4
|
+
declare module '@nuxt/schema' {
|
|
5
|
+
interface NuxtConfig { ['light']?: Partial<ModuleOptions> }
|
|
6
|
+
interface NuxtOptions { ['light']?: ModuleOptions }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'nuxt/schema' {
|
|
10
|
+
interface NuxtConfig { ['light']?: Partial<ModuleOptions> }
|
|
11
|
+
interface NuxtOptions { ['light']?: ModuleOptions }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export { ModuleOptions, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostlink/nuxt-light",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.75",
|
|
4
4
|
"description": "HostLink Nuxt Light Framework",
|
|
5
5
|
"repository": "@hostlink/nuxt-light",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"prepack": "nuxt-module-build",
|
|
25
|
+
"prepack": "nuxt-module-build build",
|
|
26
26
|
"dev": "nuxi dev playground",
|
|
27
27
|
"dev:build": "nuxi build playground",
|
|
28
|
-
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
|
|
28
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground",
|
|
29
29
|
"release:org": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
30
30
|
"release": "npm run prepack && changelogen --release && npm publish --access=public && git push --follow-tags",
|
|
31
31
|
"lint": "eslint .",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@hostlink/light": "^0.0.24",
|
|
38
|
-
"@nuxt/kit": "^3.7.
|
|
38
|
+
"@nuxt/kit": "^3.7.4",
|
|
39
|
+
"@nuxt/module-builder": "^0.5.2",
|
|
39
40
|
"@quasar/extras": "^1.16.6",
|
|
40
41
|
"axios": "^1.5.0",
|
|
41
|
-
"gql-query-builder": "^3.8.0",
|
|
42
42
|
"json-to-graphql-query": "^2.2.5",
|
|
43
43
|
"quasar": "^2.12.5",
|
|
44
44
|
"unplugin-auto-import": "^0.16.6",
|
|
@@ -48,9 +48,8 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@nuxt/content": "^2.8.2",
|
|
50
50
|
"@nuxt/devtools": "latest",
|
|
51
|
-
"@nuxt/eslint-config": "^0.
|
|
52
|
-
"@nuxt/
|
|
53
|
-
"@nuxt/schema": "^3.7.0",
|
|
51
|
+
"@nuxt/eslint-config": "^0.2.0",
|
|
52
|
+
"@nuxt/schema": "^3.7.4",
|
|
54
53
|
"@nuxt/test-utils": "^3.7.0",
|
|
55
54
|
"@types/node": "^18.17.3",
|
|
56
55
|
"changelogen": "^0.5.4",
|