Skip to content

Commit

Permalink
using widget-exported fields
Browse files Browse the repository at this point in the history
  • Loading branch information
tokdaniel committed Nov 2, 2023
1 parent 51d10fa commit dd3c554
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
15 changes: 2 additions & 13 deletions apps/frontend/src/pages/[product].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useEffect, useState } from 'react';
import { paths } from '@/backend-openapi-client';
import createClient from 'openapi-fetch';
import { LookAndFeelConfig, ProductConfig } from './pricing';
import { EmailField } from '@superfluid-finance/widget/utils';

type Props = {
productConfig: ProductConfig;
Expand All @@ -32,19 +33,7 @@ export default function Product({ productConfig, theme }: Props) {
productDetails={productConfig.productDetails}
paymentDetails={productConfig.paymentDetails}
theme={theme}
personalData={[
{
name: 'email',
label: 'Email',
required: {
pattern: '/^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$/g',
message: 'Invalid email address',
},
},

//This doesn't work
// EmailField
]}
personalData={[EmailField]}
/>
)}
</ConnectKitProvider>
Expand Down
12 changes: 3 additions & 9 deletions apps/frontend/src/pages/invoice/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useEffect, useState } from 'react';
import { paths } from '@/backend-openapi-client';
import createClient from 'openapi-fetch';
import { InvoiceConfig, LookAndFeelConfig, ProductConfig } from '../pricing';
import { EmailField } from '@superfluid-finance/widget/utils';

type Props = {
invoiceConfig: InvoiceConfig;
Expand Down Expand Up @@ -36,18 +37,11 @@ export default function Invoice({ invoiceConfig, theme }: Props) {
theme={theme}
personalData={[
{
name: 'email',
label: 'Email',
...EmailField,

disabled: true,
required: {
pattern: '/^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$/g',
message: 'Invalid email address',
},
value: stripeInvoice.customer_email ?? '',
},

//This doesn't work
// EmailField
]}
/>
)}
Expand Down

0 comments on commit dd3c554

Please sign in to comment.