solid-ui 2.4.30 → 2.4.31

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.
Files changed (45) hide show
  1. package/dist/solid-ui.js +1520 -1074
  2. package/dist/solid-ui.js.map +1 -1
  3. package/dist/solid-ui.min.js +1 -1
  4. package/dist/solid-ui.min.js.map +1 -1
  5. package/lib/login/login.d.ts.map +1 -1
  6. package/lib/login/login.js +14 -18
  7. package/lib/login/login.js.map +1 -1
  8. package/lib/media/media-capture.d.ts +2 -2
  9. package/lib/media/media-capture.d.ts.map +1 -1
  10. package/lib/media/media-capture.js +11 -15
  11. package/lib/media/media-capture.js.map +1 -1
  12. package/lib/pad.d.ts +2 -2
  13. package/lib/pad.d.ts.map +1 -1
  14. package/lib/pad.js +15 -39
  15. package/lib/pad.js.map +1 -1
  16. package/lib/participation.d.ts +7 -7
  17. package/lib/participation.d.ts.map +1 -1
  18. package/lib/participation.js +26 -24
  19. package/lib/participation.js.map +1 -1
  20. package/lib/style.js +93 -85
  21. package/lib/style.js.map +1 -1
  22. package/lib/styleConstants.js +35 -0
  23. package/lib/styleConstants.js.map +1 -0
  24. package/lib/tabs.d.ts +0 -125
  25. package/lib/tabs.d.ts.map +1 -1
  26. package/lib/tabs.js +15 -8
  27. package/lib/tabs.js.map +1 -1
  28. package/lib/versionInfo.js +3 -3
  29. package/lib/versionInfo.js.map +1 -1
  30. package/lib/widgets/dragAndDrop.js +11 -19
  31. package/lib/widgets/dragAndDrop.js.map +1 -1
  32. package/lib/widgets/error.d.ts.map +1 -1
  33. package/lib/widgets/error.js +9 -2
  34. package/lib/widgets/error.js.map +1 -1
  35. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +1 -1
  36. package/lib/widgets/forms/autocomplete/autocompletePicker.js +2 -1
  37. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  38. package/lib/widgets/forms/basic.d.ts.map +1 -1
  39. package/lib/widgets/forms/basic.js +5 -4
  40. package/lib/widgets/forms/basic.js.map +1 -1
  41. package/lib/widgets/forms/fieldParams.js +2 -2
  42. package/lib/widgets/forms/fieldParams.js.map +1 -1
  43. package/lib/widgets/forms.js +9 -8
  44. package/lib/widgets/forms.js.map +1 -1
  45. package/package.json +4 -4
package/dist/solid-ui.js CHANGED
@@ -7156,6 +7156,15 @@ function renderScopeHeadingRow(context, store, scope) {
7156
7156
  function registrationList(_x9, _x10) {
7157
7157
  return _registrationList.apply(this, arguments);
7158
7158
  } // registrationList
7159
+ /**
7160
+ * Bootstrapping identity
7161
+ * (Called by `loginStatusBox()`)
7162
+ *
7163
+ * @param dom
7164
+ * @param setUserCallback
7165
+ *
7166
+ * @returns
7167
+ */
7159
7168
  function _registrationList() {
7160
7169
  _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
7161
7170
  var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
@@ -7287,23 +7296,10 @@ function _registrationList() {
7287
7296
  }));
7288
7297
  return _registrationList.apply(this, arguments);
7289
7298
  }
7290
- function getDefaultSignInButtonStyle() {
7291
- return 'padding: 1em; border-radius:0.5em; font-size: 100%;';
7292
- }
7293
-
7294
- /**
7295
- * Bootstrapping identity
7296
- * (Called by `loginStatusBox()`)
7297
- *
7298
- * @param dom
7299
- * @param setUserCallback
7300
- *
7301
- * @returns
7302
- */
7303
7299
  function signInOrSignUpBox(dom, setUserCallback) {
7304
7300
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
7305
7301
  options = options || {};
7306
- var signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle();
7302
+ var signInButtonStyle = options.buttonStyle || style.signInAndUpButtonStyle;
7307
7303
  var box = dom.createElement('div');
7308
7304
  var magicClassName = 'SolidSignInOrSignUpBox';
7309
7305
  debug.log('widgets.signInOrSignUpBox');
@@ -7316,7 +7312,7 @@ function signInOrSignUpBox(dom, setUserCallback) {
7316
7312
  box.appendChild(signInPopUpButton);
7317
7313
  signInPopUpButton.setAttribute('type', 'button');
7318
7314
  signInPopUpButton.setAttribute('value', 'Log in');
7319
- signInPopUpButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #eef;").concat(style.headerBannerLoginInput));
7315
+ signInPopUpButton.setAttribute('style', "".concat(signInButtonStyle).concat(style.headerBannerLoginInput) + style.signUpBackground);
7320
7316
  _solidLogic.authSession.onLogin(function () {
7321
7317
  var me = _solidLogic.authn.currentUser();
7322
7318
  // const sessionInfo = authSession.info
@@ -7357,7 +7353,7 @@ function signInOrSignUpBox(dom, setUserCallback) {
7357
7353
  box.appendChild(signupButton);
7358
7354
  signupButton.setAttribute('type', 'button');
7359
7355
  signupButton.setAttribute('value', 'Sign Up for Solid');
7360
- signupButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #efe;").concat(style.headerBannerLoginInput));
7356
+ signupButton.setAttribute('style', "".concat(signInButtonStyle).concat(style.headerBannerLoginInput) + style.signInBackground);
7361
7357
  signupButton.addEventListener('click', function (_event) {
7362
7358
  var signupMgr = new _signup.Signup();
7363
7359
  signupMgr.signup().then(function (uri) {
@@ -7525,7 +7521,7 @@ function loginStatusBox(dom) {
7525
7521
  });
7526
7522
  }
7527
7523
  function logoutButton(me, options) {
7528
- var signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle();
7524
+ var signInButtonStyle = options.buttonStyle || style.signInAndUpButtonStyle;
7529
7525
  var logoutLabel = 'WebID logout';
7530
7526
  if (me) {
7531
7527
  var nick = _solidLogic.solidLogicSingleton.store.any(me, ns.foaf('nick')) || _solidLogic.solidLogicSingleton.store.any(me, ns.foaf('name'));
@@ -7537,7 +7533,7 @@ function loginStatusBox(dom) {
7537
7533
  // signOutButton.className = 'WebIDCancelButton'
7538
7534
  signOutButton.setAttribute('type', 'button');
7539
7535
  signOutButton.setAttribute('value', logoutLabel);
7540
- signOutButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #eee;"));
7536
+ signOutButton.setAttribute('style', "".concat(signInButtonStyle));
7541
7537
  signOutButton.addEventListener('click', logoutButtonHandler, false);
7542
7538
  return signOutButton;
7543
7539
  }
@@ -8272,21 +8268,21 @@ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime
8272
8268
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
8273
8269
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
8274
8270
  var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
8271
+ var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
8275
8272
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
8276
8273
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
8277
8274
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
8278
- /// /////////////////////////////////////////////
8279
8275
  //
8280
8276
  // Media input widget
8281
8277
  //
8282
8278
  //
8283
8279
  // Workflow:
8284
- // The HTML5 functionality (on mobille) is to prompt for either
8285
- // a realtime camera capture , OR a selection from images already ont the device
8280
+ // The HTML5 functionality (on mobile) is to prompt for either
8281
+ // a realtime camera capture, OR a selection from images already on the device
8286
8282
  // (eg camera roll).
8287
8283
  //
8288
- // The solid alternative is to either take a phtoto
8289
- // or access cemra roll (etc) OR to access solid cloud storage of favorite photo almbums.
8284
+ // The solid alternative is to either take a photo
8285
+ // or access camera roll (etc) OR to access solid cloud storage of favorite photo albums.
8290
8286
  // (Especially latest taken ones)
8291
8287
  //
8292
8288
 
@@ -8295,10 +8291,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
8295
8291
  var cameraIcon = _iconBase.icons.iconBase + 'noun_Camera_1618446_000000.svg'; // Get it from github
8296
8292
  var retakeIcon = _iconBase.icons.iconBase + 'noun_479395.svg'; // Get it from github
8297
8293
 
8298
- var canvasWidth = '640';
8299
- var canvasHeight = '480';
8300
- var controlStyle = "border-radius: 0.5em; margin: 0.8em; width: ".concat(canvasWidth, "; height:").concat(canvasHeight, ";");
8301
- // const controlStyle = 'border-radius: 0.5em; margin: 0.8em; width: 320; height:240;'
8302
8294
  var contentType = 'image/png';
8303
8295
 
8304
8296
  /** A control to capture a picture using camera
@@ -8343,7 +8335,7 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
8343
8335
  player = main.appendChild(dom.createElement('video'));
8344
8336
  player.setAttribute('controls', '1');
8345
8337
  player.setAttribute('autoplay', '1');
8346
- player.setAttribute('style', controlStyle);
8338
+ player.setAttribute('style', style.controlStyle);
8347
8339
  if (!navigator.mediaDevices) {
8348
8340
  throw new Error('navigator.mediaDevices not available');
8349
8341
  }
@@ -8364,9 +8356,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
8364
8356
  function grabCanvas() {
8365
8357
  // Draw the video frame to the canvas.
8366
8358
  canvas = dom.createElement('canvas');
8367
- canvas.setAttribute('width', canvasWidth);
8368
- canvas.setAttribute('height', canvasHeight);
8369
- canvas.setAttribute('style', controlStyle);
8359
+ canvas.setAttribute('width', style.canvasWidth);
8360
+ canvas.setAttribute('height', style.canvasHeight);
8361
+ canvas.setAttribute('style', style.controlStyle);
8370
8362
  main.appendChild(canvas);
8371
8363
  var context = canvas.getContext('2d');
8372
8364
  context.drawImage(player, 0, 0, canvas.width, canvas.height);
@@ -8421,9 +8413,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
8421
8413
  * @param {IndexedForumla} store - The quadstore to store data in
8422
8414
  * @param {fuunction} getImageDoc - returns NN of the image file to be created
8423
8415
  * @param {function<Node>} doneCallback - called with the image taken
8424
- * @returns {DomElement} - A div element with the buton in it
8416
+ * @returns {DomElement} - A div element with the button in it
8425
8417
  *
8426
- * This expacts the buttton to a large control when it is pressed
8418
+ * This expands the button to a large control when it is pressed
8427
8419
  */
8428
8420
 
8429
8421
  function cameraButton(dom, store, getImageDoc, doneCallback) {
@@ -8857,10 +8849,10 @@ Object.defineProperty(exports, "recordParticipation", ({
8857
8849
  return _participation.recordParticipation;
8858
8850
  }
8859
8851
  }));
8860
- Object.defineProperty(exports, "renderPartipants", ({
8852
+ Object.defineProperty(exports, "renderParticipants", ({
8861
8853
  enumerable: true,
8862
8854
  get: function get() {
8863
- return _participation.renderPartipants;
8855
+ return _participation.renderParticipants;
8864
8856
  }
8865
8857
  }));
8866
8858
  exports.xmlEncode = xmlEncode;
@@ -8878,6 +8870,7 @@ var _widgets = __webpack_require__(/*! ./widgets */ "./lib/widgets/index.js");
8878
8870
  var _utils = __webpack_require__(/*! ./utils */ "./lib/utils/index.js");
8879
8871
  var _debug = __webpack_require__(/*! ./debug */ "./lib/debug.js");
8880
8872
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
8873
+ var style = _interopRequireWildcard(__webpack_require__(/*! ./style */ "./lib/style.js"));
8881
8874
  var _participation = __webpack_require__(/*! ./participation */ "./lib/participation.js");
8882
8875
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
8883
8876
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
@@ -8945,7 +8938,7 @@ function lightColorHash(author) {
8945
8938
  /** notepad
8946
8939
  *
8947
8940
  * @param {HTMLDocument} dom - the web page of the browser
8948
- * @param {NamedNode} padDoc - the document into which the particpation should be shown
8941
+ * @param {NamedNode} padDoc - the document in which the participation should be shown
8949
8942
  * @param {NamedNode} subject - the thing in which participation is happening
8950
8943
  * @param {NamedNode} me - person who is logged into the pod
8951
8944
  * @param {notepadOptions} options - the options that can be passed in consist of statusArea, exists
@@ -8958,7 +8951,7 @@ function notepad(dom, padDoc, subject, me, options) {
8958
8951
  if (me && !me.uri) throw new Error('UI.pad.notepad: Invalid userid');
8959
8952
  var updater = store.updater;
8960
8953
  var PAD = (0, _rdflib.Namespace)('http://www.w3.org/ns/pim/pad#');
8961
- table.setAttribute('style', 'padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;');
8954
+ table.setAttribute('style', style.notepadStyle);
8962
8955
  var upstreamStatus = null;
8963
8956
  var downstreamStatus = null;
8964
8957
  if (options.statusArea) {
@@ -8967,10 +8960,10 @@ function notepad(dom, padDoc, subject, me, options) {
8967
8960
  upstreamStatus = tr.appendChild(dom.createElement('td'));
8968
8961
  downstreamStatus = tr.appendChild(dom.createElement('td'));
8969
8962
  if (upstreamStatus) {
8970
- upstreamStatus.setAttribute('style', 'width:50%');
8963
+ upstreamStatus.setAttribute('style', style.upstreamStatus);
8971
8964
  }
8972
8965
  if (downstreamStatus) {
8973
- downstreamStatus.setAttribute('style', 'width:50%');
8966
+ downstreamStatus.setAttribute('style', style.downstreamStatus);
8974
8967
  }
8975
8968
  }
8976
8969
  /* @@ TODO want to look into this, it seems upstream should be a boolean and default to false ?
@@ -8993,9 +8986,9 @@ function notepad(dom, padDoc, subject, me, options) {
8993
8986
  var setPartStyle = function setPartStyle(part, colors, pending) {
8994
8987
  var chunk = part.subject;
8995
8988
  colors = colors || '';
8996
- var baseStyle = 'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;';
8997
- var headingCore = 'font-family: sans-serif; font-weight: bold; border: none;';
8998
- var headingStyle = ['font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;', 'font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;', 'font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;'];
8989
+ var baseStyle = style.baseStyle;
8990
+ var headingCore = style.headingCore;
8991
+ var headingStyle = style.headingStyle;
8999
8992
  var author = kb.any(chunk, ns.dc('author'));
9000
8993
  if (!colors && author) {
9001
8994
  // Hash the user webid for now -- later allow user selection!
@@ -9007,9 +9000,9 @@ function notepad(dom, padDoc, subject, me, options) {
9007
9000
  // and when the indent is stored as a Number itself, not in an object.
9008
9001
  var indent = kb.any(chunk, PAD('indent'));
9009
9002
  indent = indent ? indent.value : 0;
9010
- var style = indent >= 0 ? baseStyle + 'text-indent: ' + indent * 3 + 'em;' : headingCore + headingStyle[-1 - indent];
9003
+ var localStyle = indent >= 0 ? baseStyle + 'text-indent: ' + indent * 3 + 'em;' : headingCore + headingStyle[-1 - indent];
9011
9004
  // ? baseStyle + 'padding-left: ' + (indent * 3) + 'em;'
9012
- part.setAttribute('style', style + colors);
9005
+ part.setAttribute('style', localStyle + colors);
9013
9006
  };
9014
9007
  var removePart = function removePart(part) {
9015
9008
  var chunk = part.subject;
@@ -9088,29 +9081,6 @@ function notepad(dom, padDoc, subject, me, options) {
9088
9081
  }
9089
9082
  });
9090
9083
  };
9091
-
9092
- // Use this sort of code to split the line when return pressed in the middle @@
9093
- /*
9094
- function doGetCaretPosition doGetCaretPosition (oField) {
9095
- var iCaretPos = 0
9096
- // IE Support
9097
- if (document.selection) {
9098
- // Set focus on the element to avoid IE bug
9099
- oField.focus()
9100
- // To get cursor position, get empty selection range
9101
- var oSel = document.selection.createRange()
9102
- // Move selection start to 0 position
9103
- oSel.moveStart('character', -oField.value.length)
9104
- // The caret position is selection length
9105
- iCaretPos = oSel.text.length
9106
- // Firefox suppor
9107
- } else if (oField.selectionStart || oField.selectionStart === '0') {
9108
- iCaretPos = oField.selectionStart
9109
- }
9110
- // Return results
9111
- return (iCaretPos)
9112
- }
9113
- */
9114
9084
  var addListeners = function addListeners(part, chunk) {
9115
9085
  part.addEventListener('keydown', function (event) {
9116
9086
  if (!updater) {
@@ -9151,9 +9121,9 @@ function notepad(dom, padDoc, subject, me, options) {
9151
9121
  // contents need to be sent again
9152
9122
  part.state = 4; // delete me
9153
9123
  return;
9154
- case 3: // being deleted already
9124
+ case 3: // already being deleted
9155
9125
  case 4:
9156
- // already deleme state
9126
+ // already deleted state
9157
9127
  return;
9158
9128
  case undefined:
9159
9129
  case 0:
@@ -9453,8 +9423,6 @@ function notepad(dom, padDoc, subject, me, options) {
9453
9423
  }
9454
9424
  return;
9455
9425
  }
9456
- // var last = kb.the(undefined, PAD('previous'), subject)
9457
- // var chunk = first // = kb.the(subject, PAD('next'));
9458
9426
  var row;
9459
9427
 
9460
9428
  // First see which of the logical chunks have existing physical manifestations
@@ -9516,7 +9484,7 @@ function notepad(dom, padDoc, subject, me, options) {
9516
9484
  (0, _debug.log)(' reloaded OK');
9517
9485
  clearStatus();
9518
9486
  if (!consistencyCheck()) {
9519
- complain('CONSITENCY CHECK FAILED');
9487
+ complain('CONSISTENCY CHECK FAILED');
9520
9488
  } else {
9521
9489
  refreshTree(table);
9522
9490
  }
@@ -9681,7 +9649,7 @@ Object.defineProperty(exports, "__esModule", ({
9681
9649
  exports.manageParticipation = manageParticipation;
9682
9650
  exports.participationObject = participationObject;
9683
9651
  exports.recordParticipation = recordParticipation;
9684
- exports.renderPartipants = renderPartipants;
9652
+ exports.renderParticipants = renderParticipants;
9685
9653
  var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
9686
9654
  var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
9687
9655
  var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
@@ -9697,6 +9665,8 @@ var ns = _interopRequireWildcard(__webpack_require__(/*! ./ns */ "./lib/ns.js"))
9697
9665
  var _widgets = __webpack_require__(/*! ./widgets */ "./lib/widgets/index.js");
9698
9666
  var _utils = __webpack_require__(/*! ./utils */ "./lib/utils/index.js");
9699
9667
  var _pad = __webpack_require__(/*! ./pad */ "./lib/pad.js");
9668
+ var style = _interopRequireWildcard(__webpack_require__(/*! ./style */ "./lib/style.js"));
9669
+ var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ./styleConstants */ "./lib/styleConstants.js"));
9700
9670
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
9701
9671
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
9702
9672
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
@@ -9704,7 +9674,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
9704
9674
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9705
9675
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9706
9676
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
9707
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* Manage a UI for the particpation of a person in any thing
9677
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* Manage a UI for the participation of a person in any thing
9708
9678
  */ // import { currentUser } from './authn/authn'
9709
9679
  var ParticipationTableElement = /*#__PURE__*/function (_HTMLTableElement) {
9710
9680
  (0, _inherits2["default"])(ParticipationTableElement, _HTMLTableElement);
@@ -9730,11 +9700,11 @@ var store = _solidLogic.solidLogicSingleton.store;
9730
9700
  * @param {NamedNode} unused1/document - the document to render (this argument is no longer used, but left in for backwards compatibility)
9731
9701
  * @param {NamedNode} subject - the thing in which the participation is happening
9732
9702
  * @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)
9733
- * @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button
9703
+ * @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable; these are used by the personTR button
9734
9704
  */
9735
- function renderPartipants(dom, table, unused1, subject, unused2, options) {
9736
- table.setAttribute('style', 'margin: 0.8em;');
9737
- var newRowForParticpation = function newRowForParticpation(parp) {
9705
+ function renderParticipants(dom, table, unused1, subject, unused2, options) {
9706
+ table.setAttribute('style', style.participantsStyle);
9707
+ var newRowForParticipation = function newRowForParticipation(parp) {
9738
9708
  var person = store.any(parp, ns.wf('participant'));
9739
9709
  var tr;
9740
9710
  if (!person) {
@@ -9742,13 +9712,14 @@ function renderPartipants(dom, table, unused1, subject, unused2, options) {
9742
9712
  tr.textContent = '???'; // Don't crash - invalid part'n entry
9743
9713
  return tr;
9744
9714
  }
9745
- var bg = store.anyValue(parp, ns.ui('backgroundColor')) || 'white';
9715
+ var bg = store.anyValue(parp, ns.ui('backgroundColor')) || _styleConstants["default"].participationDefaultBackground;
9746
9716
  var block = dom.createElement('div');
9747
- block.setAttribute('style', 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' + bg);
9717
+ block.setAttribute('style', style.participantsBlock);
9718
+ block.style.backgroundColor = bg;
9748
9719
  tr = (0, _widgets.personTR)(dom, null, person, options);
9749
9720
  table.appendChild(tr);
9750
9721
  var td = dom.createElement('td');
9751
- td.setAttribute('style', 'vertical-align: middle;');
9722
+ td.setAttribute('style', style.personTableTD);
9752
9723
  td.appendChild(block);
9753
9724
  tr.insertBefore(td, tr.firstChild);
9754
9725
  return tr;
@@ -9762,16 +9733,16 @@ function renderPartipants(dom, table, unused1, subject, unused2, options) {
9762
9733
  var participations = parps.map(function (p) {
9763
9734
  return p[1];
9764
9735
  });
9765
- (0, _utils.syncTableToArray)(table, participations, newRowForParticpation);
9736
+ (0, _utils.syncTableToArray)(table, participations, newRowForParticipation);
9766
9737
  };
9767
9738
  table.refresh = syncTable;
9768
9739
  syncTable();
9769
9740
  return table;
9770
9741
  }
9771
9742
 
9772
- /** Record, or find old, Particpation object
9743
+ /** Record, or find old, Participation object
9773
9744
  *
9774
- * A particpaption object is a place to record things specifically about
9745
+ * A participation object is a place to record things specifically about
9775
9746
  * subject and the user, such as preferences, start of membership, etc
9776
9747
  * @param {NamedNode} subject - the thing in which the participation is happening
9777
9748
  * @param {NamedNode} document - where to record the data
@@ -9806,19 +9777,19 @@ function participationObject(subject, padDoc, me) {
9806
9777
  }
9807
9778
  candidates.sort(); // Pick the earliest
9808
9779
  // @@ Possibly, for extra credit, delete the others, if we have write access
9809
- debug.warn('Multiple particpation objects, picking earliest, in ' + padDoc);
9780
+ debug.warn('Multiple participation objects, picking earliest, in ' + padDoc);
9810
9781
  resolve(candidates[0][1]);
9811
9782
  // throw new Error('Multiple records of your participation')
9812
9783
  }
9813
9784
  if (parps.length) {
9814
9785
  // If I am not already recorded
9815
- resolve(parps[0]); // returns the particpation object
9786
+ resolve(parps[0]); // returns the participation object
9816
9787
  } else {
9817
9788
  var _participation2 = (0, _widgets.newThing)(padDoc);
9818
9789
  var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), _participation2, padDoc), (0, _rdflib.st)(_participation2, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(_participation2, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(_participation2, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
9819
9790
  store.updater.update([], ins, function (uri, ok, errorMessage) {
9820
9791
  if (!ok) {
9821
- reject(new Error('Error recording your partipation: ' + errorMessage));
9792
+ reject(new Error('Error recording your participation: ' + errorMessage));
9822
9793
  } else {
9823
9794
  resolve(_participation2);
9824
9795
  }
@@ -9831,7 +9802,7 @@ function participationObject(subject, padDoc, me) {
9831
9802
  /** Record my participation and display participants
9832
9803
  *
9833
9804
  * @param {NamedNode} subject - the thing in which participation is happening
9834
- * @param {NamedNode} padDoc - the document into which the particpation should be recorded
9805
+ * @param {NamedNode} padDoc - the document into which the participation should be recorded
9835
9806
  * @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works
9836
9807
  *
9837
9808
  */
@@ -9847,22 +9818,21 @@ function recordParticipation(subject, padDoc, refreshable) {
9847
9818
  }
9848
9819
  if (parps.length) {
9849
9820
  // If I am not already recorded
9850
- return parps[0]; // returns the particpation object
9821
+ return parps[0]; // returns the participation object
9851
9822
  } else {
9852
9823
  if (!store.updater.editable(padDoc)) {
9853
- debug.log('Not recording participation, as no write acesss as ' + me + ' to ' + padDoc);
9824
+ debug.log('Not recording participation, as no write access as ' + me + ' to ' + padDoc);
9854
9825
  return null;
9855
9826
  }
9856
9827
  var participation = (0, _widgets.newThing)(padDoc);
9857
9828
  var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), participation, padDoc), (0, _rdflib.st)(participation, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(participation, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(participation, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
9858
9829
  store.updater.update([], ins, function (uri, ok, errorMessage) {
9859
9830
  if (!ok) {
9860
- throw new Error('Error recording your partipation: ' + errorMessage);
9831
+ throw new Error('Error recording your participation: ' + errorMessage);
9861
9832
  }
9862
9833
  if (refreshable && refreshable.refresh) {
9863
9834
  refreshable.refresh();
9864
9835
  }
9865
- // UI.pad.renderPartipants(dom, table, padDoc, subject, me, options)
9866
9836
  });
9867
9837
  return participation;
9868
9838
  }
@@ -9872,21 +9842,21 @@ function recordParticipation(subject, padDoc, refreshable) {
9872
9842
  *
9873
9843
  * @param {Document} dom - the web page loaded into the browser
9874
9844
  * @param {HTMLDivElement} container - the container element where the participants should be displayed
9875
- * @param {NamedNode} document - the document into which the particpation should be shown
9845
+ * @param {NamedNode} document - the document into which the participation should be shown
9876
9846
  * @param {NamedNode} subject - the thing in which participation is happening
9877
9847
  * @param {NamedNode} me - the logged in user
9878
- * @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button
9848
+ * @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable; these are used by the personTR button
9879
9849
  *
9880
9850
  */
9881
9851
  function manageParticipation(dom, container, padDoc, subject, me, options) {
9882
9852
  var table = dom.createElement('table');
9883
9853
  container.appendChild(table);
9884
- renderPartipants(dom, table, padDoc, subject, me, options);
9854
+ renderParticipants(dom, table, padDoc, subject, me, options);
9885
9855
  var _participation;
9886
9856
  try {
9887
9857
  _participation = recordParticipation(subject, padDoc, table);
9888
9858
  } catch (e) {
9889
- container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your partipation: ' + e)); // Clean up?
9859
+ container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your participation: ' + e)); // Clean up?
9890
9860
  }
9891
9861
  return table;
9892
9862
  }
@@ -10257,41 +10227,34 @@ Signup.prototype.signup = function signup(signupUrl) {
10257
10227
  /*!**********************!*\
10258
10228
  !*** ./lib/style.js ***!
10259
10229
  \**********************/
10260
- /***/ ((module, exports) => {
10230
+ /***/ ((module, exports, __webpack_require__) => {
10261
10231
 
10262
10232
  "use strict";
10263
10233
 
10264
10234
 
10235
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
10265
10236
  Object.defineProperty(exports, "__esModule", ({
10266
10237
  value: true
10267
10238
  }));
10268
10239
  exports.style = void 0;
10240
+ var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ./styleConstants */ "./lib/styleConstants.js"));
10269
10241
  // Common readable consistent stylesheet
10270
10242
  // to avoid using style sheets which are document-global
10271
10243
  // and make programmable style toggling with selection, drag over, etc easier
10272
-
10273
10244
  // These must all end with semicolon so they can be appended to.
10274
10245
 
10275
- var formBorderColor = '#888888'; // Mid-grey
10276
- var lowProfileLinkColor = '#3B5998'; // Grey-blue, e.g., for field labels linking to ontology
10277
- var formFieldNameBoxWidth = '8em'; // The fixed amount to get form fields to line up
10278
- // The latter we put in when switching awy from using tables. Getting allignment between
10279
- // fields in different groups though is hard problem.
10280
-
10281
10246
  var style = exports.style = {
10282
10247
  // styleModule
10283
10248
 
10284
10249
  checkboxStyle: 'color: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;',
10285
- checkboxInputStyle: 'font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em',
10250
+ checkboxInputStyle: 'font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em;',
10286
10251
  fieldLabelStyle: 'color: #3B5998; text-decoration: none;',
10287
- formSelectSTyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
10288
- textInputStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
10252
+ formSelectStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
10253
+ textInputStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
10289
10254
  textInputStyleUneditable:
10290
10255
  // Color difference only
10291
- 'background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;',
10292
- textInputSize: 20,
10293
- // Default text input size in characters roughly
10294
- buttonStyle: 'background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;',
10256
+ 'background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;',
10257
+ buttonStyle: 'background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;',
10295
10258
  // 'background-color: #eef;
10296
10259
  commentStyle: 'padding: 0.7em; border: none; font-size: 100%; white-space: pre-wrap;',
10297
10260
  iconStyle: 'width: 3em; height: 3em; margin: 0.1em; border-radius: 1em;',
@@ -10299,20 +10262,18 @@ var style = exports.style = {
10299
10262
  classIconStyle: 'width: 3em; height: 3em; margin: 0.1em; border-radius: 0.2em; border: 0.1em solid green; padding: 0.2em; background-color: #efe;',
10300
10263
  // combine with buttonStyle
10301
10264
  confirmPopupStyle: 'padding: 0.7em; border-radius: 0.2em; border: 0.1em solid orange; background-color: white; box-shadow: 0.5em 0.9em #888;',
10302
- tabBorderRadius: '0.2em',
10303
10265
  messageBodyStyle: 'white-space: pre-wrap; width: 99%; font-size:100%; border: 0.07em solid #eee; border-radius:0.2em; padding: .3em 0.5em; margin: 0.1em;',
10304
10266
  pendingeditModifier: 'color: #bbb;',
10305
- highlightColor: '#7C4DFF',
10306
- // Solid lavendar https://design.inrupt.com/atomic-core/?cat=Core
10307
-
10308
10267
  // Contacts
10309
10268
  personaBarStyle: 'width: 100%; height: 4em; background-color: #eee; vertical-align: middle;',
10310
10269
  searchInputStyle: 'border: 0.1em solid #444; border-radius: 0.2em; width: 100%; font-size: 100%; padding: 0.1em 0.6em; margin 0.2em;',
10311
10270
  autocompleteRowStyle: 'border: 0.2em solid straw;',
10312
10271
  // Login buttons
10313
- signInButtonStyle: 'padding: 1em; border-radius:0.2em; font-size: 100%;',
10272
+ signInAndUpButtonStyle: 'padding: 1em; border-radius:0.2em; font-size: 100%;',
10314
10273
  // was 0.5em radius
10315
-
10274
+ headerBannerLoginInput: 'margin: 0.75em 0 0.75em 0.5em !important; padding: 0.5em !important;',
10275
+ signUpBackground: 'background-color: #eef;',
10276
+ signInBackground: 'background-color: #efe;',
10316
10277
  // Forms
10317
10278
  heading1Style: 'font-size: 180%; font-weight: bold; color: #888888; padding: 0.5em; margin: 0.7em 0.0m;',
10318
10279
  // originally was brown; now grey
@@ -10323,87 +10284,104 @@ var style = exports.style = {
10323
10284
  heading4Style: 'font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;',
10324
10285
  // Lowest level used by default in small things
10325
10286
 
10326
- formBorderColor: formBorderColor,
10327
- // originally was brown; now grey
10328
- formHeadingColor: '#888888',
10329
- // originally was brown; now grey
10330
10287
  formHeadingStyle: 'font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;',
10331
10288
  // originally was brown; now grey
10332
10289
  formTextInput: 'font-size: 100%; margin: 0.1em; padding: 0.1em;',
10333
10290
  // originally used this
10334
- formGroupStyle: ["padding-left: 0em; border: 0.0em solid ".concat(formBorderColor, "; border-radius: 0.2em;"), // weight 0
10335
- "padding-left: 2em; border: 0.05em solid ".concat(formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.1em solid ".concat(formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.2em solid ".concat(formBorderColor, "; border-radius: 0.2em;") // @@ pink
10291
+ formGroupStyle: ["padding-left: 0em; border: 0.0em solid ".concat(_styleConstants["default"].formBorderColor, "; border-radius: 0.2em;"), // weight 0
10292
+ "padding-left: 2em; border: 0.05em solid ".concat(_styleConstants["default"].formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.1em solid ".concat(_styleConstants["default"].formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.2em solid ".concat(_styleConstants["default"].formBorderColor, "; border-radius: 0.2em;") // @@ pink
10336
10293
  ],
10337
- formFieldLabelStyle: "'color: ".concat(lowProfileLinkColor, "; text-decoration: none;'"),
10338
- formFieldNameBoxWidth: formFieldNameBoxWidth,
10339
- formFieldNameBoxStyle: "padding: 0.3em; vertical-align: middle; width:".concat(formFieldNameBoxWidth, ";"),
10340
- textInputBackgroundColor: '#eef',
10341
- textInputBackgroundColorUneditable: '#fff',
10342
- textInputColor: '#000',
10343
- textInputColorPending: '#888',
10294
+ formFieldLabelStyle: "color: ".concat(_styleConstants["default"].lowProfileLinkColor, "; text-decoration: none;"),
10295
+ formFieldNameBoxStyle: "padding: 0.3em; vertical-align: middle; width:".concat(_styleConstants["default"].formFieldNameBoxWidth, ";"),
10344
10296
  multilineTextInputStyle: 'font-size:100%; white-space: pre-wrap; background-color: #eef;' + ' border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;',
10345
10297
  // Buttons
10346
10298
  renderAsDivStyle: 'display: flex; align-items: center; justify-content: space-between; height: 2.5em; padding: 1em;',
10347
10299
  imageDivStyle: 'width:2.5em; padding:0.5em; height: 2.5em;',
10348
10300
  linkDivStyle: 'width:2em; padding:0.5em; height: 4em;',
10349
10301
  // ACL
10350
- aclControlBoxContainer: 'margin: 1em',
10351
- aclControlBoxHeader: 'font-size: 120%; margin: 0 0 1rem',
10352
- aclControlBoxStatus: 'display: none; margin: 1rem 0',
10353
- aclControlBoxStatusRevealed: 'display: block',
10354
- aclGroupContent: 'maxWidth: 650',
10355
- accessGroupList: 'display: grid; grid-template-columns: 1fr; margin: 1em; width: 100%',
10356
- accessGroupListItem: 'display: grid; grid-template-columns: 100px auto 30%',
10357
- defaultsController: 'display: flex',
10358
- defaultsControllerNotice: 'color: #888; flexGrow: 1; fontSize: 80%',
10359
- bigButton: 'background-color: white; border: 0.1em solid #888; border-radius: 0.3em; max-width: 50%; padding-bottom: 1em; padding-top: 1em',
10360
- group: 'color: #888',
10361
- group1: 'color: green',
10362
- group2: 'color: #cc0',
10363
- group3: 'color: orange',
10364
- group5: 'color: red',
10365
- group9: 'color: blue',
10366
- group13: 'color: purple',
10367
- trustedAppAddApplicationsTable: 'background-color: #eee',
10368
- trustedAppCancelButton: 'float: right',
10369
- trustedAppControllerI: 'border-color: orange; borderRadius: 1em; borderWidth: 0.1em',
10370
- temporaryStatusInit: 'background: green',
10371
- temporaryStatusEnd: 'background: transparent; transition: background 5s linear',
10302
+ aclControlBoxContainer: 'margin: 1em;',
10303
+ aclControlBoxHeader: 'font-size: 120%; margin: 0 0 1rem;',
10304
+ aclControlBoxStatus: 'display: none; margin: 1rem 0;',
10305
+ aclControlBoxStatusRevealed: 'display: block;',
10306
+ aclGroupContent: 'maxWidth: 650;',
10307
+ accessGroupList: 'display: grid; grid-template-columns: 1fr; margin: 1em; width: 100%;',
10308
+ accessGroupListItem: 'display: grid; grid-template-columns: 100px auto 30%;',
10309
+ defaultsController: 'display: flex;',
10310
+ defaultsControllerNotice: 'color: #888; flexGrow: 1; fontSize: 80%;',
10311
+ bigButton: 'background-color: white; border: 0.1em solid #888; border-radius: 0.3em; max-width: 50%; padding-bottom: 1em; padding-top: 1em;',
10312
+ group: 'color: #888;',
10313
+ group1: 'color: green;',
10314
+ group2: 'color: #cc0;',
10315
+ group3: 'color: orange;',
10316
+ group5: 'color: red;',
10317
+ group9: 'color: blue;',
10318
+ group13: 'color: purple;',
10319
+ trustedAppAddApplicationsTable: 'background-color: #eee;',
10320
+ trustedAppCancelButton: 'float: right;',
10321
+ trustedAppControllerI: 'border-color: orange; border-radius: 1em; border-width: 0.1em;',
10322
+ temporaryStatusInit: 'background: green;',
10323
+ temporaryStatusEnd: 'background: transparent; transition: background 5s linear;',
10372
10324
  // header
10373
- headerUserMenuLink: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none',
10374
- headerUserMenuLinkHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%)',
10375
- headerUserMenuTrigger: 'background: none; border: 0; cursor: pointer; width: 60px; height: 60px',
10376
- headerUserMenuTriggerImg: 'border-radius: 50%; height: 56px; width: 28px !important',
10377
- headerUserMenuButton: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%',
10378
- headerUserMenuButtonHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%)',
10379
- headerUserMenuList: 'list-style: none; margin: 0; padding: 0',
10380
- headerUserMenuListDisplay: 'list-style: none; margin: 0; padding: 0; display:true',
10381
- headerUserMenuNavigationMenu: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: true',
10382
- headerUserMenuNavigationMenuNotDisplayed: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: none',
10383
- headerUserMenuListItem: 'border-bottom: solid 1px #000000',
10384
- headerUserMenuPhoto: 'border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px',
10385
- headerBanner: 'box-shadow: 0px 1px 4px #000000; display: flex; justify-content: space-between; padding: 0 1.5em; margin-bottom: 4px',
10386
- headerBannerLink: 'display: block',
10387
- headerBannerRightMenu: 'display: flex',
10388
- headerBannerLogin: 'margin-left: auto',
10389
- allChildrenVisible: 'display:true',
10390
- headerBannerLoginInput: 'margin: 0.75em 0 0.75em 0.5em !important; padding: 0.5em !important',
10391
- headerBannerUserMenu: 'border-left: solid 1px #000000; margin-left: auto',
10392
- headerBannerHelpMenu: 'border-left: solid 1px #000000; margin.left: auto',
10393
- headerBannerIcon: 'background-size: 65px 60px !important; height: 60px !important; width: 65px !important',
10325
+ headerUserMenuLink: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none;',
10326
+ headerUserMenuLinkHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);',
10327
+ headerUserMenuTrigger: 'background: none; border: 0; cursor: pointer; width: 60px; height: 60px;',
10328
+ headerUserMenuTriggerImg: 'border-radius: 50%; height: 56px; width: 28px !important;',
10329
+ headerUserMenuButton: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%;',
10330
+ headerUserMenuButtonHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);',
10331
+ headerUserMenuList: 'list-style: none; margin: 0; padding: 0;',
10332
+ headerUserMenuListDisplay: 'list-style: none; margin: 0; padding: 0; display:true;',
10333
+ headerUserMenuNavigationMenu: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: true;',
10334
+ headerUserMenuNavigationMenuNotDisplayed: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: none;',
10335
+ headerUserMenuListItem: 'border-bottom: solid 1px #000000;',
10336
+ headerUserMenuPhoto: 'border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px;',
10337
+ headerBanner: 'box-shadow: 0px 1px 4px #000000; display: flex; justify-content: space-between; padding: 0 1.5em; margin-bottom: 4px;',
10338
+ headerBannerLink: 'display: block;',
10339
+ headerBannerRightMenu: 'display: flex;',
10340
+ headerBannerLogin: 'margin-left: auto;',
10341
+ allChildrenVisible: 'display:true;',
10342
+ headerBannerUserMenu: 'border-left: solid 1px #000000; margin-left: auto;',
10343
+ headerBannerHelpMenu: 'border-left: solid 1px #000000; margin-left: auto;',
10344
+ headerBannerIcon: 'background-size: 65px 60px !important; height: 60px !important; width: 65px !important;',
10394
10345
  // may just be 65px round($icon-size * 352 / 322);
10395
10346
 
10396
10347
  // footer
10397
- footer: 'border-top: solid 1px $divider-color; font-size: 0.9em; padding: 0.5em 1.5em',
10348
+ footer: 'border-top: solid 1px $divider-color; font-size: 0.9em; padding: 0.5em 1.5em;',
10398
10349
  // buttons
10399
- primaryButton: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
10400
- primaryButtonHover: 'background-color: #9f7dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out',
10401
- primaryButtonNoBorder: 'background-color: #ffffff; color: #7c4dff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
10402
- primaryButtonNoBorderHover: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out',
10403
- secondaryButton: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
10404
- secondaryButtonHover: 'background-color: #37cde6; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out',
10405
- secondaryButtonNoBorder: 'background-color: #ffffff; color: #01c9ea; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
10406
- secondaryButtonNoBorderHover: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out'
10350
+ primaryButton: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
10351
+ primaryButtonHover: 'background-color: #9f7dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
10352
+ primaryButtonNoBorder: 'background-color: #ffffff; color: #7c4dff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
10353
+ primaryButtonNoBorderHover: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
10354
+ secondaryButton: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
10355
+ secondaryButtonHover: 'background-color: #37cde6; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
10356
+ secondaryButtonNoBorder: 'background-color: #ffffff; color: #01c9ea; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
10357
+ secondaryButtonNoBorderHover: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
10358
+ // media
10359
+ controlStyle: "border-radius: 0.5em; margin: 0.8em; width:".concat(_styleConstants["default"].mediaModuleCanvasWidth, "; height:").concat(_styleConstants["default"].mediaModuleCanvasHeight, ";"),
10360
+ // dragAndDrop
10361
+ dragEvent: 'background-color: #ccc; border: 0.25em dashed black; border-radius: 0.3em;',
10362
+ dropEvent: 'background-color: white; border: 0em solid black;',
10363
+ restoreStyle: 'background-color: white;',
10364
+ // errors
10365
+ errorCancelButton: 'width: 2em; height: 2em; align: right;',
10366
+ errorMessageBlockStyle: 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; color:black;',
10367
+ // pad
10368
+ notepadStyle: 'padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;',
10369
+ upstreamStatus: 'width: 50%;',
10370
+ downstreamStatus: 'width: 50%;',
10371
+ baseStyle: 'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;',
10372
+ headingCore: 'font-family: sans-serif; font-weight: bold; border: none;',
10373
+ headingStyle: ['font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;', 'font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;', 'font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;'],
10374
+ // participation
10375
+ participantsStyle: 'margin: 0.8em;',
10376
+ participantsBlock: 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888;',
10377
+ personTableTD: 'vertical-align: middle;',
10378
+ // tabs
10379
+ tabsNavElement: 'margin: 0;',
10380
+ tabsRootElement: 'display: flex; height: 100%; width: 100%;',
10381
+ tabsMainElement: 'margin: 0; width:100%; height: 100%;',
10382
+ tabContainer: 'list-style-type: none; display: flex; height: 100%; width: 100%; margin: 0; padding: 0;',
10383
+ makeNewSlot: 'background: none; border: none; font: inherit; cursor: pointer;',
10384
+ ellipsis: 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;'
10407
10385
  };
10408
10386
  style.setStyle = function setStyle(ele, styleName) {
10409
10387
  ele.style = style[styleName];
@@ -10413,6 +10391,51 @@ module.exports = style; // @@ No way to do this in ESM
10413
10391
 
10414
10392
  /***/ }),
10415
10393
 
10394
+ /***/ "./lib/styleConstants.js":
10395
+ /*!*******************************!*\
10396
+ !*** ./lib/styleConstants.js ***!
10397
+ \*******************************/
10398
+ /***/ ((__unused_webpack_module, exports) => {
10399
+
10400
+ "use strict";
10401
+
10402
+
10403
+ Object.defineProperty(exports, "__esModule", ({
10404
+ value: true
10405
+ }));
10406
+ exports["default"] = void 0;
10407
+ var _default = exports["default"] = {
10408
+ highlightColor: '#7C4DFF',
10409
+ // Solid lavender https://design.inrupt.com/atomic-core/?cat=Core
10410
+
10411
+ formBorderColor: '#888888',
10412
+ // Mid-grey
10413
+ formHeadingColor: '#888888',
10414
+ // originally was brown; now grey
10415
+ lowProfileLinkColor: '#3B5998',
10416
+ // Grey-blue, e.g., for field labels linking to ontology
10417
+ formFieldNameBoxWidth: '8em',
10418
+ // The fixed amount to get form fields to line up
10419
+ // We put in the latter when switching away from using tables. However, getting
10420
+ // alignment between fields in different groups is a hard problem.
10421
+
10422
+ mediaModuleCanvasWidth: '640',
10423
+ mediaModuleCanvasHeight: '480',
10424
+ textInputSize: 20,
10425
+ // Rough default text input size, in characters
10426
+ tabBorderRadius: '0.2em',
10427
+ textInputBackgroundColor: '#eef',
10428
+ textInputBackgroundColorUneditable: '#fff',
10429
+ textInputColor: '#000',
10430
+ textInputColorPending: '#888',
10431
+ defaultErrorBackgroundColor: '#fee',
10432
+ participationDefaultBackground: 'white',
10433
+ basicMaxLength: '4096'
10434
+ };
10435
+ //# sourceMappingURL=styleConstants.js.map
10436
+
10437
+ /***/ }),
10438
+
10416
10439
  /***/ "./lib/style_multiSelect.js":
10417
10440
  /*!**********************************!*\
10418
10441
  !*** ./lib/style_multiSelect.js ***!
@@ -12079,6 +12102,7 @@ function renderTableViewPane(doc, options) {
12079
12102
 
12080
12103
 
12081
12104
  var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
12105
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
12082
12106
  Object.defineProperty(exports, "__esModule", ({
12083
12107
  value: true
12084
12108
  }));
@@ -12095,7 +12119,10 @@ var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/ru
12095
12119
  var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
12096
12120
  var _widgets = __webpack_require__(/*! ./widgets */ "./lib/widgets/index.js");
12097
12121
  var _utils = __webpack_require__(/*! ./utils */ "./lib/utils/index.js");
12122
+ var style = _interopRequireWildcard(__webpack_require__(/*! ./style */ "./lib/style.js"));
12098
12123
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
12124
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12125
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
12099
12126
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
12100
12127
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12101
12128
  /**
@@ -12277,11 +12304,12 @@ var TabElement = /*#__PURE__*/function (_HTMLElement3) {
12277
12304
  *
12278
12305
  * @param options
12279
12306
  */
12307
+ var tabsDefaultBackgroundColor = '#ddddcc';
12280
12308
  function tabWidget(options) {
12281
12309
  var subject = options.subject;
12282
12310
  var dom = options.dom || document;
12283
12311
  var orientation = parseInt(options.orientation || '0');
12284
- var backgroundColor = options.backgroundColor || '#ddddcc';
12312
+ var backgroundColor = options.backgroundColor || tabsDefaultBackgroundColor;
12285
12313
  var flipped = orientation & 2;
12286
12314
  var vertical = orientation & 1;
12287
12315
  var onClose = options.onClose;
@@ -12292,13 +12320,15 @@ function tabWidget(options) {
12292
12320
  var bodyMainStyle = "flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ".concat(selectedColor, "; padding: 1em;");
12293
12321
  var rootElement = dom.createElement('div'); // 20200117a
12294
12322
 
12295
- rootElement.setAttribute('style', 'display: flex; height: 100%; width: 100%; flex-direction: ' + (vertical ? 'row' : 'column') + (flipped ? '-reverse;' : ';'));
12323
+ rootElement.setAttribute('style', style.tabsRootElement);
12324
+ rootElement.style.flexDirection = (vertical ? 'row' : 'column') + (flipped ? '-reverse;' : ';');
12296
12325
  var navElement = rootElement.appendChild(dom.createElement('nav'));
12297
- navElement.setAttribute('style', 'margin: 0;');
12326
+ navElement.setAttribute('style', style.tabsNavElement);
12298
12327
  var mainElement = rootElement.appendChild(dom.createElement('main'));
12299
- mainElement.setAttribute('style', 'margin: 0; width:100%; height: 100%;'); // override tabbedtab.css
12328
+ mainElement.setAttribute('style', style.tabsMainElement); // override tabbedtab.css
12300
12329
  var tabContainer = navElement.appendChild(dom.createElement('ul'));
12301
- tabContainer.setAttribute('style', "\n list-style-type: none;\n display: flex;\n height: 100%;\n width: 100%;\n margin: 0;\n padding: 0;\n flex-direction: ".concat(vertical ? 'column' : 'row', "\n "));
12330
+ tabContainer.setAttribute('style', style.tabContainer);
12331
+ tabContainer.style.flexDirection = "".concat(vertical ? 'column' : 'row');
12302
12332
  var tabElement = 'li';
12303
12333
  var bodyContainer = mainElement;
12304
12334
  rootElement.tabContainer = tabContainer;
@@ -12318,7 +12348,7 @@ function tabWidget(options) {
12318
12348
  rootElement.refresh = orderedSync;
12319
12349
  orderedSync();
12320
12350
  if (!options.startEmpty && tabContainer.children.length && options.selectedTab) {
12321
- var selectedTab0 = Array.from(tabContainer.children) // Version left for compatability with ??
12351
+ var selectedTab0 = Array.from(tabContainer.children) // Version left for compatibility with ??
12322
12352
  .map(function (tab) {
12323
12353
  return tab.firstChild;
12324
12354
  }).find(function (tab) {
@@ -12371,7 +12401,7 @@ function tabWidget(options) {
12371
12401
  ele.setAttribute('style', unselectedStyle);
12372
12402
  ele.subject = item;
12373
12403
  var div = ele.appendChild(dom.createElement('button'));
12374
- div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
12404
+ div.setAttribute('style', style.makeNewSlot);
12375
12405
  div.onclick = function () {
12376
12406
  resetTabStyle();
12377
12407
  resetBodyStyle();
@@ -12388,7 +12418,7 @@ function tabWidget(options) {
12388
12418
  if (options.renderTabSettings && ele.subject) {
12389
12419
  var ellipsis = dom.createElement('button');
12390
12420
  ellipsis.textContent = '...';
12391
- ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
12421
+ ellipsis.setAttribute('style', style.ellipsis);
12392
12422
  ellipsis.onclick = function () {
12393
12423
  resetTabStyle();
12394
12424
  resetBodyStyle();
@@ -13665,10 +13695,10 @@ Object.defineProperty(exports, "__esModule", ({
13665
13695
  }));
13666
13696
  exports.versionInfo = void 0;
13667
13697
  var versionInfo = exports.versionInfo = {
13668
- buildTime: '2023-11-30T16:45:27Z',
13669
- commit: '28954ea400b5ebbd9627fdf986cadccae104a51f',
13698
+ buildTime: '2023-12-01T20:22:18Z',
13699
+ commit: 'f40cba957f0cdc0d34ddace42069ce1ae87744af',
13670
13700
  npmInfo: {
13671
- 'solid-ui': '2.4.30',
13701
+ 'solid-ui': '2.4.31',
13672
13702
  npm: '8.19.4',
13673
13703
  node: '16.20.2',
13674
13704
  v8: '9.4.146.26-node.26',
@@ -15092,39 +15122,34 @@ exports.makeDropTarget = makeDropTarget;
15092
15122
  exports.uploadFiles = uploadFiles;
15093
15123
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
15094
15124
  var mime = _interopRequireWildcard(__webpack_require__(/*! mime-types */ "./node_modules/mime-types/index.js"));
15125
+ var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
15095
15126
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15096
15127
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
15097
15128
  /* Drag and drop common functionality
15098
15129
  *
15099
15130
  * It is easy to make something draggable, or to make it a drag target!
15100
- * Just call the functions below. In a solid world, any part of the UI which
15101
- * represent one thing which has a UR, should be made draggable using makeDraggable
15131
+ * Just call the functions below. In a Solid world, any part of the UI which
15132
+ * represents one thing which has a URI, should be made draggable using makeDraggable.
15102
15133
  * Any list of things should typically allow you to drag new members of the list
15103
15134
  * onto it.
15104
- * The file upload function uploadFiles is provided as often of someone drags a file from the computer
15105
- * desktop, you may want to upload it into the pod.
15135
+ * The file upload function, uploadFiles, is provided as often as someone drags a file from the computer
15136
+ * desktop. You may want to upload it into the pod.
15106
15137
  */
15107
15138
 
15108
15139
  /* global FileReader alert */
15109
15140
 
15110
15141
  function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
15111
15142
  var dragoverListener = function dragoverListener(e) {
15112
- e.preventDefault(); // Neeed else drop does not work [sic]
15143
+ e.preventDefault(); // Need this; otherwise, drop does not work.
15113
15144
  e.dataTransfer.dropEffect = 'copy';
15114
15145
  };
15115
15146
  var dragenterListener = function dragenterListener(e) {
15116
15147
  debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect);
15117
- if (this.style) {
15148
+ if (this.localStyle) {
15118
15149
  // necessary not sure when
15119
15150
  if (!this.savedStyle) {
15120
- this.savedStyle = {};
15121
- this.savedStyle.border = this.style.border;
15122
- this.savedStyle.backgroundColor = this.style.backgroundColor;
15123
- this.savedStyle.borderRadius = this.style.borderRadius;
15151
+ this.savedStyle = style.dragEvent;
15124
15152
  }
15125
- this.style.backgroundColor = '#ccc';
15126
- this.style.border = '0.25em dashed black';
15127
- this.style.borderRadius = '0.3em';
15128
15153
  }
15129
15154
  e.dataTransfer.dropEffect = 'link';
15130
15155
  debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect);
@@ -15132,12 +15157,9 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
15132
15157
  var dragleaveListener = function dragleaveListener(e) {
15133
15158
  debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect);
15134
15159
  if (this.savedStyle) {
15135
- this.style.border = this.savedStyle.border;
15136
- this.style.backgroundColor = this.savedStyle.backgroundColor;
15137
- this.style.borderRadius = this.savedStyle.borderRadius;
15160
+ this.localStyle = this.savedStyle;
15138
15161
  } else {
15139
- this.style.backgroundColor = 'white';
15140
- this.style.border = '0em solid black';
15162
+ this.localStyle = style.dropEvent;
15141
15163
  }
15142
15164
  };
15143
15165
  var dropListener = function dropListener(e) {
@@ -15176,7 +15198,7 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
15176
15198
  if (uris) {
15177
15199
  droppedURIHandler(uris);
15178
15200
  }
15179
- this.style.backgroundColor = 'white'; // restore style
15201
+ this.localStyle = style.restoreStyle; // restore style
15180
15202
  return false;
15181
15203
  }; // dropListener
15182
15204
 
@@ -15296,11 +15318,17 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
15296
15318
  "use strict";
15297
15319
 
15298
15320
 
15321
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
15322
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
15299
15323
  Object.defineProperty(exports, "__esModule", ({
15300
15324
  value: true
15301
15325
  }));
15302
15326
  exports.errorMessageBlock = errorMessageBlock;
15303
15327
  var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
15328
+ var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
15329
+ var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../styleConstants */ "./lib/styleConstants.js"));
15330
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15331
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
15304
15332
  /**
15305
15333
  * Create an error message block
15306
15334
  * @param dom The DOM on which dom.createElement will be called
@@ -15329,8 +15357,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
15329
15357
  }
15330
15358
  div.appendChild((0, _widgets.cancelButton)(dom, function () {
15331
15359
  if (div.parentNode) div.parentNode.removeChild(div);
15332
- })).style = 'width: 2em; height: 2em; align: right;';
15333
- div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
15360
+ })).style = style.errorCancelButton;
15361
+ div.setAttribute('style', style.errorMessageBlockStyle);
15362
+ div.style.backgroundColor = backgroundColor || _styleConstants["default"].defaultErrorBackgroundColor;
15334
15363
  return div;
15335
15364
  }
15336
15365
  //# sourceMappingURL=error.js.map
@@ -15427,6 +15456,7 @@ var _error = __webpack_require__(/*! ./error */ "./lib/widgets/error.js");
15427
15456
  var _basic = __webpack_require__(/*! ./forms/basic */ "./lib/widgets/forms/basic.js");
15428
15457
  var _autocompleteField = __webpack_require__(/*! ./forms/autocomplete/autocompleteField */ "./lib/widgets/forms/autocomplete/autocompleteField.js");
15429
15458
  var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
15459
+ var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../styleConstants */ "./lib/styleConstants.js"));
15430
15460
  var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
15431
15461
  var log = _interopRequireWildcard(__webpack_require__(/*! ../log */ "./lib/log.js"));
15432
15462
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
@@ -16113,7 +16143,7 @@ _fieldFunction.field[ns.ui('MultiLineTextField').uri] = function (dom, container
16113
16143
  box.style.display = 'flex';
16114
16144
  box.style.flexDirection = 'row';
16115
16145
  var left = box.appendChild(dom.createElement('div'));
16116
- left.style.width = style.formFieldNameBoxWidth;
16146
+ left.style.width = _styleConstants["default"].formFieldNameBoxWidth;
16117
16147
  var right = box.appendChild(dom.createElement('div'));
16118
16148
  left.appendChild((0, _basic.fieldLabel)(dom, property, form));
16119
16149
  dataDoc = (0, _basic.fieldStore)(subject, property, dataDoc);
@@ -16538,7 +16568,7 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
16538
16568
  form = lists[0]; // Pick any one
16539
16569
  }
16540
16570
  log.debug('form is ' + form);
16541
- box.setAttribute('style', "border: 0.05em solid ".concat(style.formBorderColor, "; color: ").concat(style.formBorderColor)); // @@color?
16571
+ box.setAttribute('style', "border: 0.05em solid ".concat(_styleConstants["default"].formBorderColor, "; color: ").concat(_styleConstants["default"].formBorderColor)); // @@color?
16542
16572
  box.innerHTML = '<h3>New ' + utils.label(theClass) + '</h3>';
16543
16573
  var formFunction = (0, _fieldFunction.fieldFunction)(dom, form);
16544
16574
  var object = newThing(dataDoc);
@@ -16597,12 +16627,12 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
16597
16627
  submit.disabled = true;
16598
16628
  submit.setAttribute('style', 'visibility: hidden; float: right;'); // Keep UI clean
16599
16629
  field.disabled = true;
16600
- field.style.color = style.textInputColorPending; // setAttribute('style', style + 'color: gray;') // pending
16630
+ field.style.color = _styleConstants["default"].textInputColorPending;
16601
16631
  var ds = kb.statementsMatching(subject, predicate, null, dataDoc);
16602
16632
  var is = $rdf.st(subject, predicate, field.value, dataDoc);
16603
16633
  kb.updater.update(ds, is, function (uri, ok, body) {
16604
16634
  if (ok) {
16605
- field.style.color = style.textInputColor;
16635
+ field.style.color = _styleConstants["default"].textInputColor;
16606
16636
  field.disabled = false;
16607
16637
  } else {
16608
16638
  group.appendChild((0, _error.errorMessageBlock)(dom, 'Error (while saving change to ' + dataDoc.uri + '): ' + body));
@@ -16631,7 +16661,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
16631
16661
  field.addEventListener('change', saveChange, true);
16632
16662
  } else {
16633
16663
  field.disabled = true; // @@ change color too
16634
- field.style.backgroundColor = style.textInputBackgroundColorUneditable;
16664
+ field.style.backgroundColor = _styleConstants["default"].textInputBackgroundColorUneditable;
16635
16665
  }
16636
16666
  return group;
16637
16667
  }
@@ -16755,7 +16785,7 @@ function makeSelectForClassifierOptions(dom, kb, subject, predicate, possible, o
16755
16785
  });
16756
16786
  };
16757
16787
  var select = dom.createElement('select');
16758
- select.setAttribute('style', style.formSelectSTyle);
16788
+ select.setAttribute('style', style.formSelectStyle);
16759
16789
  if (options.multiple) select.setAttribute('multiple', 'true');
16760
16790
  select.currentURI = null;
16761
16791
  select.refresh = function () {
@@ -16895,7 +16925,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
16895
16925
  });
16896
16926
  };
16897
16927
  var select = dom.createElement('select');
16898
- select.setAttribute('style', style.formSelectSTyle);
16928
+ select.setAttribute('style', style.formSelectStyle);
16899
16929
  select.currentURI = null;
16900
16930
  select.refresh = function () {
16901
16931
  actual = getActual(); // refresh
@@ -17175,7 +17205,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
17175
17205
  select.refresh();
17176
17206
  };
17177
17207
  var select = dom.createElement('select');
17178
- select.setAttribute('style', style.formSelectSTyle);
17208
+ select.setAttribute('style', style.formSelectStyle);
17179
17209
  select.setAttribute('id', 'formSelect');
17180
17210
  select.currentURI = null;
17181
17211
  for (var uri in optionsFromClassUIfrom) {
@@ -17963,6 +17993,7 @@ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime
17963
17993
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
17964
17994
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../../../debug */ "./lib/debug.js"));
17965
17995
  var style = _interopRequireWildcard(__webpack_require__(/*! ../../../style */ "./lib/style.js"));
17996
+ var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../../../styleConstants */ "./lib/styleConstants.js"));
17966
17997
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../../../widgets */ "./lib/widgets/index.js"));
17967
17998
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
17968
17999
  var _publicData = __webpack_require__(/*! ./publicData */ "./lib/widgets/forms/autocomplete/publicData.js");
@@ -18362,7 +18393,7 @@ function _renderAutoComplete() {
18362
18393
  searchInput = cell.appendChild(dom.createElement('input'));
18363
18394
  searchInput.setAttribute('type', 'text');
18364
18395
  initialize();
18365
- size = acOptions.size || style.textInputSize || 20;
18396
+ size = acOptions.size || _styleConstants["default"].textInputSize || 20;
18366
18397
  searchInput.setAttribute('size', size);
18367
18398
  searchInput.setAttribute('data-testid', 'autocomplete-input');
18368
18399
  searchInputStyle = style.textInputStyle ||
@@ -19246,6 +19277,7 @@ function _getDbpediaDetails() {
19246
19277
  "use strict";
19247
19278
 
19248
19279
 
19280
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
19249
19281
  var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
19250
19282
  Object.defineProperty(exports, "__esModule", ({
19251
19283
  value: true
@@ -19258,6 +19290,7 @@ var _rdflib = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index
19258
19290
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
19259
19291
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
19260
19292
  var _style = __webpack_require__(/*! ../../style */ "./lib/style.js");
19293
+ var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../../styleConstants */ "./lib/styleConstants.js"));
19261
19294
  var _utils = __webpack_require__(/*! ../../utils */ "./lib/utils/index.js");
19262
19295
  var _error = __webpack_require__(/*! ../error */ "./lib/widgets/error.js");
19263
19296
  var _fieldFunction = __webpack_require__(/*! ./fieldFunction */ "./lib/widgets/forms/fieldFunction.js");
@@ -19273,7 +19306,7 @@ function renderNameValuePair(dom, kb, box, form, label) {
19273
19306
  box.style.display = 'flex';
19274
19307
  box.style.flexDirection = 'row';
19275
19308
  var lhs = box.appendChild(dom.createElement('div'));
19276
- lhs.style.width = _style.formFieldNameBoxWidth;
19309
+ lhs.style.width = _styleConstants["default"].formFieldNameBoxWidth;
19277
19310
  var rhs = box.appendChild(dom.createElement('div'));
19278
19311
  lhs.setAttribute('class', 'formFieldName');
19279
19312
  lhs.setAttribute('style', _style.formFieldNameBoxStyle);
@@ -19378,10 +19411,10 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
19378
19411
  field.style = style;
19379
19412
  rhs.appendChild(field);
19380
19413
  field.setAttribute('type', params.type ? params.type : 'text');
19381
- var size = kb.anyJS(form, ns.ui('size')) || _style.textInputSize || 20;
19414
+ var size = kb.anyJS(form, ns.ui('size')) || _styleConstants["default"].textInputSize || 20;
19382
19415
  field.setAttribute('size', size);
19383
19416
  var maxLength = kb.any(form, ns.ui('maxLength'));
19384
- field.setAttribute('maxLength', maxLength ? '' + maxLength : '4096');
19417
+ field.setAttribute('maxLength', maxLength ? '' + maxLength : _styleConstants["default"].basicMaxLength);
19385
19418
  doc = doc || fieldStore(subject, property, doc);
19386
19419
  var obj = kb.any(subject, property, undefined, doc);
19387
19420
  if (!obj) {
@@ -19403,7 +19436,6 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
19403
19436
  field.readOnly = true // was: disabled. readOnly is better
19404
19437
  ;
19405
19438
  field.style = _style.textInputStyleUneditable + paramStyle;
19406
- // backgroundColor = textInputBackgroundColorUneditable
19407
19439
  if (suppressEmptyUneditable && field.value === '') {
19408
19440
  box.style.display = 'none'; // clutter
19409
19441
  }
@@ -19642,10 +19674,10 @@ var fieldParams = exports.fieldParams = (_fieldParams = {}, (0, _defineProperty2
19642
19674
  style: _style.formGroupStyle
19643
19675
  }), ns.ui('Comment').uri, {
19644
19676
  element: 'p',
19645
- style: _style.commentStyle // was `padding: 0.1em 1.5em; color: ${formHeadingColor}; white-space: pre-wrap;`
19677
+ style: _style.commentStyle
19646
19678
  }), ns.ui('Heading').uri, {
19647
19679
  element: 'h3',
19648
- style: _style.formHeadingStyle // was: `font-size: 110%; font-weight: bold; color: ${formHeadingColor}; padding: 0.2em;`
19680
+ style: _style.formHeadingStyle
19649
19681
  }));
19650
19682
  //# sourceMappingURL=fieldParams.js.map
19651
19683
 
@@ -26316,51 +26348,113 @@ 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=
26316
26348
 
26317
26349
  /***/ }),
26318
26350
 
26319
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/ClientAuthentication.js":
26320
- /*!**************************************************************************************!*\
26321
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/ClientAuthentication.js ***!
26322
- \**************************************************************************************/
26351
+ /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/index.js":
26352
+ /*!***********************************************************************!*\
26353
+ !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/index.js ***!
26354
+ \***********************************************************************/
26323
26355
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26324
26356
 
26325
26357
  "use strict";
26326
26358
 
26327
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26328
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26329
- const universal_fetch_1 = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js");
26330
- const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
26331
- const globalFetch = (request, init) => (0, universal_fetch_1.fetch)(request, init);
26332
- class ClientAuthentication {
26333
- constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
26334
- this.loginHandler = loginHandler;
26335
- this.redirectHandler = redirectHandler;
26336
- this.logoutHandler = logoutHandler;
26337
- this.sessionInfoManager = sessionInfoManager;
26338
- this.issuerConfigFetcher = issuerConfigFetcher;
26359
+
26360
+ var solidClientAuthnCore = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26361
+ var uuid = __webpack_require__(/*! uuid */ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js");
26362
+ var EventEmitter = __webpack_require__(/*! events */ "./node_modules/events/events.js");
26363
+ var oidcClientExt = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
26364
+ var universalFetch = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js");
26365
+
26366
+ //
26367
+ // Copyright Inrupt Inc.
26368
+ //
26369
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26370
+ // of this software and associated documentation files (the "Software"), to deal in
26371
+ // the Software without restriction, including without limitation the rights to use,
26372
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26373
+ // Software, and to permit persons to whom the Software is furnished to do so,
26374
+ // subject to the following conditions:
26375
+ //
26376
+ // The above copyright notice and this permission notice shall be included in
26377
+ // all copies or substantial portions of the Software.
26378
+ //
26379
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26380
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26381
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26382
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26383
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26384
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26385
+ //
26386
+ /**
26387
+ * This class in a no-value-added extension of StorageUtility from the core module.
26388
+ * The reason it has to be declared is for TSyringe to find the decorators in the
26389
+ * same modules as where the dependency container is declared (in this case,
26390
+ * the browser module, with the dependancy container in dependencies.ts).
26391
+ * @hidden
26392
+ */
26393
+ class StorageUtilityBrowser extends solidClientAuthnCore.StorageUtility {
26394
+ constructor(secureStorage, insecureStorage) {
26395
+ super(secureStorage, insecureStorage);
26396
+ }
26397
+ }
26398
+
26399
+ //
26400
+ // Copyright Inrupt Inc.
26401
+ //
26402
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26403
+ // of this software and associated documentation files (the "Software"), to deal in
26404
+ // the Software without restriction, including without limitation the rights to use,
26405
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26406
+ // Software, and to permit persons to whom the Software is furnished to do so,
26407
+ // subject to the following conditions:
26408
+ //
26409
+ // The above copyright notice and this permission notice shall be included in
26410
+ // all copies or substantial portions of the Software.
26411
+ //
26412
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26413
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26414
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26415
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26416
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26417
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26418
+ //
26419
+ /**
26420
+ * @hidden
26421
+ */
26422
+ class ClientAuthentication extends solidClientAuthnCore.ClientAuthentication {
26423
+ constructor() {
26424
+ super(...arguments);
26425
+ // Define these functions as properties so that they don't get accidentally re-bound.
26426
+ // Isn't Javascript fun?
26339
26427
  this.login = async (options, eventEmitter) => {
26340
26428
  var _a, _b;
26429
+ // In order to get a clean start, make sure that the session is logged out
26430
+ // on login.
26431
+ // But we may want to preserve our client application info, particularly if
26432
+ // we used Dynamic Client Registration to register (since we don't
26433
+ // necessarily want the user to have to register this app each time they
26434
+ // login).
26341
26435
  await this.sessionInfoManager.clear(options.sessionId);
26342
- const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : (0, oidc_client_ext_1.removeOidcQueryParam)(window.location.href);
26343
- if (!(0, solid_client_authn_core_1.isValidRedirectUrl)(redirectUrl)) {
26344
- throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI or it includes a hash fragment.`);
26436
+ // In the case of the user hitting the 'back' button in their browser, they
26437
+ // could return to a previous redirect URL that contains OIDC params that
26438
+ // are now longer valid. To be safe, strip relevant params now.
26439
+ // If the user is providing a redirect IRI, it should not be modified, so
26440
+ // normalization only applies if we default to the current location (which is
26441
+ // a bad practice and should be discouraged).
26442
+ const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : oidcClientExt.normalizeCallbackUrl(window.location.href);
26443
+ if (!solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {
26444
+ throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);
26345
26445
  }
26346
26446
  await this.loginHandler.handle({
26347
26447
  ...options,
26348
26448
  redirectUrl,
26449
+ // If no clientName is provided, the clientId may be used instead.
26349
26450
  clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,
26350
26451
  eventEmitter,
26351
26452
  });
26352
26453
  };
26353
- this.fetch = globalFetch;
26354
- this.logout = async (sessionId) => {
26355
- await this.logoutHandler.handle(sessionId);
26356
- this.fetch = globalFetch;
26357
- };
26358
- this.getSessionInfo = async (sessionId) => {
26359
- return this.sessionInfoManager.get(sessionId);
26360
- };
26361
- this.getAllSessionInfo = async () => {
26362
- return this.sessionInfoManager.getAll();
26363
- };
26454
+ // Collects session information from storage, and returns them. Returns null
26455
+ // if the expected information cannot be found.
26456
+ // Note that the ID token is not stored, which means the session information
26457
+ // cannot be validated at this point.
26364
26458
  this.validateCurrentSession = async (currentSessionId) => {
26365
26459
  const sessionInfo = await this.sessionInfoManager.get(currentSessionId);
26366
26460
  if (sessionInfo === undefined ||
@@ -26373,8 +26467,14 @@ class ClientAuthentication {
26373
26467
  this.handleIncomingRedirect = async (url, eventEmitter) => {
26374
26468
  try {
26375
26469
  const redirectInfo = await this.redirectHandler.handle(url, eventEmitter);
26470
+ // The `FallbackRedirectHandler` directly returns the global `fetch` for
26471
+ // his value, so we should ensure it's bound to `window` rather than to
26472
+ // ClientAuthentication, to avoid the following error:
26473
+ // > 'fetch' called on an object that does not implement interface Window.
26376
26474
  this.fetch = redirectInfo.fetch.bind(window);
26377
- this.cleanUrlAfterRedirect(url);
26475
+ this.boundLogout = redirectInfo.getLogoutUrl;
26476
+ // Strip the oauth params:
26477
+ await this.cleanUrlAfterRedirect(url);
26378
26478
  return {
26379
26479
  isLoggedIn: redirectInfo.isLoggedIn,
26380
26480
  webId: redirectInfo.webId,
@@ -26383,447 +26483,202 @@ class ClientAuthentication {
26383
26483
  };
26384
26484
  }
26385
26485
  catch (err) {
26386
- this.cleanUrlAfterRedirect(url);
26387
- eventEmitter.emit(solid_client_authn_core_1.EVENTS.ERROR, "redirect", err);
26486
+ // Strip the oauth params:
26487
+ await this.cleanUrlAfterRedirect(url);
26488
+ // FIXME: EVENTS.ERROR should be errorCode, errorDescription
26489
+ //
26490
+ // I'm not sure if "redirect" is a good error code, and in theory `err`
26491
+ // maybe an Error object and not a string; Maybe we want to just hardcode
26492
+ // a description instead?
26493
+ eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, "redirect", err);
26388
26494
  return undefined;
26389
26495
  }
26390
26496
  };
26391
26497
  }
26392
- cleanUrlAfterRedirect(url) {
26393
- const cleanedUpUrl = new URL(url);
26394
- cleanedUpUrl.searchParams.delete("state");
26395
- cleanedUpUrl.searchParams.delete("code");
26396
- cleanedUpUrl.searchParams.delete("id_token");
26397
- cleanedUpUrl.searchParams.delete("access_token");
26398
- cleanedUpUrl.searchParams.delete("error");
26399
- cleanedUpUrl.searchParams.delete("error_description");
26400
- cleanedUpUrl.searchParams.delete("iss");
26401
- window.history.replaceState(null, "", cleanedUpUrl.toString());
26498
+ async cleanUrlAfterRedirect(url) {
26499
+ const cleanedUpUrl = solidClientAuthnCore.removeOpenIdParams(url).href;
26500
+ // Remove OAuth-specific query params (since the login flow finishes with
26501
+ // the browser being redirected back with OAuth2 query params (e.g. for
26502
+ // 'code' and 'state'), and so if the user simply refreshes this page our
26503
+ // authentication library will be called again with what are now invalid
26504
+ // query parameters!).
26505
+ window.history.replaceState(null, "", cleanedUpUrl);
26506
+ while (window.location.href !== cleanedUpUrl) {
26507
+ // Poll the current URL every ms. Active polling is required because
26508
+ // window.history.replaceState is asynchronous, but the associated
26509
+ // 'popstate' event which should be listened to is only sent on active
26510
+ // navigation, which we will not have here.
26511
+ // See https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent
26512
+ // eslint-disable-next-line no-await-in-loop
26513
+ await new Promise((resolve) => {
26514
+ setTimeout(() => resolve(), 1);
26515
+ });
26516
+ }
26402
26517
  }
26403
26518
  }
26404
- exports["default"] = ClientAuthentication;
26405
- //# sourceMappingURL=ClientAuthentication.js.map
26406
26519
 
26407
- /***/ }),
26408
-
26409
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js":
26410
- /*!*************************************************************************!*\
26411
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js ***!
26412
- \*************************************************************************/
26413
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
26414
-
26415
- "use strict";
26416
-
26417
- var __importDefault = (this && this.__importDefault) || function (mod) {
26418
- return (mod && mod.__esModule) ? mod : { "default": mod };
26419
- };
26420
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26421
- exports.Session = exports.silentlyAuthenticate = void 0;
26422
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26423
- const uuid_1 = __webpack_require__(/*! uuid */ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js");
26424
- const events_1 = __importDefault(__webpack_require__(/*! events */ "./node_modules/events/events.js"));
26425
- const dependencies_1 = __webpack_require__(/*! ./dependencies */ "./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js");
26426
- const constant_1 = __webpack_require__(/*! ./constant */ "./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js");
26427
- async function silentlyAuthenticate(sessionId, clientAuthn, session) {
26428
- var _a;
26429
- const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);
26430
- if (storedSessionInfo !== null) {
26431
- window.localStorage.setItem(constant_1.KEY_CURRENT_URL, window.location.href);
26432
- await clientAuthn.login({
26433
- sessionId,
26434
- prompt: "none",
26435
- oidcIssuer: storedSessionInfo.issuer,
26436
- redirectUrl: storedSessionInfo.redirectUrl,
26437
- clientId: storedSessionInfo.clientAppId,
26438
- clientSecret: storedSessionInfo.clientAppSecret,
26439
- tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
26440
- }, session.events);
26441
- return true;
26442
- }
26443
- return false;
26520
+ //
26521
+ // Copyright Inrupt Inc.
26522
+ //
26523
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26524
+ // of this software and associated documentation files (the "Software"), to deal in
26525
+ // the Software without restriction, including without limitation the rights to use,
26526
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26527
+ // Software, and to permit persons to whom the Software is furnished to do so,
26528
+ // subject to the following conditions:
26529
+ //
26530
+ // The above copyright notice and this permission notice shall be included in
26531
+ // all copies or substantial portions of the Software.
26532
+ //
26533
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26534
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26535
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26536
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26537
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26538
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26539
+ //
26540
+ function hasIssuer(options) {
26541
+ return typeof options.oidcIssuer === "string";
26444
26542
  }
26445
- exports.silentlyAuthenticate = silentlyAuthenticate;
26446
- function isLoggedIn(sessionInfo) {
26447
- return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
26543
+ function hasRedirectUrl(options) {
26544
+ return typeof options.redirectUrl === "string";
26448
26545
  }
26449
- class Session extends events_1.default {
26450
- constructor(sessionOptions = {}, sessionId = undefined) {
26451
- super();
26452
- this.tokenRequestInProgress = false;
26453
- this.login = async (options) => {
26454
- var _a;
26455
- await this.clientAuthentication.login({
26456
- sessionId: this.info.sessionId,
26457
- ...options,
26458
- tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
26459
- }, this.events);
26460
- return new Promise(() => { });
26461
- };
26462
- this.fetch = async (url, init) => {
26463
- return this.clientAuthentication.fetch(url, init);
26546
+ /**
26547
+ * @hidden
26548
+ */
26549
+ class OidcLoginHandler {
26550
+ constructor(storageUtility, oidcHandler, issuerConfigFetcher, clientRegistrar) {
26551
+ this.storageUtility = storageUtility;
26552
+ this.oidcHandler = oidcHandler;
26553
+ this.issuerConfigFetcher = issuerConfigFetcher;
26554
+ this.clientRegistrar = clientRegistrar;
26555
+ this.storageUtility = storageUtility;
26556
+ this.oidcHandler = oidcHandler;
26557
+ this.issuerConfigFetcher = issuerConfigFetcher;
26558
+ this.clientRegistrar = clientRegistrar;
26559
+ }
26560
+ async canHandle(options) {
26561
+ return hasIssuer(options) && hasRedirectUrl(options);
26562
+ }
26563
+ async handle(options) {
26564
+ if (!hasIssuer(options)) {
26565
+ throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(options)}`);
26566
+ }
26567
+ if (!hasRedirectUrl(options)) {
26568
+ throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(options)}`);
26569
+ }
26570
+ // Fetch issuer config.
26571
+ const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);
26572
+ const clientRegistration = await solidClientAuthnCore.handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);
26573
+ // Construct OIDC Options
26574
+ const OidcOptions = {
26575
+ // Note that here, the issuer is not the one from the received options, but
26576
+ // from the issuer's config. This enforces the canonical URL is used and stored,
26577
+ // which is also the one present in the ID token, so storing a technically
26578
+ // valid, but different issuer URL (e.g. using a trailing slash or not) now
26579
+ // could prevent from validating the ID token later.
26580
+ issuer: issuerConfig.issuer,
26581
+ // TODO: differentiate if DPoP should be true
26582
+ dpop: options.tokenType.toLowerCase() === "dpop",
26583
+ ...options,
26584
+ issuerConfiguration: issuerConfig,
26585
+ client: clientRegistration,
26464
26586
  };
26465
- this.internalLogout = async (emitSignal) => {
26466
- window.localStorage.removeItem(constant_1.KEY_CURRENT_SESSION);
26467
- await this.clientAuthentication.logout(this.info.sessionId);
26468
- this.info.isLoggedIn = false;
26469
- if (emitSignal) {
26470
- this.events.emit(solid_client_authn_core_1.EVENTS.LOGOUT);
26471
- }
26472
- };
26473
- this.logout = async () => this.internalLogout(true);
26474
- this.handleIncomingRedirect = async (inputOptions = {}) => {
26475
- var _a;
26476
- if (this.info.isLoggedIn) {
26477
- return this.info;
26478
- }
26479
- if (this.tokenRequestInProgress) {
26480
- return undefined;
26481
- }
26482
- const options = typeof inputOptions === "string" ? { url: inputOptions } : inputOptions;
26483
- const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href;
26484
- this.tokenRequestInProgress = true;
26485
- const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);
26486
- if (isLoggedIn(sessionInfo)) {
26487
- this.setSessionInfo(sessionInfo);
26488
- const currentUrl = window.localStorage.getItem(constant_1.KEY_CURRENT_URL);
26489
- if (currentUrl === null) {
26490
- this.events.emit(solid_client_authn_core_1.EVENTS.LOGIN);
26491
- }
26492
- else {
26493
- window.localStorage.removeItem(constant_1.KEY_CURRENT_URL);
26494
- this.events.emit(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, currentUrl);
26495
- }
26496
- }
26497
- else if (options.restorePreviousSession === true) {
26498
- const storedSessionId = window.localStorage.getItem(constant_1.KEY_CURRENT_SESSION);
26499
- if (storedSessionId !== null) {
26500
- const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);
26501
- if (attemptedSilentAuthentication) {
26502
- return new Promise(() => { });
26503
- }
26504
- }
26505
- }
26506
- this.tokenRequestInProgress = false;
26507
- return sessionInfo;
26508
- };
26509
- this.events = new Proxy(this, (0, solid_client_authn_core_1.buildProxyHandler)(Session.prototype, "events only implements ISessionEventListener"));
26510
- if (sessionOptions.clientAuthentication) {
26511
- this.clientAuthentication = sessionOptions.clientAuthentication;
26512
- }
26513
- else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
26514
- this.clientAuthentication = (0, dependencies_1.getClientAuthenticationWithDependencies)({
26515
- secureStorage: sessionOptions.secureStorage,
26516
- insecureStorage: sessionOptions.insecureStorage,
26517
- });
26518
- }
26519
- else {
26520
- this.clientAuthentication = (0, dependencies_1.getClientAuthenticationWithDependencies)({});
26521
- }
26522
- if (sessionOptions.sessionInfo) {
26523
- this.info = {
26524
- sessionId: sessionOptions.sessionInfo.sessionId,
26525
- isLoggedIn: false,
26526
- webId: sessionOptions.sessionInfo.webId,
26527
- };
26528
- }
26529
- else {
26530
- this.info = {
26531
- sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : (0, uuid_1.v4)(),
26532
- isLoggedIn: false,
26533
- };
26534
- }
26535
- this.events.on(solid_client_authn_core_1.EVENTS.LOGIN, () => window.localStorage.setItem(constant_1.KEY_CURRENT_SESSION, this.info.sessionId));
26536
- this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
26537
- this.events.on(solid_client_authn_core_1.EVENTS.ERROR, () => this.internalLogout(false));
26538
- }
26539
- onLogin(callback) {
26540
- this.events.on(solid_client_authn_core_1.EVENTS.LOGIN, callback);
26541
- }
26542
- onLogout(callback) {
26543
- this.events.on(solid_client_authn_core_1.EVENTS.LOGOUT, callback);
26544
- }
26545
- onError(callback) {
26546
- this.events.on(solid_client_authn_core_1.EVENTS.ERROR, callback);
26547
- }
26548
- onSessionRestore(callback) {
26549
- this.events.on(solid_client_authn_core_1.EVENTS.SESSION_RESTORED, callback);
26550
- }
26551
- onSessionExpiration(callback) {
26552
- this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXPIRED, callback);
26553
- }
26554
- setSessionInfo(sessionInfo) {
26555
- this.info.isLoggedIn = sessionInfo.isLoggedIn;
26556
- this.info.webId = sessionInfo.webId;
26557
- this.info.sessionId = sessionInfo.sessionId;
26558
- this.info.expirationDate = sessionInfo.expirationDate;
26559
- this.events.on(solid_client_authn_core_1.EVENTS.SESSION_EXTENDED, (expiresIn) => {
26560
- this.info.expirationDate = Date.now() + expiresIn * 1000;
26561
- });
26562
- }
26563
- }
26564
- exports.Session = Session;
26565
- //# sourceMappingURL=Session.js.map
26566
-
26567
- /***/ }),
26568
-
26569
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js":
26570
- /*!**************************************************************************!*\
26571
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/constant.js ***!
26572
- \**************************************************************************/
26573
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26574
-
26575
- "use strict";
26576
-
26577
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26578
- exports.KEY_CURRENT_URL = exports.KEY_CURRENT_SESSION = void 0;
26579
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26580
- exports.KEY_CURRENT_SESSION = `${solid_client_authn_core_1.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`;
26581
- exports.KEY_CURRENT_URL = `${solid_client_authn_core_1.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;
26582
- //# sourceMappingURL=constant.js.map
26583
-
26584
- /***/ }),
26585
-
26586
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/defaultSession.js":
26587
- /*!********************************************************************************!*\
26588
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/defaultSession.js ***!
26589
- \********************************************************************************/
26590
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26591
-
26592
- "use strict";
26593
-
26594
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26595
- exports.events = exports.onSessionRestore = exports.onLogout = exports.onLogin = exports.handleIncomingRedirect = exports.logout = exports.login = exports.fetch = exports.getDefaultSession = void 0;
26596
- const Session_1 = __webpack_require__(/*! ./Session */ "./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js");
26597
- let defaultSession;
26598
- function getDefaultSession() {
26599
- if (typeof defaultSession === "undefined") {
26600
- defaultSession = new Session_1.Session();
26601
- }
26602
- return defaultSession;
26603
- }
26604
- exports.getDefaultSession = getDefaultSession;
26605
- const fetch = (...args) => {
26606
- const session = getDefaultSession();
26607
- return session.fetch(...args);
26608
- };
26609
- exports.fetch = fetch;
26610
- const login = (...args) => {
26611
- const session = getDefaultSession();
26612
- return session.login(...args);
26613
- };
26614
- exports.login = login;
26615
- const logout = (...args) => {
26616
- const session = getDefaultSession();
26617
- return session.logout(...args);
26618
- };
26619
- exports.logout = logout;
26620
- const handleIncomingRedirect = (...args) => {
26621
- const session = getDefaultSession();
26622
- return session.handleIncomingRedirect(...args);
26623
- };
26624
- exports.handleIncomingRedirect = handleIncomingRedirect;
26625
- const onLogin = (...args) => {
26626
- const session = getDefaultSession();
26627
- return session.onLogin(...args);
26628
- };
26629
- exports.onLogin = onLogin;
26630
- const onLogout = (...args) => {
26631
- const session = getDefaultSession();
26632
- return session.onLogout(...args);
26633
- };
26634
- exports.onLogout = onLogout;
26635
- const onSessionRestore = (...args) => {
26636
- const session = getDefaultSession();
26637
- return session.onSessionRestore(...args);
26638
- };
26639
- exports.onSessionRestore = onSessionRestore;
26640
- const events = () => {
26641
- return getDefaultSession().events;
26642
- };
26643
- exports.events = events;
26644
- //# sourceMappingURL=defaultSession.js.map
26645
-
26646
- /***/ }),
26647
-
26648
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js":
26649
- /*!******************************************************************************!*\
26650
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js ***!
26651
- \******************************************************************************/
26652
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
26653
-
26654
- "use strict";
26655
-
26656
- var __importDefault = (this && this.__importDefault) || function (mod) {
26657
- return (mod && mod.__esModule) ? mod : { "default": mod };
26658
- };
26659
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26660
- exports.getClientAuthenticationWithDependencies = void 0;
26661
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26662
- const StorageUtility_1 = __importDefault(__webpack_require__(/*! ./storage/StorageUtility */ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/StorageUtility.js"));
26663
- const ClientAuthentication_1 = __importDefault(__webpack_require__(/*! ./ClientAuthentication */ "./node_modules/@inrupt/solid-client-authn-browser/dist/ClientAuthentication.js"));
26664
- const OidcLoginHandler_1 = __importDefault(__webpack_require__(/*! ./login/oidc/OidcLoginHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/OidcLoginHandler.js"));
26665
- const AuthorizationCodeWithPkceOidcHandler_1 = __importDefault(__webpack_require__(/*! ./login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js"));
26666
- const IssuerConfigFetcher_1 = __importDefault(__webpack_require__(/*! ./login/oidc/IssuerConfigFetcher */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js"));
26667
- const FallbackRedirectHandler_1 = __webpack_require__(/*! ./login/oidc/incomingRedirectHandler/FallbackRedirectHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js");
26668
- const GeneralLogoutHandler_1 = __importDefault(__webpack_require__(/*! ./logout/GeneralLogoutHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js"));
26669
- const SessionInfoManager_1 = __webpack_require__(/*! ./sessionInfo/SessionInfoManager */ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js");
26670
- const AuthCodeRedirectHandler_1 = __webpack_require__(/*! ./login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js");
26671
- const AggregateRedirectHandler_1 = __importDefault(__webpack_require__(/*! ./login/oidc/AggregateRedirectHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js"));
26672
- const BrowserStorage_1 = __importDefault(__webpack_require__(/*! ./storage/BrowserStorage */ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js"));
26673
- const Redirector_1 = __importDefault(__webpack_require__(/*! ./login/oidc/Redirector */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js"));
26674
- const ClientRegistrar_1 = __importDefault(__webpack_require__(/*! ./login/oidc/ClientRegistrar */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js"));
26675
- const ErrorOidcHandler_1 = __webpack_require__(/*! ./login/oidc/incomingRedirectHandler/ErrorOidcHandler */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js");
26676
- const TokenRefresher_1 = __importDefault(__webpack_require__(/*! ./login/oidc/refresh/TokenRefresher */ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js"));
26677
- function getClientAuthenticationWithDependencies(dependencies) {
26678
- const inMemoryStorage = new solid_client_authn_core_1.InMemoryStorage();
26679
- const secureStorage = dependencies.secureStorage || inMemoryStorage;
26680
- const insecureStorage = dependencies.insecureStorage || new BrowserStorage_1.default();
26681
- const storageUtility = new StorageUtility_1.default(secureStorage, insecureStorage);
26682
- const issuerConfigFetcher = new IssuerConfigFetcher_1.default(storageUtility);
26683
- const clientRegistrar = new ClientRegistrar_1.default(storageUtility);
26684
- const sessionInfoManager = new SessionInfoManager_1.SessionInfoManager(storageUtility);
26685
- const tokenRefresher = new TokenRefresher_1.default(storageUtility, issuerConfigFetcher, clientRegistrar);
26686
- const loginHandler = new OidcLoginHandler_1.default(storageUtility, new AuthorizationCodeWithPkceOidcHandler_1.default(storageUtility, new Redirector_1.default()), issuerConfigFetcher, clientRegistrar);
26687
- const redirectHandler = new AggregateRedirectHandler_1.default([
26688
- new ErrorOidcHandler_1.ErrorOidcHandler(),
26689
- new AuthCodeRedirectHandler_1.AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
26690
- new FallbackRedirectHandler_1.FallbackRedirectHandler(),
26691
- ]);
26692
- return new ClientAuthentication_1.default(loginHandler, redirectHandler, new GeneralLogoutHandler_1.default(sessionInfoManager), sessionInfoManager, issuerConfigFetcher);
26693
- }
26694
- exports.getClientAuthenticationWithDependencies = getClientAuthenticationWithDependencies;
26695
- //# sourceMappingURL=dependencies.js.map
26696
-
26697
- /***/ }),
26698
-
26699
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/index.js":
26700
- /*!***********************************************************************!*\
26701
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/index.js ***!
26702
- \***********************************************************************/
26703
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
26704
-
26705
- "use strict";
26706
-
26707
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
26708
- if (k2 === undefined) k2 = k;
26709
- var desc = Object.getOwnPropertyDescriptor(m, k);
26710
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26711
- desc = { enumerable: true, get: function() { return m[k]; } };
26712
- }
26713
- Object.defineProperty(o, k2, desc);
26714
- }) : (function(o, m, k, k2) {
26715
- if (k2 === undefined) k2 = k;
26716
- o[k2] = m[k];
26717
- }));
26718
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26719
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26720
- };
26721
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26722
- exports.EVENTS = exports.InMemoryStorage = exports.ConfigurationError = exports.NotImplementedError = exports.getClientAuthenticationWithDependencies = exports.Session = void 0;
26723
- var Session_1 = __webpack_require__(/*! ./Session */ "./node_modules/@inrupt/solid-client-authn-browser/dist/Session.js");
26724
- Object.defineProperty(exports, "Session", ({ enumerable: true, get: function () { return Session_1.Session; } }));
26725
- var dependencies_1 = __webpack_require__(/*! ./dependencies */ "./node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js");
26726
- Object.defineProperty(exports, "getClientAuthenticationWithDependencies", ({ enumerable: true, get: function () { return dependencies_1.getClientAuthenticationWithDependencies; } }));
26727
- __exportStar(__webpack_require__(/*! ./defaultSession */ "./node_modules/@inrupt/solid-client-authn-browser/dist/defaultSession.js"), exports);
26728
- var solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26729
- Object.defineProperty(exports, "NotImplementedError", ({ enumerable: true, get: function () { return solid_client_authn_core_1.NotImplementedError; } }));
26730
- Object.defineProperty(exports, "ConfigurationError", ({ enumerable: true, get: function () { return solid_client_authn_core_1.ConfigurationError; } }));
26731
- Object.defineProperty(exports, "InMemoryStorage", ({ enumerable: true, get: function () { return solid_client_authn_core_1.InMemoryStorage; } }));
26732
- Object.defineProperty(exports, "EVENTS", ({ enumerable: true, get: function () { return solid_client_authn_core_1.EVENTS; } }));
26733
- //# sourceMappingURL=index.js.map
26734
-
26735
- /***/ }),
26736
-
26737
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js":
26738
- /*!*****************************************************************************************************!*\
26739
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js ***!
26740
- \*****************************************************************************************************/
26741
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26742
-
26743
- "use strict";
26744
-
26745
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26746
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26747
- class AggregateRedirectHandler extends solid_client_authn_core_1.AggregateHandler {
26748
- constructor(redirectHandlers) {
26749
- super(redirectHandlers);
26587
+ // Call proper OIDC Handler
26588
+ return this.oidcHandler.handle(OidcOptions);
26750
26589
  }
26751
26590
  }
26752
- exports["default"] = AggregateRedirectHandler;
26753
- //# sourceMappingURL=AggregateRedirectHandler.js.map
26754
-
26755
- /***/ }),
26756
-
26757
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js":
26758
- /*!********************************************************************************************!*\
26759
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js ***!
26760
- \********************************************************************************************/
26761
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26762
26591
 
26763
- "use strict";
26764
-
26765
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26766
- const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
26767
- class ClientRegistrar {
26768
- constructor(storageUtility) {
26769
- this.storageUtility = storageUtility;
26770
- }
26771
- async getClient(options, issuerConfig) {
26772
- const [storedClientId, storedClientSecret,] = await Promise.all([
26773
- this.storageUtility.getForUser(options.sessionId, "clientId", {
26774
- secure: false,
26775
- }),
26776
- this.storageUtility.getForUser(options.sessionId, "clientSecret", {
26777
- secure: false,
26778
- }),
26779
- ]);
26780
- if (storedClientId) {
26781
- return {
26782
- clientId: storedClientId,
26783
- clientSecret: storedClientSecret,
26784
- clientType: "dynamic",
26785
- };
26786
- }
26592
+ //
26593
+ // Copyright Inrupt Inc.
26594
+ //
26595
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26596
+ // of this software and associated documentation files (the "Software"), to deal in
26597
+ // the Software without restriction, including without limitation the rights to use,
26598
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26599
+ // Software, and to permit persons to whom the Software is furnished to do so,
26600
+ // subject to the following conditions:
26601
+ //
26602
+ // The above copyright notice and this permission notice shall be included in
26603
+ // all copies or substantial portions of the Software.
26604
+ //
26605
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26606
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26607
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26608
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26609
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26610
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26611
+ //
26612
+ /**
26613
+ * @hidden
26614
+ * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth
26615
+ * PKCE: https://tools.ietf.org/html/rfc7636
26616
+ */
26617
+ class AuthorizationCodeWithPkceOidcHandler extends solidClientAuthnCore.AuthorizationCodeWithPkceOidcHandlerBase {
26618
+ async handle(oidcLoginOptions) {
26619
+ var _a;
26620
+ /* eslint-disable camelcase */
26621
+ const oidcOptions = {
26622
+ authority: oidcLoginOptions.issuer.toString(),
26623
+ client_id: oidcLoginOptions.client.clientId,
26624
+ client_secret: oidcLoginOptions.client.clientSecret,
26625
+ redirect_uri: oidcLoginOptions.redirectUrl.toString(),
26626
+ post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
26627
+ response_type: "code",
26628
+ scope: solidClientAuthnCore.DEFAULT_SCOPES,
26629
+ filterProtocolClaims: true,
26630
+ // The userinfo endpoint on NSS fails, so disable this for now
26631
+ // Note that in Solid, information should be retrieved from the
26632
+ // profile referenced by the WebId.
26633
+ loadUserInfo: false,
26634
+ code_verifier: true,
26635
+ prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent",
26636
+ };
26637
+ /* eslint-enable camelcase */
26638
+ const oidcClientLibrary = new oidcClientExt.OidcClient(oidcOptions);
26787
26639
  try {
26788
- const registeredClient = await (0, oidc_client_ext_1.registerClient)(options, issuerConfig);
26789
- const infoToSave = {
26790
- clientId: registeredClient.clientId,
26791
- };
26792
- if (registeredClient.clientSecret) {
26793
- infoToSave.clientSecret = registeredClient.clientSecret;
26794
- }
26795
- if (registeredClient.idTokenSignedResponseAlg) {
26796
- infoToSave.idTokenSignedResponseAlg =
26797
- registeredClient.idTokenSignedResponseAlg;
26798
- }
26799
- await this.storageUtility.setForUser(options.sessionId, infoToSave, {
26800
- secure: false,
26640
+ const signingRequest = await oidcClientLibrary.createSigninRequest();
26641
+ // Make sure to await the promise before returning so that the error is caught.
26642
+ return await this.handleRedirect({
26643
+ oidcLoginOptions,
26644
+ // eslint-disable-next-line no-underscore-dangle
26645
+ state: signingRequest.state._id,
26646
+ // eslint-disable-next-line no-underscore-dangle
26647
+ codeVerifier: signingRequest.state._code_verifier,
26648
+ targetUrl: signingRequest.url.toString(),
26801
26649
  });
26802
- return registeredClient;
26803
26650
  }
26804
- catch (error) {
26805
- throw new Error(`Client registration failed: [${error}]`);
26651
+ catch (err) {
26652
+ // eslint-disable-next-line no-console
26653
+ console.error(err);
26806
26654
  }
26655
+ // The login is only completed AFTER redirect, so nothing to return here.
26656
+ return undefined;
26807
26657
  }
26808
26658
  }
26809
- exports["default"] = ClientRegistrar;
26810
- //# sourceMappingURL=ClientRegistrar.js.map
26811
-
26812
- /***/ }),
26813
26659
 
26814
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js":
26815
- /*!************************************************************************************************!*\
26816
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js ***!
26817
- \************************************************************************************************/
26818
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26819
-
26820
- "use strict";
26821
-
26822
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26823
- exports.WELL_KNOWN_OPENID_CONFIG = void 0;
26824
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26825
- const universal_fetch_1 = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js");
26826
- exports.WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
26660
+ //
26661
+ // Copyright Inrupt Inc.
26662
+ //
26663
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26664
+ // of this software and associated documentation files (the "Software"), to deal in
26665
+ // the Software without restriction, including without limitation the rights to use,
26666
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26667
+ // Software, and to permit persons to whom the Software is furnished to do so,
26668
+ // subject to the following conditions:
26669
+ //
26670
+ // The above copyright notice and this permission notice shall be included in
26671
+ // all copies or substantial portions of the Software.
26672
+ //
26673
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26674
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26675
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26676
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26677
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26678
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26679
+ //
26680
+ const WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
26681
+ /* eslint-disable camelcase */
26827
26682
  const issuerConfigKeyMap = {
26828
26683
  issuer: {
26829
26684
  toKey: "issuer",
@@ -26849,6 +26704,10 @@ const issuerConfigKeyMap = {
26849
26704
  toKey: "registrationEndpoint",
26850
26705
  convertToUrl: true,
26851
26706
  },
26707
+ end_session_endpoint: {
26708
+ toKey: "endSessionEndpoint",
26709
+ convertToUrl: true,
26710
+ },
26852
26711
  scopes_supported: { toKey: "scopesSupported" },
26853
26712
  response_types_supported: { toKey: "responseTypesSupported" },
26854
26713
  response_modes_supported: { toKey: "responseModesSupported" },
@@ -26907,10 +26766,15 @@ const issuerConfigKeyMap = {
26907
26766
  convertToUrl: true,
26908
26767
  },
26909
26768
  };
26769
+ /* eslint-enable camelcase */
26910
26770
  function processConfig(config) {
26911
26771
  const parsedConfig = {};
26912
26772
  Object.keys(config).forEach((key) => {
26913
26773
  if (issuerConfigKeyMap[key]) {
26774
+ // TODO: PMcB55: Validate URL if "issuerConfigKeyMap[key].convertToUrl"
26775
+ // if (issuerConfigKeyMap[key].convertToUrl) {
26776
+ // validateUrl(config[key]);
26777
+ // }
26914
26778
  parsedConfig[issuerConfigKeyMap[key].toKey] = config[key];
26915
26779
  }
26916
26780
  });
@@ -26919,122 +26783,218 @@ function processConfig(config) {
26919
26783
  }
26920
26784
  return parsedConfig;
26921
26785
  }
26786
+ /**
26787
+ * @hidden
26788
+ */
26922
26789
  class IssuerConfigFetcher {
26923
26790
  constructor(storageUtility) {
26924
26791
  this.storageUtility = storageUtility;
26792
+ this.storageUtility = storageUtility;
26925
26793
  }
26794
+ // This method needs no state (so can be static), and can be exposed to allow
26795
+ // callers to know where this implementation puts state it needs.
26926
26796
  static getLocalStorageKey(issuer) {
26927
26797
  return `issuerConfig:${issuer}`;
26928
26798
  }
26929
26799
  async fetchConfig(issuer) {
26930
26800
  let issuerConfig;
26931
- const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer.endsWith("/") ? issuer : `${issuer}/`).href;
26932
- const issuerConfigRequestBody = await (0, universal_fetch_1.fetch)(openIdConfigUrl);
26801
+ const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG,
26802
+ // Make sure to append a slash at issuer URL, so that the .well-known URL
26803
+ // includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
26804
+ issuer.endsWith("/") ? issuer : `${issuer}/`).href;
26805
+ const issuerConfigRequestBody = await universalFetch.fetch.call(globalThis, openIdConfigUrl);
26806
+ // Check the validity of the fetched config
26933
26807
  try {
26934
26808
  issuerConfig = processConfig(await issuerConfigRequestBody.json());
26935
26809
  }
26936
26810
  catch (err) {
26937
- throw new solid_client_authn_core_1.ConfigurationError(`[${issuer.toString()}] has an invalid configuration: ${err.message}`);
26811
+ throw new solidClientAuthnCore.ConfigurationError(`[${issuer.toString()}] has an invalid configuration: ${err.message}`);
26938
26812
  }
26813
+ // Update store with fetched config
26939
26814
  await this.storageUtility.set(IssuerConfigFetcher.getLocalStorageKey(issuer), JSON.stringify(issuerConfig));
26940
26815
  return issuerConfig;
26941
26816
  }
26942
26817
  }
26943
- exports["default"] = IssuerConfigFetcher;
26944
- //# sourceMappingURL=IssuerConfigFetcher.js.map
26945
26818
 
26946
- /***/ }),
26947
-
26948
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/OidcLoginHandler.js":
26949
- /*!*********************************************************************************************!*\
26950
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/OidcLoginHandler.js ***!
26951
- \*********************************************************************************************/
26952
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
26953
-
26954
- "use strict";
26955
-
26956
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26957
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
26958
- function hasIssuer(options) {
26959
- return typeof options.oidcIssuer === "string";
26960
- }
26961
- function hasRedirectUrl(options) {
26962
- return typeof options.redirectUrl === "string";
26819
+ //
26820
+ // Copyright Inrupt Inc.
26821
+ //
26822
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26823
+ // of this software and associated documentation files (the "Software"), to deal in
26824
+ // the Software without restriction, including without limitation the rights to use,
26825
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26826
+ // Software, and to permit persons to whom the Software is furnished to do so,
26827
+ // subject to the following conditions:
26828
+ //
26829
+ // The above copyright notice and this permission notice shall be included in
26830
+ // all copies or substantial portions of the Software.
26831
+ //
26832
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26833
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26834
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26835
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26836
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26837
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26838
+ //
26839
+ /**
26840
+ * @param sessionId
26841
+ * @param storage
26842
+ * @hidden
26843
+ */
26844
+ async function clear(sessionId, storage) {
26845
+ await solidClientAuthnCore.clear(sessionId, storage);
26846
+ await oidcClientExt.clearOidcPersistentStorage();
26963
26847
  }
26964
- class OidcLoginHandler {
26965
- constructor(storageUtility, oidcHandler, issuerConfigFetcher, clientRegistrar) {
26966
- this.storageUtility = storageUtility;
26967
- this.oidcHandler = oidcHandler;
26968
- this.issuerConfigFetcher = issuerConfigFetcher;
26969
- this.clientRegistrar = clientRegistrar;
26970
- }
26971
- async canHandle(options) {
26972
- return hasIssuer(options) && hasRedirectUrl(options);
26973
- }
26974
- async handle(options) {
26975
- if (!hasIssuer(options)) {
26976
- throw new solid_client_authn_core_1.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(options)}`);
26848
+ /**
26849
+ * @hidden
26850
+ */
26851
+ class SessionInfoManager extends solidClientAuthnCore.SessionInfoManagerBase {
26852
+ async get(sessionId) {
26853
+ const [isLoggedIn, webId, clientId, clientSecret, redirectUrl, refreshToken, issuer, tokenType,] = await Promise.all([
26854
+ this.storageUtility.getForUser(sessionId, "isLoggedIn", {
26855
+ secure: true,
26856
+ }),
26857
+ this.storageUtility.getForUser(sessionId, "webId", {
26858
+ secure: true,
26859
+ }),
26860
+ this.storageUtility.getForUser(sessionId, "clientId", {
26861
+ secure: false,
26862
+ }),
26863
+ this.storageUtility.getForUser(sessionId, "clientSecret", {
26864
+ secure: false,
26865
+ }),
26866
+ this.storageUtility.getForUser(sessionId, "redirectUrl", {
26867
+ secure: false,
26868
+ }),
26869
+ this.storageUtility.getForUser(sessionId, "refreshToken", {
26870
+ secure: true,
26871
+ }),
26872
+ this.storageUtility.getForUser(sessionId, "issuer", {
26873
+ secure: false,
26874
+ }),
26875
+ this.storageUtility.getForUser(sessionId, "tokenType", {
26876
+ secure: false,
26877
+ }),
26878
+ ]);
26879
+ if (typeof redirectUrl === "string" && !solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {
26880
+ // This resolves the issue for people experiencing https://github.com/inrupt/solid-client-authn-js/issues/2891.
26881
+ // An invalid redirect URL is present in the storage, and the session should
26882
+ // be cleared to get a fresh start. This will require the user to log back in.
26883
+ await Promise.all([
26884
+ this.storageUtility.deleteAllUserData(sessionId, { secure: false }),
26885
+ this.storageUtility.deleteAllUserData(sessionId, { secure: true }),
26886
+ ]);
26887
+ return undefined;
26977
26888
  }
26978
- if (!hasRedirectUrl(options)) {
26979
- throw new solid_client_authn_core_1.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(options)}`);
26889
+ if (tokenType !== undefined && !solidClientAuthnCore.isSupportedTokenType(tokenType)) {
26890
+ throw new Error(`Tokens of type [${tokenType}] are not supported.`);
26980
26891
  }
26981
- const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);
26982
- const clientRegistration = await (0, solid_client_authn_core_1.handleRegistration)(options, issuerConfig, this.storageUtility, this.clientRegistrar);
26983
- const OidcOptions = {
26984
- issuer: issuerConfig.issuer,
26985
- dpop: options.tokenType.toLowerCase() === "dpop",
26986
- ...options,
26987
- issuerConfiguration: issuerConfig,
26988
- client: clientRegistration,
26892
+ if (clientId === undefined &&
26893
+ isLoggedIn === undefined &&
26894
+ webId === undefined &&
26895
+ refreshToken === undefined) {
26896
+ return undefined;
26897
+ }
26898
+ return {
26899
+ sessionId,
26900
+ webId,
26901
+ isLoggedIn: isLoggedIn === "true",
26902
+ redirectUrl,
26903
+ refreshToken,
26904
+ issuer,
26905
+ clientAppId: clientId,
26906
+ clientAppSecret: clientSecret,
26907
+ // Default the token type to DPoP if unspecified.
26908
+ tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP",
26989
26909
  };
26990
- return this.oidcHandler.handle(OidcOptions);
26910
+ }
26911
+ /**
26912
+ * This function removes all session-related information from storage.
26913
+ * @param sessionId the session identifier
26914
+ * @param storage the storage where session info is stored
26915
+ * @hidden
26916
+ */
26917
+ async clear(sessionId) {
26918
+ return clear(sessionId, this.storageUtility);
26991
26919
  }
26992
26920
  }
26993
- exports["default"] = OidcLoginHandler;
26994
- //# sourceMappingURL=OidcLoginHandler.js.map
26995
-
26996
- /***/ }),
26997
-
26998
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js":
26999
- /*!***************************************************************************************!*\
27000
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js ***!
27001
- \***************************************************************************************/
27002
- /***/ ((__unused_webpack_module, exports) => {
27003
-
27004
- "use strict";
27005
26921
 
27006
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27007
- class Redirector {
27008
- redirect(redirectUrl, options) {
27009
- if (options && options.handleRedirect) {
27010
- options.handleRedirect(redirectUrl);
27011
- }
27012
- else if (options && options.redirectByReplacingState) {
27013
- window.history.replaceState({}, "", redirectUrl);
26922
+ //
26923
+ // Copyright Inrupt Inc.
26924
+ //
26925
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26926
+ // of this software and associated documentation files (the "Software"), to deal in
26927
+ // the Software without restriction, including without limitation the rights to use,
26928
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26929
+ // Software, and to permit persons to whom the Software is furnished to do so,
26930
+ // subject to the following conditions:
26931
+ //
26932
+ // The above copyright notice and this permission notice shall be included in
26933
+ // all copies or substantial portions of the Software.
26934
+ //
26935
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26936
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26937
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26938
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26939
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26940
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26941
+ //
26942
+ /**
26943
+ * This class handles redirect IRIs without any query params, and returns an unauthenticated
26944
+ * session. It serves as a fallback so that consuming libraries don't have to test
26945
+ * for the query params themselves, and can always try to use them as a redirect IRI.
26946
+ * @hidden
26947
+ */
26948
+ class FallbackRedirectHandler {
26949
+ async canHandle(redirectUrl) {
26950
+ try {
26951
+ // The next URL object is built for validating it.
26952
+ // eslint-disable-next-line no-new
26953
+ new URL(redirectUrl);
26954
+ return true;
27014
26955
  }
27015
- else {
27016
- window.location.href = redirectUrl;
26956
+ catch (e) {
26957
+ throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
27017
26958
  }
27018
26959
  }
26960
+ async handle(
26961
+ // The argument is ignored, but must be present to implement the interface
26962
+ _redirectUrl) {
26963
+ return solidClientAuthnCore.getUnauthenticatedSession();
26964
+ }
27019
26965
  }
27020
- exports["default"] = Redirector;
27021
- //# sourceMappingURL=Redirector.js.map
27022
-
27023
- /***/ }),
27024
-
27025
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js":
27026
- /*!****************************************************************************************************************************!*\
27027
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js ***!
27028
- \****************************************************************************************************************************/
27029
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27030
-
27031
- "use strict";
27032
26966
 
27033
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27034
- exports.AuthCodeRedirectHandler = void 0;
27035
- const universal_fetch_1 = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js");
27036
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
27037
- const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
26967
+ //
26968
+ // Copyright Inrupt Inc.
26969
+ //
26970
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
26971
+ // of this software and associated documentation files (the "Software"), to deal in
26972
+ // the Software without restriction, including without limitation the rights to use,
26973
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
26974
+ // Software, and to permit persons to whom the Software is furnished to do so,
26975
+ // subject to the following conditions:
26976
+ //
26977
+ // The above copyright notice and this permission notice shall be included in
26978
+ // all copies or substantial portions of the Software.
26979
+ //
26980
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26981
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26982
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26983
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26984
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26985
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26986
+ //
26987
+ /**
26988
+ * @hidden
26989
+ * @packageDocumentation
26990
+ */
26991
+ // FIXME: The following doesn't work in the browser, it results in all the fetches
26992
+ // being unauthenticated. This should be looked into when migrating to universal-fetch.
26993
+ // import { fetch } from "cross-fetch";
26994
+ const globalFetch = (...args) => universalFetch.fetch.call(globalThis, ...args);
26995
+ /**
26996
+ * @hidden
26997
+ */
27038
26998
  class AuthCodeRedirectHandler {
27039
26999
  constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {
27040
27000
  this.storageUtility = storageUtility;
@@ -27042,6 +27002,11 @@ class AuthCodeRedirectHandler {
27042
27002
  this.issuerConfigFetcher = issuerConfigFetcher;
27043
27003
  this.clientRegistrar = clientRegistrar;
27044
27004
  this.tokerRefresher = tokerRefresher;
27005
+ this.storageUtility = storageUtility;
27006
+ this.sessionInfoManager = sessionInfoManager;
27007
+ this.issuerConfigFetcher = issuerConfigFetcher;
27008
+ this.clientRegistrar = clientRegistrar;
27009
+ this.tokerRefresher = tokerRefresher;
27045
27010
  }
27046
27011
  async canHandle(redirectUrl) {
27047
27012
  try {
@@ -27062,7 +27027,7 @@ class AuthCodeRedirectHandler {
27062
27027
  const storedSessionId = (await this.storageUtility.getForUser(oauthState, "sessionId", {
27063
27028
  errorIfNull: true,
27064
27029
  }));
27065
- const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await (0, solid_client_authn_core_1.loadOidcContextFromStorage)(storedSessionId, this.storageUtility, this.issuerConfigFetcher);
27030
+ const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await solidClientAuthnCore.loadOidcContextFromStorage(storedSessionId, this.storageUtility, this.issuerConfigFetcher);
27066
27031
  const iss = url.searchParams.get("iss");
27067
27032
  if (typeof iss === "string" && iss !== issuerConfig.issuer) {
27068
27033
  throw new Error(`The value of the iss parameter (${iss}) does not match the issuer identifier of the authorization server (${issuerConfig.issuer}). See [rfc9207](https://www.rfc-editor.org/rfc/rfc9207.html#section-2.3-3.1.1)`);
@@ -27077,16 +27042,21 @@ class AuthCodeRedirectHandler {
27077
27042
  let tokens;
27078
27043
  const tokenCreatedAt = Date.now();
27079
27044
  if (isDpop) {
27080
- tokens = await (0, oidc_client_ext_1.getDpopToken)(issuerConfig, client, {
27045
+ tokens = await oidcClientExt.getDpopToken(issuerConfig, client, {
27081
27046
  grantType: "authorization_code",
27047
+ // We rely on our 'canHandle' function checking that the OAuth 'code'
27048
+ // parameter is present in our query string.
27082
27049
  code: url.searchParams.get("code"),
27083
27050
  codeVerifier,
27084
27051
  redirectUrl: storedRedirectIri,
27085
27052
  });
27053
+ // Delete oidc-client-specific session information from storage. This is
27054
+ // done automatically when retrieving a bearer token, but since the DPoP
27055
+ // binding uses our custom code, this needs to be done manually.
27086
27056
  window.localStorage.removeItem(`oidc.${oauthState}`);
27087
27057
  }
27088
27058
  else {
27089
- tokens = await (0, oidc_client_ext_1.getBearerToken)(url.toString());
27059
+ tokens = await oidcClientExt.getBearerToken(url.toString());
27090
27060
  }
27091
27061
  let refreshOptions;
27092
27062
  if (tokens.refreshToken !== undefined) {
@@ -27096,7 +27066,7 @@ class AuthCodeRedirectHandler {
27096
27066
  tokenRefresher: this.tokerRefresher,
27097
27067
  };
27098
27068
  }
27099
- const authFetch = await (0, solid_client_authn_core_1.buildAuthenticatedFetch)(universal_fetch_1.fetch, tokens.accessToken, {
27069
+ const authFetch = await solidClientAuthnCore.buildAuthenticatedFetch(globalFetch, tokens.accessToken, {
27100
27070
  dpopKey: tokens.dpopKey,
27101
27071
  refreshOptions,
27102
27072
  eventEmitter,
@@ -27112,366 +27082,842 @@ class AuthCodeRedirectHandler {
27112
27082
  }
27113
27083
  return Object.assign(sessionInfo, {
27114
27084
  fetch: authFetch,
27085
+ getLogoutUrl: solidClientAuthnCore.maybeBuildRpInitiatedLogout({
27086
+ idTokenHint: tokens.idToken,
27087
+ endSessionEndpoint: issuerConfig.endSessionEndpoint,
27088
+ }),
27115
27089
  expirationDate: typeof tokens.expiresIn === "number"
27116
27090
  ? tokenCreatedAt + tokens.expiresIn * 1000
27117
- : null,
27091
+ : undefined,
27118
27092
  });
27119
27093
  }
27120
27094
  }
27121
- exports.AuthCodeRedirectHandler = AuthCodeRedirectHandler;
27122
- //# sourceMappingURL=AuthCodeRedirectHandler.js.map
27123
-
27124
- /***/ }),
27125
27095
 
27126
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js":
27127
- /*!*********************************************************************************************************************!*\
27128
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js ***!
27129
- \*********************************************************************************************************************/
27130
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27096
+ //
27097
+ // Copyright Inrupt Inc.
27098
+ //
27099
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27100
+ // of this software and associated documentation files (the "Software"), to deal in
27101
+ // the Software without restriction, including without limitation the rights to use,
27102
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27103
+ // Software, and to permit persons to whom the Software is furnished to do so,
27104
+ // subject to the following conditions:
27105
+ //
27106
+ // The above copyright notice and this permission notice shall be included in
27107
+ // all copies or substantial portions of the Software.
27108
+ //
27109
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27110
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27111
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27112
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27113
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27114
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27115
+ //
27116
+ /**
27117
+ * @hidden
27118
+ */
27119
+ class AggregateRedirectHandler extends solidClientAuthnCore.AggregateHandler {
27120
+ constructor(redirectHandlers) {
27121
+ super(redirectHandlers);
27122
+ }
27123
+ }
27131
27124
 
27132
- "use strict";
27125
+ //
27126
+ // Copyright Inrupt Inc.
27127
+ //
27128
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27129
+ // of this software and associated documentation files (the "Software"), to deal in
27130
+ // the Software without restriction, including without limitation the rights to use,
27131
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27132
+ // Software, and to permit persons to whom the Software is furnished to do so,
27133
+ // subject to the following conditions:
27134
+ //
27135
+ // The above copyright notice and this permission notice shall be included in
27136
+ // all copies or substantial portions of the Software.
27137
+ //
27138
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27139
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27140
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27141
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27142
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27143
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27144
+ //
27145
+ /**
27146
+ * @hidden
27147
+ */
27148
+ class BrowserStorage {
27149
+ get storage() {
27150
+ return window.localStorage;
27151
+ }
27152
+ async get(key) {
27153
+ return this.storage.getItem(key) || undefined;
27154
+ }
27155
+ async set(key, value) {
27156
+ this.storage.setItem(key, value);
27157
+ }
27158
+ async delete(key) {
27159
+ this.storage.removeItem(key);
27160
+ }
27161
+ }
27133
27162
 
27134
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27135
- exports.ErrorOidcHandler = void 0;
27136
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
27137
- const SessionInfoManager_1 = __webpack_require__(/*! ../../../sessionInfo/SessionInfoManager */ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js");
27138
- class ErrorOidcHandler {
27139
- async canHandle(redirectUrl) {
27140
- try {
27141
- return new URL(redirectUrl).searchParams.has("error");
27163
+ //
27164
+ // Copyright Inrupt Inc.
27165
+ //
27166
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27167
+ // of this software and associated documentation files (the "Software"), to deal in
27168
+ // the Software without restriction, including without limitation the rights to use,
27169
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27170
+ // Software, and to permit persons to whom the Software is furnished to do so,
27171
+ // subject to the following conditions:
27172
+ //
27173
+ // The above copyright notice and this permission notice shall be included in
27174
+ // all copies or substantial portions of the Software.
27175
+ //
27176
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27177
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27178
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27179
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27180
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27181
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27182
+ //
27183
+ /**
27184
+ * @hidden
27185
+ */
27186
+ class Redirector {
27187
+ redirect(redirectUrl, options) {
27188
+ if (options && options.handleRedirect) {
27189
+ options.handleRedirect(redirectUrl);
27142
27190
  }
27143
- catch (e) {
27144
- throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
27191
+ else if (options && options.redirectByReplacingState) {
27192
+ window.history.replaceState({}, "", redirectUrl);
27145
27193
  }
27146
- }
27147
- async handle(redirectUrl, eventEmitter) {
27148
- if (eventEmitter !== undefined) {
27149
- const url = new URL(redirectUrl);
27150
- const errorUrl = url.searchParams.get("error");
27151
- const errorDescriptionUrl = url.searchParams.get("error_description");
27152
- eventEmitter.emit(solid_client_authn_core_1.EVENTS.ERROR, errorUrl, errorDescriptionUrl);
27194
+ else {
27195
+ window.location.href = redirectUrl;
27153
27196
  }
27154
- return (0, SessionInfoManager_1.getUnauthenticatedSession)();
27155
27197
  }
27156
27198
  }
27157
- exports.ErrorOidcHandler = ErrorOidcHandler;
27158
- //# sourceMappingURL=ErrorOidcHandler.js.map
27159
-
27160
- /***/ }),
27161
-
27162
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js":
27163
- /*!****************************************************************************************************************************!*\
27164
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js ***!
27165
- \****************************************************************************************************************************/
27166
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27167
-
27168
- "use strict";
27169
27199
 
27170
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27171
- exports.FallbackRedirectHandler = void 0;
27172
- const SessionInfoManager_1 = __webpack_require__(/*! ../../../sessionInfo/SessionInfoManager */ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js");
27173
- class FallbackRedirectHandler {
27174
- async canHandle(redirectUrl) {
27200
+ //
27201
+ // Copyright Inrupt Inc.
27202
+ //
27203
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27204
+ // of this software and associated documentation files (the "Software"), to deal in
27205
+ // the Software without restriction, including without limitation the rights to use,
27206
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27207
+ // Software, and to permit persons to whom the Software is furnished to do so,
27208
+ // subject to the following conditions:
27209
+ //
27210
+ // The above copyright notice and this permission notice shall be included in
27211
+ // all copies or substantial portions of the Software.
27212
+ //
27213
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27214
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27215
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27216
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27217
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27218
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27219
+ //
27220
+ /**
27221
+ * @hidden
27222
+ */
27223
+ class ClientRegistrar {
27224
+ constructor(storageUtility) {
27225
+ this.storageUtility = storageUtility;
27226
+ this.storageUtility = storageUtility;
27227
+ }
27228
+ async getClient(options, issuerConfig) {
27229
+ // If client secret and/or client id are stored in storage, use those.
27230
+ const [storedClientId, storedClientSecret,
27231
+ // storedClientName,
27232
+ ] = await Promise.all([
27233
+ this.storageUtility.getForUser(options.sessionId, "clientId", {
27234
+ secure: false,
27235
+ }),
27236
+ this.storageUtility.getForUser(options.sessionId, "clientSecret", {
27237
+ secure: false,
27238
+ }),
27239
+ // this.storageUtility.getForUser(options.sessionId, "clientName", {
27240
+ // // FIXME: figure out how to persist secure storage at reload
27241
+ // secure: false,
27242
+ // }),
27243
+ ]);
27244
+ if (storedClientId) {
27245
+ return {
27246
+ clientId: storedClientId,
27247
+ clientSecret: storedClientSecret,
27248
+ clientType: "dynamic",
27249
+ };
27250
+ }
27175
27251
  try {
27176
- new URL(redirectUrl);
27177
- return true;
27252
+ const registeredClient = await oidcClientExt.registerClient(options, issuerConfig);
27253
+ // Save info
27254
+ const infoToSave = {
27255
+ clientId: registeredClient.clientId,
27256
+ };
27257
+ if (registeredClient.clientSecret) {
27258
+ infoToSave.clientSecret = registeredClient.clientSecret;
27259
+ }
27260
+ if (registeredClient.idTokenSignedResponseAlg) {
27261
+ infoToSave.idTokenSignedResponseAlg =
27262
+ registeredClient.idTokenSignedResponseAlg;
27263
+ }
27264
+ await this.storageUtility.setForUser(options.sessionId, infoToSave, {
27265
+ // FIXME: figure out how to persist secure storage at reload
27266
+ // Otherwise, the client info cannot be retrieved from storage, and
27267
+ // the lib tries to re-register the client on each fetch
27268
+ secure: false,
27269
+ });
27270
+ return registeredClient;
27178
27271
  }
27179
- catch (e) {
27180
- throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
27272
+ catch (error) {
27273
+ throw new Error(`Client registration failed: [${error}]`);
27181
27274
  }
27182
27275
  }
27183
- async handle(_redirectUrl) {
27184
- return (0, SessionInfoManager_1.getUnauthenticatedSession)();
27185
- }
27186
27276
  }
27187
- exports.FallbackRedirectHandler = FallbackRedirectHandler;
27188
- //# sourceMappingURL=FallbackRedirectHandler.js.map
27189
-
27190
- /***/ }),
27191
-
27192
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js":
27193
- /*!******************************************************************************************************************************!*\
27194
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js ***!
27195
- \******************************************************************************************************************************/
27196
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27197
-
27198
- "use strict";
27199
27277
 
27200
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27201
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
27202
- const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
27203
- class AuthorizationCodeWithPkceOidcHandler {
27204
- constructor(storageUtility, redirector) {
27205
- this.storageUtility = storageUtility;
27206
- this.redirector = redirector;
27207
- }
27208
- async canHandle(oidcLoginOptions) {
27209
- return !!(oidcLoginOptions.issuerConfiguration.grantTypesSupported &&
27210
- oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1);
27211
- }
27212
- async handle(oidcLoginOptions) {
27213
- var _a;
27214
- const oidcOptions = {
27215
- authority: oidcLoginOptions.issuer.toString(),
27216
- client_id: oidcLoginOptions.client.clientId,
27217
- client_secret: oidcLoginOptions.client.clientSecret,
27218
- redirect_uri: oidcLoginOptions.redirectUrl.toString(),
27219
- post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
27220
- response_type: "code",
27221
- scope: solid_client_authn_core_1.DEFAULT_SCOPES,
27222
- filterProtocolClaims: true,
27223
- loadUserInfo: false,
27224
- code_verifier: true,
27225
- prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent",
27226
- };
27227
- const oidcClientLibrary = new oidc_client_ext_1.OidcClient(oidcOptions);
27228
- const { redirector } = this;
27229
- const storage = this.storageUtility;
27278
+ //
27279
+ // Copyright Inrupt Inc.
27280
+ //
27281
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27282
+ // of this software and associated documentation files (the "Software"), to deal in
27283
+ // the Software without restriction, including without limitation the rights to use,
27284
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27285
+ // Software, and to permit persons to whom the Software is furnished to do so,
27286
+ // subject to the following conditions:
27287
+ //
27288
+ // The above copyright notice and this permission notice shall be included in
27289
+ // all copies or substantial portions of the Software.
27290
+ //
27291
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27292
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27293
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27294
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27295
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27296
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27297
+ //
27298
+ /**
27299
+ * This class handles redirect IRIs without any query params, and returns an unauthenticated
27300
+ * session. It serves as a fallback so that consuming libraries don't have to test
27301
+ * for the query params themselves, and can always try to use them as a redirect IRI.
27302
+ * @hidden
27303
+ */
27304
+ class ErrorOidcHandler {
27305
+ async canHandle(redirectUrl) {
27230
27306
  try {
27231
- const signingRequest = await oidcClientLibrary.createSigninRequest();
27232
- await Promise.all([
27233
- storage.setForUser(signingRequest.state._id, {
27234
- sessionId: oidcLoginOptions.sessionId,
27235
- }),
27236
- storage.setForUser(oidcLoginOptions.sessionId, {
27237
- codeVerifier: signingRequest.state._code_verifier,
27238
- issuer: oidcLoginOptions.issuer.toString(),
27239
- redirectUrl: oidcLoginOptions.redirectUrl,
27240
- dpop: oidcLoginOptions.dpop ? "true" : "false",
27241
- }),
27242
- ]);
27243
- redirector.redirect(signingRequest.url.toString(), {
27244
- handleRedirect: oidcLoginOptions.handleRedirect,
27245
- });
27307
+ // eslint-disable-next-line no-new
27308
+ return new URL(redirectUrl).searchParams.has("error");
27246
27309
  }
27247
- catch (err) {
27248
- console.error(err);
27310
+ catch (e) {
27311
+ throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);
27249
27312
  }
27250
- return undefined;
27313
+ }
27314
+ async handle(redirectUrl, eventEmitter) {
27315
+ if (eventEmitter !== undefined) {
27316
+ const url = new URL(redirectUrl);
27317
+ const errorUrl = url.searchParams.get("error");
27318
+ const errorDescriptionUrl = url.searchParams.get("error_description");
27319
+ eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, errorUrl, errorDescriptionUrl);
27320
+ }
27321
+ return solidClientAuthnCore.getUnauthenticatedSession();
27251
27322
  }
27252
27323
  }
27253
- exports["default"] = AuthorizationCodeWithPkceOidcHandler;
27254
- //# sourceMappingURL=AuthorizationCodeWithPkceOidcHandler.js.map
27255
-
27256
- /***/ }),
27257
-
27258
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js":
27259
- /*!***************************************************************************************************!*\
27260
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js ***!
27261
- \***************************************************************************************************/
27262
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27263
27324
 
27264
- "use strict";
27265
-
27266
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27267
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
27268
- const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
27325
+ //
27326
+ // Copyright Inrupt Inc.
27327
+ //
27328
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27329
+ // of this software and associated documentation files (the "Software"), to deal in
27330
+ // the Software without restriction, including without limitation the rights to use,
27331
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27332
+ // Software, and to permit persons to whom the Software is furnished to do so,
27333
+ // subject to the following conditions:
27334
+ //
27335
+ // The above copyright notice and this permission notice shall be included in
27336
+ // all copies or substantial portions of the Software.
27337
+ //
27338
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27339
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27340
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27341
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27342
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27343
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27344
+ //
27345
+ // Some identifiers are not in camelcase on purpose, as they are named using the
27346
+ // official names from the OIDC/OAuth2 specifications.
27347
+ /* eslint-disable camelcase */
27348
+ /**
27349
+ * @hidden
27350
+ */
27269
27351
  class TokenRefresher {
27270
27352
  constructor(storageUtility, issuerConfigFetcher, clientRegistrar) {
27271
27353
  this.storageUtility = storageUtility;
27272
27354
  this.issuerConfigFetcher = issuerConfigFetcher;
27273
27355
  this.clientRegistrar = clientRegistrar;
27356
+ this.storageUtility = storageUtility;
27357
+ this.issuerConfigFetcher = issuerConfigFetcher;
27358
+ this.clientRegistrar = clientRegistrar;
27274
27359
  }
27275
27360
  async refresh(sessionId, refreshToken, dpopKey, eventEmitter) {
27276
- const oidcContext = await (0, solid_client_authn_core_1.loadOidcContextFromStorage)(sessionId, this.storageUtility, this.issuerConfigFetcher);
27361
+ const oidcContext = await solidClientAuthnCore.loadOidcContextFromStorage(sessionId, this.storageUtility, this.issuerConfigFetcher);
27362
+ // This should also retrieve the client from storage
27277
27363
  const clientInfo = await this.clientRegistrar.getClient({ sessionId }, oidcContext.issuerConfig);
27278
27364
  if (refreshToken === undefined) {
27365
+ // TODO: in a next PR, look up storage for a refresh token
27279
27366
  throw new Error(`Session [${sessionId}] has no refresh token to allow it to refresh its access token.`);
27280
27367
  }
27281
27368
  if (oidcContext.dpop && dpopKey === undefined) {
27282
27369
  throw new Error(`For session [${sessionId}], the key bound to the DPoP access token must be provided to refresh said access token.`);
27283
27370
  }
27284
- const tokenSet = await (0, oidc_client_ext_1.refresh)(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
27285
- if (tokenSet.refreshToken !== undefined) {
27286
- eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(solid_client_authn_core_1.EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);
27287
- await this.storageUtility.setForUser(sessionId, {
27288
- refreshToken: tokenSet.refreshToken,
27289
- });
27371
+ const tokenSet = await oidcClientExt.refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
27372
+ if (tokenSet.refreshToken !== undefined) {
27373
+ eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(solidClientAuthnCore.EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);
27374
+ await this.storageUtility.setForUser(sessionId, {
27375
+ refreshToken: tokenSet.refreshToken,
27376
+ });
27377
+ }
27378
+ return tokenSet;
27379
+ }
27380
+ }
27381
+
27382
+ //
27383
+ // Copyright Inrupt Inc.
27384
+ //
27385
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27386
+ // of this software and associated documentation files (the "Software"), to deal in
27387
+ // the Software without restriction, including without limitation the rights to use,
27388
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27389
+ // Software, and to permit persons to whom the Software is furnished to do so,
27390
+ // subject to the following conditions:
27391
+ //
27392
+ // The above copyright notice and this permission notice shall be included in
27393
+ // all copies or substantial portions of the Software.
27394
+ //
27395
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27396
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27397
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27398
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27399
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27400
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27401
+ //
27402
+ /**
27403
+ *
27404
+ * @param dependencies
27405
+ * @deprecated This function will be removed from the external API in an upcoming release.
27406
+ */
27407
+ function getClientAuthenticationWithDependencies(dependencies) {
27408
+ const inMemoryStorage = new solidClientAuthnCore.InMemoryStorage();
27409
+ const secureStorage = dependencies.secureStorage || inMemoryStorage;
27410
+ const insecureStorage = dependencies.insecureStorage || new BrowserStorage();
27411
+ const storageUtility = new StorageUtilityBrowser(secureStorage, insecureStorage);
27412
+ const issuerConfigFetcher = new IssuerConfigFetcher(storageUtility);
27413
+ const clientRegistrar = new ClientRegistrar(storageUtility);
27414
+ const sessionInfoManager = new SessionInfoManager(storageUtility);
27415
+ const tokenRefresher = new TokenRefresher(storageUtility, issuerConfigFetcher, clientRegistrar);
27416
+ const redirector = new Redirector();
27417
+ // make new handler for redirect and login
27418
+ const loginHandler = new OidcLoginHandler(storageUtility, new AuthorizationCodeWithPkceOidcHandler(storageUtility, redirector), issuerConfigFetcher, clientRegistrar);
27419
+ const redirectHandler = new AggregateRedirectHandler([
27420
+ new ErrorOidcHandler(),
27421
+ new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
27422
+ // This catch-all class will always be able to handle the
27423
+ // redirect IRI, so it must be registered last.
27424
+ new FallbackRedirectHandler(),
27425
+ ]);
27426
+ return new ClientAuthentication(loginHandler, redirectHandler, new solidClientAuthnCore.IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);
27427
+ }
27428
+
27429
+ //
27430
+ // Copyright Inrupt Inc.
27431
+ //
27432
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27433
+ // of this software and associated documentation files (the "Software"), to deal in
27434
+ // the Software without restriction, including without limitation the rights to use,
27435
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27436
+ // Software, and to permit persons to whom the Software is furnished to do so,
27437
+ // subject to the following conditions:
27438
+ //
27439
+ // The above copyright notice and this permission notice shall be included in
27440
+ // all copies or substantial portions of the Software.
27441
+ //
27442
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27443
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27444
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27445
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27446
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27447
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27448
+ //
27449
+ const KEY_CURRENT_SESSION = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`;
27450
+ const KEY_CURRENT_URL = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;
27451
+
27452
+ //
27453
+ // Copyright Inrupt Inc.
27454
+ //
27455
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27456
+ // of this software and associated documentation files (the "Software"), to deal in
27457
+ // the Software without restriction, including without limitation the rights to use,
27458
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27459
+ // Software, and to permit persons to whom the Software is furnished to do so,
27460
+ // subject to the following conditions:
27461
+ //
27462
+ // The above copyright notice and this permission notice shall be included in
27463
+ // all copies or substantial portions of the Software.
27464
+ //
27465
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27466
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27467
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27468
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27469
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27470
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27471
+ //
27472
+ async function silentlyAuthenticate(sessionId, clientAuthn, session) {
27473
+ var _a;
27474
+ const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);
27475
+ if (storedSessionInfo !== null) {
27476
+ // It can be really useful to save the user's current browser location,
27477
+ // so that we can restore it after completing the silent authentication
27478
+ // on incoming redirect. This way, the user is eventually redirected back
27479
+ // to the page they were on and not to the app's redirect page.
27480
+ window.localStorage.setItem(KEY_CURRENT_URL, window.location.href);
27481
+ await clientAuthn.login({
27482
+ sessionId,
27483
+ prompt: "none",
27484
+ oidcIssuer: storedSessionInfo.issuer,
27485
+ redirectUrl: storedSessionInfo.redirectUrl,
27486
+ clientId: storedSessionInfo.clientAppId,
27487
+ clientSecret: storedSessionInfo.clientAppSecret,
27488
+ tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
27489
+ }, session.events);
27490
+ return true;
27491
+ }
27492
+ return false;
27493
+ }
27494
+ function isLoggedIn(sessionInfo) {
27495
+ return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
27496
+ }
27497
+ /**
27498
+ * A {@link Session} object represents a user's session on an application. The session holds state, as it stores information enabling acces to private resources after login for instance.
27499
+ */
27500
+ class Session extends EventEmitter {
27501
+ /**
27502
+ * Session object constructor. Typically called as follows:
27503
+ *
27504
+ * ```typescript
27505
+ * const session = new Session();
27506
+ * ```
27507
+ *
27508
+ * See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).
27509
+ *
27510
+ * @param sessionOptions The options enabling the correct instantiation of
27511
+ * the session. Either both storages or clientAuthentication are required. For
27512
+ * more information, see {@link ISessionOptions}.
27513
+ * @param sessionId A string uniquely identifying the session.
27514
+ *
27515
+ */
27516
+ constructor(sessionOptions = {}, sessionId = undefined) {
27517
+ super();
27518
+ this.tokenRequestInProgress = false;
27519
+ /**
27520
+ * Triggers the login process. Note that this method will redirect the user away from your app.
27521
+ *
27522
+ * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.
27523
+ * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by {@linkcode handleIncomingRedirect}.
27524
+ */
27525
+ // Define these functions as properties so that they don't get accidentally re-bound.
27526
+ // Isn't Javascript fun?
27527
+ this.login = async (options) => {
27528
+ var _a;
27529
+ await this.clientAuthentication.login({
27530
+ sessionId: this.info.sessionId,
27531
+ ...options,
27532
+ // Defaults the token type to DPoP
27533
+ tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP",
27534
+ }, this.events);
27535
+ // `login` redirects the user away from the app,
27536
+ // so unless it throws an error, there is no code that should run afterwards
27537
+ // (since there is no "after" in the lifetime of the script).
27538
+ // Hence, this Promise never resolves:
27539
+ return new Promise(() => { });
27540
+ };
27541
+ /**
27542
+ * Fetches data using available login information. If the user is not logged in, this will behave as a regular `fetch`. The signature of this method is identical to the [canonical `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
27543
+ *
27544
+ * @param url The URL from which data should be fetched.
27545
+ * @param init Optional parameters customizing the request, by specifying an HTTP method, headers, a body, etc. Follows the [WHATWG Fetch Standard](https://fetch.spec.whatwg.org/).
27546
+ */
27547
+ this.fetch = (url, init) => this.clientAuthentication.fetch(url, init);
27548
+ /**
27549
+ * An internal logout function, to control whether or not the logout signal
27550
+ * should be sent, i.e. if the logout was user-initiated or is the result of
27551
+ * an external event.
27552
+ *
27553
+ * @hidden
27554
+ */
27555
+ this.internalLogout = async (emitSignal, options) => {
27556
+ // Clearing this value means that silent refresh will no longer be attempted.
27557
+ // In particular, in the case of a silent authentication error it prevents
27558
+ // from getting stuck in an authentication retries loop.
27559
+ window.localStorage.removeItem(KEY_CURRENT_SESSION);
27560
+ await this.clientAuthentication.logout(this.info.sessionId, options);
27561
+ this.info.isLoggedIn = false;
27562
+ if (emitSignal) {
27563
+ this.events.emit(solidClientAuthnCore.EVENTS.LOGOUT);
27564
+ }
27565
+ };
27566
+ /**
27567
+ * Logs the user out of the application.
27568
+ *
27569
+ * There are 2 types of logout supported by this library,
27570
+ * `app` logout and `idp` logout.
27571
+ *
27572
+ * App logout will log the user out within the application
27573
+ * by clearing any session data from the browser. It does
27574
+ * not log the user out of their Solid identity provider,
27575
+ * and should not redirect the user away.
27576
+ * App logout can be performed as follows:
27577
+ * ```typescript
27578
+ * await session.logout({ logoutType: 'app' });
27579
+ * ```
27580
+ *
27581
+ * IDP logout will log the user out of their Solid identity provider,
27582
+ * and will redirect the user away from the application to do so. In order
27583
+ * for users to be redirected back to `postLogoutUrl` you MUST include the
27584
+ * `postLogoutUrl` value in the `post_logout_redirect_uris` field in the
27585
+ * [Client ID Document](https://docs.inrupt.com/ess/latest/security/authentication/#client-identifier-client-id).
27586
+ * IDP logout can be performed as follows:
27587
+ * ```typescript
27588
+ * await session.logout({
27589
+ * logoutType: 'idp',
27590
+ * // An optional URL to redirect to after logout has completed;
27591
+ * // this MUST match a logout URL listed in the Client ID Document
27592
+ * // of the application that is logged in.
27593
+ * // If the application is logged in with a Client ID that is not
27594
+ * // a URI dereferencing to a Client ID Document then users will
27595
+ * // not be redirected back to the `postLogoutUrl` after logout.
27596
+ * postLogoutUrl: 'https://example.com/logout',
27597
+ * // An optional value to be included in the query parameters
27598
+ * // when the IDP provider redirects the user to the postLogoutRedirectUrl.
27599
+ * state: "my-state"
27600
+ * });
27601
+ * ```
27602
+ */
27603
+ this.logout = async (options) => this.internalLogout(true, options);
27604
+ /**
27605
+ * Completes the login process by processing the information provided by the
27606
+ * Solid identity provider through redirect.
27607
+ *
27608
+ * @param options See {@see IHandleIncomingRedirectOptions}.
27609
+ */
27610
+ this.handleIncomingRedirect = async (inputOptions = {}) => {
27611
+ var _a;
27612
+ if (this.info.isLoggedIn) {
27613
+ return this.info;
27614
+ }
27615
+ if (this.tokenRequestInProgress) {
27616
+ return undefined;
27617
+ }
27618
+ const options = typeof inputOptions === "string" ? { url: inputOptions } : inputOptions;
27619
+ const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href;
27620
+ this.tokenRequestInProgress = true;
27621
+ const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);
27622
+ if (isLoggedIn(sessionInfo)) {
27623
+ this.setSessionInfo(sessionInfo);
27624
+ const currentUrl = window.localStorage.getItem(KEY_CURRENT_URL);
27625
+ if (currentUrl === null) {
27626
+ // The login event can only be triggered **after** the user has been
27627
+ // redirected from the IdP with access and ID tokens.
27628
+ this.events.emit(solidClientAuthnCore.EVENTS.LOGIN);
27629
+ }
27630
+ else {
27631
+ // If an URL is stored in local storage, we are being logged in after a
27632
+ // silent authentication, so remove our currently stored URL location
27633
+ // to clean up our state now that we are completing the re-login process.
27634
+ window.localStorage.removeItem(KEY_CURRENT_URL);
27635
+ this.events.emit(solidClientAuthnCore.EVENTS.SESSION_RESTORED, currentUrl);
27636
+ }
27637
+ }
27638
+ else if (options.restorePreviousSession === true) {
27639
+ // Silent authentication happens after a refresh, which means there are no
27640
+ // OAuth params in the current location IRI. It can only succeed if a session
27641
+ // was previously logged in, in which case its ID will be present with a known
27642
+ // identifier in local storage.
27643
+ // Check if we have a locally stored session ID...
27644
+ const storedSessionId = window.localStorage.getItem(KEY_CURRENT_SESSION);
27645
+ // ...if not, then there is no ID token, and so silent authentication cannot happen, but
27646
+ // if we do have a stored session ID, attempt to re-authenticate now silently.
27647
+ if (storedSessionId !== null) {
27648
+ const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);
27649
+ // At this point, we know that the main window will imminently be redirected.
27650
+ // However, this redirect is asynchronous and there is no way to halt execution
27651
+ // until it happens precisely. That's why the current Promise simply does not
27652
+ // resolve.
27653
+ if (attemptedSilentAuthentication) {
27654
+ return new Promise(() => { });
27655
+ }
27656
+ }
27657
+ }
27658
+ this.tokenRequestInProgress = false;
27659
+ return sessionInfo;
27660
+ };
27661
+ // Until Session no longer implements EventEmitter, this.events is just a proxy
27662
+ // to this (with some interface filtering). When we make the breaking change,
27663
+ // this.events will be a regular EventEmitter (implementing ISessionEventEmitter):
27664
+ // this.events = new EventEmitter();
27665
+ this.events = new Proxy(this, solidClientAuthnCore.buildProxyHandler(Session.prototype, "events only implements ISessionEventListener"));
27666
+ if (sessionOptions.clientAuthentication) {
27667
+ this.clientAuthentication = sessionOptions.clientAuthentication;
27668
+ }
27669
+ else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
27670
+ this.clientAuthentication = getClientAuthenticationWithDependencies({
27671
+ secureStorage: sessionOptions.secureStorage,
27672
+ insecureStorage: sessionOptions.insecureStorage,
27673
+ });
27674
+ }
27675
+ else {
27676
+ this.clientAuthentication = getClientAuthenticationWithDependencies({});
27677
+ }
27678
+ if (sessionOptions.sessionInfo) {
27679
+ this.info = {
27680
+ sessionId: sessionOptions.sessionInfo.sessionId,
27681
+ isLoggedIn: false,
27682
+ webId: sessionOptions.sessionInfo.webId,
27683
+ };
27684
+ }
27685
+ else {
27686
+ this.info = {
27687
+ sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : uuid.v4(),
27688
+ isLoggedIn: false,
27689
+ };
27290
27690
  }
27291
- return tokenSet;
27691
+ // When a session is logged in, we want to track its ID in local storage to
27692
+ // enable silent refresh. The current session ID specifically stored in 'localStorage'
27693
+ // (as opposed to using our storage abstraction layer) because it is only
27694
+ // used in a browser-specific mechanism.
27695
+ this.events.on(solidClientAuthnCore.EVENTS.LOGIN, () => window.localStorage.setItem(KEY_CURRENT_SESSION, this.info.sessionId));
27696
+ this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
27697
+ this.events.on(solidClientAuthnCore.EVENTS.ERROR, () => this.internalLogout(false));
27292
27698
  }
27293
- }
27294
- exports["default"] = TokenRefresher;
27295
- //# sourceMappingURL=TokenRefresher.js.map
27296
-
27297
- /***/ }),
27298
-
27299
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js":
27300
- /*!*********************************************************************************************!*\
27301
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js ***!
27302
- \*********************************************************************************************/
27303
- /***/ ((__unused_webpack_module, exports) => {
27304
-
27305
- "use strict";
27306
-
27307
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27308
- class GeneralLogoutHandler {
27309
- constructor(sessionInfoManager) {
27310
- this.sessionInfoManager = sessionInfoManager;
27699
+ /**
27700
+ * Register a callback function to be called when a user completes login.
27701
+ *
27702
+ * The callback is called when {@link handleIncomingRedirect} completes successfully.
27703
+ *
27704
+ * @param callback The function called when a user completes login.
27705
+ * @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
27706
+ */
27707
+ onLogin(callback) {
27708
+ this.events.on(solidClientAuthnCore.EVENTS.LOGIN, callback);
27311
27709
  }
27312
- async canHandle() {
27313
- return true;
27710
+ /**
27711
+ * Register a callback function to be called when a user logs out:
27712
+ *
27713
+ * @param callback The function called when a user completes logout.
27714
+ * @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
27715
+ */
27716
+ onLogout(callback) {
27717
+ this.events.on(solidClientAuthnCore.EVENTS.LOGOUT, callback);
27314
27718
  }
27315
- async handle(userId) {
27316
- await this.sessionInfoManager.clear(userId);
27719
+ /**
27720
+ * Register a callback function to be called when a user logs out:
27721
+ *
27722
+ * @param callback The function called when an error occurs.
27723
+ * @since 1.11.0
27724
+ * @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
27725
+ */
27726
+ onError(callback) {
27727
+ this.events.on(solidClientAuthnCore.EVENTS.ERROR, callback);
27317
27728
  }
27318
- }
27319
- exports["default"] = GeneralLogoutHandler;
27320
- //# sourceMappingURL=GeneralLogoutHandler.js.map
27321
-
27322
- /***/ }),
27323
-
27324
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js":
27325
- /*!************************************************************************************************!*\
27326
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js ***!
27327
- \************************************************************************************************/
27328
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27329
-
27330
- "use strict";
27331
-
27332
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27333
- exports.SessionInfoManager = exports.clear = exports.getUnauthenticatedSession = void 0;
27334
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
27335
- const uuid_1 = __webpack_require__(/*! uuid */ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js");
27336
- const oidc_client_ext_1 = __webpack_require__(/*! @inrupt/oidc-client-ext */ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js");
27337
- const universal_fetch_1 = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js");
27338
- function getUnauthenticatedSession() {
27339
- return {
27340
- isLoggedIn: false,
27341
- sessionId: (0, uuid_1.v4)(),
27342
- fetch: universal_fetch_1.fetch,
27343
- };
27344
- }
27345
- exports.getUnauthenticatedSession = getUnauthenticatedSession;
27346
- async function clear(sessionId, storage) {
27347
- await Promise.all([
27348
- storage.deleteAllUserData(sessionId, { secure: false }),
27349
- storage.deleteAllUserData(sessionId, { secure: true }),
27350
- storage.delete("clientKey", { secure: false }),
27351
- ]);
27352
- await (0, oidc_client_ext_1.clearOidcPersistentStorage)();
27353
- }
27354
- exports.clear = clear;
27355
- class SessionInfoManager {
27356
- constructor(storageUtility) {
27357
- this.storageUtility = storageUtility;
27729
+ /**
27730
+ * Register a callback function to be called when a session is restored.
27731
+ *
27732
+ * Note: the callback will be called with the saved value of the 'current URL'
27733
+ * at the time the session was restored.
27734
+ *
27735
+ * @param callback The function called when a user's already logged-in session is restored, e.g., after a silent authentication is completed after a page refresh.
27736
+ * @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
27737
+ */
27738
+ onSessionRestore(callback) {
27739
+ this.events.on(solidClientAuthnCore.EVENTS.SESSION_RESTORED, callback);
27358
27740
  }
27359
- update(_sessionId, _options) {
27360
- throw new Error("Not Implemented");
27741
+ /**
27742
+ * Register a callback that runs when the session expires and can no longer
27743
+ * make authenticated requests, but following a user logout.
27744
+ * @param callback The function that runs on session expiration.
27745
+ * @since 1.11.0
27746
+ * @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
27747
+ */
27748
+ onSessionExpiration(callback) {
27749
+ this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, callback);
27361
27750
  }
27362
- async get(sessionId) {
27363
- var _a;
27364
- const isLoggedIn = await this.storageUtility.getForUser(sessionId, "isLoggedIn", {
27365
- secure: true,
27366
- });
27367
- const webId = await this.storageUtility.getForUser(sessionId, "webId", {
27368
- secure: true,
27369
- });
27370
- const clientId = await this.storageUtility.getForUser(sessionId, "clientId", {
27371
- secure: false,
27372
- });
27373
- const clientSecret = await this.storageUtility.getForUser(sessionId, "clientSecret", {
27374
- secure: false,
27375
- });
27376
- const redirectUrl = await this.storageUtility.getForUser(sessionId, "redirectUrl", {
27377
- secure: false,
27378
- });
27379
- const refreshToken = await this.storageUtility.getForUser(sessionId, "refreshToken", {
27380
- secure: true,
27381
- });
27382
- const issuer = await this.storageUtility.getForUser(sessionId, "issuer", {
27383
- secure: false,
27751
+ setSessionInfo(sessionInfo) {
27752
+ this.info.isLoggedIn = sessionInfo.isLoggedIn;
27753
+ this.info.webId = sessionInfo.webId;
27754
+ this.info.sessionId = sessionInfo.sessionId;
27755
+ this.info.expirationDate = sessionInfo.expirationDate;
27756
+ this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXTENDED, (expiresIn) => {
27757
+ this.info.expirationDate = Date.now() + expiresIn * 1000;
27384
27758
  });
27385
- const tokenType = (_a = (await this.storageUtility.getForUser(sessionId, "tokenType", {
27386
- secure: false,
27387
- }))) !== null && _a !== void 0 ? _a : "DPoP";
27388
- if (!(0, solid_client_authn_core_1.isSupportedTokenType)(tokenType)) {
27389
- throw new Error(`Tokens of type [${tokenType}] are not supported.`);
27390
- }
27391
- if (clientId === undefined &&
27392
- isLoggedIn === undefined &&
27393
- webId === undefined &&
27394
- refreshToken === undefined) {
27395
- return undefined;
27396
- }
27397
- return {
27398
- sessionId,
27399
- webId,
27400
- isLoggedIn: isLoggedIn === "true",
27401
- redirectUrl,
27402
- refreshToken,
27403
- issuer,
27404
- clientAppId: clientId,
27405
- clientAppSecret: clientSecret,
27406
- tokenType,
27407
- };
27408
- }
27409
- async getAll() {
27410
- throw new Error("Not implemented");
27411
- }
27412
- async clear(sessionId) {
27413
- return clear(sessionId, this.storageUtility);
27414
- }
27415
- async register(_sessionId) {
27416
- throw new Error("Not implemented");
27417
- }
27418
- async getRegisteredSessionIdAll() {
27419
- throw new Error("Not implemented");
27420
- }
27421
- async clearAll() {
27422
- throw new Error("Not implemented");
27423
27759
  }
27424
27760
  }
27425
- exports.SessionInfoManager = SessionInfoManager;
27426
- //# sourceMappingURL=SessionInfoManager.js.map
27427
-
27428
- /***/ }),
27429
-
27430
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js":
27431
- /*!****************************************************************************************!*\
27432
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js ***!
27433
- \****************************************************************************************/
27434
- /***/ ((__unused_webpack_module, exports) => {
27435
-
27436
- "use strict";
27437
27761
 
27438
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27439
- class BrowserStorage {
27440
- get storage() {
27441
- return window.localStorage;
27442
- }
27443
- async get(key) {
27444
- return this.storage.getItem(key) || undefined;
27445
- }
27446
- async set(key, value) {
27447
- this.storage.setItem(key, value);
27448
- }
27449
- async delete(key) {
27450
- this.storage.removeItem(key);
27762
+ //
27763
+ // Copyright Inrupt Inc.
27764
+ //
27765
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
27766
+ // of this software and associated documentation files (the "Software"), to deal in
27767
+ // the Software without restriction, including without limitation the rights to use,
27768
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
27769
+ // Software, and to permit persons to whom the Software is furnished to do so,
27770
+ // subject to the following conditions:
27771
+ //
27772
+ // The above copyright notice and this permission notice shall be included in
27773
+ // all copies or substantial portions of the Software.
27774
+ //
27775
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
27776
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
27777
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27778
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27779
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27780
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27781
+ //
27782
+ let defaultSession;
27783
+ /**
27784
+ * Obtain the {@link Session} used when not explicitly instantiating one yourself.
27785
+ *
27786
+ * When using the top-level exports {@link fetch}, {@link login}, {@link logout},
27787
+ * {@link handleIncomingRedirect}, {@link onLogin} and {@link onLogout}, these apply to an
27788
+ * implicitly-instantiated {@link Session}.
27789
+ * This function returns a reference to that Session in order to obtain e.g. the current user's
27790
+ * WebID.
27791
+ * @since 1.3.0
27792
+ */
27793
+ function getDefaultSession() {
27794
+ if (typeof defaultSession === "undefined") {
27795
+ defaultSession = new Session();
27451
27796
  }
27797
+ return defaultSession;
27452
27798
  }
27453
- exports["default"] = BrowserStorage;
27454
- //# sourceMappingURL=BrowserStorage.js.map
27455
-
27456
- /***/ }),
27799
+ /**
27800
+ * This function's signature is equal to `window.fetch`, but if the current user is authenticated
27801
+ * (see [[login]] and [[handleIncomingRedirect]]), requests made using it will include that user's
27802
+ * credentials. If not, this will behave just like the regular `window.fetch`.
27803
+ *
27804
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch}
27805
+ * @since 1.3.0
27806
+ */
27807
+ /* eslint-disable-next-line no-shadow */
27808
+ const fetch = (...args) => {
27809
+ const session = getDefaultSession();
27810
+ return session.fetch(...args);
27811
+ };
27812
+ /**
27813
+ * Triggers the login process. Note that this method will redirect the user away from your app.
27814
+ *
27815
+ * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.
27816
+ * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]].
27817
+ * @since 1.3.0
27818
+ */
27819
+ const login = (...args) => {
27820
+ const session = getDefaultSession();
27821
+ return session.login(...args);
27822
+ };
27823
+ /**
27824
+ * Logs the user out of the application.
27825
+ *
27826
+ * By default this does not log the user out of their Solid identity provider.
27827
+ * In order to do so, you must set the logoutType to `idp`. For usage details
27828
+ * see {@link Session.logout}.
27829
+ *
27830
+ * @since 1.3.0
27831
+ */
27832
+ const logout = (...args) => {
27833
+ const session = getDefaultSession();
27834
+ return session.logout(...args);
27835
+ };
27836
+ /**
27837
+ * Completes the login process by processing the information provided by the Solid identity provider through redirect.
27838
+ *
27839
+ * @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login.
27840
+ * @since 1.3.0
27841
+ */
27842
+ const handleIncomingRedirect = (...args) => {
27843
+ const session = getDefaultSession();
27844
+ return session.handleIncomingRedirect(...args);
27845
+ };
27846
+ /**
27847
+ * Register a callback function to be called when a user completes login.
27848
+ *
27849
+ * The callback is called when {@link handleIncomingRedirect} completes successfully.
27850
+ * @since 1.3.0
27851
+ *
27852
+ * @param callback The function called when a user completes login.
27853
+ * @deprecated Prefer events.on(EVENTS.LOGIN, callback)
27457
27854
 
27458
- /***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/storage/StorageUtility.js":
27459
- /*!****************************************************************************************!*\
27460
- !*** ./node_modules/@inrupt/solid-client-authn-browser/dist/storage/StorageUtility.js ***!
27461
- \****************************************************************************************/
27462
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27855
+ */
27856
+ const onLogin = (...args) => {
27857
+ const session = getDefaultSession();
27858
+ return session.onLogin(...args);
27859
+ };
27860
+ /**
27861
+ * Register a callback function to be called when a user logs out:
27862
+ *
27863
+ * @param callback The function called when a user completes logout.
27864
+ * @since 1.3.0
27865
+ * @deprecated Prefer events.on(EVENTS.LOGOUT, callback)
27866
+ *
27867
+ */
27868
+ const onLogout = (...args) => {
27869
+ const session = getDefaultSession();
27870
+ return session.onLogout(...args);
27871
+ };
27872
+ /**
27873
+ * Register a callback function to be called when a session is restored:
27874
+ *
27875
+ * @param callback The function called when a session is restored.
27876
+ * @since 1.3.0
27877
+ * @deprecated Prefer events.on(EVENTS.SESSION_RESTORED, callback)
27878
+ */
27879
+ const onSessionRestore = (...args) => {
27880
+ const session = getDefaultSession();
27881
+ return session.onSessionRestore(...args);
27882
+ };
27883
+ /**
27884
+ * {@link SessionEventEmitter} instance to subscribe to events by the default session.
27885
+ *
27886
+ * @since 1.14.0
27887
+ */
27888
+ const events = () => {
27889
+ return getDefaultSession().events;
27890
+ };
27463
27891
 
27464
- "use strict";
27892
+ Object.defineProperty(exports, "ConfigurationError", ({
27893
+ enumerable: true,
27894
+ get: function () { return solidClientAuthnCore.ConfigurationError; }
27895
+ }));
27896
+ Object.defineProperty(exports, "EVENTS", ({
27897
+ enumerable: true,
27898
+ get: function () { return solidClientAuthnCore.EVENTS; }
27899
+ }));
27900
+ Object.defineProperty(exports, "InMemoryStorage", ({
27901
+ enumerable: true,
27902
+ get: function () { return solidClientAuthnCore.InMemoryStorage; }
27903
+ }));
27904
+ Object.defineProperty(exports, "NotImplementedError", ({
27905
+ enumerable: true,
27906
+ get: function () { return solidClientAuthnCore.NotImplementedError; }
27907
+ }));
27908
+ exports.Session = Session;
27909
+ exports.events = events;
27910
+ exports.fetch = fetch;
27911
+ exports.getClientAuthenticationWithDependencies = getClientAuthenticationWithDependencies;
27912
+ exports.getDefaultSession = getDefaultSession;
27913
+ exports.handleIncomingRedirect = handleIncomingRedirect;
27914
+ exports.login = login;
27915
+ exports.logout = logout;
27916
+ exports.onLogin = onLogin;
27917
+ exports.onLogout = onLogout;
27918
+ exports.onSessionRestore = onSessionRestore;
27919
+ //# sourceMappingURL=index.js.map
27465
27920
 
27466
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27467
- const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
27468
- class StorageUtilityBrowser extends solid_client_authn_core_1.StorageUtility {
27469
- constructor(secureStorage, insecureStorage) {
27470
- super(secureStorage, insecureStorage);
27471
- }
27472
- }
27473
- exports["default"] = StorageUtilityBrowser;
27474
- //# sourceMappingURL=StorageUtility.js.map
27475
27921
 
27476
27922
  /***/ }),
27477
27923