Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mock data tsc error #2078

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions shared/src/onboarding/dialogs/PurchaseID.WEB.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import {
DownloadDialog,
GetOnRealmDialog,
PaymentDialog,
ThirdEarthPeriodicity,
VerifyEmailDialog,
} from '../onboarding';
import {
mockPatps,
OnboardingDialogWrapper,
thirdEarthMockProducts,
thirdEarthMockPriceOptions,
} from './util';

export default {
Expand Down Expand Up @@ -78,10 +79,9 @@ ChooseIdDialogStory.storyName = '3. Choose ID';
export const PaymentDialogStory: ComponentStory<typeof PaymentDialog> = () => (
<OnboardingDialogWrapper>
<PaymentDialog
productType="planet"
products={thirdEarthMockProducts}
productId={1}
setProductId={() => {}}
priceOptions={thirdEarthMockPriceOptions}
periodicity={ThirdEarthPeriodicity.MONTH}
setPeriodicity={() => {}}
patp="~zod"
email="admin@admin.com"
stripe={undefined}
Expand Down
15 changes: 5 additions & 10 deletions shared/src/onboarding/dialogs/UploadPier.WEB.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {
CreateAccountDialog,
GetOnRealmDialog,
PaymentDialog,
ThirdEarthPeriodicity,
VerifyEmailDialog,
} from '../onboarding';
import { UploadPierDialog } from './UploadPier/UploadPierDialog';
import { UploadPierDisclaimerDialog } from './UploadPierDisclaimer/UploadPierDisclaimerDialog';
import { OnboardingDialogWrapper, thirdEarthMockProduct } from './util';
import { OnboardingDialogWrapper, thirdEarthMockPriceOptions } from './util';

export default {
component: CreateAccountDialog,
Expand Down Expand Up @@ -75,15 +76,9 @@ export const UploadPierPaymentDialogStory: ComponentStory<
> = () => (
<OnboardingDialogWrapper>
<PaymentDialog
productType="byop-p"
products={[
{
...thirdEarthMockProduct,
product_type: 'byop-p',
},
]}
productId={1}
setProductId={() => {}}
priceOptions={thirdEarthMockPriceOptions}
periodicity={ThirdEarthPeriodicity.MONTH}
setPeriodicity={() => {}}
patp="~zod"
email="admin@admin.com"
stripe={undefined}
Expand Down
63 changes: 16 additions & 47 deletions shared/src/onboarding/dialogs/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ReactNode } from 'react';
import { Flex } from '@holium/design-system/general';
import {
ThirdEarthPeriodicity,
ThirdEarthProduct,
ThirdEarthPriceOption,
ThirdEarthShip,
} from '@holium/shared';

Expand All @@ -30,53 +30,22 @@ export const thirdEarthMockShip: ThirdEarthShip = {
product_type: 'planet',
} as any;

export const thirdEarthMockProduct: ThirdEarthProduct = {
id: 1,
client_id: 1,
droplet_class_id: 1,
is_migration: false,
is_planet: true,
lang_code: 'en',
priority: 1,
product_status: 'active',
product_type: 'subscription',
threshold: 0,
comet_count: '0',
title: 'Monthly',
description: 'Monthly subscription',
long_description: 'Monthly subscription',
price_id: '11',
subscription_price: 15,
price_options: [
{
unit: 'usd',
description: 'monthly subscription',
periodicity: 'month' as ThirdEarthPeriodicity,
one_time_price: 0,
recurring_price: 15,
stripe_price_id: 'price_1MDqoIHhoM3uGGuYAZZN23Yr',
},
{
unit: 'usd',
description: 'yearly subscription',
periodicity: 'year' as ThirdEarthPeriodicity,
one_time_price: 0,
recurring_price: 150,
stripe_price_id: 'price_1MDqoIHhoM3uGGuY00mWc29l',
},
],
};

export const thirdEarthMockProducts = [
thirdEarthMockProduct,
export const thirdEarthMockPriceOptions: ThirdEarthPriceOption[] = [
{
unit: 'usd',
description: 'monthly subscription',
periodicity: 'month' as ThirdEarthPeriodicity,
one_time_price: 0,
recurring_price: 15,
stripe_price_id: 'price_1MDqoIHhoM3uGGuYAZZN23Yr',
},
{
...thirdEarthMockProduct,
id: 2,
title: 'Yearly',
description: 'Yearly subscription',
long_description: 'Yearly subscription',
price_id: '12',
subscription_price: 150,
unit: 'usd',
description: 'yearly subscription',
periodicity: 'year' as ThirdEarthPeriodicity,
one_time_price: 0,
recurring_price: 150,
stripe_price_id: 'price_1MDqoIHhoM3uGGuY00mWc29l',
},
];

Expand Down