@capgo/capacitor-social-login 8.5.17 → 8.5.19

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
@@ -341,7 +341,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
341
341
  if (this.loginType === 'offline') {
342
342
  return Promise.reject("Offline login doesn't store tokens. logout is not available");
343
343
  }
344
- // eslint-disable-next-line
345
344
  const state = this.getGoogleState();
346
345
  if (!state)
347
346
  return;
@@ -351,7 +350,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
351
350
  if (this.loginType === 'offline') {
352
351
  return Promise.reject("Offline login doesn't store tokens. isLoggedIn is not available");
353
352
  }
354
- // eslint-disable-next-line
355
353
  const state = this.getGoogleState();
356
354
  if (!state)
357
355
  return { isLoggedIn: false };
@@ -379,7 +377,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
379
377
  if (this.loginType === 'offline') {
380
378
  return Promise.reject("Offline login doesn't store tokens. getAuthorizationCode is not available");
381
379
  }
382
- // eslint-disable-next-line
383
380
  const state = this.getGoogleState();
384
381
  if (!state)
385
382
  throw new Error('No Google authorization code available');
@@ -489,7 +486,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
489
486
  }
490
487
  catch (e) {
491
488
  console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);
492
- throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);
489
+ throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`, { cause: e });
493
490
  }
494
491
  // Extract the 'expires_in' field
495
492
  const expiresInStr = jsonObject['expires_in'];
@@ -507,7 +504,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
507
504
  }
508
505
  catch (e) {
509
506
  console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);
510
- throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);
507
+ throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`, { cause: e });
511
508
  }
512
509
  // Determine if the access token is valid based on 'expires_in'
513
510
  return expiresInInt > 5;
@@ -523,7 +520,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
523
520
  const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch
524
521
  return parsed.exp && currentTime < parsed.exp;
525
522
  }
526
- catch (e) {
523
+ catch (_a) {
527
524
  return false;
528
525
  }
529
526
  }
@@ -536,7 +533,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
536
533
  await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);
537
534
  this.clearStateGoogle();
538
535
  }
539
- catch (e) {
536
+ catch (_a) {
540
537
  // ignore
541
538
  }
542
539
  return;
@@ -949,7 +946,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
949
946
  if (options.flow === 'redirect') {
950
947
  // Trigger a full-page redirect. The promise will not resolve because the page navigates away.
951
948
  window.location.assign(authUrl);
952
- // eslint-disable-next-line @typescript-eslint/no-empty-function
953
949
  return new Promise(() => { });
954
950
  }
955
951
  // Open popup window
@@ -993,7 +989,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
993
989
  return false;
994
990
  }
995
991
  cleanup(messageHandler, timeoutHandle, popupClosedInterval);
996
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
997
992
  const _a = data, { provider: _ignoredProvider, type: _ignoredType } = _a, payload = __rest(_a, ["provider", "type"]);
998
993
  resolve({
999
994
  provider: 'oauth2',
@@ -1808,7 +1803,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
1808
1803
  return false;
1809
1804
  }
1810
1805
  cleanup(messageHandler, timeoutHandle, popupClosedInterval);
1811
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1812
1806
  const _a = data, { provider: _ignoredProvider, type: _ignoredType } = _a, payload = __rest(_a, ["provider", "type"]);
1813
1807
  resolve({
1814
1808
  provider: 'twitter',
@@ -2115,7 +2109,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
2115
2109
  const oauth2Provider = new OAuth2SocialLogin();
2116
2110
  const twitterProvider = new TwitterSocialLogin();
2117
2111
  const telegramProvider = new TelegramSocialLogin();
2118
- let result = null;
2112
+ let result;
2119
2113
  switch (provider) {
2120
2114
  case 'twitter':
2121
2115
  result = await twitterProvider.handleOAuthRedirect(url, state);
@@ -2685,7 +2679,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
2685
2679
  .signIn()
2686
2680
  .then((res) => {
2687
2681
  var _a, _b, _c, _d, _e;
2688
- let accessToken = null;
2682
+ let accessToken;
2689
2683
  if (this.useProperTokenExchange) {
2690
2684
  // When using proper token exchange, the authorization code should be exchanged
2691
2685
  // for a proper access token on the backend. For now, we set accessToken to null
@@ -2982,7 +2976,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
2982
2976
  provider = stateRaw === 'true' ? 'google' : null;
2983
2977
  }
2984
2978
  }
2985
- let result = null;
2979
+ let result;
2986
2980
  switch (provider) {
2987
2981
  case 'twitter':
2988
2982
  result = await this.twitterProvider.handleOAuthRedirect(url, state);