Merge branch 'dev' into feature/ora-365-download-file

This commit is contained in:
Maxime Lalo 2023-05-09 17:04:00 +02:00
commit 1cb93a97f6
23 changed files with 649 additions and 232 deletions

292
package-lock.json generated
View File

@ -19,7 +19,7 @@
"dotenv": "^16.0.3",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.35",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.40",
"next": "13.2.4",
"prettier": "^2.8.7",
"react": "18.2.0",
@ -171,65 +171,65 @@
}
},
"node_modules/@emotion/babel-plugin": {
"version": "11.10.8",
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.10.8.tgz",
"integrity": "sha512-gxNky50AJL3AlkbjvTARiwAqei6/tNUxDZPSKd+3jqWVM3AmdVTTdpjHorR/an/M0VJqdsuq5oGcFH+rjtyujQ==",
"version": "11.11.0",
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.11.0.tgz",
"integrity": "sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==",
"dependencies": {
"@babel/helper-module-imports": "^7.16.7",
"@babel/runtime": "^7.18.3",
"@emotion/hash": "^0.9.0",
"@emotion/memoize": "^0.8.0",
"@emotion/serialize": "^1.1.1",
"@emotion/hash": "^0.9.1",
"@emotion/memoize": "^0.8.1",
"@emotion/serialize": "^1.1.2",
"babel-plugin-macros": "^3.1.0",
"convert-source-map": "^1.5.0",
"escape-string-regexp": "^4.0.0",
"find-root": "^1.1.0",
"source-map": "^0.5.7",
"stylis": "4.1.4"
"stylis": "4.2.0"
}
},
"node_modules/@emotion/cache": {
"version": "11.10.8",
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.10.8.tgz",
"integrity": "sha512-5fyqGHi51LU95o7qQ/vD1jyvC4uCY5GcBT+UgP4LHdpO9jPDlXqhrRr9/wCKmfoAvh5G/F7aOh4MwQa+8uEqhA==",
"version": "11.11.0",
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.11.0.tgz",
"integrity": "sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==",
"dependencies": {
"@emotion/memoize": "^0.8.0",
"@emotion/sheet": "^1.2.1",
"@emotion/utils": "^1.2.0",
"@emotion/weak-memoize": "^0.3.0",
"stylis": "4.1.4"
"@emotion/memoize": "^0.8.1",
"@emotion/sheet": "^1.2.2",
"@emotion/utils": "^1.2.1",
"@emotion/weak-memoize": "^0.3.1",
"stylis": "4.2.0"
}
},
"node_modules/@emotion/hash": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.0.tgz",
"integrity": "sha512-14FtKiHhy2QoPIzdTcvh//8OyBlknNs2nXRwIhG904opCby3l+9Xaf/wuPvICBF0rc1ZCNBd3nKe9cd2mecVkQ=="
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz",
"integrity": "sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ=="
},
"node_modules/@emotion/is-prop-valid": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.0.tgz",
"integrity": "sha512-3aDpDprjM0AwaxGE09bOPkNxHpBd+kA6jty3RnaEXdweX1DF1U3VQpPYb0g1IStAuK7SVQ1cy+bNBBKp4W3Fjg==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.1.tgz",
"integrity": "sha512-61Mf7Ufx4aDxx1xlDeOm8aFFigGHE4z+0sKCa+IHCeZKiyP9RLD0Mmx7m8b9/Cf37f7NAvQOOJAbQQGVr5uERw==",
"dependencies": {
"@emotion/memoize": "^0.8.0"
"@emotion/memoize": "^0.8.1"
}
},
"node_modules/@emotion/memoize": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.0.tgz",
"integrity": "sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA=="
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz",
"integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA=="
},
"node_modules/@emotion/react": {
"version": "11.10.8",
"resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.8.tgz",
"integrity": "sha512-ZfGfiABtJ1P1OXqOBsW08EgCDp5fK6C5I8hUJauc/VcJBGSzqAirMnFslhFWnZJ/w5HxPI36XbvMV0l4KZHl+w==",
"version": "11.11.0",
"resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.11.0.tgz",
"integrity": "sha512-ZSK3ZJsNkwfjT3JpDAWJZlrGD81Z3ytNDsxw1LKq1o+xkmO5pnWfr6gmCC8gHEFf3nSSX/09YrG67jybNPxSUw==",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.10.8",
"@emotion/cache": "^11.10.8",
"@emotion/serialize": "^1.1.1",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.0",
"@emotion/utils": "^1.2.0",
"@emotion/weak-memoize": "^0.3.0",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/cache": "^11.11.0",
"@emotion/serialize": "^1.1.2",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
"@emotion/utils": "^1.2.1",
"@emotion/weak-memoize": "^0.3.1",
"hoist-non-react-statics": "^3.3.1"
},
"peerDependencies": {
@ -242,33 +242,33 @@
}
},
"node_modules/@emotion/serialize": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.1.tgz",
"integrity": "sha512-Zl/0LFggN7+L1liljxXdsVSVlg6E/Z/olVWpfxUTxOAmi8NU7YoeWeLfi1RmnB2TATHoaWwIBRoL+FvAJiTUQA==",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.2.tgz",
"integrity": "sha512-zR6a/fkFP4EAcCMQtLOhIgpprZOwNmCldtpaISpvz348+DP4Mz8ZoKaGGCQpbzepNIUWbq4w6hNZkwDyKoS+HA==",
"dependencies": {
"@emotion/hash": "^0.9.0",
"@emotion/memoize": "^0.8.0",
"@emotion/unitless": "^0.8.0",
"@emotion/utils": "^1.2.0",
"@emotion/hash": "^0.9.1",
"@emotion/memoize": "^0.8.1",
"@emotion/unitless": "^0.8.1",
"@emotion/utils": "^1.2.1",
"csstype": "^3.0.2"
}
},
"node_modules/@emotion/sheet": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.1.tgz",
"integrity": "sha512-zxRBwl93sHMsOj4zs+OslQKg/uhF38MB+OMKoCrVuS0nyTkqnau+BM3WGEoOptg9Oz45T/aIGs1qbVAsEFo3nA=="
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.2.tgz",
"integrity": "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA=="
},
"node_modules/@emotion/styled": {
"version": "11.10.8",
"resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.10.8.tgz",
"integrity": "sha512-gow0lF4Uw/QEdX2REMhI8v6wLOabPKJ+4HKNF0xdJ2DJdznN6fxaXpQOx6sNkyBhSUL558Rmcu1Lq/MYlVo4vw==",
"version": "11.11.0",
"resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.11.0.tgz",
"integrity": "sha512-hM5Nnvu9P3midq5aaXj4I+lnSfNi7Pmd4EWk1fOZ3pxookaQTNew6bp4JaCBYM4HVFZF9g7UjJmsUmC2JlxOng==",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.10.8",
"@emotion/is-prop-valid": "^1.2.0",
"@emotion/serialize": "^1.1.1",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.0",
"@emotion/utils": "^1.2.0"
"@emotion/babel-plugin": "^11.11.0",
"@emotion/is-prop-valid": "^1.2.1",
"@emotion/serialize": "^1.1.2",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
"@emotion/utils": "^1.2.1"
},
"peerDependencies": {
"@emotion/react": "^11.0.0-rc.0",
@ -281,27 +281,27 @@
}
},
"node_modules/@emotion/unitless": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.0.tgz",
"integrity": "sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw=="
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz",
"integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ=="
},
"node_modules/@emotion/use-insertion-effect-with-fallbacks": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.0.tgz",
"integrity": "sha512-1eEgUGmkaljiBnRMTdksDV1W4kUnmwgp7X9G8B++9GYwl1lUdqSndSriIrTJ0N7LQaoauY9JJ2yhiOYK5+NI4A==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.1.tgz",
"integrity": "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==",
"peerDependencies": {
"react": ">=16.8.0"
}
},
"node_modules/@emotion/utils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.0.tgz",
"integrity": "sha512-sn3WH53Kzpw8oQ5mgMmIzzyAaH2ZqFEbozVVBSYp538E06OSE6ytOp7pRAjNQR+Q/orwqdQYJSe2m3hCOeznkw=="
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.1.tgz",
"integrity": "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg=="
},
"node_modules/@emotion/weak-memoize": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.0.tgz",
"integrity": "sha512-AHPmaAx+RYfZz0eYu6Gviiagpmiyw98ySSlQvCUhVGDRtDFe4DBS0x1bSjdF3gqUDYOczB+yYvBTtEylYSdRhg=="
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz",
"integrity": "sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww=="
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
@ -326,13 +326,13 @@
}
},
"node_modules/@eslint/eslintrc": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz",
"integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz",
"integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==",
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.5.1",
"espree": "^9.5.2",
"globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
@ -942,9 +942,9 @@
}
},
"node_modules/@types/react-is/node_modules/@types/react": {
"version": "17.0.58",
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.58.tgz",
"integrity": "sha512-c1GzVY97P0fGxwGxhYq989j4XwlcHQoto6wQISOC2v6wm3h0PORRWJFHlkRjfGsiG3y1609WdQ+J+tKxvrEd6A==",
"version": "17.0.59",
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.59.tgz",
"integrity": "sha512-gSON5zWYIGyoBcycCE75E9+r6dCC2dHdsrVkOEiIYNU5+Q28HcBAuqvDuxHcCbMfHBHdeT5Tva/AFn3rnMKE4g==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@ -952,9 +952,9 @@
}
},
"node_modules/@types/react-transition-group": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.5.tgz",
"integrity": "sha512-juKD/eiSM3/xZYzjuzH6ZwpP+/lejltmiS3QEzV/vmb/Q8+HfDmxu+Baga8UEMGBqV88Nbg4l2hY/K2DkyaLLA==",
"version": "4.4.6",
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.6.tgz",
"integrity": "sha512-VnCdSxfcm08KjsJVQcfBmhEQAPnLB8G08hAxn39azX1qYBQ/5RVQuoHuKIcfKOdncuaUvEpFKFzEvbtIMsfVew==",
"dependencies": {
"@types/react": "*"
}
@ -965,18 +965,18 @@
"integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ=="
},
"node_modules/@types/validator": {
"version": "13.7.15",
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.15.tgz",
"integrity": "sha512-yeinDVQunb03AEP8luErFcyf/7Lf7AzKCD0NXfgVoGCCQDNpZET8Jgq74oBgqKld3hafLbfzt/3inUdQvaFeXQ=="
"version": "13.7.16",
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.16.tgz",
"integrity": "sha512-VyKmLktUHYLbrSbsRi241MSUlGYomQgK/tfCNpej3Gt5qDOM10AZ3nU2aR2s5JritClXuOBu4K7MkywVW/Y6Ow=="
},
"node_modules/@typescript-eslint/parser": {
"version": "5.59.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.2.tgz",
"integrity": "sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ==",
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.5.tgz",
"integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==",
"dependencies": {
"@typescript-eslint/scope-manager": "5.59.2",
"@typescript-eslint/types": "5.59.2",
"@typescript-eslint/typescript-estree": "5.59.2",
"@typescript-eslint/scope-manager": "5.59.5",
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/typescript-estree": "5.59.5",
"debug": "^4.3.4"
},
"engines": {
@ -996,12 +996,12 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.59.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.2.tgz",
"integrity": "sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA==",
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz",
"integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==",
"dependencies": {
"@typescript-eslint/types": "5.59.2",
"@typescript-eslint/visitor-keys": "5.59.2"
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/visitor-keys": "5.59.5"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -1012,9 +1012,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.59.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.2.tgz",
"integrity": "sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w==",
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.5.tgz",
"integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@ -1024,12 +1024,12 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.59.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.2.tgz",
"integrity": "sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==",
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz",
"integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==",
"dependencies": {
"@typescript-eslint/types": "5.59.2",
"@typescript-eslint/visitor-keys": "5.59.2",
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/visitor-keys": "5.59.5",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@ -1050,11 +1050,11 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.59.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.2.tgz",
"integrity": "sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig==",
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz",
"integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==",
"dependencies": {
"@typescript-eslint/types": "5.59.2",
"@typescript-eslint/types": "5.59.5",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@ -1235,6 +1235,11 @@
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
"integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag=="
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/available-typed-arrays": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
@ -1363,9 +1368,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001482",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz",
"integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==",
"version": "1.0.30001486",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz",
"integrity": "sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==",
"funding": [
{
"type": "opencollective",
@ -1482,6 +1487,17 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -1637,6 +1653,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@ -2174,9 +2198,9 @@
}
},
"node_modules/eslint-visitor-keys": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz",
"integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@ -2185,13 +2209,13 @@
}
},
"node_modules/espree": {
"version": "9.5.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz",
"integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==",
"version": "9.5.2",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz",
"integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==",
"dependencies": {
"acorn": "^8.8.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^3.4.0"
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -2376,6 +2400,19 @@
"is-callable": "^1.1.3"
}
},
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -3166,7 +3203,7 @@
}
},
"node_modules/le-coffre-resources": {
"resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#5052051e1d3f56b8f895f7132090c77ff7bdd6bc",
"resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#b3d3495c0e65afc0b149d6c07fd5741e144e2aaa",
"license": "MIT",
"dependencies": {
"class-transformer": "^0.5.1",
@ -3186,9 +3223,9 @@
}
},
"node_modules/libphonenumber-js": {
"version": "1.10.28",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.28.tgz",
"integrity": "sha512-1eAgjLrZA0+2Wgw4hs+4Q/kEBycxQo8ZLYnmOvZ3AlM8ImAVAJgDPlZtISLEzD1vunc2q8s2Pn7XwB7I8U3Kzw=="
"version": "1.10.30",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.30.tgz",
"integrity": "sha512-PLGc+xfrQrkya/YK2/5X+bPpxRmyJBHM+xxz9krUdSgk4Vs2ZwxX5/Ow0lv3r9PDlDtNWb4u+it8MY5rZ0IyGw=="
},
"node_modules/lines-and-columns": {
"version": "1.2.4",
@ -3266,6 +3303,25 @@
"node": ">=8.6"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mimic-fn": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
@ -4287,9 +4343,9 @@
}
},
"node_modules/stylis": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.4.tgz",
"integrity": "sha512-USf5pszRYwuE6hg9by0OkKChkQYEXfkeTtm0xKw+jqQhwyjCVLdYyMBK7R+n7dhzsblAWJnGxju4vxq5eH20GQ=="
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz",
"integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw=="
},
"node_modules/supports-color": {
"version": "7.2.0",

View File

@ -21,7 +21,8 @@
"dotenv": "^16.0.3",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.38",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.40",
"form-data": "^4.0.0",
"next": "13.2.4",
"prettier": "^2.8.7",
"react": "18.2.0",

View File

@ -31,6 +31,7 @@ export default abstract class BaseApiService {
}
protected buildBody(body: { [key: string]: unknown }): string {
console.log("2 >> body >>>", JSON.stringify(body));
return JSON.stringify(body);
}
@ -54,6 +55,17 @@ export default abstract class BaseApiService {
);
}
protected async postRequestFormData<T>(url: URL, body: FormData) {
return this.sendRequest<T>(
async () =>
await fetch(url, {
method: "POST",
headers: this.buildHeaders(ContentType.FORM_DATA),
body,
}),
);
}
protected async putRequest<T>(url: URL, body: { [key: string]: unknown } = {}) {
const request = async () =>
await fetch(url, {

View File

@ -16,6 +16,7 @@ export type IPutDeedsParams = {
description?: OfficeFolder["description"];
archived_description?: OfficeFolder["archived_description"];
status?: OfficeFolder["status"];
deed_has_document_types?: Deed["deed_has_document_types"];
};
@Service()

View File

@ -0,0 +1,88 @@
import { DocumentType } from "le-coffre-resources/dist/SuperAdmin";
import { Service } from "typedi";
import BaseSuperAdmin from "../BaseSuperAdmin";
// TODO Type get query params -> Where + inclue + orderby
export interface IGetDocumentTypesparams {
where?: {};
include?: {};
}
// TODO Type getbyuid query params
export type IPutDocumentTypesParams = {
};
export interface IPostDocumentTypesParams {
name: string;
public_description: string;
private_description: string;
office: {
uid: string;
};
}
@Service()
export default class DocumentTypes extends BaseSuperAdmin {
private static instance: DocumentTypes;
private readonly baseURl = this.namespaceUrl.concat("/document-types");
private constructor() {
super();
}
public static getInstance() {
if (!this.instance) {
return new this();
} else {
return this.instance;
}
}
public async get(q: IGetDocumentTypesparams): Promise<DocumentType[]> {
const url = new URL(this.baseURl);
Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
try {
return await this.getRequest<DocumentType[]>(url);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
}
/**
* @description : Create a Document
*/
public async post(body: IPostDocumentTypesParams): Promise<DocumentType> {
const url = new URL(this.baseURl);
try {
return await this.postRequest<DocumentType>(url, body as any);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
}
public async getByUid(uid: string, q?: any): Promise<DocumentType> {
const url = new URL(this.baseURl.concat(`/${uid}`));
const query = { q };
if (q) Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
try {
return await this.getRequest<DocumentType>(url);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
}
public async put(uid: string, body: IPutDocumentTypesParams): Promise<DocumentType> {
const url = new URL(this.baseURl.concat(`/${uid}`));
try {
return await this.putRequest<DocumentType>(url, body);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
}
}

View File

@ -13,7 +13,8 @@ export interface IGetDocumentsparams {
// TODO Type getbyuid query params
export type IPutDocumentsParams = {
document_status?: EDocumentStatus
document_status?: EDocumentStatus;
refused_reason?: string;
};
export interface IPostDocumentsParams {}
@ -37,7 +38,8 @@ export default class Documents extends BaseSuperAdmin {
public async get(q: IGetDocumentsparams): Promise<Document[]> {
const url = new URL(this.baseURl);
Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
const query = { q };
if (q) Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
try {
return await this.getRequest<Document[]>(url);
} catch (err) {
@ -80,4 +82,14 @@ export default class Documents extends BaseSuperAdmin {
return Promise.reject(err);
}
}
public async delete(uid: string): Promise<Document> {
const url = new URL(this.baseURl.concat(`/${uid}`));
try {
return await this.deleteRequest<Document>(url);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
}
}

View File

@ -35,13 +35,14 @@ export default class Files extends BaseSuperAdmin {
public async get(q: IGetFilesparams): Promise<File[]> {
const url = new URL(this.baseURl);
Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
const query = { q };
if (q) Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
try {
const files = await this.getRequest<File[]>(url);
files.forEach(async(file) => {
files.forEach(async (file) => {
file.file_path = await this.cryptoService.decrypt(file.file_path!, file.iv);
})
return files
});
return files;
} catch (err) {
this.onError(err);
return Promise.reject(err);
@ -54,7 +55,7 @@ export default class Files extends BaseSuperAdmin {
public async post(body: any): Promise<File> {
const url = new URL(this.baseURl);
try {
return await this.postRequest<File>(url, body);
return await this.postRequestFormData<File>(url, body);
} catch (err) {
this.onError(err);
return Promise.reject(err);
@ -84,4 +85,17 @@ export default class Files extends BaseSuperAdmin {
return Promise.reject(err);
}
}
/**
* @description : Delete a folder only if the folder don't contains customers
*/
public async delete(uid: string): Promise<File> {
const url = new URL(this.baseURl.concat(`/${uid}`));
try {
return await this.deleteRequest<File>(url);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
}
}

View File

@ -9,13 +9,15 @@ import Button, { EButtonVariant } from "../Button";
import Tooltip from "../ToolTip";
import Typography, { ITypo, ITypoColor } from "../Typography";
import classes from "./classes.module.scss";
import { File as FileCustomer } from "le-coffre-resources/dist/Customer";
import { Document, File as FileCustomer } from "le-coffre-resources/dist/Customer";
import Files from "@Front/Api/LeCoffreApi/SuperAdmin/Files/Files";
type IProps = {
title: string;
dateAsked: Date;
defaultFiles?: FileCustomer[];
onChange?: (files: File[]) => void;
document: Document;
};
type IFile = {
@ -26,6 +28,7 @@ type IFile = {
type IState = {
files: IFile[];
isDragOver: boolean;
currentFiles?: FileCustomer[];
};
export default class DepositDocument extends React.Component<IProps, IState> {
@ -38,6 +41,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
this.state = {
files: [],
isDragOver: false,
currentFiles: this.props.defaultFiles,
};
this.addDocument = this.addDocument.bind(this);
@ -151,7 +155,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
if (file) this.addFile(file);
}
private addFile(file: File) {
private async addFile(file: File) {
this.setState({
files: [
...this.state.files,
@ -163,17 +167,33 @@ export default class DepositDocument extends React.Component<IProps, IState> {
});
if (this.props.onChange) this.props.onChange(this.state.files.map((file) => file.file));
const formData = new FormData();
formData.append("file", file, file.name);
const query = JSON.stringify({ document: { uid: this.props.document.uid } });
formData.append("q", query);
const newFile = await Files.getInstance().post(formData);
const files = this.state.currentFiles ? [...this.state.currentFiles, newFile] : [newFile];
this.setState({
currentFiles: files,
});
}
private removeFile(e: any) {
private async removeFile(e: any) {
const image = e.target as HTMLElement;
const indexToRemove = image.getAttribute("data-file");
if (!indexToRemove) return;
// const file = this.state.files.find((file) => file.index === parseInt(indexToRemove));
this.setState({
files: this.state.files.filter((file) => file.index !== parseInt(indexToRemove)),
});
if (this.props.onChange) this.props.onChange(this.state.files.map((file) => file.file));
// TODO Finir la suppression de fichier
// const deletedFileUid = this.props.document.files?.find((file) => file.file_path === newFile.file_path)?.uid;
// console.log({ deletedFileUid });
// await Files.getInstance().delete(file?.uid);
}
private async onFileChange() {

View File

@ -1,4 +1,5 @@
import React from "react";
import Tooltip from "../ToolTip";
import Typography, { ITypo, ITypoColor } from "../Typography";
import classes from "./classes.module.scss";
@ -7,12 +8,17 @@ type IProps = {
children: React.ReactNode;
name: string;
toolTip?: string;
checked?: boolean;
defaultChecked?: boolean;
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
value: string;
disabled: boolean;
};
export default class RadioBox extends React.Component<IProps> {
static defaultProps = {
disabled: false,
};
public override render(): JSX.Element {
return (
<Typography typo={ITypo.P_ERR_18} color={ITypoColor.BLACK}>
@ -20,9 +26,11 @@ export default class RadioBox extends React.Component<IProps> {
<input
type="radio"
name={this.props.name}
checked={this.props.checked}
defaultChecked={this.props.defaultChecked}
onChange={this.props.onChange}
value={this.props.value}
disabled={this.props.disabled}
/>
{this.props.children}
{this.props.toolTip && <Tooltip className={classes["tooltip"]} text={this.props.toolTip} />}

View File

@ -67,7 +67,6 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
}
private hasPendingFiles() {
console.log(this.props.folder.documents);
const documents =
this.props.folder.documents?.filter((document) => document.depositor?.contact?.uid === this.props.customer.contact?.uid) ?? [];
const notAskedDocuments = documents.filter((document) => document.document_status === EDocumentStatus.DEPOSITED) ?? [];

View File

@ -62,6 +62,7 @@
display: inline-grid;
justify-items: start;
gap: 32px;
margin-top: 16px;
}
}
}

View File

@ -15,6 +15,7 @@ import classes from "./classes.module.scss";
import DocumentList from "./DocumentList";
import UserFolderHeader from "./UserFolderHeader";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
import Documents from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents";
type IProps = {
customer: Customer;
@ -26,6 +27,7 @@ type IProps = {
};
type IState = {
isOpenDeletionModal: boolean;
selectedDocumentToDelete: string;
};
export default class UserFolder extends React.Component<IProps, IState> {
@ -39,22 +41,25 @@ export default class UserFolder extends React.Component<IProps, IState> {
super(props);
this.state = {
isOpenDeletionModal: false,
selectedDocumentToDelete: "",
};
this.closeDeletionModal = this.closeDeletionModal.bind(this);
this.openDeletionModal = this.openDeletionModal.bind(this);
this.changeUserFolder = this.changeUserFolder.bind(this);
this.deleteAskedDocument = this.deleteAskedDocument.bind(this);
}
public override render(): JSX.Element {
const documentsAsked: Document[] | null = this.getDocumentsByStatus("ASKED");
const otherDocuments: Document[] | null = this.getValidatedAndPendindDocuments();
const redirectPath = Module.getInstance()
.get()
.modules.pages.Folder.pages.AskDocument.props.path.replace("[folderUid]", this.props.folder.uid ?? "");
.modules.pages.Folder.pages.AskDocument.props.path.replace("[folderUid]", this.props.folder.uid ?? "").replace("[customerUid]", this.props.customer.uid ?? "");
return (
<div className={classes["root"]} data-opened={this.props.isOpened.toString()}>
<Confirm
isOpen={this.state.isOpenDeletionModal}
onClose={this.closeDeletionModal}
onAccept={this.deleteAskedDocument}
closeBtn
header={"Supprimer la demande de document ?"}
cancelText={"Cancel"}
@ -122,11 +127,23 @@ export default class UserFolder extends React.Component<IProps, IState> {
this.rootRefElement.current?.style.setProperty("--animation-delay", this.props.animationDelay!.toString().concat("ms"));
}
private async deleteAskedDocument(){
try{
await Documents.getInstance().delete(this.state.selectedDocumentToDelete);
window.location.reload();
}catch(e){
console.error(e);
}
}
private calculateDocumentsPercentageProgress(): number {
if (!this.props.customer.documents) return 0;
const totalDocuments: number = this.props.customer.documents.length;
const numberDocumentsAsked: number = this.getDocumentsByStatus(EDocumentStatus.ASKED)?.length || 0;
return Math.round(((totalDocuments - numberDocumentsAsked) / totalDocuments) * 100);
const percentage = Math.round(((totalDocuments - numberDocumentsAsked) / totalDocuments) * 100);
if(!percentage) return 0;
return percentage;
}
private getDocumentsByStatus(status: string): Document[] | null {
@ -159,9 +176,11 @@ export default class UserFolder extends React.Component<IProps, IState> {
}
private openDeletionModal(uid?: string): void {
// TODO: call API to delete document
if(!uid) return;
this.setState({
isOpenDeletionModal: true,
selectedDocumentToDelete: uid,
});
}
private closeDeletionModal(): void {

View File

@ -8,10 +8,14 @@ import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate";
import React from "react";
import { documentDeposited } from "../DesignSystem/dummyData";
import classes from "./classes.module.scss";
import Documents, { IGetDocumentsparams } from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents";
import { Document } from "le-coffre-resources/dist/Customer";
import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users";
type IProps = {};
type IState = {
isAddDocumentModalVisible: boolean;
documents: Document[];
};
export default class ClientDashboard extends Base<IProps, IState> {
@ -19,6 +23,7 @@ export default class ClientDashboard extends Base<IProps, IState> {
super(props);
this.state = {
isAddDocumentModalVisible: false,
documents: [],
};
this.onCloseModalAddDocument = this.onCloseModalAddDocument.bind(this);
this.onOpenModalAddDocument = this.onOpenModalAddDocument.bind(this);
@ -31,16 +36,15 @@ export default class ClientDashboard extends Base<IProps, IState> {
{this.renderHeader()}
<div className={classes["sub-container"]}>
<div className={classes["content"]}>
{this.state.documents?.map((document) => (
<DepositDocument
title={"Carte d'identité - recto-verso"}
dateAsked={new Date()}
defaultFiles={documentDeposited.files ?? []}
document={document}
key={document.uid}
defaultFiles={document.files ?? []}
/>
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} />
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} />
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} />
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} />
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} />
))}
</div>
<Typography typo={ITypo.H2}>Documents supplémentaires (facultatif)</Typography>
<Typography typo={ITypo.P_16} className={classes["text"]}>
@ -67,7 +71,7 @@ export default class ClientDashboard extends Base<IProps, IState> {
Glissez / Déposez votre document dans la zone prévue à cet effet ou cliquez sur la zone puis sélectionnez le
document correspondant.
</Typography>
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} />
<DepositDocument title={"Carte d'identité - recto-verso"} dateAsked={new Date()} document={documentDeposited} />
</div>
</Confirm>
</div>
@ -100,6 +104,21 @@ export default class ClientDashboard extends Base<IProps, IState> {
);
}
public override async componentDidMount() {
// TODO Get documents of the current customer according to userStore
// REMOVE this mock
const mockUsers = (await Users.getInstance().get({}))[2];
const query: IGetDocumentsparams = {
where: { depositor: mockUsers?.uid },
include: {
files: true,
},
};
const documents: Document[] = await Documents.getInstance().get(query);
console.log({ documents });
this.setState({ documents });
}
private onCloseModalAddDocument() {
this.setState({ isAddDocumentModalVisible: false });
}

View File

@ -1,3 +1,7 @@
import "reflect-metadata";
import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers";
import Folders, { IPutFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
import Form from "@Front/Components/DesignSystem/Form";
import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField";
@ -7,24 +11,26 @@ import { IOption } from "@Front/Components/DesignSystem/Select";
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
import BackArrow from "@Front/Components/Elements/BackArrow";
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
import Module from "@Front/Config/Module";
import { ECivility } from "le-coffre-resources/dist/Customer/Contact";
import { Customer } from "le-coffre-resources/dist/Notary";
import Link from "next/link";
import { NextRouter, useRouter } from "next/router";
import BasePage from "../../Base";
import classes from "./classes.module.scss";
import Link from "next/link";
import Module from "@Front/Config/Module";
import { ECivility } from "le-coffre-resources/dist/Customer/Contact";
import Folders, { IPutFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers";
import { Customer } from "le-coffre-resources/dist/Notary";
enum ESelectedOption {
EXISTING_CUSTOMER = "existing_customer",
NEW_CUSTOMER = "new_customer",
}
type IProps = {};
type IState = {
selectedFolder: IDashBoardFolder | null;
isExistingClientSelected: boolean;
isNewClientSelected: boolean;
availableCustomers: Customer[] | null;
selectedOption: ESelectedOption;
availableCustomers: Customer[];
selectedCustomers: readonly IOption[];
existingCustomers: IOption[];
};
type IPropsClass = IProps & {
@ -36,10 +42,10 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
super(props);
this.state = {
selectedFolder: null,
isExistingClientSelected: true,
isNewClientSelected: false,
selectedOption: ESelectedOption.EXISTING_CUSTOMER,
availableCustomers: [],
selectedCustomers: [],
existingCustomers: [],
};
this.onSelectedFolder = this.onSelectedFolder.bind(this);
this.onExistingClientSelected = this.onExistingClientSelected.bind(this);
@ -61,24 +67,27 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
</div>
<Typography typo={ITypo.H1Bis}>Associer un ou plusieurs client(s)</Typography>
<div className={classes["radiobox-container"]}>
{this.state.availableCustomers.length !== 0 && (
<RadioBox
name="client"
onChange={this.onExistingClientSelected}
defaultChecked={this.state.isExistingClientSelected}
checked={this.state.selectedOption === "existing_customer"}
value={"existing client"}>
<Typography typo={ITypo.P_ERR_18}>Client existant</Typography>
</RadioBox>
)}
<RadioBox
name="client"
onChange={this.onNewClientSelected}
defaultChecked={this.state.isNewClientSelected}
checked={this.state.selectedOption === "new_customer"}
value={"new client"}>
<Typography typo={ITypo.P_ERR_18}>Nouveau client</Typography>
</RadioBox>
</div>
<Form className={classes["form"]} onSubmit={this.onFormSubmit}>
{this.state.isExistingClientSelected && (
{this.state.selectedOption === "existing_customer" && (
<div className={classes["existing-client"]}>
<MultiSelect
options={selectOptions}
@ -95,7 +104,7 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
</div>
)}
{this.state.isNewClientSelected && (
{this.state.selectedOption === "new_customer" && (
<div className={classes["new-client"]}>
<InputField name="last_name" fakeplaceholder="Nom" />
<InputField name="first_name" fakeplaceholder="Prénom" />
@ -118,9 +127,21 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
public override async componentDidMount() {
const query = {};
const availableCustomers = await Customers.getInstance().get(query);
let preSelectedCustomers: IOption[] | undefined = await this.getFolderPreSelectedCustomers(this.props.selectedFolderUid);
const selectedCustomers = preSelectedCustomers ?? [];
this.setState({ availableCustomers, selectedCustomers });
let preExistingCustomers: IOption[] | undefined = await this.getFolderPreSelectedCustomers(this.props.selectedFolderUid);
const existingCustomers = preExistingCustomers ?? [];
existingCustomers.forEach((customer) => {
const index = availableCustomers.findIndex((availableCustomer) => availableCustomer.uid === customer.value);
if (index !== -1) availableCustomers.splice(index, 1);
});
if (availableCustomers.length === 0) {
this.setState({
selectedOption: ESelectedOption.NEW_CUSTOMER,
});
}
this.setState({ availableCustomers, existingCustomers });
}
private async getFolderPreSelectedCustomers(folderUid: string): Promise<IOption[] | undefined> {
@ -137,10 +158,10 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
},
},
};
let preSelectedCustomers: IOption[] = [];
let preExistingCustomers: IOption[] = [];
try {
const folder = await Folders.getInstance().getByUid(folderUid, query);
preSelectedCustomers = folder.office_folder_has_customers!.map((folderHasCustomer) => {
preExistingCustomers = folder.office_folder_has_customers!.map((folderHasCustomer) => {
return {
label: folderHasCustomer.customer.contact?.first_name + " " + folderHasCustomer.customer.contact?.last_name,
value: folderHasCustomer.customer.uid,
@ -150,7 +171,7 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
this.props.router.push(Module.getInstance().get().modules.pages["404"].props.path);
return;
}
return preSelectedCustomers;
return preExistingCustomers;
}
private getSelectedOptions(): IOption[] {
@ -173,11 +194,11 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
}
private onExistingClientSelected(): void {
this.setState({ isExistingClientSelected: true, isNewClientSelected: false });
this.setState({ selectedOption: ESelectedOption.EXISTING_CUSTOMER });
}
private onNewClientSelected(): void {
this.setState({ isExistingClientSelected: false, isNewClientSelected: true });
this.setState({ selectedOption: ESelectedOption.NEW_CUSTOMER });
}
private async onFormSubmit(
@ -188,13 +209,14 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
) {
values["civility"] = ECivility.MALE; // TODO: should maybe be deleted later or added to the form
let customersToLink: IPutFoldersParams["office_folder_has_customers"] = this.state.selectedCustomers.map((customer) => {
const allCustomersToLink = this.state.selectedCustomers.concat(this.state.existingCustomers);
let customersToLink: IPutFoldersParams["office_folder_has_customers"] = allCustomersToLink.map((customer) => {
return {
customer: { uid: customer.value },
};
}) as IPutFoldersParams["office_folder_has_customers"];
if (this.state.isNewClientSelected) {
if (this.state.selectedOption === "new_customer") {
const customer: Customer = await Customers.getInstance().post({
contact: values,
});

View File

@ -1,4 +1,7 @@
import "reflect-metadata";
import PlusIcon from "@Assets/Icons/plus.svg";
import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
import CheckBox from "@Front/Components/DesignSystem/CheckBox";
import Form from "@Front/Components/DesignSystem/Form";
@ -8,40 +11,41 @@ import { IOption } from "@Front/Components/DesignSystem/Select";
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
import BackArrow from "@Front/Components/Elements/BackArrow";
import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
import { NextRouter, useRouter } from "next/router";
import React from "react";
import BasePage from "../../Base";
import classes from "./classes.module.scss";
import Documents from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents";
import Module from "@Front/Config/Module";
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
import Deeds from "@Front/Api/LeCoffreApi/SuperAdmin/Deeds/Deeds";
import DocumentTypes from "@Front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes";
type IProps = {};
type IPropsClass = IProps & {
router: NextRouter;
folderUid: string;
customerUid: string;
};
type IState = {
isCreateDocumentModalVisible: boolean;
documentName: string;
visibleDescription: string;
documentTypes: IOption[];
folder: OfficeFolder | null;
};
export default class AskDocuments extends BasePage<IProps, IState> {
private documentsType: IOption[] = [
{ label: "Carte d'identité", value: "carte_identite" },
{ label: "Diagnostic État Risques et Pollution", value: "diagnostic_erep" },
{ label: "Justificatif de domicile", value: "justificatif_domicile" },
{ label: "Diagnostic gaz", value: "diagnostic_gaz" },
{ label: "Compromis de vente", value: "compromis_de_vente" },
{ label: "Diagnostic DPE", value: "diagnostic_dpe" },
{ label: "Diagnostic électrique", value: "diagnostic_electrique" },
{ label: "Diagnostic plombs", value: "diagnostic_plombs" },
{ label: "Diagnostic amiante", value: "diagnostic_amiante" },
{ label: "Diagnostic termites", value: "diagnostic_termites" },
{ label: "Diagnostic État des nuisances sonores aériennes", value: "diagnostic_ednsa" },
];
public constructor(props: IProps) {
class AskDocumentsClass extends BasePage<IPropsClass, IState> {
public constructor(props: IPropsClass) {
super(props);
this.state = {
isCreateDocumentModalVisible: false,
documentName: "",
visibleDescription: "",
documentTypes: [],
folder: null,
};
this.onFormSubmit = this.onFormSubmit.bind(this);
@ -65,8 +69,8 @@ export default class AskDocuments extends BasePage<IProps, IState> {
<Form onSubmit={this.onFormSubmit}>
<div className={classes["form-container"]}>
<div className={classes["checkbox-container"]}>
{this.documentsType.map((documentType) => (
<CheckBox name="documents_type" toolTip="Checkbox with tooltip" option={documentType} key={documentType.value as string} />
{this.state.documentTypes.map((documentType) => (
<CheckBox name="document_types" toolTip="Checkbox with tooltip" option={documentType} key={documentType.value as string} />
))}
</div>
<div className={classes["add-document-container"]}>
@ -117,6 +121,60 @@ export default class AskDocuments extends BasePage<IProps, IState> {
);
}
public override async componentDidMount(): Promise<void> {
this.loadData();
}
private async loadData(){
try{
const folder = await Folders.getInstance().getByUid(this.props.folderUid, {
q:{
deed: {
include: {
deed_has_document_types: {
include: {
document_type: true
}
}
}
},
office: true
}
});
if(!folder) return;
this.setState({
folder,
documentTypes: await this.getAvailableDocuments(folder),
});
}catch(e){
console.error(e);
}
}
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]>{
const documentTypes = await Deeds.getInstance().getByUid(folder.deed!.uid!, {
q: {
deed_has_document_types: {
include: {
document_type: true
}
}
}
})
if(!documentTypes) return [];
const documentTypesOptions: IOption[] = documentTypes.deed_has_document_types!.map((documentType) => {
return {
label: documentType.document_type!.name!,
value: documentType.document_type!.uid!,
};
});
return documentTypesOptions
}
private canAddDocument() {
if (this.state.documentName === "" || this.state.visibleDescription === "") {
return false;
@ -124,12 +182,37 @@ export default class AskDocuments extends BasePage<IProps, IState> {
return true;
}
private addDocument() {
private async addDocument() {
try{
const documentType = await DocumentTypes.getInstance().post({
name: this.state.documentName,
private_description: this.state.visibleDescription,
office: {
uid: this.state.folder?.office!.uid!
},
public_description: this.state.visibleDescription
})
const oldDocumentsType = this.state.folder?.deed?.deed_has_document_types!;
const deed = await Deeds.getInstance().put(this.state.folder?.deed?.uid!,{
deed_has_document_types: [
...oldDocumentsType,
{
document_type: documentType,
}
]
});
console.log("Deed : ", deed);
await this.loadData();
this.setState({
isCreateDocumentModalVisible: false,
documentName: "",
visibleDescription: "",
});
}catch(e){
console.error(e);
}
}
private onVisibleDescriptionChange(e: React.ChangeEvent<HTMLInputElement>) {
@ -167,11 +250,39 @@ export default class AskDocuments extends BasePage<IProps, IState> {
});
}
private onFormSubmit(
private async onFormSubmit(
e: React.FormEvent<HTMLFormElement> | null,
values: {
[key: string]: string;
[key: string]: any;
}
) {
try{
const documentAsked: [] = values["document_types"] as [];
await documentAsked.forEach(async (document) => {
await Documents.getInstance().post({
folder: {
uid: this.props.folderUid
},
depositor: {
uid: this.props.customerUid
},
document_type: {
uid: document
}
});
});
this.props.router.push(Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid));
}catch(e){
console.error(e);
}
}
}
export default function AskDocuments(props: IProps){
const router = useRouter();
let { folderUid, customerUid } = router.query;
folderUid = folderUid as string;
customerUid = customerUid as string;
return <AskDocumentsClass folderUid={folderUid} customerUid={customerUid} router={router} />;
}

View File

@ -67,6 +67,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
this.hasPrevious = this.hasPrevious.bind(this);
this.hasNext = this.hasNext.bind(this);
this.downloadFile = this.downloadFile.bind(this);
this.refuseDocument = this.refuseDocument.bind(this);
}
public override render(): JSX.Element | null {
@ -155,7 +156,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
<Confirm
isOpen={this.state.isRefuseModalVisible}
onClose={this.closeModals}
onAccept={this.closeModals}
onAccept={this.refuseDocument}
closeBtn
header={"Refuser le document ?"}
cancelText={"Annuler"}
@ -267,6 +268,23 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
return index < this.state.document!.files!.length;
}
private async refuseDocument(){
try{
await Documents.getInstance().put(this.props.documentUid, {
document_status: EDocumentStatus.REFUSED,
refused_reason: this.state.refuseText
});
this.props.router.push(
Module.getInstance()
.get()
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid),
);
}catch(e){
console.error(e);
}
}
private async validateAnchoring() {
this.setState({
hasValidateAnchoring: true,

View File

@ -55,7 +55,7 @@
"AskDocument": {
"enabled": true,
"props": {
"path": "/folders/[folderUid]/ask-documents",
"path": "/folders/[folderUid]/[customerUid]/ask-documents",
"labelKey": "ask_documents"
}
},

View File

@ -55,7 +55,7 @@
"AskDocument": {
"enabled": true,
"props": {
"path": "/folders/[folderUid]/ask-documents",
"path": "/folders/[folderUid]/[customerUid]/ask-documents",
"labelKey": "ask_documents"
}
},

View File

@ -55,7 +55,7 @@
"AskDocument": {
"enabled": true,
"props": {
"path": "/folders/[folderUid]/ask-documents",
"path": "/folders/[folderUid]/[customerUid]/ask-documents",
"labelKey": "ask_documents"
}
},

View File

@ -55,7 +55,7 @@
"AskDocument": {
"enabled": true,
"props": {
"path": "/folders/[folderUid]/ask-documents",
"path": "/folders/[folderUid]/[customerUid]/ask-documents",
"labelKey": "ask_documents"
}
},

View File

@ -5,7 +5,7 @@ import crypto from "crypto";
@Service()
export default class CryptoService {
private jwkKey: JsonWebKey;
private subtle: SubtleCrypto = crypto.webcrypto.subtle
private subtle: SubtleCrypto = window.crypto.subtle;
constructor(protected variables: FrontendVariables) {
this.jwkKey = {
kty: "oct",
@ -16,7 +16,7 @@ export default class CryptoService {
}
private async getKey() {
return await this.subtle.importKey("jwk", this.jwkKey, {name: "AES-GCM"}, false, ["encrypt", "decrypt"]);
return await this.subtle.importKey("jwk", this.jwkKey, { name: "AES-GCM" }, false, ["encrypt", "decrypt"]);
}
/**
@ -36,8 +36,8 @@ export default class CryptoService {
encodedData,
);
const cipherText = Buffer.from(cipherData).toString('base64');
const ivStringified = Buffer.from(iv).toString('base64');
const cipherText = Buffer.from(cipherData).toString("base64");
const ivStringified = Buffer.from(iv).toString("base64");
return { cipherText, ivStringified };
}
@ -47,8 +47,8 @@ export default class CryptoService {
* @throws {Error} If data cannot be decrypted
*/
public async decrypt(cipherText: string, ivStringified: string): Promise<string> {
const cipherData = Buffer.from(cipherText, 'base64');
const iv = Buffer.from(ivStringified, 'base64');
const cipherData = Buffer.from(cipherText, "base64");
const iv = Buffer.from(ivStringified, "base64");
const key = await this.getKey();
const decryptedData = await this.subtle.decrypt(
{
@ -59,6 +59,6 @@ export default class CryptoService {
cipherData,
);
return Buffer.from(decryptedData).toString('utf-8');
return Buffer.from(decryptedData).toString("utf-8");
}
}

View File

@ -38,14 +38,30 @@
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"@Api/*": ["src/api/*"],
"@Front/*": ["src/front/*"],
"@Assets/*": ["src/front/Assets/*"],
"@Components/*": ["src/front/Components/*"],
"@Themes/*": ["src/front/Themes/*"],
"@Stores/*": ["src/front/Stores/*"],
"@FrontServices/*": ["src/front/services/*"],
"@Page/*": ["src/pages/*"],
"@Api/*": [
"src/api/*"
],
"@Front/*": [
"src/front/*"
],
"@Assets/*": [
"src/front/Assets/*"
],
"@Components/*": [
"src/front/Components/*"
],
"@Themes/*": [
"src/front/Themes/*"
],
"@Stores/*": [
"src/front/Stores/*"
],
"@FrontServices/*": [
"src/front/services/*"
],
"@Page/*": [
"src/pages/*"
],
},
// "rootDirs": [],
// "typeRoots": [],
@ -69,10 +85,10 @@
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
, "src/front/next.config.js" ],
"**/*.tsx",
"src/front/next.config.js"
],
"exclude": [
"node_modules"
]
}