@logto/vue 0.1.18 → 0.2.2
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/lib/index.d.ts +3 -4
- package/lib/index.js +2 -1
- package/lib/plugin.d.ts +0 -1
- package/lib/plugin.js +0 -16
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IdTokenClaims, LogtoConfig
|
|
1
|
+
import { IdTokenClaims, LogtoConfig } from '@logto/browser';
|
|
2
2
|
import { App, Ref } from 'vue';
|
|
3
|
-
export type { LogtoConfig, IdTokenClaims,
|
|
4
|
-
export { LogtoError, LogtoClientError, OidcError } from '@logto/browser';
|
|
3
|
+
export type { LogtoConfig, IdTokenClaims, LogtoErrorCode, LogtoClientErrorCode, } from '@logto/browser';
|
|
4
|
+
export { LogtoError, LogtoClientError, OidcError, Prompt } from '@logto/browser';
|
|
5
5
|
declare type LogtoVuePlugin = {
|
|
6
6
|
install: (app: App, config: LogtoConfig) => void;
|
|
7
7
|
};
|
|
@@ -9,7 +9,6 @@ declare type Logto = {
|
|
|
9
9
|
isAuthenticated: Readonly<Ref<boolean>>;
|
|
10
10
|
isLoading: Readonly<Ref<boolean>>;
|
|
11
11
|
error: Readonly<Ref<Error | undefined>>;
|
|
12
|
-
fetchUserInfo: () => Promise<UserInfoResponse | undefined>;
|
|
13
12
|
getAccessToken: (resource?: string) => Promise<string | undefined>;
|
|
14
13
|
getIdTokenClaims: () => IdTokenClaims | undefined;
|
|
15
14
|
signIn: (redirectUri: string) => Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useHandleSignInCallback = exports.useLogto = exports.createLogto = exports.OidcError = exports.LogtoClientError = exports.LogtoError = void 0;
|
|
6
|
+
exports.useHandleSignInCallback = exports.useLogto = exports.createLogto = exports.Prompt = exports.OidcError = exports.LogtoClientError = exports.LogtoError = void 0;
|
|
7
7
|
const browser_1 = __importDefault(require("@logto/browser"));
|
|
8
8
|
const vue_1 = require("vue");
|
|
9
9
|
const consts_1 = require("./consts");
|
|
@@ -13,6 +13,7 @@ var browser_2 = require("@logto/browser");
|
|
|
13
13
|
Object.defineProperty(exports, "LogtoError", { enumerable: true, get: function () { return browser_2.LogtoError; } });
|
|
14
14
|
Object.defineProperty(exports, "LogtoClientError", { enumerable: true, get: function () { return browser_2.LogtoClientError; } });
|
|
15
15
|
Object.defineProperty(exports, "OidcError", { enumerable: true, get: function () { return browser_2.OidcError; } });
|
|
16
|
+
Object.defineProperty(exports, "Prompt", { enumerable: true, get: function () { return browser_2.Prompt; } });
|
|
16
17
|
/**
|
|
17
18
|
* Creates the Logto Vue plugin
|
|
18
19
|
*
|
package/lib/plugin.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Context } from './context';
|
|
|
2
2
|
export declare const createPluginMethods: (context: Context) => {
|
|
3
3
|
signIn: (redirectUri: string) => Promise<undefined>;
|
|
4
4
|
signOut: (postLogoutRedirectUri: string) => Promise<undefined>;
|
|
5
|
-
fetchUserInfo: () => Promise<import("@logto/browser").UserInfoResponse | undefined>;
|
|
6
5
|
getAccessToken: (resource?: string | undefined) => Promise<string | undefined>;
|
|
7
6
|
getIdTokenClaims: () => {
|
|
8
7
|
iss: string;
|
package/lib/plugin.js
CHANGED
|
@@ -37,21 +37,6 @@ const createPluginMethods = (context) => {
|
|
|
37
37
|
setLoading(false);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
const fetchUserInfo = async () => {
|
|
41
|
-
if (!logtoClient.value) {
|
|
42
|
-
return (0, context_1.throwContextError)();
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
setLoading(true);
|
|
46
|
-
return await logtoClient.value.fetchUserInfo();
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
setError(error, 'Unexpected error occurred while fetching user info.');
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
setLoading(false);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
40
|
const getAccessToken = async (resource) => {
|
|
56
41
|
if (!logtoClient.value) {
|
|
57
42
|
return (0, context_1.throwContextError)();
|
|
@@ -98,7 +83,6 @@ const createPluginMethods = (context) => {
|
|
|
98
83
|
return {
|
|
99
84
|
signIn,
|
|
100
85
|
signOut,
|
|
101
|
-
fetchUserInfo,
|
|
102
86
|
getAccessToken,
|
|
103
87
|
getIdTokenClaims,
|
|
104
88
|
handleSignInCallback,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"exports": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prepack": "pnpm test"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@logto/browser": "^0.
|
|
26
|
+
"@logto/browser": "^0.2.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@jest/types": "^27.5.1",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c8e2ad8ea656887884f9d32c119086d53554c178"
|
|
64
64
|
}
|