@freemius/sdk 0.1.0 → 0.3.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.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's auto-renewal status and activate a cancellation coupon.
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 Creat 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`.
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;
@@ -3421,6 +3404,42 @@ interface paths {
3421
3404
  patch?: never;
3422
3405
  trace?: never;
3423
3406
  };
3407
+ '/products/{product_id}/users/{user_id}/payments/{payment_id}/invoice.pdf': {
3408
+ parameters: {
3409
+ query?: never;
3410
+ header?: never;
3411
+ path: {
3412
+ /**
3413
+ * @description The ID of the product.
3414
+ * @example 1234
3415
+ */
3416
+ product_id: components['parameters']['product_id'];
3417
+ /**
3418
+ * @description The ID of the User.
3419
+ * @example 1234
3420
+ */
3421
+ user_id: components['parameters']['user_id'];
3422
+ /**
3423
+ * @description The ID of the payment.
3424
+ * @example 1234
3425
+ */
3426
+ payment_id: components['parameters']['payment_id'];
3427
+ };
3428
+ cookie?: never;
3429
+ };
3430
+ /**
3431
+ * Download invoice
3432
+ * @description Download invoice of a payment of a user. Use this endpoint to securely download the invoice of a payment belonging to a user. This is useful for implementing your own Customer Portal with download links to invoices.
3433
+ */
3434
+ get: operations['users/download-invoice'];
3435
+ put?: never;
3436
+ post?: never;
3437
+ delete?: never;
3438
+ options?: never;
3439
+ head?: never;
3440
+ patch?: never;
3441
+ trace?: never;
3442
+ };
3424
3443
  '/products/{product_id}/users/{user_id}/subscriptions.json': {
3425
3444
  parameters: {
3426
3445
  query?: never;
@@ -4165,30 +4184,6 @@ interface components {
4165
4184
  user_type: 'all' | 'new' | 'current' | 'previous' | 'customer' | 'migrated';
4166
4185
  source?: components['schemas']['Migration']['source'];
4167
4186
  };
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
4187
  /** @description Represents a link between coupons to various special entities. Example: Affiliate coupon tracking, cart abandonment recovery of a product. */
4193
4188
  CouponEntity: {
4194
4189
  id?: components['schemas']['CommonProperties']['id'];
@@ -4222,7 +4217,17 @@ interface components {
4222
4217
  redemptions?: components['schemas']['Coupon']['redemptions'];
4223
4218
  discount?: components['schemas']['Coupon']['discount'];
4224
4219
  discount_type?: components['schemas']['Coupon']['discount_type'];
4225
- discounts?: components['schemas']['CouponEnriched']['allOf']['1']['discounts'];
4220
+ /**
4221
+ * @description The discount amount for each currency
4222
+ * @example {
4223
+ * "usd": 10,
4224
+ * "eur": 9,
4225
+ * "gbp": 8
4226
+ * }
4227
+ */
4228
+ discounts?: {
4229
+ [key: string]: number;
4230
+ };
4226
4231
  has_renewals_discount?: components['schemas']['Coupon']['has_renewals_discount'];
4227
4232
  };
4228
4233
  /** @description Class Customer
@@ -5051,9 +5056,18 @@ interface components {
5051
5056
  /** @description Money-back guarantee in days. */
5052
5057
  money_back_period?: number;
5053
5058
  refund_policy?: components['schemas']['CommonEnums']['RefundPolicy'];
5059
+ /** @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.
5060
+ *
5061
+ * > This is applicable for SaaS products only. */
5062
+ is_consumptive_usage?: boolean;
5054
5063
  /** @description Renewals discount that will be applied to the chosen plan. */
5055
5064
  annual_renewals_discount?: number | null;
5056
5065
  renewals_discount_type?: components['schemas']['CommonEnums']['RenewalsDiscountType'];
5066
+ /**
5067
+ * @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.
5068
+ * @example 30
5069
+ */
5070
+ lifetime_license_proration_days?: number | null;
5057
5071
  /** @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
5072
  is_released?: boolean;
5059
5073
  /** @description A flag that controls whether the SDK should be required or not during deployment of a version. It defaults to `true`. */
@@ -5088,6 +5102,8 @@ interface components {
5088
5102
  */
5089
5103
  earnings?: number;
5090
5104
  type?: components['schemas']['CommonEnums']['ProductType'];
5105
+ /** @description The alias type of the product. For example, 'extension', 'chrome extension', 'desktop app'. */
5106
+ type_alias?: string;
5091
5107
  /** @description Determines whether the product is categorized as a static product (for example, a widget or a template). */
5092
5108
  is_static?: boolean;
5093
5109
  };
@@ -7148,100 +7164,6 @@ interface operations {
7148
7164
  404: components['responses']['404'];
7149
7165
  };
7150
7166
  };
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
7167
  'events/retrieve': {
7246
7168
  parameters: {
7247
7169
  query?: {
@@ -7570,6 +7492,7 @@ interface operations {
7570
7492
  refund_policy?: components['schemas']['Plugin']['refund_policy'];
7571
7493
  annual_renewals_discount?: components['schemas']['Plugin']['annual_renewals_discount'];
7572
7494
  renewals_discount_type?: components['schemas']['Plugin']['renewals_discount_type'];
7495
+ lifetime_license_proration_days?: components['schemas']['Plugin']['lifetime_license_proration_days'];
7573
7496
  is_pricing_visible?: components['schemas']['Plugin']['is_pricing_visible'];
7574
7497
  default_plan_id?: components['schemas']['Plugin']['default_plan_id'];
7575
7498
  /**
@@ -9283,6 +9206,8 @@ interface operations {
9283
9206
  last_name?: string;
9284
9207
  /** @description Email address of the user (only needed when activating a ghost license). */
9285
9208
  user_email?: string;
9209
+ /** @description Whether to allow license activation if the plans of the product has not been released yet. Useful for testing purpose only. */
9210
+ allow_unreleased_plan_activation?: boolean;
9286
9211
  };
9287
9212
  };
9288
9213
  };
@@ -10750,6 +10675,57 @@ interface operations {
10750
10675
  };
10751
10676
  };
10752
10677
  };
10678
+ 'products/generate-portal-login-link': {
10679
+ parameters: {
10680
+ query?: never;
10681
+ header?: never;
10682
+ path: {
10683
+ /**
10684
+ * @description The ID of the product.
10685
+ * @example 1234
10686
+ */
10687
+ product_id: components['parameters']['product_id'];
10688
+ };
10689
+ cookie?: never;
10690
+ };
10691
+ requestBody: {
10692
+ content: {
10693
+ 'application/json': {
10694
+ /**
10695
+ * Format: int64
10696
+ * @description The ID of the user. Either id or email is required.
10697
+ */
10698
+ id?: string;
10699
+ /**
10700
+ * Format: email
10701
+ * @description The email of the user. Either id or email is required.
10702
+ */
10703
+ email?: string;
10704
+ };
10705
+ };
10706
+ };
10707
+ responses: {
10708
+ /** @description Portal login link generated successfully. */
10709
+ 201: {
10710
+ headers: {
10711
+ [name: string]: unknown;
10712
+ };
10713
+ content: {
10714
+ 'application/json': {
10715
+ /** @description The generated portal session token. */
10716
+ token?: string;
10717
+ /**
10718
+ * Format: uri
10719
+ * @description The complete portal login URL with the token.
10720
+ */
10721
+ link?: string;
10722
+ };
10723
+ };
10724
+ };
10725
+ 400: components['responses']['400'];
10726
+ 404: components['responses']['404'];
10727
+ };
10728
+ };
10753
10729
  'products/retrieve-pricing-table-data': {
10754
10730
  parameters: {
10755
10731
  query?: {
@@ -11395,9 +11371,7 @@ interface operations {
11395
11371
  requestBody: {
11396
11372
  content: {
11397
11373
  'application/json': {
11398
- /** @description Logs an event that confirms the user requested that the subscription will continue to auto-renew. */
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. */
11374
+ /** @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
11375
  coupon_id?: number;
11402
11376
  };
11403
11377
  };
@@ -12336,7 +12310,7 @@ interface operations {
12336
12310
  send_verification_email?: boolean;
12337
12311
  is_marketing_allowed?: components['schemas']['User']['is_marketing_allowed'];
12338
12312
  /** @description (optional) If `true`, no emails will be sent to users nor events will be logged. */
12339
- is_migration?: string;
12313
+ is_migration?: boolean;
12340
12314
  source?: components['schemas']['Migration']['source_external_id'];
12341
12315
  };
12342
12316
  };
@@ -12683,6 +12657,52 @@ interface operations {
12683
12657
  404: components['responses']['404'];
12684
12658
  };
12685
12659
  };
12660
+ 'users/download-invoice': {
12661
+ parameters: {
12662
+ query?: {
12663
+ /**
12664
+ * @description Comma separated list of fields to return in the response. If not specified, all fields are returned.
12665
+ * @example id,name,slug
12666
+ */
12667
+ fields?: components['parameters']['fields'];
12668
+ };
12669
+ header?: never;
12670
+ path: {
12671
+ /**
12672
+ * @description The ID of the product.
12673
+ * @example 1234
12674
+ */
12675
+ product_id: components['parameters']['product_id'];
12676
+ /**
12677
+ * @description The ID of the User.
12678
+ * @example 1234
12679
+ */
12680
+ user_id: components['parameters']['user_id'];
12681
+ /**
12682
+ * @description The ID of the payment.
12683
+ * @example 1234
12684
+ */
12685
+ payment_id: components['parameters']['payment_id'];
12686
+ };
12687
+ cookie?: never;
12688
+ };
12689
+ requestBody?: never;
12690
+ responses: {
12691
+ /** @description PDF invoice */
12692
+ 200: {
12693
+ headers: {
12694
+ [name: string]: unknown;
12695
+ };
12696
+ content: {
12697
+ 'application/pdf': unknown;
12698
+ };
12699
+ };
12700
+ 400: components['responses']['400'];
12701
+ 401: components['responses']['401'];
12702
+ 402: components['responses']['402'];
12703
+ 404: components['responses']['404'];
12704
+ };
12705
+ };
12686
12706
  'users/list-subscriptions': {
12687
12707
  parameters: {
12688
12708
  query?: {
@@ -12924,6 +12944,7 @@ type UserSubscriptionFilterOptions = ApiEntitiesFilter<operations['users/list-su
12924
12944
  type UserLicenseFilterOptions = ApiEntitiesFilter<operations['users/list-licenses']['parameters']['query']>;
12925
12945
  type UserPaymentFilterOptions = ApiEntitiesFilter<operations['users/list-payments']['parameters']['query']>;
12926
12946
  type UserPluginEntity = components['schemas']['UserPluginEnriched'];
12947
+ type UserCustomerPortalResult = operations['products/generate-portal-login-link']['responses'][201]['content']['application/json'];
12927
12948
  type LicenseEntity = components['schemas']['License'];
12928
12949
  type LicenseFilterOptions = ApiEntitiesFilter<operations['licenses/list']['parameters']['query']>;
12929
12950
  type PaymentEntity = components['schemas']['Payment'];
@@ -13623,6 +13644,9 @@ declare class User extends ApiBase<UserEntity, UserFilterOptions> {
13623
13644
  retrieveLicenses(userId: FSId, filters?: UserLicenseFilterOptions, pagination?: PagingOptions): Promise<LicenseEntity[]>;
13624
13645
  retrievePayments(userId: FSId, filters?: UserPaymentFilterOptions, pagination?: PagingOptions): Promise<PaymentEntity[]>;
13625
13646
  updateBilling(userId: FSId, payload: BillingUpdatePayload): Promise<UserBillingEntity | null>;
13647
+ retrieveHostedCustomerPortal(userId: FSId): Promise<UserCustomerPortalResult | null>;
13648
+ retrieveHostedCustomerPortalByEmail(email: string): Promise<UserCustomerPortalResult | null>;
13649
+ retrieveInvoice(userId: FSId, paymentId: FSId): Promise<Blob | null>;
13626
13650
  }
13627
13651
  //#endregion
13628
13652
  //#region src/api/Payment.d.ts
@@ -14845,5 +14869,5 @@ declare class Freemius {
14845
14869
  constructor(config: FreemiusConfig);
14846
14870
  }
14847
14871
  //#endregion
14848
- 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, 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 };
14872
+ 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 };
14849
14873
  //# sourceMappingURL=index.d.ts.map