@capgo/capacitor-social-login 0.0.43 → 0.0.45

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/Package.swift CHANGED
@@ -12,7 +12,7 @@ let package = Package(
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main"),
14
14
  // FBSDKCoreKit and FBSDKLoginKit
15
- .package(url: "https://github.com/facebook/facebook-ios-sdk.git", .upToNextMajor(from: "17.1.0")),
15
+ .package(url: "https://github.com/facebook/facebook-ios-sdk.git", .upToNextMajor(from: "17.3.0")),
16
16
  // Add Google Sign-In dependency
17
17
  .package(url: "https://github.com/google/GoogleSignIn-iOS.git", .upToNextMajor(from: "8.0.0")),
18
18
  // Alamofire
package/dist/esm/web.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
- import type { SocialLoginPlugin, InitializeOptions, LoginOptions, LoginResult, AuthorizationCode, isLoggedInOptions } from "./definitions";
2
+ import type { SocialLoginPlugin, InitializeOptions, LoginOptions, LoginResult, AuthorizationCode, isLoggedInOptions, AuthorizationCodeOptions } from "./definitions";
3
3
  export declare class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {
4
4
  private googleClientId;
5
+ private appleClientId;
5
6
  private googleScriptLoaded;
7
+ private appleScriptLoaded;
8
+ private appleScriptUrl;
6
9
  initialize(options: InitializeOptions): Promise<void>;
7
10
  login(options: LoginOptions): Promise<LoginResult>;
8
11
  logout(options: {
@@ -11,9 +14,12 @@ export declare class SocialLoginWeb extends WebPlugin implements SocialLoginPlug
11
14
  isLoggedIn(options: isLoggedInOptions): Promise<{
12
15
  isLoggedIn: boolean;
13
16
  }>;
14
- getAuthorizationCode(): Promise<AuthorizationCode>;
17
+ getAuthorizationCode(options: AuthorizationCodeOptions): Promise<AuthorizationCode>;
15
18
  refresh(options: LoginOptions): Promise<void>;
16
19
  private loginWithGoogle;
17
20
  private parseJwt;
18
21
  private loadGoogleScript;
22
+ private loginWithApple;
23
+ private loadAppleScript;
24
+ private getGoogleUser;
19
25
  }
package/dist/esm/web.js CHANGED
@@ -3,40 +3,108 @@ export class SocialLoginWeb extends WebPlugin {
3
3
  constructor() {
4
4
  super(...arguments);
5
5
  this.googleClientId = null;
6
+ this.appleClientId = null;
6
7
  this.googleScriptLoaded = false;
8
+ this.appleScriptLoaded = false;
9
+ this.appleScriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';
7
10
  }
8
11
  async initialize(options) {
9
- var _a;
12
+ var _a, _b;
10
13
  if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
11
14
  this.googleClientId = options.google.webClientId;
12
15
  await this.loadGoogleScript();
13
16
  }
17
+ if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {
18
+ this.appleClientId = options.apple.clientId;
19
+ await this.loadAppleScript();
20
+ }
14
21
  // Implement initialization for other providers if needed
15
22
  }
16
23
  async login(options) {
17
24
  if (options.provider === 'google') {
18
25
  return this.loginWithGoogle(options.options);
19
26
  }
27
+ else if (options.provider === 'apple') {
28
+ return this.loginWithApple(options.options);
29
+ }
20
30
  // Implement login for other providers
21
31
  throw new Error(`Login for ${options.provider} is not implemented on web`);
22
32
  }
23
33
  async logout(options) {
24
- if (options.provider === 'google') {
25
- // Implement Google logout
34
+ switch (options.provider) {
35
+ case 'google':
36
+ // Google doesn't have a specific logout method for web
37
+ // We can revoke the token if we have it stored
38
+ console.log('Google logout: Token should be revoked on the client side if stored');
39
+ break;
40
+ case 'apple':
41
+ // Apple doesn't provide a logout method for web
42
+ console.log('Apple logout: Session should be managed on the client side');
43
+ break;
44
+ case 'facebook':
45
+ // Implement Facebook logout when Facebook login is added
46
+ console.log('Facebook logout not implemented');
47
+ break;
48
+ default:
49
+ throw new Error(`Logout for ${options.provider} is not implemented`);
26
50
  }
27
- // Implement logout for other providers
28
51
  }
29
52
  async isLoggedIn(options) {
30
- console.log("isLoggedIn", options);
31
- // Implement isLoggedIn check for each provider
32
- return { isLoggedIn: false };
53
+ switch (options.provider) {
54
+ case 'google':
55
+ // For Google, we can check if there's a valid token
56
+ const googleUser = await this.getGoogleUser();
57
+ return { isLoggedIn: !!googleUser };
58
+ case 'apple':
59
+ // Apple doesn't provide a method to check login status on web
60
+ console.log('Apple login status should be managed on the client side');
61
+ return { isLoggedIn: false };
62
+ case 'facebook':
63
+ // Implement Facebook isLoggedIn when Facebook login is added
64
+ console.log('Facebook isLoggedIn not implemented');
65
+ return { isLoggedIn: false };
66
+ default:
67
+ throw new Error(`isLoggedIn for ${options.provider} is not implemented`);
68
+ }
33
69
  }
34
- async getAuthorizationCode() {
35
- throw new Error('Method not implemented.');
70
+ async getAuthorizationCode(options) {
71
+ switch (options.provider) {
72
+ case 'google':
73
+ // For Google, we can use the id_token as the authorization code
74
+ const googleUser = await this.getGoogleUser();
75
+ if (googleUser && googleUser.credential) {
76
+ return { jwt: googleUser.credential };
77
+ }
78
+ throw new Error('No Google authorization code available');
79
+ case 'apple':
80
+ // Apple authorization code should be obtained during login
81
+ console.log('Apple authorization code should be stored during login');
82
+ throw new Error('Apple authorization code not available');
83
+ case 'facebook':
84
+ // Implement Facebook getAuthorizationCode when Facebook login is added
85
+ console.log('Facebook getAuthorizationCode not implemented');
86
+ throw new Error('Facebook authorization code not available');
87
+ default:
88
+ throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);
89
+ }
36
90
  }
37
91
  async refresh(options) {
38
- console.log("REFRESH", options);
39
- throw new Error('Method not implemented.');
92
+ switch (options.provider) {
93
+ case 'google':
94
+ // For Google, we can prompt for re-authentication
95
+ await this.loginWithGoogle(options.options);
96
+ break;
97
+ case 'apple':
98
+ // Apple doesn't provide a refresh method for web
99
+ console.log('Apple refresh not available on web');
100
+ break;
101
+ case 'facebook':
102
+ // Implement Facebook refresh when Facebook login is added
103
+ console.log('Facebook refresh not implemented');
104
+ break;
105
+ default:
106
+ throw new Error(`Refresh for ${options.provider} is not implemented`);
107
+ }
40
108
  }
41
109
  async loginWithGoogle(options) {
42
110
  console.log("isLoggedIn", options);
@@ -100,5 +168,70 @@ export class SocialLoginWeb extends WebPlugin {
100
168
  document.body.appendChild(script);
101
169
  });
102
170
  }
171
+ async loginWithApple(options) {
172
+ if (!this.appleClientId) {
173
+ throw new Error('Apple Client ID not set. Call initialize() first.');
174
+ }
175
+ if (!this.appleScriptLoaded) {
176
+ throw new Error('Apple Sign-In script not loaded.');
177
+ }
178
+ return new Promise((resolve, reject) => {
179
+ var _a;
180
+ AppleID.auth.init({
181
+ clientId: this.appleClientId,
182
+ scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',
183
+ redirectURI: options.redirectUrl || window.location.href,
184
+ state: options.state,
185
+ nonce: options.nonce,
186
+ usePopup: true,
187
+ });
188
+ AppleID.auth.signIn()
189
+ .then((res) => {
190
+ var _a, _b, _c, _d, _e, _f, _g;
191
+ const result = {
192
+ user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName) ? `${res.user.name.firstName} ${res.user.name.lastName}` : null,
193
+ email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,
194
+ givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,
195
+ familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,
196
+ identityToken: res.authorization.id_token || null,
197
+ authorizationCode: res.authorization.code || null,
198
+ };
199
+ resolve({ provider: 'apple', result });
200
+ })
201
+ .catch((error) => {
202
+ reject(error);
203
+ });
204
+ });
205
+ }
206
+ async loadAppleScript() {
207
+ if (this.appleScriptLoaded)
208
+ return;
209
+ return new Promise((resolve, reject) => {
210
+ const script = document.createElement('script');
211
+ script.src = this.appleScriptUrl;
212
+ script.async = true;
213
+ script.onload = () => {
214
+ this.appleScriptLoaded = true;
215
+ resolve();
216
+ };
217
+ script.onerror = reject;
218
+ document.body.appendChild(script);
219
+ });
220
+ }
221
+ async getGoogleUser() {
222
+ return new Promise((resolve) => {
223
+ google.accounts.id.initialize({
224
+ client_id: this.googleClientId,
225
+ callback: (response) => {
226
+ resolve(response);
227
+ },
228
+ });
229
+ google.accounts.id.prompt((notification) => {
230
+ if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
231
+ resolve(null);
232
+ }
233
+ });
234
+ });
235
+ }
103
236
  }
104
237
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAsB5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAA7C;;QACU,mBAAc,GAAkB,IAAI,CAAC;QACrC,uBAAkB,GAAG,KAAK,CAAC;IAyGrC,CAAC;IAvGC,KAAK,CAAC,UAAU,CAAC,OAA0B;;QACzC,IAAI,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YACjD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;QACD,yDAAyD;IAC3D,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;QACD,sCAAsC;QACtC,MAAM,IAAI,KAAK,CAAC,aAAa,OAAO,CAAC,QAAQ,4BAA4B,CAAC,CAAC;IAC7E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAsD;QACjE,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAA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AAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,IAAI,IAAI,CAAC,kBAAkB;YAAE,OAAO;QAEpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAChD,MAAM,CAAC,GAAG,GAAG,wCAAwC,CAAC;YACtD,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;YACpB,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;gBACnB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAC/B,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YACF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;YACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n LoginResult,\n AuthorizationCode,\n GoogleLoginResponse,\n isLoggedInOptions,\n} from \"./definitions\";\n\n// Add this declaration at the top of the file\ndeclare const google: {\n accounts: {\n id: {\n initialize(config: { client_id: string; callback: (response: any) => void }): void;\n prompt(callback: (notification: any) => void): void;\n };\n };\n};\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private googleClientId: string | null = null;\n private googleScriptLoaded = false;\n\n async initialize(options: InitializeOptions): Promise<void> {\n if (options.google?.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n // Implement initialization for other providers if needed\n }\n\n async login(options: LoginOptions): Promise<LoginResult> {\n if (options.provider === 'google') {\n return this.loginWithGoogle(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n\n async logout(options: { provider: 'apple' | 'google' | 'facebook' }): Promise<void> {\n if (options.provider === 'google') {\n // Implement Google logout\n }\n // Implement logout for other providers\n }\n\n async isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }> {\n console.log(\"isLoggedIn\", options);\n // Implement isLoggedIn check for each provider\n return { isLoggedIn: false };\n }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\n throw new Error('Method not implemented.');\n }\n\n async refresh(options: LoginOptions): Promise<void> {\n console.log(\"REFRESH\", options);\n throw new Error('Method not implemented.');\n }\n\n private async loginWithGoogle(options: any): Promise<LoginResult> {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n } else {\n const payload = this.parseJwt(response.credential);\n const result: GoogleLoginResponse = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n }\n };\n resolve({ provider: 'google', result });\n }\n },\n });\n\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n\n private parseJwt(token: string) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n return JSON.parse(jsonPayload);\n }\n\n private async loadGoogleScript(): Promise<void> {\n if (this.googleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://accounts.google.com/gsi/client';\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA0B5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAA7C;;QACU,mBAAc,GAAkB,IAAI,CAAC;QACrC,kBAAa,GAAkB,IAAI,CAAC;QACpC,uBAAkB,GAAG,KAAK,CAAC;QAC3B,sBAAiB,GAAG,KAAK,CAAC;QAC1B,mBAAc,GAAG,sFAAsF,CAAC;IA8OlH,CAAC;IA5OC,KAAK,CAAC,UAAU,CAAC,OAA0B;;QACzC,IAAI,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YACjD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,MAAA,OAAO,CAAC,KAAK,0CAAE,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC5C,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC;QACD,yDAAyD;IAC3D,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,OAAO,CAAC,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I,CAAC;gBAC9B,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YACF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;YACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC;gBAC5B,SAAS,EAAE,IAAI,CAAC,cAAe;gBAC/B,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;oBACrB,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACpB,CAAC;aACF,CAAC,CAAC;YACH,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE;gBACzC,IAAI,YAAY,CAAC,cAAc,EAAE,IAAI,YAAY,CAAC,eAAe,EAAE,EAAE,CAAC;oBACpE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n LoginResult,\n AuthorizationCode,\n GoogleLoginResponse,\n AppleProviderResponse,\n isLoggedInOptions,\n AuthorizationCodeOptions,\n} from \"./definitions\";\n\n// Add this declaration at the top of the file\ndeclare const google: {\n accounts: {\n id: {\n initialize(config: { client_id: string; callback: (response: any) => void }): void;\n prompt(callback: (notification: any) => void): void;\n };\n };\n};\n\ndeclare const AppleID: any;\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private googleClientId: string | null = null;\n private appleClientId: string | null = null;\n private googleScriptLoaded = false;\n private appleScriptLoaded = false;\n private appleScriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n\n async initialize(options: InitializeOptions): Promise<void> {\n if (options.google?.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if (options.apple?.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n // Implement initialization for other providers if needed\n }\n\n async login(options: LoginOptions): Promise<LoginResult> {\n if (options.provider === 'google') {\n return this.loginWithGoogle(options.options);\n } else if (options.provider === 'apple') {\n return this.loginWithApple(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n\n async logout(options: { provider: 'apple' | 'google' | 'facebook' }): Promise<void> {\n switch (options.provider) {\n case 'google':\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log('Google logout: Token should be revoked on the client side if stored');\n break;\n case 'apple':\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n break;\n case 'facebook':\n // Implement Facebook logout when Facebook login is added\n console.log('Facebook logout not implemented');\n break;\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n\n async isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }> {\n switch (options.provider) {\n case 'google':\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case 'apple':\n // Apple doesn't provide a method to check login status on web\n console.log('Apple login status should be managed on the client side');\n return { isLoggedIn: false };\n case 'facebook':\n // Implement Facebook isLoggedIn when Facebook login is added\n console.log('Facebook isLoggedIn not implemented');\n return { isLoggedIn: false };\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n\n async getAuthorizationCode(options: AuthorizationCodeOptions): Promise<AuthorizationCode> {\n switch (options.provider) {\n case 'google':\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error('No Google authorization code available');\n case 'apple':\n // Apple authorization code should be obtained during login\n console.log('Apple authorization code should be stored during login');\n throw new Error('Apple authorization code not available');\n case 'facebook':\n // Implement Facebook getAuthorizationCode when Facebook login is added\n console.log('Facebook getAuthorizationCode not implemented');\n throw new Error('Facebook authorization code not available');\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n\n async refresh(options: LoginOptions): Promise<void> {\n switch (options.provider) {\n case 'google':\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case 'apple':\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n break;\n case 'facebook':\n // Implement Facebook refresh when Facebook login is added\n console.log('Facebook refresh not implemented');\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n\n private async loginWithGoogle(options: any): Promise<LoginResult> {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n } else {\n const payload = this.parseJwt(response.credential);\n const result: GoogleLoginResponse = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n }\n };\n resolve({ provider: 'google', result });\n }\n },\n });\n\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n\n private parseJwt(token: string) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n return JSON.parse(jsonPayload);\n }\n\n private async loadGoogleScript(): Promise<void> {\n if (this.googleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://accounts.google.com/gsi/client';\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithApple(options: any): Promise<LoginResult> {\n if (!this.appleClientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n\n if (!this.appleScriptLoaded) {\n throw new Error('Apple Sign-In script not loaded.');\n }\n\n return new Promise((resolve, reject) => {\n AppleID.auth.init({\n clientId: this.appleClientId!,\n scope: options.scopes?.join(' ') || 'name email',\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n\n AppleID.auth.signIn()\n .then((res: any) => {\n const result: AppleProviderResponse = {\n user: res.user?.name?.firstName ? `${res.user.name.firstName} ${res.user.name.lastName}` : null,\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.appleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async getGoogleUser(): Promise<any> {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n}\n"]}
@@ -10,38 +10,108 @@ class SocialLoginWeb extends core.WebPlugin {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  this.googleClientId = null;
13
+ this.appleClientId = null;
13
14
  this.googleScriptLoaded = false;
15
+ this.appleScriptLoaded = false;
16
+ this.appleScriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';
14
17
  }
15
18
  async initialize(options) {
16
- var _a;
19
+ var _a, _b;
17
20
  if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
18
21
  this.googleClientId = options.google.webClientId;
19
22
  await this.loadGoogleScript();
20
23
  }
24
+ if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {
25
+ this.appleClientId = options.apple.clientId;
26
+ await this.loadAppleScript();
27
+ }
21
28
  // Implement initialization for other providers if needed
22
29
  }
23
30
  async login(options) {
24
31
  if (options.provider === 'google') {
25
32
  return this.loginWithGoogle(options.options);
26
33
  }
34
+ else if (options.provider === 'apple') {
35
+ return this.loginWithApple(options.options);
36
+ }
27
37
  // Implement login for other providers
28
38
  throw new Error(`Login for ${options.provider} is not implemented on web`);
29
39
  }
30
40
  async logout(options) {
31
- if (options.provider === 'google') ;
32
- // Implement logout for other providers
41
+ switch (options.provider) {
42
+ case 'google':
43
+ // Google doesn't have a specific logout method for web
44
+ // We can revoke the token if we have it stored
45
+ console.log('Google logout: Token should be revoked on the client side if stored');
46
+ break;
47
+ case 'apple':
48
+ // Apple doesn't provide a logout method for web
49
+ console.log('Apple logout: Session should be managed on the client side');
50
+ break;
51
+ case 'facebook':
52
+ // Implement Facebook logout when Facebook login is added
53
+ console.log('Facebook logout not implemented');
54
+ break;
55
+ default:
56
+ throw new Error(`Logout for ${options.provider} is not implemented`);
57
+ }
33
58
  }
34
59
  async isLoggedIn(options) {
35
- console.log("isLoggedIn", options);
36
- // Implement isLoggedIn check for each provider
37
- return { isLoggedIn: false };
60
+ switch (options.provider) {
61
+ case 'google':
62
+ // For Google, we can check if there's a valid token
63
+ const googleUser = await this.getGoogleUser();
64
+ return { isLoggedIn: !!googleUser };
65
+ case 'apple':
66
+ // Apple doesn't provide a method to check login status on web
67
+ console.log('Apple login status should be managed on the client side');
68
+ return { isLoggedIn: false };
69
+ case 'facebook':
70
+ // Implement Facebook isLoggedIn when Facebook login is added
71
+ console.log('Facebook isLoggedIn not implemented');
72
+ return { isLoggedIn: false };
73
+ default:
74
+ throw new Error(`isLoggedIn for ${options.provider} is not implemented`);
75
+ }
38
76
  }
39
- async getAuthorizationCode() {
40
- throw new Error('Method not implemented.');
77
+ async getAuthorizationCode(options) {
78
+ switch (options.provider) {
79
+ case 'google':
80
+ // For Google, we can use the id_token as the authorization code
81
+ const googleUser = await this.getGoogleUser();
82
+ if (googleUser && googleUser.credential) {
83
+ return { jwt: googleUser.credential };
84
+ }
85
+ throw new Error('No Google authorization code available');
86
+ case 'apple':
87
+ // Apple authorization code should be obtained during login
88
+ console.log('Apple authorization code should be stored during login');
89
+ throw new Error('Apple authorization code not available');
90
+ case 'facebook':
91
+ // Implement Facebook getAuthorizationCode when Facebook login is added
92
+ console.log('Facebook getAuthorizationCode not implemented');
93
+ throw new Error('Facebook authorization code not available');
94
+ default:
95
+ throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);
96
+ }
41
97
  }
42
98
  async refresh(options) {
43
- console.log("REFRESH", options);
44
- throw new Error('Method not implemented.');
99
+ switch (options.provider) {
100
+ case 'google':
101
+ // For Google, we can prompt for re-authentication
102
+ await this.loginWithGoogle(options.options);
103
+ break;
104
+ case 'apple':
105
+ // Apple doesn't provide a refresh method for web
106
+ console.log('Apple refresh not available on web');
107
+ break;
108
+ case 'facebook':
109
+ // Implement Facebook refresh when Facebook login is added
110
+ console.log('Facebook refresh not implemented');
111
+ break;
112
+ default:
113
+ throw new Error(`Refresh for ${options.provider} is not implemented`);
114
+ }
45
115
  }
46
116
  async loginWithGoogle(options) {
47
117
  console.log("isLoggedIn", options);
@@ -105,6 +175,71 @@ class SocialLoginWeb extends core.WebPlugin {
105
175
  document.body.appendChild(script);
106
176
  });
107
177
  }
178
+ async loginWithApple(options) {
179
+ if (!this.appleClientId) {
180
+ throw new Error('Apple Client ID not set. Call initialize() first.');
181
+ }
182
+ if (!this.appleScriptLoaded) {
183
+ throw new Error('Apple Sign-In script not loaded.');
184
+ }
185
+ return new Promise((resolve, reject) => {
186
+ var _a;
187
+ AppleID.auth.init({
188
+ clientId: this.appleClientId,
189
+ scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',
190
+ redirectURI: options.redirectUrl || window.location.href,
191
+ state: options.state,
192
+ nonce: options.nonce,
193
+ usePopup: true,
194
+ });
195
+ AppleID.auth.signIn()
196
+ .then((res) => {
197
+ var _a, _b, _c, _d, _e, _f, _g;
198
+ const result = {
199
+ user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName) ? `${res.user.name.firstName} ${res.user.name.lastName}` : null,
200
+ email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,
201
+ givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,
202
+ familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,
203
+ identityToken: res.authorization.id_token || null,
204
+ authorizationCode: res.authorization.code || null,
205
+ };
206
+ resolve({ provider: 'apple', result });
207
+ })
208
+ .catch((error) => {
209
+ reject(error);
210
+ });
211
+ });
212
+ }
213
+ async loadAppleScript() {
214
+ if (this.appleScriptLoaded)
215
+ return;
216
+ return new Promise((resolve, reject) => {
217
+ const script = document.createElement('script');
218
+ script.src = this.appleScriptUrl;
219
+ script.async = true;
220
+ script.onload = () => {
221
+ this.appleScriptLoaded = true;
222
+ resolve();
223
+ };
224
+ script.onerror = reject;
225
+ document.body.appendChild(script);
226
+ });
227
+ }
228
+ async getGoogleUser() {
229
+ return new Promise((resolve) => {
230
+ google.accounts.id.initialize({
231
+ client_id: this.googleClientId,
232
+ callback: (response) => {
233
+ resolve(response);
234
+ },
235
+ });
236
+ google.accounts.id.prompt((notification) => {
237
+ if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
238
+ resolve(null);
239
+ }
240
+ });
241
+ });
242
+ }
108
243
  }
109
244
 
110
245
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.googleScriptLoaded = false;\n }\n async initialize(options) {\n var _a;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === 'google') {\n return this.loginWithGoogle(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n if (options.provider === 'google') {\n // Implement Google logout\n }\n // Implement logout for other providers\n }\n async isLoggedIn(options) {\n console.log(\"isLoggedIn\", options);\n // Implement isLoggedIn check for each provider\n return { isLoggedIn: false };\n }\n async getAuthorizationCode() {\n throw new Error('Method not implemented.');\n }\n async refresh(options) {\n console.log(\"REFRESH\", options);\n throw new Error('Method not implemented.');\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n }\n };\n resolve({ provider: 'google', result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://accounts.google.com/gsi/client';\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AACnC,QAAQ,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;AACxC,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ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I,CAAC,kBAAkB;AACnC,YAAY,OAAO;AACnB,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC5D,YAAY,MAAM,CAAC,GAAG,GAAG,wCAAwC,CAAC;AAClE,YAAY,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;AAChC,YAAY,MAAM,CAAC,MAAM,GAAG,MAAM;AAClC,gBAAgB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;AAC/C,gBAAgB,OAAO,EAAE,CAAC;AAC1B,aAAa,CAAC;AACd,YAAY,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AACpC,YAAY,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC9C,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n }\n async initialize(options) {\n var _a, _b;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === 'google') {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === 'apple') {\n return this.loginWithApple(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log('Google logout: Token should be revoked on the client side if stored');\n break;\n case 'apple':\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n break;\n case 'facebook':\n // Implement Facebook logout when Facebook login is added\n console.log('Facebook logout not implemented');\n break;\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case 'google':\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case 'apple':\n // Apple doesn't provide a method to check login status on web\n console.log('Apple login status should be managed on the client side');\n return { isLoggedIn: false };\n case 'facebook':\n // Implement Facebook isLoggedIn when Facebook login is added\n console.log('Facebook isLoggedIn not implemented');\n return { isLoggedIn: false };\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case 'google':\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error('No Google authorization code available');\n case 'apple':\n // Apple authorization code should be obtained during login\n console.log('Apple authorization code should be stored during login');\n throw new Error('Apple authorization code not available');\n case 'facebook':\n // Implement Facebook getAuthorizationCode when Facebook login is added\n console.log('Facebook getAuthorizationCode not implemented');\n throw new Error('Facebook authorization code not available');\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case 'google':\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case 'apple':\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n break;\n case 'facebook':\n // Implement Facebook refresh when Facebook login is added\n console.log('Facebook refresh not implemented');\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n }\n };\n resolve({ provider: 'google', result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://accounts.google.com/gsi/client';\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.appleScriptLoaded) {\n throw new Error('Apple Sign-In script not loaded.');\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth.signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName) ? `${res.user.name.firstName} ${res.user.name.lastName}` : null,\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACFM,M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@ -9,38 +9,108 @@ var capacitorCapacitorUpdater = (function (exports, core) {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  this.googleClientId = null;
12
+ this.appleClientId = null;
12
13
  this.googleScriptLoaded = false;
14
+ this.appleScriptLoaded = false;
15
+ this.appleScriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';
13
16
  }
14
17
  async initialize(options) {
15
- var _a;
18
+ var _a, _b;
16
19
  if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
17
20
  this.googleClientId = options.google.webClientId;
18
21
  await this.loadGoogleScript();
19
22
  }
23
+ if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {
24
+ this.appleClientId = options.apple.clientId;
25
+ await this.loadAppleScript();
26
+ }
20
27
  // Implement initialization for other providers if needed
21
28
  }
22
29
  async login(options) {
23
30
  if (options.provider === 'google') {
24
31
  return this.loginWithGoogle(options.options);
25
32
  }
33
+ else if (options.provider === 'apple') {
34
+ return this.loginWithApple(options.options);
35
+ }
26
36
  // Implement login for other providers
27
37
  throw new Error(`Login for ${options.provider} is not implemented on web`);
28
38
  }
29
39
  async logout(options) {
30
- if (options.provider === 'google') ;
31
- // Implement logout for other providers
40
+ switch (options.provider) {
41
+ case 'google':
42
+ // Google doesn't have a specific logout method for web
43
+ // We can revoke the token if we have it stored
44
+ console.log('Google logout: Token should be revoked on the client side if stored');
45
+ break;
46
+ case 'apple':
47
+ // Apple doesn't provide a logout method for web
48
+ console.log('Apple logout: Session should be managed on the client side');
49
+ break;
50
+ case 'facebook':
51
+ // Implement Facebook logout when Facebook login is added
52
+ console.log('Facebook logout not implemented');
53
+ break;
54
+ default:
55
+ throw new Error(`Logout for ${options.provider} is not implemented`);
56
+ }
32
57
  }
33
58
  async isLoggedIn(options) {
34
- console.log("isLoggedIn", options);
35
- // Implement isLoggedIn check for each provider
36
- return { isLoggedIn: false };
59
+ switch (options.provider) {
60
+ case 'google':
61
+ // For Google, we can check if there's a valid token
62
+ const googleUser = await this.getGoogleUser();
63
+ return { isLoggedIn: !!googleUser };
64
+ case 'apple':
65
+ // Apple doesn't provide a method to check login status on web
66
+ console.log('Apple login status should be managed on the client side');
67
+ return { isLoggedIn: false };
68
+ case 'facebook':
69
+ // Implement Facebook isLoggedIn when Facebook login is added
70
+ console.log('Facebook isLoggedIn not implemented');
71
+ return { isLoggedIn: false };
72
+ default:
73
+ throw new Error(`isLoggedIn for ${options.provider} is not implemented`);
74
+ }
37
75
  }
38
- async getAuthorizationCode() {
39
- throw new Error('Method not implemented.');
76
+ async getAuthorizationCode(options) {
77
+ switch (options.provider) {
78
+ case 'google':
79
+ // For Google, we can use the id_token as the authorization code
80
+ const googleUser = await this.getGoogleUser();
81
+ if (googleUser && googleUser.credential) {
82
+ return { jwt: googleUser.credential };
83
+ }
84
+ throw new Error('No Google authorization code available');
85
+ case 'apple':
86
+ // Apple authorization code should be obtained during login
87
+ console.log('Apple authorization code should be stored during login');
88
+ throw new Error('Apple authorization code not available');
89
+ case 'facebook':
90
+ // Implement Facebook getAuthorizationCode when Facebook login is added
91
+ console.log('Facebook getAuthorizationCode not implemented');
92
+ throw new Error('Facebook authorization code not available');
93
+ default:
94
+ throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);
95
+ }
40
96
  }
41
97
  async refresh(options) {
42
- console.log("REFRESH", options);
43
- throw new Error('Method not implemented.');
98
+ switch (options.provider) {
99
+ case 'google':
100
+ // For Google, we can prompt for re-authentication
101
+ await this.loginWithGoogle(options.options);
102
+ break;
103
+ case 'apple':
104
+ // Apple doesn't provide a refresh method for web
105
+ console.log('Apple refresh not available on web');
106
+ break;
107
+ case 'facebook':
108
+ // Implement Facebook refresh when Facebook login is added
109
+ console.log('Facebook refresh not implemented');
110
+ break;
111
+ default:
112
+ throw new Error(`Refresh for ${options.provider} is not implemented`);
113
+ }
44
114
  }
45
115
  async loginWithGoogle(options) {
46
116
  console.log("isLoggedIn", options);
@@ -104,6 +174,71 @@ var capacitorCapacitorUpdater = (function (exports, core) {
104
174
  document.body.appendChild(script);
105
175
  });
106
176
  }
177
+ async loginWithApple(options) {
178
+ if (!this.appleClientId) {
179
+ throw new Error('Apple Client ID not set. Call initialize() first.');
180
+ }
181
+ if (!this.appleScriptLoaded) {
182
+ throw new Error('Apple Sign-In script not loaded.');
183
+ }
184
+ return new Promise((resolve, reject) => {
185
+ var _a;
186
+ AppleID.auth.init({
187
+ clientId: this.appleClientId,
188
+ scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',
189
+ redirectURI: options.redirectUrl || window.location.href,
190
+ state: options.state,
191
+ nonce: options.nonce,
192
+ usePopup: true,
193
+ });
194
+ AppleID.auth.signIn()
195
+ .then((res) => {
196
+ var _a, _b, _c, _d, _e, _f, _g;
197
+ const result = {
198
+ user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName) ? `${res.user.name.firstName} ${res.user.name.lastName}` : null,
199
+ email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,
200
+ givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,
201
+ familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,
202
+ identityToken: res.authorization.id_token || null,
203
+ authorizationCode: res.authorization.code || null,
204
+ };
205
+ resolve({ provider: 'apple', result });
206
+ })
207
+ .catch((error) => {
208
+ reject(error);
209
+ });
210
+ });
211
+ }
212
+ async loadAppleScript() {
213
+ if (this.appleScriptLoaded)
214
+ return;
215
+ return new Promise((resolve, reject) => {
216
+ const script = document.createElement('script');
217
+ script.src = this.appleScriptUrl;
218
+ script.async = true;
219
+ script.onload = () => {
220
+ this.appleScriptLoaded = true;
221
+ resolve();
222
+ };
223
+ script.onerror = reject;
224
+ document.body.appendChild(script);
225
+ });
226
+ }
227
+ async getGoogleUser() {
228
+ return new Promise((resolve) => {
229
+ google.accounts.id.initialize({
230
+ client_id: this.googleClientId,
231
+ callback: (response) => {
232
+ resolve(response);
233
+ },
234
+ });
235
+ google.accounts.id.prompt((notification) => {
236
+ if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
237
+ resolve(null);
238
+ }
239
+ });
240
+ });
241
+ }
107
242
  }
108
243
 
109
244
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.googleScriptLoaded = false;\n }\n async initialize(options) {\n var _a;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === 'google') {\n return this.loginWithGoogle(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n if (options.provider === 'google') {\n // Implement Google logout\n }\n // Implement logout for other providers\n }\n async isLoggedIn(options) {\n console.log(\"isLoggedIn\", options);\n // Implement isLoggedIn check for each provider\n return { isLoggedIn: false };\n }\n async getAuthorizationCode() {\n throw new Error('Method not implemented.');\n }\n async refresh(options) {\n console.log(\"REFRESH\", options);\n throw new Error('Method not implemented.');\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n }\n };\n resolve({ provider: 'google', result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://accounts.google.com/gsi/client';\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IACnC,QAAQ,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACxC,KAAK;I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,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,IAAI,IAAI,CAAC,kBAAkB;IACnC,YAAY,OAAO;IACnB,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;IAChD,YAAY,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC5D,YAAY,MAAM,CAAC,GAAG,GAAG,wCAAwC,CAAC;IAClE,YAAY,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IAChC,YAAY,MAAM,CAAC,MAAM,GAAG,MAAM;IAClC,gBAAgB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAC/C,gBAAgB,OAAO,EAAE,CAAC;IAC1B,aAAa,CAAC;IACd,YAAY,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;IACpC,YAAY,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9C,SAAS,CAAC,CAAC;IACX,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n }\n async initialize(options) {\n var _a, _b;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === 'google') {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === 'apple') {\n return this.loginWithApple(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log('Google logout: Token should be revoked on the client side if stored');\n break;\n case 'apple':\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n break;\n case 'facebook':\n // Implement Facebook logout when Facebook login is added\n console.log('Facebook logout not implemented');\n break;\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case 'google':\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case 'apple':\n // Apple doesn't provide a method to check login status on web\n console.log('Apple login status should be managed on the client side');\n return { isLoggedIn: false };\n case 'facebook':\n // Implement Facebook isLoggedIn when Facebook login is added\n console.log('Facebook isLoggedIn not implemented');\n return { isLoggedIn: false };\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case 'google':\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error('No Google authorization code available');\n case 'apple':\n // Apple authorization code should be obtained during login\n console.log('Apple authorization code should be stored during login');\n throw new Error('Apple authorization code not available');\n case 'facebook':\n // Implement Facebook getAuthorizationCode when Facebook login is added\n console.log('Facebook getAuthorizationCode not implemented');\n throw new Error('Facebook authorization code not available');\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case 'google':\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case 'apple':\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n break;\n case 'facebook':\n // Implement Facebook refresh when Facebook login is added\n console.log('Facebook refresh not implemented');\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n }\n };\n resolve({ provider: 'google', result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://accounts.google.com/gsi/client';\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.appleScriptLoaded) {\n throw new Error('Apple Sign-In script not loaded.');\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth.signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName) ? `${res.user.name.firstName} ${res.user.name.lastName}` : null,\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAA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AC;IACX,KAAK;IACL;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -83,5 +83,5 @@
83
83
  "src": "android"
84
84
  }
85
85
  },
86
- "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1"
86
+ "packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
87
87
  }