@capgo/capacitor-social-login 8.5.1 → 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/README.md +5 -3
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +1 -1
- package/dist/docs.json +5 -1
- package/dist/esm/definitions.d.ts +2 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/facebook-provider.d.ts +3 -1
- package/dist/esm/facebook-provider.js +33 -0
- package/dist/esm/facebook-provider.js.map +1 -1
- package/dist/esm/web.js +6 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +39 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +39 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +1 -1
- package/package.json +1 -1
package/dist/plugin.cjs.js
CHANGED
|
@@ -2363,6 +2363,39 @@ class FacebookSocialLogin extends BaseSocialLogin {
|
|
|
2363
2363
|
async refresh(options) {
|
|
2364
2364
|
await this.login(options);
|
|
2365
2365
|
}
|
|
2366
|
+
async getProfile(fields) {
|
|
2367
|
+
if (!this.appId) {
|
|
2368
|
+
throw new Error('Facebook App ID not set. Call initialize() first.');
|
|
2369
|
+
}
|
|
2370
|
+
const requestedFields = Array.isArray(fields) && fields.length > 0 ? fields : ['id', 'name', 'email', 'picture'];
|
|
2371
|
+
return new Promise((resolve, reject) => {
|
|
2372
|
+
FB.getLoginStatus((statusResponse) => {
|
|
2373
|
+
if (statusResponse.status !== 'connected') {
|
|
2374
|
+
reject(new Error('User is not logged in. Call login() before fetching profile.'));
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
FB.api('/me', { fields: requestedFields.join(',') }, (profile) => {
|
|
2378
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2379
|
+
if (profile && !profile.error) {
|
|
2380
|
+
resolve({
|
|
2381
|
+
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 }),
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2384
|
+
else {
|
|
2385
|
+
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';
|
|
2386
|
+
reject(new Error(errorMessage));
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2389
|
+
});
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
async requestTracking() {
|
|
2393
|
+
if (!this.appId) {
|
|
2394
|
+
throw new Error('Facebook App ID not set. Call initialize() first.');
|
|
2395
|
+
}
|
|
2396
|
+
// App Tracking Transparency is not applicable on web.
|
|
2397
|
+
return { status: 'authorized' };
|
|
2398
|
+
}
|
|
2366
2399
|
waitForConnection(timeoutMs = 120000, pollIntervalMs = 500) {
|
|
2367
2400
|
const start = Date.now();
|
|
2368
2401
|
return new Promise((resolve, reject) => {
|
|
@@ -2609,10 +2642,14 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
2609
2642
|
}
|
|
2610
2643
|
}
|
|
2611
2644
|
async providerSpecificCall(options) {
|
|
2645
|
+
var _a;
|
|
2612
2646
|
switch (options.call) {
|
|
2613
|
-
case 'facebook#getProfile':
|
|
2647
|
+
case 'facebook#getProfile': {
|
|
2648
|
+
const fields = (_a = options.options) === null || _a === void 0 ? void 0 : _a.fields;
|
|
2649
|
+
return this.facebookProvider.getProfile(fields);
|
|
2650
|
+
}
|
|
2614
2651
|
case 'facebook#requestTracking':
|
|
2615
|
-
|
|
2652
|
+
return this.facebookProvider.requestTracking();
|
|
2616
2653
|
case 'google#createRestoreCredential':
|
|
2617
2654
|
case 'google#getRestoreCredential':
|
|
2618
2655
|
case 'google#clearRestoreCredential':
|