@stigg/js-client-sdk 3.46.0 → 3.48.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/api/EntitlementsApi.d.ts +1 -2
- package/dist/api/initApolloClient.d.ts +0 -1
- package/dist/client.d.ts +0 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +4 -0
- package/dist/services/entitlementsService.d.ts +3 -5
- package/dist/src/api/EntitlementsApi.d.ts +1 -2
- package/dist/src/api/initApolloClient.d.ts +0 -1
- package/dist/src/client.d.ts +0 -1
- package/dist/src/models.d.ts +4 -0
- package/dist/src/services/entitlementsService.d.ts +3 -5
- package/dist/src/utils/ModelMapper.d.ts +2 -8
- package/dist/utils/ModelMapper.d.ts +2 -8
- package/package.json +2 -2
- package/dist/services/entitlementCheckReportingService.d.ts +0 -11
- package/dist/src/services/entitlementCheckReportingService.d.ts +0 -11
package/dist/models.d.ts
CHANGED
|
@@ -242,6 +242,7 @@ export declare type BooleanEntitlementFallback = {
|
|
|
242
242
|
hasAccess: boolean;
|
|
243
243
|
};
|
|
244
244
|
export declare type BooleanEntitlementOptions = {
|
|
245
|
+
/** @deprecated not in use anymore */
|
|
245
246
|
shouldTrack?: boolean;
|
|
246
247
|
fallback?: BooleanEntitlementFallback;
|
|
247
248
|
};
|
|
@@ -251,6 +252,7 @@ export declare type NumericEntitlementFallback = {
|
|
|
251
252
|
isUnlimited?: boolean;
|
|
252
253
|
};
|
|
253
254
|
export declare type NumericEntitlementOptions = {
|
|
255
|
+
/** @deprecated not in use anymore */
|
|
254
256
|
shouldTrack?: boolean;
|
|
255
257
|
fallback?: NumericEntitlementFallback;
|
|
256
258
|
};
|
|
@@ -265,11 +267,13 @@ export declare type EnumEntitlementFallback = {
|
|
|
265
267
|
};
|
|
266
268
|
export declare type EnumEntitlementOptions = {
|
|
267
269
|
requestedValues?: string[];
|
|
270
|
+
/** @deprecated not in use anymore */
|
|
268
271
|
shouldTrack?: boolean;
|
|
269
272
|
fallback?: EnumEntitlementFallback;
|
|
270
273
|
};
|
|
271
274
|
export declare type MeteredEntitlementOptions = {
|
|
272
275
|
requestedUsage?: number;
|
|
276
|
+
/** @deprecated not in use anymore */
|
|
273
277
|
shouldTrack?: boolean;
|
|
274
278
|
fallback?: MeteredEntitlementFallback;
|
|
275
279
|
};
|
|
@@ -14,16 +14,14 @@ export declare class EntitlementsService {
|
|
|
14
14
|
private readonly entitlementsApi;
|
|
15
15
|
private readonly modelMapper;
|
|
16
16
|
private loadingEntitlements;
|
|
17
|
-
|
|
18
|
-
constructor(customerId: string, resourceId: string | undefined, cacheService: CacheService, client: ApolloClient<NormalizedCacheObject>, batchedGraphClient: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null, loggerService: LoggerService, onEntitlementsUpdated: (cachedEntitlements: Map<string, CachedEntitlement>) => void);
|
|
17
|
+
constructor(customerId: string, resourceId: string | undefined, cacheService: CacheService, client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null, loggerService: LoggerService, onEntitlementsUpdated: (cachedEntitlements: Map<string, CachedEntitlement>) => void);
|
|
19
18
|
refresh(): Promise<void>;
|
|
20
19
|
get isInitialized(): boolean;
|
|
21
|
-
getBooleanEntitlement(featureId: string, fallbackEntitlement: BooleanEntitlement,
|
|
22
|
-
getNumericEntitlement(featureId: string, fallbackEntitlement: NumericEntitlement,
|
|
20
|
+
getBooleanEntitlement(featureId: string, fallbackEntitlement: BooleanEntitlement, _options?: BooleanEntitlementOptions): BooleanEntitlement;
|
|
21
|
+
getNumericEntitlement(featureId: string, fallbackEntitlement: NumericEntitlement, _options?: NumericEntitlementOptions): NumericEntitlement;
|
|
23
22
|
getMeteredEntitlement(featureId: string, fallbackEntitlement: MeteredEntitlement, options?: MeteredEntitlementOptions): MeteredEntitlement;
|
|
24
23
|
private handleUsagePeriodOver;
|
|
25
24
|
getEnumEntitlement(featureId: string, fallbackEntitlement: EnumEntitlement, options?: EnumEntitlementOptions): EnumEntitlement;
|
|
26
|
-
private tryTrackEntitlementCheck;
|
|
27
25
|
loadEntitlements(skipEdge?: boolean): Promise<void>;
|
|
28
26
|
private loadEntitlementsFromRemote;
|
|
29
27
|
protected storeFetchedEntitlementsInCache(entitlements: EntitlementFragment[]): void;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
|
|
2
2
|
import { EdgeApiClient } from './EdgeApiClient';
|
|
3
|
-
import { GetEntitlementsQuery
|
|
3
|
+
import { GetEntitlementsQuery } 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
8
|
getEntitlements(customerId: string, skipEdge?: boolean, resourceId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetEntitlementsQuery>>;
|
|
9
|
-
reportEntitlementRequested(featureId: string, customerId: string, entitlementCheckResult: EntitlementCheckResult, resourceId?: string, requestedUsage?: number, requestedValues?: string[]): Promise<void>;
|
|
10
9
|
}
|
|
11
10
|
export default EntitlementsApi;
|
|
@@ -8,5 +8,4 @@ declare type ApolloClientConfiguration = {
|
|
|
8
8
|
clientVersion?: string;
|
|
9
9
|
};
|
|
10
10
|
declare const initApolloClient: (config: Partial<ApolloClientConfiguration>) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
|
|
11
|
-
export declare const initBatchedApolloClient: (config: ApolloClientConfiguration) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
|
|
12
11
|
export default initApolloClient;
|
package/dist/src/client.d.ts
CHANGED
|
@@ -42,7 +42,6 @@ export declare class Stigg implements StiggClient {
|
|
|
42
42
|
private readonly apiGateway;
|
|
43
43
|
private readonly edgeApiClient;
|
|
44
44
|
private readonly graphClient;
|
|
45
|
-
private readonly batchedGraphClient;
|
|
46
45
|
protected readonly configuration: Required<ClientConfiguration>;
|
|
47
46
|
private readonly loggerService;
|
|
48
47
|
private globalEntitlementsService;
|
package/dist/src/models.d.ts
CHANGED
|
@@ -242,6 +242,7 @@ export declare type BooleanEntitlementFallback = {
|
|
|
242
242
|
hasAccess: boolean;
|
|
243
243
|
};
|
|
244
244
|
export declare type BooleanEntitlementOptions = {
|
|
245
|
+
/** @deprecated not in use anymore */
|
|
245
246
|
shouldTrack?: boolean;
|
|
246
247
|
fallback?: BooleanEntitlementFallback;
|
|
247
248
|
};
|
|
@@ -251,6 +252,7 @@ export declare type NumericEntitlementFallback = {
|
|
|
251
252
|
isUnlimited?: boolean;
|
|
252
253
|
};
|
|
253
254
|
export declare type NumericEntitlementOptions = {
|
|
255
|
+
/** @deprecated not in use anymore */
|
|
254
256
|
shouldTrack?: boolean;
|
|
255
257
|
fallback?: NumericEntitlementFallback;
|
|
256
258
|
};
|
|
@@ -265,11 +267,13 @@ export declare type EnumEntitlementFallback = {
|
|
|
265
267
|
};
|
|
266
268
|
export declare type EnumEntitlementOptions = {
|
|
267
269
|
requestedValues?: string[];
|
|
270
|
+
/** @deprecated not in use anymore */
|
|
268
271
|
shouldTrack?: boolean;
|
|
269
272
|
fallback?: EnumEntitlementFallback;
|
|
270
273
|
};
|
|
271
274
|
export declare type MeteredEntitlementOptions = {
|
|
272
275
|
requestedUsage?: number;
|
|
276
|
+
/** @deprecated not in use anymore */
|
|
273
277
|
shouldTrack?: boolean;
|
|
274
278
|
fallback?: MeteredEntitlementFallback;
|
|
275
279
|
};
|
|
@@ -14,16 +14,14 @@ export declare class EntitlementsService {
|
|
|
14
14
|
private readonly entitlementsApi;
|
|
15
15
|
private readonly modelMapper;
|
|
16
16
|
private loadingEntitlements;
|
|
17
|
-
|
|
18
|
-
constructor(customerId: string, resourceId: string | undefined, cacheService: CacheService, client: ApolloClient<NormalizedCacheObject>, batchedGraphClient: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null, loggerService: LoggerService, onEntitlementsUpdated: (cachedEntitlements: Map<string, CachedEntitlement>) => void);
|
|
17
|
+
constructor(customerId: string, resourceId: string | undefined, cacheService: CacheService, client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null, loggerService: LoggerService, onEntitlementsUpdated: (cachedEntitlements: Map<string, CachedEntitlement>) => void);
|
|
19
18
|
refresh(): Promise<void>;
|
|
20
19
|
get isInitialized(): boolean;
|
|
21
|
-
getBooleanEntitlement(featureId: string, fallbackEntitlement: BooleanEntitlement,
|
|
22
|
-
getNumericEntitlement(featureId: string, fallbackEntitlement: NumericEntitlement,
|
|
20
|
+
getBooleanEntitlement(featureId: string, fallbackEntitlement: BooleanEntitlement, _options?: BooleanEntitlementOptions): BooleanEntitlement;
|
|
21
|
+
getNumericEntitlement(featureId: string, fallbackEntitlement: NumericEntitlement, _options?: NumericEntitlementOptions): NumericEntitlement;
|
|
23
22
|
getMeteredEntitlement(featureId: string, fallbackEntitlement: MeteredEntitlement, options?: MeteredEntitlementOptions): MeteredEntitlement;
|
|
24
23
|
private handleUsagePeriodOver;
|
|
25
24
|
getEnumEntitlement(featureId: string, fallbackEntitlement: EnumEntitlement, options?: EnumEntitlementOptions): EnumEntitlement;
|
|
26
|
-
private tryTrackEntitlementCheck;
|
|
27
25
|
loadEntitlements(skipEdge?: boolean): Promise<void>;
|
|
28
26
|
private loadEntitlementsFromRemote;
|
|
29
27
|
protected storeFetchedEntitlementsInCache(entitlements: EntitlementFragment[]): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment,
|
|
2
|
-
import { BooleanEntitlement,
|
|
1
|
+
import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment, SlimCustomerFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
import { BooleanEntitlement, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, EnumEntitlement, MeteredEntitlement, Money, NumericEntitlement, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice, SlimCustomer, SubscriptionPreviewCredits } from '../models';
|
|
3
3
|
import CachedEntitlement from '../services/cachedEntitlement';
|
|
4
4
|
import { Decision } from '../services/entitlementDecisionService';
|
|
5
5
|
export declare class ModelMapper {
|
|
@@ -32,12 +32,6 @@ export declare class ModelMapper {
|
|
|
32
32
|
private mapLatestInvoice;
|
|
33
33
|
private mapDate;
|
|
34
34
|
private mapAddon;
|
|
35
|
-
private getResetPeriodData;
|
|
36
|
-
mapFallbackBooleanEntitlementResult(entitlement: BooleanEntitlementFallback, decision: Decision): EntitlementCheckResult;
|
|
37
|
-
mapFallbackNumericEntitlementResult(entitlement: NumericEntitlementFallback, decision: Decision): EntitlementCheckResult;
|
|
38
|
-
mapEntitlementResult(decision: Decision, entitlement?: CachedEntitlement, requestedUsage?: number, requestedValues?: string[]): EntitlementCheckResult;
|
|
39
|
-
mapFallbackMeteredEntitlementResult(entitlement: MeteredEntitlementFallback, decision: Decision, requestedUsage?: number): EntitlementCheckResult;
|
|
40
|
-
mapFallbackEnumEntitlementResult(entitlement: EnumEntitlementFallback, decision: Decision, requestedValues?: string[]): EntitlementCheckResult;
|
|
41
35
|
mapTaxFields(fragment: SubscriptionPreviewFragment | SubscriptionPreviewFragment['subscription'] | SubscriptionPreviewInvoiceFragment | ImmediateSubscriptionPreviewInvoiceFragment): Pick<SubscriptionPreview, 'tax' | 'taxDetails'>;
|
|
42
36
|
mapSubscriptionPreview(fragment: SubscriptionPreviewFragment): SubscriptionPreview;
|
|
43
37
|
mapCredits(fragment: NonNullable<SubscriptionPreviewFragment['credits']>): SubscriptionPreviewCredits;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment,
|
|
2
|
-
import { BooleanEntitlement,
|
|
1
|
+
import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment, SlimCustomerFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
import { BooleanEntitlement, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, EnumEntitlement, MeteredEntitlement, Money, NumericEntitlement, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice, SlimCustomer, SubscriptionPreviewCredits } from '../models';
|
|
3
3
|
import CachedEntitlement from '../services/cachedEntitlement';
|
|
4
4
|
import { Decision } from '../services/entitlementDecisionService';
|
|
5
5
|
export declare class ModelMapper {
|
|
@@ -32,12 +32,6 @@ export declare class ModelMapper {
|
|
|
32
32
|
private mapLatestInvoice;
|
|
33
33
|
private mapDate;
|
|
34
34
|
private mapAddon;
|
|
35
|
-
private getResetPeriodData;
|
|
36
|
-
mapFallbackBooleanEntitlementResult(entitlement: BooleanEntitlementFallback, decision: Decision): EntitlementCheckResult;
|
|
37
|
-
mapFallbackNumericEntitlementResult(entitlement: NumericEntitlementFallback, decision: Decision): EntitlementCheckResult;
|
|
38
|
-
mapEntitlementResult(decision: Decision, entitlement?: CachedEntitlement, requestedUsage?: number, requestedValues?: string[]): EntitlementCheckResult;
|
|
39
|
-
mapFallbackMeteredEntitlementResult(entitlement: MeteredEntitlementFallback, decision: Decision, requestedUsage?: number): EntitlementCheckResult;
|
|
40
|
-
mapFallbackEnumEntitlementResult(entitlement: EnumEntitlementFallback, decision: Decision, requestedValues?: string[]): EntitlementCheckResult;
|
|
41
35
|
mapTaxFields(fragment: SubscriptionPreviewFragment | SubscriptionPreviewFragment['subscription'] | SubscriptionPreviewInvoiceFragment | ImmediateSubscriptionPreviewInvoiceFragment): Pick<SubscriptionPreview, 'tax' | 'taxDetails'>;
|
|
42
36
|
mapSubscriptionPreview(fragment: SubscriptionPreviewFragment): SubscriptionPreview;
|
|
43
37
|
mapCredits(fragment: NonNullable<SubscriptionPreviewFragment['credits']>): SubscriptionPreviewCredits;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigg/js-client-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.48.0",
|
|
4
4
|
"description": "Stigg client-side SDK for Browser",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@apollo/client": "^3.4.17",
|
|
30
30
|
"@sentry/browser": "^7.11.1",
|
|
31
|
-
"@stigg/api-client-js": "2.
|
|
31
|
+
"@stigg/api-client-js": "2.479.0",
|
|
32
32
|
"cross-fetch": "^3.1.6",
|
|
33
33
|
"dayjs": "^1.11.13",
|
|
34
34
|
"fetch-retry": "^5.0.6",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import EntitlementsApi from '../api/EntitlementsApi';
|
|
2
|
-
import { LoggerService } from './loggerService';
|
|
3
|
-
import { EntitlementCheckResult } from '@stigg/api-client-js/src/generated/sdk';
|
|
4
|
-
export declare class EntitlementCheckReportingService {
|
|
5
|
-
private readonly entitlementsApi;
|
|
6
|
-
private readonly customerId;
|
|
7
|
-
private readonly loggerService;
|
|
8
|
-
private readonly resourceId?;
|
|
9
|
-
constructor(entitlementsApi: EntitlementsApi, customerId: string, loggerService: LoggerService, resourceId?: string | undefined);
|
|
10
|
-
reportEntitlementCheckRequested(featureId: string, entitlement: EntitlementCheckResult, requestedUsage?: number, requestedValues?: string[]): void;
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import EntitlementsApi from '../api/EntitlementsApi';
|
|
2
|
-
import { LoggerService } from './loggerService';
|
|
3
|
-
import { EntitlementCheckResult } from '@stigg/api-client-js/src/generated/sdk';
|
|
4
|
-
export declare class EntitlementCheckReportingService {
|
|
5
|
-
private readonly entitlementsApi;
|
|
6
|
-
private readonly customerId;
|
|
7
|
-
private readonly loggerService;
|
|
8
|
-
private readonly resourceId?;
|
|
9
|
-
constructor(entitlementsApi: EntitlementsApi, customerId: string, loggerService: LoggerService, resourceId?: string | undefined);
|
|
10
|
-
reportEntitlementCheckRequested(featureId: string, entitlement: EntitlementCheckResult, requestedUsage?: number, requestedValues?: string[]): void;
|
|
11
|
-
}
|