Skip to content

Commit

Permalink
fix(mobile): fix mispelling entitlement (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
duongdev committed Sep 11, 2024
1 parent 1be053f commit ce28056
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions apps/mobile/app/(app)/(tabs)/budgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Skeleton } from '@/components/ui/skeleton'
import { Text } from '@/components/ui/text'
import { useUserEntitlements } from '@/hooks/use-purchases'
import { useColorScheme } from '@/hooks/useColorScheme'
import { ENTILEMENT_LIMIT } from '@/lib/constaints'
import { ENTITLEMENT_LIMIT } from '@/lib/constaints'
import { theme } from '@/lib/theme'
import { useBudgetList } from '@/stores/budget/hooks'
import { useTransactionList } from '@/stores/transaction/hooks'
Expand Down Expand Up @@ -144,10 +144,10 @@ export default function BudgetsScreen() {
refetch,
} = useBudgetList()

const { entilement } = useUserEntitlements()
const { entitlement } = useUserEntitlements()

const isExceeded =
ENTILEMENT_LIMIT[entilement]?.wallets <= (spendingBudgets?.length ?? 0)
ENTITLEMENT_LIMIT[entitlement]?.wallets <= (spendingBudgets?.length ?? 0)

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
Expand Down
6 changes: 3 additions & 3 deletions apps/mobile/app/(app)/wallet/accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Skeleton } from '@/components/ui/skeleton'
import { Text } from '@/components/ui/text'
import { WalletAccountItem } from '@/components/wallet/wallet-account-item'
import { useUserEntitlements } from '@/hooks/use-purchases'
import { ENTILEMENT_LIMIT } from '@/lib/constaints'
import { ENTITLEMENT_LIMIT } from '@/lib/constaints'
import { useWalletList } from '@/stores/wallet/hooks'
import { t } from '@lingui/macro'
import { useLingui } from '@lingui/react'
Expand All @@ -19,10 +19,10 @@ export default function WalletAccountsScreen() {
const { wallets: walletAccounts, isLoading, refetch } = useWalletList()
const router = useRouter()
const navigation = useNavigation()
const { entilement } = useUserEntitlements()
const { entitlement } = useUserEntitlements()

const isExceeded =
ENTILEMENT_LIMIT[entilement]?.wallets <= (walletAccounts?.length ?? 0)
ENTITLEMENT_LIMIT[entitlement]?.wallets <= (walletAccounts?.length ?? 0)

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
Expand Down
7 changes: 4 additions & 3 deletions apps/mobile/components/transaction/scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ScanningOverlay } from '@/components/scanner/scanning-overlay'
import { Button } from '@/components/ui/button'
import { Text } from '@/components/ui/text'
import { useUserEntitlements } from '@/hooks/use-purchases'
import { ENTILEMENT_LIMIT } from '@/lib/constaints'
import { ENTITLEMENT_LIMIT } from '@/lib/constaints'
import { cn } from '@/lib/utils'
import { getAITransactionData } from '@/mutations/transaction'
import { useTransactionStore } from '@/stores/transaction/store'
Expand Down Expand Up @@ -58,7 +58,7 @@ export function Scanner({
const { bottom } = useSafeAreaInsets()
const { addDraftTransaction, updateDraftTransaction, transactions } =
useTransactionStore()
const { entilement } = useUserEntitlements()
const { entitlement } = useUserEntitlements()

const todayTransactions = transactions.filter((t) =>
dayjsExtended(t.createdAt).isSame(dayjsExtended(), 'day'),
Expand Down Expand Up @@ -91,7 +91,8 @@ export function Scanner({
}

const transactionQuota =
ENTILEMENT_LIMIT[entilement]?.['ai-transactions'] - todayTransactions.length
ENTITLEMENT_LIMIT[entitlement]?.['ai-transactions'] -
todayTransactions.length

async function processImages(uris: string[]) {
if (transactionQuota - uris.length <= 0) {
Expand Down
8 changes: 4 additions & 4 deletions apps/mobile/hooks/use-purchases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ export function useUserEntitlements() {

const isPro = isWealth || isGrowth

const entilement = (
const entitlement = (
isWealth ? 'wealth' : isGrowth ? 'growth' : 'free'
) as Entitlement

useEffect(() => {
posthog.capture('$set', {
// biome-ignore lint/style/useNamingConvention: <explanation>
$set: {
subscription_plan: entilement,
subscription_plan: entitlement,
},
})
}, [posthog, entilement])
}, [posthog, entitlement])

return {
customerInfo,
entilement,
entitlement,
isWealth,
isGrowth,
isPro,
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/lib/constaints.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type Entitlement = 'wealth' | 'growth' | 'free'

export const ENTILEMENT_LIMIT: Record<Entitlement, Record<string, number>> = {
export const ENTITLEMENT_LIMIT: Record<Entitlement, Record<string, number>> = {
free: {
'ai-transactions': 2,
budgets: 3,
Expand Down

0 comments on commit ce28056

Please sign in to comment.