@freemius/sdk 0.0.6 → 0.2.0
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.
- package/dist/index.d.mts +262 -231
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +262 -231
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +228 -119
- package/dist/index.mjs +226 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -568,49 +568,6 @@ interface paths {
|
|
|
568
568
|
patch?: never;
|
|
569
569
|
trace?: never;
|
|
570
570
|
};
|
|
571
|
-
'/developers/{developer_id}/products/{product_id}/emails/{email_id}.json': {
|
|
572
|
-
parameters: {
|
|
573
|
-
query?: never;
|
|
574
|
-
header?: never;
|
|
575
|
-
path: {
|
|
576
|
-
/**
|
|
577
|
-
* @description The ID of the product.
|
|
578
|
-
* @example 1234
|
|
579
|
-
*/
|
|
580
|
-
product_id: components['parameters']['product_id'];
|
|
581
|
-
/**
|
|
582
|
-
* @description The ID of the developer.
|
|
583
|
-
* @example 1234
|
|
584
|
-
*/
|
|
585
|
-
developer_id: components['parameters']['developer_id'];
|
|
586
|
-
/** @description The ID of the email. */
|
|
587
|
-
email_id: string;
|
|
588
|
-
};
|
|
589
|
-
cookie?: never;
|
|
590
|
-
};
|
|
591
|
-
/**
|
|
592
|
-
* Retrieve an email template
|
|
593
|
-
* @description Retrieve a specific email template by ID.
|
|
594
|
-
* > This is an experimental feature, please don't use it.
|
|
595
|
-
*
|
|
596
|
-
* > Only a developer can access email templates.
|
|
597
|
-
*/
|
|
598
|
-
get: operations['products/retrieve-email-template'];
|
|
599
|
-
/**
|
|
600
|
-
* Update an email template
|
|
601
|
-
* @description Update a specific email template by ID.
|
|
602
|
-
* > This is an experimental feature, please don't use it.
|
|
603
|
-
*
|
|
604
|
-
* > Only a developer can update email templates.
|
|
605
|
-
*/
|
|
606
|
-
put: operations['products/update-email-template'];
|
|
607
|
-
post?: never;
|
|
608
|
-
delete?: never;
|
|
609
|
-
options?: never;
|
|
610
|
-
head?: never;
|
|
611
|
-
patch?: never;
|
|
612
|
-
trace?: never;
|
|
613
|
-
};
|
|
614
571
|
'/products/{product_id}/events/{event_id}.json': {
|
|
615
572
|
parameters: {
|
|
616
573
|
query?: never;
|
|
@@ -2561,6 +2518,32 @@ interface paths {
|
|
|
2561
2518
|
patch?: never;
|
|
2562
2519
|
trace?: never;
|
|
2563
2520
|
};
|
|
2521
|
+
'/products/{product_id}/portal/login.json': {
|
|
2522
|
+
parameters: {
|
|
2523
|
+
query?: never;
|
|
2524
|
+
header?: never;
|
|
2525
|
+
path: {
|
|
2526
|
+
/**
|
|
2527
|
+
* @description The ID of the product.
|
|
2528
|
+
* @example 1234
|
|
2529
|
+
*/
|
|
2530
|
+
product_id: components['parameters']['product_id'];
|
|
2531
|
+
};
|
|
2532
|
+
cookie?: never;
|
|
2533
|
+
};
|
|
2534
|
+
get?: never;
|
|
2535
|
+
put?: never;
|
|
2536
|
+
/**
|
|
2537
|
+
* Generate portal login link
|
|
2538
|
+
* @description Generate a direct login link for a user in the context of the store of the product. The login link is valid for 5 minutes from generation. Either user ID or email must be provided.
|
|
2539
|
+
*/
|
|
2540
|
+
post: operations['products/generate-portal-login-link'];
|
|
2541
|
+
delete?: never;
|
|
2542
|
+
options?: never;
|
|
2543
|
+
head?: never;
|
|
2544
|
+
patch?: never;
|
|
2545
|
+
trace?: never;
|
|
2546
|
+
};
|
|
2564
2547
|
'/products/{product_id}/pricing.json': {
|
|
2565
2548
|
parameters: {
|
|
2566
2549
|
query?: never;
|
|
@@ -2775,7 +2758,7 @@ interface paths {
|
|
|
2775
2758
|
get: operations['subscriptions/retrieve'];
|
|
2776
2759
|
/**
|
|
2777
2760
|
* Update a subscription
|
|
2778
|
-
* @description Update a subscription
|
|
2761
|
+
* @description Update a subscription to activate a cancellation coupon.
|
|
2779
2762
|
*/
|
|
2780
2763
|
put: operations['subscriptions/update'];
|
|
2781
2764
|
post?: never;
|
|
@@ -3381,7 +3364,7 @@ interface paths {
|
|
|
3381
3364
|
put?: never;
|
|
3382
3365
|
/**
|
|
3383
3366
|
* Create a review
|
|
3384
|
-
* @description
|
|
3367
|
+
* @description Create a review associated with a license. If you want to create/import reviews which are not associated with a license or from a different system, please use the Review endpoint under `products/{product_id}/reviews.json`.
|
|
3385
3368
|
*/
|
|
3386
3369
|
post: operations['licenses/create-review'];
|
|
3387
3370
|
delete?: never;
|
|
@@ -4165,30 +4148,6 @@ interface components {
|
|
|
4165
4148
|
user_type: 'all' | 'new' | 'current' | 'previous' | 'customer' | 'migrated';
|
|
4166
4149
|
source?: components['schemas']['Migration']['source'];
|
|
4167
4150
|
};
|
|
4168
|
-
/** @description Class CouponEnriched */
|
|
4169
|
-
CouponEnriched: components['schemas']['Coupon'] & {
|
|
4170
|
-
/** @description If the discount type is `dollar`, then this field will hold values of absolute discount amount per supported currency. */
|
|
4171
|
-
discounts?: {
|
|
4172
|
-
/**
|
|
4173
|
-
* Format: float
|
|
4174
|
-
* @description The discount amount in absolute value for USD currency.
|
|
4175
|
-
* @example 10.5
|
|
4176
|
-
*/
|
|
4177
|
-
usd?: number | null;
|
|
4178
|
-
/**
|
|
4179
|
-
* Format: float
|
|
4180
|
-
* @description The discount amount in absolute value for EUR currency.
|
|
4181
|
-
* @example 10.5
|
|
4182
|
-
*/
|
|
4183
|
-
eur?: number | null;
|
|
4184
|
-
/**
|
|
4185
|
-
* Format: float
|
|
4186
|
-
* @description The discount amount in absolute value for GBP currency.
|
|
4187
|
-
* @example 10.5
|
|
4188
|
-
*/
|
|
4189
|
-
gbp?: number | null;
|
|
4190
|
-
};
|
|
4191
|
-
};
|
|
4192
4151
|
/** @description Represents a link between coupons to various special entities. Example: Affiliate coupon tracking, cart abandonment recovery of a product. */
|
|
4193
4152
|
CouponEntity: {
|
|
4194
4153
|
id?: components['schemas']['CommonProperties']['id'];
|
|
@@ -4222,7 +4181,17 @@ interface components {
|
|
|
4222
4181
|
redemptions?: components['schemas']['Coupon']['redemptions'];
|
|
4223
4182
|
discount?: components['schemas']['Coupon']['discount'];
|
|
4224
4183
|
discount_type?: components['schemas']['Coupon']['discount_type'];
|
|
4225
|
-
|
|
4184
|
+
/**
|
|
4185
|
+
* @description The discount amount for each currency
|
|
4186
|
+
* @example {
|
|
4187
|
+
* "usd": 10,
|
|
4188
|
+
* "eur": 9,
|
|
4189
|
+
* "gbp": 8
|
|
4190
|
+
* }
|
|
4191
|
+
*/
|
|
4192
|
+
discounts?: {
|
|
4193
|
+
[key: string]: number;
|
|
4194
|
+
};
|
|
4226
4195
|
has_renewals_discount?: components['schemas']['Coupon']['has_renewals_discount'];
|
|
4227
4196
|
};
|
|
4228
4197
|
/** @description Class Customer
|
|
@@ -5051,9 +5020,18 @@ interface components {
|
|
|
5051
5020
|
/** @description Money-back guarantee in days. */
|
|
5052
5021
|
money_back_period?: number;
|
|
5053
5022
|
refund_policy?: components['schemas']['CommonEnums']['RefundPolicy'];
|
|
5023
|
+
/** @description Indicates whether the product follows a consumptive usage. Use this if your product includes one-off or consumptive usage like AI credits, API usage etc. It affects how the refund policy is generated for your product. Check our [documentation](https://freemius.com/help/documentation/selling-with-freemius/refund-policy/) to learn more.
|
|
5024
|
+
*
|
|
5025
|
+
* > This is applicable for SaaS products only. */
|
|
5026
|
+
is_consumptive_usage?: boolean;
|
|
5054
5027
|
/** @description Renewals discount that will be applied to the chosen plan. */
|
|
5055
5028
|
annual_renewals_discount?: number | null;
|
|
5056
5029
|
renewals_discount_type?: components['schemas']['CommonEnums']['RenewalsDiscountType'];
|
|
5030
|
+
/**
|
|
5031
|
+
* @description Number of days to allow proration when upgrading from one lifetime license to another. Can be a number greater than `30` or `null` for unlimited.
|
|
5032
|
+
* @example 30
|
|
5033
|
+
*/
|
|
5034
|
+
lifetime_license_proration_days?: number | null;
|
|
5057
5035
|
/** @description A flag that controls the visibility of add-ons in the in-dashboard add-ons marketplace. Defaults to true. Only applicable if the product is an add-on. */
|
|
5058
5036
|
is_released?: boolean;
|
|
5059
5037
|
/** @description A flag that controls whether the SDK should be required or not during deployment of a version. It defaults to `true`. */
|
|
@@ -5088,6 +5066,8 @@ interface components {
|
|
|
5088
5066
|
*/
|
|
5089
5067
|
earnings?: number;
|
|
5090
5068
|
type?: components['schemas']['CommonEnums']['ProductType'];
|
|
5069
|
+
/** @description The alias type of the product. For example, 'extension', 'chrome extension', 'desktop app'. */
|
|
5070
|
+
type_alias?: string;
|
|
5091
5071
|
/** @description Determines whether the product is categorized as a static product (for example, a widget or a template). */
|
|
5092
5072
|
is_static?: boolean;
|
|
5093
5073
|
};
|
|
@@ -7148,100 +7128,6 @@ interface operations {
|
|
|
7148
7128
|
404: components['responses']['404'];
|
|
7149
7129
|
};
|
|
7150
7130
|
};
|
|
7151
|
-
'products/retrieve-email-template': {
|
|
7152
|
-
parameters: {
|
|
7153
|
-
query?: {
|
|
7154
|
-
/**
|
|
7155
|
-
* @description Comma separated list of fields to return in the response. If not specified, all fields are returned.
|
|
7156
|
-
* @example id,name,slug
|
|
7157
|
-
*/
|
|
7158
|
-
fields?: components['parameters']['fields'];
|
|
7159
|
-
};
|
|
7160
|
-
header?: never;
|
|
7161
|
-
path: {
|
|
7162
|
-
/**
|
|
7163
|
-
* @description The ID of the product.
|
|
7164
|
-
* @example 1234
|
|
7165
|
-
*/
|
|
7166
|
-
product_id: components['parameters']['product_id'];
|
|
7167
|
-
/**
|
|
7168
|
-
* @description The ID of the developer.
|
|
7169
|
-
* @example 1234
|
|
7170
|
-
*/
|
|
7171
|
-
developer_id: components['parameters']['developer_id'];
|
|
7172
|
-
/** @description The ID of the email. */
|
|
7173
|
-
email_id: string;
|
|
7174
|
-
};
|
|
7175
|
-
cookie?: never;
|
|
7176
|
-
};
|
|
7177
|
-
requestBody?: never;
|
|
7178
|
-
responses: {
|
|
7179
|
-
/** @description The email template. */
|
|
7180
|
-
200: {
|
|
7181
|
-
headers: {
|
|
7182
|
-
[name: string]: unknown;
|
|
7183
|
-
};
|
|
7184
|
-
content: {
|
|
7185
|
-
'application/json': components['schemas']['EmailTemplate'];
|
|
7186
|
-
};
|
|
7187
|
-
};
|
|
7188
|
-
400: components['responses']['400'];
|
|
7189
|
-
401: components['responses']['401'];
|
|
7190
|
-
402: components['responses']['402'];
|
|
7191
|
-
404: components['responses']['404'];
|
|
7192
|
-
};
|
|
7193
|
-
};
|
|
7194
|
-
'products/update-email-template': {
|
|
7195
|
-
parameters: {
|
|
7196
|
-
query?: {
|
|
7197
|
-
/**
|
|
7198
|
-
* @description Comma separated list of fields to return in the response. If not specified, all fields are returned.
|
|
7199
|
-
* @example id,name,slug
|
|
7200
|
-
*/
|
|
7201
|
-
fields?: components['parameters']['fields'];
|
|
7202
|
-
};
|
|
7203
|
-
header?: never;
|
|
7204
|
-
path: {
|
|
7205
|
-
/**
|
|
7206
|
-
* @description The ID of the product.
|
|
7207
|
-
* @example 1234
|
|
7208
|
-
*/
|
|
7209
|
-
product_id: components['parameters']['product_id'];
|
|
7210
|
-
/**
|
|
7211
|
-
* @description The ID of the developer.
|
|
7212
|
-
* @example 1234
|
|
7213
|
-
*/
|
|
7214
|
-
developer_id: components['parameters']['developer_id'];
|
|
7215
|
-
/** @description The ID of the email. */
|
|
7216
|
-
email_id: string;
|
|
7217
|
-
};
|
|
7218
|
-
cookie?: never;
|
|
7219
|
-
};
|
|
7220
|
-
requestBody: {
|
|
7221
|
-
content: {
|
|
7222
|
-
'application/json': {
|
|
7223
|
-
subject?: components['schemas']['EmailTemplate']['subject'];
|
|
7224
|
-
html?: components['schemas']['EmailTemplate']['html'];
|
|
7225
|
-
plain?: components['schemas']['EmailTemplate']['plain'];
|
|
7226
|
-
};
|
|
7227
|
-
};
|
|
7228
|
-
};
|
|
7229
|
-
responses: {
|
|
7230
|
-
/** @description The updated email template. */
|
|
7231
|
-
200: {
|
|
7232
|
-
headers: {
|
|
7233
|
-
[name: string]: unknown;
|
|
7234
|
-
};
|
|
7235
|
-
content: {
|
|
7236
|
-
'application/json': components['schemas']['EmailTemplate'];
|
|
7237
|
-
};
|
|
7238
|
-
};
|
|
7239
|
-
400: components['responses']['400'];
|
|
7240
|
-
401: components['responses']['401'];
|
|
7241
|
-
402: components['responses']['402'];
|
|
7242
|
-
404: components['responses']['404'];
|
|
7243
|
-
};
|
|
7244
|
-
};
|
|
7245
7131
|
'events/retrieve': {
|
|
7246
7132
|
parameters: {
|
|
7247
7133
|
query?: {
|
|
@@ -7570,6 +7456,7 @@ interface operations {
|
|
|
7570
7456
|
refund_policy?: components['schemas']['Plugin']['refund_policy'];
|
|
7571
7457
|
annual_renewals_discount?: components['schemas']['Plugin']['annual_renewals_discount'];
|
|
7572
7458
|
renewals_discount_type?: components['schemas']['Plugin']['renewals_discount_type'];
|
|
7459
|
+
lifetime_license_proration_days?: components['schemas']['Plugin']['lifetime_license_proration_days'];
|
|
7573
7460
|
is_pricing_visible?: components['schemas']['Plugin']['is_pricing_visible'];
|
|
7574
7461
|
default_plan_id?: components['schemas']['Plugin']['default_plan_id'];
|
|
7575
7462
|
/**
|
|
@@ -9283,6 +9170,8 @@ interface operations {
|
|
|
9283
9170
|
last_name?: string;
|
|
9284
9171
|
/** @description Email address of the user (only needed when activating a ghost license). */
|
|
9285
9172
|
user_email?: string;
|
|
9173
|
+
/** @description Whether to allow license activation if the plans of the product has not been released yet. Useful for testing purpose only. */
|
|
9174
|
+
allow_unreleased_plan_activation?: boolean;
|
|
9286
9175
|
};
|
|
9287
9176
|
};
|
|
9288
9177
|
};
|
|
@@ -10750,6 +10639,57 @@ interface operations {
|
|
|
10750
10639
|
};
|
|
10751
10640
|
};
|
|
10752
10641
|
};
|
|
10642
|
+
'products/generate-portal-login-link': {
|
|
10643
|
+
parameters: {
|
|
10644
|
+
query?: never;
|
|
10645
|
+
header?: never;
|
|
10646
|
+
path: {
|
|
10647
|
+
/**
|
|
10648
|
+
* @description The ID of the product.
|
|
10649
|
+
* @example 1234
|
|
10650
|
+
*/
|
|
10651
|
+
product_id: components['parameters']['product_id'];
|
|
10652
|
+
};
|
|
10653
|
+
cookie?: never;
|
|
10654
|
+
};
|
|
10655
|
+
requestBody: {
|
|
10656
|
+
content: {
|
|
10657
|
+
'application/json': {
|
|
10658
|
+
/**
|
|
10659
|
+
* Format: int64
|
|
10660
|
+
* @description The ID of the user. Either id or email is required.
|
|
10661
|
+
*/
|
|
10662
|
+
id?: string;
|
|
10663
|
+
/**
|
|
10664
|
+
* Format: email
|
|
10665
|
+
* @description The email of the user. Either id or email is required.
|
|
10666
|
+
*/
|
|
10667
|
+
email?: string;
|
|
10668
|
+
};
|
|
10669
|
+
};
|
|
10670
|
+
};
|
|
10671
|
+
responses: {
|
|
10672
|
+
/** @description Portal login link generated successfully. */
|
|
10673
|
+
201: {
|
|
10674
|
+
headers: {
|
|
10675
|
+
[name: string]: unknown;
|
|
10676
|
+
};
|
|
10677
|
+
content: {
|
|
10678
|
+
'application/json': {
|
|
10679
|
+
/** @description The generated portal session token. */
|
|
10680
|
+
token?: string;
|
|
10681
|
+
/**
|
|
10682
|
+
* Format: uri
|
|
10683
|
+
* @description The complete portal login URL with the token.
|
|
10684
|
+
*/
|
|
10685
|
+
link?: string;
|
|
10686
|
+
};
|
|
10687
|
+
};
|
|
10688
|
+
};
|
|
10689
|
+
400: components['responses']['400'];
|
|
10690
|
+
404: components['responses']['404'];
|
|
10691
|
+
};
|
|
10692
|
+
};
|
|
10753
10693
|
'products/retrieve-pricing-table-data': {
|
|
10754
10694
|
parameters: {
|
|
10755
10695
|
query?: {
|
|
@@ -11395,9 +11335,7 @@ interface operations {
|
|
|
11395
11335
|
requestBody: {
|
|
11396
11336
|
content: {
|
|
11397
11337
|
'application/json': {
|
|
11398
|
-
/** @description
|
|
11399
|
-
auto_renew?: boolean;
|
|
11400
|
-
/** @description An optional subscription cancellation coupon ID. The coupon must be set as a special "Cancellation Coupon" in the Freemius Developer Dashboard. If provided the discount will be applied to the next renewals. */
|
|
11338
|
+
/** @description The subscription cancellation coupon ID. The coupon must be set as a special "Cancellation Coupon" in the Freemius Developer Dashboard. The discount will be applied to the next renewals. */
|
|
11401
11339
|
coupon_id?: number;
|
|
11402
11340
|
};
|
|
11403
11341
|
};
|
|
@@ -12336,7 +12274,7 @@ interface operations {
|
|
|
12336
12274
|
send_verification_email?: boolean;
|
|
12337
12275
|
is_marketing_allowed?: components['schemas']['User']['is_marketing_allowed'];
|
|
12338
12276
|
/** @description (optional) If `true`, no emails will be sent to users nor events will be logged. */
|
|
12339
|
-
is_migration?:
|
|
12277
|
+
is_migration?: boolean;
|
|
12340
12278
|
source?: components['schemas']['Migration']['source_external_id'];
|
|
12341
12279
|
};
|
|
12342
12280
|
};
|
|
@@ -12924,6 +12862,7 @@ type UserSubscriptionFilterOptions = ApiEntitiesFilter<operations['users/list-su
|
|
|
12924
12862
|
type UserLicenseFilterOptions = ApiEntitiesFilter<operations['users/list-licenses']['parameters']['query']>;
|
|
12925
12863
|
type UserPaymentFilterOptions = ApiEntitiesFilter<operations['users/list-payments']['parameters']['query']>;
|
|
12926
12864
|
type UserPluginEntity = components['schemas']['UserPluginEnriched'];
|
|
12865
|
+
type UserCustomerPortalResult = operations['products/generate-portal-login-link']['responses'][201]['content']['application/json'];
|
|
12927
12866
|
type LicenseEntity = components['schemas']['License'];
|
|
12928
12867
|
type LicenseFilterOptions = ApiEntitiesFilter<operations['licenses/list']['parameters']['query']>;
|
|
12929
12868
|
type PaymentEntity = components['schemas']['Payment'];
|
|
@@ -12935,6 +12874,7 @@ type PlanEntity = components['schemas']['Plan'];
|
|
|
12935
12874
|
type BillingEntity = components['schemas']['Billing'];
|
|
12936
12875
|
type BillingUpdatePayload = operations['users/update-or-create-billing']['requestBody']['content']['application/json'];
|
|
12937
12876
|
type EventEntity = components['schemas']['EventLog'];
|
|
12877
|
+
type EventFilterOptions = ApiEntitiesFilter<operations['events/list']['parameters']['query']>;
|
|
12938
12878
|
type InstallEntity = components['schemas']['Install'];
|
|
12939
12879
|
type BillingCycleApiEnum = components['schemas']['CommonEnums']['BillingCycle'];
|
|
12940
12880
|
type CurrencyApiEnum = components['schemas']['CommonEnums']['Currency'];
|
|
@@ -13195,9 +13135,9 @@ interface CheckoutRedirectData {
|
|
|
13195
13135
|
*/
|
|
13196
13136
|
pricing_id: string;
|
|
13197
13137
|
/**
|
|
13198
|
-
*
|
|
13138
|
+
* Indicates the type of action performed during checkout.
|
|
13199
13139
|
*/
|
|
13200
|
-
|
|
13140
|
+
action: 'payment_method_update' | 'license_update' | 'trial' | 'purchase';
|
|
13201
13141
|
/**
|
|
13202
13142
|
* ID of the Freemius license, if available.
|
|
13203
13143
|
*/
|
|
@@ -13211,12 +13151,17 @@ interface CheckoutRedirectData {
|
|
|
13211
13151
|
*/
|
|
13212
13152
|
quota: number | null;
|
|
13213
13153
|
/**
|
|
13214
|
-
* Indicates the
|
|
13215
|
-
* Can be 'payment_method_update' or 'license_update'.
|
|
13216
|
-
*
|
|
13217
|
-
* If null it means the checkout was a standard purchase.
|
|
13154
|
+
* Indicates if the trial is free or paid. Null if not a trial.
|
|
13218
13155
|
*/
|
|
13219
|
-
|
|
13156
|
+
trial: 'free' | 'paid' | null;
|
|
13157
|
+
/**
|
|
13158
|
+
* End date of the trial period, if applicable.
|
|
13159
|
+
*/
|
|
13160
|
+
trial_ends_at: Date | null;
|
|
13161
|
+
/**
|
|
13162
|
+
* Currency of the purchase (ISO code).
|
|
13163
|
+
*/
|
|
13164
|
+
currency: CURRENCY;
|
|
13220
13165
|
/**
|
|
13221
13166
|
* Total amount charged for the purchase.
|
|
13222
13167
|
*/
|
|
@@ -13225,18 +13170,6 @@ interface CheckoutRedirectData {
|
|
|
13225
13170
|
* Tax amount applied to the purchase.
|
|
13226
13171
|
*/
|
|
13227
13172
|
tax: number;
|
|
13228
|
-
/**
|
|
13229
|
-
* Indicates a subscription purchase.
|
|
13230
|
-
* If present, the following fields are required:
|
|
13231
|
-
* - type: 'subscription'
|
|
13232
|
-
* - subscription_id
|
|
13233
|
-
* - billing_cycle
|
|
13234
|
-
*
|
|
13235
|
-
* If not present, the purchase is a one-off and the following fields are required:
|
|
13236
|
-
* - type: 'one-off'
|
|
13237
|
-
* - payment_id
|
|
13238
|
-
*/
|
|
13239
|
-
type: 'subscription' | 'one-off';
|
|
13240
13173
|
/**
|
|
13241
13174
|
* ID of the Freemius subscription associated with the license (for subscriptions only).
|
|
13242
13175
|
*/
|
|
@@ -13249,6 +13182,20 @@ interface CheckoutRedirectData {
|
|
|
13249
13182
|
* ID of the payment for the one-off purchase (for one-off only).
|
|
13250
13183
|
*/
|
|
13251
13184
|
payment_id: string | null;
|
|
13185
|
+
/**
|
|
13186
|
+
* Indicates a subscription purchase.
|
|
13187
|
+
* If present, the following fields are required:
|
|
13188
|
+
* - type: 'subscription'
|
|
13189
|
+
* - subscription_id
|
|
13190
|
+
* - billing_cycle
|
|
13191
|
+
*
|
|
13192
|
+
* If not present, the purchase is a one-off and the following fields are required:
|
|
13193
|
+
* - type: 'one-off'
|
|
13194
|
+
* - payment_id
|
|
13195
|
+
*
|
|
13196
|
+
* If null, indicates this is a free trial purchase and the final type of purchase is not applicable.
|
|
13197
|
+
*/
|
|
13198
|
+
type: 'subscription' | 'one-off' | null;
|
|
13252
13199
|
}
|
|
13253
13200
|
type CheckoutBuilderUserOptions = {
|
|
13254
13201
|
email: string;
|
|
@@ -13301,6 +13248,12 @@ type CheckoutBuilderOptions = {
|
|
|
13301
13248
|
* If not provided, the checkout will not have a trial period.
|
|
13302
13249
|
*/
|
|
13303
13250
|
trial?: CheckoutOptions['trial'];
|
|
13251
|
+
/**
|
|
13252
|
+
* Optional license ID for license upgrade scenarios.
|
|
13253
|
+
*
|
|
13254
|
+
* When provided, the checkout will be configured for upgrading the specified license. Use this to generate upgrade links for existing users.
|
|
13255
|
+
*/
|
|
13256
|
+
licenseId?: string;
|
|
13304
13257
|
};
|
|
13305
13258
|
/**
|
|
13306
13259
|
* Interface for actions that can be processed during the checkout flow.
|
|
@@ -13332,6 +13285,20 @@ type PricingData = {
|
|
|
13332
13285
|
sellingUnit: SellingUnit;
|
|
13333
13286
|
};
|
|
13334
13287
|
//#endregion
|
|
13288
|
+
//#region src/contracts/webhook.d.ts
|
|
13289
|
+
type WebhookListenerResponse = {
|
|
13290
|
+
status: number;
|
|
13291
|
+
} & ({
|
|
13292
|
+
success: true;
|
|
13293
|
+
} | {
|
|
13294
|
+
success: false;
|
|
13295
|
+
error: string;
|
|
13296
|
+
});
|
|
13297
|
+
declare enum WebhookAuthenticationMethod {
|
|
13298
|
+
SignatureHeader = "SignatureHeader",
|
|
13299
|
+
Api = "Api",
|
|
13300
|
+
}
|
|
13301
|
+
//#endregion
|
|
13335
13302
|
//#region src/api/parser.d.ts
|
|
13336
13303
|
declare function idToNumber(id: FSId): number;
|
|
13337
13304
|
declare function idToString(id: FSId): string;
|
|
@@ -13343,6 +13310,26 @@ declare function parseDate(dateString?: string | null): Date | null;
|
|
|
13343
13310
|
declare function parseCurrency(currency?: CurrencyApiEnum): CURRENCY | null;
|
|
13344
13311
|
declare function parsePaymentMethod(gateway?: string | null): PaymentMethod | null;
|
|
13345
13312
|
//#endregion
|
|
13313
|
+
//#region src/errors/ActionError.d.ts
|
|
13314
|
+
declare class ActionError extends Error {
|
|
13315
|
+
readonly statusCode: number;
|
|
13316
|
+
readonly validationIssues?: unknown;
|
|
13317
|
+
constructor(message: string, statusCode?: number, validationIssues?: unknown);
|
|
13318
|
+
toResponse(): Response;
|
|
13319
|
+
static badRequest(message: string): ActionError;
|
|
13320
|
+
static unauthorized(message?: string): ActionError;
|
|
13321
|
+
static notFound(message?: string): ActionError;
|
|
13322
|
+
static validationFailed(message: string, validationIssues: unknown): ActionError;
|
|
13323
|
+
static internalError(message?: string): ActionError;
|
|
13324
|
+
}
|
|
13325
|
+
//#endregion
|
|
13326
|
+
//#region src/errors/WebhookError.d.ts
|
|
13327
|
+
declare class WebhookError extends Error {
|
|
13328
|
+
readonly statusCode: number;
|
|
13329
|
+
constructor(message: string, statusCode?: number);
|
|
13330
|
+
toResponse(): WebhookListenerResponse;
|
|
13331
|
+
}
|
|
13332
|
+
//#endregion
|
|
13346
13333
|
//#region src/api/client.d.ts
|
|
13347
13334
|
declare function createApiClient(baseUrl: string, bearerToken?: string): createClient.Client<paths, `${string}/${string}`>;
|
|
13348
13335
|
type FsApiClient = ReturnType<typeof createApiClient>;
|
|
@@ -13575,6 +13562,8 @@ declare class User extends ApiBase<UserEntity, UserFilterOptions> {
|
|
|
13575
13562
|
retrieveLicenses(userId: FSId, filters?: UserLicenseFilterOptions, pagination?: PagingOptions): Promise<LicenseEntity[]>;
|
|
13576
13563
|
retrievePayments(userId: FSId, filters?: UserPaymentFilterOptions, pagination?: PagingOptions): Promise<PaymentEntity[]>;
|
|
13577
13564
|
updateBilling(userId: FSId, payload: BillingUpdatePayload): Promise<UserBillingEntity | null>;
|
|
13565
|
+
retrieveHostedCustomerPortal(userId: FSId): Promise<UserCustomerPortalResult | null>;
|
|
13566
|
+
retrieveHostedCustomerPortalByEmail(email: string): Promise<UserCustomerPortalResult | null>;
|
|
13578
13567
|
}
|
|
13579
13568
|
//#endregion
|
|
13580
13569
|
//#region src/api/Payment.d.ts
|
|
@@ -13619,6 +13608,48 @@ declare class Payment extends ApiBase<PaymentEntity, PaymentFilterOptions> {
|
|
|
13619
13608
|
retrieveInvoice(paymentId: FSId): Promise<Blob | null>;
|
|
13620
13609
|
}
|
|
13621
13610
|
//#endregion
|
|
13611
|
+
//#region src/api/WebhookEvent.d.ts
|
|
13612
|
+
declare class WebhookEvent$1 extends ApiBase<EventEntity, EventFilterOptions> {
|
|
13613
|
+
retrieve(eventId: FSId): Promise<({
|
|
13614
|
+
state?: components["schemas"]["CommonEnums"]["EventLogState"];
|
|
13615
|
+
id?: components["schemas"]["CommonProperties"]["id"];
|
|
13616
|
+
created?: components["schemas"]["CommonProperties"]["created"];
|
|
13617
|
+
updated?: components["schemas"]["CommonProperties"]["updated"];
|
|
13618
|
+
type?: string;
|
|
13619
|
+
developer_id?: string;
|
|
13620
|
+
plugin_id?: components["schemas"]["CommonProperties"]["plugin_id_nullable"];
|
|
13621
|
+
user_id?: components["schemas"]["CommonProperties"]["user_id_nullable"];
|
|
13622
|
+
install_id?: components["schemas"]["CommonProperties"]["install_id_nullable"];
|
|
13623
|
+
data?: unknown;
|
|
13624
|
+
event_trigger?: "system" | "developer" | "plugin" | "user" | "install";
|
|
13625
|
+
process_time?: string | null;
|
|
13626
|
+
} & {
|
|
13627
|
+
objects?: {
|
|
13628
|
+
user?: components["schemas"]["UserPluginEnriched"] | null;
|
|
13629
|
+
install?: components["schemas"]["Install"] | null;
|
|
13630
|
+
payment?: components["schemas"]["Payment"] | null;
|
|
13631
|
+
subscription?: components["schemas"]["Subscription"] | null;
|
|
13632
|
+
license?: components["schemas"]["License"] | null;
|
|
13633
|
+
} & {
|
|
13634
|
+
[key: string]: unknown;
|
|
13635
|
+
};
|
|
13636
|
+
}) | null>;
|
|
13637
|
+
retrieveMany(filter?: EventFilterOptions, pagination?: PagingOptions): Promise<{
|
|
13638
|
+
state?: components["schemas"]["CommonEnums"]["EventLogState"];
|
|
13639
|
+
id?: components["schemas"]["CommonProperties"]["id"];
|
|
13640
|
+
created?: components["schemas"]["CommonProperties"]["created"];
|
|
13641
|
+
updated?: components["schemas"]["CommonProperties"]["updated"];
|
|
13642
|
+
type?: string;
|
|
13643
|
+
developer_id?: string;
|
|
13644
|
+
plugin_id?: components["schemas"]["CommonProperties"]["plugin_id_nullable"];
|
|
13645
|
+
user_id?: components["schemas"]["CommonProperties"]["user_id_nullable"];
|
|
13646
|
+
install_id?: components["schemas"]["CommonProperties"]["install_id_nullable"];
|
|
13647
|
+
data?: unknown;
|
|
13648
|
+
event_trigger?: "system" | "developer" | "plugin" | "user" | "install";
|
|
13649
|
+
process_time?: string | null;
|
|
13650
|
+
}[]>;
|
|
13651
|
+
}
|
|
13652
|
+
//#endregion
|
|
13622
13653
|
//#region src/services/ApiService.d.ts
|
|
13623
13654
|
/**
|
|
13624
13655
|
* @todo - Add a proper user-agent string with SDK version.
|
|
@@ -13633,6 +13664,7 @@ declare class ApiService {
|
|
|
13633
13664
|
readonly product: Product;
|
|
13634
13665
|
readonly subscription: Subscription;
|
|
13635
13666
|
readonly payment: Payment;
|
|
13667
|
+
readonly event: WebhookEvent$1;
|
|
13636
13668
|
readonly baseUrl: string;
|
|
13637
13669
|
constructor(productId: FSId, apiKey: string, secretKey: string, publicKey: string);
|
|
13638
13670
|
/**
|
|
@@ -13668,6 +13700,10 @@ type CheckoutSerialized = {
|
|
|
13668
13700
|
link: string;
|
|
13669
13701
|
baseUrl: string;
|
|
13670
13702
|
};
|
|
13703
|
+
type CheckoutLicenseAuthorization = {
|
|
13704
|
+
licenseId: FSId;
|
|
13705
|
+
authorization: string;
|
|
13706
|
+
};
|
|
13671
13707
|
/**
|
|
13672
13708
|
* A builder class for constructing checkout parameters. This class provides a fluent
|
|
13673
13709
|
* API to create Checkout parameters for a product with various configurations.
|
|
@@ -13679,43 +13715,37 @@ declare class Checkout {
|
|
|
13679
13715
|
private readonly productId;
|
|
13680
13716
|
private readonly publicKey;
|
|
13681
13717
|
private readonly secretKey;
|
|
13682
|
-
static createSandboxToken(productId: string, secretKey: string, publicKey: string): NonNullable<CheckoutPopupParams['sandbox']>;
|
|
13683
13718
|
private options;
|
|
13684
13719
|
constructor(productId: string, publicKey: string, secretKey: string);
|
|
13685
13720
|
/**
|
|
13686
13721
|
* Enables sandbox mode for testing purposes.
|
|
13687
13722
|
*
|
|
13688
|
-
* @returns A new builder instance with sandbox configuration
|
|
13689
13723
|
*/
|
|
13690
|
-
setSandbox(): Checkout;
|
|
13724
|
+
setSandbox(sandbox: NonNullable<CheckoutPopupParams['sandbox']>): Checkout;
|
|
13691
13725
|
/**
|
|
13692
13726
|
* Sets user information for the checkout session.
|
|
13693
13727
|
*
|
|
13694
13728
|
* @param user User object with email and optional name fields. The shape matches the session from `better-auth` or next-auth packages. Also handles `null` or `undefined` gracefully.
|
|
13695
13729
|
* @param readonly If true, the user information will be read-only in the checkout session.
|
|
13696
13730
|
*
|
|
13697
|
-
* @returns A new builder instance with user configuration
|
|
13698
13731
|
*/
|
|
13699
13732
|
setUser(user: CheckoutBuilderUserOptions, readonly?: boolean): Checkout;
|
|
13700
13733
|
/**
|
|
13701
13734
|
* Applies recommended UI settings for better user experience.
|
|
13702
13735
|
* This includes fullscreen mode, upsells, refund badge, and reviews display.
|
|
13703
13736
|
*
|
|
13704
|
-
* @returns A new builder instance with recommended UI settings
|
|
13705
13737
|
*/
|
|
13706
13738
|
setRecommendations(): Checkout;
|
|
13707
13739
|
/**
|
|
13708
13740
|
* Sets the plan ID for the checkout.
|
|
13709
13741
|
*
|
|
13710
13742
|
* @param planId The plan ID to purchase
|
|
13711
|
-
* @returns A new builder instance with plan ID set
|
|
13712
13743
|
*/
|
|
13713
13744
|
setPlan(planId: string | number): Checkout;
|
|
13714
13745
|
/**
|
|
13715
13746
|
* Sets the number of licenses to purchase.
|
|
13716
13747
|
*
|
|
13717
13748
|
* @param count Number of licenses
|
|
13718
|
-
* @returns A new builder instance with license count set
|
|
13719
13749
|
*/
|
|
13720
13750
|
setQuota(count: number): Checkout;
|
|
13721
13751
|
setPricing(pricingId: string | number): Checkout;
|
|
@@ -13725,7 +13755,6 @@ declare class Checkout {
|
|
|
13725
13755
|
*
|
|
13726
13756
|
* @param coupon The coupon code to apply
|
|
13727
13757
|
* @param hideUI Whether to hide the coupon input field from users
|
|
13728
|
-
* @returns A new builder instance with coupon configuration
|
|
13729
13758
|
*/
|
|
13730
13759
|
setCoupon(options: {
|
|
13731
13760
|
code: string;
|
|
@@ -13735,14 +13764,12 @@ declare class Checkout {
|
|
|
13735
13764
|
* Enables trial mode for the checkout.
|
|
13736
13765
|
*
|
|
13737
13766
|
* @param mode Trial type - true/false for plan default, or specific 'free'/'paid' mode
|
|
13738
|
-
* @returns A new builder instance with trial configuration
|
|
13739
13767
|
*/
|
|
13740
13768
|
setTrial(mode?: 'free' | 'paid' | boolean): Checkout;
|
|
13741
13769
|
/**
|
|
13742
13770
|
* Configures the visual layout and appearance of the checkout.
|
|
13743
13771
|
*
|
|
13744
13772
|
* @param options Appearance configuration options
|
|
13745
|
-
* @returns A new builder instance with appearance configuration
|
|
13746
13773
|
*/
|
|
13747
13774
|
setAppearance(options: {
|
|
13748
13775
|
layout?: 'vertical' | 'horizontal' | null;
|
|
@@ -13755,7 +13782,6 @@ declare class Checkout {
|
|
|
13755
13782
|
* Configures discount display settings.
|
|
13756
13783
|
*
|
|
13757
13784
|
* @param options Discount configuration options
|
|
13758
|
-
* @returns A new builder instance with discount configuration
|
|
13759
13785
|
*/
|
|
13760
13786
|
setDiscounts(options: {
|
|
13761
13787
|
annual?: boolean;
|
|
@@ -13768,21 +13794,18 @@ declare class Checkout {
|
|
|
13768
13794
|
*
|
|
13769
13795
|
* @param selector Type of billing cycle selector to show
|
|
13770
13796
|
* @param defaultCycle Default billing cycle to select
|
|
13771
|
-
* @returns A new builder instance with billing cycle configuration
|
|
13772
13797
|
*/
|
|
13773
13798
|
setBillingCycle(defaultCycle: 'monthly' | 'annual' | 'lifetime', selector?: 'list' | 'responsive_list' | 'dropdown'): Checkout;
|
|
13774
13799
|
/**
|
|
13775
13800
|
* Sets the language/locale for the checkout.
|
|
13776
13801
|
*
|
|
13777
13802
|
* @param locale Language setting - 'auto', 'auto-beta', or specific locale like 'en_US'
|
|
13778
|
-
* @returns A new builder instance with locale configuration
|
|
13779
13803
|
*/
|
|
13780
13804
|
setLanguage(locale?: 'auto' | 'auto-beta' | string): Checkout;
|
|
13781
13805
|
/**
|
|
13782
13806
|
* Configures review and badge display settings.
|
|
13783
13807
|
*
|
|
13784
13808
|
* @param options Review and badge configuration
|
|
13785
|
-
* @returns A new builder instance with reviews and badges configuration
|
|
13786
13809
|
*/
|
|
13787
13810
|
setSocialProofing(options: {
|
|
13788
13811
|
showReviews?: boolean;
|
|
@@ -13796,7 +13819,6 @@ declare class Checkout {
|
|
|
13796
13819
|
* @param currency Primary currency or 'auto' for automatic detection
|
|
13797
13820
|
* @param defaultCurrency Default currency when using 'auto'
|
|
13798
13821
|
* @param showInlineSelector Whether to show inline currency selector
|
|
13799
|
-
* @returns A new builder instance with currency configuration
|
|
13800
13822
|
*/
|
|
13801
13823
|
setCurrency(currency: 'usd' | 'eur' | 'gbp' | 'auto', defaultCurrency?: 'usd' | 'eur' | 'gbp', showInlineSelector?: boolean): Checkout;
|
|
13802
13824
|
/**
|
|
@@ -13804,42 +13826,42 @@ declare class Checkout {
|
|
|
13804
13826
|
*
|
|
13805
13827
|
* @param cancelUrl URL for back button when in page mode
|
|
13806
13828
|
* @param cancelIcon Custom cancel icon URL
|
|
13807
|
-
* @returns A new builder instance with navigation configuration
|
|
13808
13829
|
*/
|
|
13809
13830
|
setCancelButton(cancelUrl?: string, cancelIcon?: string): Checkout;
|
|
13810
13831
|
/**
|
|
13811
13832
|
* Associates purchases with an affiliate account.
|
|
13812
13833
|
*
|
|
13813
13834
|
* @param userId Affiliate user ID
|
|
13814
|
-
* @returns A new builder instance with affiliate configuration
|
|
13815
13835
|
*/
|
|
13816
13836
|
setAffiliate(userId: number): Checkout;
|
|
13817
13837
|
/**
|
|
13818
13838
|
* Sets a custom image/icon for the checkout.
|
|
13819
13839
|
*
|
|
13820
13840
|
* @param imageUrl Secure HTTPS URL to the image
|
|
13821
|
-
* @returns A new builder instance with custom image
|
|
13822
13841
|
*/
|
|
13823
13842
|
setImage(imageUrl: string): Checkout;
|
|
13824
13843
|
/**
|
|
13825
|
-
* Configures the checkout for license renewal.
|
|
13844
|
+
* Configures the checkout for license renewal or upgrade by the license key.
|
|
13845
|
+
*
|
|
13846
|
+
* @note - This is less secure since it exposes the license key to the client. Use only in authenticated contexts.
|
|
13826
13847
|
*
|
|
13827
13848
|
* @param licenseKey The license key to renew
|
|
13828
|
-
* @returns A new builder instance configured for renewal
|
|
13829
13849
|
*/
|
|
13830
|
-
|
|
13850
|
+
setLicenseUpgradeByKey(licenseKey: string): Checkout;
|
|
13831
13851
|
/**
|
|
13832
|
-
*
|
|
13852
|
+
* Configures the checkout for license upgrade using an authorization token.
|
|
13833
13853
|
*
|
|
13834
|
-
* @
|
|
13854
|
+
* @param params The license upgrade authorization parameters
|
|
13855
|
+
*/
|
|
13856
|
+
setLicenseUpgradeByAuth(params: CheckoutLicenseAuthorization): Checkout;
|
|
13857
|
+
/**
|
|
13858
|
+
* Builds and returns the final checkout options to be used with the `@freemius/checkout` package.
|
|
13835
13859
|
*
|
|
13836
13860
|
* @returns The constructed CheckoutOptions object
|
|
13837
13861
|
*/
|
|
13838
13862
|
getOptions(): CheckoutOptions;
|
|
13839
13863
|
/**
|
|
13840
13864
|
* Generates a checkout link based on the current builder state.
|
|
13841
|
-
*
|
|
13842
|
-
* @note - This is async by purpose so that we can allow for future enhancements that might require async operations.
|
|
13843
13865
|
*/
|
|
13844
13866
|
getLink(): string;
|
|
13845
13867
|
serialize(): CheckoutSerialized;
|
|
@@ -13949,14 +13971,16 @@ declare class CheckoutRedirectInfo implements CheckoutRedirectData {
|
|
|
13949
13971
|
plan_id: string;
|
|
13950
13972
|
email: string;
|
|
13951
13973
|
pricing_id: string;
|
|
13952
|
-
|
|
13974
|
+
action: 'payment_method_update' | 'license_update' | 'trial' | 'purchase';
|
|
13953
13975
|
license_id: string;
|
|
13954
13976
|
expiration: Date | null;
|
|
13955
13977
|
quota: number | null;
|
|
13956
|
-
|
|
13978
|
+
trial: 'free' | 'paid' | null;
|
|
13979
|
+
trial_ends_at: Date | null;
|
|
13980
|
+
currency: CURRENCY;
|
|
13957
13981
|
amount: number;
|
|
13958
13982
|
tax: number;
|
|
13959
|
-
type: 'subscription' | 'one-off';
|
|
13983
|
+
type: 'subscription' | 'one-off' | null;
|
|
13960
13984
|
subscription_id: string | null;
|
|
13961
13985
|
billing_cycle: BILLING_CYCLE | null;
|
|
13962
13986
|
payment_id: string | null;
|
|
@@ -14047,13 +14071,14 @@ declare class CheckoutRequestProcessor implements RequestProcessor<CheckoutReque
|
|
|
14047
14071
|
//#endregion
|
|
14048
14072
|
//#region src/services/CheckoutService.d.ts
|
|
14049
14073
|
declare class CheckoutService {
|
|
14074
|
+
private readonly api;
|
|
14050
14075
|
private readonly productId;
|
|
14051
14076
|
private readonly publicKey;
|
|
14052
14077
|
private readonly secretKey;
|
|
14053
14078
|
private readonly purchase;
|
|
14054
14079
|
private readonly pricing;
|
|
14055
14080
|
readonly request: CheckoutRequestProcessor;
|
|
14056
|
-
constructor(productId: FSId, publicKey: string, secretKey: string, purchase: PurchaseService, pricing: PricingService);
|
|
14081
|
+
constructor(api: ApiService, productId: FSId, publicKey: string, secretKey: string, purchase: PurchaseService, pricing: PricingService);
|
|
14057
14082
|
/**
|
|
14058
14083
|
* Use this to build a Checkout for your product.
|
|
14059
14084
|
* You can build a Checkout link or options for the popup.
|
|
@@ -14093,11 +14118,14 @@ declare class CheckoutService {
|
|
|
14093
14118
|
* This shouldn't be used in production, but is useful for testing purposes.
|
|
14094
14119
|
*
|
|
14095
14120
|
* @note This is intentionally set as `async` because we would use the API in the future to generate more fine grained sandbox params (for example for a specific email address only).
|
|
14096
|
-
*
|
|
14097
|
-
* @todo - This has a duplication with the `inSandbox` method in the builder. Consider refactoring to avoid this duplication.
|
|
14098
|
-
* Also think about whether we should make the builder's `inSandbox` method async as well.
|
|
14099
14121
|
*/
|
|
14100
14122
|
getSandboxParams(): Promise<NonNullable<CheckoutPopupParams['sandbox']>>;
|
|
14123
|
+
/**
|
|
14124
|
+
* Retrieves the license upgrade authorization for a given license ID.
|
|
14125
|
+
*
|
|
14126
|
+
* This is used to authorize a license upgrade during the checkout process. Useful when creating upgrade links for existing users.
|
|
14127
|
+
*/
|
|
14128
|
+
getLicenseUpgradeAuth(licenseId: FSId): Promise<CheckoutLicenseAuthorization>;
|
|
14101
14129
|
/**
|
|
14102
14130
|
* Processes a redirect URL and returns the checkout redirect information if valid.
|
|
14103
14131
|
*
|
|
@@ -14600,19 +14628,13 @@ interface NormalizedRequest {
|
|
|
14600
14628
|
headers: Record<string, string | string[] | undefined> | Headers;
|
|
14601
14629
|
rawBody: string | Buffer;
|
|
14602
14630
|
}
|
|
14603
|
-
type WebhookListenerResponse = {
|
|
14604
|
-
status: number;
|
|
14605
|
-
} & ({
|
|
14606
|
-
success: true;
|
|
14607
|
-
} | {
|
|
14608
|
-
success: false;
|
|
14609
|
-
error: string;
|
|
14610
|
-
});
|
|
14611
14631
|
declare class WebhookListener {
|
|
14632
|
+
private readonly api;
|
|
14612
14633
|
private readonly secretKey;
|
|
14613
14634
|
private readonly onError;
|
|
14635
|
+
private readonly authenticationMethod;
|
|
14614
14636
|
private eventHandlers;
|
|
14615
|
-
constructor(secretKey: string, onError?: (error: unknown) => void);
|
|
14637
|
+
constructor(api: ApiService, secretKey: string, onError?: (error: unknown) => Promise<void>, authenticationMethod?: WebhookAuthenticationMethod);
|
|
14616
14638
|
on<T extends WebhookEventType>(type: T, handler: WebhookEventHandler<T>): this;
|
|
14617
14639
|
on<T extends WebhookEventType>(types: T[], handler: WebhookEventHandler<T>): this;
|
|
14618
14640
|
off<T extends WebhookEventType>(type: T, handler: WebhookEventHandler<T>): this;
|
|
@@ -14634,14 +14656,23 @@ declare class WebhookListener {
|
|
|
14634
14656
|
* Returns an object you can map to your framework's response easily.
|
|
14635
14657
|
*/
|
|
14636
14658
|
process(input: NormalizedRequest): Promise<WebhookListenerResponse>;
|
|
14659
|
+
private authenticateAndGetEventFromInput;
|
|
14660
|
+
private authenticateAndGetEventFromApi;
|
|
14661
|
+
private parseEventFromInput;
|
|
14662
|
+
private processEvent;
|
|
14637
14663
|
private getHeader;
|
|
14638
14664
|
}
|
|
14639
14665
|
//#endregion
|
|
14640
14666
|
//#region src/services/WebhookService.d.ts
|
|
14667
|
+
type WebhookListenerConfig = {
|
|
14668
|
+
onError?: (error: unknown) => Promise<void>;
|
|
14669
|
+
authenticationMethod?: WebhookAuthenticationMethod;
|
|
14670
|
+
};
|
|
14641
14671
|
declare class WebhookService {
|
|
14672
|
+
private readonly api;
|
|
14642
14673
|
private readonly secretKey;
|
|
14643
|
-
constructor(secretKey: string);
|
|
14644
|
-
createListener(
|
|
14674
|
+
constructor(api: ApiService, secretKey: string);
|
|
14675
|
+
createListener(config?: WebhookListenerConfig): WebhookListener;
|
|
14645
14676
|
createRequestProcessor(listener: WebhookListener): (request: Request) => Promise<Response>;
|
|
14646
14677
|
/**
|
|
14647
14678
|
* WHATWG Fetch API adapter for modern JavaScript environments.
|
|
@@ -14755,5 +14786,5 @@ declare class Freemius {
|
|
|
14755
14786
|
constructor(config: FreemiusConfig);
|
|
14756
14787
|
}
|
|
14757
14788
|
//#endregion
|
|
14758
|
-
export { ApiAuthParams, ApiEntitiesFilter, type ApiService, type ApplyRenewalCouponRequest, BILLING_CYCLE, BillingCycleApiEnum, BillingEntity, type BillingRequest, BillingUpdatePayload, CURRENCY, type Checkout, CheckoutAction, type CheckoutRequestConfig as CheckoutActionConfig, CheckoutBuilderOptions, CheckoutBuilderUserOptions, CheckoutRedirectData, type CheckoutRedirectInfo, type CheckoutSerialized, type CheckoutService, CouponEntityEnriched, CurrencyApiEnum, type CustomerPortalDataWithEmailOption, type CustomerPortalDataWithUserOption, type CustomerPortalService, EventEntity, FSId, Freemius, FreemiusConfig, InstallEntity, LicenseEntity, LicenseFilterOptions, PagingOptions, PaymentEntity, PaymentFilterOptions, PaymentMethod, PlanEntity, PortalAction, PortalBilling, PortalData, PortalPayment, PortalPlans, type PortalRequestConfig, PortalSubscription, PortalSubscriptions, PricingData, PricingEntity, type PricingService, PricingTableData, ProductEntity, PurchaseData, PurchaseEntitlementData, PurchaseEntitlementType, type PurchaseInfo, type PurchaseService, RequestProcessor, SellingUnit, SubscriptionCancellationReasonType, type SubscriptionCancellationRequest, SubscriptionCancellationResult, SubscriptionDiscountEntity, SubscriptionEntity, SubscriptionFilterOptions, SubscriptionRenewalCouponResult, UserBillingEntity, UserEntity, UserFilterOptions, UserLicenseFilterOptions, UserPaymentFilterOptions, UserPluginEntity, UserRetriever, UserSubscriptionEntity, UserSubscriptionFilterOptions, UserSubscriptionWithDiscounts, type WebhookEvent, type WebhookEventDataMap, type WebhookEventHandler, type WebhookEventType, type WebhookService, idToNumber, idToString, isIdsEqual, parseBillingCycle, parseCurrency, parseDate, parseDateTime, parseNumber, parsePaymentMethod };
|
|
14789
|
+
export { ActionError, ApiAuthParams, ApiEntitiesFilter, type ApiService, type ApplyRenewalCouponRequest, BILLING_CYCLE, BillingCycleApiEnum, BillingEntity, type BillingRequest, BillingUpdatePayload, CURRENCY, type Checkout, CheckoutAction, type CheckoutRequestConfig as CheckoutActionConfig, CheckoutBuilderOptions, CheckoutBuilderUserOptions, CheckoutRedirectData, type CheckoutRedirectInfo, type CheckoutSerialized, type CheckoutService, CouponEntityEnriched, CurrencyApiEnum, type CustomerPortalDataWithEmailOption, type CustomerPortalDataWithUserOption, type CustomerPortalService, EventEntity, EventFilterOptions, FSId, Freemius, FreemiusConfig, InstallEntity, LicenseEntity, LicenseFilterOptions, PagingOptions, PaymentEntity, PaymentFilterOptions, PaymentMethod, PlanEntity, PortalAction, PortalBilling, PortalData, PortalPayment, PortalPlans, type PortalRequestConfig, PortalSubscription, PortalSubscriptions, PricingData, PricingEntity, type PricingService, PricingTableData, ProductEntity, PurchaseData, PurchaseEntitlementData, PurchaseEntitlementType, type PurchaseInfo, type PurchaseService, RequestProcessor, SellingUnit, SubscriptionCancellationReasonType, type SubscriptionCancellationRequest, SubscriptionCancellationResult, SubscriptionDiscountEntity, SubscriptionEntity, SubscriptionFilterOptions, SubscriptionRenewalCouponResult, UserBillingEntity, UserCustomerPortalResult, UserEntity, UserFilterOptions, UserLicenseFilterOptions, UserPaymentFilterOptions, UserPluginEntity, UserRetriever, UserSubscriptionEntity, UserSubscriptionFilterOptions, UserSubscriptionWithDiscounts, WebhookAuthenticationMethod, WebhookError, type WebhookEvent, type WebhookEventDataMap, type WebhookEventHandler, type WebhookEventType, WebhookListenerResponse, type WebhookService, idToNumber, idToString, isIdsEqual, parseBillingCycle, parseCurrency, parseDate, parseDateTime, parseNumber, parsePaymentMethod };
|
|
14759
14790
|
//# sourceMappingURL=index.d.ts.map
|