solid-ui 3.0.4-d3715b2 → 3.0.4-d5a80ae

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/solid-ui.js CHANGED
@@ -9577,7 +9577,7 @@ function ensureLoadedPreferences(_x) {
9577
9577
  // used to be logInLoadProfile
9578
9578
  function _ensureLoadedPreferences() {
9579
9579
  _ensureLoadedPreferences = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(context) {
9580
- var progressDisplay, preferencesFile, m2, _t4;
9580
+ var progressDisplay, preferencesFile, m2, errorMessage, _t4;
9581
9581
  return regenerator_default().wrap(function (_context4) {
9582
9582
  while (1) switch (_context4.prev = _context4.next) {
9583
9583
  case 0:
@@ -9605,14 +9605,15 @@ function _ensureLoadedPreferences() {
9605
9605
  case 4:
9606
9606
  _context4.prev = 4;
9607
9607
  _t4 = _context4["catch"](1);
9608
- if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError)) {
9608
+ errorMessage = _t4 instanceof Error ? _t4.message : "".concat(_t4);
9609
+ if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError || /status:\s*401|unauthorized/i.test(errorMessage))) {
9609
9610
  _context4.next = 5;
9610
9611
  break;
9611
9612
  }
9612
- m2 = 'Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.';
9613
- log_alert(m2);
9614
- _context4.next = 11;
9615
- break;
9613
+ m2 = 'Not logged in, so preferences were not loaded.';
9614
+ context.preferencesFileError = m2;
9615
+ src_debug/* warn */.R8(m2);
9616
+ return _context4.abrupt("return", context);
9616
9617
  case 5:
9617
9618
  if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9618
9619
  _context4.next = 6;
@@ -9678,7 +9679,7 @@ function ensureLoadedProfile(_x2) {
9678
9679
  */
9679
9680
  function _ensureLoadedProfile() {
9680
9681
  _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9681
- var logInContext, _t5;
9682
+ var logInContext, notLoggedInMessage, message, _notLoggedInMessage, loggedInUser, isNonFatalProfileSideLoadFailure, _t5;
9682
9683
  return regenerator_default().wrap(function (_context5) {
9683
9684
  while (1) switch (_context5.prev = _context5.next) {
9684
9685
  case 0:
@@ -9697,24 +9698,51 @@ function _ensureLoadedProfile() {
9697
9698
  _context5.next = 3;
9698
9699
  break;
9699
9700
  }
9700
- throw new Error('Could not log in');
9701
+ notLoggedInMessage = 'Not logged in, so profile was not loaded.';
9702
+ src_debug/* log */.Rm(notLoggedInMessage);
9703
+ if (context.div && context.dom) {
9704
+ context.div.appendChild(errorMessageBlock(context.dom, notLoggedInMessage));
9705
+ }
9706
+ return _context5.abrupt("return", context);
9701
9707
  case 3:
9702
9708
  _context5.next = 4;
9703
9709
  return loadProfile(logInContext.me);
9704
9710
  case 4:
9705
9711
  context.publicProfile = _context5.sent;
9706
- _context5.next = 6;
9712
+ _context5.next = 8;
9707
9713
  break;
9708
9714
  case 5:
9709
9715
  _context5.prev = 5;
9710
9716
  _t5 = _context5["catch"](1);
9717
+ message = _t5 instanceof Error ? _t5.message : "".concat(_t5);
9718
+ if (!/status:\s*401|unauthorized/i.test(message)) {
9719
+ _context5.next = 6;
9720
+ break;
9721
+ }
9722
+ _notLoggedInMessage = 'Not logged in, so profile was not loaded.';
9723
+ src_debug/* warn */.R8(_notLoggedInMessage);
9711
9724
  if (context.div && context.dom) {
9712
- context.div.appendChild(errorMessageBlock(context.dom, _t5.message));
9725
+ context.div.appendChild(errorMessageBlock(context.dom, _notLoggedInMessage));
9713
9726
  }
9714
- throw new Error("Can't log in: ".concat(_t5));
9727
+ return _context5.abrupt("return", context);
9715
9728
  case 6:
9729
+ loggedInUser = logInContext && logInContext.me;
9730
+ isNonFatalProfileSideLoadFailure = !!loggedInUser && (_t5 instanceof external_SolidLogic_.CrossOriginForbiddenError || _t5 instanceof external_SolidLogic_.SameOriginForbiddenError || /status:\s*403|forbidden/i.test(message) || /cancel/i.test(message));
9731
+ if (!isNonFatalProfileSideLoadFailure) {
9732
+ _context5.next = 7;
9733
+ break;
9734
+ }
9735
+ src_debug/* warn */.R8("Unable to load all profile-linked resources; continuing as logged in user: ".concat(message));
9736
+ context.publicProfile = loggedInUser.doc();
9716
9737
  return _context5.abrupt("return", context);
9717
9738
  case 7:
9739
+ if (context.div && context.dom) {
9740
+ context.div.appendChild(errorMessageBlock(context.dom, message));
9741
+ }
9742
+ throw new Error("Can't log in: ".concat(_t5));
9743
+ case 8:
9744
+ return _context5.abrupt("return", context);
9745
+ case 9:
9718
9746
  case "end":
9719
9747
  return _context5.stop();
9720
9748
  }