diff --git a/.env.example b/.env.example index 6243743bd..ab872aaf3 100644 --- a/.env.example +++ b/.env.example @@ -50,6 +50,8 @@ REACT_APP_RELEASE_NAME= REACT_APP_WALLET_CONNECT_PROJECT_ID= +REACT_APP_CAROUSEL_PROMOTED_SELLER_ID= + REACT_APP_VIEW_MODE=dapp # REACT_APP_VIEW_MODE=dr_center # REACT_APP_VIEW_MODE=dapp,dr_center diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23d97ac3b..db6a812dd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,7 +36,7 @@ jobs: id: name call-reusable-workflow-PR: - uses: bosonprotocol/interface/.github/workflows/ci_reusable.yaml@main + uses: ./.github/workflows/ci_reusable.yaml if: github.event_name == 'pull_request' needs: prejob with: @@ -61,10 +61,11 @@ jobs: REACT_APP_META_TX_API_KEY: ${{ secrets.REACT_APP_META_TX_API_KEY_TESTING }} REACT_APP_META_TX_API_IDS: ${{ secrets.REACT_APP_META_TX_API_IDS_TESTING }} REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID_TESTING }} + REACT_APP_CAROUSEL_PROMOTED_SELLER_ID: ${{ secrets.REACT_APP_CAROUSEL_PROMOTED_SELLER_ID_TESTING }} REACT_APP_FAIR_EXCHANGE_POLICY_RULES: ${{ secrets.REACT_APP_FAIR_EXCHANGE_POLICY_RULES_TESTING }} call-reusable-workflow-testing: - uses: bosonprotocol/interface/.github/workflows/ci_reusable.yaml@main + uses: ./.github/workflows/ci_reusable.yaml if: github.event_name == 'push' needs: prejob with: @@ -96,10 +97,11 @@ jobs: REACT_APP_META_TX_API_KEY: ${{ secrets.REACT_APP_META_TX_API_KEY_TESTING }} REACT_APP_META_TX_API_IDS: ${{ secrets.REACT_APP_META_TX_API_IDS_TESTING }} REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID_TESTING }} + REACT_APP_CAROUSEL_PROMOTED_SELLER_ID: ${{ secrets.REACT_APP_CAROUSEL_PROMOTED_SELLER_ID_TESTING }} REACT_APP_FAIR_EXCHANGE_POLICY_RULES: ${{ secrets.REACT_APP_FAIR_EXCHANGE_POLICY_RULES_TESTING }} call-reusable-workflow-staging: - uses: bosonprotocol/interface/.github/workflows/ci_reusable.yaml@main + uses: ./.github/workflows/ci_reusable.yaml if: github.event_name == 'release' && github.event.action == 'created' needs: prejob with: @@ -131,10 +133,11 @@ jobs: REACT_APP_META_TX_API_KEY: ${{ secrets.REACT_APP_META_TX_API_KEY_STAGING }} REACT_APP_META_TX_API_IDS: ${{ secrets.REACT_APP_META_TX_API_IDS_STAGING }} REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID_STAGING }} + REACT_APP_CAROUSEL_PROMOTED_SELLER_ID: ${{ secrets.REACT_APP_CAROUSEL_PROMOTED_SELLER_ID_STAGING }} REACT_APP_FAIR_EXCHANGE_POLICY_RULES: ${{ secrets.REACT_APP_FAIR_EXCHANGE_POLICY_RULES_STAGING }} call-reusable-workflow-production: - uses: bosonprotocol/interface/.github/workflows/ci_reusable.yaml@main + uses: ./.github/workflows/ci_reusable.yaml if: github.event_name == 'workflow_dispatch' needs: prejob with: @@ -166,6 +169,7 @@ jobs: REACT_APP_META_TX_API_KEY: ${{ secrets.REACT_APP_META_TX_API_KEY_PRODUCTION }} REACT_APP_META_TX_API_IDS: ${{ secrets.REACT_APP_META_TX_API_IDS_PRODUCTION }} REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID_PRODUCTION }} + REACT_APP_CAROUSEL_PROMOTED_SELLER_ID: ${{ secrets.REACT_APP_CAROUSEL_PROMOTED_SELLER_ID_PRODUCTION }} REACT_APP_FAIR_EXCHANGE_POLICY_RULES: ${{ secrets.REACT_APP_FAIR_EXCHANGE_POLICY_RULES_PRODUCTION }} job-summary: diff --git a/.github/workflows/ci_reusable.yaml b/.github/workflows/ci_reusable.yaml index 86ab7064a..abaaff4d9 100644 --- a/.github/workflows/ci_reusable.yaml +++ b/.github/workflows/ci_reusable.yaml @@ -78,6 +78,8 @@ on: required: true REACT_APP_WALLET_CONNECT_PROJECT_ID: required: true + REACT_APP_CAROUSEL_PROMOTED_SELLER_ID: + required: true REACT_APP_FAIR_EXCHANGE_POLICY_RULES: required: true outputs: @@ -111,6 +113,7 @@ jobs: REACT_APP_DEFAULT_TOKENS_LIST_TESTING: ${{ secrets.REACT_APP_DEFAULT_TOKENS_LIST_TESTING }} REACT_APP_DEFAULT_TOKENS_LIST_STAGING: ${{ secrets.REACT_APP_DEFAULT_TOKENS_LIST_STAGING }} REACT_APP_DEFAULT_TOKENS_LIST_PRODUCTION: ${{ secrets.REACT_APP_DEFAULT_TOKENS_LIST_PRODUCTION }} + REACT_APP_CAROUSEL_PROMOTED_SELLER_ID: ${{ secrets.REACT_APP_CAROUSEL_PROMOTED_SELLER_ID }} REACT_APP_GOOGLE_TAG_ID: ${{ secrets.REACT_APP_GOOGLE_TAG_ID }} REACT_APP_META_TX_API_KEY: ${{ secrets.REACT_APP_META_TX_API_KEY }} REACT_APP_META_TX_API_IDS: ${{ secrets.REACT_APP_META_TX_API_IDS }} diff --git a/src/components/product/utils/validationSchema.ts b/src/components/product/utils/validationSchema.ts index e9c02dbca..2cb61f65d 100644 --- a/src/components/product/utils/validationSchema.ts +++ b/src/components/product/utils/validationSchema.ts @@ -54,7 +54,8 @@ function testPrice(price: number | null | undefined) { if (!this.parent.currency?.value) { return true; } - if (!price || price < 1e-100) { + const _price = price as number; + if (_price === null || isNaN(_price) || (_price > 0 && _price < 1e-100)) { return false; } try { @@ -64,7 +65,7 @@ function testPrice(price: number | null | undefined) { ); const decimals = exchangeToken?.decimals || 18; const priceWithoutEnotation = - price < 0.1 ? fixformattedString(price) : price.toString(); + _price < 0.1 ? fixformattedString(_price) : _price.toString(); parseUnits(priceWithoutEnotation, decimals); return true; } catch (error) { @@ -300,7 +301,7 @@ export const termsOfExchangeValidationSchema = Yup.object({ }), sellerDeposit: Yup.string().required(validationMessage.required), sellerDepositUnit: Yup.object({ - value: Yup.string(), + value: Yup.string().required(validationMessage.required), label: Yup.string() }), disputeResolver: Yup.object({ diff --git a/src/lib/config.ts b/src/lib/config.ts index 05527bf55..3a78fb5c6 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -143,6 +143,8 @@ export const CONFIG = { walletConnect: { projectId: process.env.REACT_APP_WALLET_CONNECT_PROJECT_ID || "" }, + carouselPromotedSellerId: + process.env.REACT_APP_CAROUSEL_PROMOTED_SELLER_ID || undefined, envViewMode: { current: Object.values(ViewMode).includes( (process.env.REACT_APP_VIEW_MODE as ViewMode) || "" diff --git a/src/pages/about/AboutPage.tsx b/src/pages/about/AboutPage.tsx index e26a580aa..033620318 100644 --- a/src/pages/about/AboutPage.tsx +++ b/src/pages/about/AboutPage.tsx @@ -156,6 +156,10 @@ function AboutPage() { {CONFIG.ipfsImageGateway} + + Carousel Promoted SellerId: + {CONFIG.carouselPromotedSellerId || "-"} + ); } diff --git a/src/pages/landing/Carousel.tsx b/src/pages/landing/Carousel.tsx index cb3b8cbe0..2215e131d 100644 --- a/src/pages/landing/Carousel.tsx +++ b/src/pages/landing/Carousel.tsx @@ -7,6 +7,7 @@ import styled, { css } from "styled-components"; import ProductCard from "../../components/productCard/ProductCard"; import Loading from "../../components/ui/Loading"; +import { CONFIG } from "../../lib/config"; import { breakpoint } from "../../lib/styles/breakpoint"; import { zIndex } from "../../lib/styles/zIndex"; import { Offer } from "../../lib/types/offer"; @@ -198,7 +199,8 @@ export default function Carousel() { voided: false, valid: true, first: numCells, - quantityAvailable_gte: 1 + quantityAvailable_gte: 1, + sellerId: CONFIG.carouselPromotedSellerId }); const uiOffers = useMemo(() => {