@xwiki/cristal-electron-authentication-github-renderer 0.21.1 → 0.23.0

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/CHANGELOG.md CHANGED
@@ -1,14 +1,30 @@
1
1
  # @xwiki/cristal-electron-authentication-github-renderer
2
2
 
3
- ## 0.21.1
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Cristal 0.23 Release
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @xwiki/cristal-api@0.23.0
13
+ - @xwiki/cristal-authentication-api@0.23.0
14
+ - @xwiki/cristal-authentication-github-state@0.23.0
15
+
16
+ ## 0.22.0
17
+
18
+ ### Minor Changes
19
+
20
+ - Cristal 0.22 Release
4
21
 
5
22
  ### Patch Changes
6
23
 
7
- - Cristal 0.21.1 Release
8
24
  - Updated dependencies
9
- - @xwiki/cristal-api@0.21.1
10
- - @xwiki/cristal-authentication-api@0.21.1
11
- - @xwiki/cristal-authentication-github-state@0.21.1
25
+ - @xwiki/cristal-api@0.22.0
26
+ - @xwiki/cristal-authentication-api@0.22.0
27
+ - @xwiki/cristal-authentication-github-state@0.22.0
12
28
 
13
29
  ## 0.21.0
14
30
 
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../../api-extractor.json"
4
+ }
@@ -1,6 +1,6 @@
1
- import { UserDetails, AuthenticationManager } from '@xwiki/cristal-authentication-api';
2
1
  import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
3
2
  import { CristalApp } from '@xwiki/cristal-api';
3
+ import { AuthenticationManager, UserDetails } from '@xwiki/cristal-authentication-api';
4
4
  declare class GitHubAuthenticationManager implements AuthenticationManager {
5
5
  private readonly cristalApp;
6
6
  private readonly authenticationState;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
2
2
  import { Container } from 'inversify';
3
+ /**
4
+ * @beta
5
+ */
3
6
  declare class ComponentInit {
4
7
  constructor(container: Container);
5
8
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
2
2
  import { Container } from 'inversify';
3
+ /**
4
+ * @beta
5
+ */
3
6
  declare class ComponentInit {
4
7
  constructor(container: Container);
5
8
  }
package/dist/index.es.js CHANGED
@@ -1,31 +1,35 @@
1
1
  import { GitHubAuthenticationState as u } from "@xwiki/cristal-authentication-github-state";
2
2
  import { GitHubAuthenticationState as I } from "@xwiki/cristal-authentication-github-state";
3
- import { injectable as h, inject as s } from "inversify";
4
- var g = Object.getOwnPropertyDescriptor, d = (e, t, i, a) => {
5
- for (var o = a > 1 ? void 0 : a ? g(t, i) : t, n = e.length - 1, c; n >= 0; n--)
3
+ import { injectable as g, inject as s } from "inversify";
4
+ var h = Object.getOwnPropertyDescriptor, d = (e, t, a, i) => {
5
+ for (var o = i > 1 ? void 0 : i ? h(t, a) : t, n = e.length - 1, c; n >= 0; n--)
6
6
  (c = e[n]) && (o = c(o) || o);
7
7
  return o;
8
- }, l = (e, t) => (i, a) => t(i, a, e);
8
+ }, l = (e, t) => (a, i) => t(a, i, e);
9
9
  let r = class {
10
10
  constructor(e, t) {
11
- this.cristalApp = e, this.authenticationState = t, this.localStorageDeviceCode = "authentication.device_code", this.localStorageUserCode = "authentication.user_code", this.localStorageExpiresIn = "authentication.expires_in", this.localStorageInterval = "authentication.interval";
11
+ this.cristalApp = e, this.authenticationState = t;
12
12
  }
13
+ localStorageDeviceCode = "authentication.device_code";
14
+ localStorageUserCode = "authentication.user_code";
15
+ localStorageExpiresIn = "authentication.expires_in";
16
+ localStorageInterval = "authentication.interval";
13
17
  async start() {
14
18
  const e = new URL(
15
19
  `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`
16
- ), i = await (await fetch(e)).json();
20
+ ), a = await (await fetch(e)).json();
17
21
  window.localStorage.setItem(
18
22
  this.localStorageDeviceCode,
19
- i.device_code
23
+ a.device_code
20
24
  ), window.localStorage.setItem(
21
25
  this.localStorageUserCode,
22
- i.user_code
26
+ a.user_code
23
27
  ), window.localStorage.setItem(
24
28
  this.localStorageExpiresIn,
25
- i.expires_in.toString()
29
+ a.expires_in.toString()
26
30
  ), window.localStorage.setItem(
27
31
  this.localStorageInterval,
28
- i.interval.toString()
32
+ a.interval.toString()
29
33
  ), this.authenticationState.modalOpened.value = !0;
30
34
  }
31
35
  async callback() {
@@ -38,8 +42,8 @@ let r = class {
38
42
  }
39
43
  async getAuthorizationHeader() {
40
44
  if (await this.isAuthenticated()) {
41
- const { tokenType: t, accessToken: i } = await window.authenticationGitHub.getAuthorizationValue();
42
- return `${t} ${i}`;
45
+ const { tokenType: t, accessToken: a } = await window.authenticationGitHub.getAuthorizationValue();
46
+ return `${t} ${a}`;
43
47
  }
44
48
  }
45
49
  async isAuthenticated() {
@@ -53,7 +57,7 @@ let r = class {
53
57
  }
54
58
  };
55
59
  r = d([
56
- h(),
60
+ g(),
57
61
  l(0, s("CristalApp")),
58
62
  l(1, s(u))
59
63
  ], r);
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":";;;;;;;;AAkDA,IAAMA,IAAN,MAAmE;AAAA,EACjE,YACyCC,GAEtBC,GACjB;AAHuC,SAAA,aAAAD,GAEtB,KAAA,sBAAAC,GAGnB,KAAiB,yBAAyB,8BAE1C,KAAiB,uBAAuB,4BAExC,KAAiB,wBAAwB,6BAEzC,KAAiB,uBAAuB;AAAA,EARrC;AAAA,EAUH,MAAM,QAAuB;AAC3B,UAAMC,IAAmB,IAAI;AAAA,MAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB;AAAA,IAAA,GAIpDC,IAKF,OANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA;AAEnB,WAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLC,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,WAAW,SAAA;AAAA,IAAS,GAEnC,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,SAAS,SAAA;AAAA,IAAS,GAEjC,KAAK,oBAAoB,YAAY,QAAQ;AAAA,EAC/C;AAAA,EAEA,MAAM,WAA0B;AAC9B,WAAO,OAAO,qBAAqB;AAAA,MACjC,KAAK,WAAW,cAAA,EAAgB;AAAA,MAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB;AAAA,MACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB;AAAA,MACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB;AAAA,IAAA;AAAA,EAE1D;AAAA,EAEA,MAAM,yBAAsD;AAE1D,QADsB,MAAM,KAAK,gBAAA,GACd;AACjB,YAAM,EAAE,WAAAC,GAAW,aAAAC,EAAA,IACjB,MAAM,OAAO,qBAAqB,sBAAA;AACpC,aAAO,GAAGD,CAAS,IAAIC,CAAW;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,kBAAoC;AACxC,WAAO,OAAO,qBAAqB,WAAA;AAAA,EACrC;AAAA,EAEA,MAAM,iBAAuC;AAC3C,WAAO,OAAO,qBAAqB,eAAA;AAAA,EACrC;AAAA,EAEA,MAAM,SAAwB;AAC5B,UAAM,OAAO,qBAAqB,OAAA;AAAA,EACpC;AACF;AA5EMN,IAANO,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAOC,CAAyB,CAAA;AAAA,GAH/BV,CAAA;ACzBN,MAAMW,EAAc;AAAA,EAClB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,GACrBY,EACG,KAAgCF,CAAyB,EACzD,OAAA,EACA,iBAAA;AAAA,EACL;AACF;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type {\n AuthenticationManager,\n UserDetails,\n} from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":";;;;;;;;AAoDA,IAAMA,IAAN,MAAmE;AAAA,EACjE,YACyCC,GAEtBC,GACjB;AAHuC,SAAA,aAAAD,GAEtB,KAAA,sBAAAC;AAAA,EAChB;AAAA,EAEc,yBAAyB;AAAA,EAEzB,uBAAuB;AAAA,EAEvB,wBAAwB;AAAA,EAExB,uBAAuB;AAAA,EAExC,MAAM,QAAuB;AAC3B,UAAMC,IAAmB,IAAI;AAAA,MAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB;AAAA,IAAA,GAIpDC,IAKF,OANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA;AAEnB,WAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLC,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,WAAW,SAAA;AAAA,IAAS,GAEnC,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,SAAS,SAAA;AAAA,IAAS,GAEjC,KAAK,oBAAoB,YAAY,QAAQ;AAAA,EAC/C;AAAA,EAEA,MAAM,WAA0B;AAC9B,WAAO,OAAO,qBAAqB;AAAA,MACjC,KAAK,WAAW,cAAA,EAAgB;AAAA,MAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB;AAAA,MACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB;AAAA,MACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB;AAAA,IAAA;AAAA,EAE1D;AAAA,EAEA,MAAM,yBAAsD;AAE1D,QADsB,MAAM,KAAK,gBAAA,GACd;AACjB,YAAM,EAAE,WAAAC,GAAW,aAAAC,EAAA,IACjB,MAAM,OAAO,qBAAqB,sBAAA;AACpC,aAAO,GAAGD,CAAS,IAAIC,CAAW;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,kBAAoC;AACxC,WAAO,OAAO,qBAAqB,WAAA;AAAA,EACrC;AAAA,EAEA,MAAM,iBAAuC;AAC3C,WAAO,OAAO,qBAAqB,eAAA;AAAA,EACrC;AAAA,EAEA,MAAM,SAAwB;AAC5B,UAAM,OAAO,qBAAqB,OAAA;AAAA,EACpC;AACF;AA5EMN,IAANO,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAOC,CAAyB,CAAA;AAAA,GAH/BV,CAAA;ACxBN,MAAMW,EAAc;AAAA,EAClB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,GACrBY,EACG,KAAgCF,CAAyB,EACzD,OAAA,EACA,iBAAA;AAAA,EACL;AACF;"}
package/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@xwiki/cristal-authentication-github-state"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-authentication-github-state","inversify"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n["cristal_authentication-github-renderer"]={},n.cristalAuthenticationGithubState,n.inversify))})(this,function(n,a,r){"use strict";var d=Object.getOwnPropertyDescriptor,g=(e,t,i,o)=>{for(var c=o>1?void 0:o?d(t,i):t,l=e.length-1,h;l>=0;l--)(h=e[l])&&(c=h(c)||c);return c},u=(e,t)=>(i,o)=>t(i,o,e);let s=class{constructor(e,t){this.cristalApp=e,this.authenticationState=t,this.localStorageDeviceCode="authentication.device_code",this.localStorageUserCode="authentication.user_code",this.localStorageExpiresIn="authentication.expires_in",this.localStorageInterval="authentication.interval"}async start(){const e=new URL(`${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`),i=await(await fetch(e)).json();window.localStorage.setItem(this.localStorageDeviceCode,i.device_code),window.localStorage.setItem(this.localStorageUserCode,i.user_code),window.localStorage.setItem(this.localStorageExpiresIn,i.expires_in.toString()),window.localStorage.setItem(this.localStorageInterval,i.interval.toString()),this.authenticationState.modalOpened.value=!0}async callback(){return window.authenticationGitHub.login(this.cristalApp.getWikiConfig().authenticationBaseURL,window.localStorage.getItem(this.localStorageDeviceCode),window.localStorage.getItem(this.localStorageInterval),window.localStorage.getItem(this.localStorageExpiresIn))}async getAuthorizationHeader(){if(await this.isAuthenticated()){const{tokenType:t,accessToken:i}=await window.authenticationGitHub.getAuthorizationValue();return`${t} ${i}`}}async isAuthenticated(){return window.authenticationGitHub.isLoggedIn()}async getUserDetails(){return window.authenticationGitHub.getUserDetails()}async logout(){await window.authenticationGitHub.logout()}};s=g([r.injectable(),u(0,r.inject("CristalApp")),u(1,r.inject(a.GitHubAuthenticationState))],s);class w{constructor(t){t.bind("AuthenticationManager").to(s).inSingletonScope().whenNamed("GitHub"),t.bind(a.GitHubAuthenticationState).toSelf().inSingletonScope()}}Object.defineProperty(n,"GitHubAuthenticationState",{enumerable:!0,get:()=>a.GitHubAuthenticationState}),n.ComponentInit=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@xwiki/cristal-authentication-github-state"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-authentication-github-state","inversify"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n["cristal_authentication-github-renderer"]={},n.cristalAuthenticationGithubState,n.inversify))})(this,(function(n,a,r){"use strict";var d=Object.getOwnPropertyDescriptor,g=(e,t,i,o)=>{for(var c=o>1?void 0:o?d(t,i):t,l=e.length-1,h;l>=0;l--)(h=e[l])&&(c=h(c)||c);return c},u=(e,t)=>(i,o)=>t(i,o,e);let s=class{constructor(e,t){this.cristalApp=e,this.authenticationState=t}localStorageDeviceCode="authentication.device_code";localStorageUserCode="authentication.user_code";localStorageExpiresIn="authentication.expires_in";localStorageInterval="authentication.interval";async start(){const e=new URL(`${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`),i=await(await fetch(e)).json();window.localStorage.setItem(this.localStorageDeviceCode,i.device_code),window.localStorage.setItem(this.localStorageUserCode,i.user_code),window.localStorage.setItem(this.localStorageExpiresIn,i.expires_in.toString()),window.localStorage.setItem(this.localStorageInterval,i.interval.toString()),this.authenticationState.modalOpened.value=!0}async callback(){return window.authenticationGitHub.login(this.cristalApp.getWikiConfig().authenticationBaseURL,window.localStorage.getItem(this.localStorageDeviceCode),window.localStorage.getItem(this.localStorageInterval),window.localStorage.getItem(this.localStorageExpiresIn))}async getAuthorizationHeader(){if(await this.isAuthenticated()){const{tokenType:t,accessToken:i}=await window.authenticationGitHub.getAuthorizationValue();return`${t} ${i}`}}async isAuthenticated(){return window.authenticationGitHub.isLoggedIn()}async getUserDetails(){return window.authenticationGitHub.getUserDetails()}async logout(){await window.authenticationGitHub.logout()}};s=g([r.injectable(),u(0,r.inject("CristalApp")),u(1,r.inject(a.GitHubAuthenticationState))],s);class w{constructor(t){t.bind("AuthenticationManager").to(s).inSingletonScope().whenNamed("GitHub"),t.bind(a.GitHubAuthenticationState).toSelf().inSingletonScope()}}Object.defineProperty(n,"GitHubAuthenticationState",{enumerable:!0,get:()=>a.GitHubAuthenticationState}),n.ComponentInit=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":"6lBAkDA,IAAMA,EAAN,KAAmE,CACjE,YACyCC,EAEtBC,EACjB,CAHuC,KAAA,WAAAD,EAEtB,KAAA,oBAAAC,EAGnB,KAAiB,uBAAyB,6BAE1C,KAAiB,qBAAuB,2BAExC,KAAiB,sBAAwB,4BAEzC,KAAiB,qBAAuB,yBARrC,CAUH,MAAM,OAAuB,CAC3B,MAAMC,EAAmB,IAAI,IAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB,eAAA,EAIpDC,EAKF,MANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA,EAEnB,OAAO,aAAa,QAClB,KAAK,uBACLC,EAAa,WAAA,EAEf,OAAO,aAAa,QAClB,KAAK,qBACLA,EAAa,SAAA,EAEf,OAAO,aAAa,QAClB,KAAK,sBACLA,EAAa,WAAW,SAAA,CAAS,EAEnC,OAAO,aAAa,QAClB,KAAK,qBACLA,EAAa,SAAS,SAAA,CAAS,EAEjC,KAAK,oBAAoB,YAAY,MAAQ,EAC/C,CAEA,MAAM,UAA0B,CAC9B,OAAO,OAAO,qBAAqB,MACjC,KAAK,WAAW,cAAA,EAAgB,sBAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB,EACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB,EACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB,CAAA,CAE1D,CAEA,MAAM,wBAAsD,CAE1D,GADsB,MAAM,KAAK,gBAAA,EACd,CACjB,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAA,EACjB,MAAM,OAAO,qBAAqB,sBAAA,EACpC,MAAO,GAAGD,CAAS,IAAIC,CAAW,EACpC,CACF,CAEA,MAAM,iBAAoC,CACxC,OAAO,OAAO,qBAAqB,WAAA,CACrC,CAEA,MAAM,gBAAuC,CAC3C,OAAO,OAAO,qBAAqB,eAAA,CACrC,CAEA,MAAM,QAAwB,CAC5B,MAAM,OAAO,qBAAqB,OAAA,CACpC,CACF,EA5EMN,EAANO,EAAA,CADCC,aAAA,EAGIC,aAAO,YAAY,CAAA,EACnBA,aAAOC,2BAAyB,CAAA,CAAA,EAH/BV,CAAA,ECzBN,MAAMW,CAAc,CAClB,YAAYC,EAAsB,CAChCA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,EACrBY,EACG,KAAgCF,EAAAA,yBAAyB,EACzD,OAAA,EACA,iBAAA,CACL,CACF"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type {\n AuthenticationManager,\n UserDetails,\n} from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":"8lBAoDA,IAAMA,EAAN,KAAmE,CACjE,YACyCC,EAEtBC,EACjB,CAHuC,KAAA,WAAAD,EAEtB,KAAA,oBAAAC,CAChB,CAEc,uBAAyB,6BAEzB,qBAAuB,2BAEvB,sBAAwB,4BAExB,qBAAuB,0BAExC,MAAM,OAAuB,CAC3B,MAAMC,EAAmB,IAAI,IAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB,eAAA,EAIpDC,EAKF,MANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA,EAEnB,OAAO,aAAa,QAClB,KAAK,uBACLC,EAAa,WAAA,EAEf,OAAO,aAAa,QAClB,KAAK,qBACLA,EAAa,SAAA,EAEf,OAAO,aAAa,QAClB,KAAK,sBACLA,EAAa,WAAW,SAAA,CAAS,EAEnC,OAAO,aAAa,QAClB,KAAK,qBACLA,EAAa,SAAS,SAAA,CAAS,EAEjC,KAAK,oBAAoB,YAAY,MAAQ,EAC/C,CAEA,MAAM,UAA0B,CAC9B,OAAO,OAAO,qBAAqB,MACjC,KAAK,WAAW,cAAA,EAAgB,sBAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB,EACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB,EACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB,CAAA,CAE1D,CAEA,MAAM,wBAAsD,CAE1D,GADsB,MAAM,KAAK,gBAAA,EACd,CACjB,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAA,EACjB,MAAM,OAAO,qBAAqB,sBAAA,EACpC,MAAO,GAAGD,CAAS,IAAIC,CAAW,EACpC,CACF,CAEA,MAAM,iBAAoC,CACxC,OAAO,OAAO,qBAAqB,WAAA,CACrC,CAEA,MAAM,gBAAuC,CAC3C,OAAO,OAAO,qBAAqB,eAAA,CACrC,CAEA,MAAM,QAAwB,CAC5B,MAAM,OAAO,qBAAqB,OAAA,CACpC,CACF,EA5EMN,EAANO,EAAA,CADCC,aAAA,EAGIC,aAAO,YAAY,CAAA,EACnBA,aAAOC,2BAAyB,CAAA,CAAA,EAH/BV,CAAA,ECxBN,MAAMW,CAAc,CAClB,YAAYC,EAAsB,CAChCA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,EACrBY,EACG,KAAgCF,EAAAA,yBAAyB,EACzD,OAAA,EACA,iBAAA,CACL,CACF"}
@@ -0,0 +1,19 @@
1
+ ## API Report File for "@xwiki/cristal-electron-authentication-github-renderer"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { Container } from 'inversify';
8
+ import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
9
+
10
+ // @beta (undocumented)
11
+ export class ComponentInit {
12
+ constructor(container: Container);
13
+ }
14
+
15
+ export { GitHubAuthenticationState }
16
+
17
+ // (No @packageDocumentation comment for this package)
18
+
19
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-electron-authentication-github-renderer",
3
- "version": "0.21.1",
3
+ "version": "0.23.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -26,28 +26,30 @@
26
26
  }
27
27
  },
28
28
  "main": "./dist/index.es.js",
29
+ "types": "./dist/index.d.ts",
29
30
  "dependencies": {
30
- "@xwiki/cristal-api": "0.21.1",
31
- "@xwiki/cristal-authentication-github-state": "0.21.1",
32
- "@xwiki/cristal-authentication-api": "0.21.1"
31
+ "@xwiki/cristal-api": "0.23.0",
32
+ "@xwiki/cristal-authentication-api": "0.23.0",
33
+ "@xwiki/cristal-authentication-github-state": "0.23.0"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "inversify": "7.x",
36
37
  "reflect-metadata": "0.x"
37
38
  },
38
39
  "devDependencies": {
39
- "inversify": "7.7.0",
40
+ "inversify": "7.10.2",
40
41
  "reflect-metadata": "0.2.2",
41
- "typescript": "5.9.2",
42
- "vite": "7.0.6",
43
- "vue": "3.5.18",
44
- "@xwiki/cristal-dev-config": "0.21.1"
42
+ "typescript": "5.9.3",
43
+ "vite": "7.1.9",
44
+ "vue": "3.5.22",
45
+ "@xwiki/cristal-dev-config": "0.23.0"
45
46
  },
46
47
  "scripts": {
47
- "build": "tsc --project tsconfig.json && vite build",
48
+ "api-extractor:local": "api-extractor run --local",
49
+ "build": "vite build",
48
50
  "clean": "rimraf dist",
49
51
  "lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0",
50
- "test": "vitest --run"
51
- },
52
- "types": "./dist/index.d.ts"
52
+ "test": "vitest --run",
53
+ "typecheck": "tsc"
54
+ }
53
55
  }
@@ -18,11 +18,13 @@
18
18
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  */
20
20
 
21
- import { UserDetails } from "@xwiki/cristal-authentication-api";
22
21
  import { GitHubAuthenticationState } from "@xwiki/cristal-authentication-github-state";
23
22
  import { inject, injectable } from "inversify";
24
23
  import type { CristalApp } from "@xwiki/cristal-api";
25
- import type { AuthenticationManager } from "@xwiki/cristal-authentication-api";
24
+ import type {
25
+ AuthenticationManager,
26
+ UserDetails,
27
+ } from "@xwiki/cristal-authentication-api";
26
28
 
27
29
  interface AuthenticationWindow extends Window {
28
30
  authenticationGitHub: {
package/src/index.ts CHANGED
@@ -23,6 +23,9 @@ import { GitHubAuthenticationState } from "@xwiki/cristal-authentication-github-
23
23
  import type { AuthenticationManager } from "@xwiki/cristal-authentication-api";
24
24
  import type { Container } from "inversify";
25
25
 
26
+ /**
27
+ * @beta
28
+ */
26
29
  class ComponentInit {
27
30
  constructor(container: Container) {
28
31
  container
package/vitest.config.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  import localConfig from "./vite.config";
22
+ import { vitestVue as defaultConfig } from "@xwiki/cristal-dev-config";
22
23
  import { mergeConfig } from "vitest/config";
23
- import defaultConfig from "@xwiki/cristal-dev-config/vitest-vue.config";
24
24
 
25
25
  export default mergeConfig(defaultConfig, localConfig);