@stigg/js-client-sdk 3.59.0 → 3.60.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/models.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, SubscriptionQueryFragment, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PageInfoFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod, BudgetConfigurationInput, SubscriptionProrationBehavior } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, SubscriptionQueryFragment, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PageInfoFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod, BudgetConfigurationInput, SubscriptionProrationBehavior, PaymentSessionInput, CreditBalanceSummaryInput, StripeCheckoutCredentialsFragment, ZuoraCheckoutCredentialsFragment } from '@stigg/api-client-js/src/generated/sdk';
2
2
  export * from '@stigg/api-client-js/src/generated/sdk';
3
3
  interface Metadata {
4
4
  [key: string]: string;
@@ -370,11 +370,13 @@ export declare type CustomerPortal = {
370
370
  export declare type CheckoutStatePlan = Plan & Pick<PlanFragment, 'prices'>;
371
371
  export declare type CheckoutBillingIntegration = {
372
372
  billingIdentifier: BillingVendorIdentifier;
373
+ billingCredentials: StripeCheckoutCredentialsFragment | ZuoraCheckoutCredentialsFragment;
373
374
  credentials: {
374
- accountId: string;
375
- publicKey: string;
375
+ accountId?: string | null;
376
+ publicKey?: string | null;
376
377
  };
377
378
  };
379
+ export declare type CreatePaymentSessionInput = Omit<PaymentSessionInput, 'customerId'>;
378
380
  export declare type TypographyConfiguration = Omit<TypographyConfigurationFragment, '__typename'>;
379
381
  export declare type CheckoutConfiguration = Omit<CheckoutConfigurationFragment, '__typename'>;
380
382
  export declare type GetCheckoutStateResults = {
@@ -593,6 +595,7 @@ export declare type BillableFeature = {
593
595
  featureId: string;
594
596
  quantity: number;
595
597
  };
598
+ export declare type GetCreditBalanceInput = Omit<CreditBalanceSummaryInput, 'customerId' | 'resourceId'>;
596
599
  /** @hidden */
597
600
  export declare class CustomerModel implements Customer {
598
601
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { Stigg, StiggClient } from './clients';
2
- import { ApplySubscriptionResults, BooleanEntitlement, Coupon, CreditGrantFragment, CreditsBalanceSummaryFragment, Customer, CustomerPortal, Entitlement, EnumEntitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetEnumEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetSubscriptionsResult, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
2
+ import { ApplySubscriptionResults, BooleanEntitlement, Coupon, CreditGrantFragment, CreditsBalanceSummaryFragment, Customer, CustomerPortal, Entitlement, EnumEntitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetEnumEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetSubscriptionsResult, MeteredEntitlement, NumericEntitlement, PaymentSessionFragment, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
3
3
  export declare class OfflineStigg extends Stigg {
4
4
  getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
5
5
  getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
@@ -36,4 +36,5 @@ export declare class OfflineStigg extends Stigg {
36
36
  getCustomer(): Promise<Customer>;
37
37
  getCreditBalance(): Promise<CreditsBalanceSummaryFragment>;
38
38
  getCreditGrants(): Promise<CreditGrantFragment[]>;
39
+ createPaymentSession(): Promise<PaymentSessionFragment>;
39
40
  }
@@ -9,6 +9,7 @@ import MockPaywallApi from './MockPaywallApi';
9
9
  import { EdgeApiClient } from './EdgeApiClient';
10
10
  import { UsageHistoryApi } from './UsageHistoryApi';
11
11
  import CreditsApi from './CreditsApi';
12
+ import CheckoutApi from './CheckoutApi';
12
13
  declare class ApiGateway {
13
14
  sdkConfiguration: SdkConfigurationApi;
14
15
  paywall: PaywallApi;
@@ -19,6 +20,7 @@ declare class ApiGateway {
19
20
  subscriptionEstimations: SubscriptionEstimationsApi;
20
21
  usageHistoryApi: UsageHistoryApi;
21
22
  credits: CreditsApi;
23
+ checkout: CheckoutApi;
22
24
  constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
23
25
  }
24
26
  export default ApiGateway;
@@ -0,0 +1,8 @@
1
+ import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
+ import { CreatePaymentSessionMutation, PaymentSessionInput } from '@stigg/api-client-js/src/generated/sdk';
3
+ declare class CheckoutApi {
4
+ private readonly client;
5
+ constructor(client: ApolloClient<NormalizedCacheObject>);
6
+ createPaymentSession(input: PaymentSessionInput): Promise<import("@apollo/client/core").FetchResult<CreatePaymentSessionMutation, Record<string, any>, Record<string, any>>>;
7
+ }
8
+ export default CheckoutApi;
@@ -1,6 +1,6 @@
1
- import { CreditBalanceSummaryInput, CreditGrantFragment, CreditsBalanceSummaryFragment, GetCreditGrantsInput, SlimSubscriptionFragmentV2Fragment, SubscriptionInvoicePreviewFragment, UsageHistoryV2Fragment, UsageHistoryV2Input } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { CreditGrantFragment, CreditsBalanceSummaryFragment, GetCreditGrantsInput, PaymentSessionFragment, SlimSubscriptionFragmentV2Fragment, SubscriptionInvoicePreviewFragment, UsageHistoryV2Fragment, UsageHistoryV2Input } from '@stigg/api-client-js/src/generated/sdk';
2
2
  import { ClientConfiguration } from './configuration';
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, PreviewNextInvoice, GetSubscriptionsParams, GetSubscriptionsResult, EnumEntitlement, GetEnumEntitlement } from './models';
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, PreviewNextInvoice, GetSubscriptionsParams, GetSubscriptionsResult, EnumEntitlement, GetEnumEntitlement, CreatePaymentSessionInput, GetCreditBalanceInput } from './models';
4
4
  import { EventNames, Events } from './services/eventEmitter';
5
5
  import { LoggerService } from './services/loggerService';
6
6
  export interface StiggClient {
@@ -37,8 +37,9 @@ export interface StiggClient {
37
37
  previewNextInvoice(previewNextInvoice: PreviewNextInvoice): Promise<SubscriptionInvoicePreviewFragment>;
38
38
  previewSubscription(previewSubscription: PreviewSubscription): Promise<SubscriptionPreviewV2>;
39
39
  getUsageHistoryV2(input: UsageHistoryV2Input): Promise<UsageHistoryV2Fragment>;
40
- getCreditBalance(input: CreditBalanceSummaryInput): Promise<CreditsBalanceSummaryFragment>;
40
+ getCreditBalance(input?: GetCreditBalanceInput): Promise<CreditsBalanceSummaryFragment>;
41
41
  getCreditGrants(input: GetCreditGrantsInput): Promise<CreditGrantFragment[]>;
42
+ createPaymentSession(input: CreatePaymentSessionInput): Promise<PaymentSessionFragment>;
42
43
  }
43
44
  export declare class Stigg implements StiggClient {
44
45
  private readonly apiGateway;
@@ -248,11 +249,17 @@ export declare class Stigg implements StiggClient {
248
249
  * @return {Promise<CreditsBalanceSummaryFragment>} the credit balance data
249
250
  * @param input - the input for the credit balance
250
251
  */
251
- getCreditBalance(input: CreditBalanceSummaryInput): Promise<CreditsBalanceSummaryFragment>;
252
+ getCreditBalance(input?: GetCreditBalanceInput): Promise<CreditsBalanceSummaryFragment>;
252
253
  /**
253
254
  * Get credit grants
254
255
  * @return {Promise<CreditGrantFragment[]>} the credit grants data
255
256
  * @param input - the input for the credit grants
256
257
  */
257
258
  getCreditGrants(input: GetCreditGrantsInput): Promise<CreditGrantFragment[]>;
259
+ /**
260
+ * Create payment session
261
+ * @return {Promise<PaymentSessionFragment>} the payment session data
262
+ * @param input - the input for the payment session
263
+ */
264
+ createPaymentSession(input: CreatePaymentSessionInput): Promise<PaymentSessionFragment>;
258
265
  }
@@ -1,4 +1,4 @@
1
- import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, SubscriptionQueryFragment, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PageInfoFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod, BudgetConfigurationInput, SubscriptionProrationBehavior } from '@stigg/api-client-js/src/generated/sdk';
1
+ import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, SubscriptionQueryFragment, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PageInfoFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment, CheckoutConfigurationFragment, TypographyConfigurationFragment, BillingAddress, ScheduleStrategy, PaymentCollectionMethod, BudgetConfigurationInput, SubscriptionProrationBehavior, PaymentSessionInput, CreditBalanceSummaryInput, StripeCheckoutCredentialsFragment, ZuoraCheckoutCredentialsFragment } from '@stigg/api-client-js/src/generated/sdk';
2
2
  export * from '@stigg/api-client-js/src/generated/sdk';
3
3
  interface Metadata {
4
4
  [key: string]: string;
@@ -370,11 +370,13 @@ export declare type CustomerPortal = {
370
370
  export declare type CheckoutStatePlan = Plan & Pick<PlanFragment, 'prices'>;
371
371
  export declare type CheckoutBillingIntegration = {
372
372
  billingIdentifier: BillingVendorIdentifier;
373
+ billingCredentials: StripeCheckoutCredentialsFragment | ZuoraCheckoutCredentialsFragment;
373
374
  credentials: {
374
- accountId: string;
375
- publicKey: string;
375
+ accountId?: string | null;
376
+ publicKey?: string | null;
376
377
  };
377
378
  };
379
+ export declare type CreatePaymentSessionInput = Omit<PaymentSessionInput, 'customerId'>;
378
380
  export declare type TypographyConfiguration = Omit<TypographyConfigurationFragment, '__typename'>;
379
381
  export declare type CheckoutConfiguration = Omit<CheckoutConfigurationFragment, '__typename'>;
380
382
  export declare type GetCheckoutStateResults = {
@@ -593,6 +595,7 @@ export declare type BillableFeature = {
593
595
  featureId: string;
594
596
  quantity: number;
595
597
  };
598
+ export declare type GetCreditBalanceInput = Omit<CreditBalanceSummaryInput, 'customerId' | 'resourceId'>;
596
599
  /** @hidden */
597
600
  export declare class CustomerModel implements Customer {
598
601
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { Stigg, StiggClient } from './clients';
2
- import { ApplySubscriptionResults, BooleanEntitlement, Coupon, CreditGrantFragment, CreditsBalanceSummaryFragment, Customer, CustomerPortal, Entitlement, EnumEntitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetEnumEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetSubscriptionsResult, MeteredEntitlement, NumericEntitlement, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
2
+ import { ApplySubscriptionResults, BooleanEntitlement, Coupon, CreditGrantFragment, CreditsBalanceSummaryFragment, Customer, CustomerPortal, Entitlement, EnumEntitlement, GetBooleanEntitlement, GetCheckoutStateResults, GetEnumEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetSubscriptionsResult, MeteredEntitlement, NumericEntitlement, PaymentSessionFragment, Paywall, SlimSubscriptionFragmentV2Fragment, Subscription, SubscriptionInvoicePreviewFragment, SubscriptionPreview, SubscriptionPreviewV2, UsageHistoryPoint, UsageHistoryV2Fragment } from './models';
3
3
  export declare class OfflineStigg extends Stigg {
4
4
  getBooleanEntitlement({ featureId, options }: GetBooleanEntitlement): BooleanEntitlement;
5
5
  getMeteredEntitlement({ featureId, options }: GetMeteredEntitlement): MeteredEntitlement;
@@ -36,4 +36,5 @@ export declare class OfflineStigg extends Stigg {
36
36
  getCustomer(): Promise<Customer>;
37
37
  getCreditBalance(): Promise<CreditsBalanceSummaryFragment>;
38
38
  getCreditGrants(): Promise<CreditGrantFragment[]>;
39
+ createPaymentSession(): Promise<PaymentSessionFragment>;
39
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "3.59.0",
3
+ "version": "3.60.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": "3.65.0",
31
+ "@stigg/api-client-js": "3.68.0",
32
32
  "cross-fetch": "^3.1.6",
33
33
  "dayjs": "^1.11.13",
34
34
  "fetch-retry": "^5.0.6",