Skip to content

Commit

Permalink
clients: rename internal SDK to @polar-sh/api
Browse files Browse the repository at this point in the history
Avoid future conflicts with our true SDK `@polar-sh/sdk` we want to integrate.
  • Loading branch information
frankie567 committed Jan 16, 2025
1 parent d85a892 commit 04dad8c
Show file tree
Hide file tree
Showing 428 changed files with 635 additions and 730 deletions.
4 changes: 2 additions & 2 deletions clients/.changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@examples/checkout-embed",
"eslint-config-custom",
"polarkit",
"@polar-sh/sdk"
"@polar-sh/api"
]
}
}
2 changes: 1 addition & 1 deletion clients/apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"@next/mdx": "^14.2.18",
"@next/third-parties": "^15.0.3",
"@observablehq/plot": "^0.6.16",
"@polar-sh/api": "workspace:*",
"@polar-sh/checkout": "workspace:^",
"@polar-sh/mdx": "workspace:*",
"@polar-sh/sdk": "workspace:*",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-toast": "^1.2.2",
"@react-three/drei": "^9.117.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Organization,
ResponseError,
ValidationError,
} from '@polar-sh/sdk'
} from '@polar-sh/api'
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
import Avatar from 'polarkit/components/ui/atoms/avatar'
import Button from 'polarkit/components/ui/atoms/button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
getAPIParams,
serializeSearchParams,
} from '@/utils/datatable'
import { TransactionType } from '@polar-sh/sdk'
import { TransactionType } from '@polar-sh/api'
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
import {
Tabs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@/hooks/queries'
import { api } from '@/utils/api'
import { FileDownloadOutlined } from '@mui/icons-material'
import { DownloadableRead } from '@polar-sh/sdk'
import { DownloadableRead } from '@polar-sh/api'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'
import Avatar from 'polarkit/components/ui/atoms/avatar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@/hooks/queries'
import { api } from '@/utils/api'
import { Key } from '@mui/icons-material'
import { BenefitType, CustomerBenefitGrantLicenseKeys } from '@polar-sh/sdk'
import { BenefitType, CustomerBenefitGrantLicenseKeys } from '@polar-sh/api'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'
import Avatar from 'polarkit/components/ui/atoms/avatar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AmountLabel from '@/components/Shared/AmountLabel'
import { useCustomerOrders } from '@/hooks/queries'
import { api } from '@/utils/api'
import { Search, ShoppingBagOutlined } from '@mui/icons-material'
import { CustomerOrder, ProductPriceType } from '@polar-sh/sdk'
import { CustomerOrder, ProductPriceType } from '@polar-sh/api'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'
import Button from 'polarkit/components/ui/atoms/button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CustomerPortalOrder from '@/components/CustomerPortal/CustomerPortalOrder'
import { api } from '@/utils/api'
import { ArrowBackOutlined } from '@mui/icons-material'
import { CustomerOrder } from '@polar-sh/sdk'
import { CustomerOrder } from '@polar-sh/api'
import Link from 'next/link'

const ClientPage = ({ order }: { order: CustomerOrder }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { CustomerOrder, ResponseError } from '@polar-sh/sdk'
import { CustomerOrder, ResponseError } from '@polar-sh/api'
import { notFound } from 'next/navigation'
import ClientPage from './ClientPage'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SubscriptionStatusLabel } from '@/components/Subscriptions/utils'
import { useCustomerSubscriptions } from '@/hooks/queries'
import { api } from '@/utils/api'
import { Search, ShoppingBagOutlined } from '@mui/icons-material'
import { CustomerSubscription } from '@polar-sh/sdk'
import { CustomerSubscription } from '@polar-sh/api'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'
import { Switch } from 'polarkit/components/ui/atoms'
Expand Down Expand Up @@ -201,14 +201,11 @@ const SubscriptionItem = ({
{nextEventTitle}
</span>
<span>
{nextEventDate.toLocaleDateString(
'en-US',
{
year: 'numeric',
month: 'long',
day: 'numeric',
},
)}
{nextEventDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
})}
</span>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CustomerPortalSubscription from '@/components/CustomerPortal/CustomerPortalSubscription'
import { api } from '@/utils/api'
import { ArrowBackOutlined } from '@mui/icons-material'
import { CustomerSubscription } from '@polar-sh/sdk'
import { CustomerSubscription } from '@polar-sh/api'
import Link from 'next/link'

const ClientPage = ({
Expand All @@ -25,5 +25,4 @@ const ClientPage = ({
)
}


export default ClientPage
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { CustomerSubscription, ResponseError } from '@polar-sh/sdk'
import { CustomerSubscription, ResponseError } from '@polar-sh/api'
import { notFound } from 'next/navigation'
import ClientPage from './ClientPage'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { Storefront } from '@/components/Profile/Storefront'
import { IssueFunding, Organization, ProductStorefront } from '@polar-sh/sdk'
import { IssueFunding, Organization, ProductStorefront } from '@polar-sh/api'

const ClientPage = ({
organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import IssuesLookingForFunding from '@/components/Organization/IssuesLookingForFunding'
import { organizationPageLink } from '@/utils/nav'
import { ListResourceIssueFunding, Organization } from '@polar-sh/sdk'
import { ListResourceIssueFunding, Organization } from '@polar-sh/api'
import { redirect } from 'next/navigation'
import { ShadowBoxOnMd } from 'polarkit/components/ui/atoms/shadowbox'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StorefrontNav } from '@/components/Organization/StorefrontNav'
import { StorefrontHeader } from '@/components/Profile/StorefrontHeader'
import { getServerSideAPI } from '@/utils/api/serverside'
import { getStorefrontOrNotFound } from '@/utils/storefront'
import { UserRead } from '@polar-sh/sdk'
import { UserRead } from '@polar-sh/api'
import React from 'react'

export default async function Layout({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { ListResourceIssueFunding } from '@polar-sh/sdk'
import { ListResourceIssueFunding } from '@polar-sh/api'
import type { Metadata } from 'next'
import { notFound } from 'next/navigation'
import ClientPage from './ClientPage'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { Checkout } from '@/components/Checkout/Checkout'
import { CheckoutPublic, Organization } from '@polar-sh/sdk'
import { CheckoutPublic, Organization } from '@polar-sh/api'
import { useTheme } from 'next-themes'

export default function ClientPage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CheckoutProductInfo from '@/components/Checkout/CheckoutProductInfo'
import { getServerSideAPI } from '@/utils/api/serverside'
import { isCrawler } from '@/utils/crawlers'
import { getStorefrontOrNotFound } from '@/utils/storefront'
import { CheckoutPublic } from '@polar-sh/sdk'
import { CheckoutPublic } from '@polar-sh/api'
import type { Metadata } from 'next'
import { headers } from 'next/headers'
import { notFound } from 'next/navigation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Organization,
Repository,
RepositoryProfileSettingsUpdate,
} from '@polar-sh/sdk'
} from '@polar-sh/api'
import Link from 'next/link'
import type { SuccessResult } from 'open-graph-scraper-lite'
import Avatar from 'polarkit/components/ui/atoms/avatar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import HowItWorks from '@/components/Pledge/HowItWorks'
import IssueCard from '@/components/Pledge/IssueCard'
import PledgeCheckoutPanel from '@/components/Pledge/PledgeCheckoutPanel'
import { usePostHog } from '@/hooks/posthog'
import { Issue, Organization, Pledger, RewardsSummary } from '@polar-sh/sdk'
import { Issue, Organization, Pledger, RewardsSummary } from '@polar-sh/api'
import { Banner } from 'polarkit/components/ui/molecules'
import { useEffect, useState } from 'react'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { resolveIssuePath } from '@/utils/issue'
import { organizationPageLink } from '@/utils/nav'
import { Pledger, ResponseError, RewardsSummary } from '@polar-sh/sdk'
import { Pledger, ResponseError, RewardsSummary } from '@polar-sh/api'
import { Metadata } from 'next'
import { notFound, redirect } from 'next/navigation'
import ClientPage from './ClientPage'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Status from '@/components/Pledge/Status'
import { api } from '@/utils/api'
import { resolveRepositoryPath } from '@/utils/repository'
import { Pledge, ResponseError } from '@polar-sh/sdk'
import { Pledge, ResponseError } from '@polar-sh/api'
import { notFound } from 'next/navigation'

const cacheConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getServerSideAPI } from '@/utils/api/serverside'
import { organizationPageLink } from '@/utils/nav'
import { resolveRepositoryPath } from '@/utils/repository'
import { getUserOrganizations } from '@/utils/user'
import { ListResourceIssueFunding, Organization } from '@polar-sh/sdk'
import { ListResourceIssueFunding, Organization } from '@polar-sh/api'
import { Metadata } from 'next'
import { notFound, redirect } from 'next/navigation'
import type { SuccessResult } from 'open-graph-scraper-lite'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useCustomerPortalSessionAuthenticate } from '@/hooks/queries'
import { api } from '@/utils/api'
import { setValidationErrors } from '@/utils/api/errors'
import { Organization, ResponseError, ValidationError } from '@polar-sh/sdk'
import { Organization, ResponseError, ValidationError } from '@polar-sh/api'
import { useRouter } from 'next/navigation'
import Button from 'polarkit/components/ui/atoms/button'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CustomerPortalOrder from '@/components/CustomerPortal/CustomerPortalOrder'
import { buildAPI } from '@/utils/api'
import { CustomerOrder, Organization } from '@polar-sh/sdk'
import { CustomerOrder, Organization } from '@polar-sh/api'

const ClientPage = ({
order,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { getOrganizationOrNotFound } from '@/utils/customerPortal'
import { CustomerOrder, ResponseError } from '@polar-sh/sdk'
import { CustomerOrder, ResponseError } from '@polar-sh/api'
import type { Metadata } from 'next'
import { redirect } from 'next/navigation'
import ClientPage from './ClientPage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useCustomerPortalSessionRequest } from '@/hooks/queries'
import { api } from '@/utils/api'
import { setValidationErrors } from '@/utils/api/errors'
import { Organization, ResponseError, ValidationError } from '@polar-sh/sdk'
import { Organization, ResponseError, ValidationError } from '@polar-sh/api'
import { useRouter } from 'next/navigation'
import Button from 'polarkit/components/ui/atoms/button'
import Input from 'polarkit/components/ui/atoms/input'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CustomerPortalSubscription from '@/components/CustomerPortal/CustomerPortalSubscription'
import { buildAPI } from '@/utils/api'
import { CustomerSubscription, Organization } from '@polar-sh/sdk'
import { CustomerSubscription, Organization } from '@polar-sh/api'

const ClientPage = ({
subscription,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { getOrganizationOrNotFound } from '@/utils/customerPortal'
import { CustomerSubscription, ResponseError } from '@polar-sh/sdk'
import { CustomerSubscription, ResponseError } from '@polar-sh/api'
import type { Metadata } from 'next'
import { redirect } from 'next/navigation'
import ClientPage from './ClientPage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ListResourceCustomerOrder,
ListResourceCustomerSubscription,
Organization,
} from '@polar-sh/sdk'
} from '@polar-sh/api'

const ClientPage = ({
organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ListResourceCustomerOrder,
ListResourceCustomerSubscription,
ResponseError,
} from '@polar-sh/sdk'
} from '@polar-sh/api'
import type { Metadata } from 'next'
import { redirect } from 'next/navigation'
import ClientPage from './ClientPage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useCreateOrganization } from '@/hooks/queries'
import { setValidationErrors } from '@/utils/api/errors'
import { CONFIG } from '@/utils/config'
import { FormControl } from '@mui/material'
import { ResponseError, ValidationError } from '@polar-sh/sdk'
import { ResponseError, ValidationError } from '@polar-sh/api'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import Button from 'polarkit/components/ui/atoms/button'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import revalidate from '@/app/actions'
import { getServerSideAPI } from '@/utils/api/serverside'
import { getAuthenticatedUser } from '@/utils/user'
import { Organization, ResponseError, ValidationError } from '@polar-sh/sdk'
import { Organization, ResponseError, ValidationError } from '@polar-sh/api'
import { Metadata } from 'next'
import { redirect } from 'next/navigation'
import ClientPage from './ClientPage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SubscribersWidget } from '@/components/Widgets/SubscribersWidget'
import { useProducts } from '@/hooks/queries'
import { MaintainerOrganizationContext } from '@/providers/maintainerOrganization'
import { ChevronRight } from '@mui/icons-material'
import { Organization } from '@polar-sh/sdk'
import { Organization } from '@polar-sh/api'
import Link from 'next/link'
import Button from 'polarkit/components/ui/atoms/button'
import {
Expand Down Expand Up @@ -69,7 +69,7 @@ const IntegrationView = () => {
<div className="flex flex-col gap-y-6">
<h4 className="text-xl font-medium">Install the SDK</h4>
<pre className="dark:border-polar-700 dark:bg-polar-900 rounded-xl border border-transparent bg-white px-5 py-3 text-sm shadow-sm">
pnpm install @polar-sh/sdk
pnpm install @polar-sh/api
</pre>
</div>

Expand Down Expand Up @@ -120,7 +120,7 @@ const IntegrationView = () => {
<SyntaxHighlighterProvider>
<SyntaxHighlighterClient
lang="javascript"
code={`import { Polar } from "@polar-sh/sdk";
code={`import { Polar } from "@polar-sh/api";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { ResponseError, WebhookEndpoint } from '@polar-sh/sdk'
import { ResponseError, WebhookEndpoint } from '@polar-sh/api'
import { notFound } from 'next/navigation'
import {
BreadcrumbPageParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MetricChartBox from '@/components/Metrics/MetricChartBox'
import ProductSelect from '@/components/Products/ProductSelect'
import { ParsedMetricPeriod, useMetrics } from '@/hooks/queries'
import { fromISODate, toISODate } from '@/utils/metrics'
import { Interval, Metrics, MetricsLimits, Organization } from '@polar-sh/sdk'
import { Interval, Metrics, MetricsLimits, Organization } from '@polar-sh/api'
import { useRouter } from 'next/navigation'
import { useCallback, useMemo } from 'react'
import { twMerge } from 'tailwind-merge'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getServerSideAPI } from '@/utils/api/serverside'
import { fromISODate, toISODate } from '@/utils/metrics'
import { getOrganizationBySlugOrNotFound } from '@/utils/organization'
import { Interval } from '@polar-sh/sdk'
import { Interval } from '@polar-sh/api'
import {
addDays,
endOfMonth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
AllInclusive,
MoreVertOutlined,
} from '@mui/icons-material'
import { type Benefit, Organization } from '@polar-sh/sdk'
import { type Benefit, Organization } from '@polar-sh/api'
import { encode } from 'html-entities'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getAPIParams,
serializeSearchParams,
} from '@/utils/datatable'
import { Organization } from '@polar-sh/sdk'
import { Organization } from '@polar-sh/api'
import {
PaginationState,
RowSelectionState,
Expand Down
Loading

0 comments on commit 04dad8c

Please sign in to comment.