solid-ui 3.0.4-89e0194 → 3.0.4-8c04218

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,6 +9522,96 @@ 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
+ function guessPreferencesFileUri(me) {
9533
+ return me.uri.replace('/profile/', '/').replace('/public/', '/').split('/').slice(0, -1).join('/') + '/Settings/Preferences.ttl';
9534
+ }
9535
+ function getMissingPreferencesFileUri(context, err) {
9536
+ var _response;
9537
+ var responseUrl = err === null || err === void 0 || (_response = err.response) === null || _response === void 0 ? void 0 : _response.url;
9538
+ if (typeof responseUrl === 'string' && responseUrl) {
9539
+ return responseUrl;
9540
+ }
9541
+ if (context.me) {
9542
+ var pointer = login_store.any(context.me, src_ns.space('preferencesFile'), undefined, context.me.doc ? context.me.doc() : undefined);
9543
+ if (pointer !== null && pointer !== void 0 && pointer.uri) {
9544
+ return pointer.uri;
9545
+ }
9546
+ return guessPreferencesFileUri(context.me);
9547
+ }
9548
+ return null;
9549
+ }
9550
+ function createPreferencesFile(_x, _x2) {
9551
+ return _createPreferencesFile.apply(this, arguments);
9552
+ }
9553
+ function _createPreferencesFile() {
9554
+ _createPreferencesFile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(context, uri) {
9555
+ var initialData;
9556
+ return regenerator_default().wrap(function (_context4) {
9557
+ while (1) switch (_context4.prev = _context4.next) {
9558
+ case 0:
9559
+ if (login_store.fetcher) {
9560
+ _context4.next = 1;
9561
+ break;
9562
+ }
9563
+ throw new Error('Cannot create preferences file: store has no fetcher');
9564
+ case 1:
9565
+ initialData = '# Preferences file created by solid-ui\n';
9566
+ _context4.next = 2;
9567
+ return login_store.fetcher.webOperation('PUT', uri, {
9568
+ data: initialData,
9569
+ contentType: 'text/turtle'
9570
+ });
9571
+ case 2:
9572
+ if (context.me) {
9573
+ _context4.next = 3;
9574
+ break;
9575
+ }
9576
+ throw new Error('Cannot reload preferences file: no logged-in WebID');
9577
+ case 3:
9578
+ _context4.next = 4;
9579
+ return loadPreferences(context.me);
9580
+ case 4:
9581
+ context.preferencesFile = _context4.sent;
9582
+ context.preferencesFileError = undefined;
9583
+ case 5:
9584
+ case "end":
9585
+ return _context4.stop();
9586
+ }
9587
+ }, _callee4);
9588
+ }));
9589
+ return _createPreferencesFile.apply(this, arguments);
9590
+ }
9591
+ function offerCreatePreferencesFile(context, uri, baseMessage) {
9592
+ if (context.div && context.dom) {
9593
+ var box = context.dom.createElement('div');
9594
+ box.appendChild(errorMessageBlock(context.dom, "".concat(baseMessage, " Create it now?")));
9595
+ var createButton = context.dom.createElement('button');
9596
+ createButton.textContent = 'Create preferences file';
9597
+ createButton.setAttribute('style', style.buttonStyle);
9598
+ createButton.addEventListener('click', function () {
9599
+ createButton.disabled = true;
9600
+ createPreferencesFile(context, uri).then(function () {
9601
+ box.appendChild(errorMessageBlock(context.dom, "Preferences file created: ".concat(uri), '#dfd'));
9602
+ })["catch"](function (error) {
9603
+ var message = formatDynamicError(error, 'Failed to create preferences file');
9604
+ box.appendChild(errorMessageBlock(context.dom, message));
9605
+ src_debug/* error */.z3(message);
9606
+ createButton.disabled = false;
9607
+ });
9608
+ });
9609
+ box.appendChild(createButton);
9610
+ context.div.appendChild(box);
9611
+ return;
9612
+ }
9613
+ src_debug/* warn */.R8("".concat(baseMessage, " You can create it at: ").concat(uri));
9614
+ }
9525
9615
 
9526
9616
  /**
9527
9617
  * Resolves with the logged in user's WebID
@@ -9563,7 +9653,7 @@ function ensureLoggedIn(context) {
9563
9653
  * @param context
9564
9654
  */
9565
9655
  // used to be logInLoadPreferences
9566
- function ensureLoadedPreferences(_x) {
9656
+ function ensureLoadedPreferences(_x3) {
9567
9657
  return _ensureLoadedPreferences.apply(this, arguments);
9568
9658
  }
9569
9659
 
@@ -9576,98 +9666,125 @@ function ensureLoadedPreferences(_x) {
9576
9666
  */
9577
9667
  // used to be logInLoadProfile
9578
9668
  function _ensureLoadedPreferences() {
9579
- _ensureLoadedPreferences = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(context) {
9580
- var progressDisplay, preferencesFile, m2, _t4;
9581
- return regenerator_default().wrap(function (_context4) {
9582
- while (1) switch (_context4.prev = _context4.next) {
9669
+ _ensureLoadedPreferences = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9670
+ var progressDisplay, preferencesFile, m2, missingPreferencesFileUri, _t4;
9671
+ return regenerator_default().wrap(function (_context5) {
9672
+ while (1) switch (_context5.prev = _context5.next) {
9583
9673
  case 0:
9584
9674
  if (!context.preferencesFile) {
9585
- _context4.next = 1;
9675
+ _context5.next = 1;
9586
9676
  break;
9587
9677
  }
9588
- return _context4.abrupt("return", Promise.resolve(context));
9678
+ return _context5.abrupt("return", Promise.resolve(context));
9589
9679
  case 1:
9590
- _context4.prev = 1;
9591
- _context4.next = 2;
9680
+ _context5.prev = 1;
9681
+ _context5.next = 2;
9592
9682
  return ensureLoadedProfile(context);
9593
9683
  case 2:
9594
- context = _context4.sent;
9595
- _context4.next = 3;
9596
- return loadPreferences(context.me);
9684
+ context = _context5.sent;
9685
+ if (context.me) {
9686
+ _context5.next = 3;
9687
+ break;
9688
+ }
9689
+ context.preferencesFileError = 'Not logged in, so preferences were not loaded.';
9690
+ src_debug/* log */.Rm('not logged in, no preferences loaded');
9691
+ return _context5.abrupt("return", context);
9597
9692
  case 3:
9598
- preferencesFile = _context4.sent;
9693
+ _context5.next = 4;
9694
+ return loadPreferences(context.me);
9695
+ case 4:
9696
+ preferencesFile = _context5.sent;
9599
9697
  if (progressDisplay) {
9600
9698
  progressDisplay.parentNode.removeChild(progressDisplay);
9601
9699
  }
9602
9700
  context.preferencesFile = preferencesFile;
9603
- _context4.next = 11;
9701
+ _context5.next = 13;
9604
9702
  break;
9605
- case 4:
9606
- _context4.prev = 4;
9607
- _t4 = _context4["catch"](1);
9703
+ case 5:
9704
+ _context5.prev = 5;
9705
+ _t4 = _context5["catch"](1);
9608
9706
  if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError)) {
9609
- _context4.next = 5;
9707
+ _context5.next = 6;
9610
9708
  break;
9611
9709
  }
9612
9710
  m2 = 'Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.';
9711
+ context.preferencesFileError = m2;
9613
9712
  log_alert(m2);
9614
- _context4.next = 11;
9615
- break;
9616
- case 5:
9713
+ return _context5.abrupt("return", context);
9714
+ case 6:
9617
9715
  if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9618
- _context4.next = 6;
9716
+ _context5.next = 7;
9619
9717
  break;
9620
9718
  }
9621
- m2 = "Unauthorized: Assuming preference file blocked for origin ".concat(window.location.origin);
9719
+ m2 = "Blocked by origin: preference file request from ".concat(window.location.origin, " was forbidden. Ensure this app origin is trusted/allowed for your preferences file.");
9622
9720
  context.preferencesFileError = m2;
9623
- return _context4.abrupt("return", context);
9624
- case 6:
9721
+ return _context5.abrupt("return", context);
9722
+ case 7:
9625
9723
  if (!(_t4 instanceof external_SolidLogic_.SameOriginForbiddenError)) {
9626
- _context4.next = 7;
9724
+ _context5.next = 8;
9627
9725
  break;
9628
9726
  }
9629
- m2 = 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.';
9727
+ m2 = 'You are not authorized to read your preference file from this app context.';
9728
+ context.preferencesFileError = m2;
9630
9729
  src_debug/* warn */.R8(m2);
9631
- return _context4.abrupt("return", context);
9632
- case 7:
9730
+ return _context5.abrupt("return", context);
9731
+ case 8:
9633
9732
  if (!(_t4 instanceof external_SolidLogic_.NotEditableError)) {
9634
- _context4.next = 8;
9733
+ _context5.next = 9;
9635
9734
  break;
9636
9735
  }
9637
- m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9736
+ m2 = 'You are not authorized to edit your preference file from this app context.';
9737
+ context.preferencesFileError = m2;
9638
9738
  src_debug/* warn */.R8(m2);
9639
- return _context4.abrupt("return", context);
9640
- case 8:
9739
+ return _context5.abrupt("return", context);
9740
+ case 9:
9641
9741
  if (!(_t4 instanceof external_SolidLogic_.WebOperationError)) {
9642
- _context4.next = 9;
9742
+ _context5.next = 10;
9643
9743
  break;
9644
9744
  }
9645
- m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9745
+ m2 = formatDynamicError(_t4, 'Preference file web operation failed');
9746
+ context.preferencesFileError = m2;
9646
9747
  src_debug/* warn */.R8(m2);
9647
- _context4.next = 11;
9648
- break;
9649
- case 9:
9748
+ return _context5.abrupt("return", context);
9749
+ case 10:
9650
9750
  if (!(_t4 instanceof external_SolidLogic_.FetchError)) {
9651
- _context4.next = 10;
9751
+ _context5.next = 12;
9652
9752
  break;
9653
9753
  }
9654
- m2 = "Strange: Error ".concat(_t4.status, " trying to read your preference file.").concat(_t4.message);
9655
- log_alert(m2);
9656
- _context4.next = 11;
9657
- break;
9658
- case 10:
9659
- throw new Error("(via loadPrefs) ".concat(_t4));
9754
+ if (!(_t4.status === 404)) {
9755
+ _context5.next = 11;
9756
+ break;
9757
+ }
9758
+ m2 = 'Your preferences file was not found (404). It may not exist yet.';
9759
+ context.preferencesFileError = m2;
9760
+ src_debug/* warn */.R8(m2);
9761
+ missingPreferencesFileUri = getMissingPreferencesFileUri(context, _t4);
9762
+ if (missingPreferencesFileUri) {
9763
+ offerCreatePreferencesFile(context, missingPreferencesFileUri, m2);
9764
+ }
9765
+ return _context5.abrupt("return", context);
9660
9766
  case 11:
9661
- return _context4.abrupt("return", context);
9767
+ m2 = formatDynamicError(_t4, 'Error reading your preferences file');
9768
+ context.preferencesFileError = m2;
9769
+ src_debug/* warn */.R8(m2);
9770
+ log_alert(m2);
9771
+ return _context5.abrupt("return", context);
9662
9772
  case 12:
9773
+ m2 = formatDynamicError(_t4, 'Unexpected error while loading preferences');
9774
+ context.preferencesFileError = m2;
9775
+ src_debug/* error */.z3(m2);
9776
+ return _context5.abrupt("return", context);
9777
+ case 13:
9778
+ return _context5.abrupt("return", context);
9779
+ case 14:
9663
9780
  case "end":
9664
- return _context4.stop();
9781
+ return _context5.stop();
9665
9782
  }
9666
- }, _callee4, null, [[1, 4]]);
9783
+ }, _callee5, null, [[1, 5]]);
9667
9784
  }));
9668
9785
  return _ensureLoadedPreferences.apply(this, arguments);
9669
9786
  }
9670
- function ensureLoadedProfile(_x2) {
9787
+ function ensureLoadedProfile(_x4) {
9671
9788
  return _ensureLoadedProfile.apply(this, arguments);
9672
9789
  }
9673
9790
 
@@ -9677,69 +9794,72 @@ function ensureLoadedProfile(_x2) {
9677
9794
  * leaving the `isPublic` param undefined will bring in community index things, too
9678
9795
  */
9679
9796
  function _ensureLoadedProfile() {
9680
- _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9681
- var logInContext, _t5;
9682
- return regenerator_default().wrap(function (_context5) {
9683
- while (1) switch (_context5.prev = _context5.next) {
9797
+ _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee6(context) {
9798
+ var logInContext, message, _message, _t5;
9799
+ return regenerator_default().wrap(function (_context6) {
9800
+ while (1) switch (_context6.prev = _context6.next) {
9684
9801
  case 0:
9685
9802
  if (!context.publicProfile) {
9686
- _context5.next = 1;
9803
+ _context6.next = 1;
9687
9804
  break;
9688
9805
  }
9689
- return _context5.abrupt("return", context);
9806
+ return _context6.abrupt("return", context);
9690
9807
  case 1:
9691
- _context5.prev = 1;
9692
- _context5.next = 2;
9808
+ _context6.prev = 1;
9809
+ _context6.next = 2;
9693
9810
  return ensureLoggedIn(context);
9694
9811
  case 2:
9695
- logInContext = _context5.sent;
9812
+ logInContext = _context6.sent;
9696
9813
  if (logInContext.me) {
9697
- _context5.next = 3;
9814
+ _context6.next = 3;
9698
9815
  break;
9699
9816
  }
9700
- throw new Error('Could not log in');
9817
+ message = 'Could not log in; skipping profile load.';
9818
+ src_debug/* log */.Rm(message);
9819
+ throw new Error(message);
9701
9820
  case 3:
9702
- _context5.next = 4;
9821
+ _context6.next = 4;
9703
9822
  return loadProfile(logInContext.me);
9704
9823
  case 4:
9705
- context.publicProfile = _context5.sent;
9706
- _context5.next = 6;
9824
+ context.publicProfile = _context6.sent;
9825
+ _context6.next = 6;
9707
9826
  break;
9708
9827
  case 5:
9709
- _context5.prev = 5;
9710
- _t5 = _context5["catch"](1);
9828
+ _context6.prev = 5;
9829
+ _t5 = _context6["catch"](1);
9830
+ _message = formatDynamicError(_t5, 'Unable to load your profile');
9711
9831
  if (context.div && context.dom) {
9712
- context.div.appendChild(errorMessageBlock(context.dom, _t5.message));
9832
+ context.div.appendChild(errorMessageBlock(context.dom, _message));
9713
9833
  }
9714
- throw new Error("Can't log in: ".concat(_t5));
9834
+ throw new Error(_message);
9715
9835
  case 6:
9716
- return _context5.abrupt("return", context);
9836
+ return _context6.abrupt("return", context);
9717
9837
  case 7:
9718
9838
  case "end":
9719
- return _context5.stop();
9839
+ return _context6.stop();
9720
9840
  }
9721
- }, _callee5, null, [[1, 5]]);
9841
+ }, _callee6, null, [[1, 5]]);
9722
9842
  }));
9723
9843
  return _ensureLoadedProfile.apply(this, arguments);
9724
9844
  }
9725
- function findAppInstances(_x3, _x4, _x5) {
9845
+ function findAppInstances(_x5, _x6, _x7) {
9726
9846
  return _findAppInstances.apply(this, arguments);
9727
9847
  }
9728
9848
  function _findAppInstances() {
9729
- _findAppInstances = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee6(context, theClass, isPublic) {
9849
+ _findAppInstances = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee7(context, theClass, isPublic) {
9730
9850
  var items, _t6;
9731
- return regenerator_default().wrap(function (_context6) {
9732
- while (1) switch (_context6.prev = _context6.next) {
9851
+ return regenerator_default().wrap(function (_context7) {
9852
+ while (1) switch (_context7.prev = _context7.next) {
9733
9853
  case 0:
9734
9854
  if (!context.me) {
9735
- _context6.next = 2;
9855
+ _context7.next = 2;
9736
9856
  break;
9737
9857
  }
9738
- _context6.next = 1;
9858
+ _context7.next = 1;
9739
9859
  return getScopedAppInstances(theClass, context.me);
9740
9860
  case 1:
9741
- _t6 = _context6.sent;
9742
- _context6.next = 3;
9861
+ _t6 = _context7.sent;
9862
+ _context7.next = 3;
9743
9863
  break;
9744
9864
  case 2:
9745
9865
  _t6 = [];
@@ -9758,12 +9878,12 @@ function _findAppInstances() {
9758
9878
  context.instances = items.map(function (item) {
9759
9879
  return item.instance;
9760
9880
  });
9761
- return _context6.abrupt("return", context);
9881
+ return _context7.abrupt("return", context);
9762
9882
  case 4:
9763
9883
  case "end":
9764
- return _context6.stop();
9884
+ return _context7.stop();
9765
9885
  }
9766
- }, _callee6);
9886
+ }, _callee7);
9767
9887
  }));
9768
9888
  return _findAppInstances.apply(this, arguments);
9769
9889
  }
@@ -9775,14 +9895,14 @@ function scopeLabel(context, scope) {
9775
9895
  /**
9776
9896
  * UI to control registration of instance
9777
9897
  */
9778
- function registrationControl(_x6, _x7, _x8) {
9898
+ function registrationControl(_x8, _x9, _x0) {
9779
9899
  return _registrationControl.apply(this, arguments);
9780
9900
  }
9781
9901
  function _registrationControl() {
9782
- _registrationControl = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee7(context, instance, theClass) {
9902
+ _registrationControl = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee8(context, instance, theClass) {
9783
9903
  var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row, _t7;
9784
- return regenerator_default().wrap(function (_context7) {
9785
- while (1) switch (_context7.prev = _context7.next) {
9904
+ return regenerator_default().wrap(function (_context8) {
9905
+ while (1) switch (_context8.prev = _context8.next) {
9786
9906
  case 0:
9787
9907
  renderScopeCheckbox = function _renderScopeCheckbox(scope) {
9788
9908
  var statements = registrationStatements(scope.index);
@@ -9798,7 +9918,7 @@ function _registrationControl() {
9798
9918
  /// / body of registrationControl
9799
9919
  dom = context.dom;
9800
9920
  if (!(!dom || !context.div)) {
9801
- _context7.next = 1;
9921
+ _context8.next = 1;
9802
9922
  break;
9803
9923
  }
9804
9924
  throw new Error('registrationControl: need dom and div');
@@ -9808,22 +9928,22 @@ function _registrationControl() {
9808
9928
  context.me = external_SolidLogic_.authn.currentUser(); // @@
9809
9929
  me = context.me;
9810
9930
  if (me) {
9811
- _context7.next = 2;
9931
+ _context8.next = 2;
9812
9932
  break;
9813
9933
  }
9814
9934
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
9815
- return _context7.abrupt("return", context);
9935
+ return _context8.abrupt("return", context);
9816
9936
  case 2:
9817
- _context7.prev = 2;
9818
- _context7.next = 3;
9937
+ _context8.prev = 2;
9938
+ _context8.next = 3;
9819
9939
  return loadAllTypeIndexes(me);
9820
9940
  case 3:
9821
- scopes = _context7.sent;
9822
- _context7.next = 5;
9941
+ scopes = _context8.sent;
9942
+ _context8.next = 5;
9823
9943
  break;
9824
9944
  case 4:
9825
- _context7.prev = 4;
9826
- _t7 = _context7["catch"](2);
9945
+ _context8.prev = 4;
9946
+ _t7 = _context8["catch"](2);
9827
9947
  if (context.div && context.preferencesFileError) {
9828
9948
  msg = '(Lists of stuff not available)';
9829
9949
  context.div.appendChild(dom.createElement('p')).textContent = msg;
@@ -9832,7 +9952,7 @@ function _registrationControl() {
9832
9952
  context.div.appendChild(errorMessageBlock(context.dom, _t7));
9833
9953
  }
9834
9954
  src_debug/* log */.Rm(msg);
9835
- return _context7.abrupt("return", context);
9955
+ return _context8.abrupt("return", context);
9836
9956
  case 5:
9837
9957
  box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
9838
9958
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
@@ -9850,12 +9970,12 @@ function _registrationControl() {
9850
9970
  } finally {
9851
9971
  _iterator.f();
9852
9972
  }
9853
- return _context7.abrupt("return", context);
9973
+ return _context8.abrupt("return", context);
9854
9974
  case 6:
9855
9975
  case "end":
9856
- return _context7.stop();
9976
+ return _context8.stop();
9857
9977
  }
9858
- }, _callee7, null, [[2, 4]]);
9978
+ }, _callee8, null, [[2, 4]]);
9859
9979
  }));
9860
9980
  return _registrationControl.apply(this, arguments);
9861
9981
  }
@@ -9878,7 +9998,7 @@ function renderScopeHeadingRow(context, store, scope) {
9878
9998
  /**
9879
9999
  * UI to List at all registered things
9880
10000
  */
9881
- function registrationList(_x9, _x0) {
10001
+ function registrationList(_x1, _x10) {
9882
10002
  return _registrationList.apply(this, arguments);
9883
10003
  } // registrationList
9884
10004
 
@@ -9892,10 +10012,10 @@ function registrationList(_x9, _x0) {
9892
10012
  * @returns
9893
10013
  */
9894
10014
  function _registrationList() {
9895
- _registrationList = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee9(context, options) {
10015
+ _registrationList = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee0(context, options) {
9896
10016
  var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop, _t8, _t9;
9897
- return regenerator_default().wrap(function (_context0) {
9898
- while (1) switch (_context0.prev = _context0.next) {
10017
+ return regenerator_default().wrap(function (_context1) {
10018
+ while (1) switch (_context1.prev = _context1.next) {
9899
10019
  case 0:
9900
10020
  dom = context.dom;
9901
10021
  div = context.div;
@@ -9903,16 +10023,16 @@ function _registrationList() {
9903
10023
  div.appendChild(box);
9904
10024
  context.me = external_SolidLogic_.authn.currentUser(); // @@
9905
10025
  if (context.me) {
9906
- _context0.next = 1;
10026
+ _context1.next = 1;
9907
10027
  break;
9908
10028
  }
9909
10029
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
9910
- return _context0.abrupt("return", context);
10030
+ return _context1.abrupt("return", context);
9911
10031
  case 1:
9912
- _context0.next = 2;
10032
+ _context1.next = 2;
9913
10033
  return loadAllTypeIndexes(context.me);
9914
10034
  case 2:
9915
- scopes = _context0.sent;
10035
+ scopes = _context1.sent;
9916
10036
  // includes community indexes
9917
10037
 
9918
10038
  // console.log('@@ registrationList ', scopes)
@@ -9921,47 +10041,47 @@ function _registrationList() {
9921
10041
  table = box.firstChild;
9922
10042
  tbody = table.firstChild;
9923
10043
  _iterator2 = login_createForOfIteratorHelper(scopes);
9924
- _context0.prev = 3;
10044
+ _context1.prev = 3;
9925
10045
  _iterator2.s();
9926
10046
  case 4:
9927
10047
  if ((_step2 = _iterator2.n()).done) {
9928
- _context0.next = 13;
10048
+ _context1.next = 13;
9929
10049
  break;
9930
10050
  }
9931
10051
  scope = _step2.value;
9932
10052
  // need some predicate for listing/adding agents
9933
10053
  headingRow = renderScopeHeadingRow(context, login_store, scope);
9934
10054
  tbody.appendChild(headingRow);
9935
- _context0.next = 5;
10055
+ _context1.next = 5;
9936
10056
  return getScopedAppsFromIndex(scope, options.type || null);
9937
10057
  case 5:
9938
- items = _context0.sent;
10058
+ items = _context1.sent;
9939
10059
  // any class
9940
10060
  if (items.length === 0) headingRow.style.display = 'none';
9941
10061
  // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
9942
10062
  _iterator3 = login_createForOfIteratorHelper(items);
9943
- _context0.prev = 6;
10063
+ _context1.prev = 6;
9944
10064
  _loop = /*#__PURE__*/regenerator_default().mark(function _loop() {
9945
10065
  var item, row;
9946
- return regenerator_default().wrap(function (_context9) {
9947
- while (1) switch (_context9.prev = _context9.next) {
10066
+ return regenerator_default().wrap(function (_context0) {
10067
+ while (1) switch (_context0.prev = _context0.next) {
9948
10068
  case 0:
9949
10069
  item = _step3.value;
9950
10070
  row = personTR(dom, src_ns.solid('instance'), item.instance, {
9951
10071
  deleteFunction: function () {
9952
- var _deleteFunction = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee8() {
9953
- return regenerator_default().wrap(function (_context8) {
9954
- while (1) switch (_context8.prev = _context8.next) {
10072
+ var _deleteFunction = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee9() {
10073
+ return regenerator_default().wrap(function (_context9) {
10074
+ while (1) switch (_context9.prev = _context9.next) {
9955
10075
  case 0:
9956
- _context8.next = 1;
10076
+ _context9.next = 1;
9957
10077
  return deleteTypeIndexRegistration(item);
9958
10078
  case 1:
9959
10079
  tbody.removeChild(row);
9960
10080
  case 2:
9961
10081
  case "end":
9962
- return _context8.stop();
10082
+ return _context9.stop();
9963
10083
  }
9964
- }, _callee8);
10084
+ }, _callee9);
9965
10085
  }));
9966
10086
  function deleteFunction() {
9967
10087
  return _deleteFunction.apply(this, arguments);
@@ -9973,52 +10093,52 @@ function _registrationList() {
9973
10093
  tbody.appendChild(row);
9974
10094
  case 1:
9975
10095
  case "end":
9976
- return _context9.stop();
10096
+ return _context0.stop();
9977
10097
  }
9978
10098
  }, _loop);
9979
10099
  });
9980
10100
  _iterator3.s();
9981
10101
  case 7:
9982
10102
  if ((_step3 = _iterator3.n()).done) {
9983
- _context0.next = 9;
10103
+ _context1.next = 9;
9984
10104
  break;
9985
10105
  }
9986
- return _context0.delegateYield(_loop(), "t0", 8);
10106
+ return _context1.delegateYield(_loop(), "t0", 8);
9987
10107
  case 8:
9988
- _context0.next = 7;
10108
+ _context1.next = 7;
9989
10109
  break;
9990
10110
  case 9:
9991
- _context0.next = 11;
10111
+ _context1.next = 11;
9992
10112
  break;
9993
10113
  case 10:
9994
- _context0.prev = 10;
9995
- _t8 = _context0["catch"](6);
10114
+ _context1.prev = 10;
10115
+ _t8 = _context1["catch"](6);
9996
10116
  _iterator3.e(_t8);
9997
10117
  case 11:
9998
- _context0.prev = 11;
10118
+ _context1.prev = 11;
9999
10119
  _iterator3.f();
10000
- return _context0.finish(11);
10120
+ return _context1.finish(11);
10001
10121
  case 12:
10002
- _context0.next = 4;
10122
+ _context1.next = 4;
10003
10123
  break;
10004
10124
  case 13:
10005
- _context0.next = 15;
10125
+ _context1.next = 15;
10006
10126
  break;
10007
10127
  case 14:
10008
- _context0.prev = 14;
10009
- _t9 = _context0["catch"](3);
10128
+ _context1.prev = 14;
10129
+ _t9 = _context1["catch"](3);
10010
10130
  _iterator2.e(_t9);
10011
10131
  case 15:
10012
- _context0.prev = 15;
10132
+ _context1.prev = 15;
10013
10133
  _iterator2.f();
10014
- return _context0.finish(15);
10134
+ return _context1.finish(15);
10015
10135
  case 16:
10016
- return _context0.abrupt("return", context);
10136
+ return _context1.abrupt("return", context);
10017
10137
  case 17:
10018
10138
  case "end":
10019
- return _context0.stop();
10139
+ return _context1.stop();
10020
10140
  }
10021
- }, _callee9, null, [[3, 14, 15, 16], [6, 10, 11, 12]]);
10141
+ }, _callee0, null, [[3, 14, 15, 16], [6, 10, 11, 12]]);
10022
10142
  }));
10023
10143
  return _registrationList.apply(this, arguments);
10024
10144
  }
@@ -10149,7 +10269,7 @@ function renderSignInPopup(dom) {
10149
10269
  }
10150
10270
  }, _callee, null, [[0, 2]]);
10151
10271
  }));
10152
- return function loginToIssuer(_x1) {
10272
+ return function loginToIssuer(_x11) {
10153
10273
  return _ref.apply(this, arguments);
10154
10274
  };
10155
10275
  }();
@@ -10396,7 +10516,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
10396
10516
  }
10397
10517
  function displayOptions(context) {
10398
10518
  // console.log('displayOptions!', context)
10399
- function makeNewWorkspace(_x10) {
10519
+ function makeNewWorkspace(_x12) {
10400
10520
  return _makeNewWorkspace.apply(this, arguments);
10401
10521
  } // const status = ''
10402
10522
  function _makeNewWorkspace() {
@@ -10632,60 +10752,67 @@ function getUserRoles() {
10632
10752
  * Filters which panes should be available, based on the result of [[getUserRoles]]
10633
10753
  */
10634
10754
  function _getUserRoles() {
10635
- _getUserRoles = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee0() {
10636
- var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, _t0;
10637
- return regenerator_default().wrap(function (_context1) {
10638
- while (1) switch (_context1.prev = _context1.next) {
10755
+ _getUserRoles = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee1() {
10756
+ var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, authState, _t0;
10757
+ return regenerator_default().wrap(function (_context10) {
10758
+ while (1) switch (_context10.prev = _context10.next) {
10639
10759
  case 0:
10640
- _context1.prev = 0;
10641
- _context1.next = 1;
10760
+ _context10.prev = 0;
10761
+ _context10.next = 1;
10642
10762
  return ensureLoadedPreferences({});
10643
10763
  case 1:
10644
- _yield$ensureLoadedPr = _context1.sent;
10764
+ _yield$ensureLoadedPr = _context10.sent;
10645
10765
  me = _yield$ensureLoadedPr.me;
10646
10766
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
10647
10767
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
10648
- if (!(!preferencesFile || preferencesFileError)) {
10649
- _context1.next = 2;
10768
+ if (!preferencesFileError) {
10769
+ _context10.next = 2;
10650
10770
  break;
10651
10771
  }
10652
10772
  throw new Error(preferencesFileError);
10653
10773
  case 2:
10654
- return _context1.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10774
+ if (preferencesFile) {
10775
+ _context10.next = 3;
10776
+ break;
10777
+ }
10778
+ authState = me ? "logged in as ".concat(me.value || me.uri) : 'not logged in';
10779
+ throw new Error("Preferences file unavailable (".concat(authState, ")"));
10655
10780
  case 3:
10656
- _context1.prev = 3;
10657
- _t0 = _context1["catch"](0);
10658
- src_debug/* warn */.R8('Unable to fetch your preferences - this was the error: ', _t0);
10659
- return _context1.abrupt("return", []);
10781
+ return _context10.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10660
10782
  case 4:
10783
+ _context10.prev = 4;
10784
+ _t0 = _context10["catch"](0);
10785
+ src_debug/* warn */.R8(formatDynamicError(_t0, 'Unable to fetch your preferences'));
10786
+ return _context10.abrupt("return", []);
10787
+ case 5:
10661
10788
  case "end":
10662
- return _context1.stop();
10789
+ return _context10.stop();
10663
10790
  }
10664
- }, _callee0, null, [[0, 3]]);
10791
+ }, _callee1, null, [[0, 4]]);
10665
10792
  }));
10666
10793
  return _getUserRoles.apply(this, arguments);
10667
10794
  }
10668
- function filterAvailablePanes(_x11) {
10795
+ function filterAvailablePanes(_x13) {
10669
10796
  return _filterAvailablePanes.apply(this, arguments);
10670
10797
  }
10671
10798
  function _filterAvailablePanes() {
10672
- _filterAvailablePanes = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee1(panes) {
10799
+ _filterAvailablePanes = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee10(panes) {
10673
10800
  var userRoles;
10674
- return regenerator_default().wrap(function (_context10) {
10675
- while (1) switch (_context10.prev = _context10.next) {
10801
+ return regenerator_default().wrap(function (_context11) {
10802
+ while (1) switch (_context11.prev = _context11.next) {
10676
10803
  case 0:
10677
- _context10.next = 1;
10804
+ _context11.next = 1;
10678
10805
  return getUserRoles();
10679
10806
  case 1:
10680
- userRoles = _context10.sent;
10681
- return _context10.abrupt("return", panes.filter(function (pane) {
10807
+ userRoles = _context11.sent;
10808
+ return _context11.abrupt("return", panes.filter(function (pane) {
10682
10809
  return isMatchingAudience(pane, userRoles);
10683
10810
  }));
10684
10811
  case 2:
10685
10812
  case "end":
10686
- return _context10.stop();
10813
+ return _context11.stop();
10687
10814
  }
10688
- }, _callee1);
10815
+ }, _callee10);
10689
10816
  }));
10690
10817
  return _filterAvailablePanes.apply(this, arguments);
10691
10818
  }