@stigg/js-client-sdk 0.43.0 → 0.44.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,8 +1,8 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
- import { GetPlansQuery } from './generated/types';
2
+ import { GetPaywallQuery } from './generated/types';
3
3
  declare class PaywallApi {
4
4
  private readonly client;
5
5
  constructor(client: ApolloClient<NormalizedCacheObject>);
6
- getPlans(productId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetPlansQuery>>;
6
+ getPaywall(productId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetPaywallQuery>>;
7
7
  }
8
8
  export default PaywallApi;
@@ -294,6 +294,7 @@ export declare type CreateEnvironment = {
294
294
  description?: InputMaybe<Scalars['String']>;
295
295
  displayName?: InputMaybe<Scalars['String']>;
296
296
  id?: InputMaybe<Scalars['String']>;
297
+ provisionStatus?: InputMaybe<EnvironmentProvisionStatus>;
297
298
  slug?: InputMaybe<Scalars['String']>;
298
299
  };
299
300
  export declare type CreateEnvironmentOptions = {
@@ -640,6 +641,13 @@ export declare type EnvironmentFilter = {
640
641
  or?: InputMaybe<Array<EnvironmentFilter>>;
641
642
  slug?: InputMaybe<StringFieldComparison>;
642
643
  };
644
+ /** EnvironmentProvisionStatus. */
645
+ export declare enum EnvironmentProvisionStatus {
646
+ Done = "DONE",
647
+ Failed = "FAILED",
648
+ InProgress = "IN_PROGRESS",
649
+ NotProvisioned = "NOT_PROVISIONED"
650
+ }
643
651
  export declare type EnvironmentSort = {
644
652
  direction: SortDirection;
645
653
  field: EnvironmentSortFields;
@@ -661,7 +669,6 @@ export declare enum ErrorCode {
661
669
  BillingPeriodMissingError = "BillingPeriodMissingError",
662
670
  CannotDeleteCustomerError = "CannotDeleteCustomerError",
663
671
  CannotDeleteFeatureError = "CannotDeleteFeatureError",
664
- CantCreateExperiment = "CantCreateExperiment",
665
672
  CheckoutIsNotSupported = "CheckoutIsNotSupported",
666
673
  CouponNotFound = "CouponNotFound",
667
674
  CustomerHasNoPaymentMethod = "CustomerHasNoPaymentMethod",
@@ -671,6 +678,7 @@ export declare enum ErrorCode {
671
678
  DuplicatedEntityNotAllowed = "DuplicatedEntityNotAllowed",
672
679
  EditAllowedOnDraftPackageOnlyError = "EditAllowedOnDraftPackageOnlyError",
673
680
  EnvironmentMissing = "EnvironmentMissing",
681
+ ExperimentAlreadyRunning = "ExperimentAlreadyRunning",
674
682
  ExperimentNotFoundError = "ExperimentNotFoundError",
675
683
  ExperimentStatusError = "ExperimentStatusError",
676
684
  FailedToImportCustomer = "FailedToImportCustomer",
@@ -693,6 +701,7 @@ export declare enum ErrorCode {
693
701
  MemberNotFound = "MemberNotFound",
694
702
  MeteringNotAvailableForFeatureType = "MeteringNotAvailableForFeatureType",
695
703
  NoFeatureEntitlementInSubscription = "NoFeatureEntitlementInSubscription",
704
+ OperationNotAllowedDuringInProgressExperiment = "OperationNotAllowedDuringInProgressExperiment",
696
705
  PackageAlreadyPublished = "PackageAlreadyPublished",
697
706
  PackagePricingTypeNotSet = "PackagePricingTypeNotSet",
698
707
  PlanAlreadyExtended = "PlanAlreadyExtended",
@@ -802,6 +811,10 @@ export declare enum ExperimentSortFields {
802
811
  RefId = "refId",
803
812
  Status = "status"
804
813
  }
814
+ export declare type ExperimentStatsQuery = {
815
+ environmentId?: InputMaybe<Scalars['String']>;
816
+ experimentRefId: Scalars['String'];
817
+ };
805
818
  /** The status of the EXPERIMENT */
806
819
  export declare enum ExperimentStatus {
807
820
  Completed = "COMPLETED",
@@ -924,6 +937,9 @@ export declare type GetPackageByRefIdInput = {
924
937
  refId: Scalars['String'];
925
938
  versionNumber?: InputMaybe<Scalars['Float']>;
926
939
  };
940
+ export declare type GetPaywallInput = {
941
+ productId?: InputMaybe<Scalars['String']>;
942
+ };
927
943
  export declare type HookFilter = {
928
944
  and?: InputMaybe<Array<HookFilter>>;
929
945
  createdAt?: InputMaybe<DateFieldComparison>;
@@ -1226,6 +1242,7 @@ export declare type PackageEntitlementInput = {
1226
1242
  featureId: Scalars['String'];
1227
1243
  hasUnlimitedUsage?: InputMaybe<Scalars['Boolean']>;
1228
1244
  monthlyResetPeriodConfiguration?: InputMaybe<MonthlyResetPeriodConfigInput>;
1245
+ order?: InputMaybe<Scalars['Float']>;
1229
1246
  packageId: Scalars['String'];
1230
1247
  resetPeriod?: InputMaybe<EntitlementResetPeriod>;
1231
1248
  usageLimit?: InputMaybe<Scalars['Float']>;
@@ -1247,6 +1264,7 @@ export declare type PackageEntitlementUpdateInput = {
1247
1264
  description?: InputMaybe<Scalars['String']>;
1248
1265
  hasUnlimitedUsage?: InputMaybe<Scalars['Boolean']>;
1249
1266
  monthlyResetPeriodConfiguration?: InputMaybe<MonthlyResetPeriodConfigInput>;
1267
+ order?: InputMaybe<Scalars['Float']>;
1250
1268
  resetPeriod?: InputMaybe<EntitlementResetPeriod>;
1251
1269
  usageLimit?: InputMaybe<Scalars['Float']>;
1252
1270
  weeklyResetPeriodConfiguration?: InputMaybe<WeeklyResetPeriodConfigInput>;
@@ -1765,7 +1783,6 @@ export declare type SubscriptionAddonFilterPriceFilter = {
1765
1783
  };
1766
1784
  export declare type SubscriptionAddonInput = {
1767
1785
  addonId: Scalars['String'];
1768
- billingPeriod?: InputMaybe<BillingPeriod>;
1769
1786
  quantity?: InputMaybe<Scalars['Int']>;
1770
1787
  };
1771
1788
  export declare type SubscriptionAddonSort = {
@@ -1840,6 +1857,13 @@ export declare enum SubscriptionCancellationTime {
1840
1857
  Immediate = "IMMEDIATE",
1841
1858
  SpecificDate = "SPECIFIC_DATE"
1842
1859
  }
1860
+ /** Subscription decision strategy */
1861
+ export declare enum SubscriptionDecisionStrategy {
1862
+ PredefinedFreePlan = "PREDEFINED_FREE_PLAN",
1863
+ PredefinedTrialPlan = "PREDEFINED_TRIAL_PLAN",
1864
+ RequestedPlan = "REQUESTED_PLAN",
1865
+ SkippedSubscriptionCreation = "SKIPPED_SUBSCRIPTION_CREATION"
1866
+ }
1843
1867
  export declare type SubscriptionEditTrialEndDateInput = {
1844
1868
  environmentId: Scalars['String'];
1845
1869
  subscriptionRefId: Scalars['String'];
@@ -1972,13 +1996,6 @@ export declare type SubscriptionStatusFilterComparison = {
1972
1996
  notIn?: InputMaybe<Array<SubscriptionStatus>>;
1973
1997
  notLike?: InputMaybe<SubscriptionStatus>;
1974
1998
  };
1975
- /** Subscription strategy decision */
1976
- export declare enum SubscriptionStrategyDecision {
1977
- PredefinedFreePlan = "PREDEFINED_FREE_PLAN",
1978
- PredefinedTrialPlan = "PREDEFINED_TRIAL_PLAN",
1979
- RequestedPlan = "REQUESTED_PLAN",
1980
- SkippedSubscriptionCreation = "SKIPPED_SUBSCRIPTION_CREATION"
1981
- }
1982
1999
  /** Status of the integration sync */
1983
2000
  export declare enum SyncStatus {
1984
2001
  Error = "ERROR",
@@ -2074,6 +2091,7 @@ export declare type UpdateEnvironment = {
2074
2091
  description?: InputMaybe<Scalars['String']>;
2075
2092
  displayName?: InputMaybe<Scalars['String']>;
2076
2093
  id?: InputMaybe<Scalars['String']>;
2094
+ provisionStatus?: InputMaybe<EnvironmentProvisionStatus>;
2077
2095
  slug?: InputMaybe<Scalars['String']>;
2078
2096
  };
2079
2097
  export declare type UpdateExperimentInput = {
@@ -2083,7 +2101,7 @@ export declare type UpdateExperimentInput = {
2083
2101
  name?: InputMaybe<Scalars['String']>;
2084
2102
  productId?: InputMaybe<Scalars['String']>;
2085
2103
  productSettings?: InputMaybe<ProductSettingsInput>;
2086
- refId?: InputMaybe<Scalars['String']>;
2104
+ refId: Scalars['String'];
2087
2105
  variantGroupName?: InputMaybe<Scalars['String']>;
2088
2106
  variantPercentage?: InputMaybe<Scalars['Float']>;
2089
2107
  };
@@ -2160,6 +2178,7 @@ export declare type UpdateOnePromotionalEntitlementInput = {
2160
2178
  };
2161
2179
  export declare type UpdateSubscriptionInput = {
2162
2180
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
2181
+ addons?: InputMaybe<Array<SubscriptionAddonInput>>;
2163
2182
  environmentId?: InputMaybe<Scalars['String']>;
2164
2183
  refId: Scalars['String'];
2165
2184
  unitQuantity?: InputMaybe<Scalars['Float']>;
@@ -2345,7 +2364,7 @@ export declare type SubscriptionFragment = {
2345
2364
  __typename?: 'experimentInfo';
2346
2365
  name: string;
2347
2366
  groupName: string;
2348
- groupType?: ExperimentGroupType | null | undefined;
2367
+ groupType: ExperimentGroupType;
2349
2368
  id: string;
2350
2369
  } | null | undefined;
2351
2370
  prices?: Array<{
@@ -2473,7 +2492,7 @@ export declare type CustomerFragment = {
2473
2492
  experimentInfo?: {
2474
2493
  __typename?: 'experimentInfo';
2475
2494
  name: string;
2476
- groupType?: ExperimentGroupType | null | undefined;
2495
+ groupType: ExperimentGroupType;
2477
2496
  groupName: string;
2478
2497
  id: string;
2479
2498
  } | null | undefined;
@@ -2633,27 +2652,18 @@ export declare type PlanFragment = {
2633
2652
  duration: number;
2634
2653
  units: TrialPeriodUnits;
2635
2654
  } | null | undefined;
2655
+ compatibleAddons?: Array<{
2656
+ __typename?: 'Addon';
2657
+ } & AddonFragment> | null | undefined;
2636
2658
  };
2637
- export declare type GetPlansQueryVariables = Exact<{
2638
- paging?: Maybe<CursorPaging>;
2639
- filter?: Maybe<PlanFilter>;
2640
- addonFilter?: Maybe<AddonFilter>;
2641
- sorting?: Maybe<Array<PlanSort> | PlanSort>;
2659
+ export declare type GetPaywallQueryVariables = Exact<{
2660
+ input: GetPaywallInput;
2642
2661
  }>;
2643
- export declare type GetPlansQuery = {
2662
+ export declare type GetPaywallQuery = {
2644
2663
  __typename?: 'Query';
2645
- plans: {
2646
- __typename?: 'PlanConnection';
2647
- edges: Array<{
2648
- __typename?: 'PlanEdge';
2649
- node: {
2650
- __typename?: 'Plan';
2651
- compatibleAddons?: Array<{
2652
- __typename?: 'Addon';
2653
- } & AddonFragment> | null | undefined;
2654
- } & PlanFragment;
2655
- }>;
2656
- };
2664
+ getPaywall: Array<{
2665
+ __typename?: 'Plan';
2666
+ } & PlanFragment>;
2657
2667
  };
2658
2668
  export declare type SdkConfigurationQueryVariables = Exact<{
2659
2669
  [key: string]: never;
package/dist/client.d.ts CHANGED
@@ -23,6 +23,7 @@ export declare class Stigg implements StiggClient {
23
23
  private readonly loggerService;
24
24
  private entitlementsService;
25
25
  private readonly modelMapper;
26
+ private readonly eventEmitter;
26
27
  private constructor();
27
28
  /**
28
29
  * Creates an instance of Stigg client.
@@ -75,6 +76,7 @@ export declare class Stigg implements StiggClient {
75
76
  getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
76
77
  /**
77
78
  * Get a list of plans for rendering the paywall
79
+ * @deprecated *Optional* `productId` is now deprecated and will be changed to a *required* field soon.
78
80
  *
79
81
  * @returns {Promise<Plan[]>}
80
82
  */