From b19bb02d23719348a78378c24dea4562ff5524dd Mon Sep 17 00:00:00 2001 From: gdbroman <99gustaf@gmail.com> Date: Tue, 10 Oct 2023 22:34:12 +0200 Subject: [PATCH] Fix mock data tsc error --- .../dialogs/PurchaseID.WEB.stories.tsx | 10 +-- .../dialogs/UploadPier.WEB.stories.tsx | 15 ++--- shared/src/onboarding/dialogs/util.tsx | 63 +++++-------------- 3 files changed, 26 insertions(+), 62 deletions(-) diff --git a/shared/src/onboarding/dialogs/PurchaseID.WEB.stories.tsx b/shared/src/onboarding/dialogs/PurchaseID.WEB.stories.tsx index 382be8c6c..bb80d0d4f 100644 --- a/shared/src/onboarding/dialogs/PurchaseID.WEB.stories.tsx +++ b/shared/src/onboarding/dialogs/PurchaseID.WEB.stories.tsx @@ -8,12 +8,13 @@ import { DownloadDialog, GetOnRealmDialog, PaymentDialog, + ThirdEarthPeriodicity, VerifyEmailDialog, } from '../onboarding'; import { mockPatps, OnboardingDialogWrapper, - thirdEarthMockProducts, + thirdEarthMockPriceOptions, } from './util'; export default { @@ -78,10 +79,9 @@ ChooseIdDialogStory.storyName = '3. Choose ID'; export const PaymentDialogStory: ComponentStory = () => ( {}} + priceOptions={thirdEarthMockPriceOptions} + periodicity={ThirdEarthPeriodicity.MONTH} + setPeriodicity={() => {}} patp="~zod" email="admin@admin.com" stripe={undefined} diff --git a/shared/src/onboarding/dialogs/UploadPier.WEB.stories.tsx b/shared/src/onboarding/dialogs/UploadPier.WEB.stories.tsx index 1d2a131e6..9d18ac20f 100644 --- a/shared/src/onboarding/dialogs/UploadPier.WEB.stories.tsx +++ b/shared/src/onboarding/dialogs/UploadPier.WEB.stories.tsx @@ -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, @@ -75,15 +76,9 @@ export const UploadPierPaymentDialogStory: ComponentStory< > = () => ( {}} + priceOptions={thirdEarthMockPriceOptions} + periodicity={ThirdEarthPeriodicity.MONTH} + setPeriodicity={() => {}} patp="~zod" email="admin@admin.com" stripe={undefined} diff --git a/shared/src/onboarding/dialogs/util.tsx b/shared/src/onboarding/dialogs/util.tsx index ea1a689c4..2c25a6e40 100644 --- a/shared/src/onboarding/dialogs/util.tsx +++ b/shared/src/onboarding/dialogs/util.tsx @@ -3,7 +3,7 @@ import { ReactNode } from 'react'; import { Flex } from '@holium/design-system/general'; import { ThirdEarthPeriodicity, - ThirdEarthProduct, + ThirdEarthPriceOption, ThirdEarthShip, } from '@holium/shared'; @@ -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', }, ];