diff --git a/assets/icons/ui/file-duotone.svg b/assets/icons/ui/file-duotone.svg index c9c3ad435e..42e8f66aa0 100644 --- a/assets/icons/ui/file-duotone.svg +++ b/assets/icons/ui/file-duotone.svg @@ -1,10 +1 @@ - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/package.json b/package.json index 6650b30245..5b7e02fb23 100644 --- a/package.json +++ b/package.json @@ -91,14 +91,14 @@ "babel-preset-cozy-app": "2.0.2", "browserslist-config-cozy": "0.4.0", "copyfiles": "2.4.1", - "cozy-client": "^46.10.0", + "cozy-client": "^47.6.0", "cozy-device-helper": "2.0.0", "cozy-flags": "^2.10.1", "cozy-harvest-lib": "^6.7.3", "cozy-intent": "1.16.1", "cozy-logger": "^1.9.0", "cozy-sharing": "^3.10.0", - "cozy-stack-client": "^45.0.1", + "cozy-stack-client": "^47.4.0", "css-loader": "0.28.11", "cssnano": "4.1.11", "cssnano-preset-advanced": "4.0.8", @@ -181,7 +181,7 @@ "rooks": "^5.11.2" }, "peerDependencies": { - "cozy-client": ">=45.15.0", + "cozy-client": ">=47.6.0", "cozy-device-helper": "^2.0.0", "cozy-harvest-lib": "^6.7.3", "cozy-intent": ">=1.3.0", diff --git a/react/Icons/FileDuotone.jsx b/react/Icons/FileDuotone.jsx index 74e8bd0089..de64d12207 100644 --- a/react/Icons/FileDuotone.jsx +++ b/react/Icons/FileDuotone.jsx @@ -1,18 +1,10 @@ -// Automatically created, please run `scripts/generate-svg-icon.sh assets/icons/ui/file-duotone.svg` to regenerate; +// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/file-duotone.svg` to regenerate; import React from 'react' function SvgFileDuotone(props) { return ( - - { editPath ) const isAppLinkLoaded = fetchStatus === 'loaded' + const isEditable = Boolean(editPath) && isEditableAttribute(name, file) const handleCopy = async () => { try { @@ -70,7 +71,7 @@ const ActionMenuWrapper = forwardRef(({ onClose, file, optionFile }, ref) => { return ( { { @@ -48,8 +50,20 @@ const Qualification = ({ file }) => { } const formattedMetadataQualification = useMemo(() => { + const relatedBills = file.bills?.data?.[0] + + if (relatedBills) { + const formattedBillsMetadata = KNOWN_BILLS_ATTRIBUTES_NAMES.map( + attrName => ({ name: attrName, value: relatedBills[attrName] }) + ) + + return formatMetadataQualification(metadata).concat( + formattedBillsMetadata + ) + } + return formatMetadataQualification(metadata) - }, [metadata]) + }, [metadata, file.bills?.data]) useEffect(() => { actionBtnRef.current = formattedMetadataQualification.map( diff --git a/react/Viewer/Readme.md b/react/Viewer/Readme.md index 27b3c24190..646af7dd85 100644 --- a/react/Viewer/Readme.md +++ b/react/Viewer/Readme.md @@ -86,6 +86,7 @@ const files = [ type: 'file', name: 'My vehicle registration.pdf', mime: 'application/pdf', + bills: { data: [{ amount: '500' }] }, metadata: { carbonCopy: true, AObtentionDate: null, diff --git a/react/Viewer/helpers.js b/react/Viewer/helpers.js index db2ac9c30d..fa71e668c9 100644 --- a/react/Viewer/helpers.js +++ b/react/Viewer/helpers.js @@ -1,22 +1,24 @@ -import { models, generateWebLink } from 'cozy-client' +import { generateWebLink } from 'cozy-client' -const { +import { isEncrypted, isFromKonnector, hasQualifications, hasCertifications, normalize -} = models.file +} from 'cozy-client/dist/models/file' -const { +import { KNOWN_DATE_METADATA_NAMES, - KNOWN_INFORMATION_METADATA_NAMES -} = models.paper + KNOWN_INFORMATION_METADATA_NAMES, + KNOWN_BILLS_ATTRIBUTES_NAMES +} from 'cozy-client/dist/models/paper' export const getCurrentModel = metadataName => { if ( KNOWN_DATE_METADATA_NAMES.includes(metadataName) || - KNOWN_INFORMATION_METADATA_NAMES.includes(metadataName) + KNOWN_INFORMATION_METADATA_NAMES.includes(metadataName) || + KNOWN_BILLS_ATTRIBUTES_NAMES.includes(metadataName) ) { return 'information' } diff --git a/react/__snapshots__/examples.spec.jsx.snap b/react/__snapshots__/examples.spec.jsx.snap index fc8b3e6ad9..07afcbd601 100644 --- a/react/__snapshots__/examples.spec.jsx.snap +++ b/react/__snapshots__/examples.spec.jsx.snap @@ -2697,8 +2697,6 @@ exports[`IconStack should render examples: IconStack 1`] = ` "
- - diff --git a/yarn.lock b/yarn.lock index 825f111ca6..1e00ba2be7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6087,16 +6087,16 @@ cozy-bi-auth@0.0.23: lodash "^4.17.20" node-jose "^1.1.4" -cozy-client@^46.10.0: - version "46.10.0" - resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-46.10.0.tgz#7d3bb11b77ce79ec09df156d21cab19983b90d37" - integrity sha512-zS6COIbERCBgNnj37cYvj901D9osfEX0AbcnOyFw3tMzJV0nrOidbDU5sg9SLrsd7gIKhkR2w7nN/TN6eNOz4g== +cozy-client@^47.6.0: + version "47.6.0" + resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-47.6.0.tgz#ed151e75003aa3eeda657d398d18958aadaa6e1c" + integrity sha512-hBALCB//rdMg2bj3k8dVHRaYFG0CQ7vF9u58BufYuNoJFB4HKh9R/KFSXH0+wkvDjUOK4olYjoz+7xH6bZmEPQ== dependencies: "@cozy/minilog" "1.0.0" "@types/jest" "^26.0.20" "@types/lodash" "^4.14.170" btoa "^1.2.1" - cozy-stack-client "^46.5.0" + cozy-stack-client "^47.4.0" date-fns "2.29.3" json-stable-stringify "^1.0.1" lodash "^4.17.13" @@ -6206,19 +6206,10 @@ cozy-sharing@^3.10.0: react-tooltip "^3.11.1" snarkdown "^2.0.0" -cozy-stack-client@^45.0.1: - version "45.0.1" - resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-45.0.1.tgz#4028aad131e40b7ba58528b39e411028bfd319d0" - integrity sha512-VWBbBdGmsnzxarQhUFUbnQZn4VxgWp98umUpSF9PexNmBTwvHG7eNH64/1GaChQjc7xhe8yggzCeQ7wyjQsq0g== - dependencies: - detect-node "^2.0.4" - mime "^2.4.0" - qs "^6.7.0" - -cozy-stack-client@^46.5.0: - version "46.5.0" - resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-46.5.0.tgz#9c15410a4b98cfe556b5fac4dfc8ac0f0e2de763" - integrity sha512-OmspOAWGozpi7sZG1Mi9PAeNEUgi/JpCy4f3l6O2wnfKamW8x+iaZWRofJhS5rqPfpRW2XbMkJjq9Yz3xOgv0A== +cozy-stack-client@^47.4.0: + version "47.4.0" + resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-47.4.0.tgz#db58f19ecc1f3a4100d24648ca9f87a4a825b6fe" + integrity sha512-hwk//fVrM05GZmRodYTQel7tvpK+NZ6gDn1gkpYmjaLvG8hN24PskeWr5+a6iBNzlO1FtDh7qQ1/jU5vw7v6zg== dependencies: detect-node "^2.0.4" mime "^2.4.0"