@stigg/js-client-sdk 1.7.0 → 1.9.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.
@@ -1,14 +1,21 @@
1
+ import { ApolloQueryResult } from '@apollo/client/core';
2
+ import { GetEntitlementsQuery, GetPaywallQuery } from './generated/types';
3
+ import { ObservablePoller } from '../utils/ObservablePoller';
1
4
  declare type EdgeApiClientConfiguration = {
2
5
  apiKey: string;
3
6
  baseEdgeUri: string;
4
- customerId?: string | null;
5
- customerToken?: string | null;
6
- enableEdge?: boolean;
7
+ enableEdge: boolean;
7
8
  };
8
9
  export declare class EdgeApiClient {
10
+ private readonly dynamicData;
9
11
  private readonly httpClient;
10
12
  private constructor();
11
- static create(config: EdgeApiClientConfiguration): EdgeApiClient | null;
12
- getPaywall(productId?: string): Promise<any>;
13
+ static create(config: EdgeApiClientConfiguration, dynamicData: {
14
+ customerToken?: string | null;
15
+ }): EdgeApiClient | null;
16
+ getPaywall(productId?: string): Promise<ApolloQueryResult<GetPaywallQuery>>;
17
+ getEntitlements(customerId: string): Promise<ApolloQueryResult<GetEntitlementsQuery>>;
18
+ watchEntitlements(customerId: string, interval: number): ObservablePoller<GetEntitlementsQuery>;
19
+ private get;
13
20
  }
14
21
  export {};
@@ -1,12 +1,14 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
2
  import { GetEntitlementsQuery, EntitlementCheckResult } from './generated/types';
3
+ import { EdgeApiClient } from './EdgeApiClient';
3
4
  export declare const RESET_PERIOD_CONFIGURATION_FRAGMENT: import("graphql/language/ast").DocumentNode;
4
5
  export declare const FEATURE_FRAGMENT: import("graphql/language/ast").DocumentNode;
5
6
  declare class EntitlementsApi {
6
7
  private readonly client;
7
- constructor(client: ApolloClient<NormalizedCacheObject>);
8
+ private readonly edgeApiClient;
9
+ constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
8
10
  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<{
11
+ pollEntitlements(customerId: string, interval: number): import("../utils/ObservablePoller").ObservablePoller<GetEntitlementsQuery> | import("@apollo/client/core").ObservableQuery<GetEntitlementsQuery, import("./generated/types").Exact<{
10
12
  query: import("./generated/types").FetchEntitlementsQuery;
11
13
  }>>;
12
14
  reportEntitlementRequested(featureId: string, customerId: string, entitlementCheckResult: EntitlementCheckResult, requestedUsage?: number): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
- import { WidgetType } from './generated/types';
2
+ import { GetPaywallQuery, WidgetType } from './generated/types';
3
3
  import { EdgeApiClient } from './EdgeApiClient';
4
4
  export declare const TYPOGRAPHY_CONFIGURATION: import("graphql/language/ast").DocumentNode;
5
5
  export declare const PAYWALL_CONFIGURATION: import("graphql/language/ast").DocumentNode;
@@ -12,6 +12,6 @@ declare class PaywallApi {
12
12
  private readonly client;
13
13
  private readonly edgeApiClient;
14
14
  constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
15
- getPaywall({ productId, customerId, context }: GetPaywallProps): Promise<any>;
15
+ getPaywall({ productId, customerId, context }: GetPaywallProps): Promise<import("@apollo/client/core").ApolloQueryResult<GetPaywallQuery>>;
16
16
  }
17
17
  export default PaywallApi;
@@ -521,6 +521,7 @@ export declare type CustomerSubscriptionFilter = {
521
521
  refId?: InputMaybe<StringFieldComparison>;
522
522
  startDate?: InputMaybe<DateFieldComparison>;
523
523
  status?: InputMaybe<SubscriptionStatusFilterComparison>;
524
+ subscriptionEntitlements?: InputMaybe<CustomerSubscriptionFilterSubscriptionEntitlementFilter>;
524
525
  subscriptionId?: InputMaybe<StringFieldComparison>;
525
526
  trialEndDate?: InputMaybe<DateFieldComparison>;
526
527
  };
@@ -548,6 +549,15 @@ export declare type CustomerSubscriptionFilterSubscriptionAddonFilter = {
548
549
  quantity?: InputMaybe<NumberFieldComparison>;
549
550
  updatedAt?: InputMaybe<DateFieldComparison>;
550
551
  };
552
+ export declare type CustomerSubscriptionFilterSubscriptionEntitlementFilter = {
553
+ and?: InputMaybe<Array<CustomerSubscriptionFilterSubscriptionEntitlementFilter>>;
554
+ createdAt?: InputMaybe<DateFieldComparison>;
555
+ environmentId?: InputMaybe<StringFieldComparison>;
556
+ id?: InputMaybe<StringFieldComparison>;
557
+ or?: InputMaybe<Array<CustomerSubscriptionFilterSubscriptionEntitlementFilter>>;
558
+ subscriptionId?: InputMaybe<StringFieldComparison>;
559
+ updatedAt?: InputMaybe<DateFieldComparison>;
560
+ };
551
561
  export declare type CustomerSubscriptionFilterSubscriptionPriceFilter = {
552
562
  and?: InputMaybe<Array<CustomerSubscriptionFilterSubscriptionPriceFilter>>;
553
563
  createdAt?: InputMaybe<DateFieldComparison>;
@@ -758,6 +768,7 @@ export declare enum ErrorCode {
758
768
  MeteringNotAvailableForFeatureType = "MeteringNotAvailableForFeatureType",
759
769
  MissingEntityIdError = "MissingEntityIdError",
760
770
  NoFeatureEntitlementInSubscription = "NoFeatureEntitlementInSubscription",
771
+ NoProductsAvailable = "NoProductsAvailable",
761
772
  OperationNotAllowedDuringInProgressExperiment = "OperationNotAllowedDuringInProgressExperiment",
762
773
  PackageAlreadyPublished = "PackageAlreadyPublished",
763
774
  PackagePricingTypeNotSet = "PackagePricingTypeNotSet",
@@ -823,10 +834,12 @@ export declare enum EventLogType {
823
834
  CustomerDeleted = "CUSTOMER_DELETED",
824
835
  CustomerPaymentFailed = "CUSTOMER_PAYMENT_FAILED",
825
836
  CustomerUpdated = "CUSTOMER_UPDATED",
837
+ EdgeApiDataResync = "EDGE_API_DATA_RESYNC",
826
838
  EntitlementsUpdated = "ENTITLEMENTS_UPDATED",
827
839
  EntitlementDenied = "ENTITLEMENT_DENIED",
828
840
  EntitlementGranted = "ENTITLEMENT_GRANTED",
829
841
  EntitlementRequested = "ENTITLEMENT_REQUESTED",
842
+ EnvironmentDeleted = "ENVIRONMENT_DELETED",
830
843
  FeatureCreated = "FEATURE_CREATED",
831
844
  FeatureDeleted = "FEATURE_DELETED",
832
845
  FeatureUpdated = "FEATURE_UPDATED",
@@ -837,6 +850,9 @@ export declare enum EventLogType {
837
850
  PlanCreated = "PLAN_CREATED",
838
851
  PlanDeleted = "PLAN_DELETED",
839
852
  PlanUpdated = "PLAN_UPDATED",
853
+ ProductCreated = "PRODUCT_CREATED",
854
+ ProductDeleted = "PRODUCT_DELETED",
855
+ ProductUpdated = "PRODUCT_UPDATED",
840
856
  PromotionalEntitlementExpired = "PROMOTIONAL_ENTITLEMENT_EXPIRED",
841
857
  PromotionalEntitlementGranted = "PROMOTIONAL_ENTITLEMENT_GRANTED",
842
858
  PromotionalEntitlementRevoked = "PROMOTIONAL_ENTITLEMENT_REVOKED",
@@ -851,7 +867,8 @@ export declare enum EventLogType {
851
867
  SubscriptionTrialStarted = "SUBSCRIPTION_TRIAL_STARTED",
852
868
  SubscriptionUpdated = "SUBSCRIPTION_UPDATED",
853
869
  SubscriptionUsageUpdated = "SUBSCRIPTION_USAGE_UPDATED",
854
- SyncFailed = "SYNC_FAILED"
870
+ SyncFailed = "SYNC_FAILED",
871
+ WidgetConfigurationUpdated = "WIDGET_CONFIGURATION_UPDATED"
855
872
  }
856
873
  export declare type ExperimentFilter = {
857
874
  and?: InputMaybe<Array<ExperimentFilter>>;
@@ -2058,6 +2075,73 @@ export declare enum SubscriptionEndSetup {
2058
2075
  CancelSubscription = "CANCEL_SUBSCRIPTION",
2059
2076
  DowngradeToFree = "DOWNGRADE_TO_FREE"
2060
2077
  }
2078
+ export declare type SubscriptionEntitlementFilter = {
2079
+ and?: InputMaybe<Array<SubscriptionEntitlementFilter>>;
2080
+ createdAt?: InputMaybe<DateFieldComparison>;
2081
+ environmentId?: InputMaybe<StringFieldComparison>;
2082
+ feature?: InputMaybe<SubscriptionEntitlementFilterFeatureFilter>;
2083
+ id?: InputMaybe<StringFieldComparison>;
2084
+ or?: InputMaybe<Array<SubscriptionEntitlementFilter>>;
2085
+ subscription?: InputMaybe<SubscriptionEntitlementFilterCustomerSubscriptionFilter>;
2086
+ subscriptionId?: InputMaybe<StringFieldComparison>;
2087
+ updatedAt?: InputMaybe<DateFieldComparison>;
2088
+ };
2089
+ export declare type SubscriptionEntitlementFilterCustomerSubscriptionFilter = {
2090
+ and?: InputMaybe<Array<SubscriptionEntitlementFilterCustomerSubscriptionFilter>>;
2091
+ billingId?: InputMaybe<StringFieldComparison>;
2092
+ cancelReason?: InputMaybe<SubscriptionCancelReasonFilterComparison>;
2093
+ cancellationDate?: InputMaybe<DateFieldComparison>;
2094
+ createdAt?: InputMaybe<DateFieldComparison>;
2095
+ crmId?: InputMaybe<StringFieldComparison>;
2096
+ crmLinkUrl?: InputMaybe<StringFieldComparison>;
2097
+ effectiveEndDate?: InputMaybe<DateFieldComparison>;
2098
+ endDate?: InputMaybe<DateFieldComparison>;
2099
+ environmentId?: InputMaybe<StringFieldComparison>;
2100
+ id?: InputMaybe<StringFieldComparison>;
2101
+ oldBillingId?: InputMaybe<StringFieldComparison>;
2102
+ or?: InputMaybe<Array<SubscriptionEntitlementFilterCustomerSubscriptionFilter>>;
2103
+ pricingType?: InputMaybe<PricingTypeFilterComparison>;
2104
+ refId?: InputMaybe<StringFieldComparison>;
2105
+ startDate?: InputMaybe<DateFieldComparison>;
2106
+ status?: InputMaybe<SubscriptionStatusFilterComparison>;
2107
+ subscriptionId?: InputMaybe<StringFieldComparison>;
2108
+ trialEndDate?: InputMaybe<DateFieldComparison>;
2109
+ };
2110
+ export declare type SubscriptionEntitlementFilterFeatureFilter = {
2111
+ and?: InputMaybe<Array<SubscriptionEntitlementFilterFeatureFilter>>;
2112
+ createdAt?: InputMaybe<DateFieldComparison>;
2113
+ description?: InputMaybe<StringFieldComparison>;
2114
+ displayName?: InputMaybe<StringFieldComparison>;
2115
+ environmentId?: InputMaybe<StringFieldComparison>;
2116
+ featureStatus?: InputMaybe<FeatureStatusFilterComparison>;
2117
+ featureType?: InputMaybe<FeatureTypeFilterComparison>;
2118
+ id?: InputMaybe<StringFieldComparison>;
2119
+ meterType?: InputMaybe<MeterTypeFilterComparison>;
2120
+ or?: InputMaybe<Array<SubscriptionEntitlementFilterFeatureFilter>>;
2121
+ refId?: InputMaybe<StringFieldComparison>;
2122
+ updatedAt?: InputMaybe<DateFieldComparison>;
2123
+ };
2124
+ export declare type SubscriptionEntitlementInput = {
2125
+ description?: InputMaybe<Scalars['String']>;
2126
+ featureId: Scalars['String'];
2127
+ hasUnlimitedUsage?: InputMaybe<Scalars['Boolean']>;
2128
+ monthlyResetPeriodConfiguration?: InputMaybe<MonthlyResetPeriodConfigInput>;
2129
+ resetPeriod?: InputMaybe<EntitlementResetPeriod>;
2130
+ usageLimit?: InputMaybe<Scalars['Float']>;
2131
+ weeklyResetPeriodConfiguration?: InputMaybe<WeeklyResetPeriodConfigInput>;
2132
+ };
2133
+ export declare type SubscriptionEntitlementSort = {
2134
+ direction: SortDirection;
2135
+ field: SubscriptionEntitlementSortFields;
2136
+ nulls?: InputMaybe<SortNulls>;
2137
+ };
2138
+ export declare enum SubscriptionEntitlementSortFields {
2139
+ CreatedAt = "createdAt",
2140
+ EnvironmentId = "environmentId",
2141
+ Id = "id",
2142
+ SubscriptionId = "subscriptionId",
2143
+ UpdatedAt = "updatedAt"
2144
+ }
2061
2145
  export declare type SubscriptionInput = {
2062
2146
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
2063
2147
  addons?: InputMaybe<Array<SubscriptionAddonInput>>;
@@ -2077,6 +2161,7 @@ export declare type SubscriptionInput = {
2077
2161
  promotionCode?: InputMaybe<Scalars['String']>;
2078
2162
  refId?: InputMaybe<Scalars['String']>;
2079
2163
  startDate?: InputMaybe<Scalars['DateTime']>;
2164
+ subscriptionEntitlements?: InputMaybe<Array<SubscriptionEntitlementInput>>;
2080
2165
  subscriptionId?: InputMaybe<Scalars['String']>;
2081
2166
  };
2082
2167
  export declare type SubscriptionMigrationInput = {
@@ -2410,6 +2495,14 @@ export declare type UpdatePackageEntitlementOrderItemInput = {
2410
2495
  id: Scalars['String'];
2411
2496
  order?: InputMaybe<Scalars['Float']>;
2412
2497
  };
2498
+ export declare type UpdateSubscriptionEntitlementInput = {
2499
+ hasUnlimitedUsage?: InputMaybe<Scalars['Boolean']>;
2500
+ id: Scalars['String'];
2501
+ monthlyResetPeriodConfiguration?: InputMaybe<MonthlyResetPeriodConfigInput>;
2502
+ resetPeriod?: InputMaybe<EntitlementResetPeriod>;
2503
+ usageLimit?: InputMaybe<Scalars['Float']>;
2504
+ weeklyResetPeriodConfiguration?: InputMaybe<WeeklyResetPeriodConfigInput>;
2505
+ };
2413
2506
  export declare type UpdateSubscriptionInput = {
2414
2507
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
2415
2508
  addons?: InputMaybe<Array<SubscriptionAddonInput>>;
@@ -2417,6 +2510,7 @@ export declare type UpdateSubscriptionInput = {
2417
2510
  environmentId?: InputMaybe<Scalars['String']>;
2418
2511
  promotionCode?: InputMaybe<Scalars['String']>;
2419
2512
  refId?: InputMaybe<Scalars['String']>;
2513
+ subscriptionEntitlements?: InputMaybe<Array<UpdateSubscriptionEntitlementInput>>;
2420
2514
  subscriptionId?: InputMaybe<Scalars['String']>;
2421
2515
  trialEndDate?: InputMaybe<Scalars['DateTime']>;
2422
2516
  unitQuantity?: InputMaybe<Scalars['Float']>;
@@ -2900,6 +2994,7 @@ export declare type PackageEntitlementFragment = {
2900
2994
  hasUnlimitedUsage?: boolean | null | undefined;
2901
2995
  featureId: string;
2902
2996
  resetPeriod?: EntitlementResetPeriod | null | undefined;
2997
+ isCustom?: boolean | null | undefined;
2903
2998
  hiddenFromWidgets?: Array<WidgetType> | null | undefined;
2904
2999
  displayNameOverride?: string | null | undefined;
2905
3000
  feature: {