@bosonprotocol/react-kit 0.29.0-alpha.9 → 0.29.0
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/assets/logo.svg +11 -5
- package/dist/cjs/components/buttons/Button.d.ts +3 -3
- package/dist/cjs/components/buttons/Button.d.ts.map +1 -1
- package/dist/cjs/components/buttons/Button.js.map +1 -1
- package/dist/cjs/components/buttons/CommitButtonView.d.ts +20 -0
- package/dist/cjs/components/buttons/CommitButtonView.d.ts.map +1 -0
- package/dist/cjs/components/buttons/CommitButtonView.js +81 -0
- package/dist/cjs/components/buttons/CommitButtonView.js.map +1 -0
- package/dist/cjs/components/cta/offer/CommitButton.js +1 -1
- package/dist/cjs/components/cta/offer/CommitButton.js.map +1 -1
- package/dist/cjs/components/modal/components/Commit/CommitNonModal.js +2 -2
- package/dist/cjs/components/modal/components/Commit/CommitNonModal.js.map +1 -1
- package/dist/cjs/components/modal/components/PurchaseOverview/PurchaseOverview.d.ts +9 -0
- package/dist/cjs/components/modal/components/PurchaseOverview/PurchaseOverview.d.ts.map +1 -0
- package/dist/cjs/components/modal/components/PurchaseOverview/PurchaseOverview.js +47 -0
- package/dist/cjs/components/modal/components/PurchaseOverview/PurchaseOverview.js.map +1 -0
- package/dist/cjs/components/modal/components/SellerFinance/FinanceDeposit.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/SellerFinance/FinanceDeposit.js +4 -1
- package/dist/cjs/components/modal/components/SellerFinance/FinanceDeposit.js.map +1 -1
- package/dist/cjs/components/modal/components/SellerFinance/FinanceWithdraw.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/SellerFinance/FinanceWithdraw.js +7 -2
- package/dist/cjs/components/modal/components/SellerFinance/FinanceWithdraw.js.map +1 -1
- package/dist/cjs/components/modal/components/common/StepsOverview/PurchaseOverview.js +3 -3
- package/dist/cjs/components/modal/components/common/StepsOverview/PurchaseOverview.js.map +1 -1
- package/dist/cjs/components/modal/components/common/StepsOverview/PurchaseOverviewView.d.ts +1 -1
- package/dist/cjs/components/modal/components/common/StepsOverview/PurchaseOverviewView.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/StepsOverview/PurchaseOverviewView.js +4 -4
- package/dist/cjs/components/modal/components/common/StepsOverview/PurchaseOverviewView.js.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/Detail.style.d.ts +7 -7
- package/dist/cjs/components/modal/components/common/detail/DetailSlider.d.ts.map +1 -1
- package/dist/cjs/components/modal/components/common/detail/DetailSlider.js +1 -1
- package/dist/cjs/components/modal/components/common/detail/DetailSlider.js.map +1 -1
- package/dist/cjs/components/modal/nonModal/Header.d.ts.map +1 -1
- package/dist/cjs/components/modal/nonModal/Header.js +1 -0
- package/dist/cjs/components/modal/nonModal/Header.js.map +1 -1
- package/dist/cjs/components/styles/GlobalStyle.d.ts.map +1 -1
- package/dist/cjs/components/styles/GlobalStyle.js +0 -1
- package/dist/cjs/components/styles/GlobalStyle.js.map +1 -1
- package/dist/cjs/components/ui/ThemedButton.d.ts +11 -5
- package/dist/cjs/components/ui/ThemedButton.d.ts.map +1 -1
- package/dist/cjs/components/ui/ThemedButton.js +14 -8
- package/dist/cjs/components/ui/ThemedButton.js.map +1 -1
- package/dist/cjs/components/ui/Video.d.ts +1 -0
- package/dist/cjs/components/ui/Video.d.ts.map +1 -1
- package/dist/cjs/components/ui/Video.js +2 -2
- package/dist/cjs/components/ui/Video.js.map +1 -1
- package/dist/cjs/components/ui/styles.js +1 -1
- package/dist/cjs/components/wallet/wallet-connection.d.ts +136 -136
- package/dist/cjs/components/widgets/finance/FinanceWidget.d.ts +4 -9
- package/dist/cjs/components/widgets/finance/FinanceWidget.d.ts.map +1 -1
- package/dist/cjs/components/widgets/finance/FinanceWidget.js +6 -24
- package/dist/cjs/components/widgets/finance/FinanceWidget.js.map +1 -1
- package/dist/cjs/components/widgets/finance/FinanceWidgetProviders.d.ts +11 -0
- package/dist/cjs/components/widgets/finance/FinanceWidgetProviders.d.ts.map +1 -0
- package/dist/cjs/components/widgets/finance/FinanceWidgetProviders.js +41 -0
- package/dist/cjs/components/widgets/finance/FinanceWidgetProviders.js.map +1 -0
- package/dist/cjs/hooks/useCtaClickHandler.d.ts.map +1 -1
- package/dist/cjs/hooks/useCtaClickHandler.js +3 -1
- package/dist/cjs/hooks/useCtaClickHandler.js.map +1 -1
- package/dist/cjs/hooks/useCurrentSellers.d.ts.map +1 -1
- package/dist/cjs/hooks/useCurrentSellers.js +3 -1
- package/dist/cjs/hooks/useCurrentSellers.js.map +1 -1
- package/dist/cjs/hooks/useExchanges.d.ts +0 -1
- package/dist/cjs/hooks/useExchanges.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/bundle/filter.d.ts +0 -1
- package/dist/cjs/lib/bundle/filter.d.ts.map +1 -1
- package/dist/cjs/lib/const/chainInfo.d.ts.map +1 -1
- package/dist/cjs/lib/const/chainInfo.js +0 -9
- package/dist/cjs/lib/const/chainInfo.js.map +1 -1
- package/dist/cjs/lib/const/chains.d.ts +1 -1
- package/dist/cjs/lib/const/chains.d.ts.map +1 -1
- package/dist/cjs/lib/const/chains.js +2 -2
- package/dist/cjs/lib/const/chains.js.map +1 -1
- package/dist/cjs/lib/errors/eth-revert-reason.js +1 -1
- package/dist/cjs/lib/errors/eth-revert-reason.js.map +1 -1
- package/dist/cjs/lib/numbers/numbers.d.ts.map +1 -1
- package/dist/cjs/lib/numbers/numbers.js +2 -8
- package/dist/cjs/lib/numbers/numbers.js.map +1 -1
- package/dist/cjs/lib/opensea/getOpenSeaUrl.d.ts.map +1 -1
- package/dist/cjs/lib/opensea/getOpenSeaUrl.js +0 -8
- package/dist/cjs/lib/opensea/getOpenSeaUrl.js.map +1 -1
- package/dist/esm/assets/logo.svg +11 -5
- package/dist/esm/components/buttons/Button.d.ts +3 -3
- package/dist/esm/components/buttons/Button.d.ts.map +1 -1
- package/dist/esm/components/buttons/Button.js.map +1 -1
- package/dist/esm/components/buttons/CommitButtonView.d.ts +20 -0
- package/dist/esm/components/buttons/CommitButtonView.d.ts.map +1 -0
- package/dist/esm/components/buttons/CommitButtonView.js +52 -0
- package/dist/esm/components/buttons/CommitButtonView.js.map +1 -0
- package/dist/esm/components/cta/offer/CommitButton.js +1 -1
- package/dist/esm/components/cta/offer/CommitButton.js.map +1 -1
- package/dist/esm/components/modal/components/Commit/CommitNonModal.js +2 -2
- package/dist/esm/components/modal/components/Commit/CommitNonModal.js.map +1 -1
- package/dist/esm/components/modal/components/PurchaseOverview/PurchaseOverview.d.ts +9 -0
- package/dist/esm/components/modal/components/PurchaseOverview/PurchaseOverview.d.ts.map +1 -0
- package/dist/esm/components/modal/components/PurchaseOverview/PurchaseOverview.js +17 -0
- package/dist/esm/components/modal/components/PurchaseOverview/PurchaseOverview.js.map +1 -0
- package/dist/esm/components/modal/components/SellerFinance/FinanceDeposit.d.ts.map +1 -1
- package/dist/esm/components/modal/components/SellerFinance/FinanceDeposit.js +5 -2
- package/dist/esm/components/modal/components/SellerFinance/FinanceDeposit.js.map +1 -1
- package/dist/esm/components/modal/components/SellerFinance/FinanceWithdraw.d.ts.map +1 -1
- package/dist/esm/components/modal/components/SellerFinance/FinanceWithdraw.js +7 -2
- package/dist/esm/components/modal/components/SellerFinance/FinanceWithdraw.js.map +1 -1
- package/dist/esm/components/modal/components/common/StepsOverview/PurchaseOverview.js +3 -3
- package/dist/esm/components/modal/components/common/StepsOverview/PurchaseOverview.js.map +1 -1
- package/dist/esm/components/modal/components/common/StepsOverview/PurchaseOverviewView.d.ts +1 -1
- package/dist/esm/components/modal/components/common/StepsOverview/PurchaseOverviewView.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/StepsOverview/PurchaseOverviewView.js +4 -4
- package/dist/esm/components/modal/components/common/StepsOverview/PurchaseOverviewView.js.map +1 -1
- package/dist/esm/components/modal/components/common/detail/Detail.style.d.ts +7 -7
- package/dist/esm/components/modal/components/common/detail/DetailSlider.d.ts.map +1 -1
- package/dist/esm/components/modal/components/common/detail/DetailSlider.js +1 -1
- package/dist/esm/components/modal/components/common/detail/DetailSlider.js.map +1 -1
- package/dist/esm/components/modal/nonModal/Header.d.ts.map +1 -1
- package/dist/esm/components/modal/nonModal/Header.js +1 -0
- package/dist/esm/components/modal/nonModal/Header.js.map +1 -1
- package/dist/esm/components/styles/GlobalStyle.d.ts.map +1 -1
- package/dist/esm/components/styles/GlobalStyle.js +0 -1
- package/dist/esm/components/styles/GlobalStyle.js.map +1 -1
- package/dist/esm/components/ui/ThemedButton.d.ts +11 -5
- package/dist/esm/components/ui/ThemedButton.d.ts.map +1 -1
- package/dist/esm/components/ui/ThemedButton.js +14 -8
- package/dist/esm/components/ui/ThemedButton.js.map +1 -1
- package/dist/esm/components/ui/Video.d.ts +1 -0
- package/dist/esm/components/ui/Video.d.ts.map +1 -1
- package/dist/esm/components/ui/Video.js +2 -2
- package/dist/esm/components/ui/Video.js.map +1 -1
- package/dist/esm/components/ui/styles.js +1 -1
- package/dist/esm/components/wallet/wallet-connection.d.ts +136 -136
- package/dist/esm/components/widgets/finance/FinanceWidget.d.ts +4 -9
- package/dist/esm/components/widgets/finance/FinanceWidget.d.ts.map +1 -1
- package/dist/esm/components/widgets/finance/FinanceWidget.js +6 -24
- package/dist/esm/components/widgets/finance/FinanceWidget.js.map +1 -1
- package/dist/esm/components/widgets/finance/FinanceWidgetProviders.d.ts +11 -0
- package/dist/esm/components/widgets/finance/FinanceWidgetProviders.d.ts.map +1 -0
- package/dist/esm/components/widgets/finance/FinanceWidgetProviders.js +23 -0
- package/dist/esm/components/widgets/finance/FinanceWidgetProviders.js.map +1 -0
- package/dist/esm/hooks/useCtaClickHandler.d.ts.map +1 -1
- package/dist/esm/hooks/useCtaClickHandler.js +3 -1
- package/dist/esm/hooks/useCtaClickHandler.js.map +1 -1
- package/dist/esm/hooks/useCurrentSellers.d.ts.map +1 -1
- package/dist/esm/hooks/useCurrentSellers.js +3 -1
- package/dist/esm/hooks/useCurrentSellers.js.map +1 -1
- package/dist/esm/hooks/useExchanges.d.ts +0 -1
- package/dist/esm/hooks/useExchanges.d.ts.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/bundle/filter.d.ts +0 -1
- package/dist/esm/lib/bundle/filter.d.ts.map +1 -1
- package/dist/esm/lib/const/chainInfo.d.ts.map +1 -1
- package/dist/esm/lib/const/chainInfo.js +0 -9
- package/dist/esm/lib/const/chainInfo.js.map +1 -1
- package/dist/esm/lib/const/chains.d.ts +1 -1
- package/dist/esm/lib/const/chains.d.ts.map +1 -1
- package/dist/esm/lib/const/chains.js +2 -2
- package/dist/esm/lib/const/chains.js.map +1 -1
- package/dist/esm/lib/errors/eth-revert-reason.js +1 -1
- package/dist/esm/lib/errors/eth-revert-reason.js.map +1 -1
- package/dist/esm/lib/numbers/numbers.d.ts.map +1 -1
- package/dist/esm/lib/numbers/numbers.js +3 -9
- package/dist/esm/lib/numbers/numbers.js.map +1 -1
- package/dist/esm/lib/opensea/getOpenSeaUrl.d.ts.map +1 -1
- package/dist/esm/lib/opensea/getOpenSeaUrl.js +0 -8
- package/dist/esm/lib/opensea/getOpenSeaUrl.js.map +1 -1
- package/package.json +4 -4
- package/src/assets/logo.svg +11 -5
- package/src/components/buttons/Button.tsx +2 -1
- package/src/components/buttons/CommitButtonView.tsx +118 -0
- package/src/components/cta/offer/CommitButton.tsx +1 -1
- package/src/components/modal/components/Commit/CommitNonModal.tsx +2 -2
- package/src/components/modal/components/PurchaseOverview/PurchaseOverview.tsx +45 -0
- package/src/components/modal/components/SellerFinance/FinanceDeposit.tsx +8 -2
- package/src/components/modal/components/SellerFinance/FinanceWithdraw.tsx +9 -5
- package/src/components/modal/components/common/StepsOverview/PurchaseOverview.tsx +5 -5
- package/src/components/modal/components/common/StepsOverview/PurchaseOverviewView.tsx +11 -8
- package/src/components/modal/components/common/detail/DetailSlider.tsx +1 -0
- package/src/components/modal/nonModal/Header.tsx +1 -0
- package/src/components/styles/GlobalStyle.tsx +0 -1
- package/src/components/ui/ThemedButton.tsx +14 -8
- package/src/components/ui/Video.tsx +8 -4
- package/src/components/ui/styles.ts +1 -1
- package/src/components/widgets/finance/FinanceWidget.tsx +16 -57
- package/src/components/widgets/finance/FinanceWidgetProviders.tsx +60 -0
- package/src/hooks/useCtaClickHandler.ts +8 -3
- package/src/hooks/useCurrentSellers.ts +3 -1
- package/src/index.tsx +2 -0
- package/src/lib/const/chainInfo.ts +0 -9
- package/src/lib/const/chains.ts +2 -2
- package/src/lib/errors/eth-revert-reason.ts +1 -1
- package/src/lib/numbers/numbers.ts +3 -9
- package/src/lib/opensea/getOpenSeaUrl.ts +0 -10
- package/src/stories/PurchaseOverview.stories.tsx +29 -0
- package/src/stories/buttons/CommitButtonView.stories.tsx +44 -0
- package/src/stories/cta/dispute/AddFeesDisputeResolverButton.stories.tsx +2 -2
- package/src/stories/cta/dispute/AddSellerToDisputeResolverButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/CreateDisputeResolverButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/DecideDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/EscalateDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/ExpireDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/ExpireEscalationDisputeButton.stories.tsx +2 -2
- package/src/stories/cta/dispute/ExtendDisputeTimeoutButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/RaiseDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/RefuseDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/RemoveFeesDisputeResolverButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/RemoveSellerFromDisputeResolverButton.stories.tsx +2 -2
- package/src/stories/cta/dispute/ResolveDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/RetractDisputeButton.stories.tsx +4 -2
- package/src/stories/cta/dispute/UpdateDisputeResolverButton.stories.tsx +4 -2
- package/src/stories/cta/exchange/BatchCompleteButton.stories.tsx +4 -2
- package/src/stories/cta/exchange/CancelButton.stories.tsx +4 -2
- package/src/stories/cta/exchange/CompleteButton.stories.tsx +4 -2
- package/src/stories/cta/exchange/ExpireButton.stories.tsx +4 -2
- package/src/stories/cta/exchange/RevokeButton.stories.tsx +4 -2
- package/src/stories/cta/funds/DepositFundsButton.stories.tsx +4 -2
- package/src/stories/cta/funds/WithdrawAllFunds.stories.tsx +4 -2
- package/src/stories/cta/funds/WithdrawFundsButton.stories.tsx +4 -2
- package/src/stories/cta/offer/BatchVoidButton.stories.tsx +4 -2
- package/src/stories/cta/offer/CommitButton.stories.tsx +4 -2
- package/src/stories/cta/offer/CreateOfferButton.stories.tsx +4 -2
- package/src/stories/cta/offer/VoidButton.stories.tsx +4 -2
- package/src/stories/cta/seller/CreateSellerButton.stories.tsx +4 -2
- package/src/stories/cta/seller/UpdateSellerButton.stories.tsx +4 -2
- package/src/stories/helpers/CtaButtonWrapper.tsx +32 -5
- package/src/stories/helpers/connect-wallet.ts +45 -15
- package/src/stories/widgets/Finance.stories.tsx +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { ReactNode, useCallback } from "react";
|
|
2
|
+
import { PurchaseOverviewView } from "../common/StepsOverview/PurchaseOverviewView";
|
|
3
|
+
import NonModal from "../../nonModal/NonModal";
|
|
4
|
+
import { BosonFooter } from "../common/BosonFooter";
|
|
5
|
+
import { theme } from "../../../../theme";
|
|
6
|
+
import { CSSProperties } from "styled-components";
|
|
7
|
+
const colors = theme.colors.light;
|
|
8
|
+
|
|
9
|
+
export type PurchaseOverviewProps = {
|
|
10
|
+
lookAndFeel: "regular" | "modal";
|
|
11
|
+
hideModal: () => void;
|
|
12
|
+
modalMargin?: CSSProperties["margin"];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const PurchaseOverview: React.FC<PurchaseOverviewProps> = ({
|
|
16
|
+
lookAndFeel,
|
|
17
|
+
hideModal,
|
|
18
|
+
modalMargin
|
|
19
|
+
}) => {
|
|
20
|
+
const Wrapper = useCallback(
|
|
21
|
+
({ children }: { children: ReactNode }) => {
|
|
22
|
+
return lookAndFeel === "regular" ? (
|
|
23
|
+
<>{children}</>
|
|
24
|
+
) : (
|
|
25
|
+
<div style={{ margin: modalMargin }}>{children}</div>
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
[lookAndFeel, modalMargin]
|
|
29
|
+
);
|
|
30
|
+
return (
|
|
31
|
+
<Wrapper>
|
|
32
|
+
<NonModal
|
|
33
|
+
hideModal={hideModal}
|
|
34
|
+
footerComponent={<BosonFooter />}
|
|
35
|
+
contentStyle={{
|
|
36
|
+
background: colors.white
|
|
37
|
+
}}
|
|
38
|
+
lookAndFeel={lookAndFeel}
|
|
39
|
+
showConnectButton={false}
|
|
40
|
+
>
|
|
41
|
+
<PurchaseOverviewView />
|
|
42
|
+
</NonModal>
|
|
43
|
+
</Wrapper>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
extractUserFriendlyError,
|
|
16
16
|
getHasUserRejectedTx
|
|
17
17
|
} from "../../../../lib/errors/transactions";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
getNumberWithDecimals,
|
|
20
|
+
getNumberWithoutDecimals
|
|
21
|
+
} from "../../../../lib/numbers/numbers";
|
|
19
22
|
import { poll } from "../../../../lib/promises/promises";
|
|
20
23
|
import { DepositFundsButton } from "../../../cta/funds/DepositFundsButton";
|
|
21
24
|
import { useEnvContext } from "../../../environment/EnvironmentContext";
|
|
@@ -75,6 +78,9 @@ export default function FinanceDeposit({
|
|
|
75
78
|
|
|
76
79
|
const tokenStep = 10 ** -Number(tokenDecimals);
|
|
77
80
|
const step = 0.01;
|
|
81
|
+
const balanceWithDecimals = dataBalance
|
|
82
|
+
? getNumberWithDecimals(dataBalance.toString(), tokenDecimals)
|
|
83
|
+
: Number.MAX_SAFE_INTEGER;
|
|
78
84
|
|
|
79
85
|
const handleChangeDepositAmount = (
|
|
80
86
|
e: React.ChangeEvent<HTMLInputElement>
|
|
@@ -84,7 +90,7 @@ export default function FinanceDeposit({
|
|
|
84
90
|
const value = e.target.valueAsNumber || 0;
|
|
85
91
|
setIsDepositInvalid(false);
|
|
86
92
|
setDepositError(null);
|
|
87
|
-
if (value < tokenStep || value >
|
|
93
|
+
if (value < tokenStep || value > balanceWithDecimals) {
|
|
88
94
|
setIsDepositInvalid(true);
|
|
89
95
|
}
|
|
90
96
|
setAmountToDeposit(valueStr);
|
|
@@ -97,12 +97,16 @@ export default function FinanceWithdraw({
|
|
|
97
97
|
const value = e.target.valueAsNumber || 0;
|
|
98
98
|
setIsWithdrawInvalid(false);
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
try {
|
|
101
|
+
const availableFundsBig = getNumberWithDecimals(
|
|
102
|
+
availableAmount,
|
|
103
|
+
tokenDecimals
|
|
104
|
+
);
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
if (value < tokenStep || value > availableFundsBig || !value) {
|
|
107
|
+
setIsWithdrawInvalid(true);
|
|
108
|
+
}
|
|
109
|
+
} catch (e) {
|
|
106
110
|
setIsWithdrawInvalid(true);
|
|
107
111
|
}
|
|
108
112
|
|
|
@@ -35,9 +35,9 @@ const CommitStepWrapper = styled.div`
|
|
|
35
35
|
const COMMIT_STEPS = [
|
|
36
36
|
{
|
|
37
37
|
icon: ShoppingCart,
|
|
38
|
-
header: "Commit",
|
|
38
|
+
header: "Commit to Buy",
|
|
39
39
|
description:
|
|
40
|
-
"Commit to an
|
|
40
|
+
"Commit to buy an offer to receive a Redeemable NFT (rNFT) that can be exchanged for the real-world item it represents"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
icon: CurrencyCircleDollar,
|
|
@@ -63,9 +63,9 @@ export default function PurchaseOverview() {
|
|
|
63
63
|
<b>How does the purchase process work?</b>
|
|
64
64
|
</Typography>
|
|
65
65
|
<Typography tag="p">
|
|
66
|
-
When Committing, the item price will be transferred into escrow
|
|
67
|
-
you will receive a redeemable NFT (rNFT) that can be exchanged for
|
|
68
|
-
real-world item it represents.
|
|
66
|
+
When Committing to Buy, the item price will be transferred into escrow
|
|
67
|
+
and you will receive a redeemable NFT (rNFT) that can be exchanged for
|
|
68
|
+
the real-world item it represents.
|
|
69
69
|
</Typography>
|
|
70
70
|
</Grid>
|
|
71
71
|
<CommitStepWrapper>
|
|
@@ -7,7 +7,7 @@ import { Grid } from "../../../../ui/Grid";
|
|
|
7
7
|
|
|
8
8
|
const colors = theme.colors.light;
|
|
9
9
|
type Props = {
|
|
10
|
-
onBackClick
|
|
10
|
+
onBackClick?: () => void;
|
|
11
11
|
};
|
|
12
12
|
export function PurchaseOverviewView({ onBackClick }: Props) {
|
|
13
13
|
const dispatch = useNonModalContext();
|
|
@@ -16,11 +16,15 @@ export function PurchaseOverviewView({ onBackClick }: Props) {
|
|
|
16
16
|
payload: {
|
|
17
17
|
headerComponent: (
|
|
18
18
|
<Grid style={{ flex: "1" }}>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
{onBackClick && (
|
|
20
|
+
<ArrowLeft
|
|
21
|
+
onClick={() => {
|
|
22
|
+
onBackClick();
|
|
23
|
+
}}
|
|
24
|
+
size={32}
|
|
25
|
+
style={{ cursor: "pointer" }}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
24
28
|
</Grid>
|
|
25
29
|
),
|
|
26
30
|
contentStyle: {
|
|
@@ -28,7 +32,6 @@ export function PurchaseOverviewView({ onBackClick }: Props) {
|
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
});
|
|
31
|
-
|
|
32
|
-
}, [dispatch]);
|
|
35
|
+
}, [dispatch, onBackClick]);
|
|
33
36
|
return <PurchaseOverview />;
|
|
34
37
|
}
|
|
@@ -207,7 +207,7 @@ const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
|
207
207
|
outline: {
|
|
208
208
|
color: colors.black,
|
|
209
209
|
borderColor: colors.border,
|
|
210
|
-
borderWidth:
|
|
210
|
+
borderWidth: 2,
|
|
211
211
|
hover: {
|
|
212
212
|
background: colors.border,
|
|
213
213
|
color: "var(--accent)"
|
|
@@ -222,7 +222,6 @@ const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
|
222
222
|
},
|
|
223
223
|
blank: {
|
|
224
224
|
color: `${colors.black}4d`,
|
|
225
|
-
padding: "0.75rem 0.5rem",
|
|
226
225
|
hover: {
|
|
227
226
|
color: colors.black
|
|
228
227
|
},
|
|
@@ -233,7 +232,6 @@ const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
|
233
232
|
},
|
|
234
233
|
blankSecondary: {
|
|
235
234
|
color: "var(--accent)",
|
|
236
|
-
padding: "0.75rem 0.5rem",
|
|
237
235
|
hover: {
|
|
238
236
|
borderColor: colors.secondary,
|
|
239
237
|
background: colors.border,
|
|
@@ -242,7 +240,7 @@ const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
|
242
240
|
},
|
|
243
241
|
blankSecondaryOutline: {
|
|
244
242
|
color: "var(--accent)",
|
|
245
|
-
borderWidth:
|
|
243
|
+
borderWidth: 2,
|
|
246
244
|
borderColor: colors.secondary,
|
|
247
245
|
hover: {
|
|
248
246
|
borderColor: colors.secondary,
|
|
@@ -252,8 +250,7 @@ const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
|
252
250
|
},
|
|
253
251
|
blankOutline: {
|
|
254
252
|
color: colors.black,
|
|
255
|
-
|
|
256
|
-
borderWidth: 1,
|
|
253
|
+
borderWidth: 2,
|
|
257
254
|
hover: {
|
|
258
255
|
borderColor: colors.secondary,
|
|
259
256
|
background: colors.border,
|
|
@@ -263,14 +260,23 @@ const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
|
263
260
|
white: {
|
|
264
261
|
color: colors.black,
|
|
265
262
|
background: colors.white,
|
|
266
|
-
|
|
267
|
-
borderWidth: 1,
|
|
263
|
+
borderWidth: 2,
|
|
268
264
|
borderColor: colors.border,
|
|
269
265
|
hover: {
|
|
270
266
|
color: colors.white,
|
|
271
267
|
background: colors.black
|
|
272
268
|
}
|
|
273
269
|
},
|
|
270
|
+
black: {
|
|
271
|
+
color: colors.white,
|
|
272
|
+
background: colors.black,
|
|
273
|
+
borderWidth: 2,
|
|
274
|
+
borderColor: colors.black,
|
|
275
|
+
hover: {
|
|
276
|
+
color: colors.black,
|
|
277
|
+
background: colors.white
|
|
278
|
+
}
|
|
279
|
+
},
|
|
274
280
|
warning: {
|
|
275
281
|
color: colors.black,
|
|
276
282
|
borderColor: colors.orange,
|
|
@@ -96,6 +96,7 @@ interface IVideo {
|
|
|
96
96
|
showPlaceholderText?: boolean;
|
|
97
97
|
noPreload?: boolean;
|
|
98
98
|
videoProps?: VideoHTMLAttributes<HTMLElement>;
|
|
99
|
+
withMuteButton?: boolean;
|
|
99
100
|
componentWhileLoading?: () => ReactElement;
|
|
100
101
|
}
|
|
101
102
|
const Video: React.FC<IVideo & React.HTMLAttributes<HTMLDivElement>> = ({
|
|
@@ -105,6 +106,7 @@ const Video: React.FC<IVideo & React.HTMLAttributes<HTMLDivElement>> = ({
|
|
|
105
106
|
showPlaceholderText = true,
|
|
106
107
|
noPreload = false,
|
|
107
108
|
videoProps,
|
|
109
|
+
withMuteButton,
|
|
108
110
|
componentWhileLoading: ComponentWhileLoading,
|
|
109
111
|
...rest
|
|
110
112
|
}) => {
|
|
@@ -222,10 +224,12 @@ const Video: React.FC<IVideo & React.HTMLAttributes<HTMLDivElement>> = ({
|
|
|
222
224
|
{children || ""}
|
|
223
225
|
{videoSrc && (
|
|
224
226
|
<>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
{withMuteButton && (
|
|
228
|
+
<StyledMuteButton
|
|
229
|
+
muted={muted}
|
|
230
|
+
onClick={() => setMuted((prev) => !prev)}
|
|
231
|
+
/>
|
|
232
|
+
)}
|
|
229
233
|
<VideoHtml
|
|
230
234
|
ref={videoRef}
|
|
231
235
|
data-testid={dataTestId}
|
|
@@ -7,32 +7,20 @@ import styled from "styled-components";
|
|
|
7
7
|
import { useAccount } from "../../../hooks/connection/connection";
|
|
8
8
|
import { useDisconnect } from "../../../hooks/connection/useDisconnect";
|
|
9
9
|
import { useCurrentSellers } from "../../../hooks/useCurrentSellers";
|
|
10
|
-
import { CONFIG } from "../../../lib/config/config";
|
|
11
|
-
import {
|
|
12
|
-
ConfigProvider,
|
|
13
|
-
ConfigProviderProps
|
|
14
|
-
} from "../../config/ConfigProvider";
|
|
15
|
-
import { MagicProvider } from "../../magicLink/MagicProvider";
|
|
16
|
-
import ModalProvider from "../../modal/ModalProvider";
|
|
17
|
-
import { SignerProvider } from "../../signer/SignerProvider";
|
|
18
|
-
import GlobalStyle from "../../styles/GlobalStyle";
|
|
19
10
|
import { Grid } from "../../ui/Grid";
|
|
20
11
|
import Loading from "../../ui/loading/Loading";
|
|
21
12
|
import ConnectButton from "../../wallet/ConnectButton";
|
|
22
|
-
import WalletConnectionProvider from "../../wallet/WalletConnectionProvider";
|
|
23
|
-
import { getParentWindowOrigin } from "../common";
|
|
24
|
-
import { CommonWidgetTypes } from "../types";
|
|
25
13
|
import Finance, { Props } from "./Finance";
|
|
26
|
-
import ConvertionRateProvider, {
|
|
27
|
-
ConvertionRateProviderProps
|
|
28
|
-
} from "./convertion-rate/ConvertionRateProvider";
|
|
29
14
|
import { useConvertionRate } from "./convertion-rate/useConvertionRate";
|
|
30
15
|
import { useExchangeTokens } from "./exchange-tokens/useExchangeTokens";
|
|
31
16
|
import useFunds from "./useFunds";
|
|
32
17
|
import { useOffersBacked } from "./useOffersBacked";
|
|
33
18
|
import { useSellerDeposit } from "./useSellerDeposit";
|
|
34
19
|
import { useSellerRoles } from "./useSellerRoles";
|
|
35
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
FinanceWidgetProviders,
|
|
22
|
+
FinanceWidgetProvidersProps
|
|
23
|
+
} from "./FinanceWidgetProviders";
|
|
36
24
|
dayjs.extend(isBetween);
|
|
37
25
|
|
|
38
26
|
const StyledConnectButton = styled(ConnectButton)`
|
|
@@ -146,49 +134,20 @@ function WithSellerData(WrappedComponent: React.ComponentType<Props>) {
|
|
|
146
134
|
}
|
|
147
135
|
|
|
148
136
|
const Component = WithSellerData(Finance);
|
|
149
|
-
type FinanceWidgetProps = {
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
CommonWidgetTypes &
|
|
153
|
-
ConvertionRateProviderProps & {
|
|
154
|
-
sellerId: string | null | undefined;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const { infuraKey, magicLinkKey } = CONFIG;
|
|
137
|
+
type FinanceWidgetProps = FinanceWidgetProvidersProps & {
|
|
138
|
+
sellerId: string | null | undefined;
|
|
139
|
+
};
|
|
158
140
|
|
|
159
141
|
export function FinanceWidget(props: FinanceWidgetProps) {
|
|
160
|
-
const
|
|
161
|
-
const { walletConnectProjectId, sellerId, withExternalSigner } = props;
|
|
142
|
+
const { sellerId, withExternalSigner } = props;
|
|
162
143
|
return (
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
withExternalSigner={withExternalSigner}
|
|
172
|
-
>
|
|
173
|
-
<MagicProvider>
|
|
174
|
-
<WalletConnectionProvider
|
|
175
|
-
walletConnectProjectId={walletConnectProjectId}
|
|
176
|
-
>
|
|
177
|
-
<ConvertionRateProvider>
|
|
178
|
-
<ModalProvider>
|
|
179
|
-
{!withExternalSigner && (
|
|
180
|
-
<Grid justifyContent="flex-end">
|
|
181
|
-
<StyledConnectButton showChangeWallet />
|
|
182
|
-
</Grid>
|
|
183
|
-
)}
|
|
184
|
-
<Component sellerId={sellerId ?? undefined} />
|
|
185
|
-
</ModalProvider>
|
|
186
|
-
</ConvertionRateProvider>
|
|
187
|
-
</WalletConnectionProvider>
|
|
188
|
-
</MagicProvider>
|
|
189
|
-
</SignerProvider>
|
|
190
|
-
</ConfigProvider>
|
|
144
|
+
<FinanceWidgetProviders {...props}>
|
|
145
|
+
{!withExternalSigner && (
|
|
146
|
+
<Grid justifyContent="flex-end">
|
|
147
|
+
<StyledConnectButton showChangeWallet />
|
|
148
|
+
</Grid>
|
|
149
|
+
)}
|
|
150
|
+
<Component sellerId={sellerId ?? undefined} />
|
|
151
|
+
</FinanceWidgetProviders>
|
|
191
152
|
);
|
|
192
153
|
}
|
|
193
|
-
|
|
194
|
-
export default withQueryClientProvider(FinanceWidget);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { CONFIG } from "../../../lib/config/config";
|
|
3
|
+
import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";
|
|
4
|
+
import { Omit } from "utility-types";
|
|
5
|
+
import { CommonWidgetTypes } from "../types";
|
|
6
|
+
import { SignerProvider } from "../../signer/SignerProvider";
|
|
7
|
+
import GlobalStyle from "../../styles/GlobalStyle";
|
|
8
|
+
import {
|
|
9
|
+
ConfigProvider,
|
|
10
|
+
ConfigProviderProps
|
|
11
|
+
} from "../../config/ConfigProvider";
|
|
12
|
+
import ConvertionRateProvider, {
|
|
13
|
+
ConvertionRateProviderProps
|
|
14
|
+
} from "./convertion-rate/ConvertionRateProvider";
|
|
15
|
+
import WalletConnectionProvider, {
|
|
16
|
+
WalletConnectionProviderProps
|
|
17
|
+
} from "../../wallet/WalletConnectionProvider";
|
|
18
|
+
import ModalProvider from "../../modal/ModalProvider";
|
|
19
|
+
import { MagicProvider } from "../../magicLink/MagicProvider";
|
|
20
|
+
import { getParentWindowOrigin } from "../common";
|
|
21
|
+
|
|
22
|
+
export type FinanceWidgetProvidersProps = Omit<
|
|
23
|
+
WalletConnectionProviderProps,
|
|
24
|
+
"children" | "envName"
|
|
25
|
+
> &
|
|
26
|
+
Omit<ConfigProviderProps, "magicLinkKey" | "infuraKey"> &
|
|
27
|
+
CommonWidgetTypes &
|
|
28
|
+
ConvertionRateProviderProps & {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const { infuraKey, magicLinkKey } = CONFIG;
|
|
33
|
+
|
|
34
|
+
export const FinanceWidgetProviders: React.FC<FinanceWidgetProvidersProps> =
|
|
35
|
+
withQueryClientProvider(({ children, ...props }) => {
|
|
36
|
+
const parentOrigin = getParentWindowOrigin();
|
|
37
|
+
return (
|
|
38
|
+
<ConfigProvider
|
|
39
|
+
magicLinkKey={magicLinkKey}
|
|
40
|
+
infuraKey={infuraKey}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<GlobalStyle />
|
|
44
|
+
<SignerProvider
|
|
45
|
+
parentOrigin={parentOrigin}
|
|
46
|
+
withExternalSigner={props.withExternalSigner}
|
|
47
|
+
>
|
|
48
|
+
<MagicProvider>
|
|
49
|
+
<WalletConnectionProvider
|
|
50
|
+
walletConnectProjectId={props.walletConnectProjectId}
|
|
51
|
+
>
|
|
52
|
+
<ConvertionRateProvider>
|
|
53
|
+
<ModalProvider>{children}</ModalProvider>
|
|
54
|
+
</ConvertionRateProvider>
|
|
55
|
+
</WalletConnectionProvider>
|
|
56
|
+
</MagicProvider>
|
|
57
|
+
</SignerProvider>
|
|
58
|
+
</ConfigProvider>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
@@ -135,9 +135,14 @@ export function useCtaClickHandler<T>({
|
|
|
135
135
|
onSuccess?.(receipt as providers.TransactionReceipt, payload);
|
|
136
136
|
}
|
|
137
137
|
} catch (error) {
|
|
138
|
-
onError?.(
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
onError?.(
|
|
139
|
+
typeof error === "object"
|
|
140
|
+
? (coreSdk.parseError(error as object) as Error)
|
|
141
|
+
: (error as Error),
|
|
142
|
+
{
|
|
143
|
+
txResponse: txResponse as providers.TransactionResponse
|
|
144
|
+
}
|
|
145
|
+
);
|
|
141
146
|
} finally {
|
|
142
147
|
setIsLoading(false);
|
|
143
148
|
}
|
|
@@ -360,7 +360,9 @@ export function useCurrentSellers(
|
|
|
360
360
|
resultByAddress.data
|
|
361
361
|
? resultByAddress.data.sellers.map((seller) => seller.id)
|
|
362
362
|
: sellerAddressType === "SELLER_IDS"
|
|
363
|
-
?
|
|
363
|
+
? Array.isArray(sellerAddress)
|
|
364
|
+
? sellerAddress
|
|
365
|
+
: [sellerAddress]
|
|
364
366
|
: []
|
|
365
367
|
).filter((sellerId) => !!sellerId) as string[];
|
|
366
368
|
}, [resultByAddress.data, sellerAddress, sellerAddressType]);
|
package/src/index.tsx
CHANGED
|
@@ -6,6 +6,7 @@ export { default as ThemedButton, IButton } from "./components/ui/ThemedButton";
|
|
|
6
6
|
export * from "./components/ui/zIndex";
|
|
7
7
|
export * from "./components/ui/buttonSize";
|
|
8
8
|
export * from "./components/buttons/Button";
|
|
9
|
+
export * from "./components/buttons/CommitButtonView";
|
|
9
10
|
export * from "./components/cta/exchange/BatchCompleteButton";
|
|
10
11
|
export * from "./components/cta/exchange/CancelButton";
|
|
11
12
|
export * from "./components/cta/exchange/CompleteButton";
|
|
@@ -49,6 +50,7 @@ export * from "./components/magicLink/MagicProvider";
|
|
|
49
50
|
export * from "./components/magicLink/UserContext";
|
|
50
51
|
export * from "./components/modal/components/common/OfferFullDescription/ExternalOfferFullDescription";
|
|
51
52
|
export * from "./components/modal/components/common/detail/useGetOfferDetailData";
|
|
53
|
+
export * from "./components/modal/components/PurchaseOverview/PurchaseOverview";
|
|
52
54
|
export * from "./components/modal/components/Commit/DetailView/ExternalCommitDetailView";
|
|
53
55
|
export * from "./components/modal/components/Redeem/DetailView/ExternalExchangeDetailView";
|
|
54
56
|
export * from "./components/ui/Grid";
|
|
@@ -62,15 +62,6 @@ const CHAIN_INFO: ChainInfoMap = {
|
|
|
62
62
|
logoUrl: ethereumLogoUrl,
|
|
63
63
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }
|
|
64
64
|
},
|
|
65
|
-
[ChainId.GOERLI]: {
|
|
66
|
-
networkType: NetworkType.L1,
|
|
67
|
-
docs: "https://docs.uniswap.org/",
|
|
68
|
-
explorer: "https://goerli.etherscan.io/",
|
|
69
|
-
infoLink: "https://info.uniswap.org/#/",
|
|
70
|
-
label: "Görli",
|
|
71
|
-
logoUrl: ethereumLogoUrl,
|
|
72
|
-
nativeCurrency: { name: "Görli Ether", symbol: "görETH", decimals: 18 }
|
|
73
|
-
},
|
|
74
65
|
[ChainId.SEPOLIA]: {
|
|
75
66
|
networkType: NetworkType.L1,
|
|
76
67
|
docs: "https://docs.uniswap.org/",
|
package/src/lib/const/chains.ts
CHANGED
|
@@ -45,7 +45,7 @@ async function validateInputPreProvider(txHash: string, network: string) {
|
|
|
45
45
|
) {
|
|
46
46
|
throw new Error("Invalid transaction hash");
|
|
47
47
|
}
|
|
48
|
-
const networks = ["mainnet", "
|
|
48
|
+
const networks = ["mainnet", "sepolia"];
|
|
49
49
|
if (!networks.includes(network)) {
|
|
50
50
|
throw new Error("Not a valid network");
|
|
51
51
|
}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { utils } from "ethers";
|
|
2
2
|
|
|
3
3
|
export const getNumberWithoutDecimals = (
|
|
4
4
|
value: string,
|
|
5
5
|
decimals: string
|
|
6
6
|
): string => {
|
|
7
|
-
|
|
8
|
-
if (!Number.isInteger(valueAsNumber)) {
|
|
9
|
-
return Math.floor(valueAsNumber * 10 ** Number(decimals)).toString();
|
|
10
|
-
}
|
|
11
|
-
return BigNumber.from(valueAsNumber + "")
|
|
12
|
-
.mul(BigNumber.from(10).pow(BigNumber.from(decimals)))
|
|
13
|
-
.toString();
|
|
7
|
+
return utils.parseUnits(value, decimals).toString();
|
|
14
8
|
};
|
|
15
9
|
|
|
16
10
|
export const getNumberWithDecimals = (
|
|
17
11
|
value: string,
|
|
18
12
|
decimals: string
|
|
19
13
|
): number => {
|
|
20
|
-
return Number(value
|
|
14
|
+
return Number(utils.formatUnits(value, decimals));
|
|
21
15
|
};
|
|
22
16
|
|
|
23
17
|
/**
|
|
@@ -11,11 +11,6 @@ const openSeaUrlMap = new Map([
|
|
|
11
11
|
(tokenId: string, contractAddress: string) =>
|
|
12
12
|
`https://testnets.opensea.io/assets/mumbai/${contractAddress}/${tokenId}`
|
|
13
13
|
],
|
|
14
|
-
[
|
|
15
|
-
"testing-5-0",
|
|
16
|
-
(tokenId: string, contractAddress: string) =>
|
|
17
|
-
`https://testnets.opensea.io/assets/goerli/${contractAddress}/${tokenId}`
|
|
18
|
-
],
|
|
19
14
|
[
|
|
20
15
|
"testing-11155111-0",
|
|
21
16
|
(tokenId: string, contractAddress: string) =>
|
|
@@ -31,11 +26,6 @@ const openSeaUrlMap = new Map([
|
|
|
31
26
|
(tokenId: string, contractAddress: string) =>
|
|
32
27
|
`https://testnets.opensea.io/assets/mumbai/${contractAddress}/${tokenId}`
|
|
33
28
|
],
|
|
34
|
-
[
|
|
35
|
-
"staging-5-0",
|
|
36
|
-
(tokenId: string, contractAddress: string) =>
|
|
37
|
-
`https://testnets.opensea.io/assets/goerli/${contractAddress}/${tokenId}`
|
|
38
|
-
],
|
|
39
29
|
[
|
|
40
30
|
"staging-11155111-0",
|
|
41
31
|
(tokenId: string, contractAddress: string) =>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { PurchaseOverview } from "../components/modal/components/PurchaseOverview/PurchaseOverview";
|
|
4
|
+
|
|
5
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
6
|
+
export default {
|
|
7
|
+
title: "Visual Components/PurchaseOverview",
|
|
8
|
+
component: PurchaseOverview,
|
|
9
|
+
argTypes: {
|
|
10
|
+
lookAndFeel: {
|
|
11
|
+
options: ["modal", "regular"],
|
|
12
|
+
control: { type: "radio" }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
} as ComponentMeta<typeof PurchaseOverview>;
|
|
16
|
+
|
|
17
|
+
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
18
|
+
const Template: ComponentStory<typeof PurchaseOverview> = (args) => (
|
|
19
|
+
<PurchaseOverview {...args} />
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const Base: ComponentStory<typeof PurchaseOverview> = Template.bind({});
|
|
23
|
+
|
|
24
|
+
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
25
|
+
Base.args = {
|
|
26
|
+
hideModal: () => console.log("hideModal"),
|
|
27
|
+
lookAndFeel: "modal",
|
|
28
|
+
modalMargin: "2%"
|
|
29
|
+
};
|