Skip to content

Commit

Permalink
UICHKIN-439: Implement feature toggle for switch between circulation/…
Browse files Browse the repository at this point in the history
…check-in-by-barcode and circulation-bff/loans/check-in-by-barcode
  • Loading branch information
Dmitriy-Litvinenko committed Jan 17, 2025
1 parent f4b9bb5 commit 442ea52
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change history for ui-checkin

## 10.1.0 IN PROGRESS

* Implement feature toggle for switch between `circulation/check-in-by-barcode` and `circulation-bff/loans/check-in-by-barcode`. Refs UICHKIN-439.

## [10.0.0] (https://github.com/folio-org/ui-checkin/tree/v10.0.0) (2025-01-16)
[Full Changelog](https://github.com/folio-org/ui-checkin/compare/v9.2.1...v10.0.0)

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/checkin",
"version": "10.0.0",
"version": "10.1.0",
"description": "Item Check-in",
"repository": "folio-org/ui-checkin",
"publishConfig": {
Expand Down Expand Up @@ -28,7 +28,9 @@
"inventory": "10.0 11.0 12.0 13.0 14.0",
"loan-policy-storage": "1.0 2.0",
"users": "15.0 16.0",
"feesfines": "17.0 18.0 19.0",
"feesfines": "17.0 18.0 19.0"
},
"optionalOkapiInterfaces": {
"circulation-bff-loans": "1.0"
},
"permissionSets": [
Expand All @@ -50,6 +52,7 @@
"accounts.collection.get",
"accounts.item.get",
"lost-item-fees-policies.collection.get",
"circulation.check-in-by-barcode.post",
"circulation-bff.loans.check-in-by-barcode.execute",
"circulation.requests.collection.get",
"feefineactions.collection.get",
Expand Down
19 changes: 17 additions & 2 deletions src/Scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class Scan extends React.Component {
checkIn: PropTypes.shape({
POST: PropTypes.func,
}),
checkInBFF: PropTypes.shape({
POST: PropTypes.func,
}),
requests: PropTypes.shape({
GET: PropTypes.func,
reset: PropTypes.func,
Expand Down Expand Up @@ -172,6 +175,12 @@ class Scan extends React.Component {
path: `service-points?limit=${MAX_RECORDS}`,
},
checkIn: {
type: 'okapi',
path: 'circulation/check-in-by-barcode',
fetch: false,
throwErrors: false,
},
checkInBFF: {
type: 'okapi',
path: 'circulation-bff/loans/check-in-by-barcode',
fetch: false,
Expand Down Expand Up @@ -363,13 +372,17 @@ class Scan extends React.Component {
},
} = data;
const {
mutator: { checkIn },
mutator: {
checkIn,
checkInBFF,
},
intl: { timeZone },
okapi,
} = this.props;
const {
itemClaimedReturnedResolution,
} = this.state;
const isEnabledEcsRequests = this.props.stripes?.config?.enableEcsRequests;

const servicePointId = get(okapi, 'currentUser.curServicePoint.id', '');

Expand All @@ -392,7 +405,9 @@ class Scan extends React.Component {

this.setState({ loading: true });

return checkIn.POST(requestData)
const checkInApiCall = isEnabledEcsRequests ? checkInBFF.POST(requestData) : checkIn.POST(requestData);

return checkInApiCall
.then(checkinResp => this.processResponse(checkinResp))
.then(checkinResp => this.processClaimReturned(checkinResp))
.then(checkinResp => this.fetchRequests(checkinResp))
Expand Down

0 comments on commit 442ea52

Please sign in to comment.