@stigg/js-client-sdk 3.33.0 → 3.35.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/ApiGateway.d.ts +2 -0
- package/dist/api/UsageHistoryApi.d.ts +7 -0
- package/dist/client.d.ts +9 -3
- package/dist/clients.d.ts +2 -0
- package/dist/configuration.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +31 -3
- package/dist/index.js.map +1 -1
- package/dist/offlineClient.d.ts +34 -0
- package/dist/src/api/ApiGateway.d.ts +2 -0
- package/dist/src/api/UsageHistoryApi.d.ts +7 -0
- package/dist/src/client.d.ts +9 -3
- package/dist/src/clients.d.ts +2 -0
- package/dist/src/configuration.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/offlineClient.d.ts +34 -0
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Stigg, StiggClient } from './clients';
|
|
2
|
+
import { ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetMeteredEntitlement, GetNumericEntitlement, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
|
|
3
|
+
export declare class OfflineStigg extends Stigg {
|
|
4
|
+
getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
|
|
5
|
+
getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
|
|
6
|
+
getNumericEntitlement({ featureId, options }: GetNumericEntitlement): NumericEntitlement;
|
|
7
|
+
getEntitlements(): Promise<Entitlement[]>;
|
|
8
|
+
addListener(): void;
|
|
9
|
+
clearCustomer(): void;
|
|
10
|
+
clearResource(): void;
|
|
11
|
+
getActiveSubscriptionsList(): Promise<SlimSubscriptionFragmentV2Fragment[]>;
|
|
12
|
+
getCoupons(): Promise<Coupon[]>;
|
|
13
|
+
getSubscription(): Promise<Subscription>;
|
|
14
|
+
get isCustomerLoaded(): boolean;
|
|
15
|
+
get isResourceLoaded(): boolean;
|
|
16
|
+
get isWidgetWatermarkEnabled(): boolean;
|
|
17
|
+
removeListener(): void;
|
|
18
|
+
waitForInitialization(): Promise<StiggClient>;
|
|
19
|
+
setResource(): Promise<void>;
|
|
20
|
+
getCheckoutState(): Promise<GetCheckoutStateResults>;
|
|
21
|
+
applySubscription(): Promise<ApplySubscriptionResults>;
|
|
22
|
+
estimateSubscription(): Promise<SubscriptionPreview>;
|
|
23
|
+
previewSubscription(): Promise<SubscriptionPreviewV2>;
|
|
24
|
+
estimateSubscriptionUpdate(): Promise<SubscriptionPreview>;
|
|
25
|
+
waitForCheckoutCompleted(): Promise<Subscription | null>;
|
|
26
|
+
refresh(): Promise<void>;
|
|
27
|
+
fetchUsageHistory(): Promise<UsageHistoryPoint[] | undefined>;
|
|
28
|
+
getUsageHistoryV2(): Promise<UsageHistoryV2Fragment>;
|
|
29
|
+
setCustomerId(): Promise<void>;
|
|
30
|
+
getPaywall(): Promise<Paywall>;
|
|
31
|
+
getCustomerPortal(): Promise<CustomerPortal>;
|
|
32
|
+
getActiveSubscriptions(): Promise<Subscription[]>;
|
|
33
|
+
getCustomer(): Promise<Customer>;
|
|
34
|
+
}
|
|
@@ -7,6 +7,7 @@ import SubscriptionsApi from './SubscriptionsApi';
|
|
|
7
7
|
import SubscriptionEstimationsApi from './SubscriptionEstimationsApi';
|
|
8
8
|
import MockPaywallApi from './MockPaywallApi';
|
|
9
9
|
import { EdgeApiClient } from './EdgeApiClient';
|
|
10
|
+
import { UsageHistoryApi } from './UsageHistoryApi';
|
|
10
11
|
declare class ApiGateway {
|
|
11
12
|
sdkConfiguration: SdkConfigurationApi;
|
|
12
13
|
paywall: PaywallApi;
|
|
@@ -15,6 +16,7 @@ declare class ApiGateway {
|
|
|
15
16
|
customers: CustomersApi;
|
|
16
17
|
coupons: CouponsApi;
|
|
17
18
|
subscriptionEstimations: SubscriptionEstimationsApi;
|
|
19
|
+
usageHistoryApi: UsageHistoryApi;
|
|
18
20
|
constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
|
|
19
21
|
}
|
|
20
22
|
export default ApiGateway;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UsageHistoryV2Input, GetUsageHistoryV2Query } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
|
|
3
|
+
export declare class UsageHistoryApi {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: ApolloClient<NormalizedCacheObject>);
|
|
6
|
+
getUsageHistoryV2(input: UsageHistoryV2Input): Promise<import("@apollo/client/core").ApolloQueryResult<GetUsageHistoryV2Query>>;
|
|
7
|
+
}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { SlimSubscriptionFragmentV2Fragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
1
|
+
import { SlimSubscriptionFragmentV2Fragment, UsageHistoryV2Fragment, UsageHistoryV2Input } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
2
|
import { ClientConfiguration } from './configuration';
|
|
3
3
|
import { ApplySubscription, ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, EstimateSubscription, EstimateSubscriptionUpdate, FetchUsageHistory, GetActiveSubscriptions, GetBooleanEntitlement, GetCheckoutStateResults, GetCheckoutState, GetCustomerPortal, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, GetSubscription, MeteredEntitlement, NumericEntitlement, Paywall, PreviewSubscription, Subscription, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, WaitForCheckoutCompleted } from './models';
|
|
4
4
|
import { EventNames, Events } from './services/eventEmitter';
|
|
5
|
+
import { LoggerService } from './services/loggerService';
|
|
5
6
|
export interface StiggClient {
|
|
6
7
|
isCustomerLoaded: boolean;
|
|
7
8
|
isResourceLoaded: boolean;
|
|
@@ -32,13 +33,14 @@ export interface StiggClient {
|
|
|
32
33
|
estimateSubscription(estimateSubscription: EstimateSubscription): Promise<SubscriptionPreview>;
|
|
33
34
|
estimateSubscriptionUpdate(estimateSubscriptionUpdate: EstimateSubscriptionUpdate): Promise<SubscriptionPreview>;
|
|
34
35
|
previewSubscription(previewSubscription: PreviewSubscription): Promise<SubscriptionPreviewV2>;
|
|
36
|
+
getUsageHistoryV2(input: UsageHistoryV2Input): Promise<UsageHistoryV2Fragment>;
|
|
35
37
|
}
|
|
36
38
|
export declare class Stigg implements StiggClient {
|
|
37
39
|
private readonly apiGateway;
|
|
38
40
|
private readonly edgeApiClient;
|
|
39
41
|
private readonly graphClient;
|
|
40
42
|
private readonly batchedGraphClient;
|
|
41
|
-
|
|
43
|
+
protected readonly configuration: Required<ClientConfiguration>;
|
|
42
44
|
private readonly loggerService;
|
|
43
45
|
private globalEntitlementsService;
|
|
44
46
|
private resourceEntitlementsService;
|
|
@@ -46,7 +48,7 @@ export declare class Stigg implements StiggClient {
|
|
|
46
48
|
private readonly eventEmitter;
|
|
47
49
|
private readonly initializationStateTracker;
|
|
48
50
|
private showWidgetsWatermark;
|
|
49
|
-
|
|
51
|
+
protected constructor(configuration: Required<ClientConfiguration>, loggerService: LoggerService);
|
|
50
52
|
/**
|
|
51
53
|
* Creates an instance of Stigg client.
|
|
52
54
|
*
|
|
@@ -194,6 +196,10 @@ export declare class Stigg implements StiggClient {
|
|
|
194
196
|
* @param {PreviewSubscription} previewSubscription
|
|
195
197
|
*/
|
|
196
198
|
previewSubscription(previewSubscription: PreviewSubscription): Promise<SubscriptionPreviewV2>;
|
|
199
|
+
/**
|
|
200
|
+
* Get customer usage history of a feature.
|
|
201
|
+
*/
|
|
202
|
+
getUsageHistoryV2(input: UsageHistoryV2Input): Promise<UsageHistoryV2Fragment>;
|
|
197
203
|
/**
|
|
198
204
|
* Waits for a subscription to be activated after a completed checkout.
|
|
199
205
|
* This method should be called on page load after the customer is redirected to the success URL.
|
|
@@ -21,6 +21,7 @@ export declare type ClientConfiguration = {
|
|
|
21
21
|
entitlementsFallback?: EntitlementsFallback;
|
|
22
22
|
clientName?: string;
|
|
23
23
|
clientVersion?: string;
|
|
24
|
+
offline?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export declare function validateConfiguration(configuration: ClientConfiguration, loggerService: LoggerService): void;
|
|
26
27
|
export declare function getConfiguration(configuration: ClientConfiguration): Required<ClientConfiguration>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { ClientConfiguration } from './configuration';
|
|
|
2
2
|
export { StiggClient } from './client';
|
|
3
3
|
export { LogLevel, LogConfiguration, Logger } from './services/loggerService';
|
|
4
4
|
export * from './models';
|
|
5
|
+
export { OfflineStigg } from './offlineClient';
|
|
5
6
|
export { Stigg as default } from './client';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Stigg, StiggClient } from './clients';
|
|
2
|
+
import { ApplySubscriptionResults, BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetMeteredEntitlement, GetNumericEntitlement, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
|
|
3
|
+
export declare class OfflineStigg extends Stigg {
|
|
4
|
+
getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
|
|
5
|
+
getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
|
|
6
|
+
getNumericEntitlement({ featureId, options }: GetNumericEntitlement): NumericEntitlement;
|
|
7
|
+
getEntitlements(): Promise<Entitlement[]>;
|
|
8
|
+
addListener(): void;
|
|
9
|
+
clearCustomer(): void;
|
|
10
|
+
clearResource(): void;
|
|
11
|
+
getActiveSubscriptionsList(): Promise<SlimSubscriptionFragmentV2Fragment[]>;
|
|
12
|
+
getCoupons(): Promise<Coupon[]>;
|
|
13
|
+
getSubscription(): Promise<Subscription>;
|
|
14
|
+
get isCustomerLoaded(): boolean;
|
|
15
|
+
get isResourceLoaded(): boolean;
|
|
16
|
+
get isWidgetWatermarkEnabled(): boolean;
|
|
17
|
+
removeListener(): void;
|
|
18
|
+
waitForInitialization(): Promise<StiggClient>;
|
|
19
|
+
setResource(): Promise<void>;
|
|
20
|
+
getCheckoutState(): Promise<GetCheckoutStateResults>;
|
|
21
|
+
applySubscription(): Promise<ApplySubscriptionResults>;
|
|
22
|
+
estimateSubscription(): Promise<SubscriptionPreview>;
|
|
23
|
+
previewSubscription(): Promise<SubscriptionPreviewV2>;
|
|
24
|
+
estimateSubscriptionUpdate(): Promise<SubscriptionPreview>;
|
|
25
|
+
waitForCheckoutCompleted(): Promise<Subscription | null>;
|
|
26
|
+
refresh(): Promise<void>;
|
|
27
|
+
fetchUsageHistory(): Promise<UsageHistoryPoint[] | undefined>;
|
|
28
|
+
getUsageHistoryV2(): Promise<UsageHistoryV2Fragment>;
|
|
29
|
+
setCustomerId(): Promise<void>;
|
|
30
|
+
getPaywall(): Promise<Paywall>;
|
|
31
|
+
getCustomerPortal(): Promise<CustomerPortal>;
|
|
32
|
+
getActiveSubscriptions(): Promise<Subscription[]>;
|
|
33
|
+
getCustomer(): Promise<Customer>;
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigg/js-client-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.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.235.0",
|
|
32
32
|
"cross-fetch": "^3.1.6",
|
|
33
33
|
"dayjs": "^1.11.13",
|
|
34
34
|
"fetch-retry": "^5.0.6",
|