solid-ui 3.0.4-7c010e4 → 3.0.4-837db4c

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
@@ -9522,13 +9522,6 @@ var _solidLogicSingleton$2 = external_SolidLogic_.solidLogicSingleton.typeIndex,
9522
9522
  loadAllTypeIndexes = _solidLogicSingleton$2.loadAllTypeIndexes,
9523
9523
  getScopedAppsFromIndex = _solidLogicSingleton$2.getScopedAppsFromIndex,
9524
9524
  deleteTypeIndexRegistration = _solidLogicSingleton$2.deleteTypeIndexRegistration;
9525
- function formatDynamicError(error, contextLabel) {
9526
- var e = error;
9527
- var name = (e === null || e === void 0 ? void 0 : e.name) || 'Error';
9528
- var status = typeof (e === null || e === void 0 ? void 0 : e.status) === 'number' ? " (HTTP ".concat(e.status, ")") : '';
9529
- var message = e !== null && e !== void 0 && e.message ? String(e.message) : typeof error === 'string' ? error : 'No additional details provided';
9530
- return "".concat(contextLabel, ": ").concat(name).concat(status, " - ").concat(message);
9531
- }
9532
9525
 
9533
9526
  /**
9534
9527
  * Resolves with the logged in user's WebID
@@ -9599,100 +9592,78 @@ function _ensureLoadedPreferences() {
9599
9592
  return ensureLoadedProfile(context);
9600
9593
  case 2:
9601
9594
  context = _context4.sent;
9602
- if (context.me) {
9603
- _context4.next = 3;
9604
- break;
9605
- }
9606
- context.preferencesFileError = 'Not logged in, so preferences were not loaded.';
9607
- return _context4.abrupt("return", context);
9608
- case 3:
9609
- _context4.next = 4;
9595
+ _context4.next = 3;
9610
9596
  return loadPreferences(context.me);
9611
- case 4:
9597
+ case 3:
9612
9598
  preferencesFile = _context4.sent;
9613
9599
  if (progressDisplay) {
9614
9600
  progressDisplay.parentNode.removeChild(progressDisplay);
9615
9601
  }
9616
9602
  context.preferencesFile = preferencesFile;
9617
- _context4.next = 13;
9603
+ _context4.next = 11;
9618
9604
  break;
9619
- case 5:
9620
- _context4.prev = 5;
9605
+ case 4:
9606
+ _context4.prev = 4;
9621
9607
  _t4 = _context4["catch"](1);
9622
9608
  if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError)) {
9623
- _context4.next = 6;
9609
+ _context4.next = 5;
9624
9610
  break;
9625
9611
  }
9626
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.';
9627
- context.preferencesFileError = m2;
9628
9613
  log_alert(m2);
9629
- return _context4.abrupt("return", context);
9630
- case 6:
9614
+ _context4.next = 11;
9615
+ break;
9616
+ case 5:
9631
9617
  if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9632
- _context4.next = 7;
9618
+ _context4.next = 6;
9633
9619
  break;
9634
9620
  }
9635
- m2 = "Unauthorized: preference file request was blocked for origin ".concat(window.location.origin, ".");
9621
+ m2 = "Unauthorized: Assuming preference file blocked for origin ".concat(window.location.origin);
9636
9622
  context.preferencesFileError = m2;
9637
9623
  return _context4.abrupt("return", context);
9638
- case 7:
9624
+ case 6:
9639
9625
  if (!(_t4 instanceof external_SolidLogic_.SameOriginForbiddenError)) {
9640
- _context4.next = 8;
9626
+ _context4.next = 7;
9641
9627
  break;
9642
9628
  }
9643
- m2 = 'You are not authorized to read your preference file from this app context.';
9644
- context.preferencesFileError = m2;
9629
+ m2 = 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.';
9645
9630
  src_debug/* warn */.R8(m2);
9646
9631
  return _context4.abrupt("return", context);
9647
- case 8:
9632
+ case 7:
9648
9633
  if (!(_t4 instanceof external_SolidLogic_.NotEditableError)) {
9649
- _context4.next = 9;
9634
+ _context4.next = 8;
9650
9635
  break;
9651
9636
  }
9652
- m2 = 'You are not authorized to edit your preference file from this app context.';
9653
- context.preferencesFileError = m2;
9637
+ m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9654
9638
  src_debug/* warn */.R8(m2);
9655
9639
  return _context4.abrupt("return", context);
9656
- case 9:
9640
+ case 8:
9657
9641
  if (!(_t4 instanceof external_SolidLogic_.WebOperationError)) {
9658
- _context4.next = 10;
9642
+ _context4.next = 9;
9659
9643
  break;
9660
9644
  }
9661
- m2 = formatDynamicError(_t4, 'Preference file web operation failed');
9662
- context.preferencesFileError = m2;
9645
+ m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9663
9646
  src_debug/* warn */.R8(m2);
9664
- return _context4.abrupt("return", context);
9665
- case 10:
9647
+ _context4.next = 11;
9648
+ break;
9649
+ case 9:
9666
9650
  if (!(_t4 instanceof external_SolidLogic_.FetchError)) {
9667
- _context4.next = 12;
9668
- break;
9669
- }
9670
- if (!(_t4.status === 404)) {
9671
- _context4.next = 11;
9651
+ _context4.next = 10;
9672
9652
  break;
9673
9653
  }
9674
- m2 = 'Your preferences file was not found (404). It may not exist yet.';
9675
- context.preferencesFileError = m2;
9676
- src_debug/* warn */.R8(m2);
9677
- return _context4.abrupt("return", context);
9678
- case 11:
9679
- m2 = formatDynamicError(_t4, 'Error reading your preferences file');
9680
- context.preferencesFileError = m2;
9681
- src_debug/* warn */.R8(m2);
9654
+ m2 = "Strange: Error ".concat(_t4.status, " trying to read your preference file.").concat(_t4.message);
9682
9655
  log_alert(m2);
9656
+ _context4.next = 11;
9657
+ break;
9658
+ case 10:
9659
+ throw new Error("(via loadPrefs) ".concat(_t4));
9660
+ case 11:
9683
9661
  return _context4.abrupt("return", context);
9684
9662
  case 12:
9685
- m2 = formatDynamicError(_t4, 'Unexpected error while loading preferences');
9686
- context.preferencesFileError = m2;
9687
- src_debug/* error */.z3(m2);
9688
- return _context4.abrupt("return", context);
9689
- case 13:
9690
- return _context4.abrupt("return", context);
9691
- case 14:
9692
9663
  case "end":
9693
9664
  return _context4.stop();
9694
9665
  }
9695
- }, _callee4, null, [[1, 5]]);
9666
+ }, _callee4, null, [[1, 4]]);
9696
9667
  }));
9697
9668
  return _ensureLoadedPreferences.apply(this, arguments);
9698
9669
  }
@@ -9707,7 +9678,7 @@ function ensureLoadedProfile(_x2) {
9707
9678
  */
9708
9679
  function _ensureLoadedProfile() {
9709
9680
  _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9710
- var logInContext, message, _message, _t5;
9681
+ var logInContext, _t5;
9711
9682
  return regenerator_default().wrap(function (_context5) {
9712
9683
  while (1) switch (_context5.prev = _context5.next) {
9713
9684
  case 0:
@@ -9726,9 +9697,7 @@ function _ensureLoadedProfile() {
9726
9697
  _context5.next = 3;
9727
9698
  break;
9728
9699
  }
9729
- message = 'Could not log in; skipping profile load.';
9730
- src_debug/* log */.Rm(message);
9731
- return _context5.abrupt("return", context);
9700
+ throw new Error('Could not log in');
9732
9701
  case 3:
9733
9702
  _context5.next = 4;
9734
9703
  return loadProfile(logInContext.me);
@@ -9739,11 +9708,10 @@ function _ensureLoadedProfile() {
9739
9708
  case 5:
9740
9709
  _context5.prev = 5;
9741
9710
  _t5 = _context5["catch"](1);
9742
- _message = formatDynamicError(_t5, 'Unable to load your profile');
9743
9711
  if (context.div && context.dom) {
9744
- context.div.appendChild(errorMessageBlock(context.dom, _message));
9712
+ context.div.appendChild(errorMessageBlock(context.dom, _t5.message));
9745
9713
  }
9746
- throw new Error(_message);
9714
+ throw new Error("Can't log in: ".concat(_t5));
9747
9715
  case 6:
9748
9716
  return _context5.abrupt("return", context);
9749
9717
  case 7:
@@ -10665,7 +10633,7 @@ function getUserRoles() {
10665
10633
  */
10666
10634
  function _getUserRoles() {
10667
10635
  _getUserRoles = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee0() {
10668
- var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, authState, _t0;
10636
+ var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, _t0;
10669
10637
  return regenerator_default().wrap(function (_context1) {
10670
10638
  while (1) switch (_context1.prev = _context1.next) {
10671
10639
  case 0:
@@ -10677,30 +10645,23 @@ function _getUserRoles() {
10677
10645
  me = _yield$ensureLoadedPr.me;
10678
10646
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
10679
10647
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
10680
- if (!preferencesFileError) {
10648
+ if (!(!preferencesFile || preferencesFileError)) {
10681
10649
  _context1.next = 2;
10682
10650
  break;
10683
10651
  }
10684
10652
  throw new Error(preferencesFileError);
10685
10653
  case 2:
10686
- if (preferencesFile) {
10687
- _context1.next = 3;
10688
- break;
10689
- }
10690
- authState = me ? "logged in as ".concat(me.value || me.uri) : 'not logged in';
10691
- throw new Error("Preferences file unavailable (".concat(authState, ")"));
10692
- case 3:
10693
10654
  return _context1.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10694
- case 4:
10695
- _context1.prev = 4;
10655
+ case 3:
10656
+ _context1.prev = 3;
10696
10657
  _t0 = _context1["catch"](0);
10697
- src_debug/* warn */.R8(formatDynamicError(_t0, 'Unable to fetch your preferences'));
10658
+ src_debug/* warn */.R8('Unable to fetch your preferences - this was the error: ', _t0);
10698
10659
  return _context1.abrupt("return", []);
10699
- case 5:
10660
+ case 4:
10700
10661
  case "end":
10701
10662
  return _context1.stop();
10702
10663
  }
10703
- }, _callee0, null, [[0, 4]]);
10664
+ }, _callee0, null, [[0, 3]]);
10704
10665
  }));
10705
10666
  return _getUserRoles.apply(this, arguments);
10706
10667
  }