@stigg/js-client-sdk 1.32.0 → 1.33.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.
package/dist/models.d.ts CHANGED
@@ -156,14 +156,20 @@ export declare type DefaultTrialConfig = {
156
156
  export declare type GetBooleanEntitlement = {
157
157
  featureId: string;
158
158
  options?: BooleanEntitlementOptions;
159
+ resourceId?: string;
159
160
  };
160
161
  export declare type GetNumericEntitlement = {
161
162
  featureId: string;
162
163
  options?: NumericEntitlementOptions;
164
+ resourceId?: string;
163
165
  };
164
166
  export declare type GetMeteredEntitlement = {
165
167
  featureId: string;
166
168
  options?: MeteredEntitlementOptions;
169
+ resourceId?: string;
170
+ };
171
+ export declare type GetActiveSubscriptions = {
172
+ resourceId?: string;
167
173
  };
168
174
  export declare type GetPaywall = {
169
175
  productId?: string;
@@ -1,8 +1,9 @@
1
- import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate, GetCustomerPortal } from './models';
1
+ import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate, GetCustomerPortal, GetActiveSubscriptions } from './models';
2
2
  import { ClientConfiguration } from './configuration';
3
3
  import { EventNames, Events } from './services/eventEmitter';
4
4
  export interface StiggClient {
5
5
  isCustomerLoaded: boolean;
6
+ isResourceLoaded: boolean;
6
7
  isWidgetWatermarkEnabled: boolean;
7
8
  getBooleanEntitlement: (params: GetBooleanEntitlement) => BooleanEntitlement;
8
9
  getNumericEntitlement: (params: GetNumericEntitlement) => NumericEntitlement;
@@ -10,10 +11,10 @@ export interface StiggClient {
10
11
  setCustomerId: (customerId: string, customerToken?: string | null, resourceId?: string | null) => Promise<void>;
11
12
  clearCustomer: () => void;
12
13
  setResource: (resourceId: string) => Promise<void>;
13
- clearResource: () => Promise<void>;
14
+ clearResource: () => void;
14
15
  getPaywall: (params?: GetPaywall) => Promise<Paywall>;
15
16
  getCustomer: () => Promise<Customer>;
16
- getActiveSubscriptions: () => Promise<Subscription[]>;
17
+ getActiveSubscriptions: (params?: GetActiveSubscriptions) => Promise<Subscription[]>;
17
18
  getCoupons(): Promise<Coupon[]>;
18
19
  getEntitlements: (resourceId?: string) => Promise<Entitlement[]>;
19
20
  refresh: () => Promise<void>;
@@ -32,7 +33,8 @@ export declare class Stigg implements StiggClient {
32
33
  private readonly batchedGraphClient;
33
34
  private readonly configuration;
34
35
  private readonly loggerService;
35
- private entitlementsService;
36
+ private globalEntitlementsService;
37
+ private resourceEntitlementsService;
36
38
  private readonly modelMapper;
37
39
  private readonly eventEmitter;
38
40
  private readonly initializationStateTracker;
@@ -56,6 +58,7 @@ export declare class Stigg implements StiggClient {
56
58
  waitForInitialization(): Promise<StiggClient>;
57
59
  private static initializeSdk;
58
60
  get isCustomerLoaded(): boolean;
61
+ get isResourceLoaded(): boolean;
59
62
  get isWidgetWatermarkEnabled(): boolean;
60
63
  /**
61
64
  * Add a listener to handle updates of entitlements changes
@@ -84,7 +87,7 @@ export declare class Stigg implements StiggClient {
84
87
  /**
85
88
  * Unset the customer's resource ID, usually after the customer exit a specific resource.
86
89
  */
87
- clearResource(): Promise<void>;
90
+ clearResource(): void;
88
91
  /**
89
92
  * Reload entitlements
90
93
  */
@@ -97,7 +100,7 @@ export declare class Stigg implements StiggClient {
97
100
  * @param {BooleanEntitlementOptions} options
98
101
  * @return {BooleanEntitlement} boolean entitlement
99
102
  */
100
- getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
103
+ getBooleanEntitlement({ featureId, options, resourceId }: GetBooleanEntitlement): BooleanEntitlement;
101
104
  /**
102
105
  * Get numeric entitlement of feature for a customer
103
106
  *
@@ -106,7 +109,7 @@ export declare class Stigg implements StiggClient {
106
109
  * @param {NumericEntitlementOptions} options
107
110
  * @return {NumericEntitlement} numeric entitlement
108
111
  */
109
- getNumericEntitlement({ featureId, options }: GetNumericEntitlement): NumericEntitlement;
112
+ getNumericEntitlement({ featureId, options, resourceId }: GetNumericEntitlement): NumericEntitlement;
110
113
  /**
111
114
  * Get metered entitlement of feature for a customer
112
115
  *
@@ -115,7 +118,7 @@ export declare class Stigg implements StiggClient {
115
118
  * @param {MeteredEntitlementOptions} options
116
119
  * @return {MeteredEntitlement} metered entitlement
117
120
  */
118
- getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
121
+ getMeteredEntitlement({ featureId, options, resourceId }: GetMeteredEntitlement): MeteredEntitlement;
119
122
  /**
120
123
  * Get paywall data for rendering the paywall
121
124
  * @deprecated *Optional* `productId` is now deprecated and will be changed to a *required* field soon.
@@ -169,5 +172,5 @@ export declare class Stigg implements StiggClient {
169
172
  * @param refreshOnComplete should refresh entitlements if subscription was found
170
173
  */
171
174
  waitForCheckoutCompleted({ timeoutMs, refreshOnComplete, }?: WaitForCheckoutCompleted): Promise<Subscription | null>;
172
- getActiveSubscriptions(): Promise<Subscription[]>;
175
+ getActiveSubscriptions({ resourceId }?: GetActiveSubscriptions): Promise<Subscription[]>;
173
176
  }
@@ -156,14 +156,20 @@ export declare type DefaultTrialConfig = {
156
156
  export declare type GetBooleanEntitlement = {
157
157
  featureId: string;
158
158
  options?: BooleanEntitlementOptions;
159
+ resourceId?: string;
159
160
  };
160
161
  export declare type GetNumericEntitlement = {
161
162
  featureId: string;
162
163
  options?: NumericEntitlementOptions;
164
+ resourceId?: string;
163
165
  };
164
166
  export declare type GetMeteredEntitlement = {
165
167
  featureId: string;
166
168
  options?: MeteredEntitlementOptions;
169
+ resourceId?: string;
170
+ };
171
+ export declare type GetActiveSubscriptions = {
172
+ resourceId?: string;
167
173
  };
168
174
  export declare type GetPaywall = {
169
175
  productId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "description": "Stigg client-side SDK for Browser",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",