@stigg/js-client-sdk 0.36.0 → 0.38.1

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
@@ -94,6 +94,9 @@ export declare type Price = {
94
94
  displayName: string;
95
95
  } | null;
96
96
  };
97
+ export declare type SubscriptionPrice = Price & {
98
+ grossAmount: number;
99
+ };
97
100
  export declare type BasePlan = {
98
101
  displayName: string;
99
102
  id: string;
@@ -113,6 +116,13 @@ export declare type Plan = {
113
116
  product: Product;
114
117
  metadata?: Metadata | null;
115
118
  };
119
+ export declare type Coupon = {
120
+ id: string;
121
+ name: string;
122
+ description?: string | null;
123
+ discountValue: number;
124
+ metadata?: Metadata | null;
125
+ };
116
126
  export declare type Product = {
117
127
  id: string;
118
128
  displayName?: string | null;
@@ -181,7 +191,7 @@ export declare type Subscription = {
181
191
  id: string;
182
192
  status: SubscriptionStatus;
183
193
  plan: Plan;
184
- price: Price | null;
194
+ price: SubscriptionPrice | null;
185
195
  pricingType: PricingType;
186
196
  addons: SubscriptionAddon[];
187
197
  billingId?: string;
@@ -217,6 +227,10 @@ export declare type TrialedPlan = {
217
227
  productId?: string | null;
218
228
  planId?: string | null;
219
229
  };
230
+ export declare type WaitForCheckoutCompleted = {
231
+ timeoutMs?: number;
232
+ refreshOnComplete?: boolean;
233
+ };
220
234
  /** @hidden */
221
235
  export declare class CustomerModel implements Customer {
222
236
  id: string;
@@ -1,5 +1,5 @@
1
- import { CustomerFragment, EntitlementCheckResult, EntitlementFragment, EntitlementResetPeriod as ApiEntitlementResetPeriod, FeatureType as ApiFeatureType, GetPlansQuery } from '../api/generated/types';
2
- import { BooleanEntitlement, BooleanEntitlementFallback, Customer, EntitlementResetPeriod, FeatureType, MeteredEntitlement, MeteredEntitlementFallback, NumericEntitlement, NumericEntitlementFallback, Plan } from '../models';
1
+ import { CustomerFragment, EntitlementCheckResult, EntitlementFragment, EntitlementResetPeriod as ApiEntitlementResetPeriod, FeatureType as ApiFeatureType, FetchCouponsQuery, GetPlansQuery } from '../api/generated/types';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, EntitlementResetPeriod, FeatureType, MeteredEntitlement, MeteredEntitlementFallback, NumericEntitlement, NumericEntitlementFallback, Plan } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -13,7 +13,9 @@ export declare class ModelMapper {
13
13
  mapCachedEntitlement(entitlement: EntitlementFragment, currentUsage?: number, nextResetDate?: number | null): CachedEntitlement;
14
14
  mapCachedEntitlements(updatedEntitlements: EntitlementFragment[]): Map<string, CachedEntitlement>;
15
15
  mapPlans(resultData: GetPlansQuery): Plan[];
16
+ mapCoupons(resultData: FetchCouponsQuery): Coupon[];
16
17
  mapCustomer(customer: CustomerFragment): Customer;
18
+ private mapTotalPrice;
17
19
  private mapPrice;
18
20
  private mapPlan;
19
21
  private mapCompatibleAddons;
@@ -29,4 +31,5 @@ export declare class ModelMapper {
29
31
  mapFallbackNumericEntitlementResult(entitlement: NumericEntitlementFallback, decision: Decision): EntitlementCheckResult;
30
32
  mapEntitlementResult(decision: Decision, entitlement?: CachedEntitlement, requestedUsage?: number): EntitlementCheckResult;
31
33
  mapFallbackMeteredEntitlementResult(entitlement: MeteredEntitlementFallback, decision: Decision, requestedUsage?: number): EntitlementCheckResult;
34
+ private mapCoupon;
32
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "0.36.0",
3
+ "version": "0.38.1",
4
4
  "description": "Stigg client-side SDK for Browser",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",