@inveniosoftware/react-invenio-app-ils 1.0.0-alpha.87 → 1.0.0-alpha.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changes
2
2
 
3
+ Version 1.0.0-alpha.89 (released 2024-06-24)
4
+
5
+ - self-checkout: improve scanning behaviour
6
+ - frontsite: pass document details to document item table
7
+
8
+ Version 1.0.0-alpha.88 (released 2024-06-18)
9
+
10
+ - frontsite: handle null barcode
11
+
3
12
  Version 1.0.0-alpha.87 (released 2024-06-14)
4
13
 
5
14
  - document items: add overridable id
package/dist/cjs/index.js CHANGED
@@ -5096,7 +5096,7 @@ const WarningMessage = _ref2 => {
5096
5096
  icon: "exclamation triangle",
5097
5097
  header: header,
5098
5098
  content: content,
5099
- autoDismiss: invenioConfig.APP.SUCCESS_AUTO_DISMISS_SECONDS * 1000,
5099
+ autoDismiss: invenioConfig.APP.SUCCESS_AUTO_DISMISS_SECONDS * 3000,
5100
5100
  onDismiss: () => removeNotification(id)
5101
5101
  });
5102
5102
  };
@@ -6167,7 +6167,8 @@ class DocumentItemBody extends React.Component {
6167
6167
  render() {
6168
6168
  const {
6169
6169
  items,
6170
- shelfLink
6170
+ shelfLink,
6171
+ documentDetails
6171
6172
  } = this.props;
6172
6173
  return items.map(item => /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Row, {
6173
6174
  key: item.pid
@@ -6177,7 +6178,7 @@ class DocumentItemBody extends React.Component {
6177
6178
  }, item.barcode), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Cell, {
6178
6179
  "data-label": "Shelf",
6179
6180
  className: "document-item-table-itemCell"
6180
- }, (shelfLink !== null ? shelfLink(item) : _get__default["default"](item, 'shelf')) || 'none'), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Cell, {
6181
+ }, (shelfLink !== null ? shelfLink(item, documentDetails) : _get__default["default"](item, 'shelf')) || 'none'), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Cell, {
6181
6182
  "data-label": "Status"
6182
6183
  }, this.statusLabel(item)), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Cell, {
6183
6184
  "data-label": "Medium"
@@ -36200,6 +36201,7 @@ class DocumentItem extends React.Component {
36200
36201
  const {
36201
36202
  internalLocationName,
36202
36203
  items,
36204
+ documentDetails,
36203
36205
  showTitle
36204
36206
  } = this.props;
36205
36207
  const {
@@ -36225,7 +36227,8 @@ class DocumentItem extends React.Component {
36225
36227
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.HeaderCell, null, "Barcode"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.HeaderCell, null, "Shelf"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.HeaderCell, null, "Status"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.HeaderCell, null, "Medium"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.HeaderCell, null, "Loan restriction")))), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Body, null, /*#__PURE__*/React__default["default"].createElement(Overridable__default["default"], {
36226
36228
  id: "DocumentDetails.DocumentItemTableBody"
36227
36229
  }, /*#__PURE__*/React__default["default"].createElement(DocumentItemBody, {
36228
- items: itemsToShow
36230
+ items: itemsToShow,
36231
+ documentDetails: documentDetails
36229
36232
  }))), this.moreItemsToLoad && /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Table.Footer, {
36230
36233
  fullWidth: true,
36231
36234
  "data-test": "footer",
@@ -36330,6 +36333,7 @@ class DocumentTabs extends React.Component {
36330
36333
  return /*#__PURE__*/React__default["default"].createElement(DocumentItem$1, {
36331
36334
  internalLocationName: internalLocationName,
36332
36335
  items: items,
36336
+ documentDetails: this.documentDetails,
36333
36337
  showTitle: activeInternalLocation !== internalLocationName
36334
36338
  });
36335
36339
  }
@@ -36340,6 +36344,7 @@ class DocumentTabs extends React.Component {
36340
36344
  key: internalLocationName,
36341
36345
  internalLocationName: internalLocationName,
36342
36346
  items: items,
36347
+ documentDetails: this.documentDetails,
36343
36348
  showTitle: activeInternalLocation !== internalLocationName
36344
36349
  });
36345
36350
  });
@@ -36373,6 +36378,12 @@ class DocumentTabs extends React.Component {
36373
36378
  } = this.props;
36374
36379
  return locationsObject;
36375
36380
  }
36381
+ get documentDetails() {
36382
+ const {
36383
+ documentDetails
36384
+ } = this.props;
36385
+ return documentDetails;
36386
+ }
36376
36387
  get locationEntries() {
36377
36388
  return Object.entries(this.locations);
36378
36389
  }
@@ -36390,8 +36401,8 @@ class DocumentTabs extends React.Component {
36390
36401
  }
36391
36402
 
36392
36403
  class DocumentItems$1 extends React.Component {
36393
- constructor(props) {
36394
- super(props);
36404
+ constructor() {
36405
+ super(...arguments);
36395
36406
  this.itemStatus = item => ({
36396
36407
  canCirculate: () => invenioConfig.ITEMS.canCirculateStatuses.includes(item.status),
36397
36408
  isForReference: () => invenioConfig.ITEMS.referenceStatuses.includes(item.status)
@@ -36443,7 +36454,8 @@ class DocumentItems$1 extends React.Component {
36443
36454
  documentDetails
36444
36455
  } = this.props;
36445
36456
  const internalLocationsComponent = /*#__PURE__*/React__default["default"].createElement(DocumentTabs, {
36446
- locationsObject: this.filteredLocations
36457
+ locationsObject: this.filteredLocations,
36458
+ documentDetails: documentDetails
36447
36459
  });
36448
36460
  const noItemsComponent = /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Header, null, "No copies"), /*#__PURE__*/React__default["default"].createElement("p", null, "There are no available copies in the library. Please, contact the library for more information."));
36449
36461
  const hasCopies = _has__default["default"](items, 'on_shelf') && !_isEmpty__default["default"](this.filteredLocations);
@@ -38618,7 +38630,7 @@ class BarcodeScanner extends React__default["default"].Component {
38618
38630
  this.setScannerArea = (cameraBoxWidth, cameraBoxHeight) => {
38619
38631
  return {
38620
38632
  width: cameraBoxWidth * 0.9,
38621
- height: cameraBoxHeight * 0.3
38633
+ height: cameraBoxHeight * 0.7
38622
38634
  };
38623
38635
  };
38624
38636
  this.onScanSuccess = (decodedText, decodedResult) => {
@@ -38640,8 +38652,10 @@ class BarcodeScanner extends React__default["default"].Component {
38640
38652
  this.scanner.start({
38641
38653
  facingMode: 'environment'
38642
38654
  }, {
38643
- fps: 1,
38655
+ fps: 2,
38644
38656
  // frame per second for qr code scanning
38657
+ aspectRatio: 2,
38658
+ // 2:1
38645
38659
  qrbox: this.setScannerArea // bounding box UI
38646
38660
  }, this.onScanSuccess, this.onScanFailure, /* verbose= */false);
38647
38661
  };
@@ -38658,11 +38672,8 @@ class BarcodeScanner extends React__default["default"].Component {
38658
38672
  }
38659
38673
  render() {
38660
38674
  return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Container, {
38661
- id: this.deviceId,
38662
- style: {
38663
- width: '80%'
38664
- }
38665
- }); // TODO: Move to overrides
38675
+ id: this.deviceId
38676
+ });
38666
38677
  }
38667
38678
  }
38668
38679
  BarcodeScanner.defaultProps = {
@@ -38739,15 +38750,17 @@ class SelfCheckoutModal$1 extends React__default["default"].Component {
38739
38750
  modalOpened,
38740
38751
  toggleModal
38741
38752
  } = this.props;
38742
- const itemBarcode = item === null || item === void 0 ? void 0 : item.metadata.barcode;
38743
- return item ? /*#__PURE__*/React__default["default"].createElement(Loader$1, {
38753
+ if (_isEmpty__default["default"](item)) {
38754
+ return null;
38755
+ }
38756
+ return /*#__PURE__*/React__default["default"].createElement(Loader$1, {
38744
38757
  isLoading: isLoading
38745
38758
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal, {
38746
38759
  open: modalOpened,
38747
38760
  size: "large",
38748
38761
  centered: true,
38749
38762
  onClose: () => toggleModal(false)
38750
- }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal.Header, null, "You are about to checkout a book with barcode:\n ".concat(itemBarcode)), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal.Content, null, /*#__PURE__*/React__default["default"].createElement(DocumentCard, {
38763
+ }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal.Header, null, "You are about to checkout a book with barcode:\n ".concat(item === null || item === void 0 ? void 0 : item.metadata.barcode)), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal.Content, null, /*#__PURE__*/React__default["default"].createElement(DocumentCard, {
38751
38764
  item: item
38752
38765
  })), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal.Actions, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
38753
38766
  color: "black",
@@ -38767,7 +38780,7 @@ class SelfCheckoutModal$1 extends React__default["default"].Component {
38767
38780
  labelPosition: "left",
38768
38781
  content: "Checkout and finish",
38769
38782
  onClick: this.handleCheckoutFinishClick
38770
- })))) : null;
38783
+ }))));
38771
38784
  }
38772
38785
  }
38773
38786
  SelfCheckoutModal$1.defaultProps = {
@@ -38785,7 +38798,7 @@ const notifyResultMessage = message => {
38785
38798
  };
38786
38799
  const searchItem = async (dispatch, term) => {
38787
38800
  const response = await itemApi.list(itemApi.query().withBarcode(term).qs());
38788
- const item = _first__default["default"](response.data.hits) || {};
38801
+ const item = _first__default["default"](response.data.hits) || null;
38789
38802
  dispatch({
38790
38803
  type: SEARCH_ITEM_SUCCESS,
38791
38804
  payload: item
@@ -38906,7 +38919,7 @@ class SelfCheckout$1 extends React__default["default"].Component {
38906
38919
  }, "How to scan:"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List, {
38907
38920
  bulleted: true,
38908
38921
  size: "big"
38909
- }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Look for the library's unique barcode sticker, typically found on the inside cover or the first page."), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Hold the scanner directly over the barcode and scan inside the box as depicted. Ensure that the barcode is inside the scanner box."), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Wait for the confirmation light and a popup prompting the checkout process, indicating that the barcode is successfully scanned!"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Check the popup window to ensure the correct book details are dispayed before checking out the book."), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, /*#__PURE__*/React__default["default"].createElement("b", null, "Important Reminder:"), " Please do not scan the publication barcode on the back cover of the book.", /*#__PURE__*/React__default["default"].createElement("br", null), "The publication barcode is for retail purposes and will not work with our library system.")), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid, {
38922
+ }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Look for the library's unique barcode sticker, typically found on the inside cover or the first page."), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Hold the scanner directly over the barcode and scan inside the box as depicted. Ensure that the barcode is inside the scanner box."), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Wait for the confirmation light and a popup prompting the checkout process, indicating that the barcode is successfully scanned!"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, "Check the popup window to ensure the correct book details are displayed before checking out the book."), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, null, /*#__PURE__*/React__default["default"].createElement("b", null, "Important Reminder:"), " Please do not scan the publication barcode on the back cover of the book.", /*#__PURE__*/React__default["default"].createElement("br", null), "The publication barcode is for retail purposes and will not work with our library system.")), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid, {
38910
38923
  centered: true
38911
38924
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Row, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
38912
38925
  width: 8
@@ -38934,7 +38947,7 @@ class SelfCheckout$1 extends React__default["default"].Component {
38934
38947
  textAlign: "center"
38935
38948
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Header, {
38936
38949
  as: "h1"
38937
- }, "SELF CHECKOUT"), /*#__PURE__*/React__default["default"].createElement(BarcodeScanner$1, {
38950
+ }, "SELF-CHECKOUT"), /*#__PURE__*/React__default["default"].createElement(BarcodeScanner$1, {
38938
38951
  onBarcodeDetected: this.onBarcodeDetected
38939
38952
  }), /*#__PURE__*/React__default["default"].createElement(SelfCheckoutModal, {
38940
38953
  modalOpened: showModal,