@inveniosoftware/react-invenio-app-ils 1.0.0 → 1.1.0

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,9 @@
1
1
  # Changes
2
2
 
3
+ Version 1.1.0 (released 2024-11-04)
4
+
5
+ - self-checkout: uppercase barcode when input by the user
6
+
3
7
  Version 1.0.0 (released 2024-10-22)
4
8
 
5
9
  - upgrade axios and react-searchkit dependencies
package/README.md CHANGED
@@ -10,8 +10,7 @@ To update dependencies you need to run `npm install` in the target deployment
10
10
  environment:
11
11
 
12
12
  ```shell
13
- $ rm -rf package-lock.json && rm -rf node_modules
14
-
13
+ $ rm -rf package-lock.json node_modules
15
14
  # Run the container with x86_64 architecture and install packages
16
15
  $ docker run -it --platform="linux/amd64" --rm -v $(pwd):/app -w /app node:14-alpine sh -c "npm install"
17
16
  ```
package/dist/cjs/index.js CHANGED
@@ -37659,7 +37659,7 @@ class ManualCheckout extends React__default["default"].Component {
37659
37659
  constructor(props) {
37660
37660
  super(props);
37661
37661
  this.state = {
37662
- manualBarcode: null
37662
+ manualBarcode: ''
37663
37663
  };
37664
37664
  this.inputRef = React__default["default"].createRef();
37665
37665
  }
@@ -37676,7 +37676,7 @@ class ManualCheckout extends React__default["default"].Component {
37676
37676
  render() {
37677
37677
  const {
37678
37678
  show,
37679
- onChange,
37679
+ onBarcodeInput,
37680
37680
  label
37681
37681
  } = this.props;
37682
37682
  const {
@@ -37690,17 +37690,22 @@ class ManualCheckout extends React__default["default"].Component {
37690
37690
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Header, {
37691
37691
  className: "pb-1",
37692
37692
  as: "h5"
37693
- }, label, " Add the barcode manually:"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Input, {
37693
+ }, label, " Insert the barcode manually:"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Input, {
37694
37694
  id: "barcodeInput",
37695
37695
  type: "text",
37696
37696
  placeholder: "Barcode...",
37697
37697
  className: "pb-1",
37698
37698
  ref: this.inputRef,
37699
- onChange: e => this.setState({
37700
- manualBarcode: e.target.value
37701
- })
37699
+ value: manualBarcode,
37700
+ onChange: e => {
37701
+ var _e$target$value;
37702
+ return this.setState({
37703
+ manualBarcode: (_e$target$value = e.target.value) === null || _e$target$value === void 0 ? void 0 : _e$target$value.toUpperCase()
37704
+ });
37705
+ }
37702
37706
  }), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
37703
- onClick: () => onChange(manualBarcode),
37707
+ onClick: () => manualBarcode && onBarcodeInput(manualBarcode),
37708
+ disabled: !manualBarcode,
37704
37709
  className: "ml-10",
37705
37710
  type: "submit"
37706
37711
  }, "Search")));
@@ -37711,7 +37716,7 @@ class ManualCheckout extends React__default["default"].Component {
37711
37716
  }
37712
37717
  ManualCheckout.defaultProps = {
37713
37718
  show: false,
37714
- label: 'Can’t scan the barcode?',
37719
+ label: "Can't scan the barcode?",
37715
37720
  autofocus: false
37716
37721
  };
37717
37722
 
@@ -37768,7 +37773,7 @@ class SelfCheckoutModal$1 extends React__default["default"].Component {
37768
37773
  label: "Wrong book?",
37769
37774
  autofocus: true,
37770
37775
  show: true,
37771
- onChange: onBarcodeDetected
37776
+ onBarcodeInput: onBarcodeDetected
37772
37777
  })), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Modal.Actions, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
37773
37778
  color: "black",
37774
37779
  onClick: () => toggleModal(false),
@@ -37804,7 +37809,8 @@ const notifyResultMessage = message => {
37804
37809
  };
37805
37810
  };
37806
37811
  const searchItem = async (dispatch, term) => {
37807
- const response = await itemApi.list(itemApi.query().withBarcode(term).qs());
37812
+ const upperCasedTerm = term.toUpperCase();
37813
+ const response = await itemApi.list(itemApi.query().withBarcode(upperCasedTerm).qs());
37808
37814
  const item = _first__default["default"](response.data.hits) || null;
37809
37815
  dispatch({
37810
37816
  type: SEARCH_ITEM_SUCCESS,
@@ -37834,9 +37840,9 @@ const checkoutItem = (documentPid, itemPid, patronPid) => {
37834
37840
  const {
37835
37841
  pid
37836
37842
  } = response.data.metadata;
37837
- const linkToLoan = /*#__PURE__*/React__default["default"].createElement("p", null, "The loan ", pid, " has been created by you!", ' ', /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
37843
+ const linkToLoan = /*#__PURE__*/React__default["default"].createElement("p", null, "The loan ", pid, " has been created by you! You can view all your current loans on your ", /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
37838
37844
  to: FrontSiteRoutes.patronProfile
37839
- }, "You can now view the loan details."));
37845
+ }, "profile"), ' ', "page.");
37840
37846
  dispatch(sendSuccessNotification('Success!', linkToLoan));
37841
37847
  } catch (error) {
37842
37848
  dispatch(sendErrorNotification(error));
@@ -37899,7 +37905,7 @@ class SelfCheckout$1 extends React__default["default"].Component {
37899
37905
  item,
37900
37906
  notifyResultMessage
37901
37907
  } = this.props;
37902
- var resultMessage = `Book with barcode: ${itemBarcode} doesn't exist.`;
37908
+ var resultMessage = `Book with barcode ${itemBarcode} not found.`;
37903
37909
  if (!_isEmpty__default["default"](item)) {
37904
37910
  if (this.itemStatus(item).canCirculate()) {
37905
37911
  if (this.itemStatus(item).isOnShelf()) {
@@ -37960,11 +37966,13 @@ class SelfCheckout$1 extends React__default["default"].Component {
37960
37966
  onBarcodeDetected: this.onBarcodeDetected
37961
37967
  }), /*#__PURE__*/React__default["default"].createElement(ManualCheckout, {
37962
37968
  show: true,
37963
- onChange: this.onBarcodeDetected
37969
+ onBarcodeInput: this.onBarcodeDetected
37964
37970
  }), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message, {
37965
37971
  warning: true,
37966
37972
  compact: true
37967
- }, "If your browser isn't able to scan the barcode, try", /*#__PURE__*/React__default["default"].createElement("br", null), "using another browser. (Recommended: Chrome)")), /*#__PURE__*/React__default["default"].createElement(SelfCheckoutModal, {
37973
+ }, "Barcode not detected while scanning?", /*#__PURE__*/React__default["default"].createElement("br", null), "Try using another browser. (Recommended:", ' ', /*#__PURE__*/React__default["default"].createElement("a", {
37974
+ href: "https://www.google.com/chrome/"
37975
+ }, "Google Chrome"), ")")), /*#__PURE__*/React__default["default"].createElement(SelfCheckoutModal, {
37968
37976
  modalOpened: showModal,
37969
37977
  toggleModal: this.toggleModal,
37970
37978
  onBarcodeDetected: this.onBarcodeDetected