@stigg/js-client-sdk 3.19.0 → 3.21.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,10 +1,11 @@
1
1
  import { EntitlementFeature, EntitlementResetPeriod } from '../models';
2
- import { ResetPeriodConfigurationFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { AccessDeniedReason, ResetPeriodConfigurationFragment } from '@stigg/api-client-js/src/generated/sdk';
3
3
  export interface CalculatedEntitlement {
4
4
  usageLimit?: number | null;
5
5
  hasUnlimitedUsage: boolean;
6
6
  hasSoftLimit: boolean;
7
7
  feature?: EntitlementFeature;
8
+ accessDeniedReason?: AccessDeniedReason;
8
9
  }
9
10
  export interface EntitlementUsage {
10
11
  currentUsage: number;
@@ -26,7 +26,7 @@ export declare class EntitlementsService {
26
26
  private loadEntitlementsFromRemote;
27
27
  protected storeFetchedEntitlementsInCache(entitlements: EntitlementFragment[]): void;
28
28
  private getLastEntitlementsUpdate;
29
- private getEntitlment;
29
+ private getEntitlement;
30
30
  getEntitlements(): Promise<BooleanEntitlement[]>;
31
31
  renewOutdatedCache(renewCondition: () => boolean): Promise<void>;
32
32
  renewOutdatedCacheInBackground(renewCondition: () => boolean): void;
@@ -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
  }
@@ -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
@@ -1,10 +1,11 @@
1
1
  import { EntitlementFeature, EntitlementResetPeriod } from '../models';
2
- import { ResetPeriodConfigurationFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { AccessDeniedReason, ResetPeriodConfigurationFragment } from '@stigg/api-client-js/src/generated/sdk';
3
3
  export interface CalculatedEntitlement {
4
4
  usageLimit?: number | null;
5
5
  hasUnlimitedUsage: boolean;
6
6
  hasSoftLimit: boolean;
7
7
  feature?: EntitlementFeature;
8
+ accessDeniedReason?: AccessDeniedReason;
8
9
  }
9
10
  export interface EntitlementUsage {
10
11
  currentUsage: number;
@@ -26,7 +26,7 @@ export declare class EntitlementsService {
26
26
  private loadEntitlementsFromRemote;
27
27
  protected storeFetchedEntitlementsInCache(entitlements: EntitlementFragment[]): void;
28
28
  private getLastEntitlementsUpdate;
29
- private getEntitlment;
29
+ private getEntitlement;
30
30
  getEntitlements(): Promise<BooleanEntitlement[]>;
31
31
  renewOutdatedCache(renewCondition: () => boolean): Promise<void>;
32
32
  renewOutdatedCacheInBackground(renewCondition: () => boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "3.19.0",
3
+ "version": "3.21.0",
4
4
  "description": "Stigg client-side SDK for Browser",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",