From 4733d77ded200e2a4d039b7c2e3f26608b2f3fc5 Mon Sep 17 00:00:00 2001 From: daria-github Date: Fri, 12 Jan 2024 12:56:57 -0800 Subject: [PATCH 01/21] add portable consent --- package-lock.json | 277 +++++++++++------- package.json | 3 +- .../ConversationList/ConversationList.tsx | 12 +- .../FullConversation/FullConversation.tsx | 43 ++- .../HeaderDropdown/HeaderDropdown.tsx | 120 ++------ .../components/MessageInput/MessageInput.tsx | 42 +-- .../MessagePreviewCard/MessagePreviewCard.tsx | 14 +- .../ConversationListController.tsx | 42 ++- .../FullConversationController.tsx | 8 +- src/controllers/HeaderDropdownController.tsx | 1 - src/controllers/MessageInputController.tsx | 1 + .../MessagePreviewCardController.tsx | 3 + src/hooks/useStreamAllMessages.tsx | 2 + src/locales/en_US.json | 10 + src/pages/inbox.tsx | 29 +- src/store/xmtp.tsx | 6 + vite.config.ts | 3 + 17 files changed, 377 insertions(+), 239 deletions(-) diff --git a/package-lock.json b/package-lock.json index a837e22b..ee28d0a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@xmtp/content-type-remote-attachment": "^1.1.4", "@xmtp/content-type-reply": "^1.1.5", "@xmtp/experimental-content-type-screen-effect": "^1.0.2", - "@xmtp/react-sdk": "^3.0.0", + "@xmtp/react-sdk": "^4.0.0", "buffer": "^6.0.3", "date-fns": "^2.29.3", "dexie": "^3.2.4", @@ -42,6 +42,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-media-recorder-2": "^1.6.23", "react-medium-image-zoom": "^5.1.6", + "react-modal": "^3.16.1", "react-qrcode-logo": "^2.9.0", "react-router-dom": "^6.12.0", "react-timer-hook": "^3.0.6", @@ -101,9 +102,9 @@ } }, "node_modules/@adraffy/ens-normalize": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz", - "integrity": "sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", @@ -14899,18 +14900,6 @@ "@xmtp/xmtp-js": "^11.1.1" } }, - "node_modules/@xmtp/content-type-read-receipt": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@xmtp/content-type-read-receipt/-/content-type-read-receipt-1.1.5.tgz", - "integrity": "sha512-/CM/JAuEo+lnUQGJFG3UZ+t5rqql8sA/eLzPc0sJJMzGLCCfogd/SngS8rNkz4KI7yI5SXrXaksAsv5/zqXUHA==", - "dependencies": { - "@xmtp/proto": "^3.29.0", - "@xmtp/xmtp-js": "^11.1.2" - }, - "peerDependencies": { - "@xmtp/xmtp-js": "^11.1.1" - } - }, "node_modules/@xmtp/content-type-remote-attachment": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@xmtp/content-type-remote-attachment/-/content-type-remote-attachment-1.1.4.tgz", @@ -14959,32 +14948,40 @@ } }, "node_modules/@xmtp/react-sdk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@xmtp/react-sdk/-/react-sdk-3.0.0.tgz", - "integrity": "sha512-xaMQo5N82mSyC551Ktztp+N8aN/kMdZQ6qu/8BJCCErigWV1XXzOHCZr1tgONQHRFjnasmRdqsaTdiGZNatCbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@xmtp/react-sdk/-/react-sdk-4.0.0.tgz", + "integrity": "sha512-u8aL771ZA6qpyBbLNZ2TP3g0Y+DhRbfdpJykociA28tTdE6hF63ULWHVgEhkZb93AZ8JTsG9c0DRLW6crVUoZQ==", "dependencies": { "@xmtp/content-type-reaction": "^1.1.3", - "@xmtp/content-type-read-receipt": "^1.1.5", "@xmtp/content-type-remote-attachment": "^1.1.4", "@xmtp/content-type-reply": "^1.1.5", - "@xmtp/xmtp-js": "^11.2.0", + "@xmtp/xmtp-js": "^11.3.0", "async-mutex": "^0.4.0", - "date-fns": "^2.30.0", + "date-fns": "^3.1.0", "dexie": "^3.2.4", - "dexie-react-hooks": "^1.1.6", + "dexie-react-hooks": "^1.1.7", "react": "^18.2.0", "uuid": "^9.0.1", - "viem": "^1.13.0", - "zod": "^3.22.2" + "viem": "^1.19.6", + "zod": "^3.22.4" }, "engines": { "node": ">=18" }, "peerDependencies": { - "@xmtp/xmtp-js": "^11.2.0", + "@xmtp/xmtp-js": "^11.3.0", "react": ">=16.14" } }, + "node_modules/@xmtp/react-sdk/node_modules/date-fns": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.2.0.tgz", + "integrity": "sha512-E4KWKavANzeuusPi0jUjpuI22SURAznGkx7eZV+4i6x2A+IZxAMcajgkvuDAU1bg40+xuhW1zRdVIIM/4khuIg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/@xmtp/react-sdk/node_modules/uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", @@ -14997,13 +14994,19 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/@xmtp/user-preferences-bindings-wasm": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@xmtp/user-preferences-bindings-wasm/-/user-preferences-bindings-wasm-0.3.4.tgz", + "integrity": "sha512-4d0j8QDZT8Z9DXIjxRJh7M1DjLNWcPV6807eeMN79gwF9SWbR1CXGSnBNqSrOgVu9nQSWqtg6qfyrrlQ3yHybA==" + }, "node_modules/@xmtp/xmtp-js": { - "version": "11.2.3", - "resolved": "https://registry.npmjs.org/@xmtp/xmtp-js/-/xmtp-js-11.2.3.tgz", - "integrity": "sha512-uDZcqmOuAtSNVQ4pk7D1GvVPe12Os6oqesyPQQ5vt3tbeteMgK7lqrHZ1PKH4ZVoYuYJm4Rgaz2hKKGM9KsmQw==", + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/@xmtp/xmtp-js/-/xmtp-js-11.3.2.tgz", + "integrity": "sha512-N2f7R6mBEop3ZUiXi1vqrsOz/BZ47kGkhkNHXyV4kyHIMFn/0bNV58CeDgDfYyiDeoZHGeVMsfv6tOcV70LY0g==", "dependencies": { "@noble/secp256k1": "^1.5.2", - "@xmtp/proto": "^3.29.0", + "@xmtp/proto": "^3.34.0", + "@xmtp/user-preferences-bindings-wasm": "^0.3.4", "async-mutex": "^0.4.0", "elliptic": "^6.5.4", "ethers": "^5.5.3", @@ -18748,9 +18751,9 @@ } }, "node_modules/dexie-react-hooks": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/dexie-react-hooks/-/dexie-react-hooks-1.1.6.tgz", - "integrity": "sha512-xSblWtmPwhafWNWMECsW7zMMmBu8goH3QqTxEfwBNoNG1mgsM0oFclippev7ss9HhKICqBwTjgqpscci5Ed4mA==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/dexie-react-hooks/-/dexie-react-hooks-1.1.7.tgz", + "integrity": "sha512-Lwv5W0Hk+uOW3kGnsU9GZoR1er1B7WQ5DSdonoNG+focTNeJbHW6vi6nBoX534VKI3/uwHebYzSw1fwY6a7mTw==", "peerDependencies": { "@types/react": ">=16", "dexie": "^3.2 || ^4.0.1-alpha", @@ -20797,6 +20800,11 @@ "node": ">=4" } }, + "node_modules/exenv": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", + "integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==" + }, "node_modules/express": { "version": "4.18.2", "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", @@ -23571,6 +23579,20 @@ "ws": "*" } }, + "node_modules/isows": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", + "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wagmi-dev" + } + ], + "peerDependencies": { + "ws": "*" + } + }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -28501,6 +28523,11 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "node_modules/react-lifecycles-compat": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + }, "node_modules/react-media-recorder-2": { "version": "1.6.23", "resolved": "https://registry.npmjs.org/react-media-recorder-2/-/react-media-recorder-2-1.6.23.tgz", @@ -28525,6 +28552,24 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-modal": { + "version": "3.16.1", + "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.1.tgz", + "integrity": "sha512-VStHgI3BVcGo7OXczvnJN7yT2TWHJPDXZWyI/a0ssFNhGZWsPmB8cF0z33ewDXq4VfYMO1vXgiv/g8Nj9NDyWg==", + "dependencies": { + "exenv": "^1.2.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.0", + "warning": "^4.0.3" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "react": "^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18", + "react-dom": "^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18" + } + }, "node_modules/react-native-fetch-api": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-native-fetch-api/-/react-native-fetch-api-3.0.0.tgz", @@ -31805,24 +31850,23 @@ } }, "node_modules/viem": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/viem/-/viem-1.13.2.tgz", - "integrity": "sha512-iaiExxe0WIbf4Yvqtk/nDaFbKg6CBtW6xY6bGUNBV8/lx9PhSeFneSK/LogC2NPo0X2LpCLaxx+E6MUqL5JEAg==", + "version": "1.21.4", + "resolved": "https://registry.npmjs.org/viem/-/viem-1.21.4.tgz", + "integrity": "sha512-BNVYdSaUjeS2zKQgPs+49e5JKocfo60Ib2yiXOWBT6LuVxY1I/6fFX3waEtpXvL1Xn4qu+BVitVtMh9lyThyhQ==", "funding": [ { "type": "github", - "url": "https://github.com/sponsors/wagmi-dev" + "url": "https://github.com/sponsors/wevm" } ], "dependencies": { - "@adraffy/ens-normalize": "1.9.4", + "@adraffy/ens-normalize": "1.10.0", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@scure/bip32": "1.3.2", "@scure/bip39": "1.2.1", - "@types/ws": "^8.5.5", "abitype": "0.9.8", - "isomorphic-ws": "5.0.0", + "isows": "1.0.3", "ws": "8.13.0" }, "peerDependencies": { @@ -31834,14 +31878,6 @@ } } }, - "node_modules/viem/node_modules/@types/ws": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.6.tgz", - "integrity": "sha512-8B5EO9jLVCy+B58PLHvLDuOD8DRVMgQzq8d55SjLCOn9kqGyqOvy27exVaTio1q1nX5zLu8/6N0n2ThSxOM6tg==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/viem/node_modules/abitype": { "version": "0.9.8", "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.9.8.tgz", @@ -31865,14 +31901,6 @@ } } }, - "node_modules/viem/node_modules/isomorphic-ws": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", - "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", - "peerDependencies": { - "ws": "*" - } - }, "node_modules/vite": { "version": "4.3.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz", @@ -32285,6 +32313,14 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/warning": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -33135,9 +33171,9 @@ } }, "node_modules/zod": { - "version": "3.22.2", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.2.tgz", - "integrity": "sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg==", + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", "funding": { "url": "https://github.com/sponsors/colinhacks" } @@ -33168,9 +33204,9 @@ }, "dependencies": { "@adraffy/ens-normalize": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz", - "integrity": "sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" }, "@alloc/quick-lru": { "version": "5.2.0", @@ -44372,15 +44408,6 @@ "@xmtp/xmtp-js": "^11.1.2" } }, - "@xmtp/content-type-read-receipt": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@xmtp/content-type-read-receipt/-/content-type-read-receipt-1.1.5.tgz", - "integrity": "sha512-/CM/JAuEo+lnUQGJFG3UZ+t5rqql8sA/eLzPc0sJJMzGLCCfogd/SngS8rNkz4KI7yI5SXrXaksAsv5/zqXUHA==", - "requires": { - "@xmtp/proto": "^3.29.0", - "@xmtp/xmtp-js": "^11.1.2" - } - }, "@xmtp/content-type-remote-attachment": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@xmtp/content-type-remote-attachment/-/content-type-remote-attachment-1.1.4.tgz", @@ -44420,25 +44447,29 @@ } }, "@xmtp/react-sdk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@xmtp/react-sdk/-/react-sdk-3.0.0.tgz", - "integrity": "sha512-xaMQo5N82mSyC551Ktztp+N8aN/kMdZQ6qu/8BJCCErigWV1XXzOHCZr1tgONQHRFjnasmRdqsaTdiGZNatCbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@xmtp/react-sdk/-/react-sdk-4.0.0.tgz", + "integrity": "sha512-u8aL771ZA6qpyBbLNZ2TP3g0Y+DhRbfdpJykociA28tTdE6hF63ULWHVgEhkZb93AZ8JTsG9c0DRLW6crVUoZQ==", "requires": { "@xmtp/content-type-reaction": "^1.1.3", - "@xmtp/content-type-read-receipt": "^1.1.5", "@xmtp/content-type-remote-attachment": "^1.1.4", "@xmtp/content-type-reply": "^1.1.5", - "@xmtp/xmtp-js": "^11.2.0", + "@xmtp/xmtp-js": "^11.3.0", "async-mutex": "^0.4.0", - "date-fns": "^2.30.0", + "date-fns": "^3.1.0", "dexie": "^3.2.4", - "dexie-react-hooks": "^1.1.6", + "dexie-react-hooks": "^1.1.7", "react": "^18.2.0", "uuid": "^9.0.1", - "viem": "^1.13.0", - "zod": "^3.22.2" + "viem": "^1.19.6", + "zod": "^3.22.4" }, "dependencies": { + "date-fns": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.2.0.tgz", + "integrity": "sha512-E4KWKavANzeuusPi0jUjpuI22SURAznGkx7eZV+4i6x2A+IZxAMcajgkvuDAU1bg40+xuhW1zRdVIIM/4khuIg==" + }, "uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", @@ -44446,13 +44477,19 @@ } } }, + "@xmtp/user-preferences-bindings-wasm": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@xmtp/user-preferences-bindings-wasm/-/user-preferences-bindings-wasm-0.3.4.tgz", + "integrity": "sha512-4d0j8QDZT8Z9DXIjxRJh7M1DjLNWcPV6807eeMN79gwF9SWbR1CXGSnBNqSrOgVu9nQSWqtg6qfyrrlQ3yHybA==" + }, "@xmtp/xmtp-js": { - "version": "11.2.3", - "resolved": "https://registry.npmjs.org/@xmtp/xmtp-js/-/xmtp-js-11.2.3.tgz", - "integrity": "sha512-uDZcqmOuAtSNVQ4pk7D1GvVPe12Os6oqesyPQQ5vt3tbeteMgK7lqrHZ1PKH4ZVoYuYJm4Rgaz2hKKGM9KsmQw==", + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/@xmtp/xmtp-js/-/xmtp-js-11.3.2.tgz", + "integrity": "sha512-N2f7R6mBEop3ZUiXi1vqrsOz/BZ47kGkhkNHXyV4kyHIMFn/0bNV58CeDgDfYyiDeoZHGeVMsfv6tOcV70LY0g==", "requires": { "@noble/secp256k1": "^1.5.2", - "@xmtp/proto": "^3.29.0", + "@xmtp/proto": "^3.34.0", + "@xmtp/user-preferences-bindings-wasm": "^0.3.4", "async-mutex": "^0.4.0", "elliptic": "^6.5.4", "ethers": "^5.5.3", @@ -47337,9 +47374,9 @@ "integrity": "sha512-VKoTQRSv7+RnffpOJ3Dh6ozknBqzWw/F3iqMdsZg958R0AS8AnY9x9d1lbwENr0gzeGJHXKcGhAMRaqys6SxqA==" }, "dexie-react-hooks": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/dexie-react-hooks/-/dexie-react-hooks-1.1.6.tgz", - "integrity": "sha512-xSblWtmPwhafWNWMECsW7zMMmBu8goH3QqTxEfwBNoNG1mgsM0oFclippev7ss9HhKICqBwTjgqpscci5Ed4mA==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/dexie-react-hooks/-/dexie-react-hooks-1.1.7.tgz", + "integrity": "sha512-Lwv5W0Hk+uOW3kGnsU9GZoR1er1B7WQ5DSdonoNG+focTNeJbHW6vi6nBoX534VKI3/uwHebYzSw1fwY6a7mTw==", "requires": {} }, "didyoumean": { @@ -48964,6 +49001,11 @@ "pify": "^2.2.0" } }, + "exenv": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", + "integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==" + }, "express": { "version": "4.18.2", "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", @@ -51072,6 +51114,12 @@ "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", "requires": {} }, + "isows": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", + "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "requires": {} + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -54937,6 +54985,11 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "react-lifecycles-compat": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + }, "react-media-recorder-2": { "version": "1.6.23", "resolved": "https://registry.npmjs.org/react-media-recorder-2/-/react-media-recorder-2-1.6.23.tgz", @@ -54952,6 +55005,17 @@ "integrity": "sha512-0QolPce1vNJsF5HKrGkU1UT6kLNvY9EOnLBqz++LlVnBQduaHLkJlY73ayj3SxY09XWRrnxKDMTHPDkrQYdREw==", "requires": {} }, + "react-modal": { + "version": "3.16.1", + "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.1.tgz", + "integrity": "sha512-VStHgI3BVcGo7OXczvnJN7yT2TWHJPDXZWyI/a0ssFNhGZWsPmB8cF0z33ewDXq4VfYMO1vXgiv/g8Nj9NDyWg==", + "requires": { + "exenv": "^1.2.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.0", + "warning": "^4.0.3" + } + }, "react-native-fetch-api": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-native-fetch-api/-/react-native-fetch-api-3.0.0.tgz", @@ -57471,40 +57535,25 @@ } }, "viem": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/viem/-/viem-1.13.2.tgz", - "integrity": "sha512-iaiExxe0WIbf4Yvqtk/nDaFbKg6CBtW6xY6bGUNBV8/lx9PhSeFneSK/LogC2NPo0X2LpCLaxx+E6MUqL5JEAg==", + "version": "1.21.4", + "resolved": "https://registry.npmjs.org/viem/-/viem-1.21.4.tgz", + "integrity": "sha512-BNVYdSaUjeS2zKQgPs+49e5JKocfo60Ib2yiXOWBT6LuVxY1I/6fFX3waEtpXvL1Xn4qu+BVitVtMh9lyThyhQ==", "requires": { - "@adraffy/ens-normalize": "1.9.4", + "@adraffy/ens-normalize": "1.10.0", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@scure/bip32": "1.3.2", "@scure/bip39": "1.2.1", - "@types/ws": "^8.5.5", "abitype": "0.9.8", - "isomorphic-ws": "5.0.0", + "isows": "1.0.3", "ws": "8.13.0" }, "dependencies": { - "@types/ws": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.6.tgz", - "integrity": "sha512-8B5EO9jLVCy+B58PLHvLDuOD8DRVMgQzq8d55SjLCOn9kqGyqOvy27exVaTio1q1nX5zLu8/6N0n2ThSxOM6tg==", - "requires": { - "@types/node": "*" - } - }, "abitype": { "version": "0.9.8", "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.9.8.tgz", "integrity": "sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ==", "requires": {} - }, - "isomorphic-ws": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", - "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", - "requires": {} } } }, @@ -57772,6 +57821,14 @@ } } }, + "warning": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "requires": { + "loose-envify": "^1.0.0" + } + }, "watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -58463,9 +58520,9 @@ "dev": true }, "zod": { - "version": "3.22.2", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.2.tgz", - "integrity": "sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg==" + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==" }, "zustand": { "version": "4.3.8", diff --git a/package.json b/package.json index 753be559..4d2f75d4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@xmtp/content-type-remote-attachment": "^1.1.4", "@xmtp/content-type-reply": "^1.1.5", "@xmtp/experimental-content-type-screen-effect": "^1.0.2", - "@xmtp/react-sdk": "^3.0.0", + "@xmtp/react-sdk": "^4.0.0", "buffer": "^6.0.3", "date-fns": "^2.29.3", "dexie": "^3.2.4", @@ -63,6 +63,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-media-recorder-2": "^1.6.23", "react-medium-image-zoom": "^5.1.6", + "react-modal": "^3.16.1", "react-qrcode-logo": "^2.9.0", "react-router-dom": "^6.12.0", "react-timer-hook": "^3.0.6", diff --git a/src/component-library/components/ConversationList/ConversationList.tsx b/src/component-library/components/ConversationList/ConversationList.tsx index 31e42992..a779bf71 100644 --- a/src/component-library/components/ConversationList/ConversationList.tsx +++ b/src/component-library/components/ConversationList/ConversationList.tsx @@ -2,6 +2,7 @@ import type React from "react"; import { Virtuoso } from "react-virtuoso"; import { EmptyMessage } from "../EmptyMessage/EmptyMessage"; import { MessagePreviewCard } from "../MessagePreviewCard/MessagePreviewCard"; +import type { ActiveTab } from "../../../store/xmtp"; interface ConversationListProps { /** @@ -20,6 +21,10 @@ interface ConversationListProps { * Has a value been entered for the recipient? */ hasRecipientEnteredValue?: boolean; + /** + * Which tab are we on? + */ + activeTab: ActiveTab; } export const ConversationList = ({ @@ -27,16 +32,19 @@ export const ConversationList = ({ isLoading, setStartedFirstMessage, hasRecipientEnteredValue, + activeTab, }: ConversationListProps) => !messages?.length && isLoading ? (
{Array.from({ length: 12 }).map((_, idx) => ( - + ))}
) : !messages.length && !isLoading && !hasRecipientEnteredValue ? (
- + {activeTab === "messages" ? ( + + ) : null}
) : ( ; isLoading?: boolean; + address: string; } const LoadingMessage: React.FC = () => { @@ -28,9 +31,46 @@ const BeginningMessage: React.FC = () => { ); }; +const AcceptOrDeny = ({ address }: { address: string }) => { + const { t } = useTranslation(); + const { allow, deny } = useConsent(); + const setActiveTab = useXmtpStore((s) => s.setActiveTab); + const activeTab = useXmtpStore((s) => s.activeTab); + + return activeTab === "requests" ? ( +
+

{t("consent.new_message_request")}

+

{t("consent.new_message_request_description")}

+
+ + +
+
+ ) : null; +}; + export const FullConversation = ({ messages = [], isLoading = false, + address, }: FullConversationProps) => { const virtuosoRef = useRef(null); const filteredMessages = useMemo(() => { @@ -42,8 +82,9 @@ export const FullConversation = ({ ), ...filtered, + , ]; - }, [isLoading, messages]); + }, [isLoading, messages, address]); return ( ; - /** - * What is currently selected? - */ - defaultSelected?: string; - /** - * What happens on change? - */ - onChange?: () => void; /** * On new message button click? */ onClick?: () => void; - /** - * Is this dropdown disabled? - */ - disabled?: boolean; /** * What is the recipient input? */ @@ -41,25 +21,22 @@ interface HeaderDropdownProps { } export const HeaderDropdown = ({ - dropdownOptions, - defaultSelected, - onChange, onClick, - disabled, recipientInput, isMobileView, }: HeaderDropdownProps) => { const { t } = useTranslation(); - const [isOpen, setIsOpen] = useState(false); - const [currentlySelected, setCurrentlySelected] = useState( - defaultSelected || t("messages.filter_none"), - ); + const activeTab = useXmtpStore((s) => s.activeTab); + const setActiveTab = useXmtpStore((s) => s.setActiveTab); + const resetRecipient = useXmtpStore((s) => s.resetRecipient); + const setConversationTopic = useXmtpStore((s) => s.setConversationTopic); - useEffect(() => { - setCurrentlySelected(defaultSelected || t("messages.filter_none")); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [i18next.language]); + const tabs = [ + { name: "messages", testId: "messages-button" }, + { name: "requests", testId: "requests-button" }, + { name: "blocked", testId: "blocked-button" }, + ]; return (
- setIsOpen(!isOpen)}> -

{currentlySelected}

- {!disabled && } -
+ {tabs.map(({ name, testId }) => ( + + ))} {(recipientInput || isMobileView) && ( onClick?.()} @@ -80,58 +70,6 @@ export const HeaderDropdown = ({ /> )}
- - {!disabled && isOpen && ( - - {}}> -
-
- {( - dropdownOptions || [ - t("messages.filter_none"), - t("messages.filter_requests"), - ] - ).map((item) => ( -
-
- - -
-
- {item === currentlySelected && ( - - )} -
-
- ))} -
-
-
-
- )}
); }; diff --git a/src/component-library/components/MessageInput/MessageInput.tsx b/src/component-library/components/MessageInput/MessageInput.tsx index 50667499..d6ae5e8a 100644 --- a/src/component-library/components/MessageInput/MessageInput.tsx +++ b/src/component-library/components/MessageInput/MessageInput.tsx @@ -300,26 +300,28 @@ export const MessageInput = ({ {attachmentError ? (

{attachmentError}

) : ( -