Skip to content

Commit

Permalink
Convert account store to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Nov 21, 2024
1 parent 5425149 commit c900f03
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 189 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Interval } from "@httptoolkit/accounts";
import { Interval } from "@/lib/store/account-store";

interface Option {
text: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/sections/pricing/plans/hooks/get-plan-cta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { StyledPricingCardCTAWrapper } from '../components/card/card.styles';
import { Button } from '@/components/elements/button';
import { PaperPlaneTilt, Sparkle, Spinner } from '@/components/elements/icon';
import { Text } from '@/components/elements/text';
import type { AccountStore } from '@/lib/store/account-store';
import type { AccountStore, Interval } from '@/lib/store/account-store';

/**
* @param {React.ReactNode} downloadButton - DrowpdownButton is a server component, so we need to provide it as a children because we cannot import directly in client component
*/
export const usePlanCta = (downloadButton?: React.ReactNode) => {
const posthog = usePostHog();

return useCallback((tierCode: string, account: AccountStore, waitingForPurchase: boolean, planCycle: string) => {
return useCallback((tierCode: string, account: AccountStore, waitingForPurchase: boolean, planCycle: Interval) => {
const { paidTier, paidCycle } = account.subscription;

if (waitingForPurchase) {
Expand Down
3 changes: 1 addition & 2 deletions src/components/sections/pricing/plans/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { observer } from 'mobx-react-lite';
import { useCallback, useState } from 'react';
import { Interval } from '@httptoolkit/accounts';

import { PricingCard } from './components/card';
import { LoginInfo } from './components/login-info';
Expand All @@ -21,7 +20,7 @@ import type { PlanId, StyledPricingPlansProps } from './plans.types';

import { Spinner } from '@/components/elements/icon';
import { Text } from '@/components/elements/text';
import { accountStore } from '@/lib/store/account-store';
import { accountStore, Interval } from '@/lib/store/account-store';

const LoadingPrice = () => {
return (
Expand Down
184 changes: 0 additions & 184 deletions src/lib/store/account-store.js

This file was deleted.

Loading

0 comments on commit c900f03

Please sign in to comment.