@stigg/js-client-sdk 3.19.0 → 3.20.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.
@@ -1,11 +1,14 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
- import { GetCustomerPortalByRefIdQuery, GetCustomerByIdQuery, GetActiveSubscriptionsQuery, GetSubscriptionQuery, GetUsageHistoryQuery } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { GetCustomerPortalByRefIdQuery, GetCustomerByIdQuery, GetActiveSubscriptionsQuery, GetActiveSubscriptionsListQuery, GetSubscriptionQuery, GetUsageHistoryQuery } from '@stigg/api-client-js/src/generated/sdk';
3
3
  import { FetchUsageHistory } from '../models';
4
+ import { EdgeApiClient } from './EdgeApiClient';
4
5
  declare class CustomersApi {
5
6
  private readonly client;
6
- constructor(client: ApolloClient<NormalizedCacheObject>);
7
+ private readonly edgeApiClient;
8
+ constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
7
9
  getCustomer(customerId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerByIdQuery>>;
8
10
  getActiveSubscriptions(customerId: string, resourceId?: string | string[]): Promise<import("@apollo/client/core").ApolloQueryResult<GetActiveSubscriptionsQuery>>;
11
+ getActiveSubscriptionsList(customerId: string, resourceId?: string | string[]): Promise<import("@apollo/client/core").ApolloQueryResult<GetActiveSubscriptionsListQuery>>;
9
12
  getSubscription(subscriptionId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetSubscriptionQuery>>;
10
13
  getCustomerPortal(customerId: string, resourceId: string | undefined, productId: string | undefined): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerPortalByRefIdQuery>>;
11
14
  fetchUsageHistory({ customerId, resourceId, endDate, startDate, featureId }: FetchUsageHistory): Promise<import("@apollo/client/core").ApolloQueryResult<GetUsageHistoryQuery>>;
@@ -1,5 +1,5 @@
1
1
  import { ApolloQueryResult } from '@apollo/client/core';
2
- import { GetEntitlementsQuery, GetPaywallQuery, GetSdkConfigurationQuery } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { GetActiveSubscriptionsListQuery, GetEntitlementsQuery, GetPaywallQuery, GetSdkConfigurationQuery } from '@stigg/api-client-js/src/generated/sdk';
3
3
  declare type EdgeApiClientConfiguration = {
4
4
  apiKey: string;
5
5
  baseEdgeUri: string;
@@ -14,6 +14,7 @@ export declare class EdgeApiClient {
14
14
  }): EdgeApiClient | null;
15
15
  getPaywall(productId?: string, billingCountryCode?: string, includeHiddenPlans?: boolean): Promise<ApolloQueryResult<GetPaywallQuery>>;
16
16
  getEntitlements(customerId: string, resourceId: string | undefined): Promise<ApolloQueryResult<GetEntitlementsQuery>>;
17
+ getActiveSubscriptionsList(customerId: string, resourceId: string | string[] | undefined): Promise<ApolloQueryResult<GetActiveSubscriptionsListQuery>>;
17
18
  getSdkConfiguration(): Promise<ApolloQueryResult<GetSdkConfigurationQuery>>;
18
19
  private get;
19
20
  }
package/dist/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { SlimSubscriptionFragmentV2Fragment } from '@stigg/api-client-js/src/generated/sdk';
1
2
  import { ClientConfiguration } from './configuration';
2
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 } from './models';
3
4
  import { EventNames, Events } from './services/eventEmitter';
@@ -18,6 +19,7 @@ export interface StiggClient {
18
19
  getCheckoutState: (params: GetCheckoutState) => Promise<GetCheckoutStateResults>;
19
20
  applySubscription: (params: ApplySubscription) => Promise<ApplySubscriptionResults>;
20
21
  getActiveSubscriptions: (params?: GetActiveSubscriptions) => Promise<Subscription[]>;
22
+ getActiveSubscriptionsList(params?: GetActiveSubscriptions): Promise<SlimSubscriptionFragmentV2Fragment[]>;
21
23
  getSubscription(params: GetSubscription): Promise<Subscription>;
22
24
  getCoupons(): Promise<Coupon[]>;
23
25
  getEntitlements: (resourceId?: string) => Promise<Entitlement[]>;
@@ -203,6 +205,12 @@ export declare class Stigg implements StiggClient {
203
205
  */
204
206
  waitForCheckoutCompleted({ timeoutMs, refreshOnComplete, }?: WaitForCheckoutCompleted): Promise<Subscription | null>;
205
207
  getActiveSubscriptions({ resourceId }?: GetActiveSubscriptions): Promise<Subscription[]>;
208
+ /**
209
+ * @description Get customer's active subscriptions, for extended subscription data use {@link getSubscription}
210
+ * @return {Promise<SlimSubscriptionFragmentV2Fragment[]>} List of active subscriptions
211
+ * @param resourceId - optional resource id, if not provided global resources will be fetched.
212
+ */
213
+ getActiveSubscriptionsList({ resourceId }?: GetActiveSubscriptions): Promise<SlimSubscriptionFragmentV2Fragment[]>;
206
214
  /**
207
215
  * Get subscription
208
216
  * @return {Promise<Subscription>} the subscription data