From b6bef85ac070dd1f7dd4c9076fe52ad5682c3821 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Mon, 5 Feb 2024 13:27:44 +0000 Subject: [PATCH 1/3] fix: ensure the lensProfile is passed for every seller to the Explore page/Products (OfferList) --- src/components/config/ConfigProvider.tsx | 3 +++ src/components/offers/OfferList.tsx | 9 ++++++++- src/pages/profile/seller/Offers.tsx | 10 ++++++++-- src/pages/profile/seller/Seller.tsx | 2 +- src/pages/profile/seller/Tabs.tsx | 16 ++++++++++------ 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/components/config/ConfigProvider.tsx b/src/components/config/ConfigProvider.tsx index c45db94c7..abfd750d4 100644 --- a/src/components/config/ConfigProvider.tsx +++ b/src/components/config/ConfigProvider.tsx @@ -1,6 +1,7 @@ import { ProtocolConfig } from "@bosonprotocol/react-kit"; import { MagicProvider } from "components/magicLink/MagicContext"; import { + CONFIG, defaultEnvConfig, envConfigsFilteredByEnv, getDappConfig @@ -33,6 +34,8 @@ function SyncCurrentConfigId({ export function ConfigProvider({ children }: ConfigProviderProps) { const [envConfig, setEnvConfig] = useState(defaultEnvConfig); const dappConfig = getDappConfig(envConfig || defaultEnvConfig); + // TODO: change at core-component level + dappConfig.lens.ipfsGateway = CONFIG.ipfsGateway; return ( diff --git a/src/components/offers/OfferList.tsx b/src/components/offers/OfferList.tsx index b621f650c..c2adb6bd8 100644 --- a/src/components/offers/OfferList.tsx +++ b/src/components/offers/OfferList.tsx @@ -7,6 +7,7 @@ import styled from "styled-components"; import { BosonRoutes } from "../../lib/routing/routes"; import { colors } from "../../lib/styles/colors"; import { Offer } from "../../lib/types/offer"; +import { Profile } from "../../lib/utils/hooks/lens/graphql/generated"; import { useKeepQueryParamsNavigate } from "../../lib/utils/hooks/useKeepQueryParamsNavigate"; import { useIsCustomStoreValueChanged } from "../../pages/custom-store/useIsCustomStoreValueChanged"; import { ExtendedOffer } from "../../pages/explore/WithAllOffers"; @@ -30,6 +31,10 @@ interface Props { itemsPerRow?: Partial; breadcrumbs?: boolean; numOffers: number; + seller: { + sellerId: string; + lensProfile?: Profile; + }; } const Container = styled.div<{ $isPrimaryBgChanged: boolean }>` @@ -61,7 +66,8 @@ export default function OfferList({ numOffers, showInvalidOffers, itemsPerRow, - breadcrumbs + breadcrumbs, + seller }: Props) { const isPrimaryBgChanged = useIsCustomStoreValueChanged("primaryBgColor"); const navigate = useKeepQueryParamsNavigate(); @@ -165,6 +171,7 @@ export default function OfferList({ key={offer.id} offer={offer} dataTestId="offer" + lensProfile={seller?.lensProfile} /> ) ); diff --git a/src/pages/profile/seller/Offers.tsx b/src/pages/profile/seller/Offers.tsx index f99fa2cb0..4e4610726 100644 --- a/src/pages/profile/seller/Offers.tsx +++ b/src/pages/profile/seller/Offers.tsx @@ -2,11 +2,15 @@ import { useMemo } from "react"; import { Action } from "../../../components/offer/OfferCard"; import OfferList from "../../../components/offers/OfferList"; +import { Profile } from "../../../lib/utils/hooks/lens/graphql/generated"; import { ExtendedSeller } from "../../explore/WithAllOffers"; interface Props { products: ExtendedSeller; - sellerId: string; + seller: { + sellerId: string; + lensProfile?: Profile; + }; action: Action; showInvalidOffers: boolean; isPrivateProfile: boolean; @@ -18,7 +22,8 @@ export default function Offers({ action, showInvalidOffers, isPrivateProfile, - isLoading + isLoading, + seller }: Props) { const allOffers = useMemo(() => { return products?.offers || []; @@ -41,6 +46,7 @@ export default function Offers({ l: 3, xl: 3 }} + seller={seller} /> ); } diff --git a/src/pages/profile/seller/Seller.tsx b/src/pages/profile/seller/Seller.tsx index 63953a0c4..3e3ac18c0 100644 --- a/src/pages/profile/seller/Seller.tsx +++ b/src/pages/profile/seller/Seller.tsx @@ -317,7 +317,7 @@ export default function Seller() { diff --git a/src/pages/profile/seller/Tabs.tsx b/src/pages/profile/seller/Tabs.tsx index 6d7c0131e..17a4e7125 100644 --- a/src/pages/profile/seller/Tabs.tsx +++ b/src/pages/profile/seller/Tabs.tsx @@ -7,6 +7,7 @@ import { AccountQueryParameters } from "../../../lib/routing/parameters"; import { useQueryParameter } from "../../../lib/routing/useQueryParameter"; import { breakpoint } from "../../../lib/styles/breakpoint"; import { colors } from "../../../lib/styles/colors"; +import { Profile } from "../../../lib/utils/hooks/lens/graphql/generated"; import { ExtendedSeller } from "../../explore/WithAllOffers"; import { ProfileSectionWrapper } from "../ProfilePage.styles"; import Exchanges from "./Exchanges"; @@ -110,7 +111,10 @@ const tabIdentifier = "id" as const; interface Props { products: ExtendedSeller; - sellerId: string; + seller: { + sellerId: string; + lensProfile?: Profile; + }; isErrorSellers: boolean; isPrivateProfile: boolean; isLoading: boolean; @@ -118,7 +122,7 @@ interface Props { export default function Tabs({ products, isPrivateProfile, - sellerId, + seller, isErrorSellers, isLoading }: Props) { @@ -130,7 +134,7 @@ export default function Tabs({ content: ( + content: }, { id: "redemptions", title: "Redemptions", - content: + content: } ]; return tabsData; - }, [sellerId, isPrivateProfile, products, isLoading]); + }, [seller, isPrivateProfile, products, isLoading]); const [currentTab, setCurrentTab] = useQueryParameter( AccountQueryParameters.tab ); From 13875ffc8f93c79a53d49c5b1768f4a5d6528cbd Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Mon, 5 Feb 2024 13:29:38 +0000 Subject: [PATCH 2/3] chore: small refactor --- src/components/config/ConfigProvider.tsx | 3 --- src/lib/config.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/config/ConfigProvider.tsx b/src/components/config/ConfigProvider.tsx index abfd750d4..c45db94c7 100644 --- a/src/components/config/ConfigProvider.tsx +++ b/src/components/config/ConfigProvider.tsx @@ -1,7 +1,6 @@ import { ProtocolConfig } from "@bosonprotocol/react-kit"; import { MagicProvider } from "components/magicLink/MagicContext"; import { - CONFIG, defaultEnvConfig, envConfigsFilteredByEnv, getDappConfig @@ -34,8 +33,6 @@ function SyncCurrentConfigId({ export function ConfigProvider({ children }: ConfigProviderProps) { const [envConfig, setEnvConfig] = useState(defaultEnvConfig); const dappConfig = getDappConfig(envConfig || defaultEnvConfig); - // TODO: change at core-component level - dappConfig.lens.ipfsGateway = CONFIG.ipfsGateway; return ( diff --git a/src/lib/config.ts b/src/lib/config.ts index 41f83daee..077393436 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -212,7 +212,7 @@ export const getDappConfig = (envConfig: ProtocolConfig) => { lensHandleExtension: envConfig.chainId === 137 ? ".lens" : ".test", availableOnNetwork: [80001, 137].includes(envConfig.chainId), apiLink: envConfig.lens?.apiLink, - ipfsGateway: envConfig.lens?.ipfsGateway, + ipfsGateway: CONFIG.ipfsGateway, LENS_HUB_CONTRACT: envConfig.lens?.LENS_HUB_CONTRACT, LENS_PERIPHERY_CONTRACT: envConfig.lens?.LENS_PERIPHERY_CONTRACT, LENS_PROFILES_CONTRACT_ADDRESS: From e23dc95b38b105f95a06e09971cc225af3a37d48 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Mon, 5 Feb 2024 14:48:38 +0000 Subject: [PATCH 3/3] upgrade core-component --- package-lock.json | 102 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4babd485e..46ed9a34c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.26.0-alpha.5", + "@bosonprotocol/react-kit": "^0.26.0-alpha.7", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.6.1", @@ -2305,11 +2305,11 @@ } }, "node_modules/@bosonprotocol/common": { - "version": "1.25.2-alpha.3", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.2-alpha.3.tgz", - "integrity": "sha512-rsOl6KIriiVLTKGcl0piMXbMMwZT4Ol2ujdvthZPBpJOmRHzF4AmrXzPdstMiqDKPngIroakbpwf3A4Ln4yWEQ==", + "version": "1.25.2-alpha.5", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.2-alpha.5.tgz", + "integrity": "sha512-MOaE6MHjjWKWOhFCD9n9zIc/l8B6pYJnDZzpRbxoOGZL+WRPVpSPB8EN5m8k1Kzx3KE0PiROaBxXqSiIwXVJ9g==", "dependencies": { - "@bosonprotocol/metadata": "^1.14.0-alpha.1", + "@bosonprotocol/metadata": "^1.14.0-alpha.3", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -2319,11 +2319,11 @@ } }, "node_modules/@bosonprotocol/core-sdk": { - "version": "1.36.0-alpha.1", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.36.0-alpha.1.tgz", - "integrity": "sha512-BLZSA60zDAcXYfy+spOZQT6IYkpAqg2EOarh/5cn6vn0VWi/THGuYpo8AsKYINPT5iq4lwQnjNPF0sRP2Vop5A==", + "version": "1.36.0-alpha.3", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.36.0-alpha.3.tgz", + "integrity": "sha512-cpbm/4SjgAi5ueEO9b2+ssLmyY0WQYdV+rSn3EU+I18N+yrHHhzytvwDU0IIn2wH5N3dbR2NZFeh3TCeinizBQ==", "dependencies": { - "@bosonprotocol/common": "^1.25.2-alpha.3", + "@bosonprotocol/common": "^1.25.2-alpha.5", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -2339,44 +2339,44 @@ } }, "node_modules/@bosonprotocol/ethers-sdk": { - "version": "1.12.13-alpha.3", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.13-alpha.3.tgz", - "integrity": "sha512-Cdy5UwNdhO5TOyKcsM/9RtU93MOB7tNwjtffu30+stzrNbHfraHp7ieh/jvvq2iP1wL+EF96W99d6js1FrvWGA==", + "version": "1.12.13-alpha.5", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.13-alpha.5.tgz", + "integrity": "sha512-KXs4zOSzJdiKHW971sULd0cJJmHFPBo87AhTDkzX1B5Ipc+22oShDzQ6x0wT6dGPBCy2JGoAYcdz6mUHqgXmrw==", "dependencies": { - "@bosonprotocol/common": "^1.25.2-alpha.3" + "@bosonprotocol/common": "^1.25.2-alpha.5" }, "peerDependencies": { "ethers": "^5.5.0" } }, "node_modules/@bosonprotocol/ipfs-storage": { - "version": "1.11.0-alpha.1", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.11.0-alpha.1.tgz", - "integrity": "sha512-aCu+sA+B71LbmBaVysUepGH8sG4saQCFbRjDCJV1JINp0941TJaeBhexXY0b8beOqgMOFPCLJP0wDPqEbYohVw==", + "version": "1.11.0-alpha.3", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.11.0-alpha.3.tgz", + "integrity": "sha512-PQeVWSfZuC728TXM+uypQU4dJhbovcYyRLkHxt+nuI5EMGDp+uBIR3VoWur1Vv+cEZry1wnIheJbO9e5kpcj0Q==", "dependencies": { - "@bosonprotocol/metadata": "^1.14.0-alpha.1", + "@bosonprotocol/metadata": "^1.14.0-alpha.3", "ipfs-http-client": "^56.0.1", "multiformats": "^9.6.4", "uint8arrays": "^3.0.0" } }, "node_modules/@bosonprotocol/metadata": { - "version": "1.14.0-alpha.1", - "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.14.0-alpha.1.tgz", - "integrity": "sha512-/u+Zp3JwGTp/HQehygiKfMv5gOEQ6sWufjIMZ29gaxXE6nRGaOJe4aFykBK4cPe4FX7ImrZhg4fOGM4j8BcDTw==", + "version": "1.14.0-alpha.3", + "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.14.0-alpha.3.tgz", + "integrity": "sha512-DADHIQYUgZXBek6jpUwrMkNHi7Dy7/NbMrHgY9AWRGVLuDR4Y0V86wC/oZojEZAK3xrusRMAZ63TuS9K6Zkm2w==", "dependencies": { "schema-to-yup": "^1.11.11" } }, "node_modules/@bosonprotocol/react-kit": { - "version": "0.26.0-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.26.0-alpha.5.tgz", - "integrity": "sha512-uzk2Ss+gA0xQi66gCcr1upGrXVJqwJKm50O7J/yKq8znW1NB1yhgKCQ1hL3xTvCJ8qiNNHaT3Y5B6/7XTDg64w==", + "version": "0.26.0-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.26.0-alpha.7.tgz", + "integrity": "sha512-jcDAyxBcdgEfbeb3wZDPSPCoRsp+8AbJkg2AFPLFgIvHaWScSNyb5zhQuwtUbw9BY222KSBkz9cjT5upcKFDiw==", "dependencies": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.36.0-alpha.1", - "@bosonprotocol/ethers-sdk": "^1.12.13-alpha.3", - "@bosonprotocol/ipfs-storage": "^1.11.0-alpha.1", + "@bosonprotocol/core-sdk": "^1.36.0-alpha.3", + "@bosonprotocol/ethers-sdk": "^1.12.13-alpha.5", + "@bosonprotocol/ipfs-storage": "^1.11.0-alpha.3", "@davatar/react": "1.11.1", "@ethersproject/units": "5.6.0", "@glidejs/glide": "3.6.0", @@ -48092,11 +48092,11 @@ } }, "@bosonprotocol/common": { - "version": "1.25.2-alpha.3", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.2-alpha.3.tgz", - "integrity": "sha512-rsOl6KIriiVLTKGcl0piMXbMMwZT4Ol2ujdvthZPBpJOmRHzF4AmrXzPdstMiqDKPngIroakbpwf3A4Ln4yWEQ==", + "version": "1.25.2-alpha.5", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.2-alpha.5.tgz", + "integrity": "sha512-MOaE6MHjjWKWOhFCD9n9zIc/l8B6pYJnDZzpRbxoOGZL+WRPVpSPB8EN5m8k1Kzx3KE0PiROaBxXqSiIwXVJ9g==", "requires": { - "@bosonprotocol/metadata": "^1.14.0-alpha.1", + "@bosonprotocol/metadata": "^1.14.0-alpha.3", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -48106,11 +48106,11 @@ } }, "@bosonprotocol/core-sdk": { - "version": "1.36.0-alpha.1", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.36.0-alpha.1.tgz", - "integrity": "sha512-BLZSA60zDAcXYfy+spOZQT6IYkpAqg2EOarh/5cn6vn0VWi/THGuYpo8AsKYINPT5iq4lwQnjNPF0sRP2Vop5A==", + "version": "1.36.0-alpha.3", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.36.0-alpha.3.tgz", + "integrity": "sha512-cpbm/4SjgAi5ueEO9b2+ssLmyY0WQYdV+rSn3EU+I18N+yrHHhzytvwDU0IIn2wH5N3dbR2NZFeh3TCeinizBQ==", "requires": { - "@bosonprotocol/common": "^1.25.2-alpha.3", + "@bosonprotocol/common": "^1.25.2-alpha.5", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -48126,41 +48126,41 @@ } }, "@bosonprotocol/ethers-sdk": { - "version": "1.12.13-alpha.3", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.13-alpha.3.tgz", - "integrity": "sha512-Cdy5UwNdhO5TOyKcsM/9RtU93MOB7tNwjtffu30+stzrNbHfraHp7ieh/jvvq2iP1wL+EF96W99d6js1FrvWGA==", + "version": "1.12.13-alpha.5", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.13-alpha.5.tgz", + "integrity": "sha512-KXs4zOSzJdiKHW971sULd0cJJmHFPBo87AhTDkzX1B5Ipc+22oShDzQ6x0wT6dGPBCy2JGoAYcdz6mUHqgXmrw==", "requires": { - "@bosonprotocol/common": "^1.25.2-alpha.3" + "@bosonprotocol/common": "^1.25.2-alpha.5" } }, "@bosonprotocol/ipfs-storage": { - "version": "1.11.0-alpha.1", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.11.0-alpha.1.tgz", - "integrity": "sha512-aCu+sA+B71LbmBaVysUepGH8sG4saQCFbRjDCJV1JINp0941TJaeBhexXY0b8beOqgMOFPCLJP0wDPqEbYohVw==", + "version": "1.11.0-alpha.3", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.11.0-alpha.3.tgz", + "integrity": "sha512-PQeVWSfZuC728TXM+uypQU4dJhbovcYyRLkHxt+nuI5EMGDp+uBIR3VoWur1Vv+cEZry1wnIheJbO9e5kpcj0Q==", "requires": { - "@bosonprotocol/metadata": "^1.14.0-alpha.1", + "@bosonprotocol/metadata": "^1.14.0-alpha.3", "ipfs-http-client": "^56.0.1", "multiformats": "^9.6.4", "uint8arrays": "^3.0.0" } }, "@bosonprotocol/metadata": { - "version": "1.14.0-alpha.1", - "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.14.0-alpha.1.tgz", - "integrity": "sha512-/u+Zp3JwGTp/HQehygiKfMv5gOEQ6sWufjIMZ29gaxXE6nRGaOJe4aFykBK4cPe4FX7ImrZhg4fOGM4j8BcDTw==", + "version": "1.14.0-alpha.3", + "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.14.0-alpha.3.tgz", + "integrity": "sha512-DADHIQYUgZXBek6jpUwrMkNHi7Dy7/NbMrHgY9AWRGVLuDR4Y0V86wC/oZojEZAK3xrusRMAZ63TuS9K6Zkm2w==", "requires": { "schema-to-yup": "^1.11.11" } }, "@bosonprotocol/react-kit": { - "version": "0.26.0-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.26.0-alpha.5.tgz", - "integrity": "sha512-uzk2Ss+gA0xQi66gCcr1upGrXVJqwJKm50O7J/yKq8znW1NB1yhgKCQ1hL3xTvCJ8qiNNHaT3Y5B6/7XTDg64w==", + "version": "0.26.0-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.26.0-alpha.7.tgz", + "integrity": "sha512-jcDAyxBcdgEfbeb3wZDPSPCoRsp+8AbJkg2AFPLFgIvHaWScSNyb5zhQuwtUbw9BY222KSBkz9cjT5upcKFDiw==", "requires": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.36.0-alpha.1", - "@bosonprotocol/ethers-sdk": "^1.12.13-alpha.3", - "@bosonprotocol/ipfs-storage": "^1.11.0-alpha.1", + "@bosonprotocol/core-sdk": "^1.36.0-alpha.3", + "@bosonprotocol/ethers-sdk": "^1.12.13-alpha.5", + "@bosonprotocol/ipfs-storage": "^1.11.0-alpha.3", "@davatar/react": "1.11.1", "@ethersproject/units": "5.6.0", "@glidejs/glide": "3.6.0", diff --git a/package.json b/package.json index 3b574b00e..dce315d9e 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.26.0-alpha.5", + "@bosonprotocol/react-kit": "^0.26.0-alpha.7", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.6.1",