diff --git a/sdks/js/packages/core/package.json b/sdks/js/packages/core/package.json index 5f9b32121..6b78bf849 100644 --- a/sdks/js/packages/core/package.json +++ b/sdks/js/packages/core/package.json @@ -101,7 +101,7 @@ "@connectrpc/connect-query": "^2.1.1", "@connectrpc/connect-web": "^2.0.2", "@hookform/resolvers": "^3.10.0", - "@raystack/proton": "0.1.0-dcceed81ad090604a542bb2a9a12bab7218bc59b", + "@raystack/proton": "0.1.0-c0cefcd5a0fa53487ff80dec69788b21999cb01e", "@tanstack/react-query": "^5.83.0", "@tanstack/react-router": "1.58.17", "axios": "^1.9.0", diff --git a/sdks/js/packages/core/react/components/common/upcoming-plan-change-banner/index.tsx b/sdks/js/packages/core/react/components/common/upcoming-plan-change-banner/index.tsx index 0b518f2d5..05613a834 100644 --- a/sdks/js/packages/core/react/components/common/upcoming-plan-change-banner/index.tsx +++ b/sdks/js/packages/core/react/components/common/upcoming-plan-change-banner/index.tsx @@ -36,7 +36,6 @@ export function UpcomingPlanChangeBanner({ config, activePlan, activeOrganization, - billingAccount, basePlan, allPlans, isAllPlansLoading @@ -54,8 +53,7 @@ export function UpcomingPlanChangeBanner({ schema: FrontierServiceQueries.listSubscriptions, transport, input: { - orgId: activeOrganization?.id ?? '', - billingId: billingAccount?.id ?? '' + orgId: activeOrganization?.id ?? '' }, cardinality: 'finite' }) @@ -102,11 +100,9 @@ export function UpcomingPlanChangeBanner({ const showLoader = isLoading || isAllPlansLoading; const onPlanChangeCancel = useCallback(() => { - if (activeOrganization?.id && billingAccount?.id && subscription?.id) { + if (subscription?.id) { cancelUpcomingChange( create(ChangeSubscriptionRequestSchema, { - orgId: activeOrganization?.id, - billingId: billingAccount?.id, id: subscription?.id, change: { case: 'phaseChange', @@ -117,12 +113,7 @@ export function UpcomingPlanChangeBanner({ }) ); } - }, [ - activeOrganization?.id, - billingAccount?.id, - subscription?.id, - cancelUpcomingChange - ]); + }, [subscription?.id, cancelUpcomingChange]); const currentPlanName = getPlanNameWithInterval(activePlan); const upcomingPlanName = getPlanNameWithInterval(upcomingPlan || basePlan); diff --git a/sdks/js/packages/core/react/components/organization/plans/hooks/usePlans.tsx b/sdks/js/packages/core/react/components/organization/plans/hooks/usePlans.tsx index 146f820ca..62e3a77b0 100644 --- a/sdks/js/packages/core/react/components/organization/plans/hooks/usePlans.tsx +++ b/sdks/js/packages/core/react/components/organization/plans/hooks/usePlans.tsx @@ -164,15 +164,9 @@ export const usePlans = () => { const changePlan = useCallback( async ({ planId, onSuccess, immediate = false }: changePlanOptions) => { - if ( - activeOrganization?.id && - billingAccount?.id && - activeSubscription?.id - ) { + if (activeSubscription?.id) { const resp = await changeSubscriptionMutation( create(ChangeSubscriptionRequestSchema, { - orgId: activeOrganization?.id, - billingId: billingAccount?.id, id: activeSubscription?.id, change: { case: 'planChange', @@ -188,12 +182,7 @@ export const usePlans = () => { } } }, - [ - activeOrganization?.id, - activeSubscription?.id, - billingAccount?.id, - changeSubscriptionMutation - ] + [activeSubscription?.id, changeSubscriptionMutation] ); const verifyPlanChange = useCallback( @@ -286,15 +275,9 @@ export const usePlans = () => { const cancelSubscription = useCallback( async ({ onSuccess }: cancelSubscriptionOptions) => { - if ( - activeOrganization?.id && - billingAccount?.id && - activeSubscription?.id - ) { + if (activeSubscription?.id) { const resp = await cancelSubscriptionMutation( create(CancelSubscriptionRequestSchema, { - orgId: activeOrganization?.id, - billingId: billingAccount?.id, id: activeSubscription?.id, immediate: false }) @@ -304,12 +287,7 @@ export const usePlans = () => { } } }, - [ - activeOrganization?.id, - billingAccount?.id, - activeSubscription?.id, - cancelSubscriptionMutation - ] + [activeSubscription?.id, cancelSubscriptionMutation] ); return { diff --git a/sdks/js/packages/core/react/contexts/FrontierContext.tsx b/sdks/js/packages/core/react/contexts/FrontierContext.tsx index 66091d2e8..e4422be32 100644 --- a/sdks/js/packages/core/react/contexts/FrontierContext.tsx +++ b/sdks/js/packages/core/react/contexts/FrontierContext.tsx @@ -289,10 +289,9 @@ export const FrontierContextProvider = ({ } = useConnectQuery( FrontierServiceQueries.listSubscriptions, create(ListSubscriptionsRequestSchema, { - orgId: activeOrganization?.id ?? '', - billingId: billingAccount?.id ?? '' + orgId: activeOrganization?.id ?? '' }), - { enabled: !!activeOrganization?.id && !!billingAccount?.id } + { enabled: !!activeOrganization?.id } ); const subscriptions = (subscriptionsData?.subscriptions || diff --git a/sdks/js/pnpm-lock.yaml b/sdks/js/pnpm-lock.yaml index 85a88b887..a3a82d33b 100644 --- a/sdks/js/pnpm-lock.yaml +++ b/sdks/js/pnpm-lock.yaml @@ -49,8 +49,8 @@ importers: specifier: ^3.10.0 version: 3.10.0(react-hook-form@7.57.0(react@18.3.1)) '@raystack/proton': - specifier: 0.1.0-dcceed81ad090604a542bb2a9a12bab7218bc59b - version: 0.1.0-dcceed81ad090604a542bb2a9a12bab7218bc59b(@tanstack/query-core@5.83.0)(@tanstack/react-query@5.83.0(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 0.1.0-c0cefcd5a0fa53487ff80dec69788b21999cb01e + version: 0.1.0-c0cefcd5a0fa53487ff80dec69788b21999cb01e(@tanstack/query-core@5.83.0)(@tanstack/react-query@5.83.0(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/react-query': specifier: ^5.83.0 version: 5.83.0(react@18.3.1) @@ -2032,8 +2032,8 @@ packages: '@types/react': optional: true - '@raystack/proton@0.1.0-dcceed81ad090604a542bb2a9a12bab7218bc59b': - resolution: {integrity: sha512-l4mvcw3WNLXY0tOyDBUGnU+t7wMLpHUxCeG5jgBWHK+VYy6lpyZuL23+5IqxrTNNQtfrH7gLs9kA41KGp3HxLw==} + '@raystack/proton@0.1.0-c0cefcd5a0fa53487ff80dec69788b21999cb01e': + resolution: {integrity: sha512-3wXHrxmaWLfYeQj7sOFCG37iqv1qZjdH+GYnim/hL+80Oxqy6PlcpImawmgm+MpZCkCSt+dFZb6LlLDszA7VJw==} peerDependencies: '@tanstack/react-query': ^5.0.0 peerDependenciesMeta: @@ -9232,7 +9232,7 @@ snapshots: transitivePeerDependencies: - '@types/react-dom' - '@raystack/proton@0.1.0-dcceed81ad090604a542bb2a9a12bab7218bc59b(@tanstack/query-core@5.83.0)(@tanstack/react-query@5.83.0(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@raystack/proton@0.1.0-c0cefcd5a0fa53487ff80dec69788b21999cb01e(@tanstack/query-core@5.83.0)(@tanstack/react-query@5.83.0(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@bufbuild/protobuf': 2.6.3 '@connectrpc/connect': 2.1.0(@bufbuild/protobuf@2.6.3) diff --git a/ui/src/pages/organizations/details/side-panel/plan-details-section.tsx b/ui/src/pages/organizations/details/side-panel/plan-details-section.tsx index 6dc773502..9afb543d8 100644 --- a/ui/src/pages/organizations/details/side-panel/plan-details-section.tsx +++ b/ui/src/pages/organizations/details/side-panel/plan-details-section.tsx @@ -18,11 +18,10 @@ export const PlanDetailsSection = () => { const { data: activeSubscription, isLoading: isSubscriptionLoading, error: subscriptionsError } = useQuery( FrontierServiceQueries.listSubscriptions, create(ListSubscriptionsRequestSchema, { - orgId: organizationId, - billingId: billingAccountId, + orgId: organizationId }), { - enabled: !!organizationId && !!billingAccountId, + enabled: !!organizationId, select: (data) => { const subscriptions = data?.subscriptions ?? []; return subscriptions.find(