@logto/vue 0.1.17 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
- import { IdTokenClaims, LogtoConfig, UserInfoResponse } from '@logto/browser';
1
+ import { IdTokenClaims, LogtoConfig } from '@logto/browser';
2
2
  import { App, Ref } from 'vue';
3
- export type { LogtoConfig, IdTokenClaims, UserInfoResponse, LogtoErrorCode, LogtoClientErrorCode, } from '@logto/browser';
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;
@@ -10,11 +9,11 @@ export declare const createPluginMethods: (context: Context) => {
10
9
  aud: string;
11
10
  exp: number;
12
11
  iat: number;
13
- at_hash?: string | undefined;
14
- name?: string | undefined;
15
- username?: string | undefined;
16
- avatar?: string | undefined;
17
- role_names?: string[] | undefined;
12
+ at_hash?: string | null | undefined;
13
+ name?: string | null | undefined;
14
+ username?: string | null | undefined;
15
+ avatar?: string | null | undefined;
16
+ role_names?: string[] | null | undefined;
18
17
  } | undefined;
19
18
  handleSignInCallback: (callbackUri: string, callbackFunction?: (() => void) | undefined) => Promise<undefined>;
20
19
  };
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.1.17",
3
+ "version": "0.2.1",
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.1.17"
26
+ "@logto/browser": "^0.2.1"
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": "57e93385829eceb3c1b2ffb92b90901aa174a59a"
63
+ "gitHead": "b572a2f02cec128f24efc6a030ea68c7e44e9384"
64
64
  }