@stigg/js-client-sdk 0.22.2 → 0.23.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 -3
- package/dist/api/generated/types.d.ts +60 -868
- package/dist/api/initApolloClient.d.ts +2 -2
- package/dist/client.d.ts +56 -9
- package/dist/configuration.d.ts +5 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +99 -75
- package/dist/services/cachedEntitlement.d.ts +2 -8
- package/dist/services/entitlementDecisionService.d.ts +2 -2
- package/dist/services/entitlementsService.d.ts +10 -8
- package/dist/services/loggerService.d.ts +21 -0
- package/dist/utils/ModelMapper.d.ts +9 -7
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloClient } from '@apollo/client/core';
|
|
2
2
|
declare type ApolloClientConfiguration = {
|
|
3
|
-
|
|
3
|
+
apiKey: string;
|
|
4
4
|
baseUri: string;
|
|
5
5
|
};
|
|
6
|
-
declare const initApolloClient: ({
|
|
6
|
+
declare const initApolloClient: ({ apiKey, baseUri }: Partial<ApolloClientConfiguration>) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
|
|
7
7
|
export default initApolloClient;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Customer, Entitlement, Plan, BooleanEntitlement, NumericEntitlement, MeteredEntitlement, GetBooleanEntitlement, GetNumericEntitlement, GetMeteredEntitlement, GetPaywall } from './models';
|
|
2
2
|
import { ClientConfiguration } from './configuration';
|
|
3
3
|
export interface StiggClient {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
getBooleanEntitlement: (params: GetBooleanEntitlement) => BooleanEntitlement;
|
|
5
|
+
getNumericEntitlement: (params: GetNumericEntitlement) => NumericEntitlement;
|
|
6
|
+
getMeteredEntitlement: (params: GetMeteredEntitlement) => MeteredEntitlement;
|
|
7
|
+
setCustomerId: (customerId: string) => Promise<void>;
|
|
8
|
+
getPaywall: (params?: GetPaywall) => Promise<Plan[]>;
|
|
7
9
|
getCustomer: () => Promise<Customer>;
|
|
8
10
|
getEntitlements: () => Promise<Entitlement[]>;
|
|
9
11
|
refresh: () => Promise<void>;
|
|
@@ -12,15 +14,60 @@ export declare class Stigg implements StiggClient {
|
|
|
12
14
|
private readonly apiGateway;
|
|
13
15
|
private readonly graphClient;
|
|
14
16
|
private readonly configuration;
|
|
17
|
+
private readonly loggerService;
|
|
15
18
|
private entitlementsService;
|
|
16
19
|
private readonly modelMapper;
|
|
17
20
|
private constructor();
|
|
18
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the SDK
|
|
23
|
+
* @param {ClientConfiguration} configuration
|
|
24
|
+
* @returns {Stigg | null}
|
|
25
|
+
*/
|
|
26
|
+
static initialize(configuration: ClientConfiguration): Promise<StiggClient | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Set the customer ID, usually after the customer signs in or restores a session
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
*/
|
|
19
31
|
setCustomerId(customerId: string): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Reload entitlements
|
|
34
|
+
*/
|
|
20
35
|
refresh(): Promise<void>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Get boolean entitlement of feature for a customer
|
|
38
|
+
* @param {string} featureId
|
|
39
|
+
* @param {BooleanEntitlementOptions} options
|
|
40
|
+
* @return {BooleanEntitlement} boolean entitlement
|
|
41
|
+
*/
|
|
42
|
+
getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
|
|
43
|
+
/**
|
|
44
|
+
* Get numeric entitlement of feature for a customer
|
|
45
|
+
* @param {string} featureId
|
|
46
|
+
* @param {NumericEntitlementOptions} options
|
|
47
|
+
* @return {NumericEntitlement} numeric entitlement
|
|
48
|
+
*/
|
|
49
|
+
getNumericEntitlement({ featureId, options }: GetNumericEntitlement): NumericEntitlement;
|
|
50
|
+
/**
|
|
51
|
+
* Get metered entitlement of feature for a customer
|
|
52
|
+
* @param {string} featureId
|
|
53
|
+
* @param {MeteredEntitlementOptions} options
|
|
54
|
+
* @return {MeteredEntitlement} metered entitlement
|
|
55
|
+
*/
|
|
56
|
+
getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
|
|
57
|
+
/**
|
|
58
|
+
* Get a list of plans for rendering the paywall
|
|
59
|
+
* @returns {Promise<Plan[]>}
|
|
60
|
+
*/
|
|
61
|
+
getPaywall({ productId }?: GetPaywall): Promise<Plan[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Get a customer
|
|
64
|
+
* @returns {Promise<Customer>}
|
|
65
|
+
*/
|
|
24
66
|
getCustomer(): Promise<Customer>;
|
|
25
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Get a list of entitlements
|
|
69
|
+
* @returns {Promise<Entitlement[]>}
|
|
70
|
+
*/
|
|
71
|
+
getEntitlements(): Promise<Entitlement[]>;
|
|
72
|
+
private withErrorHandling;
|
|
26
73
|
}
|
package/dist/configuration.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { LogConfiguration, LoggerService } from './services/loggerService';
|
|
1
2
|
export declare type ClientConfiguration = {
|
|
2
|
-
|
|
3
|
+
apiKey: string;
|
|
3
4
|
baseUri?: string;
|
|
4
5
|
customerId?: string;
|
|
5
6
|
entitlementPollingInterval?: number;
|
|
7
|
+
logConfiguration?: LogConfiguration;
|
|
6
8
|
};
|
|
7
|
-
export declare function validateConfiguration(configuration: ClientConfiguration):
|
|
8
|
-
export declare function
|
|
9
|
+
export declare function validateConfiguration(configuration: ClientConfiguration, loggerService: LoggerService): boolean;
|
|
10
|
+
export declare function getConfiguration(configuration: ClientConfiguration): Required<ClientConfiguration>;
|
|
9
11
|
export declare function ensureCustomerRefIdExists({ customerId }: ClientConfiguration): string;
|