@saasquatch/component-environment 1.0.2-2 → 1.0.2-4

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/index.js CHANGED
@@ -516,9 +516,11 @@ function userIdentityFromJwt(jwt) {
516
516
  userId = decoded.user.id;
517
517
  }
518
518
  if (!userId || !accountId) {
519
+ debug6("No user information");
519
520
  return void 0;
520
521
  }
521
522
  if (exp && Date.now() >= exp * 1e3) {
523
+ debug6("JWT has expired");
522
524
  return void 0;
523
525
  }
524
526
  return {
@@ -527,6 +529,7 @@ function userIdentityFromJwt(jwt) {
527
529
  jwt
528
530
  };
529
531
  } catch (e) {
532
+ debug6("Invalid JWT");
530
533
  return void 0;
531
534
  }
532
535
  }
@@ -571,9 +574,6 @@ function _getInitialValue() {
571
574
  }
572
575
  function setUserIdentity(identity) {
573
576
  const globalProvider = lazilyStartUserContext();
574
- const sdk = getEnvironmentSDK();
575
- const widgetIdent = sdk.type === "SquatchJS2" ? sdk.widgetIdent : void 0;
576
- console.log({ sdk, widgetIdent });
577
577
  if (!(0, import_equality.equal)(globalProvider.context, identity)) {
578
578
  debug6(`Setting user context value [${JSON.stringify(identity)}]`);
579
579
  globalProvider.context = identity;
package/dist/index.mjs CHANGED
@@ -467,9 +467,11 @@ function userIdentityFromJwt(jwt) {
467
467
  userId = decoded.user.id;
468
468
  }
469
469
  if (!userId || !accountId) {
470
+ debug6("No user information");
470
471
  return void 0;
471
472
  }
472
473
  if (exp && Date.now() >= exp * 1e3) {
474
+ debug6("JWT has expired");
473
475
  return void 0;
474
476
  }
475
477
  return {
@@ -478,6 +480,7 @@ function userIdentityFromJwt(jwt) {
478
480
  jwt
479
481
  };
480
482
  } catch (e) {
483
+ debug6("Invalid JWT");
481
484
  return void 0;
482
485
  }
483
486
  }
@@ -522,9 +525,6 @@ function _getInitialValue() {
522
525
  }
523
526
  function setUserIdentity(identity) {
524
527
  const globalProvider = lazilyStartUserContext();
525
- const sdk = getEnvironmentSDK();
526
- const widgetIdent = sdk.type === "SquatchJS2" ? sdk.widgetIdent : void 0;
527
- console.log({ sdk, widgetIdent });
528
528
  if (!equal(globalProvider.context, identity)) {
529
529
  debug6(`Setting user context value [${JSON.stringify(identity)}]`);
530
530
  globalProvider.context = identity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasquatch/component-environment",
3
- "version": "1.0.2-2",
3
+ "version": "1.0.2-4",
4
4
  "description": "Environment and contexts for SaaSquatch components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",