@stigg/js-client-sdk 3.68.0 → 3.69.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,5 +1,5 @@
1
1
  import { ApolloQueryResult } from '@apollo/client/core';
2
- import { GetActiveSubscriptionsListQuery, GetEntitlementsQuery, GetPaywallQuery, GetSdkConfigurationQuery } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { GetActiveSubscriptionsListQuery, GetEntitlementsStateQuery, GetPaywallQuery, GetSdkConfigurationQuery } from '@stigg/api-client-js/src/generated/sdk';
3
3
  declare type EdgeApiClientConfiguration = {
4
4
  apiKey: string;
5
5
  baseEdgeUri: string;
@@ -13,7 +13,7 @@ export declare class EdgeApiClient {
13
13
  customerToken?: string | null;
14
14
  }): EdgeApiClient | null;
15
15
  getPaywall(productId?: string, billingCountryCode?: string, includeHiddenPlans?: boolean): Promise<ApolloQueryResult<GetPaywallQuery>>;
16
- getEntitlements(customerId: string, resourceId: string | undefined): Promise<ApolloQueryResult<GetEntitlementsQuery>>;
16
+ getEntitlementsState(customerId: string, resourceId: string | undefined): Promise<ApolloQueryResult<GetEntitlementsStateQuery>>;
17
17
  getActiveSubscriptionsList(customerId: string, resourceId: string | string[] | undefined): Promise<ApolloQueryResult<GetActiveSubscriptionsListQuery>>;
18
18
  getSdkConfiguration(): Promise<ApolloQueryResult<GetSdkConfigurationQuery>>;
19
19
  private get;
@@ -1,10 +1,10 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
2
  import { EdgeApiClient } from './EdgeApiClient';
3
- import { GetEntitlementsQuery } from '@stigg/api-client-js/src/generated/sdk';
3
+ import { GetEntitlementsStateQuery } from '@stigg/api-client-js/src/generated/sdk';
4
4
  declare class EntitlementsApi {
5
5
  private readonly client;
6
6
  private readonly edgeApiClient;
7
7
  constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
8
- getEntitlements(customerId: string, skipEdge?: boolean, resourceId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetEntitlementsQuery>>;
8
+ getEntitlementsState(customerId: string, skipEdge?: boolean, resourceId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetEntitlementsStateQuery>>;
9
9
  }
10
10
  export default EntitlementsApi;
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CreditLedgerFragment, CreditsBalanceSummaryFragment, CreditUsageFragment, PaymentSessionFragment, 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, GetSubscriptionsParams, GetSubscriptionsResult, EnumEntitlement, GetEnumEntitlement, CreatePaymentSessionInput, GetCreditBalanceInput, GetCreditGrantsInput, GetCreditLedgerInput, GetCreditUsageInput, GetCreditGrantsResult } 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, EnumEntitlement, GetEnumEntitlement, CreatePaymentSessionInput, GetCreditBalanceInput, GetCreditGrantsInput, GetCreditLedgerInput, GetCreditUsageInput, GetCreditGrantsResult, EntitlementsState } from './models';
4
4
  import { EventNames, Events } from './services/eventEmitter';
5
5
  import { LoggerService } from './services/loggerService';
6
6
  export interface StiggClient {
@@ -26,7 +26,11 @@ export interface StiggClient {
26
26
  getActiveSubscriptionsList(params?: GetActiveSubscriptions): Promise<SlimSubscriptionFragmentV2Fragment[]>;
27
27
  getSubscription(params: GetSubscription): Promise<Subscription>;
28
28
  getCoupons(): Promise<Coupon[]>;
29
+ /**
30
+ * @deprecated Use {@link getEntitlementsState} instead
31
+ */
29
32
  getEntitlements: (resourceId?: string) => Promise<Entitlement[]>;
33
+ getEntitlementsState: (resourceId?: string) => Promise<EntitlementsState>;
30
34
  refresh: () => Promise<void>;
31
35
  waitForCheckoutCompleted(params?: WaitForCheckoutCompleted): Promise<Subscription | null>;
32
36
  waitForInitialization(): Promise<StiggClient>;
@@ -194,10 +198,16 @@ export declare class Stigg implements StiggClient {
194
198
  fetchUsageHistory(fetchUsageHistory: FetchUsageHistory): Promise<UsageHistoryPoint[] | undefined>;
195
199
  /**
196
200
  * Get a list of entitlements
197
- *
201
+ * @deprecated Use getEntitlementsState instead.
198
202
  * @returns {Promise<Entitlement[]>}
199
203
  */
200
204
  getEntitlements(resourceId?: string): Promise<Entitlement[]>;
205
+ /**
206
+ * Get a list of entitlements alongside an access denied reason if applicable.
207
+ *
208
+ * @returns {Promise<EntitlementsState>}
209
+ */
210
+ getEntitlementsState(resourceId?: string): Promise<EntitlementsState>;
201
211
  /**
202
212
  * Estimate subscription
203
213
  * @return {Promise<SubscriptionPreview>} Preview of the subscription.