@capgo/capacitor-social-login 7.6.7 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -363,7 +363,7 @@ Refresh the access token
363
363
  ### providerSpecificCall(...)
364
364
 
365
365
  ```typescript
366
- providerSpecificCall<T extends "facebook#getProfile">(options: { call: T; options: ProviderSpecificCallOptionsMap[T]; }) => Promise<ProviderSpecificCallResponseMap[T]>
366
+ providerSpecificCall<T extends ProviderSpecificCall>(options: { call: T; options: ProviderSpecificCallOptionsMap[T]; }) => Promise<ProviderSpecificCallResponseMap[T]>
367
367
  ```
368
368
 
369
369
  Execute provider-specific calls
@@ -498,6 +498,13 @@ Execute provider-specific calls
498
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
499
 
500
500
 
501
+ #### FacebookRequestTrackingResponse
502
+
503
+ | Prop | Type | Description |
504
+ | ------------ | ------------------------------------------------------------------------ | --------------------------------- |
505
+ | **`status`** | <code>'authorized' \| 'denied' \| 'notDetermined' \| 'restricted'</code> | App tracking authorization status |
506
+
507
+
501
508
  #### FacebookGetProfileOptions
502
509
 
503
510
  | Prop | Type | Description |
@@ -532,17 +539,29 @@ Execute provider-specific calls
532
539
 
533
540
  #### ProviderSpecificCallResponseMap
534
541
 
535
- <code>{ 'facebook#getProfile': <a href="#facebookgetprofileresponse">FacebookGetProfileResponse</a>; }</code>
542
+ <code>{ 'facebook#getProfile': <a href="#facebookgetprofileresponse">FacebookGetProfileResponse</a>; 'facebook#requestTracking': <a href="#facebookrequesttrackingresponse">FacebookRequestTrackingResponse</a>; }</code>
536
543
 
537
544
 
538
545
  #### ProviderSpecificCall
539
546
 
540
- <code>'facebook#getProfile'</code>
547
+ <code>'facebook#getProfile' | 'facebook#requestTracking'</code>
541
548
 
542
549
 
543
550
  #### ProviderSpecificCallOptionsMap
544
551
 
545
- <code>{ 'facebook#getProfile': <a href="#facebookgetprofileoptions">FacebookGetProfileOptions</a>; }</code>
552
+ <code>{ 'facebook#getProfile': <a href="#facebookgetprofileoptions">FacebookGetProfileOptions</a>; 'facebook#requestTracking': <a href="#facebookrequesttrackingoptions">FacebookRequestTrackingOptions</a>; }</code>
553
+
554
+
555
+ #### FacebookRequestTrackingOptions
556
+
557
+ <code><a href="#record">Record</a>&lt;string, never&gt;</code>
558
+
559
+
560
+ #### Record
561
+
562
+ Construct a type with a set of properties K of type T
563
+
564
+ <code>{
546
565
  [P in K]: T;
547
566
  }</code>
548
567
 
549
568
  </docgen-api>
550
569
 
package/dist/docs.json CHANGED
@@ -147,7 +147,7 @@
147
147
  },
148
148
  {
149
149
  "name": "providerSpecificCall",
150
- "signature": "<T extends \"facebook#getProfile\">(options: { call: T; options: ProviderSpecificCallOptionsMap[T]; }) => Promise<ProviderSpecificCallResponseMap[T]>",
150
+ "signature": "<T extends ProviderSpecificCall>(options: { call: T; options: ProviderSpecificCallOptionsMap[T]; }) => Promise<ProviderSpecificCallResponseMap[T]>",
151
151
  "parameters": [
152
152
  {
153
153
  "name": "options",
@@ -677,6 +677,22 @@
677
677
  }
678
678
  ]
679
679
  },
680
+ {
681
+ "name": "FacebookRequestTrackingResponse",
682
+ "slug": "facebookrequesttrackingresponse",
683
+ "docs": "",
684
+ "tags": [],
685
+ "methods": [],
686
+ "properties": [
687
+ {
688
+ "name": "status",
689
+ "tags": [],
690
+ "docs": "App tracking authorization status",
691
+ "complexTypes": [],
692
+ "type": "'authorized' | 'denied' | 'notDetermined' | 'restricted'"
693
+ }
694
+ ]
695
+ },
680
696
  {
681
697
  "name": "FacebookGetProfileOptions",
682
698
  "slug": "facebookgetprofileoptions",
@@ -780,9 +796,10 @@
780
796
  "docs": "",
781
797
  "types": [
782
798
  {
783
- "text": "{\n 'facebook#getProfile': FacebookGetProfileResponse;\n}",
799
+ "text": "{\n 'facebook#getProfile': FacebookGetProfileResponse;\n 'facebook#requestTracking': FacebookRequestTrackingResponse;\n}",
784
800
  "complexTypes": [
785
- "FacebookGetProfileResponse"
801
+ "FacebookGetProfileResponse",
802
+ "FacebookRequestTrackingResponse"
786
803
  ]
787
804
  }
788
805
  ]
@@ -795,6 +812,10 @@
795
812
  {
796
813
  "text": "'facebook#getProfile'",
797
814
  "complexTypes": []
815
+ },
816
+ {
817
+ "text": "'facebook#requestTracking'",
818
+ "complexTypes": []
798
819
  }
799
820
  ]
800
821
  },
@@ -804,9 +825,37 @@
804
825
  "docs": "",
805
826
  "types": [
806
827
  {
807
- "text": "{\n 'facebook#getProfile': FacebookGetProfileOptions;\n}",
828
+ "text": "{\n 'facebook#getProfile': FacebookGetProfileOptions;\n 'facebook#requestTracking': FacebookRequestTrackingOptions;\n}",
829
+ "complexTypes": [
830
+ "FacebookGetProfileOptions",
831
+ "FacebookRequestTrackingOptions"
832
+ ]
833
+ }
834
+ ]
835
+ },
836
+ {
837
+ "name": "FacebookRequestTrackingOptions",
838
+ "slug": "facebookrequesttrackingoptions",
839
+ "docs": "",
840
+ "types": [
841
+ {
842
+ "text": "Record<string, never>",
843
+ "complexTypes": [
844
+ "Record"
845
+ ]
846
+ }
847
+ ]
848
+ },
849
+ {
850
+ "name": "Record",
851
+ "slug": "record",
852
+ "docs": "Construct a type with a set of properties K of type T",
853
+ "types": [
854
+ {
855
+ "text": "{\r\n [P in K]: T;\r\n}",
808
856
  "complexTypes": [
809
- "FacebookGetProfileOptions"
857
+ "K",
858
+ "T"
810
859
  ]
811
860
  }
812
861
  ]
@@ -238,7 +238,7 @@ export interface isLoggedInOptions {
238
238
  */
239
239
  provider: 'apple' | 'google' | 'facebook';
240
240
  }
241
- export type ProviderSpecificCall = 'facebook#getProfile';
241
+ export type ProviderSpecificCall = 'facebook#getProfile' | 'facebook#requestTracking';
242
242
  export interface FacebookGetProfileOptions {
243
243
  /**
244
244
  * Fields to retrieve from Facebook profile
@@ -267,11 +267,20 @@ export interface FacebookGetProfileResponse {
267
267
  [key: string]: any;
268
268
  };
269
269
  }
270
+ export type FacebookRequestTrackingOptions = Record<string, never>;
271
+ export interface FacebookRequestTrackingResponse {
272
+ /**
273
+ * App tracking authorization status
274
+ */
275
+ status: 'authorized' | 'denied' | 'notDetermined' | 'restricted';
276
+ }
270
277
  export type ProviderSpecificCallOptionsMap = {
271
278
  'facebook#getProfile': FacebookGetProfileOptions;
279
+ 'facebook#requestTracking': FacebookRequestTrackingOptions;
272
280
  };
273
281
  export type ProviderSpecificCallResponseMap = {
274
282
  'facebook#getProfile': FacebookGetProfileResponse;
283
+ 'facebook#requestTracking': FacebookRequestTrackingResponse;
275
284
  };
276
285
  export type ProviderResponseMap = {
277
286
  facebook: FacebookLoginResponse;
@@ -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// 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"]}
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' | 'facebook#requestTracking';\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\nexport type FacebookRequestTrackingOptions = Record<string, never>;\n\nexport interface FacebookRequestTrackingResponse {\n /**\n * App tracking authorization status\n */\n status: 'authorized' | 'denied' | 'notDetermined' | 'restricted';\n}\n\n// Map call strings to their options and response types\nexport type ProviderSpecificCallOptionsMap = {\n 'facebook#getProfile': FacebookGetProfileOptions;\n 'facebook#requestTracking': FacebookRequestTrackingOptions;\n};\n\nexport type ProviderSpecificCallResponseMap = {\n 'facebook#getProfile': FacebookGetProfileResponse;\n 'facebook#requestTracking': FacebookRequestTrackingResponse;\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"]}
@@ -6,6 +6,10 @@ import FBSDKLoginKit
6
6
  import FacebookLogin
7
7
  #endif
8
8
 
9
+ #if canImport(AppTrackingTransparency)
10
+ import AppTrackingTransparency
11
+ #endif
12
+
9
13
  struct FacebookLoginResponse {
10
14
  let accessToken: [String: Any]
11
15
  let profile: [String: Any]
@@ -166,6 +170,35 @@ class FacebookProvider {
166
170
  }
167
171
  }
168
172
 
173
+ func requestTracking(completion: @escaping (Result<String, Error>) -> Void) {
174
+ #if canImport(AppTrackingTransparency)
175
+ if #available(iOS 14, *) {
176
+ DispatchQueue.main.async {
177
+ ATTrackingManager.requestTrackingAuthorization { status in
178
+ let statusString: String
179
+ switch status {
180
+ case .authorized:
181
+ statusString = "authorized"
182
+ case .denied:
183
+ statusString = "denied"
184
+ case .notDetermined:
185
+ statusString = "notDetermined"
186
+ case .restricted:
187
+ statusString = "restricted"
188
+ @unknown default:
189
+ statusString = "notDetermined"
190
+ }
191
+ completion(.success(statusString))
192
+ }
193
+ }
194
+ } else {
195
+ completion(.success("notDetermined"))
196
+ }
197
+ #else
198
+ completion(.success("notDetermined"))
199
+ #endif
200
+ }
201
+
169
202
  func refresh(viewController: UIViewController?, completion: @escaping (Result<SocialLoginUser, Error>) -> Void) {
170
203
  DispatchQueue.main.async {
171
204
  if let token = AccessToken.current, !token.isExpired, !token.isDataAccessExpired {
@@ -31,6 +31,11 @@ class GoogleProvider {
31
31
  } else {
32
32
  self.forceAuthCode = false
33
33
  }
34
+ // if nonce reject login as we need v9 to release to work
35
+ if let nonce = payload["nonce"] as? String {
36
+ completion(.failure(NSError(domain: "GoogleProvider", code: 0, userInfo: [NSLocalizedDescriptionKey: "Nonce is not supported in this version of the SDK, when V9 will be release it will work https://github.com/google/GoogleSignIn-iOS/tags"])))
37
+ return
38
+ }
34
39
 
35
40
  func login() {
36
41
  guard let presentingVc = UIApplication.shared.windows.first?.rootViewController else {
@@ -194,8 +194,17 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
194
194
  call.reject(error.localizedDescription)
195
195
  }
196
196
  })
197
+ case "facebook#requestTracking":
198
+ facebook.requestTracking(completion: { res in
199
+ switch res {
200
+ case .success(let status):
201
+ call.resolve(["status": status])
202
+ case .failure(let error):
203
+ call.reject(error.localizedDescription)
204
+ }
205
+ })
197
206
  default:
198
- call.reject("Invalid call. Supported calls: facebook#getProfile")
207
+ call.reject("Invalid call. Supported calls: facebook#getProfile, facebook#requestTracking")
199
208
  }
200
209
  }
201
210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "7.6.7",
3
+ "version": "7.7.0",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",