@stigg/js-client-sdk 1.1.0 → 1.2.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.
@@ -34,6 +34,10 @@ export declare enum AccessDeniedReason {
34
34
  RequestedUsageExceedingLimit = "RequestedUsageExceedingLimit",
35
35
  Unknown = "Unknown"
36
36
  }
37
+ export declare enum AccountStatus {
38
+ Active = "ACTIVE",
39
+ Blocked = "BLOCKED"
40
+ }
37
41
  export declare type AddCompatibleAddonsToPlanInput = {
38
42
  /** The id of the record. */
39
43
  id: Scalars['String'];
@@ -46,6 +50,7 @@ export declare type AddonCreateInput = {
46
50
  description?: InputMaybe<Scalars['String']>;
47
51
  displayName: Scalars['String'];
48
52
  environmentId?: InputMaybe<Scalars['String']>;
53
+ hiddenFromWidgets?: InputMaybe<Array<WidgetType>>;
49
54
  productId: Scalars['String'];
50
55
  refId?: InputMaybe<Scalars['String']>;
51
56
  status?: InputMaybe<PackageStatus>;
@@ -92,6 +97,7 @@ export declare type AddonUpdateInput = {
92
97
  billingId?: InputMaybe<Scalars['String']>;
93
98
  description?: InputMaybe<Scalars['String']>;
94
99
  displayName: Scalars['String'];
100
+ hiddenFromWidgets?: InputMaybe<Array<WidgetType>>;
95
101
  id: Scalars['String'];
96
102
  status?: InputMaybe<PackageStatus>;
97
103
  };
@@ -203,6 +209,7 @@ export declare type CheckoutOptions = {
203
209
  allowPromoCodes?: InputMaybe<Scalars['Boolean']>;
204
210
  cancelUrl: Scalars['String'];
205
211
  collectBillingAddress?: InputMaybe<Scalars['Boolean']>;
212
+ referenceId?: InputMaybe<Scalars['String']>;
206
213
  successUrl: Scalars['String'];
207
214
  };
208
215
  export declare type CouponFilter = {
@@ -709,6 +716,7 @@ export declare enum ErrorCode {
709
716
  CheckoutIsNotSupported = "CheckoutIsNotSupported",
710
717
  CheckoutOptionsMissing = "CheckoutOptionsMissing",
711
718
  CouponNotFound = "CouponNotFound",
719
+ CustomerAlreadyHaveCustomerCoupon = "CustomerAlreadyHaveCustomerCoupon",
712
720
  CustomerAlreadyUsesCoupon = "CustomerAlreadyUsesCoupon",
713
721
  CustomerHasNoPaymentMethod = "CustomerHasNoPaymentMethod",
714
722
  CustomerNoBillingId = "CustomerNoBillingId",
@@ -753,6 +761,12 @@ export declare enum ErrorCode {
753
761
  PlanWithChildCantBeDeleted = "PlanWithChildCantBeDeleted",
754
762
  PlansCircularDependencyError = "PlansCircularDependencyError",
755
763
  PriceNotFound = "PriceNotFound",
764
+ PromotionCodeCustomerNotFirstPurchase = "PromotionCodeCustomerNotFirstPurchase",
765
+ PromotionCodeMaxRedemptionsReached = "PromotionCodeMaxRedemptionsReached",
766
+ PromotionCodeMinimumAmountNotReached = "PromotionCodeMinimumAmountNotReached",
767
+ PromotionCodeNotActive = "PromotionCodeNotActive",
768
+ PromotionCodeNotForCustomer = "PromotionCodeNotForCustomer",
769
+ PromotionCodeNotFound = "PromotionCodeNotFound",
756
770
  RateLimitExceeded = "RateLimitExceeded",
757
771
  ResyncAlreadyInProgress = "ResyncAlreadyInProgress",
758
772
  SelectedBillingModelDoesntMatchImportedItemError = "SelectedBillingModelDoesntMatchImportedItemError",
@@ -775,13 +789,15 @@ export declare type EstimateSubscriptionInput = {
775
789
  billingPeriod?: InputMaybe<BillingPeriod>;
776
790
  customerId: Scalars['String'];
777
791
  environmentId?: InputMaybe<Scalars['String']>;
778
- planId?: InputMaybe<Scalars['String']>;
792
+ planId: Scalars['String'];
779
793
  priceUnitAmount?: InputMaybe<Scalars['Float']>;
794
+ promotionCode?: InputMaybe<Scalars['String']>;
780
795
  startDate?: InputMaybe<Scalars['DateTime']>;
781
796
  };
782
797
  export declare type EstimateSubscriptionUpdateInput = {
783
798
  addons?: InputMaybe<Array<SubscriptionAddonInput>>;
784
799
  environmentId?: InputMaybe<Scalars['String']>;
800
+ promotionCode?: InputMaybe<Scalars['String']>;
785
801
  subscriptionId: Scalars['String'];
786
802
  unitQuantity?: InputMaybe<Scalars['Float']>;
787
803
  };
@@ -1000,12 +1016,18 @@ export declare enum FontWeight {
1000
1016
  Bold = "BOLD",
1001
1017
  Normal = "NORMAL"
1002
1018
  }
1019
+ export declare type GetCustomerByRefIdInput = {
1020
+ customerId: Scalars['String'];
1021
+ environmentId?: InputMaybe<Scalars['String']>;
1022
+ };
1003
1023
  export declare type GetPackageByRefIdInput = {
1004
1024
  environmentId: Scalars['String'];
1005
1025
  refId: Scalars['String'];
1006
1026
  versionNumber?: InputMaybe<Scalars['Float']>;
1007
1027
  };
1008
1028
  export declare type GetPaywallInput = {
1029
+ context?: InputMaybe<WidgetType>;
1030
+ customerId?: InputMaybe<Scalars['String']>;
1009
1031
  environmentId?: InputMaybe<Scalars['String']>;
1010
1032
  productId?: InputMaybe<Scalars['String']>;
1011
1033
  };
@@ -1406,6 +1428,7 @@ export declare type PlanCreateInput = {
1406
1428
  description?: InputMaybe<Scalars['String']>;
1407
1429
  displayName: Scalars['String'];
1408
1430
  environmentId?: InputMaybe<Scalars['String']>;
1431
+ hiddenFromWidgets?: InputMaybe<Array<WidgetType>>;
1409
1432
  parentPlanId?: InputMaybe<Scalars['String']>;
1410
1433
  productId: Scalars['String'];
1411
1434
  refId?: InputMaybe<Scalars['String']>;
@@ -1485,6 +1508,7 @@ export declare type PlanUpdateInput = {
1485
1508
  defaultTrialConfig?: InputMaybe<DefaultTrialConfigInputDto>;
1486
1509
  description?: InputMaybe<Scalars['String']>;
1487
1510
  displayName?: InputMaybe<Scalars['String']>;
1511
+ hiddenFromWidgets?: InputMaybe<Array<WidgetType>>;
1488
1512
  id: Scalars['String'];
1489
1513
  parentPlanId?: InputMaybe<Scalars['String']>;
1490
1514
  status?: InputMaybe<PackageStatus>;
@@ -1683,6 +1707,10 @@ export declare type PromotionalEntitlementUpdateInput = {
1683
1707
  usageLimit?: InputMaybe<Scalars['Float']>;
1684
1708
  weeklyResetPeriodConfiguration?: InputMaybe<WeeklyResetPeriodConfigInput>;
1685
1709
  };
1710
+ export declare enum ProrationBehavior {
1711
+ CreateProrations = "CREATE_PRORATIONS",
1712
+ InvoiceImmediately = "INVOICE_IMMEDIATELY"
1713
+ }
1686
1714
  export declare type ProvisionCustomerInput = {
1687
1715
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
1688
1716
  billingId?: InputMaybe<Scalars['String']>;
@@ -1705,8 +1733,9 @@ export declare type ProvisionCustomerSubscriptionInput = {
1705
1733
  awaitPaymentConfirmation?: InputMaybe<Scalars['Boolean']>;
1706
1734
  billingInformation?: InputMaybe<SubscriptionBillingInfo>;
1707
1735
  billingPeriod?: InputMaybe<BillingPeriod>;
1708
- planId?: InputMaybe<Scalars['String']>;
1736
+ planId: Scalars['String'];
1709
1737
  priceUnitAmount?: InputMaybe<Scalars['Float']>;
1738
+ promotionCode?: InputMaybe<Scalars['String']>;
1710
1739
  refId?: InputMaybe<Scalars['String']>;
1711
1740
  startDate?: InputMaybe<Scalars['DateTime']>;
1712
1741
  subscriptionId?: InputMaybe<Scalars['String']>;
@@ -1719,8 +1748,25 @@ export declare type ProvisionSubscription = {
1719
1748
  billingPeriod?: InputMaybe<BillingPeriod>;
1720
1749
  checkoutOptions?: InputMaybe<CheckoutOptions>;
1721
1750
  customerId: Scalars['String'];
1722
- planId?: InputMaybe<Scalars['String']>;
1751
+ planId: Scalars['String'];
1752
+ priceUnitAmount?: InputMaybe<Scalars['Float']>;
1753
+ promotionCode?: InputMaybe<Scalars['String']>;
1754
+ refId?: InputMaybe<Scalars['String']>;
1755
+ skipTrial?: InputMaybe<Scalars['Boolean']>;
1756
+ startDate?: InputMaybe<Scalars['DateTime']>;
1757
+ subscriptionId?: InputMaybe<Scalars['String']>;
1758
+ };
1759
+ export declare type ProvisionSubscriptionInput = {
1760
+ additionalMetaData?: InputMaybe<Scalars['JSON']>;
1761
+ addons?: InputMaybe<Array<SubscriptionAddonInput>>;
1762
+ awaitPaymentConfirmation?: InputMaybe<Scalars['Boolean']>;
1763
+ billingInformation?: InputMaybe<SubscriptionBillingInfo>;
1764
+ billingPeriod?: InputMaybe<BillingPeriod>;
1765
+ checkoutOptions?: InputMaybe<CheckoutOptions>;
1766
+ customerId: Scalars['String'];
1767
+ planId: Scalars['String'];
1723
1768
  priceUnitAmount?: InputMaybe<Scalars['Float']>;
1769
+ promotionCode?: InputMaybe<Scalars['String']>;
1724
1770
  refId?: InputMaybe<Scalars['String']>;
1725
1771
  skipTrial?: InputMaybe<Scalars['Boolean']>;
1726
1772
  startDate?: InputMaybe<Scalars['DateTime']>;
@@ -2007,8 +2053,9 @@ export declare type SubscriptionInput = {
2007
2053
  isCustomPriceSubscription?: InputMaybe<Scalars['Boolean']>;
2008
2054
  isOverridingTrialConfig?: InputMaybe<Scalars['Boolean']>;
2009
2055
  isTrial?: InputMaybe<Scalars['Boolean']>;
2010
- planId?: InputMaybe<Scalars['String']>;
2056
+ planId: Scalars['String'];
2011
2057
  priceUnitAmount?: InputMaybe<Scalars['Float']>;
2058
+ promotionCode?: InputMaybe<Scalars['String']>;
2012
2059
  refId?: InputMaybe<Scalars['String']>;
2013
2060
  startDate?: InputMaybe<Scalars['DateTime']>;
2014
2061
  subscriptionId?: InputMaybe<Scalars['String']>;
@@ -2193,6 +2240,7 @@ export declare type UpdateAccountInput = {
2193
2240
  displayName: Scalars['String'];
2194
2241
  id: Scalars['String'];
2195
2242
  subscriptionBillingAnchor?: InputMaybe<BillingAnchor>;
2243
+ subscriptionProrationBehavior?: InputMaybe<ProrationBehavior>;
2196
2244
  timezone?: InputMaybe<Scalars['String']>;
2197
2245
  };
2198
2246
  export declare type UpdateCouponInput = {
@@ -2325,6 +2373,7 @@ export declare type UpdateSubscriptionInput = {
2325
2373
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
2326
2374
  addons?: InputMaybe<Array<SubscriptionAddonInput>>;
2327
2375
  environmentId?: InputMaybe<Scalars['String']>;
2376
+ promotionCode?: InputMaybe<Scalars['String']>;
2328
2377
  refId?: InputMaybe<Scalars['String']>;
2329
2378
  subscriptionId?: InputMaybe<Scalars['String']>;
2330
2379
  trialEndDate?: InputMaybe<Scalars['DateTime']>;
@@ -2799,19 +2848,13 @@ export declare type CustomerPortalFragment = {
2799
2848
  } & CustomerPortalConfigurationFragment) | null | undefined;
2800
2849
  };
2801
2850
  export declare type GetCustomerByRefIdQueryVariables = Exact<{
2802
- filter?: Maybe<CustomerFilter>;
2851
+ input: GetCustomerByRefIdInput;
2803
2852
  }>;
2804
2853
  export declare type GetCustomerByRefIdQuery = {
2805
2854
  __typename?: 'Query';
2806
- customers: {
2807
- __typename?: 'CustomerConnection';
2808
- edges: Array<{
2809
- __typename?: 'CustomerEdge';
2810
- node: {
2811
- __typename?: 'Customer';
2812
- } & CustomerFragment;
2813
- }>;
2814
- };
2855
+ getCustomerByRefId?: ({
2856
+ __typename?: 'Customer';
2857
+ } & CustomerFragment) | null | undefined;
2815
2858
  };
2816
2859
  export declare type GetCustomerPortalByRefIdQueryVariables = Exact<{
2817
2860
  input: CustomerPortalInput;
@@ -2,7 +2,9 @@ import { ApolloClient } from '@apollo/client/core';
2
2
  declare type ApolloClientConfiguration = {
3
3
  apiKey: string;
4
4
  baseUri: string;
5
+ customerId?: string | null;
6
+ customerToken?: string | null;
5
7
  };
6
- declare const initApolloClient: ({ apiKey, baseUri }: Partial<ApolloClientConfiguration>) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
7
- export declare const initBatchedApolloClient: ({ apiKey, baseUri }: ApolloClientConfiguration) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
8
+ declare const initApolloClient: (config: Partial<ApolloClientConfiguration>) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
9
+ export declare const initBatchedApolloClient: (config: ApolloClientConfiguration) => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
8
10
  export default initApolloClient;
package/dist/client.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface StiggClient {
7
7
  getBooleanEntitlement: (params: GetBooleanEntitlement) => BooleanEntitlement;
8
8
  getNumericEntitlement: (params: GetNumericEntitlement) => NumericEntitlement;
9
9
  getMeteredEntitlement: (params: GetMeteredEntitlement) => MeteredEntitlement;
10
- setCustomerId: (customerId: string) => Promise<void>;
10
+ setCustomerId: (customerId: string, customerToken?: string | null) => Promise<void>;
11
11
  clearCustomer: () => void;
12
12
  getPaywall: (params?: GetPaywall) => Promise<Paywall>;
13
13
  getCustomer: () => Promise<Customer>;
@@ -66,7 +66,7 @@ export declare class Stigg implements StiggClient {
66
66
  /**
67
67
  * Set the customer ID, usually after the customer signs in or restores a session
68
68
  */
69
- setCustomerId(customerId: string): Promise<void>;
69
+ setCustomerId(customerId: string, customerToken?: string | null): Promise<void>;
70
70
  /**
71
71
  * Clear the customer ID, usually after the customer signs out
72
72
  */
@@ -6,6 +6,7 @@ export declare type ClientConfiguration = {
6
6
  apiKey: string;
7
7
  baseUri?: string;
8
8
  customerId?: string | null;
9
+ customerToken?: string | null;
9
10
  entitlementPollingInterval?: number;
10
11
  useEntitlementPolling?: boolean;
11
12
  logConfiguration?: LogConfiguration;