@logto/browser 0.1.5 → 0.1.11

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,8 @@
1
1
  import { IdTokenClaims, Requester, UserInfoResponse } from '@logto/js';
2
2
  import { Nullable } from '@silverhand/essentials';
3
3
  import { Infer } from 'superstruct';
4
- export type { IdTokenClaims, UserInfoResponse } from '@logto/js';
4
+ export type { IdTokenClaims, UserInfoResponse, LogtoErrorCode } from '@logto/js';
5
+ export { LogtoError, OidcError } from '@logto/js';
5
6
  export * from './errors';
6
7
  export declare type LogtoConfig = {
7
8
  endpoint: string;
package/lib/index.js CHANGED
@@ -13,13 +13,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.LogtoSignInSessionItemSchema = void 0;
16
+ exports.LogtoSignInSessionItemSchema = exports.OidcError = exports.LogtoError = void 0;
17
17
  const js_1 = require("@logto/js");
18
18
  const jose_1 = require("jose");
19
19
  const lodash_once_1 = __importDefault(require("lodash.once"));
20
20
  const superstruct_1 = require("superstruct");
21
21
  const errors_1 = require("./errors");
22
22
  const utils_1 = require("./utils");
23
+ var js_2 = require("@logto/js");
24
+ Object.defineProperty(exports, "LogtoError", { enumerable: true, get: function () { return js_2.LogtoError; } });
25
+ Object.defineProperty(exports, "OidcError", { enumerable: true, get: function () { return js_2.OidcError; } });
23
26
  __exportStar(require("./errors"), exports);
24
27
  exports.LogtoSignInSessionItemSchema = (0, superstruct_1.type)({
25
28
  redirectUri: (0, superstruct_1.string)(),
@@ -85,6 +88,7 @@ class LogtoClient {
85
88
  }
86
89
  localStorage.setItem(idTokenKey, idToken);
87
90
  }
91
+ // eslint-disable-next-line complexity
88
92
  async getAccessToken(resource) {
89
93
  if (!this.idToken) {
90
94
  throw new errors_1.LogtoClientError('not_authenticated');
@@ -148,6 +152,8 @@ class LogtoClient {
148
152
  resources,
149
153
  });
150
154
  this.signInSession = { redirectUri, codeVerifier, state };
155
+ this.refreshToken = null;
156
+ this.idToken = null;
151
157
  window.location.assign(signInUri);
152
158
  }
153
159
  isSignInRedirected(url) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/browser",
3
- "version": "0.1.5",
3
+ "version": "0.1.11",
4
4
  "main": "./lib/index.js",
5
5
  "exports": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "prepack": "pnpm test"
25
25
  },
26
26
  "dependencies": {
27
- "@logto/js": "^0.1.5",
27
+ "@logto/js": "^0.1.11",
28
28
  "@silverhand/essentials": "^1.1.6",
29
29
  "jose": "^4.5.0",
30
30
  "lodash.get": "^4.4.2",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jest/types": "^27.5.1",
36
- "@silverhand/eslint-config": "^0.10.0",
37
- "@silverhand/ts-config": "^0.10.0",
36
+ "@silverhand/eslint-config": "^0.14.0",
37
+ "@silverhand/ts-config": "^0.14.0",
38
38
  "@types/jest": "^27.4.0",
39
39
  "@types/lodash.get": "^4.4.6",
40
40
  "@types/lodash.once": "^4.1.6",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "ed98d55270ae923f95a57fe4f3bc5a5959518c06"
58
+ "gitHead": "fb6df238f56049607af2c3b88bee07ba2aa45dae"
59
59
  }