@capgo/capacitor-social-login 7.5.9 → 7.6.4

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/README.md CHANGED
@@ -23,6 +23,13 @@ We plan in the future to keep adding others social login and make this plugin th
23
23
 
24
24
  This plugin is the only one who implement all 3 majors social login on WEB, IOS and Android
25
25
 
26
+ ## Documentation
27
+
28
+ Best experience to read the doc here:
29
+
30
+ https://capgo.app/docs/plugins/social-login/getting-started/
31
+
32
+
26
33
  ## Install
27
34
 
28
35
  ```bash
@@ -248,6 +255,7 @@ Initialize method create a script tag with google lib, we canot knwo when it's r
248
255
  * [`isLoggedIn(...)`](#isloggedin)
249
256
  * [`getAuthorizationCode(...)`](#getauthorizationcode)
250
257
  * [`refresh(...)`](#refresh)
258
+ * [`providerSpecificCall(...)`](#providerspecificcall)
251
259
  * [Interfaces](#interfaces)
252
260
  * [Type Aliases](#type-aliases)
253
261
 
@@ -352,6 +360,23 @@ Refresh the access token
352
360
  --------------------
353
361
 
354
362
 
363
+ ### providerSpecificCall(...)
364
+
365
+ ```typescript
366
+ providerSpecificCall<T extends "facebook#getProfile">(options: { call: T; options: ProviderSpecificCallOptionsMap[T]; }) => Promise<ProviderSpecificCallResponseMap[T]>
367
+ ```
368
+
369
+ Execute provider-specific calls
370
+
371
+ | Param | Type |
372
+ | ------------- | --------------------------------------------------------------------- |
373
+ | **`options`** | <code>{ call: T; options: ProviderSpecificCallOptionsMap[T]; }</code> |
374
+
375
+ **Returns:** <code>Promise&lt;ProviderSpecificCallResponseMap[T]&gt;</code>
376
+
377
+ --------------------
378
+
379
+
355
380
  ### Interfaces
356
381
 
357
382
 
@@ -466,6 +491,20 @@ Refresh the access token
466
491
  | **`provider`** | <code>'apple' \| 'google' \| 'facebook'</code> | Provider |
467
492
 
468
493
 
494
+ #### FacebookGetProfileResponse
495
+
496
+ | Prop | Type | Description |
497
+ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
498
+ | **`profile`** | <code>{ [key: string]: any; id: string \| null; name: string \| null; email: string \| null; first_name: string \| null; last_name: string \| null; picture?: { data: { height: number \| null; is_silhouette: boolean \| null; url: string \| null; width: number \| null; }; } \| null; }</code> | Facebook profile data |
499
+
500
+
501
+ #### FacebookGetProfileOptions
502
+
503
+ | Prop | Type | Description |
504
+ | ------------ | --------------------- | ---------------------------------------- |
505
+ | **`fields`** | <code>string[]</code> | Fields to retrieve from Facebook profile |
506
+
507
+
469
508
  ### Type Aliases
470
509
 
471
510
 
@@ -490,6 +529,21 @@ Refresh the access token
490
529
 
491
530
  <code>T extends U ? T : never</code>
492
531
 
532
+
533
+ #### ProviderSpecificCallResponseMap
534
+
535
+ <code>{ 'facebook#getProfile': <a href="#facebookgetprofileresponse">FacebookGetProfileResponse</a>; }</code>
536
+
537
+
538
+ #### ProviderSpecificCall
539
+
540
+ <code>'facebook#getProfile'</code>
541
+
542
+
543
+ #### ProviderSpecificCallOptionsMap
544
+
545
+ <code>{ 'facebook#getProfile': <a href="#facebookgetprofileoptions">FacebookGetProfileOptions</a>; }</code>
546
+
493
547
  </docgen-api>
494
548
 
495
549
  ### Credits
@@ -22,6 +22,7 @@ import ee.forgr.capacitor.social.login.helpers.JsonHelper;
22
22
  import ee.forgr.capacitor.social.login.helpers.SocialProvider;
23
23
  import java.util.Collection;
24
24
  import java.util.concurrent.CountDownLatch;
25
+ import org.json.JSONArray;
25
26
  import org.json.JSONException;
26
27
  import org.json.JSONObject;
27
28
 
@@ -207,6 +208,57 @@ public class FacebookProvider implements SocialProvider {
207
208
  return false;
208
209
  }
209
210
 
211
+ public void getProfile(JSONArray fieldsArray, PluginCall call) {
212
+ AccessToken accessToken = AccessToken.getCurrentAccessToken();
213
+ if (accessToken == null || accessToken.isExpired()) {
214
+ call.reject("You're not logged in. Please login first to obtain an access token and try again.");
215
+ return;
216
+ }
217
+
218
+ String[] fieldsStrings = new String[fieldsArray.length()];
219
+ try {
220
+ for (int i = 0; i < fieldsArray.length(); i++) {
221
+ fieldsStrings[i] = fieldsArray.getString(i);
222
+ }
223
+ } catch (JSONException e) {
224
+ call.reject("Invalid fields format");
225
+ return;
226
+ }
227
+
228
+ String fieldsString = String.join(",", fieldsStrings);
229
+
230
+ Bundle parameters = new Bundle();
231
+ parameters.putString("fields", fieldsString);
232
+
233
+ GraphRequest request = GraphRequest.newMeRequest(accessToken, (jsonObject, response) -> {
234
+ if (response == null) {
235
+ call.reject("response is null from Facebook Graph");
236
+ return;
237
+ }
238
+ if (response.getError() != null) {
239
+ call.reject(response.getError().getErrorMessage());
240
+ return;
241
+ }
242
+
243
+ if (jsonObject == null) {
244
+ call.reject("jsonObject is null from Facebook Graph");
245
+ return;
246
+ }
247
+
248
+ try {
249
+ JSObject profile = JSObject.fromJSONObject(jsonObject);
250
+ JSObject result = new JSObject();
251
+ result.put("profile", profile);
252
+ call.resolve(result);
253
+ } catch (Exception e) {
254
+ call.reject("Error parsing profile response: " + e.getMessage());
255
+ }
256
+ });
257
+
258
+ request.setParameters(parameters);
259
+ request.executeAsync();
260
+ }
261
+
210
262
  private JSObject createAccessTokenObject(AccessToken accessToken) {
211
263
  JSObject tokenObject = new JSObject();
212
264
  tokenObject.put("applicationId", accessToken.getApplicationId());
@@ -3,6 +3,7 @@ package ee.forgr.capacitor.social.login;
3
3
  import android.content.Intent;
4
4
  import android.os.Build;
5
5
  import android.util.Log;
6
+ import com.getcapacitor.JSArray;
6
7
  import com.getcapacitor.JSObject;
7
8
  import com.getcapacitor.Plugin;
8
9
  import com.getcapacitor.PluginCall;
@@ -10,6 +11,8 @@ import com.getcapacitor.PluginMethod;
10
11
  import com.getcapacitor.annotation.CapacitorPlugin;
11
12
  import ee.forgr.capacitor.social.login.helpers.SocialProvider;
12
13
  import java.util.HashMap;
14
+ import org.json.JSONArray;
15
+ import org.json.JSONException;
13
16
  import org.json.JSONObject;
14
17
 
15
18
  @CapacitorPlugin(name = "SocialLogin")
@@ -184,6 +187,43 @@ public class SocialLoginPlugin extends Plugin {
184
187
  provider.refresh(call);
185
188
  }
186
189
 
190
+ @PluginMethod
191
+ public void providerSpecificCall(PluginCall call) {
192
+ String customCall = call.getString("call");
193
+ if (customCall == null || customCall.isEmpty()) {
194
+ call.reject("Call is required");
195
+ return;
196
+ }
197
+
198
+ switch (customCall) {
199
+ case "facebook#getProfile":
200
+ JSObject options = call.getObject("options", new JSObject());
201
+ if (options == null) {
202
+ call.reject("Options are required");
203
+ return;
204
+ }
205
+
206
+ JSONArray fieldsArray = null;
207
+ try {
208
+ fieldsArray = options.getJSONArray("fields");
209
+ } catch (JSONException e) {
210
+ call.reject("Fields array is required");
211
+ return;
212
+ }
213
+
214
+ SocialProvider provider = this.socialProviderHashMap.get("facebook");
215
+ if (provider == null || !(provider instanceof FacebookProvider)) {
216
+ call.reject("Facebook provider not initialized");
217
+ return;
218
+ }
219
+
220
+ ((FacebookProvider) provider).getProfile(fieldsArray, call);
221
+ break;
222
+ default:
223
+ call.reject("Invalid call. Supported calls: facebook#getProfile");
224
+ }
225
+ }
226
+
187
227
  public void handleGoogleLoginIntent(int requestCode, Intent intent) {
188
228
  try {
189
229
  SocialProvider provider = socialProviderHashMap.get("google");
@@ -1,5 +1,6 @@
1
1
  package ee.forgr.capacitor.social.login.helpers;
2
2
 
3
+ import com.getcapacitor.JSArray;
3
4
  import com.getcapacitor.PluginCall;
4
5
  import org.json.JSONObject;
5
6
 
package/dist/docs.json CHANGED
@@ -144,6 +144,32 @@
144
144
  "LoginOptions"
145
145
  ],
146
146
  "slug": "refresh"
147
+ },
148
+ {
149
+ "name": "providerSpecificCall",
150
+ "signature": "<T extends \"facebook#getProfile\">(options: { call: T; options: ProviderSpecificCallOptionsMap[T]; }) => Promise<ProviderSpecificCallResponseMap[T]>",
151
+ "parameters": [
152
+ {
153
+ "name": "options",
154
+ "docs": "",
155
+ "type": "{ call: T; options: ProviderSpecificCallOptionsMap[T]; }"
156
+ }
157
+ ],
158
+ "returns": "Promise<ProviderSpecificCallResponseMap[T]>",
159
+ "tags": [
160
+ {
161
+ "name": "description",
162
+ "text": "Execute a provider-specific functionality"
163
+ }
164
+ ],
165
+ "docs": "Execute provider-specific calls",
166
+ "complexTypes": [
167
+ "ProviderSpecificCallResponseMap",
168
+ "T",
169
+ "ProviderSpecificCall",
170
+ "ProviderSpecificCallOptionsMap"
171
+ ],
172
+ "slug": "providerspecificcall"
147
173
  }
148
174
  ],
149
175
  "properties": []
@@ -634,6 +660,43 @@
634
660
  "type": "'apple' | 'google' | 'facebook'"
635
661
  }
636
662
  ]
663
+ },
664
+ {
665
+ "name": "FacebookGetProfileResponse",
666
+ "slug": "facebookgetprofileresponse",
667
+ "docs": "",
668
+ "tags": [],
669
+ "methods": [],
670
+ "properties": [
671
+ {
672
+ "name": "profile",
673
+ "tags": [],
674
+ "docs": "Facebook profile data",
675
+ "complexTypes": [],
676
+ "type": "{ [key: string]: any; id: string | null; name: string | null; email: string | null; first_name: string | null; last_name: string | null; picture?: { data: { height: number | null; is_silhouette: boolean | null; url: string | null; width: number | null; }; } | null | undefined; }"
677
+ }
678
+ ]
679
+ },
680
+ {
681
+ "name": "FacebookGetProfileOptions",
682
+ "slug": "facebookgetprofileoptions",
683
+ "docs": "",
684
+ "tags": [],
685
+ "methods": [],
686
+ "properties": [
687
+ {
688
+ "name": "fields",
689
+ "tags": [
690
+ {
691
+ "text": "[\"id\", \"name\", \"email\", \"picture\"]",
692
+ "name": "example"
693
+ }
694
+ ],
695
+ "docs": "Fields to retrieve from Facebook profile",
696
+ "complexTypes": [],
697
+ "type": "string[] | undefined"
698
+ }
699
+ ]
637
700
  }
638
701
  ],
639
702
  "enums": [],
@@ -710,6 +773,43 @@
710
773
  ]
711
774
  }
712
775
  ]
776
+ },
777
+ {
778
+ "name": "ProviderSpecificCallResponseMap",
779
+ "slug": "providerspecificcallresponsemap",
780
+ "docs": "",
781
+ "types": [
782
+ {
783
+ "text": "{\n 'facebook#getProfile': FacebookGetProfileResponse;\n}",
784
+ "complexTypes": [
785
+ "FacebookGetProfileResponse"
786
+ ]
787
+ }
788
+ ]
789
+ },
790
+ {
791
+ "name": "ProviderSpecificCall",
792
+ "slug": "providerspecificcall",
793
+ "docs": "",
794
+ "types": [
795
+ {
796
+ "text": "'facebook#getProfile'",
797
+ "complexTypes": []
798
+ }
799
+ ]
800
+ },
801
+ {
802
+ "name": "ProviderSpecificCallOptionsMap",
803
+ "slug": "providerspecificcalloptionsmap",
804
+ "docs": "",
805
+ "types": [
806
+ {
807
+ "text": "{\n 'facebook#getProfile': FacebookGetProfileOptions;\n}",
808
+ "complexTypes": [
809
+ "FacebookGetProfileOptions"
810
+ ]
811
+ }
812
+ ]
713
813
  }
714
814
  ],
715
815
  "pluginConfigs": []
@@ -238,6 +238,41 @@ export interface isLoggedInOptions {
238
238
  */
239
239
  provider: 'apple' | 'google' | 'facebook';
240
240
  }
241
+ export type ProviderSpecificCall = 'facebook#getProfile';
242
+ export interface FacebookGetProfileOptions {
243
+ /**
244
+ * Fields to retrieve from Facebook profile
245
+ * @example ["id", "name", "email", "picture"]
246
+ */
247
+ fields?: string[];
248
+ }
249
+ export interface FacebookGetProfileResponse {
250
+ /**
251
+ * Facebook profile data
252
+ */
253
+ profile: {
254
+ id: string | null;
255
+ name: string | null;
256
+ email: string | null;
257
+ first_name: string | null;
258
+ last_name: string | null;
259
+ picture?: {
260
+ data: {
261
+ height: number | null;
262
+ is_silhouette: boolean | null;
263
+ url: string | null;
264
+ width: number | null;
265
+ };
266
+ } | null;
267
+ [key: string]: any;
268
+ };
269
+ }
270
+ export type ProviderSpecificCallOptionsMap = {
271
+ 'facebook#getProfile': FacebookGetProfileOptions;
272
+ };
273
+ export type ProviderSpecificCallResponseMap = {
274
+ 'facebook#getProfile': FacebookGetProfileResponse;
275
+ };
241
276
  export type ProviderResponseMap = {
242
277
  facebook: FacebookLoginResponse;
243
278
  google: GoogleLoginResponse;
@@ -283,4 +318,12 @@ export interface SocialLoginPlugin {
283
318
  * @description refresh the access token
284
319
  */
285
320
  refresh(options: LoginOptions): Promise<void>;
321
+ /**
322
+ * Execute provider-specific calls
323
+ * @description Execute a provider-specific functionality
324
+ */
325
+ providerSpecificCall<T extends ProviderSpecificCall>(options: {
326
+ call: T;
327
+ options: ProviderSpecificCallOptionsMap[T];
328
+ }): Promise<ProviderSpecificCallResponseMap[T]>;
286
329
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n facebook?: {\n /**\n * Facebook App ID, provided by Facebook for web, in mobile it's set in the native files\n */\n appId: string;\n /**\n * Facebook Client Token, provided by Facebook for web, in mobile it's set in the native files\n */\n clientToken: string;\n };\n\n google?: {\n /**\n * The app's client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSClientId?: string;\n /**\n * The app's server client ID, required for offline mode, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSServerClientId?: string;\n /**\n * The app's web client ID, found and created in the Google Developers Console.\n * For Android (and web in the future).\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n webClientId?: string;\n /**\n * The login mode, can be online or offline. In offline mode, the user will be able to login without an internet connection. It requires iOSServerClientId to be set.\n * @example offline\n * @since 3.1.0\n */\n mode?: 'online' | 'offline';\n /**\n * Filter visible accounts by hosted domain\n * @description filter visible accounts by hosted domain\n */\n hostedDomain?: string;\n /**\n * Google Redirect URL, should be your backend url that is configured in your google app\n */\n redirectUrl?: string;\n };\n apple?: {\n /**\n * Apple Client ID, provided by Apple for web and Android\n */\n clientId?: string;\n /**\n * Apple Redirect URL, should be your backend url that is configured in your apple app, only for android\n */\n redirectUrl?: string;\n };\n}\n\nexport interface FacebookLoginOptions {\n /**\n * Permissions\n * @description select permissions to login with\n */\n permissions: string[];\n /**\n * Is Limited Login\n * @description use limited login for Facebook IOS\n * @default false\n */\n limitedLogin?: boolean;\n /**\n * Nonce\n * @description A custom nonce to use for the login request\n */\n nonce?: string;\n}\n\nexport interface GoogleLoginOptions {\n /**\n * Specifies the scopes required for accessing Google APIs\n * The default is defined in the configuration.\n * @example [\"profile\", \"email\"]\n * @see [Google OAuth2 Scopes](https://developers.google.com/identity/protocols/oauth2/scopes)\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * Force refresh token (only for Android)\n * @description force refresh token\n * @default false\n */\n forceRefreshToken?: boolean;\n /**\n * Force account selection prompt (iOS)\n * @description forces the account selection prompt to appear on iOS\n * @default false\n */\n forcePrompt?: boolean;\n /**\n * Style\n * @description style\n * @default 'standard'\n */\n style?: 'bottom' | 'standard';\n}\n\nexport interface GoogleLoginResponseOnline {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n email: string | null;\n familyName: string | null;\n givenName: string | null;\n id: string | null;\n name: string | null;\n imageUrl: string | null;\n };\n responseType: 'online';\n}\n\nexport interface GoogleLoginResponseOffline {\n serverAuthCode: string;\n responseType: 'offline';\n}\n\nexport type GoogleLoginResponse = GoogleLoginResponseOnline | GoogleLoginResponseOffline;\n\nexport interface AppleProviderOptions {\n /**\n * Scopes\n * @description An array of scopes to request during login\n * @example [\"name\", \"email\"]\n * default: [\"name\", \"email\"]\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * State\n * @description state\n */\n state?: string;\n}\n\nexport interface AppleProviderResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n user: string;\n email: string | null;\n givenName: string | null;\n familyName: string | null;\n };\n}\n\nexport type LoginOptions =\n | {\n provider: 'facebook';\n options: FacebookLoginOptions;\n }\n | {\n provider: 'google';\n options: GoogleLoginOptions;\n }\n | {\n provider: 'apple';\n options: AppleProviderOptions;\n };\n\nexport type LoginResult =\n | {\n provider: 'facebook';\n result: FacebookLoginResponse;\n }\n | {\n provider: 'google';\n result: GoogleLoginResponse;\n }\n | {\n provider: 'apple';\n result: AppleProviderResponse;\n };\n\nexport interface AccessToken {\n applicationId?: string;\n declinedPermissions?: string[];\n expires?: string;\n isExpired?: boolean;\n lastRefresh?: string;\n permissions?: string[];\n token: string;\n refreshToken?: string;\n userId?: string;\n}\n\nexport interface FacebookLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n userID: string;\n email: string | null;\n friendIDs: string[];\n birthday: string | null;\n ageRange: { min?: number; max?: number } | null;\n gender: string | null;\n location: { id: string; name: string } | null;\n hometown: { id: string; name: string } | null;\n profileURL: string | null;\n name: string | null;\n imageURL: string | null;\n };\n}\n\nexport interface AuthorizationCode {\n /**\n * Jwt\n * @description A JSON web token\n */\n jwt?: string;\n /**\n * Access Token\n * @description An access token\n */\n accessToken?: string;\n}\n\nexport interface AuthorizationCodeOptions {\n /**\n * Provider\n * @description Provider for the authorization code\n */\n provider: 'apple' | 'google' | 'facebook';\n}\n\nexport interface isLoggedInOptions {\n /**\n * Provider\n * @description Provider for the isLoggedIn\n */\n provider: 'apple' | 'google' | 'facebook';\n}\n\n// Add a helper type to map providers to their response types\nexport type ProviderResponseMap = {\n facebook: FacebookLoginResponse;\n google: GoogleLoginResponse;\n apple: AppleProviderResponse;\n};\n\nexport interface SocialLoginPlugin {\n /**\n * Initialize the plugin\n * @description initialize the plugin with the required options\n */\n initialize(options: InitializeOptions): Promise<void>;\n /**\n * Login with the selected provider\n * @description login with the selected provider\n */\n login<T extends LoginOptions['provider']>(\n options: Extract<LoginOptions, { provider: T }>,\n ): Promise<{ provider: T; result: ProviderResponseMap[T] }>;\n /**\n * Logout\n * @description logout the user\n */\n logout(options: { provider: 'apple' | 'google' | 'facebook' }): Promise<void>;\n /**\n * IsLoggedIn\n * @description logout the user\n */\n isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }>;\n\n /**\n * Get the current access token\n * @description get the current access token\n */\n getAuthorizationCode(options: AuthorizationCodeOptions): Promise<AuthorizationCode>;\n /**\n * Refresh the access token\n * @description refresh the access token\n */\n refresh(options: LoginOptions): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n facebook?: {\n /**\n * Facebook App ID, provided by Facebook for web, in mobile it's set in the native files\n */\n appId: string;\n /**\n * Facebook Client Token, provided by Facebook for web, in mobile it's set in the native files\n */\n clientToken: string;\n };\n\n google?: {\n /**\n * The app's client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSClientId?: string;\n /**\n * The app's server client ID, required for offline mode, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSServerClientId?: string;\n /**\n * The app's web client ID, found and created in the Google Developers Console.\n * For Android (and web in the future).\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n webClientId?: string;\n /**\n * The login mode, can be online or offline. In offline mode, the user will be able to login without an internet connection. It requires iOSServerClientId to be set.\n * @example offline\n * @since 3.1.0\n */\n mode?: 'online' | 'offline';\n /**\n * Filter visible accounts by hosted domain\n * @description filter visible accounts by hosted domain\n */\n hostedDomain?: string;\n /**\n * Google Redirect URL, should be your backend url that is configured in your google app\n */\n redirectUrl?: string;\n };\n apple?: {\n /**\n * Apple Client ID, provided by Apple for web and Android\n */\n clientId?: string;\n /**\n * Apple Redirect URL, should be your backend url that is configured in your apple app, only for android\n */\n redirectUrl?: string;\n };\n}\n\nexport interface FacebookLoginOptions {\n /**\n * Permissions\n * @description select permissions to login with\n */\n permissions: string[];\n /**\n * Is Limited Login\n * @description use limited login for Facebook IOS\n * @default false\n */\n limitedLogin?: boolean;\n /**\n * Nonce\n * @description A custom nonce to use for the login request\n */\n nonce?: string;\n}\n\nexport interface GoogleLoginOptions {\n /**\n * Specifies the scopes required for accessing Google APIs\n * The default is defined in the configuration.\n * @example [\"profile\", \"email\"]\n * @see [Google OAuth2 Scopes](https://developers.google.com/identity/protocols/oauth2/scopes)\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * Force refresh token (only for Android)\n * @description force refresh token\n * @default false\n */\n forceRefreshToken?: boolean;\n /**\n * Force account selection prompt (iOS)\n * @description forces the account selection prompt to appear on iOS\n * @default false\n */\n forcePrompt?: boolean;\n /**\n * Style\n * @description style\n * @default 'standard'\n */\n style?: 'bottom' | 'standard';\n}\n\nexport interface GoogleLoginResponseOnline {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n email: string | null;\n familyName: string | null;\n givenName: string | null;\n id: string | null;\n name: string | null;\n imageUrl: string | null;\n };\n responseType: 'online';\n}\n\nexport interface GoogleLoginResponseOffline {\n serverAuthCode: string;\n responseType: 'offline';\n}\n\nexport type GoogleLoginResponse = GoogleLoginResponseOnline | GoogleLoginResponseOffline;\n\nexport interface AppleProviderOptions {\n /**\n * Scopes\n * @description An array of scopes to request during login\n * @example [\"name\", \"email\"]\n * default: [\"name\", \"email\"]\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * State\n * @description state\n */\n state?: string;\n}\n\nexport interface AppleProviderResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n user: string;\n email: string | null;\n givenName: string | null;\n familyName: string | null;\n };\n}\n\nexport type LoginOptions =\n | {\n provider: 'facebook';\n options: FacebookLoginOptions;\n }\n | {\n provider: 'google';\n options: GoogleLoginOptions;\n }\n | {\n provider: 'apple';\n options: AppleProviderOptions;\n };\n\nexport type LoginResult =\n | {\n provider: 'facebook';\n result: FacebookLoginResponse;\n }\n | {\n provider: 'google';\n result: GoogleLoginResponse;\n }\n | {\n provider: 'apple';\n result: AppleProviderResponse;\n };\n\nexport interface AccessToken {\n applicationId?: string;\n declinedPermissions?: string[];\n expires?: string;\n isExpired?: boolean;\n lastRefresh?: string;\n permissions?: string[];\n token: string;\n refreshToken?: string;\n userId?: string;\n}\n\nexport interface FacebookLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n userID: string;\n email: string | null;\n friendIDs: string[];\n birthday: string | null;\n ageRange: { min?: number; max?: number } | null;\n gender: string | null;\n location: { id: string; name: string } | null;\n hometown: { id: string; name: string } | null;\n profileURL: string | null;\n name: string | null;\n imageURL: string | null;\n };\n}\n\nexport interface AuthorizationCode {\n /**\n * Jwt\n * @description A JSON web token\n */\n jwt?: string;\n /**\n * Access Token\n * @description An access token\n */\n accessToken?: string;\n}\n\nexport interface AuthorizationCodeOptions {\n /**\n * Provider\n * @description Provider for the authorization code\n */\n provider: 'apple' | 'google' | 'facebook';\n}\n\nexport interface isLoggedInOptions {\n /**\n * Provider\n * @description Provider for the isLoggedIn\n */\n provider: 'apple' | 'google' | 'facebook';\n}\n\n// Define the provider-specific call types\nexport type ProviderSpecificCall = 'facebook#getProfile';\n\n// Define the options and response types for each specific call\nexport interface FacebookGetProfileOptions {\n /**\n * Fields to retrieve from Facebook profile\n * @example [\"id\", \"name\", \"email\", \"picture\"]\n */\n fields?: string[];\n}\n\nexport interface FacebookGetProfileResponse {\n /**\n * Facebook profile data\n */\n profile: {\n id: string | null;\n name: string | null;\n email: string | null;\n first_name: string | null;\n last_name: string | null;\n picture?: {\n data: {\n height: number | null;\n is_silhouette: boolean | null;\n url: string | null;\n width: number | null;\n };\n } | null;\n [key: string]: any; // For additional fields that might be requested\n };\n}\n\n// Map call strings to their options and response types\nexport type ProviderSpecificCallOptionsMap = {\n 'facebook#getProfile': FacebookGetProfileOptions;\n};\n\nexport type ProviderSpecificCallResponseMap = {\n 'facebook#getProfile': FacebookGetProfileResponse;\n};\n\n// Add a helper type to map providers to their response types\nexport type ProviderResponseMap = {\n facebook: FacebookLoginResponse;\n google: GoogleLoginResponse;\n apple: AppleProviderResponse;\n};\n\nexport interface SocialLoginPlugin {\n /**\n * Initialize the plugin\n * @description initialize the plugin with the required options\n */\n initialize(options: InitializeOptions): Promise<void>;\n /**\n * Login with the selected provider\n * @description login with the selected provider\n */\n login<T extends LoginOptions['provider']>(\n options: Extract<LoginOptions, { provider: T }>,\n ): Promise<{ provider: T; result: ProviderResponseMap[T] }>;\n /**\n * Logout\n * @description logout the user\n */\n logout(options: { provider: 'apple' | 'google' | 'facebook' }): Promise<void>;\n /**\n * IsLoggedIn\n * @description logout the user\n */\n isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }>;\n\n /**\n * Get the current access token\n * @description get the current access token\n */\n getAuthorizationCode(options: AuthorizationCodeOptions): Promise<AuthorizationCode>;\n /**\n * Refresh the access token\n * @description refresh the access token\n */\n refresh(options: LoginOptions): Promise<void>;\n\n /**\n * Execute provider-specific calls\n * @description Execute a provider-specific functionality\n */\n providerSpecificCall<T extends ProviderSpecificCall>(options: {\n call: T;\n options: ProviderSpecificCallOptionsMap[T];\n }): Promise<ProviderSpecificCallResponseMap[T]>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { SocialLoginPlugin, InitializeOptions, LoginOptions, AuthorizationCode, AuthorizationCodeOptions, isLoggedInOptions, ProviderResponseMap } from './definitions';
2
+ import type { SocialLoginPlugin, InitializeOptions, LoginOptions, AuthorizationCode, AuthorizationCodeOptions, isLoggedInOptions, ProviderResponseMap, ProviderSpecificCall, ProviderSpecificCallOptionsMap, ProviderSpecificCallResponseMap } from './definitions';
3
3
  export declare class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {
4
4
  private static readonly OAUTH_STATE_KEY;
5
5
  private googleProvider;
@@ -22,4 +22,8 @@ export declare class SocialLoginWeb extends WebPlugin implements SocialLoginPlug
22
22
  }>;
23
23
  getAuthorizationCode(options: AuthorizationCodeOptions): Promise<AuthorizationCode>;
24
24
  refresh(options: LoginOptions): Promise<void>;
25
+ providerSpecificCall<T extends ProviderSpecificCall>(options: {
26
+ call: T;
27
+ options: ProviderSpecificCallOptionsMap[T];
28
+ }): Promise<ProviderSpecificCallResponseMap[T]>;
25
29
  }
package/dist/esm/web.js CHANGED
@@ -97,6 +97,9 @@ export class SocialLoginWeb extends WebPlugin {
97
97
  throw new Error(`Refresh for ${options.provider} is not implemented`);
98
98
  }
99
99
  }
100
+ async providerSpecificCall(options) {
101
+ throw new Error(`Provider specific call for ${options.call} is not implemented`);
102
+ }
100
103
  }
101
104
  SocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';
102
105
  //# 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;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAWpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,OAAO,cAAe,SAAQ,SAAS;IAO3C;;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAElD,sEAAsE;QACtE,IAAI,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACrC,MAAM,MAAM,GAAG,IAAI,CAAC,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C,gBAAgB,CAAC,UAAU,EAAE,CAAC;YAC5C;gBACE,MAAM,IAAI,KAAK,CAAC,kBAAkB,OAAO,CAAC,QAAQ,qBAAqB,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,OAAiC;QAC1D,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;YACpD,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE,CAAC;YACnD,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;YACtD;gBACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,CAAC,QAAQ,qBAAqB,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YACvC,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YACtC,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAA+B,CAAC,CAAC;YAChF;gBACE,MAAM,IAAI,KAAK,CAAC,eAAgB,OAAe,CAAC,QAAQ,qBAAqB,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;;AAhIuB,8BAAe,GAAG,4BAA4B,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport { AppleSocialLogin } from './apple-provider';\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n AuthorizationCode,\n AuthorizationCodeOptions,\n isLoggedInOptions,\n ProviderResponseMap,\n FacebookLoginOptions,\n} from './definitions';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private static readonly OAUTH_STATE_KEY = 'social_login_oauth_pending';\n\n private googleProvider: GoogleSocialLogin;\n private appleProvider: AppleSocialLogin;\n private facebookProvider: FacebookSocialLogin;\n\n constructor() {\n super();\n\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n window.opener?.postMessage(\n {\n type: 'oauth-response',\n ...result.result,\n },\n window.location.origin,\n );\n window.close();\n }\n }\n }\n\n private handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n\n async initialize(options: InitializeOptions): Promise<void> {\n const initPromises: Promise<void>[] = [];\n\n if (options.google?.webClientId) {\n initPromises.push(\n this.googleProvider.initialize(\n options.google.webClientId,\n options.google.mode,\n options.google.hostedDomain,\n options.google.redirectUrl,\n ),\n );\n }\n\n if (options.apple?.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl));\n }\n\n if (options.facebook?.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId));\n }\n\n await Promise.all(initPromises);\n }\n\n async login<T extends LoginOptions['provider']>(\n options: Extract<LoginOptions, { provider: T }>,\n ): Promise<{ provider: T; result: ProviderResponseMap[T] }> {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options) as Promise<{ provider: T; result: ProviderResponseMap[T] }>;\n case 'apple':\n return this.appleProvider.login(options.options) as Promise<{ provider: T; result: ProviderResponseMap[T] }>;\n case 'facebook':\n return this.facebookProvider.login(options.options as FacebookLoginOptions) as Promise<{\n provider: T;\n result: ProviderResponseMap[T];\n }>;\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n\n async logout(options: { provider: 'apple' | 'google' | 'facebook' }): Promise<void> {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options as FacebookLoginOptions);\n default:\n throw new Error(`Refresh for ${(options as any).provider} is not implemented`);\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;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,OAAO,cAAe,SAAQ,SAAS;IAO3C;;QACE,KAAK,EAAE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AAC,CAAC;YAChF;gBACE,MAAM,IAAI,KAAK,CAAC,eAAgB,OAAe,CAAC,QAAQ,qBAAqB,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAiC,OAG1D;QACC,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,CAAC,IAAI,qBAAqB,CAAC,CAAC;IACnF,CAAC;;AAvIuB,8BAAe,GAAG,4BAA4B,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport { AppleSocialLogin } from './apple-provider';\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n AuthorizationCode,\n AuthorizationCodeOptions,\n isLoggedInOptions,\n ProviderResponseMap,\n FacebookLoginOptions,\n ProviderSpecificCall,\n ProviderSpecificCallOptionsMap,\n ProviderSpecificCallResponseMap,\n} from './definitions';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private static readonly OAUTH_STATE_KEY = 'social_login_oauth_pending';\n\n private googleProvider: GoogleSocialLogin;\n private appleProvider: AppleSocialLogin;\n private facebookProvider: FacebookSocialLogin;\n\n constructor() {\n super();\n\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n window.opener?.postMessage(\n {\n type: 'oauth-response',\n ...result.result,\n },\n window.location.origin,\n );\n window.close();\n }\n }\n }\n\n private handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n\n async initialize(options: InitializeOptions): Promise<void> {\n const initPromises: Promise<void>[] = [];\n\n if (options.google?.webClientId) {\n initPromises.push(\n this.googleProvider.initialize(\n options.google.webClientId,\n options.google.mode,\n options.google.hostedDomain,\n options.google.redirectUrl,\n ),\n );\n }\n\n if (options.apple?.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl));\n }\n\n if (options.facebook?.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId));\n }\n\n await Promise.all(initPromises);\n }\n\n async login<T extends LoginOptions['provider']>(\n options: Extract<LoginOptions, { provider: T }>,\n ): Promise<{ provider: T; result: ProviderResponseMap[T] }> {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options) as Promise<{ provider: T; result: ProviderResponseMap[T] }>;\n case 'apple':\n return this.appleProvider.login(options.options) as Promise<{ provider: T; result: ProviderResponseMap[T] }>;\n case 'facebook':\n return this.facebookProvider.login(options.options as FacebookLoginOptions) as Promise<{\n provider: T;\n result: ProviderResponseMap[T];\n }>;\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n\n async logout(options: { provider: 'apple' | 'google' | 'facebook' }): Promise<void> {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options as FacebookLoginOptions);\n default:\n throw new Error(`Refresh for ${(options as any).provider} is not implemented`);\n }\n }\n\n async providerSpecificCall<T extends ProviderSpecificCall>(options: {\n call: T;\n options: ProviderSpecificCallOptionsMap[T];\n }): Promise<ProviderSpecificCallResponseMap[T]> {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n}\n"]}
@@ -661,6 +661,9 @@ class SocialLoginWeb extends core.WebPlugin {
661
661
  throw new Error(`Refresh for ${options.provider} is not implemented`);
662
662
  }
663
663
  }
664
+ async providerSpecificCall(options) {
665
+ throw new Error(`Provider specific call for ${options.call} is not implemented`);
666
+ }
664
667
  }
665
668
  SocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';
666
669
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64)\n .split('')\n .map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(''));\n return JSON.parse(jsonPayload);\n }\n async loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n }\n async initialize(clientId, redirectUrl) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\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.clientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: this.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e;\n const result = {\n profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n },\n accessToken: {\n token: res.authorization.id_token || '',\n },\n idToken: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n }\n async initialize(appId) {\n this.appId = appId;\n if (appId) {\n await this.loadFacebookScript();\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\n throw new Error('Facebook App ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: 'facebook', result });\n });\n }\n else {\n reject(new Error('Facebook login failed'));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n async logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });\n }\n else {\n reject(new Error('No Facebook authorization code available'));\n }\n });\n });\n }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript('https://connect.facebook.net/en_US/sdk.js').then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, }) {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE;AACf;AACA,IAAI,QAAQ,CAAC,KAAK,EAAE;AACpB,QAAQ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,QAAQ,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAA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CAAC,oBAAoB,EAAE;AACjE,YAAY,KAAK,OAAO;AACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;AAChE,YAAY,KAAK,UAAU;AAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE;AACnE,YAAY;AACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,yBAAyB,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAClG;AACA;AACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;AAC3B,QAAQ,QAAQ,OAAO,CAAC,QAAQ;AAChC,YAAY,KAAK,QAAQ;AACzB,gBAAgB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACpD,YAAY,KAAK,OAAO;AACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;AACnD,YAAY,KAAK,UAAU;AAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AACrE,YAAY;AACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACrF;AACA;AACA;AACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64)\n .split('')\n .map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(''));\n return JSON.parse(jsonPayload);\n }\n async loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n }\n async initialize(clientId, redirectUrl) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\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.clientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: this.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e;\n const result = {\n profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n },\n accessToken: {\n token: res.authorization.id_token || '',\n },\n idToken: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n }\n async initialize(appId) {\n this.appId = appId;\n if (appId) {\n await this.loadFacebookScript();\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\n throw new Error('Facebook App ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: 'facebook', result });\n });\n }\n else {\n reject(new Error('Facebook login failed'));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n async logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });\n }\n else {\n reject(new Error('No Facebook authorization code available'));\n }\n });\n });\n }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript('https://connect.facebook.net/en_US/sdk.js').then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, }) {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async providerSpecificCall(options) {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,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AAmB,CAAC,CAAC;AACxF;AACA;AACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -660,6 +660,9 @@ var capacitorCapacitorUpdater = (function (exports, core) {
660
660
  throw new Error(`Refresh for ${options.provider} is not implemented`);
661
661
  }
662
662
  }
663
+ async providerSpecificCall(options) {
664
+ throw new Error(`Provider specific call for ${options.call} is not implemented`);
665
+ }
663
666
  }
664
667
  SocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';
665
668
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64)\n .split('')\n .map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(''));\n return JSON.parse(jsonPayload);\n }\n async loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n }\n async initialize(clientId, redirectUrl) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\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.clientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: this.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e;\n const result = {\n profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n },\n accessToken: {\n token: res.authorization.id_token || '',\n },\n idToken: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n }\n async initialize(appId) {\n this.appId = appId;\n if (appId) {\n await this.loadFacebookScript();\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\n throw new Error('Facebook App ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: 'facebook', result });\n });\n }\n else {\n reject(new Error('Facebook login failed'));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n async logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });\n }\n else {\n reject(new Error('No Facebook authorization code available'));\n }\n });\n });\n }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript('https://connect.facebook.net/en_US/sdk.js').then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, }) {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf;IACA,IAAI,QAAQ,CAAC,KAAK,EAAE;IACpB,QAAQ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7C,QAAQ,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;IACtE,QAAQ,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM;IAC1D,aAAa,KAAK,CAAC,EAAE;IACrB,aAAa,GAAG,CAAC,CAAC,CAAC,KAAK;IACxB,YAAY,OAAO,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAA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B,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAClG;IACA;IACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;IAC3B,QAAQ,QAAQ,OAAO,CAAC,QAAQ;IAChC,YAAY,KAAK,QAAQ;IACzB,gBAAgB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;IACpD,YAAY,KAAK,OAAO;IACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;IACnD,YAAY,KAAK,UAAU;IAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;IACrE,YAAY;IACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IACrF;IACA;IACA;IACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\n }\n parseJwt(token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const jsonPayload = decodeURIComponent(atob(base64)\n .split('')\n .map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(''));\n return JSON.parse(jsonPayload);\n }\n async loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n }\n async initialize(clientId, redirectUrl) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\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.clientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: this.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e;\n const result = {\n profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n },\n accessToken: {\n token: res.authorization.id_token || '',\n },\n idToken: res.authorization.code || null,\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n }\n async initialize(appId) {\n this.appId = appId;\n if (appId) {\n await this.loadFacebookScript();\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\n throw new Error('Facebook App ID not set. Call initialize() first.');\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: 'facebook', result });\n });\n }\n else {\n reject(new Error('Facebook login failed'));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n async logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });\n }\n else {\n reject(new Error('No Facebook authorization code available'));\n }\n });\n });\n }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript('https://connect.facebook.net/en_US/sdk.js').then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, }) {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async providerSpecificCall(options) {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf;IACA,IAAI,QAAQ,CAAC,KAAK,EAAE;IACpB,QAAQ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7C,QAAQ,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,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YAAY,KAAK,QAAQ;IACzB,gBAAgB,OAAO,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE;IACjE,YAAY,KAAK,OAAO;IACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;IAChE,YAAY,KAAK,UAAU;IAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE;IACnE,YAAY;IACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,yBAAyB,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAClG;IACA;IACA,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;IAC3B,QAAQ,QAAQ,OAAO,CAAC,QAAQ;IAChC,YAAY,KAAK,QAAQ;IACzB,gBAAgB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;IACpD,YAAY,KAAK,OAAO;IACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;IACnD,YAAY,KAAK,UAAU;IAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;IACrE,YAAY;IACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IACrF;IACA;IACA,IAAI,MAAM,oBAAoB,CAAC,OAAO,EAAE;IACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,2BAA2B,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACxF;IACA;IACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;;;;;;;"}
@@ -32,6 +32,34 @@ class FacebookProvider {
32
32
  // No initialization required for FacebookProvider
33
33
  }
34
34
 
35
+ func getProfile(fields: [String], completion: @escaping (Result<[String: Any]?, Error>) -> Void) {
36
+ guard let accessToken = AccessToken.current else {
37
+ completion(.failure(NSError(domain: "FacebookProvider", code: 0, userInfo: [NSLocalizedDescriptionKey: "You're not logged in. Please login first to obtain an access token and try again."])))
38
+ return
39
+ }
40
+
41
+ if accessToken.isExpired {
42
+ completion(.failure(NSError(domain: "FacebookProvider", code: 1, userInfo: [NSLocalizedDescriptionKey: "AccessToken is expired"])))
43
+ return
44
+ }
45
+
46
+ let parameters = ["fields": fields.joined(separator: ",")]
47
+ let graphRequest = GraphRequest.init(graphPath: "me", parameters: parameters)
48
+
49
+ graphRequest.start { (_ connection, _ result, _ error) in
50
+ if let error = error {
51
+ completion(.failure(error))
52
+ return
53
+ }
54
+
55
+ return completion(.success(result as? [String: Any]))
56
+ }
57
+ }
58
+
59
+ func isLoggedIn() -> Bool {
60
+ return AccessToken.current != nil
61
+ }
62
+
35
63
  func login(payload: [String: Any], completion: @escaping (Result<FacebookLoginResponse, Error>) -> Void) {
36
64
  guard let permissions = payload["permissions"] as? [String] else {
37
65
  completion(.failure(NSError(domain: "FacebookProvider", code: 0, userInfo: [NSLocalizedDescriptionKey: "Missing permissions"])))
@@ -16,8 +16,8 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
16
16
  CAPPluginMethod(name: "getAuthorizationCode", returnType: CAPPluginReturnPromise),
17
17
  CAPPluginMethod(name: "getUserInfo", returnType: CAPPluginReturnPromise),
18
18
  CAPPluginMethod(name: "initialize", returnType: CAPPluginReturnPromise),
19
- CAPPluginMethod(name: "refresh", returnType: CAPPluginReturnPromise)
20
-
19
+ CAPPluginMethod(name: "refresh", returnType: CAPPluginReturnPromise),
20
+ CAPPluginMethod(name: "providerSpecificCall", returnType: CAPPluginReturnPromise)
21
21
  ]
22
22
  private let apple = AppleProvider()
23
23
  private let facebook = FacebookProvider()
@@ -136,6 +136,10 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
136
136
  }
137
137
  }
138
138
  }
139
+ case "facebook": do {
140
+ call.resolve([ "isLoggedIn": self.facebook.isLoggedIn() ])
141
+
142
+ }
139
143
  default:
140
144
  call.reject("Invalid provider")
141
145
  }
@@ -166,6 +170,35 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
166
170
  }
167
171
  }
168
172
 
173
+ @objc func providerSpecificCall(_ call: CAPPluginCall) {
174
+ guard let customCall = call.getString("call") else {
175
+ call.reject("Call is required")
176
+ return
177
+ }
178
+ switch customCall {
179
+ case "facebook#getProfile":
180
+ guard let options = call.getObject("options") else {
181
+ call.reject("options are required")
182
+ return
183
+ }
184
+ guard let fields = options["fields"] as? [String] else {
185
+ call.reject("options are required")
186
+ return
187
+ }
188
+
189
+ facebook.getProfile(fields: fields, completion: { res in
190
+ switch res {
191
+ case .success(let profile):
192
+ call.resolve(["profile": profile as Any])
193
+ case .failure(let error):
194
+ call.reject(error.localizedDescription)
195
+ }
196
+ })
197
+ default:
198
+ call.reject("Invalid call. Supported calls: facebook#getProfile")
199
+ }
200
+ }
201
+
169
202
  @objc func logout(_ call: CAPPluginCall) {
170
203
  guard let provider = call.getString("provider") else {
171
204
  call.reject("Missing provider")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "7.5.9",
3
+ "version": "7.6.4",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",