@stigg/js-client-sdk 3.21.1 → 3.22.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/models.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod, BudgetConfigurationInput } from '@stigg/api-client-js/src/generated/sdk';
2
2
  export * from '@stigg/api-client-js/src/generated/sdk';
3
3
  interface Metadata {
4
4
  [key: string]: string;
@@ -123,6 +123,9 @@ export declare type Product = {
123
123
  export declare type DefaultTrialConfig = {
124
124
  duration: number;
125
125
  units: TrialPeriodUnits;
126
+ budget?: {
127
+ limit: BudgetConfigurationInput['limit'];
128
+ };
126
129
  };
127
130
  export declare type GetBooleanEntitlement = {
128
131
  featureId: string;
@@ -168,6 +171,7 @@ export declare type CheckoutAddon = {
168
171
  export declare type ApplySubscription = {
169
172
  planId: string;
170
173
  paymentMethodId?: string;
174
+ payingCustomerId?: string;
171
175
  resourceId?: string;
172
176
  addons?: CheckoutAddon[];
173
177
  startDate?: Date;
@@ -259,6 +263,7 @@ export declare type Subscription = {
259
263
  id: string;
260
264
  status: SubscriptionStatus;
261
265
  resourceId?: string;
266
+ payingCustomer?: SlimCustomer | null;
262
267
  plan: Plan;
263
268
  /** @deprecated use {@link prices} instead with {@link totalPrice} */
264
269
  price: SubscriptionPrice | null;
@@ -358,6 +363,16 @@ export declare type Customer = {
358
363
  /** @deprecated use {@link StiggClient.getActiveSubscriptions} instead with filter for {@link SubscriptionStatus.InTrial} */
359
364
  getActiveTrials(): Subscription[];
360
365
  };
366
+ export declare type SlimCustomer = {
367
+ id: string;
368
+ name?: string;
369
+ email?: string;
370
+ createdAt: Date;
371
+ updatedAt: Date;
372
+ billingId?: string;
373
+ metadata?: Metadata | null;
374
+ awsMarketplaceCustomerId?: string | null;
375
+ };
361
376
  export declare type CustomerState = Omit<Customer, 'getActiveSubscriptions' | 'getActivePromotionalEntitlements' | 'getActiveTrials'>;
362
377
  export declare type TrialedPlan = {
363
378
  productId?: string | null;
@@ -10,7 +10,7 @@ export declare type GetCheckoutStateParams = GetCheckoutState & {
10
10
  declare class SubscriptionsApi {
11
11
  private readonly client;
12
12
  constructor(client: ApolloClient<NormalizedCacheObject>);
13
- applySubscription({ customerId, planId, paymentMethodId, addons, billableFeatures, billingInformation, billingCountryCode, billingId, billingPeriod, metadata, promotionCode, resourceId, skipTrial, startDate, unitQuantity, scheduleStrategy, }: ApplySubscriptionParams): Promise<import("@apollo/client/core").FetchResult<ApplySubscriptionMutation, Record<string, any>, Record<string, any>>>;
13
+ applySubscription({ customerId, payingCustomerId, planId, paymentMethodId, addons, billableFeatures, billingInformation, billingCountryCode, billingId, billingPeriod, metadata, promotionCode, resourceId, skipTrial, startDate, unitQuantity, scheduleStrategy, }: ApplySubscriptionParams): Promise<import("@apollo/client/core").FetchResult<ApplySubscriptionMutation, Record<string, any>, Record<string, any>>>;
14
14
  checkoutState({ customerId, resourceId, planId, billingCountryCode }: GetCheckoutStateParams): Promise<import("@apollo/client/core").ApolloQueryResult<GetCheckoutStateQuery>>;
15
15
  private mapBillingInformation;
16
16
  }
@@ -1,4 +1,4 @@
1
- import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod, BudgetConfigurationInput } from '@stigg/api-client-js/src/generated/sdk';
2
2
  export * from '@stigg/api-client-js/src/generated/sdk';
3
3
  interface Metadata {
4
4
  [key: string]: string;
@@ -123,6 +123,9 @@ export declare type Product = {
123
123
  export declare type DefaultTrialConfig = {
124
124
  duration: number;
125
125
  units: TrialPeriodUnits;
126
+ budget?: {
127
+ limit: BudgetConfigurationInput['limit'];
128
+ };
126
129
  };
127
130
  export declare type GetBooleanEntitlement = {
128
131
  featureId: string;
@@ -168,6 +171,7 @@ export declare type CheckoutAddon = {
168
171
  export declare type ApplySubscription = {
169
172
  planId: string;
170
173
  paymentMethodId?: string;
174
+ payingCustomerId?: string;
171
175
  resourceId?: string;
172
176
  addons?: CheckoutAddon[];
173
177
  startDate?: Date;
@@ -259,6 +263,7 @@ export declare type Subscription = {
259
263
  id: string;
260
264
  status: SubscriptionStatus;
261
265
  resourceId?: string;
266
+ payingCustomer?: SlimCustomer | null;
262
267
  plan: Plan;
263
268
  /** @deprecated use {@link prices} instead with {@link totalPrice} */
264
269
  price: SubscriptionPrice | null;
@@ -358,6 +363,16 @@ export declare type Customer = {
358
363
  /** @deprecated use {@link StiggClient.getActiveSubscriptions} instead with filter for {@link SubscriptionStatus.InTrial} */
359
364
  getActiveTrials(): Subscription[];
360
365
  };
366
+ export declare type SlimCustomer = {
367
+ id: string;
368
+ name?: string;
369
+ email?: string;
370
+ createdAt: Date;
371
+ updatedAt: Date;
372
+ billingId?: string;
373
+ metadata?: Metadata | null;
374
+ awsMarketplaceCustomerId?: string | null;
375
+ };
361
376
  export declare type CustomerState = Omit<Customer, 'getActiveSubscriptions' | 'getActivePromotionalEntitlements' | 'getActiveTrials'>;
362
377
  export declare type TrialedPlan = {
363
378
  productId?: string | null;
@@ -1,5 +1,5 @@
1
- import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment } from '@stigg/api-client-js/src/generated/sdk';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice } from '../models';
1
+ import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment, SlimCustomerFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice, SlimCustomer } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -23,8 +23,10 @@ export declare class ModelMapper {
23
23
  private mapPrice;
24
24
  private mapPlan;
25
25
  private mapCompatibleAddons;
26
+ private mapDefaultTrialConfig;
26
27
  private mapPackageEntitlement;
27
28
  private mapPromotionalEntitlement;
29
+ mapSlimCustomer: (customer: SlimCustomerFragment) => SlimCustomer;
28
30
  mapSubscription(subscription: SubscriptionFragment): Subscription;
29
31
  private mapLatestInvoice;
30
32
  private mapDate;
@@ -1,5 +1,5 @@
1
- import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment } from '@stigg/api-client-js/src/generated/sdk';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice } from '../models';
1
+ import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment, SlimCustomerFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice, SlimCustomer } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -23,8 +23,10 @@ export declare class ModelMapper {
23
23
  private mapPrice;
24
24
  private mapPlan;
25
25
  private mapCompatibleAddons;
26
+ private mapDefaultTrialConfig;
26
27
  private mapPackageEntitlement;
27
28
  private mapPromotionalEntitlement;
29
+ mapSlimCustomer: (customer: SlimCustomerFragment) => SlimCustomer;
28
30
  mapSubscription(subscription: SubscriptionFragment): Subscription;
29
31
  private mapLatestInvoice;
30
32
  private mapDate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "3.21.1",
3
+ "version": "3.22.0",
4
4
  "description": "Stigg client-side SDK for Browser",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@apollo/client": "^3.4.17",
30
30
  "@sentry/browser": "^7.11.1",
31
- "@stigg/api-client-js": "2.85.7",
31
+ "@stigg/api-client-js": "2.100.2",
32
32
  "cross-fetch": "^3.1.6",
33
33
  "fetch-retry": "^5.0.6",
34
34
  "husky": "^7.0.4",