diff --git a/libs/react-client/package.json b/libs/react-client/package.json index 82d43db0d7..b9c8be57ae 100644 --- a/libs/react-client/package.json +++ b/libs/react-client/package.json @@ -1,10 +1,10 @@ { "name": "@chainlit/react-client", "description": "Websocket client to connect to your chainlit app.", - "version": "0.2.3", + "version": "0.3.0", "scripts": { - "build": "tsup src/index.ts --tsconfig tsconfig.build.json --clean --format esm,cjs --dts --external react --external recoil --minify --sourcemap --treeshake", - "dev": "tsup src/index.ts --clean --format esm,cjs --dts --external react --external recoil --minify --sourcemap --treeshake", + "build": "tsup src/index.ts --tsconfig tsconfig.build.json --clean --format esm,cjs --dts --external react --external zustand --minify --sourcemap --treeshake", + "dev": "tsup src/index.ts --clean --format esm,cjs --dts --external react --external zustand --minify --sourcemap --treeshake", "lint": "eslint ./src --ext ts,tsx --report-unused-disable-directives --max-warnings 0 && tsc --noemit", "format": "prettier '**/*.{ts,tsx}' --write", "test": "echo no tests yet", @@ -31,8 +31,9 @@ "types": "dist/index.d.ts", "devDependencies": { "@swc/core": "^1.3.86", - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^14.0.0", + "@testing-library/dom": "^10.4.0", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.2.0", "@types/lodash": "^4.14.199", "@types/uuid": "^9.0.3", "@vitejs/plugin-react": "^4.0.4", @@ -46,18 +47,19 @@ "vitest": "^0.34.4" }, "peerDependencies": { - "@types/react": "^18.3.1", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "recoil": "^0.7.7" + "@types/react": "^19.0.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "zustand": "^5.0.3" }, "dependencies": { "jwt-decode": "^3.1.2", "lodash": "^4.17.21", "socket.io-client": "^4.7.2", "sonner": "^1.7.1", - "swr": "^2.2.2", - "uuid": "^9.0.0" + "swr": "^2.3.0", + "uuid": "^9.0.0", + "zustand": "^5.0.3" }, "pnpm": { "overrides": { diff --git a/libs/react-client/pnpm-lock.yaml b/libs/react-client/pnpm-lock.yaml index 676246e319..9e30756c52 100644 --- a/libs/react-client/pnpm-lock.yaml +++ b/libs/react-client/pnpm-lock.yaml @@ -22,8 +22,8 @@ importers: .: dependencies: '@types/react': - specifier: ^18.3.1 - version: 18.3.18 + specifier: ^19.0.0 + version: 19.0.8 jwt-decode: specifier: ^3.1.2 version: 3.1.2 @@ -31,36 +31,39 @@ importers: specifier: ^4.17.21 version: 4.17.21 react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.0.0 + version: 19.0.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) - recoil: - specifier: ^0.7.7 - version: 0.7.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^19.0.0 + version: 19.0.0(react@19.0.0) socket.io-client: specifier: ^4.7.2 version: 4.7.2 sonner: specifier: ^1.7.1 - version: 1.7.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 1.7.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0) swr: - specifier: ^2.2.2 - version: 2.2.2(react@18.3.1) + specifier: ^2.3.0 + version: 2.3.0(react@19.0.0) uuid: specifier: ^9.0.0 version: 9.0.0 + zustand: + specifier: ^5.0.3 + version: 5.0.3(@types/react@19.0.8)(react@19.0.0)(use-sync-external-store@1.4.0(react@19.0.0)) devDependencies: '@swc/core': specifier: ^1.3.86 version: 1.3.86 + '@testing-library/dom': + specifier: ^10.4.0 + version: 10.4.0 '@testing-library/jest-dom': - specifier: ^5.17.0 - version: 5.17.0 + specifier: ^6.6.3 + version: 6.6.3 '@testing-library/react': - specifier: ^14.0.0 - version: 14.0.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^16.2.0 + version: 16.2.0(@testing-library/dom@10.4.0)(@types/react-dom@18.2.15)(@types/react@19.0.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@types/lodash': specifier: ^4.14.199 version: 4.14.199 @@ -481,18 +484,10 @@ packages: cpu: [x64] os: [win32] - '@jest/expect-utils@29.7.0': - resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - '@jest/schemas@29.6.3': resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - '@jest/types@29.6.3': - resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - '@jridgewell/gen-mapping@0.3.3': resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} @@ -681,20 +676,28 @@ packages: '@swc/types@0.1.5': resolution: {integrity: sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==} - '@testing-library/dom@9.3.3': - resolution: {integrity: sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==} - engines: {node: '>=14'} + '@testing-library/dom@10.4.0': + resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==} + engines: {node: '>=18'} - '@testing-library/jest-dom@5.17.0': - resolution: {integrity: sha512-ynmNeT7asXyH3aSVv4vvX4Rb+0qjOhdNHnO/3vuZNqPmhDpV/+rCSGwQ7bLcmU2cJ4dvoheIO85LQj0IbJHEtg==} - engines: {node: '>=8', npm: '>=6', yarn: '>=1'} + '@testing-library/jest-dom@6.6.3': + resolution: {integrity: sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} - '@testing-library/react@14.0.0': - resolution: {integrity: sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==} - engines: {node: '>=14'} + '@testing-library/react@16.2.0': + resolution: {integrity: sha512-2cSskAvA1QNtKc8Y9VJQRv0tm3hLVgxRGDB+KYhIaPQJ1I+RHbhIXcM+zClKXzMes/wshsMVzf4B9vS4IZpqDQ==} + engines: {node: '>=18'} peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 + '@testing-library/dom': ^10.0.0 + '@types/react': ^18.0.0 || ^19.0.0 + '@types/react-dom': ^18.0.0 || ^19.0.0 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true '@tootallnate/once@2.0.0': resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} @@ -712,48 +715,21 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - '@types/istanbul-lib-coverage@2.0.6': - resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} - - '@types/istanbul-lib-report@3.0.3': - resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} - - '@types/istanbul-reports@3.0.4': - resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} - - '@types/jest@29.5.8': - resolution: {integrity: sha512-fXEFTxMV2Co8ZF5aYFJv+YeA08RTYJfhtN5c9JSv/mFEMe+xxjufCb+PHL+bJcMs/ebPUsBu+UNTEz+ydXrR6g==} - '@types/lodash@4.14.199': resolution: {integrity: sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==} '@types/node@20.9.0': resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==} - '@types/prop-types@15.7.10': - resolution: {integrity: sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==} - '@types/react-dom@18.2.15': resolution: {integrity: sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==} - '@types/react@18.3.18': - resolution: {integrity: sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==} - - '@types/stack-utils@2.0.3': - resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} - - '@types/testing-library__jest-dom@5.14.9': - resolution: {integrity: sha512-FSYhIjFlfOpGSRyVoMBMuS3ws5ehFQODymf3vlI7U1K8c7PHwWwFY7VREfmsuzHSOnoKs/9/Y983ayOs7eRzqw==} + '@types/react@19.0.8': + resolution: {integrity: sha512-9P/o1IGdfmQxrujGbIMDyYaaCykhLKc0NGCtYcECNUr9UAaDe4gwvV9bR6tvd5Br1SG0j+PBpbKr2UYY8CwqSw==} '@types/uuid@9.0.3': resolution: {integrity: sha512-taHQQH/3ZyI3zP8M/puluDEIEvtQHVYcC6y3N8ijFtAd28+Ey/G4sg1u2gB01S8MwybLOKAp9/yCMu/uR5l3Ug==} - '@types/yargs-parser@21.0.3': - resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} - - '@types/yargs@17.0.31': - resolution: {integrity: sha512-bocYSx4DI8TmdlvxqGpVNXOgCNR1Jj0gNPhhAY+iz1rgKDAaYrAYdFYnhDV1IFuiuVc9HkOwyDcFxaTElF3/wg==} - '@vitejs/plugin-react-swc@3.3.2': resolution: {integrity: sha512-VJFWY5sfoZerQRvJrh518h3AcQt6f/yTuWn4/TRB+dqmYU0NX1qz7qM5Wfd+gOQqUzQW4gxKqKN3KpE/P3+zrA==} peerDependencies: @@ -819,15 +795,9 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} - aria-query@5.1.3: - resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==} - aria-query@5.3.0: resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} - array-buffer-byte-length@1.0.0: - resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} - array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} @@ -838,10 +808,6 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - available-typed-arrays@1.0.5: - resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} - engines: {node: '>= 0.4'} - balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -871,9 +837,6 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} - call-bind@1.0.5: - resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} - caniuse-lite@1.0.30001562: resolution: {integrity: sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng==} @@ -900,13 +863,6 @@ packages: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} - ci-info@3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} - engines: {node: '>=8'} - - client-only@0.0.1: - resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} - color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -968,18 +924,6 @@ packages: resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} engines: {node: '>=6'} - deep-equal@2.2.3: - resolution: {integrity: sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==} - engines: {node: '>= 0.4'} - - define-data-property@1.1.1: - resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} - engines: {node: '>= 0.4'} - - define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -999,6 +943,9 @@ packages: dom-accessibility-api@0.5.16: resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + dom-accessibility-api@0.6.3: + resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} + domexception@4.0.0: resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} engines: {node: '>=12'} @@ -1017,9 +964,6 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} - es-get-iterator@1.1.3: - resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} - esbuild@0.18.20: resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} engines: {node: '>=12'} @@ -1038,18 +982,10 @@ packages: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} - escape-string-regexp@2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - execa@5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} - expect@29.7.0: - resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -1061,9 +997,6 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - for-each@0.3.3: - resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - form-data@4.0.0: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} @@ -1076,12 +1009,6 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] - function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - - functions-have-names@1.2.3: - resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} - gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -1089,9 +1016,6 @@ packages: get-func-name@2.0.2: resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} - get-intrinsic@1.2.2: - resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} - get-stream@6.0.1: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} @@ -1114,18 +1038,6 @@ packages: globrex@0.1.2: resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} - gopd@1.0.1: - resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - - hamt_plus@1.0.2: - resolution: {integrity: sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==} - - has-bigints@1.0.2: - resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} - has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} @@ -1134,25 +1046,6 @@ packages: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - has-property-descriptors@1.0.1: - resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} - - has-proto@1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} - engines: {node: '>= 0.4'} - - has-symbols@1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - - has-tostringtag@1.0.0: - resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} - engines: {node: '>= 0.4'} - - hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} - engines: {node: '>= 0.4'} - html-encoding-sniffer@3.0.0: resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} engines: {node: '>=12'} @@ -1187,36 +1080,10 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - internal-slot@1.0.6: - resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} - engines: {node: '>= 0.4'} - - is-arguments@1.1.1: - resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} - engines: {node: '>= 0.4'} - - is-array-buffer@3.0.2: - resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} - - is-bigint@1.0.4: - resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} - is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} - is-boolean-object@1.1.2: - resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} - engines: {node: '>= 0.4'} - - is-callable@1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} - engines: {node: '>= 0.4'} - - is-date-object@1.0.5: - resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} - engines: {node: '>= 0.4'} - is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -1225,13 +1092,6 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} - is-map@2.0.2: - resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} - - is-number-object@1.0.7: - resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} - engines: {node: '>= 0.4'} - is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -1239,64 +1099,13 @@ packages: is-potential-custom-element-name@1.0.1: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} - is-regex@1.1.4: - resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} - engines: {node: '>= 0.4'} - - is-set@2.0.2: - resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} - - is-shared-array-buffer@1.0.2: - resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} - is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} - is-string@1.0.7: - resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} - engines: {node: '>= 0.4'} - - is-symbol@1.0.4: - resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} - engines: {node: '>= 0.4'} - - is-typed-array@1.1.12: - resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} - engines: {node: '>= 0.4'} - - is-weakmap@2.0.1: - resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} - - is-weakset@2.0.2: - resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==} - - isarray@2.0.5: - resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} - isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - jest-diff@29.7.0: - resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-get-type@29.6.3: - resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-matcher-utils@29.7.0: - resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-message-util@29.7.0: - resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-util@29.7.0: - resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - joycon@3.1.1: resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} engines: {node: '>=10'} @@ -1350,10 +1159,6 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - loose-envify@1.4.0: - resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} - hasBin: true - loupe@2.3.7: resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} @@ -1430,21 +1235,6 @@ packages: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} - object-inspect@1.13.1: - resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - - object-is@1.1.5: - resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} - engines: {node: '>= 0.4'} - - object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - - object.assign@4.1.4: - resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} - engines: {node: '>= 0.4'} - once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -1531,10 +1321,10 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - react-dom@18.3.1: - resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} + react-dom@19.0.0: + resolution: {integrity: sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==} peerDependencies: - react: ^18.3.1 + react: ^19.0.0 react-is@17.0.2: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} @@ -1546,26 +1336,14 @@ packages: resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} engines: {node: '>=0.10.0'} - react@18.3.1: - resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} + react@19.0.0: + resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} engines: {node: '>=0.10.0'} readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} - recoil@0.7.7: - resolution: {integrity: sha512-8Og5KPQW9LwC577Vc7Ug2P0vQshkv1y3zG3tSSkWMqkWSwHmE+by06L8JtnGocjW6gcCvfwB3YtrJG6/tWivNQ==} - peerDependencies: - react: '>=16.13.1' - react-dom: '*' - react-native: '*' - peerDependenciesMeta: - react-dom: - optional: true - react-native: - optional: true - redent@3.0.0: resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} engines: {node: '>=8'} @@ -1573,10 +1351,6 @@ packages: regenerator-runtime@0.14.0: resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} - regexp.prototype.flags@1.5.1: - resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} - engines: {node: '>= 0.4'} - requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} @@ -1606,21 +1380,13 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.23.2: - resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} + scheduler@0.25.0: + resolution: {integrity: sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==} semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - set-function-length@1.1.1: - resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} - engines: {node: '>= 0.4'} - - set-function-name@2.0.1: - resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} - engines: {node: '>= 0.4'} - shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -1629,9 +1395,6 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - side-channel@1.0.4: - resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} - siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -1664,20 +1427,12 @@ packages: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} - stack-utils@2.0.6: - resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} - engines: {node: '>=10'} - stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} std-env@3.5.0: resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} - stop-iteration-iterator@1.0.0: - resolution: {integrity: sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==} - engines: {node: '>= 0.4'} - strip-final-newline@2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} @@ -1702,10 +1457,10 @@ packages: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} - swr@2.2.2: - resolution: {integrity: sha512-CbR41AoMD4TQBQw9ic3GTXspgfM9Y8Mdhb5Ob4uIKXhWqnRLItwA5fpGvB7SmSw3+zEjb0PdhiEumtUvYoQ+bQ==} + swr@2.3.0: + resolution: {integrity: sha512-NyZ76wA4yElZWBHzSgEJc28a0u6QZvhb6w0azeL2k7+Q1gAzVK+IqQYXhVOC/mzi+HZIozrZvBVeSeOZNR2bqA==} peerDependencies: - react: ^16.11.0 || ^17.0.0 || ^18.0.0 + react: ^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} @@ -1811,10 +1566,10 @@ packages: url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - use-sync-external-store@1.2.0: - resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} + use-sync-external-store@1.4.0: + resolution: {integrity: sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==} peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 uuid@9.0.0: resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} @@ -1921,16 +1676,6 @@ packages: whatwg-url@7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} - which-boxed-primitive@1.0.2: - resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} - - which-collection@1.0.1: - resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==} - - which-typed-array@1.1.13: - resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} - engines: {node: '>= 0.4'} - which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -1978,6 +1723,24 @@ packages: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} + zustand@5.0.3: + resolution: {integrity: sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==} + engines: {node: '>=12.20.0'} + peerDependencies: + '@types/react': '>=18.0.0' + immer: '>=9.0.6' + react: '>=18.0.0' + use-sync-external-store: '>=1.2.0' + peerDependenciesMeta: + '@types/react': + optional: true + immer: + optional: true + react: + optional: true + use-sync-external-store: + optional: true + snapshots: '@adobe/css-tools@4.4.0': {} @@ -2263,23 +2026,10 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@jest/expect-utils@29.7.0': - dependencies: - jest-get-type: 29.6.3 - '@jest/schemas@29.6.3': dependencies: '@sinclair/typebox': 0.27.8 - '@jest/types@29.6.3': - dependencies: - '@jest/schemas': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.6 - '@types/istanbul-reports': 3.0.4 - '@types/node': 20.9.0 - '@types/yargs': 17.0.31 - chalk: 4.1.2 - '@jridgewell/gen-mapping@0.3.3': dependencies: '@jridgewell/set-array': 1.1.2 @@ -2408,36 +2158,36 @@ snapshots: '@swc/types@0.1.5': {} - '@testing-library/dom@9.3.3': + '@testing-library/dom@10.4.0': dependencies: '@babel/code-frame': 7.22.13 '@babel/runtime': 7.23.2 '@types/aria-query': 5.0.4 - aria-query: 5.1.3 + aria-query: 5.3.0 chalk: 4.1.2 dom-accessibility-api: 0.5.16 lz-string: 1.5.0 pretty-format: 27.5.1 - '@testing-library/jest-dom@5.17.0': + '@testing-library/jest-dom@6.6.3': dependencies: '@adobe/css-tools': 4.4.0 - '@babel/runtime': 7.23.2 - '@types/testing-library__jest-dom': 5.14.9 aria-query: 5.3.0 chalk: 3.0.0 css.escape: 1.5.1 - dom-accessibility-api: 0.5.16 + dom-accessibility-api: 0.6.3 lodash: 4.17.21 redent: 3.0.0 - '@testing-library/react@14.0.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@testing-library/react@16.2.0(@testing-library/dom@10.4.0)(@types/react-dom@18.2.15)(@types/react@19.0.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.23.2 - '@testing-library/dom': 9.3.3 + '@testing-library/dom': 10.4.0 + react: 19.0.0 + react-dom: 19.0.0(react@19.0.0) + optionalDependencies: + '@types/react': 19.0.8 '@types/react-dom': 18.2.15 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) '@tootallnate/once@2.0.0': {} @@ -2451,52 +2201,23 @@ snapshots: '@types/estree@1.0.6': {} - '@types/istanbul-lib-coverage@2.0.6': {} - - '@types/istanbul-lib-report@3.0.3': - dependencies: - '@types/istanbul-lib-coverage': 2.0.6 - - '@types/istanbul-reports@3.0.4': - dependencies: - '@types/istanbul-lib-report': 3.0.3 - - '@types/jest@29.5.8': - dependencies: - expect: 29.7.0 - pretty-format: 29.7.0 - '@types/lodash@4.14.199': {} '@types/node@20.9.0': dependencies: undici-types: 5.26.5 - '@types/prop-types@15.7.10': {} - '@types/react-dom@18.2.15': dependencies: - '@types/react': 18.3.18 + '@types/react': 19.0.8 + optional: true - '@types/react@18.3.18': + '@types/react@19.0.8': dependencies: - '@types/prop-types': 15.7.10 csstype: 3.1.2 - '@types/stack-utils@2.0.3': {} - - '@types/testing-library__jest-dom@5.14.9': - dependencies: - '@types/jest': 29.5.8 - '@types/uuid@9.0.3': {} - '@types/yargs-parser@21.0.3': {} - - '@types/yargs@17.0.31': - dependencies: - '@types/yargs-parser': 21.0.3 - '@vitejs/plugin-react-swc@3.3.2(vite@5.4.14(@types/node@20.9.0))': dependencies: '@swc/core': 1.3.86 @@ -2573,27 +2294,16 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.1 - aria-query@5.1.3: - dependencies: - deep-equal: 2.2.3 - aria-query@5.3.0: dependencies: dequal: 2.0.3 - array-buffer-byte-length@1.0.0: - dependencies: - call-bind: 1.0.5 - is-array-buffer: 3.0.2 - array-union@2.1.0: {} assertion-error@1.1.0: {} asynckit@0.4.0: {} - available-typed-arrays@1.0.5: {} - balanced-match@1.0.2: {} binary-extensions@2.2.0: {} @@ -2621,12 +2331,6 @@ snapshots: cac@6.7.14: {} - call-bind@1.0.5: - dependencies: - function-bind: 1.1.2 - get-intrinsic: 1.2.2 - set-function-length: 1.1.1 - caniuse-lite@1.0.30001562: {} chai@4.3.10: @@ -2671,10 +2375,6 @@ snapshots: optionalDependencies: fsevents: 2.3.3 - ci-info@3.9.0: {} - - client-only@0.0.1: {} - color-convert@1.9.3: dependencies: color-name: 1.1.3 @@ -2727,39 +2427,6 @@ snapshots: dependencies: type-detect: 4.0.8 - deep-equal@2.2.3: - dependencies: - array-buffer-byte-length: 1.0.0 - call-bind: 1.0.5 - es-get-iterator: 1.1.3 - get-intrinsic: 1.2.2 - is-arguments: 1.1.1 - is-array-buffer: 3.0.2 - is-date-object: 1.0.5 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 - isarray: 2.0.5 - object-is: 1.1.5 - object-keys: 1.1.1 - object.assign: 4.1.4 - regexp.prototype.flags: 1.5.1 - side-channel: 1.0.4 - which-boxed-primitive: 1.0.2 - which-collection: 1.0.1 - which-typed-array: 1.1.13 - - define-data-property@1.1.1: - dependencies: - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - - define-properties@1.2.1: - dependencies: - define-data-property: 1.1.1 - has-property-descriptors: 1.0.1 - object-keys: 1.1.1 - delayed-stream@1.0.0: {} dequal@2.0.3: {} @@ -2772,6 +2439,8 @@ snapshots: dom-accessibility-api@0.5.16: {} + dom-accessibility-api@0.6.3: {} + domexception@4.0.0: dependencies: webidl-conversions: 7.0.0 @@ -2794,18 +2463,6 @@ snapshots: entities@4.5.0: {} - es-get-iterator@1.1.3: - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - has-symbols: 1.0.3 - is-arguments: 1.1.1 - is-map: 2.0.2 - is-set: 2.0.2 - is-string: 1.0.7 - isarray: 2.0.5 - stop-iteration-iterator: 1.0.0 - esbuild@0.18.20: optionalDependencies: '@esbuild/android-arm': 0.18.20 @@ -2861,8 +2518,6 @@ snapshots: escape-string-regexp@1.0.5: {} - escape-string-regexp@2.0.0: {} - execa@5.1.1: dependencies: cross-spawn: 7.0.6 @@ -2875,14 +2530,6 @@ snapshots: signal-exit: 3.0.7 strip-final-newline: 2.0.0 - expect@29.7.0: - dependencies: - '@jest/expect-utils': 29.7.0 - jest-get-type: 29.6.3 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -2899,10 +2546,6 @@ snapshots: dependencies: to-regex-range: 5.0.1 - for-each@0.3.3: - dependencies: - is-callable: 1.2.7 - form-data@4.0.0: dependencies: asynckit: 0.4.0 @@ -2914,21 +2557,10 @@ snapshots: fsevents@2.3.3: optional: true - function-bind@1.1.2: {} - - functions-have-names@1.2.3: {} - gensync@1.0.0-beta.2: {} get-func-name@2.0.2: {} - get-intrinsic@1.2.2: - dependencies: - function-bind: 1.1.2 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - get-stream@6.0.1: {} glob-parent@5.1.2: @@ -2957,36 +2589,10 @@ snapshots: globrex@0.1.2: {} - gopd@1.0.1: - dependencies: - get-intrinsic: 1.2.2 - - graceful-fs@4.2.11: {} - - hamt_plus@1.0.2: {} - - has-bigints@1.0.2: {} - has-flag@3.0.0: {} has-flag@4.0.0: {} - has-property-descriptors@1.0.1: - dependencies: - get-intrinsic: 1.2.2 - - has-proto@1.0.1: {} - - has-symbols@1.0.3: {} - - has-tostringtag@1.0.0: - dependencies: - has-symbols: 1.0.3 - - hasown@2.0.0: - dependencies: - function-bind: 1.1.2 - html-encoding-sniffer@3.0.0: dependencies: whatwg-encoding: 2.0.0 @@ -3023,131 +2629,24 @@ snapshots: inherits@2.0.4: {} - internal-slot@1.0.6: - dependencies: - get-intrinsic: 1.2.2 - hasown: 2.0.0 - side-channel: 1.0.4 - - is-arguments@1.1.1: - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - - is-array-buffer@3.0.2: - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 - - is-bigint@1.0.4: - dependencies: - has-bigints: 1.0.2 - is-binary-path@2.1.0: dependencies: binary-extensions: 2.2.0 - is-boolean-object@1.1.2: - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - - is-callable@1.2.7: {} - - is-date-object@1.0.5: - dependencies: - has-tostringtag: 1.0.0 - is-extglob@2.1.1: {} is-glob@4.0.3: dependencies: is-extglob: 2.1.1 - is-map@2.0.2: {} - - is-number-object@1.0.7: - dependencies: - has-tostringtag: 1.0.0 - is-number@7.0.0: {} is-potential-custom-element-name@1.0.1: {} - is-regex@1.1.4: - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - - is-set@2.0.2: {} - - is-shared-array-buffer@1.0.2: - dependencies: - call-bind: 1.0.5 - is-stream@2.0.1: {} - is-string@1.0.7: - dependencies: - has-tostringtag: 1.0.0 - - is-symbol@1.0.4: - dependencies: - has-symbols: 1.0.3 - - is-typed-array@1.1.12: - dependencies: - which-typed-array: 1.1.13 - - is-weakmap@2.0.1: {} - - is-weakset@2.0.2: - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - - isarray@2.0.5: {} - isexe@2.0.0: {} - jest-diff@29.7.0: - dependencies: - chalk: 4.1.2 - diff-sequences: 29.6.3 - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - - jest-get-type@29.6.3: {} - - jest-matcher-utils@29.7.0: - dependencies: - chalk: 4.1.2 - jest-diff: 29.7.0 - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - - jest-message-util@29.7.0: - dependencies: - '@babel/code-frame': 7.22.13 - '@jest/types': 29.6.3 - '@types/stack-utils': 2.0.3 - chalk: 4.1.2 - graceful-fs: 4.2.11 - micromatch: 4.0.8 - pretty-format: 29.7.0 - slash: 3.0.0 - stack-utils: 2.0.6 - - jest-util@29.7.0: - dependencies: - '@jest/types': 29.6.3 - '@types/node': 20.9.0 - chalk: 4.1.2 - ci-info: 3.9.0 - graceful-fs: 4.2.11 - picomatch: 2.3.1 - joycon@3.1.1: {} js-tokens@4.0.0: {} @@ -3202,10 +2701,6 @@ snapshots: lodash@4.17.21: {} - loose-envify@1.4.0: - dependencies: - js-tokens: 4.0.0 - loupe@2.3.7: dependencies: get-func-name: 2.0.2 @@ -3272,22 +2767,6 @@ snapshots: object-assign@4.1.1: {} - object-inspect@1.13.1: {} - - object-is@1.1.5: - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - - object-keys@1.1.1: {} - - object.assign@4.1.4: - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - has-symbols: 1.0.3 - object-keys: 1.1.1 - once@1.4.0: dependencies: wrappy: 1.0.2 @@ -3361,11 +2840,10 @@ snapshots: queue-microtask@1.2.3: {} - react-dom@18.3.1(react@18.3.1): + react-dom@19.0.0(react@19.0.0): dependencies: - loose-envify: 1.4.0 - react: 18.3.1 - scheduler: 0.23.2 + react: 19.0.0 + scheduler: 0.25.0 react-is@17.0.2: {} @@ -3373,21 +2851,12 @@ snapshots: react-refresh@0.14.0: {} - react@18.3.1: - dependencies: - loose-envify: 1.4.0 + react@19.0.0: {} readdirp@3.6.0: dependencies: picomatch: 2.3.1 - recoil@0.7.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - hamt_plus: 1.0.2 - react: 18.3.1 - optionalDependencies: - react-dom: 18.3.1(react@18.3.1) - redent@3.0.0: dependencies: indent-string: 4.0.0 @@ -3395,12 +2864,6 @@ snapshots: regenerator-runtime@0.14.0: {} - regexp.prototype.flags@1.5.1: - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - set-function-name: 2.0.1 - requires-port@1.0.0: {} resolve-from@5.0.0: {} @@ -3441,37 +2904,16 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.23.2: - dependencies: - loose-envify: 1.4.0 + scheduler@0.25.0: {} semver@6.3.1: {} - set-function-length@1.1.1: - dependencies: - define-data-property: 1.1.1 - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - - set-function-name@2.0.1: - dependencies: - define-data-property: 1.1.1 - functions-have-names: 1.2.3 - has-property-descriptors: 1.0.1 - shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 shebang-regex@3.0.0: {} - side-channel@1.0.4: - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - object-inspect: 1.13.1 - siginfo@2.0.0: {} signal-exit@3.0.7: {} @@ -3496,10 +2938,10 @@ snapshots: transitivePeerDependencies: - supports-color - sonner@1.7.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + sonner@1.7.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.0.0 + react-dom: 19.0.0(react@19.0.0) source-map-js@1.2.1: {} @@ -3507,18 +2949,10 @@ snapshots: dependencies: whatwg-url: 7.1.0 - stack-utils@2.0.6: - dependencies: - escape-string-regexp: 2.0.0 - stackback@0.0.2: {} std-env@3.5.0: {} - stop-iteration-iterator@1.0.0: - dependencies: - internal-slot: 1.0.6 - strip-final-newline@2.0.0: {} strip-indent@3.0.0: @@ -3547,11 +2981,11 @@ snapshots: dependencies: has-flag: 4.0.0 - swr@2.2.2(react@18.3.1): + swr@2.3.0(react@19.0.0): dependencies: - client-only: 0.0.1 - react: 18.3.1 - use-sync-external-store: 1.2.0(react@18.3.1) + dequal: 2.0.3 + react: 19.0.0 + use-sync-external-store: 1.4.0(react@19.0.0) symbol-tree@3.2.4: {} @@ -3645,9 +3079,9 @@ snapshots: querystringify: 2.2.0 requires-port: 1.0.0 - use-sync-external-store@1.2.0(react@18.3.1): + use-sync-external-store@1.4.0(react@19.0.0): dependencies: - react: 18.3.1 + react: 19.0.0 uuid@9.0.0: {} @@ -3753,29 +3187,6 @@ snapshots: tr46: 1.0.1 webidl-conversions: 4.0.2 - which-boxed-primitive@1.0.2: - dependencies: - is-bigint: 1.0.4 - is-boolean-object: 1.1.2 - is-number-object: 1.0.7 - is-string: 1.0.7 - is-symbol: 1.0.4 - - which-collection@1.0.1: - dependencies: - is-map: 2.0.2 - is-set: 2.0.2 - is-weakmap: 2.0.1 - is-weakset: 2.0.2 - - which-typed-array@1.1.13: - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - which@2.0.2: dependencies: isexe: 2.0.0 @@ -3800,3 +3211,9 @@ snapshots: yaml@2.3.4: {} yocto-queue@1.0.0: {} + + zustand@5.0.3(@types/react@19.0.8)(react@19.0.0)(use-sync-external-store@1.4.0(react@19.0.0)): + optionalDependencies: + '@types/react': 19.0.8 + react: 19.0.0 + use-sync-external-store: 1.4.0(react@19.0.0) diff --git a/libs/react-client/src/api/hooks/auth/state.ts b/libs/react-client/src/api/hooks/auth/state.ts index 03a165f4ca..bc83db319e 100644 --- a/libs/react-client/src/api/hooks/auth/state.ts +++ b/libs/react-client/src/api/hooks/auth/state.ts @@ -1,10 +1,11 @@ -import { useRecoilState, useSetRecoilState } from 'recoil'; -import { authState, threadHistoryState, userState } from 'src/state'; +import { useAuthStore } from 'src/store/auth'; export const useAuthState = () => { - const [authConfig, setAuthConfig] = useRecoilState(authState); - const [user, setUser] = useRecoilState(userState); - const setThreadHistory = useSetRecoilState(threadHistoryState); + const authConfig = useAuthStore((s) => s.authConfig); + const setAuthConfig = useAuthStore((s) => s.setAuthConfig); + const user = useAuthStore((s) => s.user); + const setUser = useAuthStore((s) => s.setUser); + const setThreadHistory = useAuthStore((s) => s.setThreadHistory); return { authConfig, diff --git a/libs/react-client/src/index.ts b/libs/react-client/src/index.ts index 083d74abe4..c9ff83902e 100644 --- a/libs/react-client/src/index.ts +++ b/libs/react-client/src/index.ts @@ -7,7 +7,6 @@ export * from './useConfig'; export * from './api'; export * from './types'; export * from './context'; -export * from './state'; export * from './utils/message'; export { Socket } from 'socket.io-client'; diff --git a/libs/react-client/src/state.ts b/libs/react-client/src/state.ts deleted file mode 100644 index e41bad0a14..0000000000 --- a/libs/react-client/src/state.ts +++ /dev/null @@ -1,215 +0,0 @@ -import { isEqual } from 'lodash'; -import { DefaultValue, atom, selector } from 'recoil'; -import { Socket } from 'socket.io-client'; -import { v4 as uuidv4 } from 'uuid'; - -import { ICommand } from './types/command'; - -import { - IAction, - IAsk, - IAuthConfig, - ICallFn, - IChainlitConfig, - IMessageElement, - IStep, - ITasklistElement, - IUser, - ThreadHistory -} from './types'; -import { groupByDate } from './utils/group'; -import { WavRecorder, WavStreamPlayer } from './wavtools'; - -export interface ISession { - socket: Socket; - error?: boolean; -} - -export const threadIdToResumeState = atom({ - key: 'ThreadIdToResume', - default: undefined -}); - -export const resumeThreadErrorState = atom({ - key: 'ResumeThreadErrorState', - default: undefined -}); - -export const chatProfileState = atom({ - key: 'ChatProfile', - default: undefined -}); - -const sessionIdAtom = atom({ - key: 'SessionId', - default: uuidv4() -}); - -export const sessionIdState = selector({ - key: 'SessionIdSelector', - get: ({ get }) => get(sessionIdAtom), - set: ({ set }, newValue) => - set(sessionIdAtom, newValue instanceof DefaultValue ? uuidv4() : newValue) -}); - -export const sessionState = atom({ - key: 'Session', - dangerouslyAllowMutability: true, - default: undefined -}); - -export const actionState = atom({ - key: 'Actions', - default: [] -}); - -export const messagesState = atom({ - key: 'Messages', - dangerouslyAllowMutability: true, - default: [] -}); - -export const commandsState = atom({ - key: 'Commands', - default: [] -}); - -export const tokenCountState = atom({ - key: 'TokenCount', - default: 0 -}); - -export const loadingState = atom({ - key: 'Loading', - default: false -}); - -export const askUserState = atom({ - key: 'AskUser', - default: undefined -}); - -export const wavRecorderState = atom({ - key: 'WavRecorder', - dangerouslyAllowMutability: true, - default: new WavRecorder() -}); - -export const wavStreamPlayerState = atom({ - key: 'WavStreamPlayer', - dangerouslyAllowMutability: true, - default: new WavStreamPlayer() -}); - -export const audioConnectionState = atom<'connecting' | 'on' | 'off'>({ - key: 'AudioConnection', - default: 'off' -}); - -export const isAiSpeakingState = atom({ - key: 'isAiSpeaking', - default: false -}); - -export const callFnState = atom({ - key: 'CallFn', - default: undefined -}); - -export const chatSettingsInputsState = atom({ - key: 'ChatSettings', - default: [] -}); - -export const chatSettingsDefaultValueSelector = selector({ - key: 'ChatSettingsValue/Default', - get: ({ get }) => { - const chatSettings = get(chatSettingsInputsState); - return chatSettings.reduce( - (form: { [key: string]: any }, input: any) => ( - (form[input.id] = input.initial), form - ), - {} - ); - } -}); - -export const chatSettingsValueState = atom({ - key: 'ChatSettingsValue', - default: chatSettingsDefaultValueSelector -}); - -export const elementState = atom({ - key: 'DisplayElements', - default: [] -}); - -export const tasklistState = atom({ - key: 'TasklistElements', - default: [] -}); - -export const firstUserInteraction = atom({ - key: 'FirstUserInteraction', - default: undefined -}); - -export const userState = atom({ - key: 'User', - default: undefined -}); - -export const configState = atom({ - key: 'ChainlitConfig', - default: undefined -}); - -export const authState = atom({ - key: 'AuthConfig', - default: undefined -}); - -export const threadHistoryState = atom({ - key: 'ThreadHistory', - default: { - threads: undefined, - currentThreadId: undefined, - timeGroupedThreads: undefined, - pageInfo: undefined - }, - effects: [ - ({ setSelf, onSet }: { setSelf: any; onSet: any }) => { - onSet( - ( - newValue: ThreadHistory | undefined, - oldValue: ThreadHistory | undefined - ) => { - let timeGroupedThreads = newValue?.timeGroupedThreads; - if ( - newValue?.threads && - !isEqual(newValue.threads, oldValue?.timeGroupedThreads) - ) { - timeGroupedThreads = groupByDate(newValue.threads); - } - - setSelf({ - ...newValue, - timeGroupedThreads - }); - } - ); - } - ] -}); - -export const sideViewState = atom< - { title: string; elements: IMessageElement[] } | undefined ->({ - key: 'SideView', - default: undefined -}); - -export const currentThreadIdState = atom({ - key: 'CurrentThreadId', - default: undefined -}); diff --git a/libs/react-client/src/store/auth.ts b/libs/react-client/src/store/auth.ts new file mode 100644 index 0000000000..841b609d99 --- /dev/null +++ b/libs/react-client/src/store/auth.ts @@ -0,0 +1,52 @@ +import { isEqual } from 'lodash'; +import { groupByDate } from 'src/utils/group'; +import { create } from 'zustand'; + +import { IAuthConfig, IUser, ThreadHistory } from '..'; + +interface AuthState { + authConfig?: IAuthConfig; + user?: IUser | null; + + threadHistory?: ThreadHistory; + + setAuthConfig: (authConfig?: IAuthConfig) => void; + setUser: (user?: IUser | null) => void; + setThreadHistory: (threadHistory?: ThreadHistory) => void; +} + +export const useAuthStore = create((set, get) => ({ + threadHistory: { + threads: undefined, + currentThreadId: undefined, + timeGroupedThreads: undefined, + pageInfo: undefined + }, + + setAuthConfig: (authConfig?: IAuthConfig) => { + set({ authConfig }); + }, + + setUser: (user?: IUser | null) => { + set({ user }); + }, + + setThreadHistory: (threadHistory?: ThreadHistory) => { + const oldValue = get().threadHistory; + + let timeGroupedThreads = threadHistory?.timeGroupedThreads; + if ( + threadHistory?.threads && + !isEqual(threadHistory.threads, oldValue?.timeGroupedThreads) + ) { + timeGroupedThreads = groupByDate(threadHistory.threads); + } + + set({ + threadHistory: { + ...threadHistory, + timeGroupedThreads + } + }); + } +})); diff --git a/libs/react-client/src/store/chat.ts b/libs/react-client/src/store/chat.ts new file mode 100644 index 0000000000..5201d36aa4 --- /dev/null +++ b/libs/react-client/src/store/chat.ts @@ -0,0 +1,104 @@ +import { ICallFn, ICommand, IMessageElement } from 'src/types'; +import { WavRecorder, WavStreamPlayer } from 'src/wavtools'; +import { create } from 'zustand'; + +import { stateOrSetter } from './utils'; + +interface ChatState { + isAiSpeaking: boolean; + audioConnection: 'connecting' | 'on' | 'off'; + loading: boolean; + wavStreamPlayer: WavStreamPlayer; + wavRecorder: WavRecorder; + callFn?: ICallFn; + commands: ICommand[]; + sideView?: { title: string; elements: IMessageElement[] }; + chatProfile?: string; + chatSettingsInputs: any[]; + chatSettingsDefaultValue: any; + chatSettingsValue: any; + + setIsAiSpeaking: (isAiSpeaking: boolean) => void; + setAudioConnection: (audioConnection: 'connecting' | 'on' | 'off') => void; + setLoading: (loading: boolean) => void; + setCallFn: (callFn?: ICallFn) => void; + setCommands: (commands: ICommand[]) => void; + setSideView: ( + sideViewOrSetter?: + | { title: string; elements: IMessageElement[] } + | ((old?: { title: string; elements: IMessageElement[] }) => + | { + title: string; + elements: IMessageElement[]; + } + | undefined) + ) => void; + setChatProfile: (chatProfile: string) => void; + resetChatSettingsInputs: () => void; + resetChatSettingsValue: () => void; +} + +export const useChatStore = create((set, get) => ({ + isAiSpeaking: false, + audioConnection: 'off', + loading: false, + wavStreamPlayer: new WavStreamPlayer(), + wavRecorder: new WavRecorder(), + commands: [], + chatSettingsInputs: [], + chatSettingsValue: [].reduce( + (form: { [key: string]: any }, input: any) => ( + (form[input.id] = input.initial), form + ), + {} + ), + chatSettingsDefaultValue: [].reduce( + (form: { [key: string]: any }, input: any) => ( + (form[input.id] = input.initial), form + ), + {} + ), + + setIsAiSpeaking: (isAiSpeaking) => { + set({ isAiSpeaking }); + }, + + setAudioConnection: (audioConnection) => { + set({ audioConnection }); + }, + + setLoading: (loading) => { + set({ loading }); + }, + + setCallFn: (callFn) => { + set({ callFn }); + }, + + setCommands: (commands) => { + set({ commands }); + }, + + setSideView: (sideViewOrSetter) => { + stateOrSetter(set, 'sideView', sideViewOrSetter); + }, + + setChatProfile: (chatProfile) => { + set({ chatProfile }); + }, + + resetChatSettingsInputs: () => { + set({ chatSettingsInputs: [] }); + }, + + resetChatSettingsValue: () => { + const chatSettingsValue = get().chatSettingsInputs.reduce( + (form: { [key: string]: any }, input: any) => ( + (form[input.id] = input.initial), form + ), + {} + ); + + set({ chatSettingsValue }); + } +})); diff --git a/libs/react-client/src/store/config.ts b/libs/react-client/src/store/config.ts new file mode 100644 index 0000000000..192a6926a2 --- /dev/null +++ b/libs/react-client/src/store/config.ts @@ -0,0 +1,14 @@ +import { create } from 'zustand'; + +import { IChainlitConfig } from '..'; + +interface ConfigState { + config?: IChainlitConfig; + setConfig: (config: IChainlitConfig) => void; +} + +export const useConfigStore = create((set) => ({ + setConfig: (config: IChainlitConfig) => { + set({ config }); + } +})); diff --git a/libs/react-client/src/store/messages.ts b/libs/react-client/src/store/messages.ts new file mode 100644 index 0000000000..0913416822 --- /dev/null +++ b/libs/react-client/src/store/messages.ts @@ -0,0 +1,63 @@ +import { IAction, IMessageElement, IStep, ITasklistElement } from 'src/types'; +import { create } from 'zustand'; + +import { stateOrSetter } from './utils'; + +interface MessagesState { + messages: IStep[]; + elements: IMessageElement[]; + taskList: ITasklistElement[]; + actions: IAction[]; + chatInputs: any[]; + tokenCount: number; + + setMessages: (setterFnOrItems: ((old: IStep[]) => IStep[]) | IStep[]) => void; + setElements: ( + setterFnOrItems: + | ((old: IMessageElement[]) => IMessageElement[]) + | IMessageElement[] + ) => void; + setTaskList: ( + setterFnOrItems: + | ((old: ITasklistElement[]) => ITasklistElement[]) + | ITasklistElement[] + ) => void; + setActions: ( + setterFnOrItems: ((old: IAction[]) => IAction[]) | IAction[] + ) => void; + setChatInputs: (chatInputs: any[]) => void; + setTokenCount: (setterFnOrCount: ((old: number) => number) | number) => void; +} + +export const useMessagesStore = create((set) => ({ + messages: [], + elements: [], + taskList: [], + actions: [], + chatInputs: [], + tokenCount: 0, + + setMessages: (setterFnOrItems) => { + stateOrSetter(set, 'messages', setterFnOrItems); + }, + + setElements: (elements) => { + stateOrSetter(set, 'elements', elements); + }, + + setTaskList: (taskList) => { + stateOrSetter(set, 'taskList', taskList); + }, + + setActions: (actions) => { + stateOrSetter(set, 'actions', actions); + }, + + setChatInputs: (chatInputs) => { + set({ chatInputs }); + }, + + setTokenCount: (tokenCount) => { + stateOrSetter(set, 'tokenCount', tokenCount); + } +})); diff --git a/libs/react-client/src/store/session.ts b/libs/react-client/src/store/session.ts new file mode 100644 index 0000000000..738bd898f6 --- /dev/null +++ b/libs/react-client/src/store/session.ts @@ -0,0 +1,29 @@ +import { v4 as uuidv4 } from 'uuid'; +import { create } from 'zustand'; + +import { ISession } from '../types'; +import { stateOrSetter } from './utils'; + +interface SessionState { + sessionId: string; + session?: ISession; + + setState: (state: Partial) => void; + setSession: ( + setterFnOrState: ((old?: ISession) => ISession) | ISession + ) => void; + resetSessionId: () => void; +} + +export const useSessionState = create((set) => ({ + sessionId: uuidv4(), + + setState: (state) => set(state), + setSession: (setterFnOrState) => { + stateOrSetter(set, 'session', setterFnOrState); + }, + + resetSessionId: () => { + set({ sessionId: uuidv4() }); + } +})); diff --git a/libs/react-client/src/store/thread.ts b/libs/react-client/src/store/thread.ts new file mode 100644 index 0000000000..9bc22d2275 --- /dev/null +++ b/libs/react-client/src/store/thread.ts @@ -0,0 +1,19 @@ +import { create } from 'zustand'; + +interface ThreadState { + idToResume?: string; + resumeThreadError?: string; + currentThreadId?: string; + + setState: (state: Partial) => void; + setIdToResume: (idToResume?: string) => void; + setCurrentThreadId: (currentThreadId?: string) => void; + setResumeThreadError: (resumeThreadError?: string) => void; +} + +export const useThreadStore = create((set) => ({ + setState: (state) => set(state), + setIdToResume: (idToResume) => set({ idToResume }), + setCurrentThreadId: (currentThreadId) => set({ currentThreadId }), + setResumeThreadError: (resumeThreadError) => set({ resumeThreadError }) +})); diff --git a/libs/react-client/src/store/user.ts b/libs/react-client/src/store/user.ts new file mode 100644 index 0000000000..2c85cf1080 --- /dev/null +++ b/libs/react-client/src/store/user.ts @@ -0,0 +1,20 @@ +import { IAsk } from 'src/types'; +import { create } from 'zustand'; + +interface UserState { + firstUserInteraction?: string; + askUser?: IAsk; + + setFirstUserInteraction: (interaction?: string) => void; + setAskUser: (ask?: IAsk) => void; +} + +export const useUserState = create((set) => ({ + setFirstUserInteraction: (interaction) => { + set({ firstUserInteraction: interaction }); + }, + + setAskUser: (ask) => { + set({ askUser: ask }); + } +})); diff --git a/libs/react-client/src/store/utils.ts b/libs/react-client/src/store/utils.ts new file mode 100644 index 0000000000..872dbb8a18 --- /dev/null +++ b/libs/react-client/src/store/utils.ts @@ -0,0 +1,25 @@ +export interface SetterFn { + ( + partial: T | Partial | ((state: T) => T | Partial), + replace?: false + ): void; + (state: T | ((state: T) => T), replace: true): void; +} + +export const stateOrSetter = ( + set: SetterFn, + key: K, + stateOrSetterFn: ((old: T[K]) => T[K]) | T[K] +) => { + if (typeof stateOrSetterFn === 'function') { + const setter = stateOrSetterFn as (old: T[K]) => T[K]; + + set((state) => ({ ...state, [key]: setter(state[key]) })); + + return; + } + + const state = stateOrSetterFn as T[K]; + + set((prevState) => ({ ...prevState, [key]: state })); +}; diff --git a/libs/react-client/src/types/index.ts b/libs/react-client/src/types/index.ts index 4064cb0df0..fa90e06980 100644 --- a/libs/react-client/src/types/index.ts +++ b/libs/react-client/src/types/index.ts @@ -8,3 +8,4 @@ export * from './user'; export * from './thread'; export * from './history'; export * from './config'; +export * from './session'; diff --git a/libs/react-client/src/types/session.ts b/libs/react-client/src/types/session.ts new file mode 100644 index 0000000000..ac40aedb7a --- /dev/null +++ b/libs/react-client/src/types/session.ts @@ -0,0 +1,6 @@ +import { Socket } from 'socket.io-client'; + +export interface ISession { + socket: Socket; + error?: boolean; +} diff --git a/libs/react-client/src/useAudio.ts b/libs/react-client/src/useAudio.ts index 79a964f3f2..5653774dee 100644 --- a/libs/react-client/src/useAudio.ts +++ b/libs/react-client/src/useAudio.ts @@ -1,20 +1,14 @@ import { useCallback } from 'react'; -import { useRecoilState, useRecoilValue } from 'recoil'; -import { - audioConnectionState, - isAiSpeakingState, - wavRecorderState, - wavStreamPlayerState -} from './state'; +import { useChatStore } from './store/chat'; import { useChatInteract } from './useChatInteract'; const useAudio = () => { - const [audioConnection, setAudioConnection] = - useRecoilState(audioConnectionState); - const wavRecorder = useRecoilValue(wavRecorderState); - const wavStreamPlayer = useRecoilValue(wavStreamPlayerState); - const isAiSpeaking = useRecoilValue(isAiSpeakingState); + const audioConnection = useChatStore((state) => state.audioConnection); + const setAudioConnection = useChatStore((state) => state.setAudioConnection); + const wavRecorder = useChatStore((state) => state.wavRecorder); + const wavStreamPlayer = useChatStore((state) => state.wavStreamPlayer); + const isAiSpeaking = useChatStore((state) => state.isAiSpeaking); const { startAudioStream, endAudioStream } = useChatInteract(); diff --git a/libs/react-client/src/useChatData.ts b/libs/react-client/src/useChatData.ts index ba3e37a98c..d0380e8275 100644 --- a/libs/react-client/src/useChatData.ts +++ b/libs/react-client/src/useChatData.ts @@ -1,17 +1,7 @@ -import { useRecoilValue } from 'recoil'; - -import { - actionState, - askUserState, - callFnState, - chatSettingsDefaultValueSelector, - chatSettingsInputsState, - chatSettingsValueState, - elementState, - loadingState, - sessionState, - tasklistState -} from './state'; +import { useChatStore } from './store/chat'; +import { useMessagesStore } from './store/messages'; +import { useSessionState } from './store/session'; +import { useUserState } from './store/user'; export interface IToken { id: number | string; @@ -21,17 +11,17 @@ export interface IToken { } const useChatData = () => { - const loading = useRecoilValue(loadingState); - const elements = useRecoilValue(elementState); - const tasklists = useRecoilValue(tasklistState); - const actions = useRecoilValue(actionState); - const session = useRecoilValue(sessionState); - const askUser = useRecoilValue(askUserState); - const callFn = useRecoilValue(callFnState); - const chatSettingsInputs = useRecoilValue(chatSettingsInputsState); - const chatSettingsValue = useRecoilValue(chatSettingsValueState); - const chatSettingsDefaultValue = useRecoilValue( - chatSettingsDefaultValueSelector + const loading = useChatStore((s) => s.loading); + const elements = useMessagesStore((s) => s.elements); + const tasklists = useMessagesStore((s) => s.taskList); + const actions = useMessagesStore((s) => s.actions); + const session = useSessionState((s) => s.session); + const askUser = useUserState((s) => s.askUser); + const callFn = useChatStore((s) => s.callFn); + const chatSettingsInputs = useChatStore((s) => s.chatSettingsInputs); + const chatSettingsValue = useChatStore((s) => s.chatSettingsValue); + const chatSettingsDefaultValue = useChatStore( + (s) => s.chatSettingsDefaultValue ); const connected = session?.socket.connected && !session?.error; diff --git a/libs/react-client/src/useChatInteract.ts b/libs/react-client/src/useChatInteract.ts index bd5499ef9c..7e26b10abb 100644 --- a/libs/react-client/src/useChatInteract.ts +++ b/libs/react-client/src/useChatInteract.ts @@ -1,50 +1,39 @@ import { useCallback, useContext } from 'react'; -import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'; -import { - actionState, - askUserState, - chatSettingsInputsState, - chatSettingsValueState, - currentThreadIdState, - elementState, - firstUserInteraction, - loadingState, - messagesState, - sessionIdState, - sessionState, - sideViewState, - tasklistState, - threadIdToResumeState, - tokenCountState -} from 'src/state'; import { IFileRef, IStep } from 'src/types'; import { addMessage } from 'src/utils/message'; import { v4 as uuidv4 } from 'uuid'; import { ChainlitContext } from './context'; +import { useChatStore } from './store/chat'; +import { useMessagesStore } from './store/messages'; +import { useSessionState } from './store/session'; +import { useThreadStore } from './store/thread'; +import { useUserState } from './store/user'; type PartialBy = Omit & Partial>; const useChatInteract = () => { const client = useContext(ChainlitContext); - const session = useRecoilValue(sessionState); - const askUser = useRecoilValue(askUserState); - const sessionId = useRecoilValue(sessionIdState); - - const resetChatSettings = useResetRecoilState(chatSettingsInputsState); - const resetSessionId = useResetRecoilState(sessionIdState); - const resetChatSettingsValue = useResetRecoilState(chatSettingsValueState); - - const setFirstUserInteraction = useSetRecoilState(firstUserInteraction); - const setLoading = useSetRecoilState(loadingState); - const setMessages = useSetRecoilState(messagesState); - const setElements = useSetRecoilState(elementState); - const setTasklists = useSetRecoilState(tasklistState); - const setActions = useSetRecoilState(actionState); - const setTokenCount = useSetRecoilState(tokenCountState); - const setIdToResume = useSetRecoilState(threadIdToResumeState); - const setSideView = useSetRecoilState(sideViewState); - const setCurrentThreadId = useSetRecoilState(currentThreadIdState); + const session = useSessionState((state) => state.session); + const askUser = useUserState((s) => s.askUser); + const sessionId = useSessionState((s) => s.sessionId); + + const resetChatSettings = useChatStore((s) => s.resetChatSettingsInputs); + const resetSessionId = useSessionState((s) => s.resetSessionId); + const resetChatSettingsValue = useChatStore((s) => s.resetChatSettingsValue); + + const setFirstUserInteraction = useUserState( + (state) => state.setFirstUserInteraction + ); + const setLoading = useChatStore((s) => s.setLoading); + const setMessages = useMessagesStore((s) => s.setMessages); + const setElements = useMessagesStore((s) => s.setElements); + const setTasklists = useMessagesStore((s) => s.setTaskList); + const setActions = useMessagesStore((s) => s.setActions); + const setTokenCount = useMessagesStore((s) => s.setTokenCount); + const setIdToResume = useThreadStore((s) => s.setIdToResume); + const setSideView = useChatStore((s) => s.setSideView); + const setCurrentThreadId = useThreadStore((s) => s.setCurrentThreadId); const clear = useCallback(() => { session?.socket.emit('clear_session'); diff --git a/libs/react-client/src/useChatMessages.ts b/libs/react-client/src/useChatMessages.ts index c3b1f5c949..9f7555233c 100644 --- a/libs/react-client/src/useChatMessages.ts +++ b/libs/react-client/src/useChatMessages.ts @@ -1,15 +1,11 @@ -import { useRecoilValue } from 'recoil'; - -import { - currentThreadIdState, - firstUserInteraction, - messagesState -} from './state'; +import { useMessagesStore } from './store/messages'; +import { useThreadStore } from './store/thread'; +import { useUserState } from './store/user'; const useChatMessages = () => { - const messages = useRecoilValue(messagesState); - const firstInteraction = useRecoilValue(firstUserInteraction); - const threadId = useRecoilValue(currentThreadIdState); + const messages = useMessagesStore((state) => state.messages); + const firstInteraction = useUserState((state) => state.firstUserInteraction); + const threadId = useThreadStore((state) => state.currentThreadId); return { threadId, diff --git a/libs/react-client/src/useChatSession.ts b/libs/react-client/src/useChatSession.ts index 4ecbc2b37a..b542bab1e4 100644 --- a/libs/react-client/src/useChatSession.ts +++ b/libs/react-client/src/useChatSession.ts @@ -1,38 +1,7 @@ import { debounce } from 'lodash'; import { useCallback, useContext, useEffect } from 'react'; -import { - useRecoilState, - useRecoilValue, - useResetRecoilState, - useSetRecoilState -} from 'recoil'; import io from 'socket.io-client'; import { toast } from 'sonner'; -import { - actionState, - askUserState, - audioConnectionState, - callFnState, - chatProfileState, - chatSettingsInputsState, - chatSettingsValueState, - commandsState, - currentThreadIdState, - elementState, - firstUserInteraction, - isAiSpeakingState, - loadingState, - messagesState, - resumeThreadErrorState, - sessionIdState, - sessionState, - sideViewState, - tasklistState, - threadIdToResumeState, - tokenCountState, - wavRecorderState, - wavStreamPlayerState -} from 'src/state'; import { IAction, ICommand, @@ -52,36 +21,45 @@ import { import { OutputAudioChunk } from './types/audio'; import { ChainlitContext } from './context'; +import { useChatStore } from './store/chat'; +import { useMessagesStore } from './store/messages'; +import { useSessionState } from './store/session'; +import { useThreadStore } from './store/thread'; +import { useUserState } from './store/user'; import type { IToken } from './useChatData'; const useChatSession = () => { const client = useContext(ChainlitContext); - const sessionId = useRecoilValue(sessionIdState); - - const [session, setSession] = useRecoilState(sessionState); - const setIsAiSpeaking = useSetRecoilState(isAiSpeakingState); - const setAudioConnection = useSetRecoilState(audioConnectionState); - const resetChatSettingsValue = useResetRecoilState(chatSettingsValueState); - const setFirstUserInteraction = useSetRecoilState(firstUserInteraction); - const setLoading = useSetRecoilState(loadingState); - const wavStreamPlayer = useRecoilValue(wavStreamPlayerState); - const wavRecorder = useRecoilValue(wavRecorderState); - const setMessages = useSetRecoilState(messagesState); - const setAskUser = useSetRecoilState(askUserState); - const setCallFn = useSetRecoilState(callFnState); - const setCommands = useSetRecoilState(commandsState); - const setSideView = useSetRecoilState(sideViewState); - const setElements = useSetRecoilState(elementState); - const setTasklists = useSetRecoilState(tasklistState); - const setActions = useSetRecoilState(actionState); - const setChatSettingsInputs = useSetRecoilState(chatSettingsInputsState); - const setTokenCount = useSetRecoilState(tokenCountState); - const [chatProfile, setChatProfile] = useRecoilState(chatProfileState); - const idToResume = useRecoilValue(threadIdToResumeState); - const setThreadResumeError = useSetRecoilState(resumeThreadErrorState); - - const [currentThreadId, setCurrentThreadId] = - useRecoilState(currentThreadIdState); + const sessionId = useSessionState((s) => s.sessionId); + + const session = useSessionState((s) => s.session); + const setSession = useSessionState((s) => s.setSession); + const setIsAiSpeaking = useChatStore((s) => s.setIsAiSpeaking); + const setAudioConnection = useChatStore((s) => s.setAudioConnection); + const resetChatSettingsValue = useChatStore((s) => s.resetChatSettingsValue); + const setFirstUserInteraction = useUserState( + (s) => s.setFirstUserInteraction + ); + const setLoading = useChatStore((s) => s.setLoading); + const wavStreamPlayer = useChatStore((s) => s.wavStreamPlayer); + const wavRecorder = useChatStore((s) => s.wavRecorder); + const setMessages = useMessagesStore((s) => s.setMessages); + const setAskUser = useUserState((s) => s.setAskUser); + const setCallFn = useChatStore((s) => s.setCallFn); + const setCommands = useChatStore((s) => s.setCommands); + const setSideView = useChatStore((s) => s.setSideView); + const setElements = useMessagesStore((s) => s.setElements); + const setTasklists = useMessagesStore((s) => s.setTaskList); + const setActions = useMessagesStore((s) => s.setActions); + const setChatSettingsInputs = useMessagesStore((s) => s.setChatInputs); + const setTokenCount = useMessagesStore((s) => s.setTokenCount); + const chatProfile = useChatStore((s) => s.chatProfile); + const setChatProfile = useChatStore((s) => s.setChatProfile); + const idToResume = useThreadStore((s) => s.idToResume); + const setThreadResumeError = useThreadStore((s) => s.setResumeThreadError); + + const currentThreadId = useThreadStore((s) => s.currentThreadId); + const setCurrentThreadId = useThreadStore((s) => s.setCurrentThreadId); // Use currentThreadId as thread id in websocket header useEffect(() => { @@ -93,10 +71,12 @@ const useChatSession = () => { const _connect = useCallback( ({ transports, - userEnv + userEnv, + authToken }: { transports?: string[]; userEnv: Record; + authToken?: string; }) => { const { protocol, host, pathname } = new URL(client.httpEndpoint); const uri = `${protocol}//${host}`; @@ -110,19 +90,25 @@ const useChatSession = () => { withCredentials: true, transports, auth: { + token: authToken, clientType: client.type, sessionId, threadId: idToResume || '', userEnv: JSON.stringify(userEnv), chatProfile: chatProfile ? encodeURIComponent(chatProfile) : '' - } + }, + extraHeaders: authToken + ? { + Authorization: `Bearer ${authToken}` + } + : {} }); + setSession((old) => { old?.socket?.removeAllListeners(); old?.socket?.close(); - return { - socket - }; + + return { socket }; }); socket.on('connect', () => { diff --git a/libs/react-client/src/useConfig.ts b/libs/react-client/src/useConfig.ts index 9f1ae60978..07ee81f9b9 100644 --- a/libs/react-client/src/useConfig.ts +++ b/libs/react-client/src/useConfig.ts @@ -1,12 +1,11 @@ import { useEffect } from 'react'; -import { useRecoilState } from 'recoil'; import { useApi, useAuth } from './api'; -import { configState } from './state'; +import { useConfigStore } from './store/config'; import { IChainlitConfig } from './types'; const useConfig = () => { - const [config, setConfig] = useRecoilState(configState); + const { config, setConfig } = useConfigStore(); const { isAuthenticated } = useAuth(); const language = navigator.language || 'en-US';