Skip to content

Commit

Permalink
Merge pull request #2078 from holium/fix-mock-tsc
Browse files Browse the repository at this point in the history
Fix mock data tsc error
  • Loading branch information
gdbroman authored Oct 10, 2023
2 parents 5288444 + b19bb02 commit 77b2b58
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 62 deletions.
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

0 comments on commit 77b2b58

Please sign in to comment.