@stigg/js-client-sdk 0.20.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/CHANGELOG.md +45 -0
- package/README.md +4 -0
- package/dist/api/ApiGateway.d.ts +9 -0
- package/dist/api/CustomersApi.d.ts +8 -0
- package/dist/api/EntitlementsApi.d.ts +10 -0
- package/dist/api/PaywallApi.d.ts +8 -0
- package/dist/api/fragments/priceFragment.d.ts +1 -0
- package/dist/api/generated/types.d.ts +2598 -0
- package/dist/api/initApolloClient.d.ts +7 -0
- package/dist/client.d.ts +24 -0
- package/dist/configuration.d.ts +8 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.js.LICENSE.txt +8 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +171 -0
- package/dist/services/cacheService.d.ts +9 -0
- package/dist/services/cachedEntitlement.d.ts +24 -0
- package/dist/services/entitlementDecisionService.d.ts +9 -0
- package/dist/services/entitlementsService.d.ts +21 -0
- package/dist/services/inMemoryCacheService.d.ts +13 -0
- package/dist/utils/ModelMapper.d.ts +21 -0
- package/package.json +68 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApolloClient } from '@apollo/client/core';
|
|
2
|
+
declare type ApolloClientConfiguration = {
|
|
3
|
+
sdkKey: string;
|
|
4
|
+
baseUri: string;
|
|
5
|
+
};
|
|
6
|
+
declare const initApolloClient: ({ sdkKey, baseUri }: Partial<ApolloClientConfiguration>) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
|
|
7
|
+
export default initApolloClient;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EntitlementOptions, Customer, Entitlement, InvalidEntitlement, Plan, FallbackEntitlement } from './models';
|
|
2
|
+
import { ClientConfiguration } from './configuration';
|
|
3
|
+
export interface StiggClient {
|
|
4
|
+
getEntitlement: <T extends Entitlement>(featureId: string, options?: EntitlementOptions) => T | InvalidEntitlement | FallbackEntitlement;
|
|
5
|
+
setCustomerId: (customerId: string) => void;
|
|
6
|
+
getPlans: () => Promise<Plan[]>;
|
|
7
|
+
getCustomer: () => Promise<Customer>;
|
|
8
|
+
getEntitlements: () => Promise<Entitlement[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare class Stigg implements StiggClient {
|
|
11
|
+
private readonly apiGateway;
|
|
12
|
+
private readonly graphClient;
|
|
13
|
+
private readonly configuration;
|
|
14
|
+
private entitlementsService;
|
|
15
|
+
private readonly modelMapper;
|
|
16
|
+
private constructor();
|
|
17
|
+
static initialize(configuration: ClientConfiguration): Promise<StiggClient>;
|
|
18
|
+
setCustomerId(customerId: string): Promise<void>;
|
|
19
|
+
getEntitlement<T extends Entitlement>(featureId: string, options?: EntitlementOptions): T | InvalidEntitlement | FallbackEntitlement;
|
|
20
|
+
private handleNoEntitlementFound;
|
|
21
|
+
getPlans(): Promise<Plan[]>;
|
|
22
|
+
getCustomer(): Promise<Customer>;
|
|
23
|
+
getEntitlements(): Promise<Entitlement[] | never[]>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type ClientConfiguration = {
|
|
2
|
+
sdkKey: string;
|
|
3
|
+
baseUri?: string;
|
|
4
|
+
customerId?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function validateConfiguration(configuration: ClientConfiguration): void;
|
|
7
|
+
export declare function withDefaults(configuration: ClientConfiguration): Partial<ClientConfiguration> & ClientConfiguration;
|
|
8
|
+
export declare function ensureCustomerRefIdExists({ customerId }: ClientConfiguration): string;
|
package/dist/index.d.ts
ADDED