From a479466d675ff37bdc675b5038a2dc968f5cc7f1 Mon Sep 17 00:00:00 2001 From: samuelea Date: Wed, 1 May 2024 14:42:05 -0400 Subject: [PATCH] build fixes --- packages/checkout/src/api/data.ts | 21 -- .../shared/components/PaperTransaction.tsx | 230 ------------------ .../src/views/CheckoutSelection/index.tsx | 5 - .../src/views/PaperTransactionForm.tsx | 28 --- .../checkout/src/views/PendingTransaction.tsx | 21 -- packages/kit/src/hooks/useWaasRevalidation.ts | 1 - 6 files changed, 306 deletions(-) delete mode 100644 packages/checkout/src/shared/components/PaperTransaction.tsx delete mode 100644 packages/checkout/src/views/PaperTransactionForm.tsx diff --git a/packages/checkout/src/api/data.ts b/packages/checkout/src/api/data.ts index 99f32ed5..936d6519 100644 --- a/packages/checkout/src/api/data.ts +++ b/packages/checkout/src/api/data.ts @@ -208,27 +208,6 @@ export const fetchSardineClientToken = async (order: SardineCheckout, isDev: boo const { resp: { orderId, token } } = await res.json() - // const res = await apiClient.getSardineNFTCheckoutToken({ - // referenceId, - // expiresIn: 3600, - // paymentMethodTypeConfig: { - // enabled: ['us_debit', 'us_credit', 'international_debit', 'international_credit', 'ach'], - // default: order.defaultPaymentMethodType - // }, - // nft: { - // name: tokenMetadata?.name || 'Unknown', - // imageUrl: tokenMetadata?.image || '', - // network: networks[order.chainId as ChainId].name, - // recipientAddress: order.recipientAddress, - // platform: 'horizon', - // blockchainNftId: order.blockchainNftId, - // contractAddress: order.contractAddress, - // executionType: 'smart_contract', - // quantity: Number(order.quantity), - // decimals: Number(order.decimals) - // } - // }) - return ({ token, orderId, diff --git a/packages/checkout/src/shared/components/PaperTransaction.tsx b/packages/checkout/src/shared/components/PaperTransaction.tsx deleted file mode 100644 index 9b59b161..00000000 --- a/packages/checkout/src/shared/components/PaperTransaction.tsx +++ /dev/null @@ -1,230 +0,0 @@ -import React, { useState, useEffect, ChangeEvent } from 'react' -import { Box, Button, Card, Spinner, Text, TextInput, EditIcon, CheckmarkIcon } from '@0xsequence/design-system' -import { CheckoutWithCard } from '@paperxyz/react-client-sdk' -import { useNavigation } from '../../hooks' -// import { fetchPaperSecret } from '../../api' -import { CheckoutSettings } from '../../contexts/CheckoutModal' -export interface PaperTransactionProps { - settings: CheckoutSettings -} - -// export const PaperTransaction = ({ -// settings -// }: PaperTransactionProps) => { -// const [emailEditState, setEmailEditState] = useState(true) -// const [email, setEmail] = useState(settings.creditCardCheckout?.email || '') -// const [inputEmailAddress, setInputEmailAddress] = useState(email) -// const [paperSecret, setPaperSecret] = useState(null) -// const [paperSecretLoading, setPaperSecretLoading] = useState(false) -// const { setNavigation } = useNavigation() - -// const onClickEditEmail = () => { -// if (emailEditState) { -// setEmail(inputEmailAddress || '') -// } -// if (!emailEditState) { -// setInputEmailAddress(email) -// } -// setEmailEditState(!emailEditState) -// } - -// const fetchSecret = async () => { -// setPaperSecretLoading(true) -// try { -// if (!email) { -// throw 'No email address found' -// } - -// if (!settings.creditCardCheckout) { -// throw 'No credit card checkout settings found' -// } - -// const secret = await fetchPaperSecret({ -// email, -// ...settings.creditCardCheckout -// }) - -// setPaperSecret(secret) -// } catch(e) { -// console.error('Failed to fetch paper secret', e ) -// setNavigation({ -// location: 'transaction-error', -// params: { -// error: e -// } -// }) -// } -// setPaperSecretLoading(false) -// } - -// useEffect(() => { -// const timer = setInterval(() => { -// // This is a workaround for the KYC modal not becoming clickable -// // The alternative of using the onReview callback does not work due -// // to race conditions -// const paperJsSdkModal = document.getElementById('paper-js-sdk-modal') -// if (paperJsSdkModal) { -// paperJsSdkModal.style.pointerEvents = 'visible' -// } -// }, 100) -// return (() => { -// clearInterval(timer) -// }) -// }, []) - -// useEffect(() => { -// if (email !== '') { -// fetchSecret() -// } -// }, [email]) - -// const isValidEmailAddress = () => { -// const emailRegEx = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/ -// const isValidEmail = emailRegEx.test(inputEmailAddress || '') -// return isValidEmail -// } - -// const emailAddressOnChange = (ev: ChangeEvent) => { -// setInputEmailAddress(ev.target.value) -// } - -// const onPending = (transactionId: string) => { -// setNavigation({ -// location: 'transaction-pending', -// params: { -// transactionId -// } -// }) -// } - -// const onError = (error: Error) => { -// setNavigation({ -// location: 'transaction-error', -// params: { -// error -// } -// }) -// } - -// const getEmailInput = () => { -// if (emailEditState) { -// return ( -// -// -// -// Receipt email address -// -// -// -//