@capgo/capacitor-social-login 8.5.0 → 8.5.2

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/dist/plugin.js CHANGED
@@ -2362,6 +2362,39 @@ var capacitorCapacitorUpdater = (function (exports, core) {
2362
2362
  async refresh(options) {
2363
2363
  await this.login(options);
2364
2364
  }
2365
+ async getProfile(fields) {
2366
+ if (!this.appId) {
2367
+ throw new Error('Facebook App ID not set. Call initialize() first.');
2368
+ }
2369
+ const requestedFields = Array.isArray(fields) && fields.length > 0 ? fields : ['id', 'name', 'email', 'picture'];
2370
+ return new Promise((resolve, reject) => {
2371
+ FB.getLoginStatus((statusResponse) => {
2372
+ if (statusResponse.status !== 'connected') {
2373
+ reject(new Error('User is not logged in. Call login() before fetching profile.'));
2374
+ return;
2375
+ }
2376
+ FB.api('/me', { fields: requestedFields.join(',') }, (profile) => {
2377
+ var _a, _b, _c, _d, _e, _f, _g;
2378
+ if (profile && !profile.error) {
2379
+ resolve({
2380
+ profile: Object.assign(Object.assign({}, profile), { id: (_a = profile.id) !== null && _a !== void 0 ? _a : null, name: (_b = profile.name) !== null && _b !== void 0 ? _b : null, email: (_c = profile.email) !== null && _c !== void 0 ? _c : null, first_name: (_d = profile.first_name) !== null && _d !== void 0 ? _d : null, last_name: (_e = profile.last_name) !== null && _e !== void 0 ? _e : null }),
2381
+ });
2382
+ }
2383
+ else {
2384
+ const errorMessage = (_g = (_f = profile === null || profile === void 0 ? void 0 : profile.error) === null || _f === void 0 ? void 0 : _f.message) !== null && _g !== void 0 ? _g : 'Failed to fetch Facebook profile';
2385
+ reject(new Error(errorMessage));
2386
+ }
2387
+ });
2388
+ });
2389
+ });
2390
+ }
2391
+ async requestTracking() {
2392
+ if (!this.appId) {
2393
+ throw new Error('Facebook App ID not set. Call initialize() first.');
2394
+ }
2395
+ // App Tracking Transparency is not applicable on web.
2396
+ return { status: 'authorized' };
2397
+ }
2365
2398
  waitForConnection(timeoutMs = 120000, pollIntervalMs = 500) {
2366
2399
  const start = Date.now();
2367
2400
  return new Promise((resolve, reject) => {
@@ -2608,10 +2641,14 @@ var capacitorCapacitorUpdater = (function (exports, core) {
2608
2641
  }
2609
2642
  }
2610
2643
  async providerSpecificCall(options) {
2644
+ var _a;
2611
2645
  switch (options.call) {
2612
- case 'facebook#getProfile':
2646
+ case 'facebook#getProfile': {
2647
+ const fields = (_a = options.options) === null || _a === void 0 ? void 0 : _a.fields;
2648
+ return this.facebookProvider.getProfile(fields);
2649
+ }
2613
2650
  case 'facebook#requestTracking':
2614
- throw new Error(`Provider specific call for ${options.call} is not implemented on web`);
2651
+ return this.facebookProvider.requestTracking();
2615
2652
  case 'google#createRestoreCredential':
2616
2653
  case 'google#getRestoreCredential':
2617
2654
  case 'google#clearRestoreCredential':