-
Notifications
You must be signed in to change notification settings - Fork 372
feat(clerk-js, types): Update billing resources with trial properties #6492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2efc7c2
6b21c1e
d4aac9c
208a4b7
50801c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
'@clerk/types': minor | ||
--- | ||
|
||
Update billing resources with trial properties. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -783,6 +783,7 @@ export interface CommerceSubscriptionItemJSON extends ClerkResourceJSON { | |
period_end: number | null; | ||
canceled_at: number | null; | ||
past_due_at: number | null; | ||
is_free_trial: boolean; | ||
} | ||
Comment on lines
+786
to
787
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainRequired JSON field may break backward-compat; ensure safe runtime default.
Follow-up fix (in runtime mapping) to preserve a safe default: Apply in - this.isFreeTrial = data.is_free_trial;
+ this.isFreeTrial = data.is_free_trial ?? false; 🏁 Script executed: #!/bin/bash
# Locate CommerceSubscription.ts
echo "CommerceSubscription.ts files:"
rg -l "CommerceSubscription" -g "*.ts"
# Inspect JSON mapping references in clerk-js
echo -e "\nMapping of is_free_trial in clerk-js runtime:"
rg -n "is_free_trial" -C2 packages/clerk-js/src
echo -e "\nAssignment to isFreeTrial in clerk-js runtime:"
rg -n "isFreeTrial" -C2 packages/clerk-js/src Length of output: 2519 Ensure safe default for To prevent legacy responses from clearing the default, update the runtime mapping in
Optional: if the backend cannot guarantee - interface CommerceSubscriptionItemJSON {
- is_free_trial: boolean;
+ interface CommerceSubscriptionItemJSON {
+ /** Indicates whether this subscription item started with a free trial */
+ is_free_trial?: boolean; This preserves backward compatibility while clarifying the field’s semantics.
🤖 Prompt for AI Agents
|
||
|
||
/** | ||
|
@@ -812,6 +813,7 @@ export interface CommerceSubscriptionJSON extends ClerkResourceJSON { | |
updated_at: number | null; | ||
past_due_at: number | null; | ||
subscription_items: CommerceSubscriptionItemJSON[] | null; | ||
eligible_for_free_trial?: boolean; | ||
} | ||
|
||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.