Skip to content

Commit

Permalink
merge master into UIU-3047-2
Browse files Browse the repository at this point in the history
  • Loading branch information
manvendra-s-rathore committed May 20, 2024
2 parents 28e15aa + 774da6c commit be74a62
Show file tree
Hide file tree
Showing 120 changed files with 3,901 additions and 3,343 deletions.
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Change history for ui-users

## [10.1.0] IN PROGRESS
## [11.0.0] IN PROGRESS

* UX consistency: Use Save & close button label stripes-component translation key. Refs UIU-3078.
* Fix two "triangle down" icons in select element of "Copy existing fee/fine owner table entries" modal. Refs UIU-2929.
* Fix incorrect translation key having count-disagreements in Pay fees/fines modal in Fees/Fines Page. Refs UIU-1097.
* Reading Room Access accordion in User record - Basic Layout. Refs UIU-3096.
* Trim input values and delete properties with empty string when user record save. Refs UIU-2049.
* Update username field validation to trim leading and trailing spaces. Refs UIU-3099.
* Fix "Total paid amount" value that set as "$NaN" on "Refund fee/fine" modal. Refs UIU-3094.
* Validate image url provided as external url for user profile picture. Refs UIU-3080.
* Import and use ProfilePicture Component from stripes/smart-components. Refs UIU-3104.
* Rename isDCBItem function name to isDcbItem. Refs UIU-3020.
* *BREAKING* Add new okapi interface reading-room-patron-permission. Create new permission 'Users: Can view reading room access'. Refs UIU-3116.
* Create new permission 'Users: Can view, and edit reading room access'. Refs UIU-3117.
* Include DCB in 'User Type' search filter group. Refs UIU-3016.
* Displaying Default Reading Room Access in User Records. Refs UIU-3114.

## [10.1.1](https://github.com/folio-org/ui-users/tree/v10.1.1) (2024-05-07)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v10.1.0...v10.1.1)

* Allow override for reminder fees with renewal blocked. Refs UICIRC-1077.

## [10.1.0](https://github.com/folio-org/ui-users/tree/v10.1.0) (2024-03-20)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v10.0.4...v10.1.0)

* Also support `feesfines` interface version `19.0`. Refs UIU-2960.
* Disable validation for shadow user. Refs UIU-3000.
Expand All @@ -20,6 +43,7 @@
* Update sub permissions of permission 'Users: Can view user profiles'. Refs UIU-3038.
* Create new permission 'Users: Can view, edit, and delete profile pictures'. Refs UIU-3025.
* UserInformation in UserDetails to display profile picture. Refs UIU-3011.
* User Record View to display thumbnail image in the absence of profile picture. Refs UIU-3024.
* Enable effective call number column sorting in Open Loans screen. Refs UIU-3002.
* User Information in User Edit to display profile picture and update button set. Refs UIU-3005.
* Update request header for pay several Fees/fines. Refs UIU-3040.
Expand All @@ -37,6 +61,8 @@
* Reset rotation when profile picture upload is canceled. Refs UIU-3071.
* Restrict profile picture upload exceeding max file size from profile picture configuration. Refs UIU-3047.
* Profile Pictures - basic error handling. Refs UIU-3070.
* Add optional chaining in `AddServicePointModal` in order to safely access `assignedServicePoints` from props. Refs UIU-3069.
* Fix lint issues. Refs UIU-3072.

## [10.0.4](https://github.com/folio-org/ui-users/tree/v10.0.4) (2023-11-10)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v10.0.3...v10.0.4)
Expand Down
31 changes: 24 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/users",
"version": "10.1.0",
"version": "11.0.0",
"description": "User management",
"repository": "folio-org/ui-users",
"publishConfig": {
Expand Down Expand Up @@ -30,12 +30,13 @@
],
"okapiInterfaces": {
"add-info": "0.1",
"users": "16.0",
"users": "16.0 16.1",
"configuration": "2.0",
"permissions": "5.6",
"login": "7.3",
"users-bl": "6.1",
"tags": "1.0"
"tags": "1.0",
"reading-room-patron-permission": "1.0"
},
"optionalOkapiInterfaces": {
"actual-cost-record-storage": "0.4",
Expand Down Expand Up @@ -1057,6 +1058,25 @@
"batch-print.entries.item.delete"
],
"visible": true
},
{
"permissionName": "ui-users.view-reading-room-access",
"displayName": "Users: Can view reading room access",
"subPermissions": [
"ui-users.view",
"reading-room.patron-permission.item.get"
],
"visible": true
},
{
"permissionName": "ui-users.edit-reading-room-access",
"displayName": "Users: Can view, and edit reading room access",
"subPermissions": [
"ui-users.edit",
"ui-users.view-reading-room-access",
"reading-room.patron-permission.item.put"
],
"visible": true
}
]
},
Expand All @@ -1070,6 +1090,7 @@
"formatjs-compile": "formatjs compile-folder --ast --format simple ./translations/ui-users ./translations/ui-users/compiled"
},
"devDependencies": {
"@aashutoshrathi/word-wrap": "^1.2.6",
"@babel/core": "^7.21.4",
"@babel/eslint-parser": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.13.0",
Expand Down Expand Up @@ -1113,7 +1134,6 @@
"react-final-form": "^6.3.0",
"react-final-form-arrays": "^3.1.0",
"react-final-form-listeners": "^1.0.3",
"react-image": "^4.1.0",
"react-router-prop-types": "^1.0.4",
"uuid": "^9.0.0"
},
Expand All @@ -1130,8 +1150,5 @@
},
"optionalDependencies": {
"@folio/plugin-find-user": "^7.0.0"
},
"resolutions": {
"word-wrap": "npm:@aashutoshrathi/word-wrap@^1.2.6"
}
}
5 changes: 3 additions & 2 deletions src/components/Accounts/Actions/ActionModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from '../../../constants';

import css from './PayWaive.css';
import { localizeCurrencyAmount } from '../../util/localizeCurrencyAmount';
import { localizeCurrencyAmount } from '../../util';

class ActionModal extends React.Component {
static propTypes = {
Expand All @@ -54,6 +54,7 @@ class ActionModal extends React.Component {
checkAmount: PropTypes.string,
okapi: PropTypes.object,
initialValues: PropTypes.object,
stripes: PropTypes.object,
};

static defaultProps = {
Expand Down Expand Up @@ -379,7 +380,7 @@ class ActionModal extends React.Component {
:
</Col>
<Col xs={4}>
{localizeCurrencyAmount(totalPaidAmount, stripes.currency, intl)}
{totalPaidAmount}
</Col>
</Row>
) : (
Expand Down
3 changes: 2 additions & 1 deletion src/components/Accounts/Actions/CancellationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import {
Col,
} from '@folio/stripes/components';

import { localizeCurrencyAmount } from '../../util';

import css from './modal.css';
import { localizeCurrencyAmount } from '../../util/localizeCurrencyAmount';

class CancellationModal extends React.Component {
static propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Accounts/Actions/FeeFineActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import {
formatCurrencyAmount,
getFullName,
isRefundAllowed,
localizeCurrencyAmount,
} from '../../util';
import {
calculateSelectedAmount,
loadServicePoints,
} from '../accountFunctions';
import { localizeCurrencyAmount } from '../../util/localizeCurrencyAmount';

class Actions extends React.Component {
static manifest = Object.freeze({
Expand Down
15 changes: 7 additions & 8 deletions src/components/Accounts/Actions/WarningModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
injectIntl,
} from 'react-intl';

import { stripesConnect } from '@folio/stripes/core';
import { stripesConnect, stripesShape } from '@folio/stripes/core';
import {
Button,
Col,
Expand All @@ -23,10 +23,10 @@ import {
import {
calculateSortParams,
isRefundAllowed,
localizeCurrencyAmount,
} from '../../util';

import css from './modal.css';
import { localizeCurrencyAmount } from '../../util/localizeCurrencyAmount';

class WarningModal extends React.Component {
static propTypes = {
Expand All @@ -37,6 +37,7 @@ class WarningModal extends React.Component {
label: PropTypes.string,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
stripes: stripesShape.isRequired,
};

constructor(props) {
Expand Down Expand Up @@ -171,7 +172,6 @@ class WarningModal extends React.Component {

let action;
let invalidItemsAmount = accounts.filter(a => a.status && a.status.name === 'Closed').length;
let reason = <FormattedMessage id="ui-users.accounts.actions.warning.closedItems" />;
const notAllowedToRefundItemsAmount = accounts.filter(a => !isRefundAllowed(a, feeFineActions)).length;
const selectedItemsAmount = accounts.length;

Expand All @@ -188,18 +188,17 @@ class WarningModal extends React.Component {
default:
action = <FormattedMessage id="ui-users.accounts.actions.warning.refundAction" />;
invalidItemsAmount = notAllowedToRefundItemsAmount;
reason = <FormattedMessage id="ui-users.accounts.actions.warning.unpaidItems" />;
break;
}

return (
<FormattedMessage
id="ui-users.accounts.actions.warning.summary"
id={action.props.id === 'ui-users.accounts.actions.warning.refundAction'
? 'ui-users.accounts.warning.unpaidItemSelected' : 'ui-users.accounts.warning.itemSelected'}
values={{
selectedItemsAmount,
invalidItemsAmount,
total: selectedItemsAmount,
items: invalidItemsAmount,
action,
reason,
}}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Accounts/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from '../util';

import { refundClaimReturned } from '../../constants';
import { useLocalizedCurrency } from '../../hooks';

import css from './Menu.css';
import { useLocalizeCurrency } from '../../hooks/useLocalizedCurrency/useLocalizeCurrency';

const Menu = (props) => {
const {
Expand All @@ -27,7 +27,7 @@ const Menu = (props) => {
accounts
} = props;

const { localizeCurrency } = useLocalizeCurrency();
const { localizeCurrency } = useLocalizedCurrency();

let balanceOutstanding = 0;
let balanceSuspended = 0;
Expand Down
9 changes: 4 additions & 5 deletions src/components/Accounts/ViewFeesFines/ViewFeesFines.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ import {
FormattedDate,
FormattedTime,
} from '@folio/stripes/components';
import { stripesConnect } from '@folio/stripes/core';
import { stripesConnect, stripesShape } from '@folio/stripes/core';

import { itemStatuses } from '../../../constants';
import {
calculateSortParams,
nav,
isRefundAllowed,
localizeCurrencyAmount,
} from '../../util';
import {
isCancelAllowed,
} from '../accountFunctions';

import css from './ViewFeesFines.css';
import { localizeCurrencyAmount } from '../../util/localizeCurrencyAmount';

class ViewFeesFines extends React.Component {
static propTypes = {
Expand All @@ -45,9 +46,7 @@ class ViewFeesFines extends React.Component {
update: PropTypes.func.isRequired,
}),
}).isRequired,
stripes: PropTypes.shape({
hasPerm: PropTypes.func,
}),
stripes: stripesShape.isRequired,
onChangeActions: PropTypes.func.isRequired,
onChangeSelected: PropTypes.func.isRequired,
accounts: PropTypes.arrayOf(PropTypes.object),
Expand Down
4 changes: 2 additions & 2 deletions src/components/AddServicePointModal/AddServicePointModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AddServicePointModal extends React.Component {
}

static getDerivedStateFromProps(props, state) {
const assignedServicePointIds = props.assignedServicePoints.map(({ id }) => id);
const assignedServicePointIds = props.assignedServicePoints?.map(({ id }) => id);
const selectionIds = Object.keys(state.selection).filter(id => state.selection[id]);

if (!isEqual(assignedServicePointIds, selectionIds)) {
Expand Down Expand Up @@ -92,7 +92,7 @@ class AddServicePointModal extends React.Component {
id="save-service-point-btn"
onClick={this.onSaveAndClose}
>
<FormattedMessage id="ui-users.saveAndClose" />
<FormattedMessage id="stripes-components.saveAndClose" />
</Button>
<Button
onClick={this.onCancel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('AddServicePointModal Component', () => {
expect(screen.getByText('Circ Desk 1')).toBeInTheDocument();
});
it('Checking Save and Cancel Operation', async () => {
await userEvent.click(screen.getByText('ui-users.saveAndClose'));
await userEvent.click(screen.getByText(/saveAndClose/i));
expect(onSaveMock).toHaveBeenCalled();
await userEvent.click(screen.getByText('stripes-core.button.cancel'));
expect(onCancelMock).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('AffiliationsManager', () => {
});

it('should handle affiliations assignment when \'Save & close\' button was clicked', async () => {
await userEvent.click(await screen.findByText('ui-users.saveAndClose'));
await userEvent.click(await screen.findByText(/saveAndClose/));

expect(defaultProps.onUpdateAffiliations).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const AffiliationsManagerModalFooter = ({
buttonStyle="primary"
onClick={onSubmit}
>
<FormattedMessage id="ui-users.saveAndClose" />
<FormattedMessage id="stripes-components.saveAndClose" />
</Button>
</Layout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Edit Service Points Component', () => {
it('Add service points functionality ', async () => {
await userEvent.click(document.querySelector('[id=add-service-point-btn]'));
await userEvent.click(document.querySelector('[data-test-sp-modal-checkbox="7c5abc9f-f3d7-4856-b8d7-6712462ca007"]'));
await userEvent.click(screen.getByText('ui-users.saveAndClose'));
await userEvent.click(screen.getByText(/saveAndClose/));
expect(onChangeMock).toHaveBeenCalled();
});
it('Remove service points functionality ', async () => {
Expand Down
3 changes: 0 additions & 3 deletions src/components/EditSections/EditUserInfo/EditUserInfo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import EditUserInfo from './EditUserInfo';
import { isConsortiumEnabled } from '../../util';
import { USER_TYPES } from '../../../constants';

jest.mock('../../../hooks', () => ({
useProfilePicture: jest.fn(),
}));
jest.mock('@folio/stripes/components', () => ({
...jest.requireActual('@folio/stripes/components'),
Modal: jest.fn(({ children, label, footer, ...rest }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
Label,
} from '@folio/stripes/components';
import { useStripes, useCallout } from '@folio/stripes/core';
import { ProfilePicture } from '@folio/stripes/smart-components';

import { isAValidURL } from '../../../../util/util';
import ExternalLinkModal from '../ExternalLinkModal';
import DeleteProfilePictureModal from '../DeleteProfilePictureModal';
import ProfilePicture from '../../../../ProfilePicture';
import LocalFileModal from '../LocalFileModal';
import { getRotatedImage, createImage } from './utils/canvasUtils';
import {
Expand Down Expand Up @@ -283,7 +283,6 @@ const EditUserProfilePicture = ({ profilePictureId, form, personal, profilePictu
profilePictureLink={profilePictureLink}
croppedLocalImage={croppedLocalImage}
/>
<br />
<input type="file" data-testid="hidden-file-input" hidden ref={fileInputRef} onClick={onFileSelect} onChange={onFileChange} accept={ACCEPTED_IMAGE_TYPES} />
{
hasAllProfilePicturePerms && (
Expand Down
Loading

0 comments on commit be74a62

Please sign in to comment.