@stigg/js-client-sdk 3.18.0 → 3.19.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
@@ -146,6 +146,9 @@ export declare type GetPaywall = {
146
146
  billingCountryCode?: string;
147
147
  includeHiddenPlans?: boolean;
148
148
  };
149
+ export declare type GetSubscription = {
150
+ subscriptionId: string;
151
+ };
149
152
  export declare type GetActiveSubscriptions = {
150
153
  resourceId?: string | string[];
151
154
  };
@@ -1,11 +1,12 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
- import { GetCustomerPortalByRefIdQuery, GetCustomerByIdQuery, GetActiveSubscriptionsQuery, GetUsageHistoryQuery } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { GetCustomerPortalByRefIdQuery, GetCustomerByIdQuery, GetActiveSubscriptionsQuery, GetSubscriptionQuery, GetUsageHistoryQuery } from '@stigg/api-client-js/src/generated/sdk';
3
3
  import { FetchUsageHistory } from '../models';
4
4
  declare class CustomersApi {
5
5
  private readonly client;
6
6
  constructor(client: ApolloClient<NormalizedCacheObject>);
7
7
  getCustomer(customerId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerByIdQuery>>;
8
8
  getActiveSubscriptions(customerId: string, resourceId?: string | string[]): Promise<import("@apollo/client/core").ApolloQueryResult<GetActiveSubscriptionsQuery>>;
9
+ getSubscription(subscriptionId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetSubscriptionQuery>>;
9
10
  getCustomerPortal(customerId: string, resourceId: string | undefined, productId: string | undefined): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerPortalByRefIdQuery>>;
10
11
  fetchUsageHistory({ customerId, resourceId, endDate, startDate, featureId }: FetchUsageHistory): Promise<import("@apollo/client/core").ApolloQueryResult<GetUsageHistoryQuery>>;
11
12
  }
@@ -1,5 +1,5 @@
1
1
  import { ClientConfiguration } from './configuration';
2
- import { BooleanEntitlement, Coupon, Customer, CustomerPortal, Entitlement, EstimateSubscription, EstimateSubscriptionUpdate, FetchUsageHistory, GetActiveSubscriptions, GetBooleanEntitlement, GetCheckoutStateResults, GetCheckoutState, GetCustomerPortal, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Paywall, Subscription, SubscriptionPreview, UsageHistoryPoint, WaitForCheckoutCompleted, ApplySubscription, ApplySubscriptionResults, PreviewSubscription, SubscriptionPreviewV2 } from './models';
2
+ 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 } from './models';
3
3
  import { EventNames, Events } from './services/eventEmitter';
4
4
  export interface StiggClient {
5
5
  isCustomerLoaded: boolean;
@@ -18,6 +18,7 @@ export interface StiggClient {
18
18
  getCheckoutState: (params: GetCheckoutState) => Promise<GetCheckoutStateResults>;
19
19
  applySubscription: (params: ApplySubscription) => Promise<ApplySubscriptionResults>;
20
20
  getActiveSubscriptions: (params?: GetActiveSubscriptions) => Promise<Subscription[]>;
21
+ getSubscription(params: GetSubscription): Promise<Subscription>;
21
22
  getCoupons(): Promise<Coupon[]>;
22
23
  getEntitlements: (resourceId?: string) => Promise<Entitlement[]>;
23
24
  refresh: () => Promise<void>;
@@ -202,4 +203,10 @@ export declare class Stigg implements StiggClient {
202
203
  */
203
204
  waitForCheckoutCompleted({ timeoutMs, refreshOnComplete, }?: WaitForCheckoutCompleted): Promise<Subscription | null>;
204
205
  getActiveSubscriptions({ resourceId }?: GetActiveSubscriptions): Promise<Subscription[]>;
206
+ /**
207
+ * Get subscription
208
+ * @return {Promise<Subscription>} the subscription data
209
+ * @param subscriptionId - subscription id
210
+ */
211
+ getSubscription({ subscriptionId }: GetSubscription): Promise<Subscription>;
205
212
  }
@@ -146,6 +146,9 @@ export declare type GetPaywall = {
146
146
  billingCountryCode?: string;
147
147
  includeHiddenPlans?: boolean;
148
148
  };
149
+ export declare type GetSubscription = {
150
+ subscriptionId: string;
151
+ };
149
152
  export declare type GetActiveSubscriptions = {
150
153
  resourceId?: string | string[];
151
154
  };
@@ -25,7 +25,7 @@ export declare class ModelMapper {
25
25
  private mapCompatibleAddons;
26
26
  private mapPackageEntitlement;
27
27
  private mapPromotionalEntitlement;
28
- private mapSubscription;
28
+ mapSubscription(subscription: SubscriptionFragment): Subscription;
29
29
  private mapLatestInvoice;
30
30
  private mapDate;
31
31
  private mapAddon;
@@ -25,7 +25,7 @@ export declare class ModelMapper {
25
25
  private mapCompatibleAddons;
26
26
  private mapPackageEntitlement;
27
27
  private mapPromotionalEntitlement;
28
- private mapSubscription;
28
+ mapSubscription(subscription: SubscriptionFragment): Subscription;
29
29
  private mapLatestInvoice;
30
30
  private mapDate;
31
31
  private mapAddon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "3.18.0",
3
+ "version": "3.19.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": "1.222.0",
31
+ "@stigg/api-client-js": "1.233.0",
32
32
  "cross-fetch": "^3.1.6",
33
33
  "fetch-retry": "^5.0.6",
34
34
  "husky": "^7.0.4",