@funnelsgrove/runtime 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -50,6 +50,7 @@ export type ManageSubscriptionsResponse = {
|
|
|
50
50
|
currency?: string | null;
|
|
51
51
|
billingInterval?: string | null;
|
|
52
52
|
billingIntervalCount?: number | null;
|
|
53
|
+
discountCouponIds?: string[];
|
|
53
54
|
environment: 'test' | 'live';
|
|
54
55
|
}>;
|
|
55
56
|
eventsCount: number;
|
|
@@ -102,7 +103,8 @@ declare class ApiService {
|
|
|
102
103
|
getManageSubscriptions(): Promise<ManageSubscriptionsResponse>;
|
|
103
104
|
updateSubscription(input: {
|
|
104
105
|
subscriptionId: string;
|
|
105
|
-
action: 'cancel' | 'renew';
|
|
106
|
+
action: 'cancel' | 'renew' | 'apply-discount';
|
|
107
|
+
couponId?: string | null;
|
|
106
108
|
}): Promise<ManageSubscriptionsResponse>;
|
|
107
109
|
}
|
|
108
110
|
export declare const apiService: ApiService;
|
|
@@ -481,6 +481,7 @@ class ApiService {
|
|
|
481
481
|
return (await response.json());
|
|
482
482
|
}
|
|
483
483
|
async updateSubscription(input) {
|
|
484
|
+
var _a;
|
|
484
485
|
const userId = this.getSubscriptionManagementUserId();
|
|
485
486
|
const stripeCustomerId = this.getSubscriptionManagementStripeCustomerId();
|
|
486
487
|
const response = await fetch(buildMainApiUrl(`/sdk/public/subscriptions/${encodeURIComponent(input.subscriptionId)}/${input.action}`), {
|
|
@@ -492,6 +493,7 @@ class ApiService {
|
|
|
492
493
|
user_id: userId || undefined,
|
|
493
494
|
stripe_customer_id: stripeCustomerId || undefined,
|
|
494
495
|
funnelId: FUNNEL_ID || undefined,
|
|
496
|
+
coupon_id: ((_a = input.couponId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
|
|
495
497
|
}),
|
|
496
498
|
});
|
|
497
499
|
if (!response.ok) {
|