@stigg/js-client-sdk 3.47.0 → 3.49.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 +5 -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 +5 -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
|
@@ -69,6 +69,7 @@ export declare type PackageEntitlement = {
|
|
|
69
69
|
resetPeriod?: EntitlementResetPeriod | null;
|
|
70
70
|
hiddenFromWidgets?: PackageEntitlementFragment['hiddenFromWidgets'];
|
|
71
71
|
displayNameOverride?: PackageEntitlementFragment['displayNameOverride'];
|
|
72
|
+
enumValues?: string[] | null;
|
|
72
73
|
};
|
|
73
74
|
export declare type PromotionalEntitlement = {
|
|
74
75
|
usageLimit: number;
|
|
@@ -242,6 +243,7 @@ export declare type BooleanEntitlementFallback = {
|
|
|
242
243
|
hasAccess: boolean;
|
|
243
244
|
};
|
|
244
245
|
export declare type BooleanEntitlementOptions = {
|
|
246
|
+
/** @deprecated not in use anymore */
|
|
245
247
|
shouldTrack?: boolean;
|
|
246
248
|
fallback?: BooleanEntitlementFallback;
|
|
247
249
|
};
|
|
@@ -251,6 +253,7 @@ export declare type NumericEntitlementFallback = {
|
|
|
251
253
|
isUnlimited?: boolean;
|
|
252
254
|
};
|
|
253
255
|
export declare type NumericEntitlementOptions = {
|
|
256
|
+
/** @deprecated not in use anymore */
|
|
254
257
|
shouldTrack?: boolean;
|
|
255
258
|
fallback?: NumericEntitlementFallback;
|
|
256
259
|
};
|
|
@@ -265,11 +268,13 @@ export declare type EnumEntitlementFallback = {
|
|
|
265
268
|
};
|
|
266
269
|
export declare type EnumEntitlementOptions = {
|
|
267
270
|
requestedValues?: string[];
|
|
271
|
+
/** @deprecated not in use anymore */
|
|
268
272
|
shouldTrack?: boolean;
|
|
269
273
|
fallback?: EnumEntitlementFallback;
|
|
270
274
|
};
|
|
271
275
|
export declare type MeteredEntitlementOptions = {
|
|
272
276
|
requestedUsage?: number;
|
|
277
|
+
/** @deprecated not in use anymore */
|
|
273
278
|
shouldTrack?: boolean;
|
|
274
279
|
fallback?: MeteredEntitlementFallback;
|
|
275
280
|
};
|
|
@@ -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
|
@@ -69,6 +69,7 @@ export declare type PackageEntitlement = {
|
|
|
69
69
|
resetPeriod?: EntitlementResetPeriod | null;
|
|
70
70
|
hiddenFromWidgets?: PackageEntitlementFragment['hiddenFromWidgets'];
|
|
71
71
|
displayNameOverride?: PackageEntitlementFragment['displayNameOverride'];
|
|
72
|
+
enumValues?: string[] | null;
|
|
72
73
|
};
|
|
73
74
|
export declare type PromotionalEntitlement = {
|
|
74
75
|
usageLimit: number;
|
|
@@ -242,6 +243,7 @@ export declare type BooleanEntitlementFallback = {
|
|
|
242
243
|
hasAccess: boolean;
|
|
243
244
|
};
|
|
244
245
|
export declare type BooleanEntitlementOptions = {
|
|
246
|
+
/** @deprecated not in use anymore */
|
|
245
247
|
shouldTrack?: boolean;
|
|
246
248
|
fallback?: BooleanEntitlementFallback;
|
|
247
249
|
};
|
|
@@ -251,6 +253,7 @@ export declare type NumericEntitlementFallback = {
|
|
|
251
253
|
isUnlimited?: boolean;
|
|
252
254
|
};
|
|
253
255
|
export declare type NumericEntitlementOptions = {
|
|
256
|
+
/** @deprecated not in use anymore */
|
|
254
257
|
shouldTrack?: boolean;
|
|
255
258
|
fallback?: NumericEntitlementFallback;
|
|
256
259
|
};
|
|
@@ -265,11 +268,13 @@ export declare type EnumEntitlementFallback = {
|
|
|
265
268
|
};
|
|
266
269
|
export declare type EnumEntitlementOptions = {
|
|
267
270
|
requestedValues?: string[];
|
|
271
|
+
/** @deprecated not in use anymore */
|
|
268
272
|
shouldTrack?: boolean;
|
|
269
273
|
fallback?: EnumEntitlementFallback;
|
|
270
274
|
};
|
|
271
275
|
export declare type MeteredEntitlementOptions = {
|
|
272
276
|
requestedUsage?: number;
|
|
277
|
+
/** @deprecated not in use anymore */
|
|
273
278
|
shouldTrack?: boolean;
|
|
274
279
|
fallback?: MeteredEntitlementFallback;
|
|
275
280
|
};
|
|
@@ -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.49.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.488.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
|
-
}
|