@stigg/js-client-sdk 3.40.0 → 3.42.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, BudgetConfigurationInput } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, SubscriptionQueryFragment, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PageInfoFragment, 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;
@@ -155,6 +155,22 @@ export declare type GetMeteredEntitlement = {
155
155
  options?: MeteredEntitlementOptions;
156
156
  resourceId?: string;
157
157
  };
158
+ export declare type PaginatedResult<T> = {
159
+ data: T[];
160
+ pageInfo: PageInfoFragment;
161
+ };
162
+ export declare type GetSubscriptionsResult = PaginatedResult<SubscriptionQueryFragment>;
163
+ export declare type GetSubscriptionsParams = {
164
+ customerId?: string;
165
+ resourceId?: string | string[];
166
+ status?: SubscriptionStatus | SubscriptionStatus[];
167
+ productId?: string | string[];
168
+ pagination?: {
169
+ limit?: number;
170
+ startingAfter?: string;
171
+ endingBefore?: string;
172
+ };
173
+ };
158
174
  export declare type GetPaywall = {
159
175
  productId?: string;
160
176
  resourceId?: string;
@@ -1,5 +1,5 @@
1
1
  import { Stigg, StiggClient } from './clients';
2
- import { ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetMeteredEntitlement, GetNumericEntitlement, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
2
+ import { ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetMeteredEntitlement, GetNumericEntitlement, GetSubscriptionsResult, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
3
3
  export declare class OfflineStigg extends Stigg {
4
4
  getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
5
5
  getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
@@ -31,5 +31,6 @@ export declare class OfflineStigg extends Stigg {
31
31
  getPaywall(): Promise<Paywall>;
32
32
  getCustomerPortal(): Promise<CustomerPortal>;
33
33
  getActiveSubscriptions(): Promise<Subscription[]>;
34
+ getSubscriptions(): Promise<GetSubscriptionsResult>;
34
35
  getCustomer(): Promise<Customer>;
35
36
  }
@@ -1,4 +1,4 @@
1
- import { GetCheckoutStateQuery, ApplySubscriptionMutation } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { GetCheckoutStateQuery, ApplySubscriptionMutation, GetSubscriptionsQuery, SubscriptionStatus } from '@stigg/api-client-js/src/generated/sdk';
2
2
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
3
3
  import { ApplySubscription, GetCheckoutState } from '../models';
4
4
  export declare type ApplySubscriptionParams = ApplySubscription & {
@@ -11,6 +11,11 @@ declare class SubscriptionsApi {
11
11
  private readonly client;
12
12
  constructor(client: ApolloClient<NormalizedCacheObject>);
13
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
+ getSubscriptions(customerId?: string, resourceId?: string | string[], status?: SubscriptionStatus | SubscriptionStatus[], productId?: string | string[], pagination?: {
15
+ limit?: number;
16
+ startingAfter?: string;
17
+ endingBefore?: string;
18
+ }): Promise<import("@apollo/client/core").ApolloQueryResult<GetSubscriptionsQuery>>;
14
19
  checkoutState({ customerId, resourceId, planId, billingCountryCode }: GetCheckoutStateParams): Promise<import("@apollo/client/core").ApolloQueryResult<GetCheckoutStateQuery>>;
15
20
  private mapBillingInformation;
16
21
  }
@@ -1,6 +1,6 @@
1
1
  import { SlimSubscriptionFragmentV2Fragment, SubscriptionInvoicePreviewFragment, UsageHistoryV2Fragment, UsageHistoryV2Input } from '@stigg/api-client-js/src/generated/sdk';
2
2
  import { ClientConfiguration } from './configuration';
3
- import { ApplySubscription, ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, EstimateSubscription, EstimateSubscriptionUpdate, FetchUsageHistory, GetActiveSubscriptions, GetBooleanEntitlement, GetCheckoutStateResults, GetCheckoutState, GetCustomerPortal, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, GetSubscription, MeteredEntitlement, NumericEntitlement, Paywall, PreviewSubscription, Subscription, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, WaitForCheckoutCompleted, PreviewNextInvoice } from './models';
3
+ import { ApplySubscription, ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, EstimateSubscription, EstimateSubscriptionUpdate, FetchUsageHistory, GetActiveSubscriptions, GetBooleanEntitlement, GetCheckoutStateResults, GetCheckoutState, GetCustomerPortal, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, GetSubscription, MeteredEntitlement, NumericEntitlement, Paywall, PreviewSubscription, Subscription, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, WaitForCheckoutCompleted, PreviewNextInvoice, GetSubscriptionsParams, GetSubscriptionsResult } from './models';
4
4
  import { EventNames, Events } from './services/eventEmitter';
5
5
  import { LoggerService } from './services/loggerService';
6
6
  export interface StiggClient {
@@ -19,6 +19,7 @@ export interface StiggClient {
19
19
  getCustomer: () => Promise<Customer>;
20
20
  getCheckoutState: (params: GetCheckoutState) => Promise<GetCheckoutStateResults>;
21
21
  applySubscription: (params: ApplySubscription) => Promise<ApplySubscriptionResults>;
22
+ getSubscriptions(params: GetSubscriptionsParams): Promise<GetSubscriptionsResult>;
22
23
  getActiveSubscriptions: (params?: GetActiveSubscriptions) => Promise<Subscription[]>;
23
24
  getActiveSubscriptionsList(params?: GetActiveSubscriptions): Promise<SlimSubscriptionFragmentV2Fragment[]>;
24
25
  getSubscription(params: GetSubscription): Promise<Subscription>;
@@ -217,6 +218,7 @@ export declare class Stigg implements StiggClient {
217
218
  * @param refreshOnComplete should refresh entitlements if subscription was found
218
219
  */
219
220
  waitForCheckoutCompleted({ timeoutMs, refreshOnComplete, }?: WaitForCheckoutCompleted): Promise<Subscription | null>;
221
+ getSubscriptions(params?: GetSubscriptionsParams): Promise<GetSubscriptionsResult>;
220
222
  getActiveSubscriptions({ resourceId }?: GetActiveSubscriptions): Promise<Subscription[]>;
221
223
  /**
222
224
  * @description Get customer's active subscriptions, for extended subscription data use {@link getSubscription}
@@ -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, BudgetConfigurationInput } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, SubscriptionQueryFragment, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PageInfoFragment, 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;
@@ -155,6 +155,22 @@ export declare type GetMeteredEntitlement = {
155
155
  options?: MeteredEntitlementOptions;
156
156
  resourceId?: string;
157
157
  };
158
+ export declare type PaginatedResult<T> = {
159
+ data: T[];
160
+ pageInfo: PageInfoFragment;
161
+ };
162
+ export declare type GetSubscriptionsResult = PaginatedResult<SubscriptionQueryFragment>;
163
+ export declare type GetSubscriptionsParams = {
164
+ customerId?: string;
165
+ resourceId?: string | string[];
166
+ status?: SubscriptionStatus | SubscriptionStatus[];
167
+ productId?: string | string[];
168
+ pagination?: {
169
+ limit?: number;
170
+ startingAfter?: string;
171
+ endingBefore?: string;
172
+ };
173
+ };
158
174
  export declare type GetPaywall = {
159
175
  productId?: string;
160
176
  resourceId?: string;
@@ -1,5 +1,5 @@
1
1
  import { Stigg, StiggClient } from './clients';
2
- import { ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetMeteredEntitlement, GetNumericEntitlement, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
2
+ import { ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetMeteredEntitlement, GetNumericEntitlement, GetSubscriptionsResult, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
3
3
  export declare class OfflineStigg extends Stigg {
4
4
  getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
5
5
  getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
@@ -31,5 +31,6 @@ export declare class OfflineStigg extends Stigg {
31
31
  getPaywall(): Promise<Paywall>;
32
32
  getCustomerPortal(): Promise<CustomerPortal>;
33
33
  getActiveSubscriptions(): Promise<Subscription[]>;
34
+ getSubscriptions(): Promise<GetSubscriptionsResult>;
34
35
  getCustomer(): Promise<Customer>;
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "3.40.0",
3
+ "version": "3.42.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.361.0",
31
+ "@stigg/api-client-js": "2.448.1",
32
32
  "cross-fetch": "^3.1.6",
33
33
  "dayjs": "^1.11.13",
34
34
  "fetch-retry": "^5.0.6",