@stigg/js-client-sdk 1.27.0 → 1.29.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
@@ -170,10 +170,13 @@ export declare type GetMeteredEntitlement = {
170
170
  };
171
171
  export declare type GetPaywall = {
172
172
  productId?: string;
173
- customerId?: string;
173
+ resourceId?: string;
174
174
  context?: WidgetType;
175
175
  billingCountryCode?: string;
176
176
  };
177
+ export declare type GetCustomerPortal = {
178
+ resourceId?: string;
179
+ };
177
180
  export declare type EntitlementsFallback = {
178
181
  [featureId: string]: BooleanEntitlementFallback | NumericEntitlementFallback | MeteredEntitlementFallback;
179
182
  };
@@ -261,6 +264,7 @@ export declare type CustomerPortal = {
261
264
  canUpgradeSubscription: boolean;
262
265
  billingPortalUrl?: string | null;
263
266
  configuration?: CustomerPortalConfiguration | null;
267
+ resource: CustomerResource | null;
264
268
  };
265
269
  export declare type PaywallConfiguration = Omit<PaywallConfigurationFragment, '__typename'>;
266
270
  export declare type PaywallCurrency = Omit<PaywallCurrencyFragment, '__typename'>;
@@ -268,8 +272,12 @@ export declare type Paywall = {
268
272
  plans: Plan[];
269
273
  configuration?: PaywallConfiguration | null;
270
274
  customer: Customer | null;
275
+ resource: CustomerResource | null;
271
276
  currency: PaywallCurrency;
272
277
  };
278
+ export declare type CustomerResource = {
279
+ id: string;
280
+ };
273
281
  export declare type Customer = {
274
282
  id: string;
275
283
  name?: string;
@@ -4,6 +4,6 @@ declare class CustomersApi {
4
4
  private readonly client;
5
5
  constructor(client: ApolloClient<NormalizedCacheObject>);
6
6
  getCustomer(customerId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerByIdQuery>>;
7
- getCustomerPortal(customerId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerPortalByRefIdQuery>>;
7
+ getCustomerPortal(customerId: string, resourceId: string | undefined): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerPortalByRefIdQuery>>;
8
8
  }
9
9
  export default CustomersApi;
@@ -4,6 +4,7 @@ import { EdgeApiClient } from './EdgeApiClient';
4
4
  export declare type GetPaywallProps = {
5
5
  productId?: string;
6
6
  customerId?: string | null;
7
+ resourceId?: string | null;
7
8
  context?: WidgetType;
8
9
  billingCountryCode?: string;
9
10
  };
@@ -11,6 +12,6 @@ declare class PaywallApi {
11
12
  private readonly client;
12
13
  private readonly edgeApiClient;
13
14
  constructor(client: ApolloClient<NormalizedCacheObject>, edgeApiClient: EdgeApiClient | null);
14
- getPaywall({ productId, customerId, context, billingCountryCode }: GetPaywallProps): Promise<import("@apollo/client/core").ApolloQueryResult<GetPaywallQuery>>;
15
+ getPaywall({ productId, customerId, resourceId, context, billingCountryCode }: GetPaywallProps): Promise<import("@apollo/client/core").ApolloQueryResult<GetPaywallQuery>>;
15
16
  }
16
17
  export default PaywallApi;
@@ -1,4 +1,4 @@
1
- import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate } from './models';
1
+ import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate, GetCustomerPortal } from './models';
2
2
  import { ClientConfiguration } from './configuration';
3
3
  import { EventNames, Events } from './services/eventEmitter';
4
4
  export interface StiggClient {
@@ -18,7 +18,7 @@ export interface StiggClient {
18
18
  waitForInitialization(): Promise<StiggClient>;
19
19
  addListener: <K extends EventNames>(eventName: K, callback: Events[K]) => void;
20
20
  removeListener: <K extends EventNames>(eventName: K, callback: Events[K]) => void;
21
- getCustomerPortal(): Promise<CustomerPortal>;
21
+ getCustomerPortal(params?: GetCustomerPortal): Promise<CustomerPortal>;
22
22
  estimateSubscription(estimateSubscription: EstimateSubscription): Promise<SubscriptionPreview>;
23
23
  estimateSubscriptionUpdate(estimateSubscriptionUpdate: EstimateSubscriptionUpdate): Promise<SubscriptionPreview>;
24
24
  }
@@ -111,7 +111,7 @@ export declare class Stigg implements StiggClient {
111
111
  *
112
112
  * @returns {Promise<Paywall>}
113
113
  */
114
- getPaywall({ productId, context, billingCountryCode }?: GetPaywall): Promise<Paywall>;
114
+ getPaywall({ productId, resourceId, context, billingCountryCode }?: GetPaywall): Promise<Paywall>;
115
115
  /**
116
116
  * Get a list of coupons
117
117
  *
@@ -129,7 +129,7 @@ export declare class Stigg implements StiggClient {
129
129
  *
130
130
  * @returns {Promise<CustomerPortal>}
131
131
  */
132
- getCustomerPortal(): Promise<CustomerPortal>;
132
+ getCustomerPortal({ resourceId }?: GetCustomerPortal): Promise<CustomerPortal>;
133
133
  /**
134
134
  * Get a list of entitlements
135
135
  *
@@ -170,10 +170,13 @@ export declare type GetMeteredEntitlement = {
170
170
  };
171
171
  export declare type GetPaywall = {
172
172
  productId?: string;
173
- customerId?: string;
173
+ resourceId?: string;
174
174
  context?: WidgetType;
175
175
  billingCountryCode?: string;
176
176
  };
177
+ export declare type GetCustomerPortal = {
178
+ resourceId?: string;
179
+ };
177
180
  export declare type EntitlementsFallback = {
178
181
  [featureId: string]: BooleanEntitlementFallback | NumericEntitlementFallback | MeteredEntitlementFallback;
179
182
  };
@@ -261,6 +264,7 @@ export declare type CustomerPortal = {
261
264
  canUpgradeSubscription: boolean;
262
265
  billingPortalUrl?: string | null;
263
266
  configuration?: CustomerPortalConfiguration | null;
267
+ resource: CustomerResource | null;
264
268
  };
265
269
  export declare type PaywallConfiguration = Omit<PaywallConfigurationFragment, '__typename'>;
266
270
  export declare type PaywallCurrency = Omit<PaywallCurrencyFragment, '__typename'>;
@@ -268,8 +272,12 @@ export declare type Paywall = {
268
272
  plans: Plan[];
269
273
  configuration?: PaywallConfiguration | null;
270
274
  customer: Customer | null;
275
+ resource: CustomerResource | null;
271
276
  currency: PaywallCurrency;
272
277
  };
278
+ export declare type CustomerResource = {
279
+ id: string;
280
+ };
273
281
  export declare type Customer = {
274
282
  id: string;
275
283
  name?: string;
@@ -1,5 +1,5 @@
1
- import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionPreviewFragment, EntitlementCheckResult, EntitlementResetPeriod as ApiEntitlementResetPeriod, FeatureType as ApiFeatureType, GetCouponsQuery, GetMockPaywallQuery } from '@stigg/api-client-js/src/generated/sdk';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, EntitlementResetPeriod, FeatureType, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
1
+ import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionPreviewFragment, EntitlementCheckResult, EntitlementResetPeriod as ApiEntitlementResetPeriod, FeatureType as ApiFeatureType, GetCouponsQuery, GetMockPaywallQuery, CustomerResourceFragment, CustomerPortalFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, CustomerPortal, CustomerResource, EntitlementResetPeriod, FeatureType, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -16,6 +16,8 @@ export declare class ModelMapper {
16
16
  mapPaywall(resultData: GetPaywallQuery): Paywall;
17
17
  mapMockPlans(resultData: GetMockPaywallQuery): Paywall;
18
18
  mapCoupons(resultData: GetCouponsQuery): Coupon[];
19
+ mapResource(resource: CustomerResourceFragment): CustomerResource;
20
+ mapCustomerPortal(customerPortal: CustomerPortalFragment): CustomerPortal;
19
21
  mapCustomer(customer: CustomerFragment): Customer;
20
22
  private mapPaymentDetails;
21
23
  private mapTotalPrice;
@@ -1,5 +1,5 @@
1
- import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionPreviewFragment, EntitlementCheckResult, EntitlementResetPeriod as ApiEntitlementResetPeriod, FeatureType as ApiFeatureType, GetCouponsQuery, GetMockPaywallQuery } from '@stigg/api-client-js/src/generated/sdk';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, EntitlementResetPeriod, FeatureType, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
1
+ import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionPreviewFragment, EntitlementCheckResult, EntitlementResetPeriod as ApiEntitlementResetPeriod, FeatureType as ApiFeatureType, GetCouponsQuery, GetMockPaywallQuery, CustomerResourceFragment, CustomerPortalFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, CustomerPortal, CustomerResource, EntitlementResetPeriod, FeatureType, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -16,6 +16,8 @@ export declare class ModelMapper {
16
16
  mapPaywall(resultData: GetPaywallQuery): Paywall;
17
17
  mapMockPlans(resultData: GetMockPaywallQuery): Paywall;
18
18
  mapCoupons(resultData: GetCouponsQuery): Coupon[];
19
+ mapResource(resource: CustomerResourceFragment): CustomerResource;
20
+ mapCustomerPortal(customerPortal: CustomerPortalFragment): CustomerPortal;
19
21
  mapCustomer(customer: CustomerFragment): Customer;
20
22
  private mapPaymentDetails;
21
23
  private mapTotalPrice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "1.27.0",
3
+ "version": "1.29.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": "0.374.2",
31
+ "@stigg/api-client-js": "0.385.0",
32
32
  "axios": "^1.2.2",
33
33
  "cross-fetch": "^3.1.4",
34
34
  "husky": "^7.0.4",