Skip to content

Commit b2a2641

Browse files
refactor(SDK): remove deprecated fields from subscription APIs (#1298)
Co-authored-by: Claude <[email protected]>
1 parent c4db389 commit b2a2641

File tree

6 files changed

+17
-50
lines changed

6 files changed

+17
-50
lines changed

sdks/js/packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"@connectrpc/connect-query": "^2.1.1",
102102
"@connectrpc/connect-web": "^2.0.2",
103103
"@hookform/resolvers": "^3.10.0",
104-
"@raystack/proton": "0.1.0-dcceed81ad090604a542bb2a9a12bab7218bc59b",
104+
"@raystack/proton": "0.1.0-c0cefcd5a0fa53487ff80dec69788b21999cb01e",
105105
"@tanstack/react-query": "^5.83.0",
106106
"@tanstack/react-router": "1.58.17",
107107
"axios": "^1.9.0",

sdks/js/packages/core/react/components/common/upcoming-plan-change-banner/index.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export function UpcomingPlanChangeBanner({
3636
config,
3737
activePlan,
3838
activeOrganization,
39-
billingAccount,
4039
basePlan,
4140
allPlans,
4241
isAllPlansLoading
@@ -54,8 +53,7 @@ export function UpcomingPlanChangeBanner({
5453
schema: FrontierServiceQueries.listSubscriptions,
5554
transport,
5655
input: {
57-
orgId: activeOrganization?.id ?? '',
58-
billingId: billingAccount?.id ?? ''
56+
orgId: activeOrganization?.id ?? ''
5957
},
6058
cardinality: 'finite'
6159
})
@@ -102,11 +100,9 @@ export function UpcomingPlanChangeBanner({
102100
const showLoader = isLoading || isAllPlansLoading;
103101

104102
const onPlanChangeCancel = useCallback(() => {
105-
if (activeOrganization?.id && billingAccount?.id && subscription?.id) {
103+
if (subscription?.id) {
106104
cancelUpcomingChange(
107105
create(ChangeSubscriptionRequestSchema, {
108-
orgId: activeOrganization?.id,
109-
billingId: billingAccount?.id,
110106
id: subscription?.id,
111107
change: {
112108
case: 'phaseChange',
@@ -117,12 +113,7 @@ export function UpcomingPlanChangeBanner({
117113
})
118114
);
119115
}
120-
}, [
121-
activeOrganization?.id,
122-
billingAccount?.id,
123-
subscription?.id,
124-
cancelUpcomingChange
125-
]);
116+
}, [subscription?.id, cancelUpcomingChange]);
126117

127118
const currentPlanName = getPlanNameWithInterval(activePlan);
128119
const upcomingPlanName = getPlanNameWithInterval(upcomingPlan || basePlan);

sdks/js/packages/core/react/components/organization/plans/hooks/usePlans.tsx

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,9 @@ export const usePlans = () => {
164164

165165
const changePlan = useCallback(
166166
async ({ planId, onSuccess, immediate = false }: changePlanOptions) => {
167-
if (
168-
activeOrganization?.id &&
169-
billingAccount?.id &&
170-
activeSubscription?.id
171-
) {
167+
if (activeSubscription?.id) {
172168
const resp = await changeSubscriptionMutation(
173169
create(ChangeSubscriptionRequestSchema, {
174-
orgId: activeOrganization?.id,
175-
billingId: billingAccount?.id,
176170
id: activeSubscription?.id,
177171
change: {
178172
case: 'planChange',
@@ -188,12 +182,7 @@ export const usePlans = () => {
188182
}
189183
}
190184
},
191-
[
192-
activeOrganization?.id,
193-
activeSubscription?.id,
194-
billingAccount?.id,
195-
changeSubscriptionMutation
196-
]
185+
[activeSubscription?.id, changeSubscriptionMutation]
197186
);
198187

199188
const verifyPlanChange = useCallback(
@@ -286,15 +275,9 @@ export const usePlans = () => {
286275

287276
const cancelSubscription = useCallback(
288277
async ({ onSuccess }: cancelSubscriptionOptions) => {
289-
if (
290-
activeOrganization?.id &&
291-
billingAccount?.id &&
292-
activeSubscription?.id
293-
) {
278+
if (activeSubscription?.id) {
294279
const resp = await cancelSubscriptionMutation(
295280
create(CancelSubscriptionRequestSchema, {
296-
orgId: activeOrganization?.id,
297-
billingId: billingAccount?.id,
298281
id: activeSubscription?.id,
299282
immediate: false
300283
})
@@ -304,12 +287,7 @@ export const usePlans = () => {
304287
}
305288
}
306289
},
307-
[
308-
activeOrganization?.id,
309-
billingAccount?.id,
310-
activeSubscription?.id,
311-
cancelSubscriptionMutation
312-
]
290+
[activeSubscription?.id, cancelSubscriptionMutation]
313291
);
314292

315293
return {

sdks/js/packages/core/react/contexts/FrontierContext.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,9 @@ export const FrontierContextProvider = ({
289289
} = useConnectQuery(
290290
FrontierServiceQueries.listSubscriptions,
291291
create(ListSubscriptionsRequestSchema, {
292-
orgId: activeOrganization?.id ?? '',
293-
billingId: billingAccount?.id ?? ''
292+
orgId: activeOrganization?.id ?? ''
294293
}),
295-
{ enabled: !!activeOrganization?.id && !!billingAccount?.id }
294+
{ enabled: !!activeOrganization?.id }
296295
);
297296

298297
const subscriptions = (subscriptionsData?.subscriptions ||

sdks/js/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/pages/organizations/details/side-panel/plan-details-section.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ export const PlanDetailsSection = () => {
1818
const { data: activeSubscription, isLoading: isSubscriptionLoading, error: subscriptionsError } = useQuery(
1919
FrontierServiceQueries.listSubscriptions,
2020
create(ListSubscriptionsRequestSchema, {
21-
orgId: organizationId,
22-
billingId: billingAccountId,
21+
orgId: organizationId
2322
}),
2423
{
25-
enabled: !!organizationId && !!billingAccountId,
24+
enabled: !!organizationId,
2625
select: (data) => {
2726
const subscriptions = data?.subscriptions ?? [];
2827
return subscriptions.find(

0 commit comments

Comments
 (0)