solid-ui 2.4.19-c5a8888d → 2.4.19-d2eb760d

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.
@@ -645,6 +645,7 @@ var EXPLANATION = {
645
645
  * for https://github.com/solid/userguide/blob/main/views/sharing/userguide.md
646
646
  */
647
647
  var AccessGroups = /*#__PURE__*/function () {
648
+ // @@ was LiveStore but does not need to be connected to web
648
649
  function AccessGroups(doc, aclDoc, controller, store) {
649
650
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
650
651
  (0, _classCallCheck2["default"])(this, AccessGroups);
@@ -7915,6 +7916,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
7915
7916
  * * `containers` An array of nodes of containers of instances
7916
7917
  * * `div` A DOM element where UI can be displayed
7917
7918
  * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
7919
+ * *
7920
+ * * Vocabulary: "load" loads a file if it exists;
7921
+ * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
7918
7922
  * @packageDocumentation
7919
7923
  */
7920
7924
 
@@ -8334,141 +8338,231 @@ function _findAppInstances() {
8334
8338
  return _findAppInstances.apply(this, arguments);
8335
8339
  }
8336
8340
 
8337
- function registrationControl(context, instance, theClass) {
8338
- var dom = context.dom;
8341
+ function registrationControl(_x7, _x8, _x9) {
8342
+ return _registrationControl.apply(this, arguments);
8343
+ }
8344
+ /**
8345
+ * UI to List at all registered things
8346
+ */
8339
8347
 
8340
- if (!dom || !context.div) {
8341
- return Promise.resolve();
8342
- }
8343
8348
 
8344
- var box = dom.createElement('div');
8345
- context.div.appendChild(box);
8346
- return (0, _solidLogic.ensureTypeIndexes)(context).then(function () {
8347
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
8349
+ function _registrationControl() {
8350
+ _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
8351
+ var dom, box, context2, msg, tbody, form, registrationStatements, index, statements, _msg;
8348
8352
 
8349
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
8350
- var tbody = box.children[0].children[0];
8351
- var form = new _rdflib.BlankNode(); // @@ say for now
8353
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
8354
+ while (1) {
8355
+ switch (_context7.prev = _context7.next) {
8356
+ case 0:
8357
+ dom = context.dom;
8352
8358
 
8353
- var registrationStatements = function registrationStatements(index) {
8354
- var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8359
+ if (!(!dom || !context.div)) {
8360
+ _context7.next = 3;
8361
+ break;
8362
+ }
8355
8363
 
8356
- var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8357
- return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8358
- };
8364
+ return _context7.abrupt("return", context);
8359
8365
 
8360
- var index, statements;
8366
+ case 3:
8367
+ box = dom.createElement('div');
8368
+ context.div.appendChild(box);
8369
+ context.me = _solidLogic.authn.currentUser(); // @@
8361
8370
 
8362
- if (context.index && context.index["public"] && context.index["public"].length > 0) {
8363
- index = context.index["public"][0];
8364
- statements = registrationStatements(index);
8365
- tbody.children[0].appendChild(widgets.buildCheckBoxForm(context.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context.noun), null, statements, form, index));
8366
- }
8371
+ if (context.me) {
8372
+ _context7.next = 9;
8373
+ break;
8374
+ }
8367
8375
 
8368
- if (context.index && context.index["private"] && context.index["private"].length > 0) {
8369
- index = context.index["private"][0];
8370
- statements = registrationStatements(index);
8371
- tbody.children[1].appendChild(widgets.buildCheckBoxForm(context.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context.noun), null, statements, form, index));
8372
- }
8376
+ box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
8377
+ return _context7.abrupt("return", context);
8373
8378
 
8374
- return context;
8375
- }, function (e) {
8376
- var msg;
8379
+ case 9:
8380
+ _context7.prev = 9;
8381
+ _context7.next = 12;
8382
+ return (0, _solidLogic.ensureTypeIndexes)(context);
8377
8383
 
8378
- if (context.div && context.preferencesFileError) {
8379
- msg = '(Preferences not available)';
8380
- context.div.appendChild(dom.createElement('p')).textContent = msg;
8381
- } else if (context.div) {
8382
- msg = "registrationControl: Type indexes not available: ".concat(e);
8383
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
8384
- }
8384
+ case 12:
8385
+ context2 = _context7.sent;
8386
+ _context7.next = 19;
8387
+ break;
8385
8388
 
8386
- debug.log(msg);
8387
- })["catch"](function (e) {
8388
- var msg = "registrationControl: Error making panel: ".concat(e);
8389
+ case 15:
8390
+ _context7.prev = 15;
8391
+ _context7.t0 = _context7["catch"](9);
8392
+
8393
+ if (context.div && context.preferencesFileError) {
8394
+ msg = '(Preferences not available)';
8395
+ context.div.appendChild(dom.createElement('p')).textContent = msg;
8396
+ } else if (context.div) {
8397
+ msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
8398
+ context.div.appendChild(widgets.errorMessageBlock(context.dom, _context7.t0));
8399
+ }
8389
8400
 
8390
- if (context.div) {
8391
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
8392
- }
8401
+ debug.log(msg);
8393
8402
 
8394
- debug.log(msg);
8395
- });
8396
- }
8397
- /**
8398
- * UI to List at all registered things
8399
- */
8403
+ case 19:
8404
+ box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
8400
8405
 
8406
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
8407
+ tbody = box.children[0].children[0];
8408
+ form = new _rdflib.BlankNode(); // @@ say for now
8401
8409
 
8402
- function registrationList(context, options) {
8403
- var dom = context.dom;
8404
- var div = context.div;
8405
- var box = dom.createElement('div');
8406
- div.appendChild(box);
8407
- return (0, _solidLogic.ensureTypeIndexes)(context).then(function (_indexes) {
8408
- box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8409
-
8410
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8411
- var table = box.firstChild;
8412
- var ix = [];
8413
- var sts = [];
8414
- var vs = ['private', 'public'];
8415
- vs.forEach(function (visibility) {
8416
- if (context.index && options[visibility]) {
8417
- ix = ix.concat(context.index[visibility][0]);
8418
- sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
8419
- }
8420
- });
8410
+ registrationStatements = function registrationStatements(index) {
8411
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8421
8412
 
8422
- var _loop = function _loop(i) {
8423
- var statement = sts[i];
8413
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8414
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8415
+ };
8424
8416
 
8425
- if (options.type) {
8426
- // now check terms:forClass
8427
- if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
8428
- return "continue"; // skip irrelevant ones
8429
- }
8430
- } // const cla = statement.subject
8417
+ try {
8418
+ if (context2.index && context2.index["public"] && context2.index["public"].length > 0) {
8419
+ index = context2.index["public"][0];
8420
+ statements = registrationStatements(index);
8421
+ tbody.children[0].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context2.noun), null, statements, form, index));
8422
+ }
8431
8423
 
8424
+ if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
8425
+ index = context2.index["private"][0];
8426
+ statements = registrationStatements(index);
8427
+ tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
8428
+ }
8429
+ } catch (e) {
8430
+ _msg = "registrationControl: Error making panel: ".concat(e);
8432
8431
 
8433
- var inst = statement.object;
8434
- table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
8435
- deleteFunction: function deleteFunction(_x) {
8436
- if (!_solidLogic.solidLogicSingleton.store.updater) {
8437
- throw new Error('Cannot delete this, store has no updater');
8438
- }
8432
+ if (context.div) {
8433
+ context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
8434
+ }
8439
8435
 
8440
- _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
8441
- if (ok) {
8442
- debug.log("Removed from index: ".concat(statement.subject));
8443
- } else {
8444
- debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
8436
+ debug.log(_msg);
8445
8437
  }
8446
- });
8438
+
8439
+ return _context7.abrupt("return", context2);
8440
+
8441
+ case 26:
8442
+ case "end":
8443
+ return _context7.stop();
8447
8444
  }
8448
- }));
8449
- };
8445
+ }
8446
+ }, _callee7, null, [[9, 15]]);
8447
+ }));
8448
+ return _registrationControl.apply(this, arguments);
8449
+ }
8450
8450
 
8451
- for (var i = 0; i < sts.length; i++) {
8452
- var _ret = _loop(i);
8451
+ function registrationList(_x10, _x11) {
8452
+ return _registrationList.apply(this, arguments);
8453
+ }
8453
8454
 
8454
- if (_ret === "continue") continue;
8455
- } // registrationList
8455
+ function _registrationList() {
8456
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(context0, options) {
8457
+ var dom, div, box;
8458
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
8459
+ while (1) {
8460
+ switch (_context8.prev = _context8.next) {
8461
+ case 0:
8462
+ dom = context0.dom;
8463
+ div = context0.div;
8464
+ box = dom.createElement('div');
8465
+ div.appendChild(box);
8466
+ context0.me = _solidLogic.authn.currentUser(); // @@
8467
+
8468
+ if (context0.me) {
8469
+ _context8.next = 8;
8470
+ break;
8471
+ }
8456
8472
 
8457
- /*
8458
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8459
- if (containers.length) {
8460
- fetcher.load(containers).then(function(xhrs){
8461
- for (const i=0; i<containers.length; i++) {
8462
- const cont = containers[i];
8463
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8464
- }
8465
- });
8466
- }
8467
- */
8473
+ box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
8474
+ return _context8.abrupt("return", context0);
8468
8475
 
8476
+ case 8:
8477
+ return _context8.abrupt("return", (0, _solidLogic.ensureTypeIndexes)(context0).then(function (context) {
8478
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8479
+
8480
+ // tbody will be inserted anyway
8481
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8482
+ var table = box.firstChild;
8483
+ var ix = [];
8484
+ var sts = [];
8485
+ var vs = ['private', 'public'];
8486
+ vs.forEach(function (visibility) {
8487
+ if (context.index && context.index[visibility].length > 0 && options[visibility]) {
8488
+ ix = ix.concat(context.index[visibility][0]);
8489
+ sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
8490
+ }
8491
+ });
8469
8492
 
8470
- return context;
8471
- });
8493
+ var _loop = function _loop(i) {
8494
+ var statement = sts[i];
8495
+
8496
+ if (options.type) {
8497
+ // now check terms:forClass
8498
+ if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
8499
+ return "continue"; // skip irrelevant ones
8500
+ }
8501
+ } // const cla = statement.subject
8502
+
8503
+
8504
+ // const cla = statement.subject
8505
+ var inst = statement.object;
8506
+ table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
8507
+ deleteFunction: function deleteFunction(_x) {
8508
+ if (!_solidLogic.solidLogicSingleton.store.updater) {
8509
+ throw new Error('Cannot delete this, store has no updater');
8510
+ }
8511
+
8512
+ _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
8513
+ if (ok) {
8514
+ debug.log("Removed from index: ".concat(statement.subject));
8515
+ } else {
8516
+ debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
8517
+ }
8518
+ });
8519
+ }
8520
+ }));
8521
+ };
8522
+
8523
+ for (var i = 0; i < sts.length; i++) {
8524
+ var _ret = _loop(i);
8525
+
8526
+ if (_ret === "continue") continue;
8527
+ } // registrationList
8528
+
8529
+ /*
8530
+ //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8531
+ if (containers.length) {
8532
+ fetcher.load(containers).then(function(xhrs){
8533
+ for (const i=0; i<containers.length; i++) {
8534
+ const cont = containers[i];
8535
+ instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8536
+ }
8537
+ });
8538
+ }
8539
+ */
8540
+
8541
+
8542
+ // registrationList
8543
+
8544
+ /*
8545
+ //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8546
+ if (containers.length) {
8547
+ fetcher.load(containers).then(function(xhrs){
8548
+ for (const i=0; i<containers.length; i++) {
8549
+ const cont = containers[i];
8550
+ instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8551
+ }
8552
+ });
8553
+ }
8554
+ */
8555
+ return context;
8556
+ }));
8557
+
8558
+ case 9:
8559
+ case "end":
8560
+ return _context8.stop();
8561
+ }
8562
+ }
8563
+ }, _callee8);
8564
+ }));
8565
+ return _registrationList.apply(this, arguments);
8472
8566
  }
8473
8567
 
8474
8568
  function getDefaultSignInButtonStyle() {
@@ -8623,7 +8717,7 @@ function renderSignInPopup(dom) {
8623
8717
  }, _callee, null, [[0, 8]]);
8624
8718
  }));
8625
8719
 
8626
- return function loginToIssuer(_x7) {
8720
+ return function loginToIssuer(_x12) {
8627
8721
  return _ref.apply(this, arguments);
8628
8722
  };
8629
8723
  }();
@@ -8910,7 +9004,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
8910
9004
 
8911
9005
  function displayOptions(context) {
8912
9006
  // console.log('displayOptions!', context)
8913
- function makeNewWorkspace(_x8) {
9007
+ function makeNewWorkspace(_x13) {
8914
9008
  return _makeNewWorkspace.apply(this, arguments);
8915
9009
  } // const status = ''
8916
9010
 
@@ -9179,77 +9273,77 @@ function getUserRoles() {
9179
9273
 
9180
9274
 
9181
9275
  function _getUserRoles() {
9182
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
9276
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
9183
9277
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
9184
9278
 
9185
- return _regenerator["default"].wrap(function _callee7$(_context7) {
9279
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
9186
9280
  while (1) {
9187
- switch (_context7.prev = _context7.next) {
9281
+ switch (_context9.prev = _context9.next) {
9188
9282
  case 0:
9189
- _context7.prev = 0;
9190
- _context7.next = 3;
9283
+ _context9.prev = 0;
9284
+ _context9.next = 3;
9191
9285
  return ensureLoadedPreferences({});
9192
9286
 
9193
9287
  case 3:
9194
- _yield$ensureLoadedPr = _context7.sent;
9288
+ _yield$ensureLoadedPr = _context9.sent;
9195
9289
  me = _yield$ensureLoadedPr.me;
9196
9290
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
9197
9291
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
9198
9292
 
9199
9293
  if (!(!preferencesFile || preferencesFileError)) {
9200
- _context7.next = 9;
9294
+ _context9.next = 9;
9201
9295
  break;
9202
9296
  }
9203
9297
 
9204
9298
  throw new Error(preferencesFileError);
9205
9299
 
9206
9300
  case 9:
9207
- return _context7.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9301
+ return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9208
9302
 
9209
9303
  case 12:
9210
- _context7.prev = 12;
9211
- _context7.t0 = _context7["catch"](0);
9212
- debug.warn('Unable to fetch your preferences - this was the error: ', _context7.t0);
9304
+ _context9.prev = 12;
9305
+ _context9.t0 = _context9["catch"](0);
9306
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context9.t0);
9213
9307
 
9214
9308
  case 15:
9215
- return _context7.abrupt("return", []);
9309
+ return _context9.abrupt("return", []);
9216
9310
 
9217
9311
  case 16:
9218
9312
  case "end":
9219
- return _context7.stop();
9313
+ return _context9.stop();
9220
9314
  }
9221
9315
  }
9222
- }, _callee7, null, [[0, 12]]);
9316
+ }, _callee9, null, [[0, 12]]);
9223
9317
  }));
9224
9318
  return _getUserRoles.apply(this, arguments);
9225
9319
  }
9226
9320
 
9227
- function filterAvailablePanes(_x9) {
9321
+ function filterAvailablePanes(_x14) {
9228
9322
  return _filterAvailablePanes.apply(this, arguments);
9229
9323
  }
9230
9324
 
9231
9325
  function _filterAvailablePanes() {
9232
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(panes) {
9326
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
9233
9327
  var userRoles;
9234
- return _regenerator["default"].wrap(function _callee8$(_context8) {
9328
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
9235
9329
  while (1) {
9236
- switch (_context8.prev = _context8.next) {
9330
+ switch (_context10.prev = _context10.next) {
9237
9331
  case 0:
9238
- _context8.next = 2;
9332
+ _context10.next = 2;
9239
9333
  return getUserRoles();
9240
9334
 
9241
9335
  case 2:
9242
- userRoles = _context8.sent;
9243
- return _context8.abrupt("return", panes.filter(function (pane) {
9336
+ userRoles = _context10.sent;
9337
+ return _context10.abrupt("return", panes.filter(function (pane) {
9244
9338
  return isMatchingAudience(pane, userRoles);
9245
9339
  }));
9246
9340
 
9247
9341
  case 4:
9248
9342
  case "end":
9249
- return _context8.stop();
9343
+ return _context10.stop();
9250
9344
  }
9251
9345
  }
9252
- }, _callee8);
9346
+ }, _callee10);
9253
9347
  }));
9254
9348
  return _filterAvailablePanes.apply(this, arguments);
9255
9349
  }
@@ -11986,10 +12080,10 @@ var style = {
11986
12080
  checkboxStyle: 'colour: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;',
11987
12081
  checkboxInputStyle: 'font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em',
11988
12082
  fieldLabelStyle: 'color: #3B5998; text-decoration: none;',
11989
- formSelectSTyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.2em;',
11990
- textInputStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.2em;',
12083
+ formSelectSTyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
12084
+ textInputStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
11991
12085
  textInputStyleUneditable: // Color difference only
11992
- 'background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.2em;',
12086
+ 'background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;',
11993
12087
  textInputSize: 20,
11994
12088
  // Default text input size in characters roughly
11995
12089
  buttonStyle: 'background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;',
@@ -13955,13 +14049,21 @@ function tabWidget(options) {
13955
14049
  orderedSync();
13956
14050
 
13957
14051
  if (!options.startEmpty && tabContainer.children.length && options.selectedTab) {
13958
- var selectedTab = Array.from(tabContainer.children).map(function (tab) {
14052
+ var selectedTab0 = Array.from(tabContainer.children) // Version left for compatability with ??
14053
+ .map(function (tab) {
13959
14054
  return tab.firstChild;
13960
14055
  }).find(function (tab) {
13961
14056
  return tab.dataset.name === options.selectedTab;
13962
14057
  });
13963
- var tab = selectedTab || tabContainer.children[0].firstChild;
13964
- tab.click();
14058
+ var selectedTabURI = options.selectedTab.uri;
14059
+ var selectedTab1 = Array.from(tabContainer.children) // @ts-ignore
14060
+ .find(function (tab) {
14061
+ return tab.subject && tab.subject.uri && tab.subject.uri === selectedTabURI;
14062
+ });
14063
+ var tab = selectedTab1 || selectedTab0 || tabContainer.children[0];
14064
+ var clickMe = tab.firstChild; // @ts-ignore
14065
+
14066
+ if (clickMe) clickMe.click();
13965
14067
  } else if (!options.startEmpty) {
13966
14068
  tabContainer.children[0].firstChild.click(); // Open first tab
13967
14069
  }
@@ -14248,7 +14350,6 @@ function getPod() {
14248
14350
  return (0, _rdflib.sym)(document.location.origin).site();
14249
14351
  }
14250
14352
  /**
14251
- * @ignore exporting this only for the unit test
14252
14353
  */
14253
14354
 
14254
14355
 
@@ -14262,63 +14363,94 @@ function getPodOwner(_x, _x2) {
14262
14363
 
14263
14364
  function _getPodOwner() {
14264
14365
  _getPodOwner = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(pod, store) {
14265
- var podOwner, storageIsListedInPodOwnersProfile;
14366
+ var podOwner, guess;
14266
14367
  return _regenerator["default"].wrap(function _callee$(_context) {
14267
14368
  while (1) {
14268
14369
  switch (_context.prev = _context.next) {
14269
14370
  case 0:
14270
- // @@ TODO: This is given the structure that NSS provides - might need to change for other Pod servers
14271
- podOwner = (0, _rdflib.sym)("".concat(pod.uri, "profile/card#me"));
14272
- _context.prev = 1;
14371
+ _context.prev = 0;
14372
+ // @ts-ignore LiveStore always has fetcher
14373
+ store.fetcher.load(pod);
14374
+ _context.next = 8;
14375
+ break;
14376
+
14377
+ case 4:
14378
+ _context.prev = 4;
14379
+ _context.t0 = _context["catch"](0);
14380
+ console.error('Error loading pod ' + pod + ': ' + _context.t0);
14381
+ return _context.abrupt("return", null);
14273
14382
 
14274
- if (!store.fetcher) {
14275
- _context.next = 7;
14383
+ case 8:
14384
+ if (store.holds(pod, _.ns.rdf('type'), _.ns.space('Storage'), pod)) {
14385
+ _context.next = 11;
14276
14386
  break;
14277
14387
  }
14278
14388
 
14279
- _context.next = 5;
14280
- return store.fetcher.load(podOwner.doc());
14389
+ console.warn('Pod ' + pod + ' does not declare itself as a space:Storage');
14390
+ return _context.abrupt("return", null);
14281
14391
 
14282
- case 5:
14283
- _context.next = 8;
14284
- break;
14392
+ case 11:
14393
+ podOwner = store.any(pod, _.ns.solid('owner'), null, pod) || store.any(null, _.ns.space('storage'), pod, pod);
14285
14394
 
14286
- case 7:
14287
- throw new Error('There was a problem loading the Fetcher');
14395
+ if (!podOwner) {
14396
+ _context.next = 25;
14397
+ break;
14398
+ }
14288
14399
 
14289
- case 8:
14290
- _context.next = 13;
14400
+ _context.prev = 13;
14401
+ // @ts-ignore LiveStore always has fetcher
14402
+ store.fetcher.load(podOwner.doc());
14403
+ _context.next = 21;
14291
14404
  break;
14292
14405
 
14293
- case 10:
14294
- _context.prev = 10;
14295
- _context.t0 = _context["catch"](1);
14296
- throw new Error('Did NOT find pod owners profile at ' + podOwner);
14406
+ case 17:
14407
+ _context.prev = 17;
14408
+ _context.t1 = _context["catch"](13);
14409
+ console.warn('Unable to load profile of pod owner ' + podOwner);
14410
+ return _context.abrupt("return", null);
14297
14411
 
14298
- case 13:
14299
- if (!podOwner) {
14300
- _context.next = 17;
14301
- break;
14412
+ case 21:
14413
+ if (!store.holds(podOwner, _.ns.space('storage'), pod, podOwner.doc())) {
14414
+ console.warn("Pod owner ".concat(podOwner, " does NOT list pod ").concat(pod, " as their storage"));
14302
14415
  }
14303
14416
 
14304
- storageIsListedInPodOwnersProfile = store.holds(podOwner, _.ns.space('storage'), pod, podOwner.doc());
14417
+ return _context.abrupt("return", podOwner);
14418
+
14419
+ case 25:
14420
+ // pod owner not declared in pod
14421
+ // @@ TODO: This is given the structure that NSS provides
14422
+ // This is a massive guess. For old pods which don't have owner link
14423
+ guess = (0, _rdflib.sym)("".concat(pod.uri, "profile/card#me"));
14424
+ _context.prev = 26;
14425
+ // @ts-ignore LiveStore always has fetcher
14426
+ store.fetcher.load(guess);
14427
+ _context.next = 34;
14428
+ break;
14429
+
14430
+ case 30:
14431
+ _context.prev = 30;
14432
+ _context.t2 = _context["catch"](26);
14433
+ console.error('Ooops. Guessed wrong pod owner webid {$guess} : can\'t load it.');
14434
+ return _context.abrupt("return", null);
14305
14435
 
14306
- if (storageIsListedInPodOwnersProfile) {
14307
- _context.next = 17;
14436
+ case 34:
14437
+ if (!store.holds(guess, _.ns.space('storage'), pod, guess.doc())) {
14438
+ _context.next = 37;
14308
14439
  break;
14309
14440
  }
14310
14441
 
14311
- throw new Error("** Pod owner ".concat(podOwner, " does NOT list pod ").concat(pod, " as storage"));
14442
+ console.warn('Using guessed pod owner webid but it links back.');
14443
+ return _context.abrupt("return", guess);
14312
14444
 
14313
- case 17:
14314
- return _context.abrupt("return", podOwner);
14445
+ case 37:
14446
+ return _context.abrupt("return", null);
14315
14447
 
14316
- case 18:
14448
+ case 38:
14317
14449
  case "end":
14318
14450
  return _context.stop();
14319
14451
  }
14320
14452
  }
14321
- }, _callee, null, [[1, 10]]);
14453
+ }, _callee, null, [[0, 4], [13, 17], [26, 30]]);
14322
14454
  }));
14323
14455
  return _getPodOwner.apply(this, arguments);
14324
14456
  }
@@ -15167,8 +15299,8 @@ Object.defineProperty(exports, "__esModule", {
15167
15299
  });
15168
15300
  exports["default"] = void 0;
15169
15301
  var _default = {
15170
- buildTime: '2022-03-01T17:00:41Z',
15171
- commit: 'c5a8888d6cb61363bc0445be007e3c96de593338',
15302
+ buildTime: '2022-03-24T17:42:27Z',
15303
+ commit: 'd2eb760d7ee92f9b6e64717fd3d9544e33ce879d',
15172
15304
  npmInfo: {
15173
15305
  'solid-ui': '2.4.19',
15174
15306
  npm: '6.14.16',
@@ -17091,6 +17223,12 @@ Object.defineProperty(exports, "__esModule", {
17091
17223
  value: true
17092
17224
  });
17093
17225
  exports.appendForm = appendForm;
17226
+ Object.defineProperty(exports, "basicField", {
17227
+ enumerable: true,
17228
+ get: function get() {
17229
+ return _basic.basicField;
17230
+ }
17231
+ });
17094
17232
  exports.buildCheckboxForm = buildCheckboxForm;
17095
17233
  exports.editFormButton = editFormButton;
17096
17234
  Object.defineProperty(exports, "field", {
@@ -17099,14 +17237,24 @@ Object.defineProperty(exports, "field", {
17099
17237
  return _fieldFunction.field;
17100
17238
  }
17101
17239
  });
17102
- exports.fieldLabel = fieldLabel;
17240
+ Object.defineProperty(exports, "fieldLabel", {
17241
+ enumerable: true,
17242
+ get: function get() {
17243
+ return _basic.fieldLabel;
17244
+ }
17245
+ });
17103
17246
  Object.defineProperty(exports, "fieldParams", {
17104
17247
  enumerable: true,
17105
17248
  get: function get() {
17106
17249
  return _fieldParams.fieldParams;
17107
17250
  }
17108
17251
  });
17109
- exports.fieldStore = fieldStore;
17252
+ Object.defineProperty(exports, "fieldStore", {
17253
+ enumerable: true,
17254
+ get: function get() {
17255
+ return _basic.fieldStore;
17256
+ }
17257
+ });
17110
17258
  exports.findClosest = findClosest;
17111
17259
  exports.formsFor = formsFor;
17112
17260
  exports.makeDescription = makeDescription;
@@ -17117,6 +17265,12 @@ exports.newButton = newButton;
17117
17265
  exports.newThing = newThing;
17118
17266
  exports.promptForNew = promptForNew;
17119
17267
  exports.propertiesForClass = propertiesForClass;
17268
+ Object.defineProperty(exports, "renderNameValuePair", {
17269
+ enumerable: true,
17270
+ get: function get() {
17271
+ return _basic.renderNameValuePair;
17272
+ }
17273
+ });
17120
17274
  exports.sortByLabel = sortByLabel;
17121
17275
  exports.sortBySequence = sortBySequence;
17122
17276
 
@@ -17989,8 +18143,8 @@ _fieldFunction.field[ns.ui('MultiLineTextField').uri] = function (dom, container
17989
18143
  var left = box.appendChild(dom.createElement('div'));
17990
18144
  left.style.width = style.formFieldNameBoxWidth;
17991
18145
  var right = box.appendChild(dom.createElement('div'));
17992
- left.appendChild(fieldLabel(dom, property, form));
17993
- dataDoc = fieldStore(subject, property, dataDoc);
18146
+ left.appendChild((0, _basic.fieldLabel)(dom, property, form));
18147
+ dataDoc = (0, _basic.fieldStore)(subject, property, dataDoc);
17994
18148
  var text = kb.anyJS(subject, property, null, dataDoc) || '';
17995
18149
  var editable = kb.updater.editable(dataDoc.uri);
17996
18150
  var suppressEmptyUneditable = form && kb.anyJS(form, ns.ui('suppressEmptyUneditable'), null, formDoc);
@@ -18024,7 +18178,7 @@ function booleanField(dom, container, already, subject, form, dataDoc, callbackF
18024
18178
  var lab = kb.any(form, ui('label'));
18025
18179
  if (!lab) lab = utils.label(property, true); // Init capital
18026
18180
 
18027
- dataDoc = fieldStore(subject, property, dataDoc);
18181
+ dataDoc = (0, _basic.fieldStore)(subject, property, dataDoc);
18028
18182
  var state = kb.any(subject, property);
18029
18183
 
18030
18184
  if (state === undefined) {
@@ -18107,7 +18261,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18107
18261
  return box.appendChild((0, _error.errorMessageBlock)(dom, 'No property for Choice: ' + form));
18108
18262
  }
18109
18263
 
18110
- lhs.appendChild(fieldLabel(dom, property, form));
18264
+ lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
18111
18265
  var from = kb.any(form, ui('from'));
18112
18266
 
18113
18267
  if (!from) {
@@ -18824,7 +18978,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
18824
18978
 
18825
18979
  function buildCheckboxForm(dom, kb, lab, del, ins, form, dataDoc, tristate) {
18826
18980
  var box = dom.createElement('div');
18827
- var rhs = (0, _basic.renderNameValuePair)(dom, kb, box, form);
18981
+ var rhs = (0, _basic.renderNameValuePair)(dom, kb, box, form, lab);
18828
18982
  var editable = kb.updater.editable(dataDoc.uri);
18829
18983
  var input = dom.createElement('button');
18830
18984
  var colorCarrier = input;
@@ -18923,33 +19077,34 @@ function buildCheckboxForm(dom, kb, lab, del, ins, form, dataDoc, tristate) {
18923
19077
  input.addEventListener('click', boxHandler, false);
18924
19078
  return box;
18925
19079
  }
18926
-
18927
- function fieldLabel(dom, property, form) {
18928
- var lab = kb.any(form, ns.ui('label'));
18929
- if (!lab) lab = utils.label(property, true); // Init capital
18930
-
19080
+ /*
19081
+ export function fieldLabel (dom, property, form) {
19082
+ let lab = kb.any(form, ns.ui('label'))
19083
+ if (!lab) lab = utils.label(property, true) // Init capital
18931
19084
  if (property === undefined) {
18932
- return dom.createTextNode('@@Internal error: undefined property');
19085
+ return dom.createTextNode('@@Internal error: undefined property')
18933
19086
  }
18934
-
18935
- var anchor = dom.createElement('a');
18936
- if (property.uri) anchor.setAttribute('href', property.uri);
18937
- anchor.setAttribute('style', style.fieldLabelStyle); // Not too blue and no underline
18938
-
18939
- anchor.textContent = lab;
18940
- return anchor;
19087
+ const anchor = dom.createElement('a')
19088
+ if (property.uri) anchor.setAttribute('href', property.uri)
19089
+ anchor.setAttribute('style', style.fieldLabelStyle) // Not too blue and no underline
19090
+ anchor.textContent = lab
19091
+ return anchor
18941
19092
  }
18942
19093
 
18943
- function fieldStore(subject, predicate, def) {
18944
- var sts = kb.statementsMatching(subject, predicate);
18945
- if (sts.length === 0) return def; // can used default as no data yet
18946
-
18947
- if (sts.length > 0 && sts[0].why.uri && kb.updater.editable(sts[0].why.uri)) {
18948
- return kb.sym(sts[0].why.uri);
19094
+ export function fieldStore (subject, predicate, def) {
19095
+ const sts = kb.statementsMatching(subject, predicate)
19096
+ if (sts.length === 0) return def // can used default as no data yet
19097
+ if (
19098
+ sts.length > 0 &&
19099
+ sts[0].why.uri &&
19100
+ kb.updater.editable(sts[0].why.uri)
19101
+ ) {
19102
+ return kb.sym(sts[0].why.uri)
18949
19103
  }
18950
-
18951
- return def;
19104
+ return def
18952
19105
  }
19106
+ */
19107
+
18953
19108
  /** Mint local ID using timestamp
18954
19109
  * @param {NamedNode} doc - the document in which the ID is to be generated
18955
19110
  */
@@ -21285,8 +21440,8 @@ var store = _solidLogic.solidLogicSingleton.store;
21285
21440
  /* Style and create a name, value pair
21286
21441
  */
21287
21442
 
21288
- function renderNameValuePair(dom, kb, box, form) {
21289
- var property = kb.any(form, ns.ui('property'));
21443
+ function renderNameValuePair(dom, kb, box, form, label) {
21444
+ // const property = kb.any(form, ns.ui('property'))
21290
21445
  box.style.display = 'flex';
21291
21446
  box.style.flexDirection = 'row';
21292
21447
  var lhs = box.appendChild(dom.createElement('div'));
@@ -21296,12 +21451,14 @@ function renderNameValuePair(dom, kb, box, form) {
21296
21451
  lhs.setAttribute('style', _style.formFieldNameBoxStyle);
21297
21452
  rhs.setAttribute('class', 'formFieldValue');
21298
21453
 
21299
- if (!property) {
21454
+ if (label) {
21455
+ lhs.appendChild(dom.createTextNode(label));
21456
+ } else if (kb.any(form, ns.ui('property'))) {
21300
21457
  // Assume more space for error on right
21301
- rhs.appendChild((0, _error.errorMessageBlock)(dom, 'No property given for form field: ' + form));
21302
- lhs.appendChild(dom.createTextNode('???'));
21458
+ lhs.appendChild(fieldLabel(dom, kb.any(form, ns.ui('property')), form));
21303
21459
  } else {
21304
- lhs.appendChild(fieldLabel(dom, property, form));
21460
+ rhs.appendChild((0, _error.errorMessageBlock)(dom, 'No property or label given for form field: ' + form));
21461
+ lhs.appendChild(dom.createTextNode('???'));
21305
21462
  }
21306
21463
 
21307
21464
  return rhs;
@@ -23793,7 +23950,6 @@ e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=
23793
23950
 
23794
23951
  Object.defineProperty(exports, "__esModule", { value: true });
23795
23952
  const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
23796
- const constant_1 = __webpack_require__(/*! ./constant */ "./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js");
23797
23953
  const globalFetch = (request, init) => window.fetch(request, init);
23798
23954
  class ClientAuthentication {
23799
23955
  constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
@@ -23824,11 +23980,7 @@ class ClientAuthentication {
23824
23980
  this.getAllSessionInfo = async () => {
23825
23981
  return this.sessionInfoManager.getAll();
23826
23982
  };
23827
- this.validateCurrentSession = async () => {
23828
- const currentSessionId = window.localStorage.getItem(constant_1.KEY_CURRENT_SESSION);
23829
- if (currentSessionId === null) {
23830
- return null;
23831
- }
23983
+ this.validateCurrentSession = async (currentSessionId) => {
23832
23984
  const sessionInfo = await this.sessionInfoManager.get(currentSessionId);
23833
23985
  if (sessionInfo === undefined ||
23834
23986
  sessionInfo.clientAppId === undefined ||
@@ -23883,7 +24035,7 @@ async function silentlyAuthenticate(sessionId, clientAuthn, options = {
23883
24035
  inIframe: false,
23884
24036
  }, session) {
23885
24037
  var _a;
23886
- const storedSessionInfo = await clientAuthn.validateCurrentSession();
24038
+ const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);
23887
24039
  if (storedSessionInfo !== null) {
23888
24040
  window.localStorage.setItem(constant_1.KEY_CURRENT_URL, window.location.href);
23889
24041
  await clientAuthn.login({
@@ -23928,12 +24080,16 @@ class Session extends events_1.EventEmitter {
23928
24080
  init === null || init === void 0 ? void 0 : init.credentials,
23929
24081
  });
23930
24082
  };
23931
- this.logout = async () => {
24083
+ this.internalLogout = async (emitSignal) => {
24084
+ window.localStorage.removeItem(constant_1.KEY_CURRENT_SESSION);
23932
24085
  await this.clientAuthentication.logout(this.info.sessionId);
23933
24086
  this.info.isLoggedIn = false;
23934
24087
  this.tmpFetchWithCookies = false;
23935
- this.emit("logout");
24088
+ if (emitSignal) {
24089
+ this.emit(solid_client_authn_core_1.EVENTS.LOGOUT);
24090
+ }
23936
24091
  };
24092
+ this.logout = async () => this.internalLogout(true);
23937
24093
  this.handleIncomingRedirect = async (inputOptions = {}) => {
23938
24094
  var _a;
23939
24095
  if (this.info.isLoggedIn) {
@@ -23989,11 +24145,11 @@ class Session extends events_1.EventEmitter {
23989
24145
  this.setSessionInfo(sessionInfo);
23990
24146
  const currentUrl = window.localStorage.getItem(constant_1.KEY_CURRENT_URL);
23991
24147
  if (currentUrl === null) {
23992
- this.emit("login");
24148
+ this.emit(solid_client_authn_core_1.EVENTS.LOGIN);
23993
24149
  }
23994
24150
  else {
23995
24151
  window.localStorage.removeItem(constant_1.KEY_CURRENT_URL);
23996
- this.emit("sessionRestore", currentUrl);
24152
+ this.emit(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, currentUrl);
23997
24153
  }
23998
24154
  }
23999
24155
  else if (options.restorePreviousSession === true) {
@@ -24043,18 +24199,21 @@ class Session extends events_1.EventEmitter {
24043
24199
  this.on("tokenRenewal", () => silentlyAuthenticate(this.info.sessionId, this.clientAuthentication, {
24044
24200
  inIframe: true,
24045
24201
  }, this));
24202
+ this.on(solid_client_authn_core_1.EVENTS.LOGIN, () => window.localStorage.setItem(constant_1.KEY_CURRENT_SESSION, this.info.sessionId));
24203
+ this.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
24204
+ this.on(solid_client_authn_core_1.EVENTS.ERROR, () => this.internalLogout(false));
24046
24205
  }
24047
24206
  onLogin(callback) {
24048
- this.on("login", callback);
24207
+ this.on(solid_client_authn_core_1.EVENTS.LOGIN, callback);
24049
24208
  }
24050
24209
  onLogout(callback) {
24051
- this.on("logout", callback);
24210
+ this.on(solid_client_authn_core_1.EVENTS.LOGOUT, callback);
24052
24211
  }
24053
24212
  onError(callback) {
24054
24213
  this.on(solid_client_authn_core_1.EVENTS.ERROR, callback);
24055
24214
  }
24056
24215
  onSessionRestore(callback) {
24057
- this.on("sessionRestore", callback);
24216
+ this.on(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, callback);
24058
24217
  }
24059
24218
  onSessionExpiration(callback) {
24060
24219
  this.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, callback);
@@ -24268,7 +24427,11 @@ exports.postRedirectUrlToParent = postRedirectUrlToParent;
24268
24427
 
24269
24428
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24270
24429
  if (k2 === undefined) k2 = k;
24271
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
24430
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24431
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24432
+ desc = { enumerable: true, get: function() { return m[k]; } };
24433
+ }
24434
+ Object.defineProperty(o, k2, desc);
24272
24435
  }) : (function(o, m, k, k2) {
24273
24436
  if (k2 === undefined) k2 = k;
24274
24437
  o[k2] = m[k];
@@ -24457,6 +24620,9 @@ function processConfig(config) {
24457
24620
  parsedConfig[issuerConfigKeyMap[key].toKey] = config[key];
24458
24621
  }
24459
24622
  });
24623
+ if (!Array.isArray(parsedConfig.scopesSupported)) {
24624
+ parsedConfig.scopesSupported = ["openid"];
24625
+ }
24460
24626
  return parsedConfig;
24461
24627
  }
24462
24628
  class IssuerConfigFetcher {
@@ -24669,7 +24835,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
24669
24835
  exports.AuthCodeRedirectHandler = exports.DEFAULT_LIFESPAN = void 0;
24670
24836
  const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
24671
24837
  const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
24672
- const constant_1 = __webpack_require__(/*! ../../../constant */ "./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js");
24673
24838
  exports.DEFAULT_LIFESPAN = 30 * 60 * 1000;
24674
24839
  async function setupResourceServerSession(webId, authenticatedFetch, storageUtility) {
24675
24840
  const webIdAsUrl = new URL(webId);
@@ -24714,23 +24879,24 @@ class AuthCodeRedirectHandler {
24714
24879
  const storedSessionId = (await this.storageUtility.getForUser(oauthState, "sessionId", {
24715
24880
  errorIfNull: true,
24716
24881
  }));
24717
- const isDpop = (await this.storageUtility.getForUser(storedSessionId, "dpop")) ===
24718
- "true";
24719
- const issuer = (await this.storageUtility.getForUser(storedSessionId, "issuer", { errorIfNull: true }));
24720
- window.localStorage.setItem(constant_1.KEY_CURRENT_SESSION, storedSessionId);
24721
- const issuerConfig = await this.issuerConfigFetcher.fetchConfig(issuer);
24882
+ const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await (0, solid_client_authn_core_1.loadOidcContextFromStorage)(storedSessionId, this.storageUtility, this.issuerConfigFetcher);
24883
+ if (codeVerifier === undefined) {
24884
+ throw new Error(`The code verifier for session ${storedSessionId} is missing from storage.`);
24885
+ }
24886
+ if (storedRedirectIri === undefined) {
24887
+ throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);
24888
+ }
24722
24889
  const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);
24723
24890
  let tokens;
24724
- const referenceTime = Date.now();
24891
+ const tokenCreatedAt = Date.now();
24725
24892
  if (isDpop) {
24726
- const codeVerifier = (await this.storageUtility.getForUser(storedSessionId, "codeVerifier", { errorIfNull: true }));
24727
- const storedRedirectIri = (await this.storageUtility.getForUser(storedSessionId, "redirectUrl", { errorIfNull: true }));
24728
24893
  tokens = await (0, oidc_client_ext_1.getDpopToken)(issuerConfig, client, {
24729
24894
  grantType: "authorization_code",
24730
24895
  code: url.searchParams.get("code"),
24731
24896
  codeVerifier,
24732
24897
  redirectUrl: storedRedirectIri,
24733
24898
  });
24899
+ window.localStorage.removeItem(`oidc.${oauthState}`);
24734
24900
  }
24735
24901
  else {
24736
24902
  tokens = await (0, oidc_client_ext_1.getBearerToken)(url.toString());
@@ -24771,7 +24937,7 @@ class AuthCodeRedirectHandler {
24771
24937
  return Object.assign(sessionInfo, {
24772
24938
  fetch: authFetch,
24773
24939
  expirationDate: typeof tokens.expiresIn === "number"
24774
- ? referenceTime + tokens.expiresIn * 1000
24940
+ ? tokenCreatedAt + tokens.expiresIn * 1000
24775
24941
  : null,
24776
24942
  });
24777
24943
  }
@@ -25286,10 +25452,13 @@ exports.REFRESH_BEFORE_EXPIRATION_SECONDS = exports.EVENTS = exports.PREFERRED_S
25286
25452
  exports.SOLID_CLIENT_AUTHN_KEY_PREFIX = "solidClientAuthn:";
25287
25453
  exports.PREFERRED_SIGNING_ALG = ["ES256", "RS256"];
25288
25454
  exports.EVENTS = {
25455
+ ERROR: "error",
25456
+ LOGIN: "login",
25457
+ LOGOUT: "logout",
25289
25458
  NEW_REFRESH_TOKEN: "newRefreshToken",
25290
- ERROR: "onError",
25291
25459
  SESSION_EXPIRED: "sessionExpired",
25292
25460
  SESSION_EXTENDED: "sessionExtended",
25461
+ SESSION_RESTORED: "sessionRestore",
25293
25462
  TIMEOUT_SET: "timeoutSet",
25294
25463
  };
25295
25464
  exports.REFRESH_BEFORE_EXPIRATION_SECONDS = 5;
@@ -25480,7 +25649,11 @@ exports.OidcProviderError = OidcProviderError;
25480
25649
 
25481
25650
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25482
25651
  if (k2 === undefined) k2 = k;
25483
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
25652
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25653
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25654
+ desc = { enumerable: true, get: function() { return m[k]; } };
25655
+ }
25656
+ Object.defineProperty(o, k2, desc);
25484
25657
  }) : (function(o, m, k, k2) {
25485
25658
  if (k2 === undefined) k2 = k;
25486
25659
  o[k2] = m[k];
@@ -25761,6 +25934,7 @@ async function loadOidcContextFromStorage(sessionId, storageUtility, configFetch
25761
25934
  storageUtility.getForUser(sessionId, "redirectUrl"),
25762
25935
  storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true }),
25763
25936
  ]);
25937
+ await storageUtility.deleteForUser(sessionId, "codeVerifier");
25764
25938
  const issuerConfig = await configFetcher.fetchConfig(issuerIri);
25765
25939
  return {
25766
25940
  codeVerifier,
@@ -39246,7 +39420,7 @@ async function compactDecrypt(jwe, key, options) {
39246
39420
  throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__["JWEInvalid"]('Invalid Compact JWE');
39247
39421
  }
39248
39422
  const decrypted = await Object(_flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_0__["flattenedDecrypt"])({
39249
- ciphertext: (ciphertext || undefined),
39423
+ ciphertext,
39250
39424
  iv: (iv || undefined),
39251
39425
  protected: protectedHeader || undefined,
39252
39426
  tag: (tag || undefined),
@@ -39864,6 +40038,12 @@ class GeneralEncrypt {
39864
40038
  const recipient = this._recipients[i];
39865
40039
  const target = {};
39866
40040
  jwe.recipients.push(target);
40041
+ const joseHeader = {
40042
+ ...this._protectedHeader,
40043
+ ...this._unprotectedHeader,
40044
+ ...recipient.unprotectedHeader,
40045
+ };
40046
+ const p2c = joseHeader.alg.startsWith('PBES2') ? 2048 + i : undefined;
39867
40047
  if (i === 0) {
39868
40048
  const flattened = await new _flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__["FlattenedEncrypt"](this._plaintext)
39869
40049
  .setAdditionalAuthenticatedData(this._aad)
@@ -39871,6 +40051,7 @@ class GeneralEncrypt {
39871
40051
  .setProtectedHeader(this._protectedHeader)
39872
40052
  .setSharedUnprotectedHeader(this._unprotectedHeader)
39873
40053
  .setUnprotectedHeader(recipient.unprotectedHeader)
40054
+ .setKeyManagementParameters({ p2c })
39874
40055
  .encrypt(recipient.key, {
39875
40056
  ...recipient.options,
39876
40057
  ...options,
@@ -39892,7 +40073,7 @@ class GeneralEncrypt {
39892
40073
  }
39893
40074
  const { encryptedKey, parameters } = await Object(_lib_encrypt_key_management_js__WEBPACK_IMPORTED_MODULE_4__["default"])(((_a = recipient.unprotectedHeader) === null || _a === void 0 ? void 0 : _a.alg) ||
39894
40075
  ((_b = this._protectedHeader) === null || _b === void 0 ? void 0 : _b.alg) ||
39895
- ((_c = this._unprotectedHeader) === null || _c === void 0 ? void 0 : _c.alg), enc, recipient.key, cek);
40076
+ ((_c = this._unprotectedHeader) === null || _c === void 0 ? void 0 : _c.alg), enc, recipient.key, cek, { p2c });
39896
40077
  target.encrypted_key = Object(_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_5__["encode"])(encryptedKey);
39897
40078
  if (recipient.unprotectedHeader || parameters)
39898
40079
  target.header = { ...recipient.unprotectedHeader, ...parameters };
@@ -41554,7 +41735,7 @@ function checkEncCryptoKey(key, alg, ...usages) {
41554
41735
  throw unusable(expected, 'algorithm.length');
41555
41736
  break;
41556
41737
  }
41557
- case 'ECDH-ES':
41738
+ case 'ECDH':
41558
41739
  if (!isAlgorithm(key.algorithm, 'ECDH'))
41559
41740
  throw unusable('ECDH');
41560
41741
  break;
@@ -41633,7 +41814,7 @@ async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
41633
41814
  if (!Object(_is_object_js__WEBPACK_IMPORTED_MODULE_9__["default"])(joseHeader.epk))
41634
41815
  throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__["JWEInvalid"](`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);
41635
41816
  if (!_runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__["ecdhAllowed"](key))
41636
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__["JOSENotSupported"]('ECDH-ES with the provided key is not allowed or not supported by your javascript runtime');
41817
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__["JOSENotSupported"]('ECDH with the provided key is not allowed or not supported by your javascript runtime');
41637
41818
  const epk = await Object(_key_import_js__WEBPACK_IMPORTED_MODULE_7__["importJWK"])(joseHeader.epk, alg);
41638
41819
  let partyUInfo;
41639
41820
  let partyVInfo;
@@ -41748,7 +41929,7 @@ async function encryptKeyManagement(alg, enc, key, providedCek, providedParamete
41748
41929
  case 'ECDH-ES+A192KW':
41749
41930
  case 'ECDH-ES+A256KW': {
41750
41931
  if (!_runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__["ecdhAllowed"](key)) {
41751
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_6__["JOSENotSupported"]('ECDH-ES with the provided key is not allowed or not supported by your javascript runtime');
41932
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_6__["JOSENotSupported"]('ECDH with the provided key is not allowed or not supported by your javascript runtime');
41752
41933
  }
41753
41934
  const { apu, apv } = providedParameters;
41754
41935
  let { epk: ephemeralKey } = providedParameters;
@@ -42689,15 +42870,12 @@ async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new
42689
42870
  if (!Object(_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["isCryptoKey"])(publicKey)) {
42690
42871
  throw new TypeError(Object(_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(publicKey, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__["types"]));
42691
42872
  }
42692
- Object(_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__["checkEncCryptoKey"])(publicKey, 'ECDH-ES');
42873
+ Object(_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__["checkEncCryptoKey"])(publicKey, 'ECDH');
42693
42874
  if (!Object(_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["isCryptoKey"])(privateKey)) {
42694
42875
  throw new TypeError(Object(_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(privateKey, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__["types"]));
42695
42876
  }
42696
- Object(_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__["checkEncCryptoKey"])(privateKey, 'ECDH-ES', 'deriveBits', 'deriveKey');
42877
+ Object(_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__["checkEncCryptoKey"])(privateKey, 'ECDH', 'deriveBits');
42697
42878
  const value = Object(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__["concat"])(Object(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__["lengthAndInput"])(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__["encoder"].encode(algorithm)), Object(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__["lengthAndInput"])(apu), Object(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__["lengthAndInput"])(apv), Object(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__["uint32be"])(keyLength));
42698
- if (!privateKey.usages.includes('deriveBits')) {
42699
- throw new TypeError('ECDH-ES private key "usages" must include "deriveBits"');
42700
- }
42701
42879
  const sharedSecret = new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.deriveBits({
42702
42880
  name: 'ECDH',
42703
42881
  public: publicKey,
@@ -42846,8 +43024,6 @@ function isNodeJs() {
42846
43024
  "use strict";
42847
43025
  __webpack_require__.r(__webpack_exports__);
42848
43026
  /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
42849
- /* harmony import */ var _env_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
42850
-
42851
43027
 
42852
43028
  const fetchJwks = async (url, timeout) => {
42853
43029
  let controller;
@@ -42863,14 +43039,6 @@ const fetchJwks = async (url, timeout) => {
42863
43039
  const response = await fetch(url.href, {
42864
43040
  signal: controller ? controller.signal : undefined,
42865
43041
  redirect: 'manual',
42866
- method: 'GET',
42867
- ...(!Object(_env_js__WEBPACK_IMPORTED_MODULE_1__["isCloudflareWorkers"])()
42868
- ? {
42869
- referrerPolicy: 'no-referrer',
42870
- credentials: 'omit',
42871
- mode: 'cors',
42872
- }
42873
- : undefined),
42874
43042
  }).catch((err) => {
42875
43043
  if (timedOut)
42876
43044
  throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__["JWKSTimeout"]();
@@ -43353,7 +43521,7 @@ async function deriveKey(p2s, alg, p2c, key) {
43353
43521
  }
43354
43522
  throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"');
43355
43523
  }
43356
- const encrypt = async (alg, key, cek, p2c = Math.floor(Math.random() * 2049) + 2048, p2s = Object(_random_js__WEBPACK_IMPORTED_MODULE_0__["default"])(new Uint8Array(16))) => {
43524
+ const encrypt = async (alg, key, cek, p2c = 2048, p2s = Object(_random_js__WEBPACK_IMPORTED_MODULE_0__["default"])(new Uint8Array(16))) => {
43357
43525
  const derived = await deriveKey(p2s, alg, p2c, key);
43358
43526
  const encryptedKey = await Object(_aeskw_js__WEBPACK_IMPORTED_MODULE_3__["wrap"])(alg.slice(-6), derived, cek);
43359
43527
  return { encryptedKey, p2c, p2s: Object(_base64url_js__WEBPACK_IMPORTED_MODULE_2__["encode"])(p2s) };