@capgo/capacitor-social-login 8.5.1 → 8.5.3

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.
Files changed (30) hide show
  1. package/README.md +78 -18
  2. package/android/src/main/java/ee/forgr/capacitor/social/login/OAuth2LoginActivity.java +7 -0
  3. package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +31 -1
  4. package/android/src/main/java/ee/forgr/capacitor/social/login/TelegramProvider.java +352 -0
  5. package/android/src/main/java/ee/forgr/capacitor/social/login/helpers/DependencyAvailabilityChecker.java +21 -1
  6. package/dist/docs.json +150 -8
  7. package/dist/esm/definitions.d.ts +87 -3
  8. package/dist/esm/definitions.js.map +1 -1
  9. package/dist/esm/facebook-provider.d.ts +3 -1
  10. package/dist/esm/facebook-provider.js +33 -0
  11. package/dist/esm/facebook-provider.js.map +1 -1
  12. package/dist/esm/oauth-popup-bridge.js +17 -7
  13. package/dist/esm/oauth-popup-bridge.js.map +1 -1
  14. package/dist/esm/oauth-popup-redirect.js +5 -0
  15. package/dist/esm/oauth-popup-redirect.js.map +1 -1
  16. package/dist/esm/social-login.d.ts +1 -1
  17. package/dist/esm/social-login.js.map +1 -1
  18. package/dist/esm/telegram-provider.d.ts +37 -0
  19. package/dist/esm/telegram-provider.js +292 -0
  20. package/dist/esm/telegram-provider.js.map +1 -0
  21. package/dist/esm/web.d.ts +2 -1
  22. package/dist/esm/web.js +23 -3
  23. package/dist/esm/web.js.map +1 -1
  24. package/dist/plugin.cjs.js +364 -10
  25. package/dist/plugin.cjs.js.map +1 -1
  26. package/dist/plugin.js +364 -10
  27. package/dist/plugin.js.map +1 -1
  28. package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +67 -1
  29. package/ios/Sources/SocialLoginPlugin/TelegramProvider.swift +260 -0
  30. package/package.json +1 -1
@@ -73,7 +73,13 @@ const OAUTH_STATE_KEY = 'social_login_oauth_pending';
73
73
  const OAUTH_POPUP_SESSION_KEY = 'social_login_oauth_popup';
74
74
  const OAUTH_RESULT_KEY_PREFIX = 'social_login_oauth_result_';
75
75
  const OAUTH_DELIVERED_KEY = 'social_login_oauth_delivered';
76
- const POPUP_WINDOW_NAMES = new Set(['OAuth2Login', 'XLogin', 'Google Sign In', 'Authorization']);
76
+ const POPUP_WINDOW_NAMES = new Set([
77
+ 'OAuth2Login',
78
+ 'XLogin',
79
+ 'Google Sign In',
80
+ 'Authorization',
81
+ 'TelegramLogin',
82
+ ]);
77
83
  function getOAuthResultKey(nonce) {
78
84
  return `${OAUTH_RESULT_KEY_PREFIX}${nonce}`;
79
85
  }
@@ -82,6 +88,8 @@ function getBroadcastChannelName(provider, nonceOrState) {
82
88
  return `oauth2_${nonceOrState}`;
83
89
  if (provider === 'twitter')
84
90
  return `twitter_oauth_${nonceOrState}`;
91
+ if (provider === 'telegram')
92
+ return `telegram_oauth_${nonceOrState}`;
85
93
  return `google_oauth_${nonceOrState}`;
86
94
  }
87
95
  function markOAuthPopup(nonce) {
@@ -102,12 +110,14 @@ function clearOAuthPopupMarker() {
102
110
  }
103
111
  }
104
112
  function hasOAuthRedirectParams() {
105
- const { search, hash } = window.location;
106
- return (search.includes('code=') ||
107
- search.includes('error=') ||
108
- hash.includes('access_token=') ||
109
- hash.includes('id_token=') ||
110
- hash.includes('error='));
113
+ const search = new URLSearchParams(window.location.search);
114
+ const hash = new URLSearchParams(window.location.hash.replace(/^#/, ''));
115
+ return (search.has('code') ||
116
+ search.has('error') ||
117
+ (search.has('hash') && search.has('auth_date')) ||
118
+ hash.has('access_token') ||
119
+ hash.has('id_token') ||
120
+ hash.has('error'));
111
121
  }
112
122
  function isOAuthPopupContext() {
113
123
  if (typeof window === 'undefined')
@@ -1411,6 +1421,294 @@ class OAuth2SocialLogin extends BaseSocialLogin {
1411
1421
  }
1412
1422
  }
1413
1423
 
1424
+ class TelegramSocialLogin extends BaseSocialLogin {
1425
+ constructor() {
1426
+ super(...arguments);
1427
+ this.botId = null;
1428
+ this.redirectUrl = null;
1429
+ this.origin = null;
1430
+ this.requestAccess = 'write';
1431
+ this.languageCode = null;
1432
+ this.TOKENS_KEY = 'capgo_social_login_telegram_session_v1';
1433
+ this.STATE_PREFIX = 'capgo_social_login_telegram_state_';
1434
+ this.SESSION_TTL_MS = 24 * 60 * 60 * 1000; // 24h session window based on Telegram auth_date
1435
+ }
1436
+ initialize(botId, requestAccess, redirectUrl, origin, languageCode) {
1437
+ this.botId = botId;
1438
+ this.requestAccess = requestAccess !== null && requestAccess !== void 0 ? requestAccess : 'write';
1439
+ this.redirectUrl = redirectUrl !== null && redirectUrl !== void 0 ? redirectUrl : null;
1440
+ this.origin = origin !== null && origin !== void 0 ? origin : null;
1441
+ this.languageCode = languageCode !== null && languageCode !== void 0 ? languageCode : null;
1442
+ }
1443
+ async login(options) {
1444
+ var _a, _b, _c, _d, _e;
1445
+ if (!this.botId) {
1446
+ throw new Error('Telegram botId is not configured. Call initialize() first.');
1447
+ }
1448
+ const redirectUri = (_b = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : this.redirectUrl) !== null && _b !== void 0 ? _b : window.location.origin + window.location.pathname;
1449
+ const state = (_c = options.state) !== null && _c !== void 0 ? _c : this.generateState();
1450
+ const requestAccess = (_d = options.requestAccess) !== null && _d !== void 0 ? _d : this.requestAccess;
1451
+ const origin = (_e = this.origin) !== null && _e !== void 0 ? _e : this.getOriginFromRedirect(redirectUri);
1452
+ if (!this.isHttpOrigin(origin)) {
1453
+ throw new Error('Telegram origin must be a valid http(s) URL registered with BotFather. Pass origin when redirectUrl is not http(s).');
1454
+ }
1455
+ const returnTo = this.appendStateToRedirect(redirectUri, state);
1456
+ this.persistPendingLogin(state, {
1457
+ redirectUri,
1458
+ requestAccess,
1459
+ });
1460
+ localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, JSON.stringify({ provider: 'telegram', state }));
1461
+ const authUrl = this.buildAuthUrl(origin, requestAccess, returnTo);
1462
+ const popup = this.openPopup(authUrl);
1463
+ return new Promise((resolve, reject) => {
1464
+ if (!popup) {
1465
+ this.clearPendingTelegramState(state);
1466
+ reject(new Error('Unable to open login window. Please allow popups.'));
1467
+ return;
1468
+ }
1469
+ let settled = false;
1470
+ let timeoutHandle = 0;
1471
+ let popupClosedInterval = 0;
1472
+ let removeOAuthListener = null;
1473
+ const cleanup = (shouldClose = false) => {
1474
+ clearTimeout(timeoutHandle);
1475
+ clearInterval(popupClosedInterval);
1476
+ if (removeOAuthListener) {
1477
+ removeOAuthListener();
1478
+ removeOAuthListener = null;
1479
+ }
1480
+ this.clearPendingTelegramState(state);
1481
+ if (shouldClose) {
1482
+ try {
1483
+ popup.close();
1484
+ }
1485
+ catch (_a) {
1486
+ // ignore if already closed
1487
+ }
1488
+ }
1489
+ };
1490
+ const settle = (shouldClose, action) => {
1491
+ if (settled)
1492
+ return;
1493
+ settled = true;
1494
+ cleanup(shouldClose);
1495
+ action();
1496
+ };
1497
+ removeOAuthListener = listenForOAuthResult('telegram', state, {
1498
+ onResponse: (data) => {
1499
+ if ((data === null || data === void 0 ? void 0 : data.provider) && data.provider !== 'telegram') {
1500
+ return;
1501
+ }
1502
+ const _a = data, { provider: _ignoredProvider, type: _ignoredType, _ts: _ignoredTs } = _a, payload = __rest(_a, ["provider", "type", "_ts"]);
1503
+ settle(true, () => {
1504
+ resolve({
1505
+ provider: 'telegram',
1506
+ result: payload,
1507
+ });
1508
+ });
1509
+ },
1510
+ onError: (error, code) => {
1511
+ const message = error || 'Telegram login was cancelled.';
1512
+ settle(true, () => {
1513
+ reject(code === 'USER_CANCELLED' ? createUserCancelledError(message) : inferUserCancelledError(message));
1514
+ });
1515
+ },
1516
+ });
1517
+ timeoutHandle = window.setTimeout(() => {
1518
+ settle(true, () => {
1519
+ reject(new Error('Telegram login timed out.'));
1520
+ });
1521
+ }, 300000);
1522
+ popupClosedInterval = window.setInterval(() => {
1523
+ try {
1524
+ if (popup.closed) {
1525
+ settle(false, () => {
1526
+ reject(createUserCancelledError('Telegram login window was closed.'));
1527
+ });
1528
+ }
1529
+ }
1530
+ catch (_a) {
1531
+ clearInterval(popupClosedInterval);
1532
+ }
1533
+ }, 1000);
1534
+ });
1535
+ }
1536
+ async logout() {
1537
+ localStorage.removeItem(this.TOKENS_KEY);
1538
+ }
1539
+ async isLoggedIn() {
1540
+ const session = this.getStoredSession();
1541
+ if (!session) {
1542
+ return { isLoggedIn: false };
1543
+ }
1544
+ const isValid = session.expiresAt > Date.now();
1545
+ if (!isValid) {
1546
+ localStorage.removeItem(this.TOKENS_KEY);
1547
+ }
1548
+ return { isLoggedIn: isValid };
1549
+ }
1550
+ async getAuthorizationCode() {
1551
+ throw new Error('getAuthorizationCode is not available for Telegram.');
1552
+ }
1553
+ async refresh() {
1554
+ throw new Error('Telegram refresh is not supported. Call login() again.');
1555
+ }
1556
+ async handleOAuthRedirect(url, expectedState) {
1557
+ var _a;
1558
+ const params = url.searchParams;
1559
+ const stateFromUrl = params.get('state');
1560
+ if (!stateFromUrl) {
1561
+ return null;
1562
+ }
1563
+ if (expectedState && expectedState !== stateFromUrl) {
1564
+ return { error: 'Telegram login session expired or state mismatch.' };
1565
+ }
1566
+ const pending = this.consumePendingLogin(stateFromUrl);
1567
+ if (!pending) {
1568
+ localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);
1569
+ return { error: 'Telegram login session expired or state mismatch.' };
1570
+ }
1571
+ const error = params.get('error');
1572
+ if (error) {
1573
+ localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);
1574
+ return { error: params.get('error_description') || error };
1575
+ }
1576
+ const id = params.get('id');
1577
+ const authDateRaw = params.get('auth_date');
1578
+ const hash = params.get('hash');
1579
+ if (!id || !authDateRaw || !hash) {
1580
+ localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);
1581
+ return { error: 'Telegram login payload is incomplete.' };
1582
+ }
1583
+ const profile = {
1584
+ id,
1585
+ firstName: (_a = params.get('first_name')) !== null && _a !== void 0 ? _a : '',
1586
+ lastName: params.get('last_name'),
1587
+ username: params.get('username'),
1588
+ photoUrl: params.get('photo_url'),
1589
+ };
1590
+ const authDate = Number(authDateRaw);
1591
+ if (!Number.isInteger(authDate)) {
1592
+ localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);
1593
+ return { error: 'Telegram auth_date is invalid.' };
1594
+ }
1595
+ const result = {
1596
+ profile,
1597
+ authDate,
1598
+ hash,
1599
+ requestAccess: pending.requestAccess,
1600
+ };
1601
+ this.persistSession({
1602
+ expiresAt: authDate * 1000 + this.SESSION_TTL_MS,
1603
+ });
1604
+ localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);
1605
+ return {
1606
+ provider: 'telegram',
1607
+ result,
1608
+ };
1609
+ }
1610
+ buildAuthUrl(origin, requestAccess, returnTo) {
1611
+ var _a;
1612
+ const params = new URLSearchParams({
1613
+ bot_id: (_a = this.botId) !== null && _a !== void 0 ? _a : '',
1614
+ origin,
1615
+ request_access: requestAccess,
1616
+ return_to: returnTo,
1617
+ embed: '1',
1618
+ mobile: '1',
1619
+ });
1620
+ if (this.languageCode) {
1621
+ params.set('lang', this.languageCode);
1622
+ }
1623
+ return `https://oauth.telegram.org/auth?${params.toString()}`;
1624
+ }
1625
+ openPopup(authUrl) {
1626
+ const width = 500;
1627
+ const height = 650;
1628
+ const left = window.screenX + (window.outerWidth - width) / 2;
1629
+ const top = window.screenY + (window.outerHeight - height) / 2;
1630
+ return window.open(authUrl, 'TelegramLogin', `width=${width},height=${height},left=${left},top=${top},popup=1`);
1631
+ }
1632
+ appendStateToRedirect(redirectUri, state) {
1633
+ try {
1634
+ const redirect = new URL(redirectUri);
1635
+ redirect.searchParams.set('state', state);
1636
+ return redirect.toString();
1637
+ }
1638
+ catch (_a) {
1639
+ return redirectUri;
1640
+ }
1641
+ }
1642
+ isHttpOrigin(value) {
1643
+ if (!value) {
1644
+ return false;
1645
+ }
1646
+ try {
1647
+ const url = new URL(value);
1648
+ return url.protocol === 'http:' || url.protocol === 'https:';
1649
+ }
1650
+ catch (_a) {
1651
+ return false;
1652
+ }
1653
+ }
1654
+ getOriginFromRedirect(redirectUri) {
1655
+ return this.isHttpOrigin(redirectUri) ? new URL(redirectUri).origin : undefined;
1656
+ }
1657
+ persistSession(session) {
1658
+ localStorage.setItem(this.TOKENS_KEY, JSON.stringify(session));
1659
+ }
1660
+ getStoredSession() {
1661
+ const raw = localStorage.getItem(this.TOKENS_KEY);
1662
+ if (!raw) {
1663
+ return null;
1664
+ }
1665
+ try {
1666
+ return JSON.parse(raw);
1667
+ }
1668
+ catch (err) {
1669
+ console.warn('Failed to parse stored Telegram session', err);
1670
+ return null;
1671
+ }
1672
+ }
1673
+ persistPendingLogin(state, payload) {
1674
+ localStorage.setItem(`${this.STATE_PREFIX}${state}`, JSON.stringify(payload));
1675
+ }
1676
+ consumePendingLogin(state) {
1677
+ const key = `${this.STATE_PREFIX}${state}`;
1678
+ const raw = localStorage.getItem(key);
1679
+ localStorage.removeItem(key);
1680
+ if (!raw) {
1681
+ return null;
1682
+ }
1683
+ try {
1684
+ return JSON.parse(raw);
1685
+ }
1686
+ catch (err) {
1687
+ console.warn('Failed to parse pending Telegram login payload', err);
1688
+ return null;
1689
+ }
1690
+ }
1691
+ clearPendingTelegramState(state) {
1692
+ try {
1693
+ localStorage.removeItem(`${this.STATE_PREFIX}${state}`);
1694
+ const raw = localStorage.getItem(BaseSocialLogin.OAUTH_STATE_KEY);
1695
+ if (!raw) {
1696
+ return;
1697
+ }
1698
+ const parsed = JSON.parse(raw);
1699
+ if (parsed.provider === 'telegram' && parsed.state === state) {
1700
+ localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);
1701
+ }
1702
+ }
1703
+ catch (_a) {
1704
+ // ignore storage errors
1705
+ }
1706
+ }
1707
+ generateState() {
1708
+ return [...crypto.getRandomValues(new Uint8Array(16))].map((b) => b.toString(16).padStart(2, '0')).join('');
1709
+ }
1710
+ }
1711
+
1414
1712
  class TwitterSocialLogin extends BaseSocialLogin {
1415
1713
  constructor() {
1416
1714
  super(...arguments);
@@ -1802,11 +2100,15 @@ async function parseRedirectResult() {
1802
2100
  const googleProvider = new GoogleSocialLogin();
1803
2101
  const oauth2Provider = new OAuth2SocialLogin();
1804
2102
  const twitterProvider = new TwitterSocialLogin();
2103
+ const telegramProvider = new TelegramSocialLogin();
1805
2104
  let result = null;
1806
2105
  switch (provider) {
1807
2106
  case 'twitter':
1808
2107
  result = await twitterProvider.handleOAuthRedirect(url, state);
1809
2108
  break;
2109
+ case 'telegram':
2110
+ result = await telegramProvider.handleOAuthRedirect(url, state);
2111
+ break;
1810
2112
  case 'oauth2':
1811
2113
  result = await oauth2Provider.handleOAuthRedirect(url, state);
1812
2114
  break;
@@ -2363,6 +2665,39 @@ class FacebookSocialLogin extends BaseSocialLogin {
2363
2665
  async refresh(options) {
2364
2666
  await this.login(options);
2365
2667
  }
2668
+ async getProfile(fields) {
2669
+ if (!this.appId) {
2670
+ throw new Error('Facebook App ID not set. Call initialize() first.');
2671
+ }
2672
+ const requestedFields = Array.isArray(fields) && fields.length > 0 ? fields : ['id', 'name', 'email', 'picture'];
2673
+ return new Promise((resolve, reject) => {
2674
+ FB.getLoginStatus((statusResponse) => {
2675
+ if (statusResponse.status !== 'connected') {
2676
+ reject(new Error('User is not logged in. Call login() before fetching profile.'));
2677
+ return;
2678
+ }
2679
+ FB.api('/me', { fields: requestedFields.join(',') }, (profile) => {
2680
+ var _a, _b, _c, _d, _e, _f, _g;
2681
+ if (profile && !profile.error) {
2682
+ resolve({
2683
+ 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 }),
2684
+ });
2685
+ }
2686
+ else {
2687
+ 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';
2688
+ reject(new Error(errorMessage));
2689
+ }
2690
+ });
2691
+ });
2692
+ });
2693
+ }
2694
+ async requestTracking() {
2695
+ if (!this.appId) {
2696
+ throw new Error('Facebook App ID not set. Call initialize() first.');
2697
+ }
2698
+ // App Tracking Transparency is not applicable on web.
2699
+ return { status: 'authorized' };
2700
+ }
2366
2701
  waitForConnection(timeoutMs = 120000, pollIntervalMs = 500) {
2367
2702
  const start = Date.now();
2368
2703
  return new Promise((resolve, reject) => {
@@ -2416,6 +2751,7 @@ class SocialLoginWeb extends core.WebPlugin {
2416
2751
  this.appleProvider = new AppleSocialLogin();
2417
2752
  this.facebookProvider = new FacebookSocialLogin();
2418
2753
  this.twitterProvider = new TwitterSocialLogin();
2754
+ this.telegramProvider = new TelegramSocialLogin();
2419
2755
  this.oauth2Provider = new OAuth2SocialLogin();
2420
2756
  // Auto-finish OAuth redirects only when running inside a popup window.
2421
2757
  // For redirect-based flows (full page navigation), the app should call `handleRedirectCallback()` explicitly.
@@ -2455,6 +2791,9 @@ class SocialLoginWeb extends core.WebPlugin {
2455
2791
  case 'twitter':
2456
2792
  result = await this.twitterProvider.handleOAuthRedirect(url, state);
2457
2793
  break;
2794
+ case 'telegram':
2795
+ result = await this.telegramProvider.handleOAuthRedirect(url, state);
2796
+ break;
2458
2797
  case 'oauth2':
2459
2798
  result = await this.oauth2Provider.handleOAuthRedirect(url, state);
2460
2799
  break;
@@ -2495,7 +2834,7 @@ class SocialLoginWeb extends core.WebPlugin {
2495
2834
  }
2496
2835
  }
2497
2836
  async initialize(options) {
2498
- var _a, _b, _c, _d;
2837
+ var _a, _b, _c, _d, _e;
2499
2838
  const initPromises = [];
2500
2839
  if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
2501
2840
  initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));
@@ -2509,6 +2848,9 @@ class SocialLoginWeb extends core.WebPlugin {
2509
2848
  if ((_d = options.twitter) === null || _d === void 0 ? void 0 : _d.clientId) {
2510
2849
  initPromises.push(this.twitterProvider.initialize(options.twitter.clientId, options.twitter.redirectUrl, options.twitter.defaultScopes, options.twitter.forceLogin, options.twitter.audience));
2511
2850
  }
2851
+ if ((_e = options.telegram) === null || _e === void 0 ? void 0 : _e.botId) {
2852
+ this.telegramProvider.initialize(options.telegram.botId, options.telegram.requestAccess, options.telegram.redirectUrl, options.telegram.origin, options.telegram.languageCode);
2853
+ }
2512
2854
  if (options.oauth2 && Object.keys(options.oauth2).length > 0) {
2513
2855
  initPromises.push(this.oauth2Provider.initializeProviders(options.oauth2));
2514
2856
  }
@@ -2524,6 +2866,8 @@ class SocialLoginWeb extends core.WebPlugin {
2524
2866
  return this.facebookProvider.login(options.options);
2525
2867
  case 'twitter':
2526
2868
  return this.twitterProvider.login(options.options);
2869
+ case 'telegram':
2870
+ return this.telegramProvider.login(options.options);
2527
2871
  case 'oauth2':
2528
2872
  return this.oauth2Provider.login(options.options);
2529
2873
  default:
@@ -2540,6 +2884,8 @@ class SocialLoginWeb extends core.WebPlugin {
2540
2884
  return this.facebookProvider.logout();
2541
2885
  case 'twitter':
2542
2886
  return this.twitterProvider.logout();
2887
+ case 'telegram':
2888
+ return this.telegramProvider.logout();
2543
2889
  case 'oauth2':
2544
2890
  if (!options.providerId) {
2545
2891
  throw new Error('providerId is required for oauth2 logout');
@@ -2559,6 +2905,8 @@ class SocialLoginWeb extends core.WebPlugin {
2559
2905
  return this.facebookProvider.isLoggedIn();
2560
2906
  case 'twitter':
2561
2907
  return this.twitterProvider.isLoggedIn();
2908
+ case 'telegram':
2909
+ return this.telegramProvider.isLoggedIn();
2562
2910
  case 'oauth2':
2563
2911
  if (!options.providerId) {
2564
2912
  throw new Error('providerId is required for oauth2 isLoggedIn');
@@ -2597,6 +2945,8 @@ class SocialLoginWeb extends core.WebPlugin {
2597
2945
  return this.facebookProvider.refresh(options.options);
2598
2946
  case 'twitter':
2599
2947
  return this.twitterProvider.refresh();
2948
+ case 'telegram':
2949
+ return this.telegramProvider.refresh();
2600
2950
  case 'oauth2': {
2601
2951
  const oauth2Options = options.options;
2602
2952
  if (!(oauth2Options === null || oauth2Options === void 0 ? void 0 : oauth2Options.providerId)) {
@@ -2609,10 +2959,14 @@ class SocialLoginWeb extends core.WebPlugin {
2609
2959
  }
2610
2960
  }
2611
2961
  async providerSpecificCall(options) {
2962
+ var _a;
2612
2963
  switch (options.call) {
2613
- case 'facebook#getProfile':
2964
+ case 'facebook#getProfile': {
2965
+ const fields = (_a = options.options) === null || _a === void 0 ? void 0 : _a.fields;
2966
+ return this.facebookProvider.getProfile(fields);
2967
+ }
2614
2968
  case 'facebook#requestTracking':
2615
- throw new Error(`Provider specific call for ${options.call} is not implemented on web`);
2969
+ return this.facebookProvider.requestTracking();
2616
2970
  case 'google#createRestoreCredential':
2617
2971
  case 'google#getRestoreCredential':
2618
2972
  case 'google#clearRestoreCredential':