@stigg/js-client-sdk 1.30.0 → 1.31.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.
@@ -14,9 +14,9 @@ export declare class EdgeApiClient {
14
14
  customerToken?: string | null;
15
15
  }): EdgeApiClient | null;
16
16
  getPaywall(productId?: string, billingCountryCode?: string): Promise<ApolloQueryResult<GetPaywallQuery>>;
17
- getEntitlements(customerId: string): Promise<ApolloQueryResult<GetEntitlementsQuery>>;
17
+ getEntitlements(customerId: string, resourceId: string | undefined): Promise<ApolloQueryResult<GetEntitlementsQuery>>;
18
18
  getSdkConfiguration(): Promise<ApolloQueryResult<GetSdkConfigurationQuery>>;
19
- watchEntitlements(customerId: string, interval: number): ObservablePoller<GetEntitlementsQuery>;
19
+ watchEntitlements(customerId: string, interval: number, resourceId: string | undefined): ObservablePoller<GetEntitlementsQuery>;
20
20
  private get;
21
21
  }
22
22
  export {};
@@ -5,8 +5,8 @@ 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): Promise<import("@apollo/client/core").ApolloQueryResult<GetEntitlementsQuery>>;
9
- pollEntitlements(customerId: string, interval: number): import("../utils/ObservablePoller").ObservablePoller<GetEntitlementsQuery> | import("@apollo/client/core").ObservableQuery<GetEntitlementsQuery, import("@stigg/api-client-js/src/generated/sdk").Exact<{
8
+ getEntitlements(customerId: string, skipEdge?: boolean, resourceId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetEntitlementsQuery>>;
9
+ pollEntitlements(customerId: string, interval: number, resourceId?: string): import("../utils/ObservablePoller").ObservablePoller<GetEntitlementsQuery> | import("@apollo/client/core").ObservableQuery<GetEntitlementsQuery, import("@stigg/api-client-js/src/generated/sdk").Exact<{
10
10
  query: import("@stigg/api-client-js/src/generated/sdk").FetchEntitlementsQuery;
11
11
  }>>;
12
12
  reportEntitlementRequested(featureId: string, customerId: string, entitlementCheckResult: EntitlementCheckResult, resourceId?: string, requestedUsage?: number): Promise<void>;
package/dist/client.d.ts CHANGED
@@ -7,8 +7,10 @@ export interface StiggClient {
7
7
  getBooleanEntitlement: (params: GetBooleanEntitlement) => BooleanEntitlement;
8
8
  getNumericEntitlement: (params: GetNumericEntitlement) => NumericEntitlement;
9
9
  getMeteredEntitlement: (params: GetMeteredEntitlement) => MeteredEntitlement;
10
- setCustomerId: (customerId: string, customerToken?: string | null) => Promise<void>;
10
+ setCustomerId: (customerId: string, customerToken?: string | null, resourceId?: string | null) => Promise<void>;
11
11
  clearCustomer: () => void;
12
+ setResource: (resourceId: string) => Promise<void>;
13
+ clearResource: () => Promise<void>;
12
14
  getPaywall: (params?: GetPaywall) => Promise<Paywall>;
13
15
  getCustomer: () => Promise<Customer>;
14
16
  getCoupons(): Promise<Coupon[]>;
@@ -69,11 +71,19 @@ export declare class Stigg implements StiggClient {
69
71
  /**
70
72
  * Set the customer ID, usually after the customer signs in or restores a session
71
73
  */
72
- setCustomerId(customerId: string, customerToken?: string | null): Promise<void>;
74
+ setCustomerId(customerId: string, customerToken?: string | null, resourceId?: string | null): Promise<void>;
73
75
  /**
74
76
  * Clear the customer ID, usually after the customer signs out
75
77
  */
76
78
  clearCustomer(): void;
79
+ /**
80
+ * Set the customer's resource ID, usually after the customer select a specific resource.
81
+ */
82
+ setResource(resourceId: string): Promise<void>;
83
+ /**
84
+ * Unset the customer's resource ID, usually after the customer exit a specific resource.
85
+ */
86
+ clearResource(): Promise<void>;
77
87
  /**
78
88
  * Reload entitlements
79
89
  */
@@ -86,7 +96,7 @@ export declare class Stigg implements StiggClient {
86
96
  * @param {BooleanEntitlementOptions} options
87
97
  * @return {BooleanEntitlement} boolean entitlement
88
98
  */
89
- getBooleanEntitlement({ featureId, options, resourceId }: GetBooleanEntitlement): BooleanEntitlement;
99
+ getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
90
100
  /**
91
101
  * Get numeric entitlement of feature for a customer
92
102
  *
@@ -95,7 +105,7 @@ export declare class Stigg implements StiggClient {
95
105
  * @param {NumericEntitlementOptions} options
96
106
  * @return {NumericEntitlement} numeric entitlement
97
107
  */
98
- getNumericEntitlement({ featureId, options, resourceId }: GetNumericEntitlement): NumericEntitlement;
108
+ getNumericEntitlement({ featureId, options }: GetNumericEntitlement): NumericEntitlement;
99
109
  /**
100
110
  * Get metered entitlement of feature for a customer
101
111
  *
@@ -104,7 +114,7 @@ export declare class Stigg implements StiggClient {
104
114
  * @param {MeteredEntitlementOptions} options
105
115
  * @return {MeteredEntitlement} metered entitlement
106
116
  */
107
- getMeteredEntitlement({ featureId, options, resourceId }: GetMeteredEntitlement): MeteredEntitlement;
117
+ getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
108
118
  /**
109
119
  * Get paywall data for rendering the paywall
110
120
  * @deprecated *Optional* `productId` is now deprecated and will be changed to a *required* field soon.
@@ -133,10 +143,9 @@ export declare class Stigg implements StiggClient {
133
143
  /**
134
144
  * Get a list of entitlements
135
145
  *
136
- * @param {string} resourceId
137
146
  * @returns {Promise<Entitlement[]>}
138
147
  */
139
- getEntitlements(resourceId?: string): Promise<Entitlement[]>;
148
+ getEntitlements(): Promise<Entitlement[]>;
140
149
  /**
141
150
  * Estimate subscription
142
151
  * @return {Promise<SubscriptionPreview>} Preview of the subscription.
@@ -8,6 +8,7 @@ export declare type ClientConfiguration = {
8
8
  baseUri?: string;
9
9
  baseEdgeUri?: string;
10
10
  customerId?: string | null;
11
+ resourceId?: string | null;
11
12
  customerToken?: string | null;
12
13
  entitlementPollingInterval?: number;
13
14
  useEntitlementPolling?: boolean;