@stigg/js-client-sdk 3.68.0 → 3.70.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.
@@ -10,6 +10,7 @@ import { EdgeApiClient } from './EdgeApiClient';
10
10
  import { UsageHistoryApi } from './UsageHistoryApi';
11
11
  import CreditsApi from './CreditsApi';
12
12
  import CheckoutApi from './CheckoutApi';
13
+ import AutomaticRechargeApi from './AutomaticRechargeApi';
13
14
  declare class ApiGateway {
14
15
  sdkConfiguration: SdkConfigurationApi;
15
16
  paywall: PaywallApi;
@@ -21,6 +22,7 @@ declare class ApiGateway {
21
22
  usageHistoryApi: UsageHistoryApi;
22
23
  credits: CreditsApi;
23
24
  checkout: CheckoutApi;
25
+ automaticRecharge: AutomaticRechargeApi;
24
26
  constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
25
27
  }
26
28
  export default ApiGateway;
@@ -0,0 +1,23 @@
1
+ import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
+ import { GetAutomaticRechargeConfigurationQuery, SaveAutomaticRechargeConfigurationMutation, GetAutoRechargeSettingsInput, SaveAutoRechargeSettingsInput } from '@stigg/api-client-js/src/generated/sdk';
3
+ /**
4
+ * API class for managing automatic recharge configurations.
5
+ * Handles GraphQL queries and mutations for automatic recharge settings.
6
+ */
7
+ declare class AutomaticRechargeApi {
8
+ private readonly client;
9
+ constructor(client: ApolloClient<NormalizedCacheObject>);
10
+ /**
11
+ * Retrieves the automatic recharge configuration for a customer and currency.
12
+ * @param input - Configuration input containing customerId, currencyId, and environmentId
13
+ * @returns Promise with the GraphQL query result containing automatic recharge settings
14
+ */
15
+ getConfiguration(input: GetAutoRechargeSettingsInput): Promise<import("@apollo/client/core").ApolloQueryResult<GetAutomaticRechargeConfigurationQuery>>;
16
+ /**
17
+ * Saves (creates or updates) the automatic recharge configuration for a customer and currency.
18
+ * @param input - Configuration input containing all automatic recharge settings
19
+ * @returns Promise with the GraphQL mutation result containing saved automatic recharge settings
20
+ */
21
+ saveConfiguration(input: SaveAutoRechargeSettingsInput): Promise<import("@apollo/client/core").FetchResult<SaveAutomaticRechargeConfigurationMutation, Record<string, any>, Record<string, any>>>;
22
+ }
23
+ export default AutomaticRechargeApi;
@@ -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, AutomaticRechargeConfiguration, GetAutomaticRechargeConfigurationInput, SaveAutomaticRechargeConfigurationInput, 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>;
@@ -43,6 +47,8 @@ export interface StiggClient {
43
47
  getCreditLedger(input?: GetCreditLedgerInput): Promise<CreditLedgerFragment[]>;
44
48
  getCreditUsage(input: GetCreditUsageInput): Promise<CreditUsageFragment>;
45
49
  createPaymentSession(input: CreatePaymentSessionInput): Promise<PaymentSessionFragment>;
50
+ getAutomaticRechargeConfiguration(input: GetAutomaticRechargeConfigurationInput): Promise<AutomaticRechargeConfiguration>;
51
+ saveAutomaticRechargeConfiguration(input: SaveAutomaticRechargeConfigurationInput): Promise<AutomaticRechargeConfiguration>;
46
52
  getShowWatermark(): boolean;
47
53
  }
48
54
  export declare class Stigg implements StiggClient {
@@ -194,10 +200,16 @@ export declare class Stigg implements StiggClient {
194
200
  fetchUsageHistory(fetchUsageHistory: FetchUsageHistory): Promise<UsageHistoryPoint[] | undefined>;
195
201
  /**
196
202
  * Get a list of entitlements
197
- *
203
+ * @deprecated Use getEntitlementsState instead.
198
204
  * @returns {Promise<Entitlement[]>}
199
205
  */
200
206
  getEntitlements(resourceId?: string): Promise<Entitlement[]>;
207
+ /**
208
+ * Get a list of entitlements alongside an access denied reason if applicable.
209
+ *
210
+ * @returns {Promise<EntitlementsState>}
211
+ */
212
+ getEntitlementsState(resourceId?: string): Promise<EntitlementsState>;
201
213
  /**
202
214
  * Estimate subscription
203
215
  * @return {Promise<SubscriptionPreview>} Preview of the subscription.
@@ -275,4 +287,16 @@ export declare class Stigg implements StiggClient {
275
287
  * @param input - the input for the payment session
276
288
  */
277
289
  createPaymentSession(input: CreatePaymentSessionInput): Promise<PaymentSessionFragment>;
290
+ /**
291
+ * Get automatic recharge configuration
292
+ * @return {Promise<AutomaticRechargeConfiguration>} the automatic recharge configuration
293
+ * @param input - the input for getting automatic recharge configuration
294
+ */
295
+ getAutomaticRechargeConfiguration(input: GetAutomaticRechargeConfigurationInput): Promise<AutomaticRechargeConfiguration>;
296
+ /**
297
+ * Save automatic recharge configuration
298
+ * @return {Promise<AutomaticRechargeConfiguration>} the saved automatic recharge configuration
299
+ * @param input - the input for saving automatic recharge configuration
300
+ */
301
+ saveAutomaticRechargeConfiguration(input: SaveAutomaticRechargeConfigurationInput): Promise<AutomaticRechargeConfiguration>;
278
302
  }