File tree Expand file tree Collapse file tree
packages/vue/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @clerk/vue " : minor
3+ ---
4+
5+ Replaced callback props with event emitters in billing buttons:
6+
7+ props ` onSubscriptionComplete ` → emit ` subscription-complete `
8+ props ` onSubscriptionCancel ` → emit ` subscription-cancel `
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { useClerk } from '../composables/useClerk';
55import { useAuth } from ' ../composables/useAuth' ;
66import { assertSingleChild , normalizeWithDefaultValue } from ' ../utils' ;
77
8- const props = defineProps <__experimental_CheckoutButtonProps >();
8+ type CheckoutButtonProps = Omit <__experimental_CheckoutButtonProps , ' onSubscriptionComplete' >;
9+ const props = defineProps <CheckoutButtonProps >();
910
1011const clerk = useClerk ();
1112const { userId, orgId } = useAuth ();
@@ -26,6 +27,8 @@ function getChildComponent() {
2627 return assertSingleChild (children , ' CheckoutButton' );
2728}
2829
30+ const emit = defineEmits <{ (e : ' subscription-complete' ): void }>();
31+
2932function clickHandler() {
3033 if (! clerk .value ) {
3134 return ;
@@ -35,9 +38,9 @@ function clickHandler() {
3538 planId: props .planId ,
3639 planPeriod: props .planPeriod ,
3740 for: props .for ,
38- onSubscriptionComplete: props .onSubscriptionComplete ,
3941 newSubscriptionRedirectUrl: props .newSubscriptionRedirectUrl ,
4042 ... props .checkoutProps ,
43+ onSubscriptionComplete : () => emit (' subscription-complete' ),
4144 });
4245}
4346 </script >
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { useClerk } from '../composables/useClerk';
55import { useAuth } from ' ../composables/useAuth' ;
66import { assertSingleChild , normalizeWithDefaultValue } from ' ../utils' ;
77
8- const props = defineProps <__experimental_SubscriptionDetailsButtonProps >();
8+ type SubscriptionDetailsButtonProps = Omit <__experimental_SubscriptionDetailsButtonProps , ' onSubscriptionCancel' >;
9+ const props = defineProps <SubscriptionDetailsButtonProps >();
910
1011const clerk = useClerk ();
1112const { userId, orgId } = useAuth ();
@@ -26,15 +27,17 @@ function getChildComponent() {
2627 return assertSingleChild (children , ' SubscriptionDetailsButton' );
2728}
2829
30+ const emit = defineEmits <{ (e : ' subscription-cancel' ): void }>();
31+
2932function clickHandler() {
3033 if (! clerk .value ) {
3134 return ;
3235 }
3336
3437 return clerk .value .__internal_openSubscriptionDetails ({
3538 for: props .for ,
36- onSubscriptionCancel: props .onSubscriptionCancel ,
3739 ... props .subscriptionDetailsProps ,
40+ onSubscriptionCancel : () => emit (' subscription-cancel' ),
3841 });
3942}
4043 </script >
You can’t perform that action at this time.
0 commit comments