@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/dist/esm/index.js CHANGED
@@ -37617,7 +37617,7 @@ class ManualCheckout extends React.Component {
37617
37617
  constructor(props) {
37618
37618
  super(props);
37619
37619
  this.state = {
37620
- manualBarcode: null
37620
+ manualBarcode: ''
37621
37621
  };
37622
37622
  this.inputRef = React.createRef();
37623
37623
  }
@@ -37634,7 +37634,7 @@ class ManualCheckout extends React.Component {
37634
37634
  render() {
37635
37635
  const {
37636
37636
  show,
37637
- onChange,
37637
+ onBarcodeInput,
37638
37638
  label
37639
37639
  } = this.props;
37640
37640
  const {
@@ -37648,17 +37648,22 @@ class ManualCheckout extends React.Component {
37648
37648
  }, /*#__PURE__*/React.createElement(Header, {
37649
37649
  className: "pb-1",
37650
37650
  as: "h5"
37651
- }, label, " Add the barcode manually:"), /*#__PURE__*/React.createElement(Input, {
37651
+ }, label, " Insert the barcode manually:"), /*#__PURE__*/React.createElement(Input, {
37652
37652
  id: "barcodeInput",
37653
37653
  type: "text",
37654
37654
  placeholder: "Barcode...",
37655
37655
  className: "pb-1",
37656
37656
  ref: this.inputRef,
37657
- onChange: e => this.setState({
37658
- manualBarcode: e.target.value
37659
- })
37657
+ value: manualBarcode,
37658
+ onChange: e => {
37659
+ var _e$target$value;
37660
+ return this.setState({
37661
+ manualBarcode: (_e$target$value = e.target.value) === null || _e$target$value === void 0 ? void 0 : _e$target$value.toUpperCase()
37662
+ });
37663
+ }
37660
37664
  }), /*#__PURE__*/React.createElement(Button, {
37661
- onClick: () => onChange(manualBarcode),
37665
+ onClick: () => manualBarcode && onBarcodeInput(manualBarcode),
37666
+ disabled: !manualBarcode,
37662
37667
  className: "ml-10",
37663
37668
  type: "submit"
37664
37669
  }, "Search")));
@@ -37669,7 +37674,7 @@ class ManualCheckout extends React.Component {
37669
37674
  }
37670
37675
  ManualCheckout.defaultProps = {
37671
37676
  show: false,
37672
- label: 'Can’t scan the barcode?',
37677
+ label: "Can't scan the barcode?",
37673
37678
  autofocus: false
37674
37679
  };
37675
37680
 
@@ -37726,7 +37731,7 @@ class SelfCheckoutModal$1 extends React.Component {
37726
37731
  label: "Wrong book?",
37727
37732
  autofocus: true,
37728
37733
  show: true,
37729
- onChange: onBarcodeDetected
37734
+ onBarcodeInput: onBarcodeDetected
37730
37735
  })), /*#__PURE__*/React.createElement(Modal.Actions, null, /*#__PURE__*/React.createElement(Button, {
37731
37736
  color: "black",
37732
37737
  onClick: () => toggleModal(false),
@@ -37762,7 +37767,8 @@ const notifyResultMessage = message => {
37762
37767
  };
37763
37768
  };
37764
37769
  const searchItem = async (dispatch, term) => {
37765
- const response = await itemApi.list(itemApi.query().withBarcode(term).qs());
37770
+ const upperCasedTerm = term.toUpperCase();
37771
+ const response = await itemApi.list(itemApi.query().withBarcode(upperCasedTerm).qs());
37766
37772
  const item = _first(response.data.hits) || null;
37767
37773
  dispatch({
37768
37774
  type: SEARCH_ITEM_SUCCESS,
@@ -37792,9 +37798,9 @@ const checkoutItem = (documentPid, itemPid, patronPid) => {
37792
37798
  const {
37793
37799
  pid
37794
37800
  } = response.data.metadata;
37795
- const linkToLoan = /*#__PURE__*/React.createElement("p", null, "The loan ", pid, " has been created by you!", ' ', /*#__PURE__*/React.createElement(Link$1, {
37801
+ const linkToLoan = /*#__PURE__*/React.createElement("p", null, "The loan ", pid, " has been created by you! You can view all your current loans on your ", /*#__PURE__*/React.createElement(Link$1, {
37796
37802
  to: FrontSiteRoutes.patronProfile
37797
- }, "You can now view the loan details."));
37803
+ }, "profile"), ' ', "page.");
37798
37804
  dispatch(sendSuccessNotification('Success!', linkToLoan));
37799
37805
  } catch (error) {
37800
37806
  dispatch(sendErrorNotification(error));
@@ -37857,7 +37863,7 @@ class SelfCheckout$1 extends React.Component {
37857
37863
  item,
37858
37864
  notifyResultMessage
37859
37865
  } = this.props;
37860
- var resultMessage = `Book with barcode: ${itemBarcode} doesn't exist.`;
37866
+ var resultMessage = `Book with barcode ${itemBarcode} not found.`;
37861
37867
  if (!_isEmpty(item)) {
37862
37868
  if (this.itemStatus(item).canCirculate()) {
37863
37869
  if (this.itemStatus(item).isOnShelf()) {
@@ -37918,11 +37924,13 @@ class SelfCheckout$1 extends React.Component {
37918
37924
  onBarcodeDetected: this.onBarcodeDetected
37919
37925
  }), /*#__PURE__*/React.createElement(ManualCheckout, {
37920
37926
  show: true,
37921
- onChange: this.onBarcodeDetected
37927
+ onBarcodeInput: this.onBarcodeDetected
37922
37928
  }), /*#__PURE__*/React.createElement(Message, {
37923
37929
  warning: true,
37924
37930
  compact: true
37925
- }, "If your browser isn't able to scan the barcode, try", /*#__PURE__*/React.createElement("br", null), "using another browser. (Recommended: Chrome)")), /*#__PURE__*/React.createElement(SelfCheckoutModal, {
37931
+ }, "Barcode not detected while scanning?", /*#__PURE__*/React.createElement("br", null), "Try using another browser. (Recommended:", ' ', /*#__PURE__*/React.createElement("a", {
37932
+ href: "https://www.google.com/chrome/"
37933
+ }, "Google Chrome"), ")")), /*#__PURE__*/React.createElement(SelfCheckoutModal, {
37926
37934
  modalOpened: showModal,
37927
37935
  toggleModal: this.toggleModal,
37928
37936
  onBarcodeDetected: this.onBarcodeDetected