@bosonprotocol/react-kit 0.30.0-alpha.1 → 0.30.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Loading.js +1 -1
- package/dist/cjs/components/Loading.js.map +1 -1
- package/dist/cjs/components/modal/components/Commit/OfferVariantView.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Commit/OfferVariantView.js +4 -1
- package/dist/cjs/components/modal/components/Commit/OfferVariantView.js.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/Confirmation/Confirmation.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/Confirmation/Confirmation.js +4 -1
- package/dist/cjs/components/modal/components/Redeem/Confirmation/Confirmation.js.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemForm.d.ts +4 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemForm.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemForm.js +13 -2
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemForm.js.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemFormView.d.ts +2 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemFormView.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemFormView.js +2 -2
- package/dist/cjs/components/modal/components/Redeem/RedeemForm/RedeemFormView.js.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemFormModel.d.ts +7 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemFormModel.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemFormModel.js +6 -0
- package/dist/cjs/components/modal/components/Redeem/RedeemFormModel.js.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemNonModal.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/RedeemNonModal.js +22 -3
- package/dist/cjs/components/modal/components/Redeem/RedeemNonModal.js.map +1 -1
- package/dist/cjs/components/modal/components/common/OfferFullDescription/DigitalProductData.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/OfferFullDescription/DigitalProductData.js +41 -13
- package/dist/cjs/components/modal/components/common/OfferFullDescription/DigitalProductData.js.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/Detail.style.d.ts +36 -1
- package/dist/cjs/components/modal/components/common/detail/Detail.style.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/PhygitalProduct.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/PhygitalProduct.js +48 -33
- package/dist/cjs/components/modal/components/common/detail/PhygitalProduct.js.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/TokenGatedItem.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/TokenGatedItem.js +28 -16
- package/dist/cjs/components/modal/components/common/detail/TokenGatedItem.js.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.d.ts +3 -1
- package/dist/cjs/components/productCard/ProductCard.d.ts.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.js +14 -2
- package/dist/cjs/components/productCard/ProductCard.js.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.styles.d.ts +1 -0
- package/dist/cjs/components/productCard/ProductCard.styles.d.ts.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.styles.js +43 -3
- package/dist/cjs/components/productCard/ProductCard.styles.js.map +1 -1
- package/dist/cjs/components/tooltip/Tooltip.d.ts +3 -2
- package/dist/cjs/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/cjs/components/tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/ui/DetailsSummary.js +1 -1
- package/dist/cjs/components/ui/DetailsSummary.js.map +1 -1
- package/dist/cjs/components/ui/IpfsImage.d.ts +3 -0
- package/dist/cjs/components/ui/IpfsImage.d.ts.map +1 -1
- package/dist/cjs/components/ui/IpfsImage.js +13 -3
- package/dist/cjs/components/ui/IpfsImage.js.map +1 -1
- package/dist/cjs/components/ui/Typography.d.ts +7 -1
- package/dist/cjs/components/ui/Typography.d.ts.map +1 -1
- package/dist/cjs/components/ui/Typography.js.map +1 -1
- package/dist/cjs/hooks/bundles/useBundleItemsImages.d.ts +10 -0
- package/dist/cjs/hooks/bundles/useBundleItemsImages.d.ts.map +1 -0
- package/dist/cjs/hooks/bundles/useBundleItemsImages.js +56 -0
- package/dist/cjs/hooks/bundles/useBundleItemsImages.js.map +1 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.d.ts +11 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.d.ts.map +1 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.js +37 -0
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uris.js.map +1 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.d.ts +11 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.d.ts.map +1 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.js +37 -0
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUris.js.map +1 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.d.ts +10 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.d.ts.map +1 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.js +103 -0
- package/dist/cjs/hooks/contracts/useGetTokenUriImages.js.map +1 -0
- package/dist/cjs/hooks/index.d.ts +3 -3
- package/dist/cjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/hooks/index.js +3 -3
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/transactions/usePendingTransactionsWithContext.d.ts +1 -1
- package/dist/cjs/lib/address/address.d.ts +1 -0
- package/dist/cjs/lib/address/address.d.ts.map +1 -1
- package/dist/cjs/lib/address/address.js +8 -1
- package/dist/cjs/lib/address/address.js.map +1 -1
- package/dist/cjs/lib/bundle/const.d.ts +19 -5
- package/dist/cjs/lib/bundle/const.d.ts.map +1 -1
- package/dist/cjs/lib/bundle/const.js +18 -3
- package/dist/cjs/lib/bundle/const.js.map +1 -1
- package/dist/cjs/lib/ipfs/ipfs.d.ts.map +1 -1
- package/dist/cjs/lib/ipfs/ipfs.js +9 -4
- package/dist/cjs/lib/ipfs/ipfs.js.map +1 -1
- package/dist/cjs/lib/offer/filter.d.ts +3 -0
- package/dist/cjs/lib/offer/filter.d.ts.map +1 -1
- package/dist/cjs/lib/offer/filter.js +21 -1
- package/dist/cjs/lib/offer/filter.js.map +1 -1
- package/dist/cjs/lib/offer/getOfferDetails.d.ts.map +1 -1
- package/dist/cjs/lib/offer/getOfferDetails.js +21 -9
- package/dist/cjs/lib/offer/getOfferDetails.js.map +1 -1
- package/dist/esm/components/Loading.js +1 -1
- package/dist/esm/components/Loading.js.map +1 -1
- package/dist/esm/components/modal/components/Commit/OfferVariantView.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Commit/OfferVariantView.js +4 -1
- package/dist/esm/components/modal/components/Commit/OfferVariantView.js.map +1 -1
- package/dist/esm/components/modal/components/Redeem/Confirmation/Confirmation.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Redeem/Confirmation/Confirmation.js +4 -1
- package/dist/esm/components/modal/components/Redeem/Confirmation/Confirmation.js.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemForm.d.ts +4 -1
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemForm.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemForm.js +13 -2
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemForm.js.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemFormView.d.ts +2 -1
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemFormView.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemFormView.js +2 -2
- package/dist/esm/components/modal/components/Redeem/RedeemForm/RedeemFormView.js.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemFormModel.d.ts +7 -1
- package/dist/esm/components/modal/components/Redeem/RedeemFormModel.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemFormModel.js +6 -0
- package/dist/esm/components/modal/components/Redeem/RedeemFormModel.js.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemNonModal.d.ts.map +1 -1
- package/dist/esm/components/modal/components/Redeem/RedeemNonModal.js +22 -3
- package/dist/esm/components/modal/components/Redeem/RedeemNonModal.js.map +1 -1
- package/dist/esm/components/modal/components/common/OfferFullDescription/DigitalProductData.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/OfferFullDescription/DigitalProductData.js +44 -11
- package/dist/esm/components/modal/components/common/OfferFullDescription/DigitalProductData.js.map +1 -1
- package/dist/esm/components/modal/components/common/detail/Detail.style.d.ts +36 -1
- package/dist/esm/components/modal/components/common/detail/Detail.style.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/detail/PhygitalProduct.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/detail/PhygitalProduct.js +40 -26
- package/dist/esm/components/modal/components/common/detail/PhygitalProduct.js.map +1 -1
- package/dist/esm/components/modal/components/common/detail/TokenGatedItem.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/detail/TokenGatedItem.js +28 -16
- package/dist/esm/components/modal/components/common/detail/TokenGatedItem.js.map +1 -1
- package/dist/esm/components/productCard/ProductCard.d.ts +3 -1
- package/dist/esm/components/productCard/ProductCard.d.ts.map +1 -1
- package/dist/esm/components/productCard/ProductCard.js +3 -3
- package/dist/esm/components/productCard/ProductCard.js.map +1 -1
- package/dist/esm/components/productCard/ProductCard.styles.d.ts +1 -0
- package/dist/esm/components/productCard/ProductCard.styles.d.ts.map +1 -1
- package/dist/esm/components/productCard/ProductCard.styles.js +42 -2
- package/dist/esm/components/productCard/ProductCard.styles.js.map +1 -1
- package/dist/esm/components/tooltip/Tooltip.d.ts +3 -2
- package/dist/esm/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/ui/DetailsSummary.js +1 -1
- package/dist/esm/components/ui/DetailsSummary.js.map +1 -1
- package/dist/esm/components/ui/IpfsImage.d.ts +3 -0
- package/dist/esm/components/ui/IpfsImage.d.ts.map +1 -1
- package/dist/esm/components/ui/IpfsImage.js +14 -4
- package/dist/esm/components/ui/IpfsImage.js.map +1 -1
- package/dist/esm/components/ui/Typography.d.ts +7 -1
- package/dist/esm/components/ui/Typography.d.ts.map +1 -1
- package/dist/esm/components/ui/Typography.js.map +1 -1
- package/dist/esm/hooks/bundles/useBundleItemsImages.d.ts +10 -0
- package/dist/esm/hooks/bundles/useBundleItemsImages.d.ts.map +1 -0
- package/dist/esm/hooks/bundles/useBundleItemsImages.js +48 -0
- package/dist/esm/hooks/bundles/useBundleItemsImages.js.map +1 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.d.ts +11 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.d.ts.map +1 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.js +22 -0
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uris.js.map +1 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.d.ts +11 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.d.ts.map +1 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.js +22 -0
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUris.js.map +1 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.d.ts +10 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.d.ts.map +1 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.js +90 -0
- package/dist/esm/hooks/contracts/useGetTokenUriImages.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +3 -3
- package/dist/esm/hooks/index.d.ts.map +1 -1
- package/dist/esm/hooks/index.js +3 -3
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/transactions/usePendingTransactionsWithContext.d.ts +1 -1
- package/dist/esm/lib/address/address.d.ts +1 -0
- package/dist/esm/lib/address/address.d.ts.map +1 -1
- package/dist/esm/lib/address/address.js +6 -0
- package/dist/esm/lib/address/address.js.map +1 -1
- package/dist/esm/lib/bundle/const.d.ts +19 -5
- package/dist/esm/lib/bundle/const.d.ts.map +1 -1
- package/dist/esm/lib/bundle/const.js +17 -2
- package/dist/esm/lib/bundle/const.js.map +1 -1
- package/dist/esm/lib/ipfs/ipfs.d.ts.map +1 -1
- package/dist/esm/lib/ipfs/ipfs.js +9 -4
- package/dist/esm/lib/ipfs/ipfs.js.map +1 -1
- package/dist/esm/lib/offer/filter.d.ts +3 -0
- package/dist/esm/lib/offer/filter.d.ts.map +1 -1
- package/dist/esm/lib/offer/filter.js +18 -0
- package/dist/esm/lib/offer/filter.js.map +1 -1
- package/dist/esm/lib/offer/getOfferDetails.d.ts.map +1 -1
- package/dist/esm/lib/offer/getOfferDetails.js +17 -5
- package/dist/esm/lib/offer/getOfferDetails.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Loading.tsx +1 -1
- package/src/components/modal/components/Commit/OfferVariantView.tsx +4 -1
- package/src/components/modal/components/Redeem/Confirmation/Confirmation.tsx +6 -1
- package/src/components/modal/components/Redeem/RedeemForm/RedeemForm.tsx +32 -3
- package/src/components/modal/components/Redeem/RedeemForm/RedeemFormView.tsx +5 -1
- package/src/components/modal/components/Redeem/RedeemFormModel.ts +7 -1
- package/src/components/modal/components/Redeem/RedeemNonModal.tsx +29 -2
- package/src/components/modal/components/common/OfferFullDescription/DigitalProductData.tsx +166 -99
- package/src/components/modal/components/common/detail/PhygitalProduct.tsx +75 -34
- package/src/components/modal/components/common/detail/TokenGatedItem.tsx +27 -15
- package/src/components/productCard/ProductCard.styles.ts +43 -2
- package/src/components/productCard/ProductCard.tsx +3 -2
- package/src/components/tooltip/Tooltip.tsx +3 -2
- package/src/components/ui/DetailsSummary.tsx +1 -1
- package/src/components/ui/IpfsImage.tsx +19 -4
- package/src/components/ui/Typography.tsx +1 -4
- package/src/components/widgets/commit/CommitWidget.tsx +1 -1
- package/src/hooks/bundles/useBundleItemsImages.ts +71 -0
- package/src/hooks/contracts/erc1155/useErc1155Uris.ts +52 -0
- package/src/hooks/contracts/erc721/useErc721TokenUris.ts +52 -0
- package/src/hooks/contracts/useGetTokenUriImages.ts +126 -0
- package/src/hooks/index.ts +3 -3
- package/src/lib/address/address.ts +8 -1
- package/src/lib/bundle/const.ts +20 -3
- package/src/lib/ipfs/ipfs.ts +15 -5
- package/src/lib/offer/filter.ts +28 -0
- package/src/lib/offer/getOfferDetails.ts +30 -16
- package/src/stories/widgets/Commit.stories.tsx +3 -3
- package/dist/cjs/components/nftItem/NftItemIcon.d.ts +0 -8
- package/dist/cjs/components/nftItem/NftItemIcon.d.ts.map +0 -1
- package/dist/cjs/components/nftItem/NftItemIcon.js +0 -14
- package/dist/cjs/components/nftItem/NftItemIcon.js.map +0 -1
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.d.ts +0 -9
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.d.ts.map +0 -1
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.js +0 -29
- package/dist/cjs/hooks/contracts/erc1155/useErc1155Uri.js.map +0 -1
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.d.ts +0 -9
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.d.ts.map +0 -1
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.js +0 -29
- package/dist/cjs/hooks/contracts/erc721/useErc721TokenUri.js.map +0 -1
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.d.ts +0 -8
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.d.ts.map +0 -1
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.js +0 -93
- package/dist/cjs/hooks/contracts/useGetTokenUriImage.js.map +0 -1
- package/dist/esm/components/nftItem/NftItemIcon.d.ts +0 -8
- package/dist/esm/components/nftItem/NftItemIcon.d.ts.map +0 -1
- package/dist/esm/components/nftItem/NftItemIcon.js +0 -7
- package/dist/esm/components/nftItem/NftItemIcon.js.map +0 -1
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.d.ts +0 -9
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.d.ts.map +0 -1
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.js +0 -16
- package/dist/esm/hooks/contracts/erc1155/useErc1155Uri.js.map +0 -1
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.d.ts +0 -9
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.d.ts.map +0 -1
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.js +0 -16
- package/dist/esm/hooks/contracts/erc721/useErc721TokenUri.js.map +0 -1
- package/dist/esm/hooks/contracts/useGetTokenUriImage.d.ts +0 -8
- package/dist/esm/hooks/contracts/useGetTokenUriImage.d.ts.map +0 -1
- package/dist/esm/hooks/contracts/useGetTokenUriImage.js +0 -80
- package/dist/esm/hooks/contracts/useGetTokenUriImage.js.map +0 -1
- package/src/components/nftItem/NftItemIcon.tsx +0 -16
- package/src/hooks/contracts/erc1155/useErc1155Uri.ts +0 -31
- package/src/hooks/contracts/erc721/useErc721TokenUri.ts +0 -31
- package/src/hooks/contracts/useGetTokenUriImage.ts +0 -102
|
@@ -13,8 +13,13 @@ export const getOfferDetails = (offer) => {
|
|
|
13
13
|
const offerImg = offer.metadata?.image;
|
|
14
14
|
const animationUrl = getOfferAnimationUrl(offer);
|
|
15
15
|
const shippingInfo = {
|
|
16
|
-
returnPeriodInDays: productV1ItemMetadataEntity?.shipping?.returnPeriodInDays
|
|
17
|
-
|
|
16
|
+
returnPeriodInDays: productV1ItemMetadataEntity?.shipping?.returnPeriodInDays ||
|
|
17
|
+
isProductV1(offer)
|
|
18
|
+
? offer.metadata.shipping?.returnPeriodInDays
|
|
19
|
+
: undefined,
|
|
20
|
+
shippingTable: (productV1ItemMetadataEntity?.shipping || isProductV1(offer)
|
|
21
|
+
? offer.metadata.shipping
|
|
22
|
+
: undefined)?.supportedJurisdictions?.map((jurisdiction) => ({
|
|
18
23
|
name: jurisdiction.label,
|
|
19
24
|
value: jurisdiction.deliveryTime
|
|
20
25
|
})) || []
|
|
@@ -22,12 +27,19 @@ export const getOfferDetails = (offer) => {
|
|
|
22
27
|
const description = productV1ItemMetadataEntity?.product?.description ||
|
|
23
28
|
offer.metadata?.description ||
|
|
24
29
|
"";
|
|
25
|
-
const artist = productV1ItemMetadataEntity?.productV1Seller ||
|
|
30
|
+
const artist = productV1ItemMetadataEntity?.productV1Seller ||
|
|
31
|
+
(isProductV1(offer)
|
|
32
|
+
? offer.metadata.productV1Seller
|
|
33
|
+
: null);
|
|
26
34
|
const artistDescription = artist?.description ||
|
|
27
35
|
productV1ItemMetadataEntity?.product.productV1Seller?.description ||
|
|
28
36
|
"";
|
|
29
|
-
const images = productV1ItemMetadataEntity?.product
|
|
30
|
-
|
|
37
|
+
const images = (productV1ItemMetadataEntity?.product ||
|
|
38
|
+
(isProductV1(offer)
|
|
39
|
+
? offer.metadata.product
|
|
40
|
+
: undefined))?.visuals_images?.map(({ url }) => url) || [];
|
|
41
|
+
const variantsImages = (productV1ItemMetadataEntity ||
|
|
42
|
+
(isProductV1(offer) ? offer.metadata : undefined))?.productOverrides?.visuals_images?.map(({ url }) => url) || [];
|
|
31
43
|
const bundleItems = isBundle(offer) ? offer.metadata.items : undefined;
|
|
32
44
|
const nftItems = bundleItems
|
|
33
45
|
? bundleItems.filter((item) => isNftItem(item))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOfferDetails.js","sourceRoot":"","sources":["../../../../src/lib/offer/getOfferDetails.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAiE9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAA2C,EACzB,EAAE;IACpB,MAAM,2BAA2B,GAGjB,WAAW,CAAC,KAAK,CAAC;QAChC,CAAC,CAAE,KAAK,CAAC,QAAyB;QAClC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"getOfferDetails.js","sourceRoot":"","sources":["../../../../src/lib/offer/getOfferDetails.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bosonprotocol/react-kit",
|
|
3
3
|
"description": "React toolkit with smart components and hooks for building on top of the Boson Protocol.",
|
|
4
|
-
"version": "0.30.0-alpha.
|
|
4
|
+
"version": "0.30.0-alpha.11",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
7
7
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@bosonprotocol/chat-sdk": "^1.3.1-alpha.9",
|
|
18
|
-
"@bosonprotocol/core-sdk": "^1.40.
|
|
19
|
-
"@bosonprotocol/ethers-sdk": "^1.14.
|
|
18
|
+
"@bosonprotocol/core-sdk": "^1.40.2-alpha.8",
|
|
19
|
+
"@bosonprotocol/ethers-sdk": "^1.14.2-alpha.8",
|
|
20
20
|
"@bosonprotocol/ipfs-storage": "^1.11.3",
|
|
21
21
|
"@davatar/react": "1.11.1",
|
|
22
22
|
"@ethersproject/units": "5.6.0",
|
|
@@ -170,5 +170,5 @@
|
|
|
170
170
|
"overrides": {
|
|
171
171
|
"typescript": "^5.1.6"
|
|
172
172
|
},
|
|
173
|
-
"gitHead": "
|
|
173
|
+
"gitHead": "d4b172237e5adf12f96f6569962c63debb134088"
|
|
174
174
|
}
|
|
@@ -26,6 +26,7 @@ import { DetailContextProps } from "../common/detail/DetailViewProvider";
|
|
|
26
26
|
import { OnClickBuyOrSwapHandler } from "../common/detail/types";
|
|
27
27
|
import { UseGetOfferDetailDataProps } from "../common/detail/useGetOfferDetailData";
|
|
28
28
|
import { BosonLogo } from "../common/BosonLogo";
|
|
29
|
+
import { PhygitalLabel } from "../../../productCard/ProductCard";
|
|
29
30
|
|
|
30
31
|
const colors = theme.colors.light;
|
|
31
32
|
const ImageWrapper = styled.div`
|
|
@@ -36,6 +37,7 @@ const ImageWrapper = styled.div`
|
|
|
36
37
|
${breakpoint.s} {
|
|
37
38
|
max-width: 35rem !important;
|
|
38
39
|
}
|
|
40
|
+
overflow: hidden;
|
|
39
41
|
`;
|
|
40
42
|
|
|
41
43
|
const ImageAndSellerIdContainer = styled(Grid)`
|
|
@@ -173,7 +175,8 @@ export function OfferVariantView({
|
|
|
173
175
|
>
|
|
174
176
|
<ImageAndSellerIdContainer flexDirection="column" flex={1}>
|
|
175
177
|
<ImageWrapper>
|
|
176
|
-
|
|
178
|
+
<PhygitalLabel />
|
|
179
|
+
{!!mediaFiles.length && (
|
|
177
180
|
<DetailSlider
|
|
178
181
|
mediaFiles={mediaFiles}
|
|
179
182
|
sliderOptions={sliderOptions}
|
|
@@ -134,6 +134,9 @@ export default function Confirmation({
|
|
|
134
134
|
const [zipField] = useField(FormModel.formFields.zip.name);
|
|
135
135
|
const [countryField] = useField(FormModel.formFields.country.name);
|
|
136
136
|
const [emailField] = useField(FormModel.formFields.email.name);
|
|
137
|
+
const [walletAddressField] = useField(
|
|
138
|
+
FormModel.formFields.walletAddress.name
|
|
139
|
+
);
|
|
137
140
|
const [phoneField] = useField(FormModel.formFields.phone.name);
|
|
138
141
|
const redemptionInfo = {
|
|
139
142
|
exchangeId,
|
|
@@ -249,7 +252,8 @@ ${FormModel.formFields.state.placeholder}: ${message.deliveryDetails.state}
|
|
|
249
252
|
${FormModel.formFields.zip.placeholder}: ${message.deliveryDetails.zip}
|
|
250
253
|
${FormModel.formFields.country.placeholder}: ${message.deliveryDetails.country}
|
|
251
254
|
${FormModel.formFields.email.placeholder}: ${message.deliveryDetails.email}
|
|
252
|
-
${FormModel.formFields.phone.placeholder}: ${message.deliveryDetails.phone}
|
|
255
|
+
${FormModel.formFields.phone.placeholder}: ${message.deliveryDetails.phone}
|
|
256
|
+
${FormModel.formFields.walletAddress.placeholder}: ${message.deliveryDetails.walletAddress}`;
|
|
253
257
|
|
|
254
258
|
const newMessage = {
|
|
255
259
|
threadId: {
|
|
@@ -300,6 +304,7 @@ ${FormModel.formFields.phone.placeholder}: ${message.deliveryDetails.phone}`;
|
|
|
300
304
|
<div>{zipField.value}</div>
|
|
301
305
|
<div>{countryField.value}</div>
|
|
302
306
|
<div>{emailField.value}</div>
|
|
307
|
+
<div>{walletAddressField.value}</div>
|
|
303
308
|
<div>{phoneField.value}</div>
|
|
304
309
|
</Grid>
|
|
305
310
|
<Grid flexDirection="row" flexBasis="0">
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { Country as CountryCode } from "react-phone-number-input";
|
|
2
3
|
import { useBreakpoints } from "../../../../../hooks/useBreakpoints";
|
|
4
|
+
import { BuyerTransferInfo } from "../../../../../lib/bundle/const";
|
|
5
|
+
import { getHasBuyerTransferInfos } from "../../../../../lib/offer/filter";
|
|
6
|
+
import { Exchange } from "../../../../../types/exchange";
|
|
3
7
|
import { Button } from "../../../../buttons/Button";
|
|
8
|
+
import { CountrySelect } from "../../../../form/CountrySelect";
|
|
4
9
|
import Input from "../../../../form/Input";
|
|
5
10
|
import Phone from "../../../../form/Phone";
|
|
6
11
|
import { Grid } from "../../../../ui/Grid";
|
|
7
12
|
import { Typography } from "../../../../ui/Typography";
|
|
8
13
|
import { FormModel } from "../RedeemFormModel";
|
|
9
|
-
import { CountrySelect } from "../../../../form/CountrySelect";
|
|
10
|
-
import type { Country as CountryCode } from "react-phone-number-input";
|
|
11
14
|
interface Props {
|
|
15
|
+
exchange: Exchange | null;
|
|
12
16
|
isValid: boolean;
|
|
13
17
|
onNextClick: () => void;
|
|
14
18
|
onBackClick: () => void;
|
|
19
|
+
setConnectedWalletAddress: () => void;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
// https://www.fatf-gafi.org/en/countries.html
|
|
@@ -55,11 +60,18 @@ const fatfMemberCountries: CountryCode[] = [
|
|
|
55
60
|
];
|
|
56
61
|
|
|
57
62
|
export default function RedeemForm({
|
|
63
|
+
exchange,
|
|
58
64
|
isValid,
|
|
59
65
|
onNextClick,
|
|
60
|
-
onBackClick
|
|
66
|
+
onBackClick,
|
|
67
|
+
setConnectedWalletAddress
|
|
61
68
|
}: Props) {
|
|
62
69
|
const { isLteXS } = useBreakpoints();
|
|
70
|
+
const requestBuyerAddress = exchange?.offer
|
|
71
|
+
? getHasBuyerTransferInfos(exchange.offer, [
|
|
72
|
+
BuyerTransferInfo.walletAddress
|
|
73
|
+
])
|
|
74
|
+
: false;
|
|
63
75
|
return (
|
|
64
76
|
<>
|
|
65
77
|
<Typography
|
|
@@ -142,6 +154,23 @@ export default function RedeemForm({
|
|
|
142
154
|
placeholder={FormModel.formFields.email.placeholder}
|
|
143
155
|
/>
|
|
144
156
|
</Grid>
|
|
157
|
+
{requestBuyerAddress && (
|
|
158
|
+
<Grid gap="1rem">
|
|
159
|
+
<Grid flexDirection="column" alignItems="flex-start">
|
|
160
|
+
<Input
|
|
161
|
+
name={FormModel.formFields.walletAddress.name}
|
|
162
|
+
placeholder={FormModel.formFields.walletAddress.placeholder}
|
|
163
|
+
/>
|
|
164
|
+
</Grid>
|
|
165
|
+
<Button
|
|
166
|
+
variant="secondaryFill"
|
|
167
|
+
onClick={() => setConnectedWalletAddress()}
|
|
168
|
+
style={{ whiteSpace: "nowrap" }}
|
|
169
|
+
>
|
|
170
|
+
Use my wallet address
|
|
171
|
+
</Button>
|
|
172
|
+
</Grid>
|
|
173
|
+
)}
|
|
145
174
|
<Grid flexDirection="column" alignItems="flex-start">
|
|
146
175
|
<Phone
|
|
147
176
|
name={FormModel.formFields.phone.name}
|
|
@@ -14,13 +14,15 @@ interface Props {
|
|
|
14
14
|
isValid: boolean;
|
|
15
15
|
onNextClick: () => void;
|
|
16
16
|
onBackClick: () => void;
|
|
17
|
+
setConnectedWalletAddress: () => void;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export default function RedeemFormView({
|
|
20
21
|
exchange,
|
|
21
22
|
isValid,
|
|
22
23
|
onNextClick,
|
|
23
|
-
onBackClick
|
|
24
|
+
onBackClick,
|
|
25
|
+
setConnectedWalletAddress
|
|
24
26
|
}: Props) {
|
|
25
27
|
const { address } = useAccount();
|
|
26
28
|
const dispatch = useNonModalContext();
|
|
@@ -45,9 +47,11 @@ export default function RedeemFormView({
|
|
|
45
47
|
<p>Invalid exchange state.</p>
|
|
46
48
|
) : (
|
|
47
49
|
<RedeemForm
|
|
50
|
+
exchange={exchange}
|
|
48
51
|
isValid={isValid}
|
|
49
52
|
onNextClick={onNextClick}
|
|
50
53
|
onBackClick={onBackClick}
|
|
54
|
+
setConnectedWalletAddress={setConnectedWalletAddress}
|
|
51
55
|
/>
|
|
52
56
|
)}
|
|
53
57
|
</>
|
|
@@ -36,6 +36,12 @@ export const FormModel = {
|
|
|
36
36
|
placeholder: "Email",
|
|
37
37
|
mustBeEmail: "This is not an e-mail"
|
|
38
38
|
},
|
|
39
|
+
walletAddress: {
|
|
40
|
+
name: "walletAddress",
|
|
41
|
+
requiredErrorMessage: "This field is required",
|
|
42
|
+
placeholder: "Wallet Address: Required to receive the digital item/s",
|
|
43
|
+
mustBeWalletAddress: "This is not a wallet address"
|
|
44
|
+
},
|
|
39
45
|
phone: {
|
|
40
46
|
name: "phone",
|
|
41
47
|
requiredErrorMessage: "This field is required",
|
|
@@ -44,4 +50,4 @@ export const FormModel = {
|
|
|
44
50
|
}
|
|
45
51
|
} as const;
|
|
46
52
|
|
|
47
|
-
export type FormType = Record<keyof typeof FormModel["formFields"], string>;
|
|
53
|
+
export type FormType = Record<keyof (typeof FormModel)["formFields"], string>;
|
|
@@ -56,6 +56,8 @@ import {
|
|
|
56
56
|
DetailContextProps,
|
|
57
57
|
DetailViewProvider
|
|
58
58
|
} from "../common/detail/DetailViewProvider";
|
|
59
|
+
import { getHasBuyerTransferInfos } from "../../../../lib/offer/filter";
|
|
60
|
+
import { BuyerTransferInfo } from "../../../../lib/bundle/const";
|
|
59
61
|
|
|
60
62
|
const colors = theme.colors.light;
|
|
61
63
|
const UlWithWordBreak = styled.ul`
|
|
@@ -328,6 +330,11 @@ function RedeemNonModal({
|
|
|
328
330
|
const emailPreference =
|
|
329
331
|
exchange?.seller.metadata?.contactPreference ===
|
|
330
332
|
ContactPreference.XMTP_AND_EMAIL;
|
|
333
|
+
const requestBuyerAddress = exchange?.offer
|
|
334
|
+
? getHasBuyerTransferInfos(exchange.offer, [
|
|
335
|
+
BuyerTransferInfo.walletAddress
|
|
336
|
+
])
|
|
337
|
+
: false;
|
|
331
338
|
const validationSchema = useMemo(() => {
|
|
332
339
|
return Yup.object({
|
|
333
340
|
[FormModel.formFields.name.name]: Yup.string()
|
|
@@ -356,11 +363,21 @@ function RedeemNonModal({
|
|
|
356
363
|
.required(FormModel.formFields.email.requiredErrorMessage)
|
|
357
364
|
.email(FormModel.formFields.email.mustBeEmail)
|
|
358
365
|
: Yup.string().trim().email(FormModel.formFields.email.mustBeEmail),
|
|
366
|
+
[FormModel.formFields.walletAddress.name]: requestBuyerAddress
|
|
367
|
+
? Yup.string()
|
|
368
|
+
.trim()
|
|
369
|
+
.required(FormModel.formFields.walletAddress.requiredErrorMessage)
|
|
370
|
+
.test(
|
|
371
|
+
"mustBeAddress",
|
|
372
|
+
FormModel.formFields.walletAddress.mustBeWalletAddress,
|
|
373
|
+
(value) => (value ? ethers.utils.isAddress(value) : true)
|
|
374
|
+
)
|
|
375
|
+
: Yup.string().trim(),
|
|
359
376
|
[FormModel.formFields.phone.name]: Yup.string()
|
|
360
377
|
.trim()
|
|
361
378
|
.required(FormModel.formFields.phone.requiredErrorMessage)
|
|
362
379
|
});
|
|
363
|
-
}, [emailPreference]);
|
|
380
|
+
}, [emailPreference, requestBuyerAddress]);
|
|
364
381
|
type FormType = Yup.InferType<typeof validationSchema>;
|
|
365
382
|
const [{ currentStep }, setStep] = useState<{
|
|
366
383
|
previousStep: ActiveStep[];
|
|
@@ -495,12 +512,13 @@ function RedeemNonModal({
|
|
|
495
512
|
[FormModel.formFields.zip.name]: "",
|
|
496
513
|
[FormModel.formFields.country.name]: "",
|
|
497
514
|
[FormModel.formFields.email.name]: "",
|
|
515
|
+
[FormModel.formFields.walletAddress.name]: "",
|
|
498
516
|
[FormModel.formFields.phone.name]: ""
|
|
499
517
|
}
|
|
500
518
|
}
|
|
501
519
|
validateOnMount
|
|
502
520
|
>
|
|
503
|
-
{({ errors }) => {
|
|
521
|
+
{({ errors, setFieldValue }) => {
|
|
504
522
|
const isRedeemFormOK =
|
|
505
523
|
!errors[FormModel.formFields.name.name] &&
|
|
506
524
|
!errors[FormModel.formFields.streetNameAndNumber.name] &&
|
|
@@ -509,6 +527,7 @@ function RedeemNonModal({
|
|
|
509
527
|
!errors[FormModel.formFields.zip.name] &&
|
|
510
528
|
!errors[FormModel.formFields.country.name] &&
|
|
511
529
|
!errors[FormModel.formFields.email.name] &&
|
|
530
|
+
!errors[FormModel.formFields.walletAddress.name] &&
|
|
512
531
|
!errors[FormModel.formFields.phone.name];
|
|
513
532
|
|
|
514
533
|
return (
|
|
@@ -646,6 +665,14 @@ function RedeemNonModal({
|
|
|
646
665
|
setActiveStep(ActiveStep.REDEEM_FORM_CONFIRMATION)
|
|
647
666
|
}
|
|
648
667
|
isValid={isRedeemFormOK}
|
|
668
|
+
setConnectedWalletAddress={() => {
|
|
669
|
+
if (address) {
|
|
670
|
+
setFieldValue(
|
|
671
|
+
FormModel.formFields.walletAddress.name,
|
|
672
|
+
address
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
}}
|
|
649
676
|
/>
|
|
650
677
|
) : currentStep === ActiveStep.EXCHANGE_POLICY ? (
|
|
651
678
|
<RedeemOfferPolicyView
|
|
@@ -3,16 +3,23 @@ import React from "react";
|
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { getOfferDetails } from "../../../../../lib/offer/getOfferDetails";
|
|
5
5
|
import { Offer } from "../../../../../types/offer";
|
|
6
|
-
import { NftItemIcon } from "../../../../nftItem/NftItemIcon";
|
|
7
6
|
import { DetailsSummary } from "../../../../ui/DetailsSummary";
|
|
8
7
|
import { Grid } from "../../../../ui/Grid";
|
|
9
8
|
import { Typography } from "../../../../ui/Typography";
|
|
10
9
|
import DetailTable from "../detail/DetailTable";
|
|
11
10
|
import { SlickSlider, initialSettings } from "../detail/SlickSlider";
|
|
12
11
|
import {
|
|
12
|
+
buyerTransferInfoMapping,
|
|
13
13
|
digitalNftTypeMapping,
|
|
14
|
-
digitalTypeMappingDisplay
|
|
14
|
+
digitalTypeMappingDisplay,
|
|
15
|
+
ercTokenMapping
|
|
15
16
|
} from "../../../../../lib/bundle/const";
|
|
17
|
+
import { useBundleItemsImages } from "../../../../../hooks/bundles/useBundleItemsImages";
|
|
18
|
+
import { useCoreSDKWithContext } from "../../../../../hooks/core-sdk/useCoreSdkWithContext";
|
|
19
|
+
import { isNftItem } from "../../../../../lib/bundle/filter";
|
|
20
|
+
import { isTruthy } from "../../../../../types/helpers";
|
|
21
|
+
import Video from "../../../../ui/Video";
|
|
22
|
+
import IpfsImage from "../../../../ui/IpfsImage";
|
|
16
23
|
|
|
17
24
|
const StyledDetailsSummary = styled(DetailsSummary)`
|
|
18
25
|
.icon-wrapper {
|
|
@@ -26,6 +33,9 @@ const StyledDetailsSummary = styled(DetailsSummary)`
|
|
|
26
33
|
const MediaWrapper = styled.div`
|
|
27
34
|
width: 100%;
|
|
28
35
|
height: 100%;
|
|
36
|
+
.loading-container {
|
|
37
|
+
padding-top: 100%;
|
|
38
|
+
}
|
|
29
39
|
`;
|
|
30
40
|
type DigitalProductDataProps = {
|
|
31
41
|
offer: Offer;
|
|
@@ -36,7 +46,12 @@ export const DigitalProductData: React.FC<DigitalProductDataProps> = ({
|
|
|
36
46
|
offer,
|
|
37
47
|
imagesToShow
|
|
38
48
|
}) => {
|
|
39
|
-
const {
|
|
49
|
+
const { bundleItems } = getOfferDetails(offer);
|
|
50
|
+
const { images } = useBundleItemsImages({
|
|
51
|
+
bundleItems,
|
|
52
|
+
coreSDK: useCoreSDKWithContext()
|
|
53
|
+
});
|
|
54
|
+
|
|
40
55
|
return (
|
|
41
56
|
<Grid
|
|
42
57
|
flexDirection="column"
|
|
@@ -45,105 +60,157 @@ export const DigitalProductData: React.FC<DigitalProductDataProps> = ({
|
|
|
45
60
|
justifyContent="space-between"
|
|
46
61
|
>
|
|
47
62
|
<Typography tag="h3">Digital product data</Typography>
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
63
|
+
{bundleItems
|
|
64
|
+
?.map((bundleItem, index) => {
|
|
65
|
+
if (!isNftItem(bundleItem)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const nftItem = bundleItem;
|
|
69
|
+
const nftMedia = [
|
|
70
|
+
...(nftItem.image
|
|
71
|
+
? [{ url: nftItem.image, type: "image" } as const]
|
|
72
|
+
: []),
|
|
73
|
+
...(nftItem.animationUrl
|
|
74
|
+
? [
|
|
75
|
+
{
|
|
76
|
+
url: nftItem.animationUrl,
|
|
77
|
+
type: "video"
|
|
78
|
+
} as const
|
|
79
|
+
]
|
|
80
|
+
: [])
|
|
81
|
+
];
|
|
82
|
+
const imageSrc = images?.[index];
|
|
83
|
+
const videoSrc = bundleItem.animationUrl;
|
|
84
|
+
const icon = videoSrc ? (
|
|
85
|
+
<MediaWrapper>
|
|
86
|
+
<Video src={videoSrc} />
|
|
87
|
+
</MediaWrapper>
|
|
88
|
+
) : imageSrc ? (
|
|
89
|
+
<MediaWrapper>
|
|
90
|
+
<IpfsImage
|
|
91
|
+
src={imageSrc}
|
|
92
|
+
overrides={{ ipfsGateway: "https://ipfs.io/ipfs" }}
|
|
93
|
+
/>
|
|
94
|
+
</MediaWrapper>
|
|
95
|
+
) : (
|
|
96
|
+
<MediaWrapper></MediaWrapper>
|
|
97
|
+
);
|
|
98
|
+
return (
|
|
99
|
+
<StyledDetailsSummary
|
|
100
|
+
key={nftItem.id}
|
|
101
|
+
icon={icon ? <MediaWrapper>{icon}</MediaWrapper> : null}
|
|
102
|
+
summaryText={nftItem.name || nftItem.contract || ""}
|
|
103
|
+
initiallyOpen={index === 0}
|
|
104
|
+
>
|
|
105
|
+
<DetailTable
|
|
106
|
+
align={false}
|
|
107
|
+
noBorder
|
|
108
|
+
data={[
|
|
109
|
+
...(nftItem.contract
|
|
110
|
+
? [
|
|
111
|
+
{
|
|
112
|
+
name: "Contract address",
|
|
113
|
+
value: (
|
|
114
|
+
<Typography tag="p">{nftItem.contract}</Typography>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
100
117
|
]
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
118
|
+
: []),
|
|
119
|
+
...(nftItem.description
|
|
120
|
+
? [
|
|
121
|
+
{
|
|
122
|
+
name: "Description",
|
|
123
|
+
value: (
|
|
124
|
+
<Typography tag="p">
|
|
125
|
+
{nftItem.description}
|
|
126
|
+
</Typography>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
: []),
|
|
131
|
+
...(nftItem.attributes || []).map((attribute) => ({
|
|
132
|
+
name: attribute.displayType || attribute.traitType,
|
|
133
|
+
value: (
|
|
134
|
+
<Typography tag="p">
|
|
135
|
+
{digitalTypeMappingDisplay[
|
|
136
|
+
attribute.value as keyof typeof digitalTypeMappingDisplay
|
|
137
|
+
]
|
|
138
|
+
? digitalTypeMappingDisplay[
|
|
139
|
+
attribute.value as keyof typeof digitalTypeMappingDisplay
|
|
106
140
|
]
|
|
107
|
-
|
|
108
|
-
|
|
141
|
+
: digitalNftTypeMapping[
|
|
142
|
+
attribute.value as keyof typeof digitalNftTypeMapping
|
|
143
|
+
]
|
|
144
|
+
? digitalNftTypeMapping[
|
|
145
|
+
attribute.value as keyof typeof digitalNftTypeMapping
|
|
146
|
+
]
|
|
147
|
+
: attribute.value}
|
|
148
|
+
</Typography>
|
|
149
|
+
)
|
|
150
|
+
})),
|
|
151
|
+
...(nftItem.tokenIdRange?.min && nftItem.tokenIdRange.max
|
|
152
|
+
? [
|
|
153
|
+
{
|
|
154
|
+
name:
|
|
155
|
+
nftItem.tokenIdRange?.min ===
|
|
156
|
+
nftItem.tokenIdRange?.max
|
|
157
|
+
? "Token ID"
|
|
158
|
+
: "Token IDs",
|
|
159
|
+
value:
|
|
160
|
+
nftItem.tokenIdRange?.min ===
|
|
161
|
+
nftItem.tokenIdRange?.max ? (
|
|
162
|
+
<Typography tag="p">
|
|
163
|
+
{nftItem.tokenIdRange?.min}
|
|
164
|
+
</Typography>
|
|
165
|
+
) : (
|
|
166
|
+
<Typography tag="p">
|
|
167
|
+
{nftItem.tokenIdRange?.min}-
|
|
168
|
+
{nftItem.tokenIdRange?.max}
|
|
169
|
+
</Typography>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
: []),
|
|
174
|
+
...(nftItem.terms || []).map((term) => ({
|
|
175
|
+
name: term.displayKey || term.key,
|
|
176
|
+
value: (
|
|
177
|
+
<Typography tag="p">
|
|
178
|
+
{buyerTransferInfoMapping[
|
|
179
|
+
term.value as keyof typeof buyerTransferInfoMapping
|
|
180
|
+
]
|
|
181
|
+
? buyerTransferInfoMapping[
|
|
182
|
+
term.value as keyof typeof buyerTransferInfoMapping
|
|
109
183
|
]
|
|
110
|
-
:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
imageOptimizationOpts={{ height: 500 }}
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
)}
|
|
144
|
-
</StyledDetailsSummary>
|
|
145
|
-
);
|
|
146
|
-
})}
|
|
184
|
+
: ercTokenMapping[
|
|
185
|
+
term.value as keyof typeof ercTokenMapping
|
|
186
|
+
]
|
|
187
|
+
? ercTokenMapping[
|
|
188
|
+
term.value as keyof typeof ercTokenMapping
|
|
189
|
+
]
|
|
190
|
+
: term.value}
|
|
191
|
+
</Typography>
|
|
192
|
+
)
|
|
193
|
+
}))
|
|
194
|
+
]}
|
|
195
|
+
inheritColor={false}
|
|
196
|
+
/>
|
|
197
|
+
{!!nftMedia.length && (
|
|
198
|
+
<div style={{ width: "100%", padding: "0 2rem 1.5rem 2rem" }}>
|
|
199
|
+
<SlickSlider
|
|
200
|
+
settings={{
|
|
201
|
+
...initialSettings,
|
|
202
|
+
slidesToShow: imagesToShow
|
|
203
|
+
}}
|
|
204
|
+
mediaFiles={nftMedia}
|
|
205
|
+
alignLeft
|
|
206
|
+
imageOptimizationOpts={{ height: 500 }}
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
)}
|
|
210
|
+
</StyledDetailsSummary>
|
|
211
|
+
);
|
|
212
|
+
})
|
|
213
|
+
.filter(isTruthy)}
|
|
147
214
|
</Grid>
|
|
148
215
|
);
|
|
149
216
|
};
|