hyperapp-is 0.1.33 → 0.1.35

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.
@@ -13,4 +13,4 @@ export { Carousel, effect_InitCarousel } from "./animationView/carousel";
13
13
  export type { ScrollMargin, MatrixState } from "./dom/utils";
14
14
  export { getScrollMargin, getMatrixState } from "./dom/utils";
15
15
  export type { GoogleAccountsId, GoogleTokenClient, GoogleAccountsOAuth2, GoogleAccounts, Google, GoogleAuthConfig, GoogleUser, GoogleAuthResult, GoogleScope, GetAccessTokenConfig } from "./services/google";
16
- export { getGoogle, googleAuth, getAccessToken } from "./services/google";
16
+ export { getGoogle, googleAuth, googleLogout, getAccessToken } from "./services/google";
@@ -7,4 +7,4 @@ export { progress_easing } from "./animation/easing";
7
7
  export { createUnits, createRAFProperties, effect_RAFProperties } from "./animation/properties";
8
8
  export { Carousel, effect_InitCarousel } from "./animationView/carousel";
9
9
  export { getScrollMargin, getMatrixState } from "./dom/utils";
10
- export { getGoogle, googleAuth, getAccessToken } from "./services/google";
10
+ export { getGoogle, googleAuth, googleLogout, getAccessToken } from "./services/google";
@@ -7,6 +7,8 @@ export interface GoogleAccountsId {
7
7
  credential: string;
8
8
  }) => void;
9
9
  }): void;
10
+ disableAutoSelect(): void;
11
+ cancel(): void;
10
12
  prompt(callback?: (notification: any) => void): void;
11
13
  }
12
14
  export interface GoogleTokenClient {
@@ -48,6 +50,7 @@ export interface GoogleAuthResult {
48
50
  user: GoogleUser;
49
51
  }
50
52
  export declare const googleAuth: (config: GoogleAuthConfig) => Promise<GoogleAuthResult>;
53
+ export declare const googleLogout: () => Promise<void>;
51
54
  export type GoogleScope = "openid" | "email" | "profile" | "https://www.googleapis.com/auth/drive" | "https://www.googleapis.com/auth/drive.readonly" | "https://www.googleapis.com/auth/drive.file" | "https://www.googleapis.com/auth/drive.metadata.readonly" | "https://www.googleapis.com/auth/drive.appdata" | "https://www.googleapis.com/auth/calendar" | "https://www.googleapis.com/auth/calendar.readonly" | "https://www.googleapis.com/auth/calendar.events" | "https://www.googleapis.com/auth/calendar.events.readonly" | "https://www.googleapis.com/auth/gmail.readonly" | "https://www.googleapis.com/auth/gmail.modify" | "https://www.googleapis.com/auth/gmail.send" | "https://www.googleapis.com/auth/gmail.compose" | "https://www.googleapis.com/auth/gmail.labels" | "https://www.googleapis.com/auth/spreadsheets" | "https://www.googleapis.com/auth/spreadsheets.readonly" | "https://www.googleapis.com/auth/documents" | "https://www.googleapis.com/auth/documents.readonly" | "https://www.googleapis.com/auth/presentations" | "https://www.googleapis.com/auth/presentations.readonly" | "https://www.googleapis.com/auth/forms" | "https://www.googleapis.com/auth/forms.responses.readonly" | "https://www.googleapis.com/auth/youtube.readonly" | "https://www.googleapis.com/auth/youtube" | "https://www.googleapis.com/auth/youtube.upload" | "https://www.googleapis.com/auth/youtube.force-ssl" | "https://www.googleapis.com/auth/userinfo.email" | "https://www.googleapis.com/auth/userinfo.profile" | (string & {});
52
55
  export interface GetAccessTokenConfig {
53
56
  clientId: string;
@@ -78,10 +78,24 @@ export const googleAuth = async (config) => {
78
78
  }
79
79
  }); // end initialize
80
80
  // show prompt
81
- client.prompt();
81
+ client.prompt((notification) => {
82
+ if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
83
+ reject(new Error("Prompt skipped or not displayed"));
84
+ }
85
+ });
82
86
  }); // end result
83
87
  };
84
88
  // ---------- ---------- ---------- ---------- ----------
89
+ // googleLogout
90
+ // ---------- ---------- ---------- ---------- ----------
91
+ export const googleLogout = async () => {
92
+ const google = await getGoogle();
93
+ // 自動ログインを無効化
94
+ google.accounts.id.disableAutoSelect();
95
+ // セッション的なものをクリア(念のため)
96
+ google.accounts.id.cancel();
97
+ };
98
+ // ---------- ---------- ---------- ---------- ----------
85
99
  // getAccessToken
86
100
  // ---------- ---------- ---------- ---------- ----------
87
101
  export const getAccessToken = (config) => new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperapp-is",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "description": "UI foundation library for Hyperapp by is4416",
5
5
  "license": "MIT",
6
6
  "type": "module",