@stigg/js-client-sdk 0.20.0 → 0.22.2

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.
@@ -6,5 +6,8 @@ declare class EntitlementsApi {
6
6
  constructor(client: ApolloClient<NormalizedCacheObject>);
7
7
  getEntitlement(query: FetchEntitlement): Promise<import("@apollo/client/core").ApolloQueryResult<EntitlementQuery>>;
8
8
  getEntitlements(customerId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetEntitlementsQuery>>;
9
+ pollEntitlements(customerId: string, interval: number): import("@apollo/client/core").ObservableQuery<GetEntitlementsQuery, import("./generated/types").Exact<{
10
+ query: import("./generated/types").FetchEntitlementsQuery;
11
+ }>>;
9
12
  }
10
13
  export default EntitlementsApi;
@@ -3,6 +3,6 @@ import { GetPlansQuery } from './generated/types';
3
3
  declare class PaywallApi {
4
4
  private readonly client;
5
5
  constructor(client: ApolloClient<NormalizedCacheObject>);
6
- getPlans(): Promise<import("@apollo/client/core").ApolloQueryResult<GetPlansQuery>>;
6
+ getPlans(productId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetPlansQuery>>;
7
7
  }
8
8
  export default PaywallApi;
@@ -1133,12 +1133,25 @@ export declare type PlanFilter = {
1133
1133
  id?: InputMaybe<StringFieldComparison>;
1134
1134
  isLatest?: InputMaybe<BooleanFieldComparison>;
1135
1135
  or?: InputMaybe<Array<PlanFilter>>;
1136
+ product?: InputMaybe<PlanFilterProductFilter>;
1136
1137
  productId?: InputMaybe<StringFieldComparison>;
1137
1138
  refId?: InputMaybe<StringFieldComparison>;
1138
1139
  status?: InputMaybe<PackageStatusFilterComparison>;
1139
1140
  updatedAt?: InputMaybe<DateFieldComparison>;
1140
1141
  versionNumber?: InputMaybe<IntFieldComparison>;
1141
1142
  };
1143
+ export declare type PlanFilterProductFilter = {
1144
+ and?: InputMaybe<Array<PlanFilterProductFilter>>;
1145
+ createdAt?: InputMaybe<DateFieldComparison>;
1146
+ description?: InputMaybe<StringFieldComparison>;
1147
+ displayName?: InputMaybe<StringFieldComparison>;
1148
+ environmentId?: InputMaybe<StringFieldComparison>;
1149
+ id?: InputMaybe<StringFieldComparison>;
1150
+ isDefaultProduct?: InputMaybe<BooleanFieldComparison>;
1151
+ or?: InputMaybe<Array<PlanFilterProductFilter>>;
1152
+ refId?: InputMaybe<StringFieldComparison>;
1153
+ updatedAt?: InputMaybe<DateFieldComparison>;
1154
+ };
1142
1155
  export declare type PlanSort = {
1143
1156
  direction: SortDirection;
1144
1157
  field: PlanSortFields;
@@ -2298,6 +2311,11 @@ export declare type SubscriptionFragment = {
2298
2311
  refId: string;
2299
2312
  displayName: string;
2300
2313
  description?: string | null | undefined;
2314
+ product: {
2315
+ __typename?: 'Product';
2316
+ refId: string;
2317
+ displayName?: string | null | undefined;
2318
+ };
2301
2319
  entitlements?: Array<{
2302
2320
  __typename?: 'PackageEntitlement';
2303
2321
  usageLimit?: number | null | undefined;
@@ -2538,6 +2556,11 @@ export declare type PlanFragment = {
2538
2556
  refId: string;
2539
2557
  description?: string | null | undefined;
2540
2558
  displayName: string;
2559
+ product: {
2560
+ __typename?: 'Product';
2561
+ refId: string;
2562
+ displayName?: string | null | undefined;
2563
+ };
2541
2564
  basePlan?: {
2542
2565
  __typename?: 'Plan';
2543
2566
  id: string;
package/dist/client.d.ts CHANGED
@@ -3,9 +3,10 @@ import { ClientConfiguration } from './configuration';
3
3
  export interface StiggClient {
4
4
  getEntitlement: <T extends Entitlement>(featureId: string, options?: EntitlementOptions) => T | InvalidEntitlement | FallbackEntitlement;
5
5
  setCustomerId: (customerId: string) => void;
6
- getPlans: () => Promise<Plan[]>;
6
+ getPaywall: (productId?: string) => Promise<Plan[]>;
7
7
  getCustomer: () => Promise<Customer>;
8
8
  getEntitlements: () => Promise<Entitlement[]>;
9
+ refresh: () => Promise<void>;
9
10
  }
10
11
  export declare class Stigg implements StiggClient {
11
12
  private readonly apiGateway;
@@ -16,9 +17,10 @@ export declare class Stigg implements StiggClient {
16
17
  private constructor();
17
18
  static initialize(configuration: ClientConfiguration): Promise<StiggClient>;
18
19
  setCustomerId(customerId: string): Promise<void>;
20
+ refresh(): Promise<void>;
19
21
  getEntitlement<T extends Entitlement>(featureId: string, options?: EntitlementOptions): T | InvalidEntitlement | FallbackEntitlement;
20
22
  private handleNoEntitlementFound;
21
- getPlans(): Promise<Plan[]>;
23
+ getPaywall(productId?: string): Promise<Plan[]>;
22
24
  getCustomer(): Promise<Customer>;
23
25
  getEntitlements(): Promise<Entitlement[] | never[]>;
24
26
  }
@@ -2,7 +2,8 @@ export declare type ClientConfiguration = {
2
2
  sdkKey: string;
3
3
  baseUri?: string;
4
4
  customerId?: string;
5
+ entitlementPollingInterval?: number;
5
6
  };
6
7
  export declare function validateConfiguration(configuration: ClientConfiguration): void;
7
- export declare function withDefaults(configuration: ClientConfiguration): Partial<ClientConfiguration> & ClientConfiguration;
8
+ export declare function withDefaults(configuration: ClientConfiguration): Required<ClientConfiguration>;
8
9
  export declare function ensureCustomerRefIdExists({ customerId }: ClientConfiguration): string;