@stigg/js-client-sdk 3.21.2 → 3.22.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
@@ -171,6 +171,7 @@ export declare type CheckoutAddon = {
171
171
  export declare type ApplySubscription = {
172
172
  planId: string;
173
173
  paymentMethodId?: string;
174
+ payingCustomerId?: string;
174
175
  resourceId?: string;
175
176
  addons?: CheckoutAddon[];
176
177
  startDate?: Date;
@@ -262,6 +263,7 @@ export declare type Subscription = {
262
263
  id: string;
263
264
  status: SubscriptionStatus;
264
265
  resourceId?: string;
266
+ payingCustomer?: SlimCustomer | null;
265
267
  plan: Plan;
266
268
  /** @deprecated use {@link prices} instead with {@link totalPrice} */
267
269
  price: SubscriptionPrice | null;
@@ -361,6 +363,16 @@ export declare type Customer = {
361
363
  /** @deprecated use {@link StiggClient.getActiveSubscriptions} instead with filter for {@link SubscriptionStatus.InTrial} */
362
364
  getActiveTrials(): Subscription[];
363
365
  };
366
+ export declare type SlimCustomer = {
367
+ id: string;
368
+ name?: string;
369
+ email?: string;
370
+ createdAt: Date;
371
+ updatedAt: Date;
372
+ billingId?: string;
373
+ metadata?: Metadata | null;
374
+ awsMarketplaceCustomerId?: string | null;
375
+ };
364
376
  export declare type CustomerState = Omit<Customer, 'getActiveSubscriptions' | 'getActivePromotionalEntitlements' | 'getActiveTrials'>;
365
377
  export declare type TrialedPlan = {
366
378
  productId?: string | null;
@@ -10,7 +10,7 @@ export declare type GetCheckoutStateParams = GetCheckoutState & {
10
10
  declare class SubscriptionsApi {
11
11
  private readonly client;
12
12
  constructor(client: ApolloClient<NormalizedCacheObject>);
13
- applySubscription({ customerId, planId, paymentMethodId, addons, billableFeatures, billingInformation, billingCountryCode, billingId, billingPeriod, metadata, promotionCode, resourceId, skipTrial, startDate, unitQuantity, scheduleStrategy, }: ApplySubscriptionParams): Promise<import("@apollo/client/core").FetchResult<ApplySubscriptionMutation, Record<string, any>, Record<string, any>>>;
13
+ applySubscription({ customerId, payingCustomerId, planId, paymentMethodId, addons, billableFeatures, billingInformation, billingCountryCode, billingId, billingPeriod, metadata, promotionCode, resourceId, skipTrial, startDate, unitQuantity, scheduleStrategy, }: ApplySubscriptionParams): Promise<import("@apollo/client/core").FetchResult<ApplySubscriptionMutation, Record<string, any>, Record<string, any>>>;
14
14
  checkoutState({ customerId, resourceId, planId, billingCountryCode }: GetCheckoutStateParams): Promise<import("@apollo/client/core").ApolloQueryResult<GetCheckoutStateQuery>>;
15
15
  private mapBillingInformation;
16
16
  }
@@ -171,6 +171,7 @@ export declare type CheckoutAddon = {
171
171
  export declare type ApplySubscription = {
172
172
  planId: string;
173
173
  paymentMethodId?: string;
174
+ payingCustomerId?: string;
174
175
  resourceId?: string;
175
176
  addons?: CheckoutAddon[];
176
177
  startDate?: Date;
@@ -262,6 +263,7 @@ export declare type Subscription = {
262
263
  id: string;
263
264
  status: SubscriptionStatus;
264
265
  resourceId?: string;
266
+ payingCustomer?: SlimCustomer | null;
265
267
  plan: Plan;
266
268
  /** @deprecated use {@link prices} instead with {@link totalPrice} */
267
269
  price: SubscriptionPrice | null;
@@ -361,6 +363,16 @@ export declare type Customer = {
361
363
  /** @deprecated use {@link StiggClient.getActiveSubscriptions} instead with filter for {@link SubscriptionStatus.InTrial} */
362
364
  getActiveTrials(): Subscription[];
363
365
  };
366
+ export declare type SlimCustomer = {
367
+ id: string;
368
+ name?: string;
369
+ email?: string;
370
+ createdAt: Date;
371
+ updatedAt: Date;
372
+ billingId?: string;
373
+ metadata?: Metadata | null;
374
+ awsMarketplaceCustomerId?: string | null;
375
+ };
364
376
  export declare type CustomerState = Omit<Customer, 'getActiveSubscriptions' | 'getActivePromotionalEntitlements' | 'getActiveTrials'>;
365
377
  export declare type TrialedPlan = {
366
378
  productId?: string | null;
@@ -1,5 +1,5 @@
1
- import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment } from '@stigg/api-client-js/src/generated/sdk';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice } from '../models';
1
+ import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment, SlimCustomerFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice, SlimCustomer } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -26,6 +26,7 @@ export declare class ModelMapper {
26
26
  private mapDefaultTrialConfig;
27
27
  private mapPackageEntitlement;
28
28
  private mapPromotionalEntitlement;
29
+ mapSlimCustomer: (customer: SlimCustomerFragment) => SlimCustomer;
29
30
  mapSubscription(subscription: SubscriptionFragment): Subscription;
30
31
  private mapLatestInvoice;
31
32
  private mapDate;
@@ -1,5 +1,5 @@
1
- import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment } from '@stigg/api-client-js/src/generated/sdk';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice } from '../models';
1
+ import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment, SubscriptionPreviewV2Fragment, SubscriptionPreviewInvoiceFragment, ImmediateSubscriptionPreviewInvoiceFragment, SlimCustomerFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, ApplySubscriptionResults, Coupon, Customer, CustomerPortal, CustomerResource, GetCheckoutStateResults, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint, SubscriptionPreviewV2, SubscriptionPreviewInvoice, SlimCustomer } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -26,6 +26,7 @@ export declare class ModelMapper {
26
26
  private mapDefaultTrialConfig;
27
27
  private mapPackageEntitlement;
28
28
  private mapPromotionalEntitlement;
29
+ mapSlimCustomer: (customer: SlimCustomerFragment) => SlimCustomer;
29
30
  mapSubscription(subscription: SubscriptionFragment): Subscription;
30
31
  private mapLatestInvoice;
31
32
  private mapDate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "3.21.2",
3
+ "version": "3.22.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": "2.85.7",
31
+ "@stigg/api-client-js": "2.100.2",
32
32
  "cross-fetch": "^3.1.6",
33
33
  "fetch-retry": "^5.0.6",
34
34
  "husky": "^7.0.4",