@freemius/sdk 0.1.0 → 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 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;
@@ -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
- discounts?: components['schemas']['CouponEnriched']['allOf']['1']['discounts'];
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 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. */
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?: string;
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'];
@@ -13623,6 +13562,8 @@ declare class User extends ApiBase<UserEntity, UserFilterOptions> {
13623
13562
  retrieveLicenses(userId: FSId, filters?: UserLicenseFilterOptions, pagination?: PagingOptions): Promise<LicenseEntity[]>;
13624
13563
  retrievePayments(userId: FSId, filters?: UserPaymentFilterOptions, pagination?: PagingOptions): Promise<PaymentEntity[]>;
13625
13564
  updateBilling(userId: FSId, payload: BillingUpdatePayload): Promise<UserBillingEntity | null>;
13565
+ retrieveHostedCustomerPortal(userId: FSId): Promise<UserCustomerPortalResult | null>;
13566
+ retrieveHostedCustomerPortalByEmail(email: string): Promise<UserCustomerPortalResult | null>;
13626
13567
  }
13627
13568
  //#endregion
13628
13569
  //#region src/api/Payment.d.ts
@@ -14845,5 +14786,5 @@ declare class Freemius {
14845
14786
  constructor(config: FreemiusConfig);
14846
14787
  }
14847
14788
  //#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 };
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 };
14849
14790
  //# sourceMappingURL=index.d.mts.map