Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changeset/silent-zebras-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
'@clerk/clerk-js': patch
---
10 changes: 7 additions & 3 deletions packages/clerk-js/bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,26 @@
{ "path": "./dist/coinbase*.js", "maxSize": "38KB" },
{ "path": "./dist/createorganization*.js", "maxSize": "5KB" },
{ "path": "./dist/impersonationfab*.js", "maxSize": "5KB" },
{ "path": "./dist/organizationprofile*.js", "maxSize": "12KB" },
{ "path": "./dist/organizationprofile*.js", "maxSize": "10KB" },
{ "path": "./dist/organizationswitcher*.js", "maxSize": "5KB" },
{ "path": "./dist/organizationlist*.js", "maxSize": "5.5KB" },
{ "path": "./dist/signin*.js", "maxSize": "14KB" },
{ "path": "./dist/signup*.js", "maxSize": "8.5KB" },
{ "path": "./dist/userbutton*.js", "maxSize": "5KB" },
{ "path": "./dist/userprofile*.js", "maxSize": "16.5KB" },
{ "path": "./dist/userprofile*.js", "maxSize": "16KB" },
{ "path": "./dist/userverification*.js", "maxSize": "5KB" },
{ "path": "./dist/onetap*.js", "maxSize": "1KB" },
{ "path": "./dist/waitlist*.js", "maxSize": "1.5KB" },
{ "path": "./dist/keylessPrompt*.js", "maxSize": "6.5KB" },
{ "path": "./dist/pricingTable*.js", "maxSize": "4.02KB" },
{ "path": "./dist/checkout*.js", "maxSize": "7.3KB" },
{ "path": "./dist/paymentSources*.js", "maxSize": "9.17KB" },
{ "path": "./dist/up-billing-page*.js", "maxSize": "3.0KB" },
{ "path": "./dist/up-billing-page*.js", "maxSize": "3.5KB" },
{ "path": "./dist/op-billing-page*.js", "maxSize": "3.0KB" },
{ "path": "./dist/up-plans-page*.js", "maxSize": "1.0KB" },
{ "path": "./dist/op-plans-page*.js", "maxSize": "1.0KB" },
{ "path": "./dist/statement-page*.js", "maxSize": "1.0KB" },
{ "path": "./dist/payment-attempt-page*.js", "maxSize": "3.0KB" },
Comment on lines +30 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason we have seperate chunks between UP and OP for plans, but not for statements and PAs ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only because based on what I observed, webpack seemed to handle pricing table chunks distinctly and appropriately for OP and UP, but wasn't doing the same for statement page or payment attempt page – instead just grabbing a (seemingly) random one. For example, the UserProfile would always grab up_pricing_table, but would grab op_statement_page for some reason – maybe they aren't different enough and webpack is being smart?

{ "path": "./dist/sessionTasks*.js", "maxSize": "1.5KB" }
]
}
2 changes: 0 additions & 2 deletions packages/clerk-js/src/ui/components/Checkout/parts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { LineItems } from '@/ui/elements/LineItems';

import { useCheckoutContext } from '../../contexts';
import { Box, descriptors, Flex, localizationKeys, useLocalizations } from '../../customizables';
// TODO(@COMMERCE): Is this causing bundle size issues ?
import { EmailForm } from '../UserProfile/EmailForm';
import { useCheckoutContextRoot } from './CheckoutPage';

Expand Down Expand Up @@ -101,7 +100,6 @@ export const AddEmailForm = () => {
padding: t.space.$4,
})}
>
{/* TODO(@COMMERCE): How does ths operate for orgs ? */}
<EmailForm
title={localizationKeys('commerce.checkout.emailForm.title')}
subtitle={localizationKeys('commerce.checkout.emailForm.subtitle')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import { useEnvironment, useOrganizationProfileContext } from '../../contexts';
import { Route, Switch } from '../../router';
import { OrganizationGeneralPage } from './OrganizationGeneralPage';
import { OrganizationMembers } from './OrganizationMembers';
import { OrganizationPaymentAttemptPage } from './OrganizationPaymentAttemptPage';
import { OrganizationPlansPage } from './OrganizationPlansPage';
import { OrganizationStatementPage } from './OrganizationStatementPage';

const OrganizationBillingPage = lazy(() =>
import(/* webpackChunkName: "op-billing-page"*/ './OrganizationBillingPage').then(module => ({
Expand All @@ -22,6 +19,24 @@ const OrganizationAPIKeysPage = lazy(() =>
})),
);

const OrganizationPlansPage = lazy(() =>
import(/* webpackChunkName: "op-plans-page"*/ './OrganizationPlansPage').then(module => ({
default: module.OrganizationPlansPage,
})),
);

const OrganizationStatementPage = lazy(() =>
import(/* webpackChunkName: "statement-page"*/ './OrganizationStatementPage').then(module => ({
default: module.OrganizationStatementPage,
})),
);

const OrganizationPaymentAttemptPage = lazy(() =>
import(/* webpackChunkName: "payment-attempt-page"*/ './OrganizationPaymentAttemptPage').then(module => ({
default: module.OrganizationPaymentAttemptPage,
})),
);

export const OrganizationProfileRoutes = () => {
const { pages, isMembersPageRoot, isGeneralPageRoot, isBillingPageRoot, isApiKeysPageRoot } =
useOrganizationProfileContext();
Expand Down Expand Up @@ -82,19 +97,16 @@ export const OrganizationProfileRoutes = () => {
</Suspense>
</Route>
<Route path='plans'>
{/* TODO(@commerce): Should this be lazy loaded ? */}
<Suspense fallback={''}>
<OrganizationPlansPage />
</Suspense>
</Route>
<Route path='statement/:statementId'>
{/* TODO(@commerce): Should this be lazy loaded ? */}
<Suspense fallback={''}>
<OrganizationStatementPage />
</Suspense>
</Route>
<Route path='payment-attempt/:paymentAttemptId'>
{/* TODO(@commerce): Should this be lazy loaded ? */}
<Suspense fallback={''}>
<OrganizationPaymentAttemptPage />
</Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
const elements = useElements();
const { displayConfig } = useEnvironment();
const { t } = useLocalizations();
const subscriberType = useSubscriberTypeContext();
const localizationRoot = useSubscriberTypeLocalizationRoot();

const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
Expand All @@ -251,7 +252,7 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
const { setupIntent, error } = await stripe.confirmSetup({
elements,
confirmParams: {
return_url: '', // TODO(@COMMERCE): need to figure this out
return_url: window.location.href,
},
redirect: 'if_required',
});
Expand Down Expand Up @@ -295,7 +296,8 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
? {
recurringPaymentRequest: {
paymentDescription: `${t(localizationKeys(checkout.planPeriod === 'month' ? 'commerce.paymentSource.applePayDescription.monthly' : 'commerce.paymentSource.applePayDescription.annual'))}`,
managementURL: displayConfig.homeUrl, // TODO(@COMMERCE): is this the right URL?
managementURL:
subscriberType === 'org' ? displayConfig.organizationProfileUrl : displayConfig.userProfileUrl,
regularBilling: {
amount: checkout.totals.totalDueNow?.amount || checkout.totals.grandTotal.amount,
label: checkout.plan.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { CustomPageContentContainer } from '../../common/CustomPageContentContai
import { USER_PROFILE_NAVBAR_ROUTE_ID } from '../../constants';
import { useEnvironment, useUserProfileContext } from '../../contexts';
import { Route, Switch } from '../../router';
import { PaymentAttemptPage } from '../PaymentAttempts';
import { StatementPage } from '../Statements';
import { AccountPage } from './AccountPage';
import { PlansPage } from './PlansPage';
import { SecurityPage } from './SecurityPage';

const BillingPage = lazy(() =>
Expand All @@ -22,6 +19,24 @@ const APIKeysPage = lazy(() =>
})),
);

const PlansPage = lazy(() =>
import(/* webpackChunkName: "up-plans-page"*/ './PlansPage').then(module => ({
default: module.PlansPage,
})),
);

const StatementPage = lazy(() =>
import(/* webpackChunkName: "statement-page"*/ '../Statements').then(module => ({
default: module.StatementPage,
})),
);

const PaymentAttemptPage = lazy(() =>
import(/* webpackChunkName: "payment-attempt-page"*/ '../PaymentAttempts').then(module => ({
default: module.PaymentAttemptPage,
})),
);

export const UserProfileRoutes = () => {
const { pages } = useUserProfileContext();
const { apiKeysSettings, commerceSettings } = useEnvironment();
Expand Down Expand Up @@ -74,19 +89,16 @@ export const UserProfileRoutes = () => {
</Suspense>
</Route>
<Route path='plans'>
{/* TODO(@commerce): Should this be lazy loaded ? */}
<Suspense fallback={''}>
<PlansPage />
</Suspense>
</Route>
<Route path='statement/:statementId'>
{/* TODO(@commerce): Should this be lazy loaded ? */}
<Suspense fallback={''}>
<StatementPage />
</Suspense>
</Route>
<Route path='payment-attempt/:paymentAttemptId'>
{/* TODO(@commerce): Should this be lazy loaded ? */}
<Suspense fallback={''}>
<PaymentAttemptPage />
</Suspense>
Expand Down
Loading