@stigg/js-client-sdk 2.18.0 → 2.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/api/ApiGateway.d.ts +2 -0
- package/dist/api/SubscriptionEstimationsApi.d.ts +3 -2
- package/dist/api/SubscriptionsApi.d.ts +17 -0
- package/dist/client.d.ts +22 -1
- package/dist/index.js +236 -228
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +65 -2
- package/dist/src/api/ApiGateway.d.ts +2 -0
- package/dist/src/api/SubscriptionEstimationsApi.d.ts +3 -2
- package/dist/src/api/SubscriptionsApi.d.ts +17 -0
- package/dist/src/client.d.ts +22 -1
- package/dist/src/models.d.ts +65 -2
- package/dist/src/utils/ModelMapper.d.ts +4 -2
- package/dist/utils/ModelMapper.d.ts +4 -2
- package/package.json +2 -2
package/dist/models.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment,
|
|
2
|
-
export { PricingType, SubscriptionStatus, PromotionalEntitlementStatus, Currency, BillingPeriod, BillingModel, TrialPeriodUnits, ExperimentGroupType, WidgetType, FontWeight, Alignment, SubscriptionScheduleType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PriceTierFragment, } from '@stigg/api-client-js/src/generated/sdk';
|
|
1
|
+
import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
export { PricingType, SubscriptionStatus, PromotionalEntitlementStatus, Currency, BillingPeriod, BillingModel, TrialPeriodUnits, ExperimentGroupType, WidgetType, FontWeight, Alignment, SubscriptionScheduleType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, SubscriptionInvoiceFragment, PaymentCollection, BillingVendorIdentifier, PriceTierFragment, TiersMode, } from '@stigg/api-client-js/src/generated/sdk';
|
|
3
3
|
interface Metadata {
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
@@ -150,6 +150,38 @@ export declare type GetCustomerPortal = {
|
|
|
150
150
|
resourceId?: string;
|
|
151
151
|
productId?: string;
|
|
152
152
|
};
|
|
153
|
+
export declare type GetCheckoutState = {
|
|
154
|
+
planId: string;
|
|
155
|
+
billingCountryCode?: string;
|
|
156
|
+
resourceId?: string | null;
|
|
157
|
+
};
|
|
158
|
+
export declare type CheckoutAddon = {
|
|
159
|
+
addonId: string;
|
|
160
|
+
quantity?: number;
|
|
161
|
+
};
|
|
162
|
+
export declare type ApplySubscription = {
|
|
163
|
+
planId: string;
|
|
164
|
+
paymentMethodId?: string;
|
|
165
|
+
resourceId?: string;
|
|
166
|
+
addons?: CheckoutAddon[];
|
|
167
|
+
startDate?: Date;
|
|
168
|
+
billingId?: string;
|
|
169
|
+
billingPeriod?: BillingPeriod;
|
|
170
|
+
skipTrial?: boolean;
|
|
171
|
+
unitQuantity?: number;
|
|
172
|
+
billableFeatures?: BillableFeature[];
|
|
173
|
+
metadata?: Metadata | null;
|
|
174
|
+
billingInformation?: SubscriptionBillingInfo;
|
|
175
|
+
promotionCode?: string;
|
|
176
|
+
billingCountryCode?: string;
|
|
177
|
+
};
|
|
178
|
+
export declare type SubscriptionBillingInfo = {
|
|
179
|
+
taxRateIds?: string[];
|
|
180
|
+
taxPercentage?: number;
|
|
181
|
+
};
|
|
182
|
+
export declare type ApplySubscriptionResults = {
|
|
183
|
+
subscription?: Subscription;
|
|
184
|
+
};
|
|
153
185
|
export declare type EntitlementsFallback = {
|
|
154
186
|
[featureId: string]: BooleanEntitlementFallback | NumericEntitlementFallback | MeteredEntitlementFallback;
|
|
155
187
|
};
|
|
@@ -247,6 +279,22 @@ export declare type CustomerPortal = {
|
|
|
247
279
|
configuration?: CustomerPortalConfiguration | null;
|
|
248
280
|
resource: CustomerResource | null;
|
|
249
281
|
};
|
|
282
|
+
export declare type CheckoutStatePlan = Plan & Pick<PlanFragment, 'prices'>;
|
|
283
|
+
export declare type CheckoutBillingIntegration = {
|
|
284
|
+
billingIdentifier: BillingVendorIdentifier;
|
|
285
|
+
credentials: {
|
|
286
|
+
accountId: string;
|
|
287
|
+
publicKey: string;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
export declare type GetCheckoutStateResults = {
|
|
291
|
+
setupSecret: string;
|
|
292
|
+
plan: CheckoutStatePlan;
|
|
293
|
+
customer: Customer;
|
|
294
|
+
resource: CustomerResource | null;
|
|
295
|
+
activeSubscription?: Subscription | null;
|
|
296
|
+
billingIntegration: CheckoutBillingIntegration;
|
|
297
|
+
};
|
|
250
298
|
export declare type PaywallConfiguration = Omit<PaywallConfigurationFragment, '__typename'>;
|
|
251
299
|
export declare type PaywallCurrency = Omit<PaywallCurrencyFragment, '__typename'>;
|
|
252
300
|
export declare type PaywallCalculatedPricePoint = Omit<PaywallCalculatedPricePointsFragment, '__typename'>;
|
|
@@ -345,6 +393,8 @@ export interface SubscriptionPreview {
|
|
|
345
393
|
billingPeriodRange: DateRange;
|
|
346
394
|
proration?: SubscriptionPreviewProration;
|
|
347
395
|
subscription?: SubscriptionPricePreview;
|
|
396
|
+
isPlanDowngrade?: boolean;
|
|
397
|
+
hasScheduledUpdates?: boolean;
|
|
348
398
|
}
|
|
349
399
|
export declare type EstimateSubscription = {
|
|
350
400
|
customerId: string;
|
|
@@ -367,6 +417,19 @@ export declare type EstimateSubscriptionUpdate = {
|
|
|
367
417
|
addons?: SubscriptionEstimationAddon[];
|
|
368
418
|
promotionCode?: string;
|
|
369
419
|
};
|
|
420
|
+
export declare type PreviewSubscription = {
|
|
421
|
+
customerId: string;
|
|
422
|
+
planId: string;
|
|
423
|
+
resourceId?: string;
|
|
424
|
+
addons?: SubscriptionEstimationAddon[];
|
|
425
|
+
startDate?: Date;
|
|
426
|
+
billingPeriod?: BillingPeriod;
|
|
427
|
+
billingCountryCode?: string;
|
|
428
|
+
unitQuantity?: number;
|
|
429
|
+
billableFeatures?: BillableFeature[];
|
|
430
|
+
billingInformation?: SubscriptionBillingInfo;
|
|
431
|
+
promotionCode?: string;
|
|
432
|
+
};
|
|
370
433
|
export declare type FetchUsageHistory = {
|
|
371
434
|
customerId: string;
|
|
372
435
|
resourceId?: string;
|
|
@@ -3,12 +3,14 @@ import SdkConfigurationApi from './SdkConfigurationApi';
|
|
|
3
3
|
import PaywallApi from './PaywallApi';
|
|
4
4
|
import CustomersApi from './CustomersApi';
|
|
5
5
|
import CouponsApi from './CouponsApi';
|
|
6
|
+
import SubscriptionsApi from './SubscriptionsApi';
|
|
6
7
|
import SubscriptionEstimationsApi from './SubscriptionEstimationsApi';
|
|
7
8
|
import MockPaywallApi from './MockPaywallApi';
|
|
8
9
|
import { EdgeApiClient } from './EdgeApiClient';
|
|
9
10
|
declare class ApiGateway {
|
|
10
11
|
sdkConfiguration: SdkConfigurationApi;
|
|
11
12
|
paywall: PaywallApi;
|
|
13
|
+
subscriptions: SubscriptionsApi;
|
|
12
14
|
mockPaywall: MockPaywallApi;
|
|
13
15
|
customers: CustomersApi;
|
|
14
16
|
coupons: CouponsApi;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
|
|
2
|
-
import { EstimateSubscription, EstimateSubscriptionUpdate } from '../models';
|
|
3
|
-
import { EstimateSubscriptionMutation, EstimateSubscriptionUpdateMutation } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
import { PreviewSubscription, EstimateSubscription, EstimateSubscriptionUpdate } from '../models';
|
|
3
|
+
import { EstimateSubscriptionMutation, EstimateSubscriptionUpdateMutation, PreviewSubscriptionMutation } from '@stigg/api-client-js/src/generated/sdk';
|
|
4
4
|
declare class SubscriptionEstimationsApi {
|
|
5
5
|
private readonly client;
|
|
6
6
|
constructor(client: ApolloClient<NormalizedCacheObject>);
|
|
7
7
|
estimateSubscription(input: EstimateSubscription): Promise<import("@apollo/client/core").FetchResult<EstimateSubscriptionMutation, Record<string, any>, Record<string, any>>>;
|
|
8
8
|
estimateSubscriptionUpdate(input: EstimateSubscriptionUpdate): Promise<import("@apollo/client/core").FetchResult<EstimateSubscriptionUpdateMutation, Record<string, any>, Record<string, any>>>;
|
|
9
|
+
previewSubscription(input: PreviewSubscription): Promise<import("@apollo/client/core").FetchResult<PreviewSubscriptionMutation, Record<string, any>, Record<string, any>>>;
|
|
9
10
|
}
|
|
10
11
|
export default SubscriptionEstimationsApi;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CheckoutStateQuery, ApplySubscriptionMutation } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
|
|
3
|
+
import { ApplySubscription, GetCheckoutState } from '../models';
|
|
4
|
+
export declare type ApplySubscriptionParams = ApplySubscription & {
|
|
5
|
+
customerId: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type GetCheckoutStateParams = GetCheckoutState & {
|
|
8
|
+
customerId: string;
|
|
9
|
+
};
|
|
10
|
+
declare class SubscriptionsApi {
|
|
11
|
+
private readonly client;
|
|
12
|
+
constructor(client: ApolloClient<NormalizedCacheObject>);
|
|
13
|
+
applySubscription({ customerId, planId, paymentMethodId, addons, billableFeatures, billingCountryCode, billingId, billingInformation, billingPeriod, metadata, promotionCode, resourceId, skipTrial, startDate, unitQuantity, }: ApplySubscriptionParams): Promise<import("@apollo/client/core").FetchResult<ApplySubscriptionMutation, Record<string, any>, Record<string, any>>>;
|
|
14
|
+
checkoutState({ customerId, resourceId, planId, billingCountryCode }: GetCheckoutStateParams): Promise<import("@apollo/client/core").ApolloQueryResult<CheckoutStateQuery>>;
|
|
15
|
+
private mapBillingInformation;
|
|
16
|
+
}
|
|
17
|
+
export default SubscriptionsApi;
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate, GetCustomerPortal, GetActiveSubscriptions, FetchUsageHistory, UsageHistoryPoint } from './models';
|
|
2
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 } from './models';
|
|
3
3
|
import { EventNames, Events } from './services/eventEmitter';
|
|
4
4
|
export interface StiggClient {
|
|
5
5
|
isCustomerLoaded: boolean;
|
|
@@ -15,6 +15,8 @@ export interface StiggClient {
|
|
|
15
15
|
clearResource: () => void;
|
|
16
16
|
getPaywall: (params?: GetPaywall) => Promise<Paywall>;
|
|
17
17
|
getCustomer: () => Promise<Customer>;
|
|
18
|
+
getCheckoutState: (params: GetCheckoutState) => Promise<GetCheckoutStateResults>;
|
|
19
|
+
applySubscription: (params: ApplySubscription) => Promise<ApplySubscriptionResults>;
|
|
18
20
|
getActiveSubscriptions: (params?: GetActiveSubscriptions) => Promise<Subscription[]>;
|
|
19
21
|
getCoupons(): Promise<Coupon[]>;
|
|
20
22
|
getEntitlements: (resourceId?: string) => Promise<Entitlement[]>;
|
|
@@ -26,6 +28,7 @@ export interface StiggClient {
|
|
|
26
28
|
getCustomerPortal(params?: GetCustomerPortal): Promise<CustomerPortal>;
|
|
27
29
|
estimateSubscription(estimateSubscription: EstimateSubscription): Promise<SubscriptionPreview>;
|
|
28
30
|
estimateSubscriptionUpdate(estimateSubscriptionUpdate: EstimateSubscriptionUpdate): Promise<SubscriptionPreview>;
|
|
31
|
+
previewSubscription(previewSubscription: PreviewSubscription): Promise<SubscriptionPreview>;
|
|
29
32
|
}
|
|
30
33
|
export declare class Stigg implements StiggClient {
|
|
31
34
|
private readonly apiGateway;
|
|
@@ -145,6 +148,18 @@ export declare class Stigg implements StiggClient {
|
|
|
145
148
|
* @returns {Promise<CustomerPortal>}
|
|
146
149
|
*/
|
|
147
150
|
getCustomerPortal({ resourceId, productId }?: GetCustomerPortal): Promise<CustomerPortal>;
|
|
151
|
+
/**
|
|
152
|
+
* Get customer checkout details
|
|
153
|
+
* @param {GetCheckoutState} parameters
|
|
154
|
+
* @returns {Promise<GetCheckoutStateResults>}
|
|
155
|
+
*/
|
|
156
|
+
getCheckoutState({ planId, resourceId, billingCountryCode, }: GetCheckoutState): Promise<GetCheckoutStateResults>;
|
|
157
|
+
/**
|
|
158
|
+
* Get customer checkout details
|
|
159
|
+
* @param {ApplySubscription} parameters
|
|
160
|
+
* @returns {Promise<ApplySubscriptionResults>}
|
|
161
|
+
*/
|
|
162
|
+
applySubscription(applySubscriptionInput: ApplySubscription): Promise<ApplySubscriptionResults>;
|
|
148
163
|
/**
|
|
149
164
|
* Fetch customer usage history of a feature.
|
|
150
165
|
* @return {Promise<UsageHistoryPoint[]>} Array of usage history as data points.
|
|
@@ -169,6 +184,12 @@ export declare class Stigg implements StiggClient {
|
|
|
169
184
|
* @param {EstimateSubscriptionUpdate} estimateSubscriptionUpdate
|
|
170
185
|
*/
|
|
171
186
|
estimateSubscriptionUpdate(estimateSubscriptionUpdate: EstimateSubscriptionUpdate): Promise<SubscriptionPreview>;
|
|
187
|
+
/**
|
|
188
|
+
* Estimate checkout
|
|
189
|
+
* @return {Promise<SubscriptionPreview>} Preview of the subscription.
|
|
190
|
+
* @param {PreviewSubscription} previewSubscription
|
|
191
|
+
*/
|
|
192
|
+
previewSubscription(previewSubscription: PreviewSubscription): Promise<SubscriptionPreview>;
|
|
172
193
|
/**
|
|
173
194
|
* Waits for a subscription to be activated after a completed checkout.
|
|
174
195
|
* This method should be called on page load after the customer is redirected to the success URL.
|
package/dist/src/models.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment,
|
|
2
|
-
export { PricingType, SubscriptionStatus, PromotionalEntitlementStatus, Currency, BillingPeriod, BillingModel, TrialPeriodUnits, ExperimentGroupType, WidgetType, FontWeight, Alignment, SubscriptionScheduleType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PriceTierFragment, } from '@stigg/api-client-js/src/generated/sdk';
|
|
1
|
+
import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, PaywallCalculatedPricePointsFragment, SubscriptionInvoiceFragment, PaymentCollection, PlanFragment, BillingVendorIdentifier, TiersMode, SubscriptionFutureUpdateDataFragment, PriceTierFragment, TotalPriceFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
2
|
+
export { PricingType, SubscriptionStatus, PromotionalEntitlementStatus, Currency, BillingPeriod, BillingModel, TrialPeriodUnits, ExperimentGroupType, WidgetType, FontWeight, Alignment, SubscriptionScheduleType, CustomerPortalSubscriptionScheduledUpdateDataFragment, DiscountType, DiscountDurationType, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason, SubscriptionInvoiceFragment, PaymentCollection, BillingVendorIdentifier, PriceTierFragment, TiersMode, } from '@stigg/api-client-js/src/generated/sdk';
|
|
3
3
|
interface Metadata {
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
@@ -150,6 +150,38 @@ export declare type GetCustomerPortal = {
|
|
|
150
150
|
resourceId?: string;
|
|
151
151
|
productId?: string;
|
|
152
152
|
};
|
|
153
|
+
export declare type GetCheckoutState = {
|
|
154
|
+
planId: string;
|
|
155
|
+
billingCountryCode?: string;
|
|
156
|
+
resourceId?: string | null;
|
|
157
|
+
};
|
|
158
|
+
export declare type CheckoutAddon = {
|
|
159
|
+
addonId: string;
|
|
160
|
+
quantity?: number;
|
|
161
|
+
};
|
|
162
|
+
export declare type ApplySubscription = {
|
|
163
|
+
planId: string;
|
|
164
|
+
paymentMethodId?: string;
|
|
165
|
+
resourceId?: string;
|
|
166
|
+
addons?: CheckoutAddon[];
|
|
167
|
+
startDate?: Date;
|
|
168
|
+
billingId?: string;
|
|
169
|
+
billingPeriod?: BillingPeriod;
|
|
170
|
+
skipTrial?: boolean;
|
|
171
|
+
unitQuantity?: number;
|
|
172
|
+
billableFeatures?: BillableFeature[];
|
|
173
|
+
metadata?: Metadata | null;
|
|
174
|
+
billingInformation?: SubscriptionBillingInfo;
|
|
175
|
+
promotionCode?: string;
|
|
176
|
+
billingCountryCode?: string;
|
|
177
|
+
};
|
|
178
|
+
export declare type SubscriptionBillingInfo = {
|
|
179
|
+
taxRateIds?: string[];
|
|
180
|
+
taxPercentage?: number;
|
|
181
|
+
};
|
|
182
|
+
export declare type ApplySubscriptionResults = {
|
|
183
|
+
subscription?: Subscription;
|
|
184
|
+
};
|
|
153
185
|
export declare type EntitlementsFallback = {
|
|
154
186
|
[featureId: string]: BooleanEntitlementFallback | NumericEntitlementFallback | MeteredEntitlementFallback;
|
|
155
187
|
};
|
|
@@ -247,6 +279,22 @@ export declare type CustomerPortal = {
|
|
|
247
279
|
configuration?: CustomerPortalConfiguration | null;
|
|
248
280
|
resource: CustomerResource | null;
|
|
249
281
|
};
|
|
282
|
+
export declare type CheckoutStatePlan = Plan & Pick<PlanFragment, 'prices'>;
|
|
283
|
+
export declare type CheckoutBillingIntegration = {
|
|
284
|
+
billingIdentifier: BillingVendorIdentifier;
|
|
285
|
+
credentials: {
|
|
286
|
+
accountId: string;
|
|
287
|
+
publicKey: string;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
export declare type GetCheckoutStateResults = {
|
|
291
|
+
setupSecret: string;
|
|
292
|
+
plan: CheckoutStatePlan;
|
|
293
|
+
customer: Customer;
|
|
294
|
+
resource: CustomerResource | null;
|
|
295
|
+
activeSubscription?: Subscription | null;
|
|
296
|
+
billingIntegration: CheckoutBillingIntegration;
|
|
297
|
+
};
|
|
250
298
|
export declare type PaywallConfiguration = Omit<PaywallConfigurationFragment, '__typename'>;
|
|
251
299
|
export declare type PaywallCurrency = Omit<PaywallCurrencyFragment, '__typename'>;
|
|
252
300
|
export declare type PaywallCalculatedPricePoint = Omit<PaywallCalculatedPricePointsFragment, '__typename'>;
|
|
@@ -345,6 +393,8 @@ export interface SubscriptionPreview {
|
|
|
345
393
|
billingPeriodRange: DateRange;
|
|
346
394
|
proration?: SubscriptionPreviewProration;
|
|
347
395
|
subscription?: SubscriptionPricePreview;
|
|
396
|
+
isPlanDowngrade?: boolean;
|
|
397
|
+
hasScheduledUpdates?: boolean;
|
|
348
398
|
}
|
|
349
399
|
export declare type EstimateSubscription = {
|
|
350
400
|
customerId: string;
|
|
@@ -367,6 +417,19 @@ export declare type EstimateSubscriptionUpdate = {
|
|
|
367
417
|
addons?: SubscriptionEstimationAddon[];
|
|
368
418
|
promotionCode?: string;
|
|
369
419
|
};
|
|
420
|
+
export declare type PreviewSubscription = {
|
|
421
|
+
customerId: string;
|
|
422
|
+
planId: string;
|
|
423
|
+
resourceId?: string;
|
|
424
|
+
addons?: SubscriptionEstimationAddon[];
|
|
425
|
+
startDate?: Date;
|
|
426
|
+
billingPeriod?: BillingPeriod;
|
|
427
|
+
billingCountryCode?: string;
|
|
428
|
+
unitQuantity?: number;
|
|
429
|
+
billableFeatures?: BillableFeature[];
|
|
430
|
+
billingInformation?: SubscriptionBillingInfo;
|
|
431
|
+
promotionCode?: string;
|
|
432
|
+
};
|
|
370
433
|
export declare type FetchUsageHistory = {
|
|
371
434
|
customerId: string;
|
|
372
435
|
resourceId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CustomerFragment,
|
|
2
|
-
import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, CustomerPortal, CustomerResource, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint } from '../models';
|
|
1
|
+
import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment } 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 } from '../models';
|
|
3
3
|
import CachedEntitlement from '../services/cachedEntitlement';
|
|
4
4
|
import { Decision } from '../services/entitlementDecisionService';
|
|
5
5
|
export declare class ModelMapper {
|
|
@@ -15,6 +15,8 @@ export declare class ModelMapper {
|
|
|
15
15
|
mapCoupons(resultData: GetCouponsQuery): Coupon[];
|
|
16
16
|
mapResource(resource: CustomerResourceFragment): CustomerResource;
|
|
17
17
|
mapCustomerPortal(customerPortal: CustomerPortalFragment): CustomerPortal;
|
|
18
|
+
mapCheckoutState(checkoutState: CheckoutStateFragment): GetCheckoutStateResults;
|
|
19
|
+
mapApplySubscriptionResults: (graphApplySubscriptionResults: ApplySubscriptionMutation) => ApplySubscriptionResults;
|
|
18
20
|
mapCustomer(customer: CustomerFragment, subscriptions: SubscriptionFragment[]): Customer;
|
|
19
21
|
private mapPaymentDetails;
|
|
20
22
|
private mapPriceWithTotalPrice;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CustomerFragment,
|
|
2
|
-
import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, CustomerPortal, CustomerResource, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount, UsageHistoryPoint } from '../models';
|
|
1
|
+
import { ApplySubscriptionMutation, CustomerFragment, CustomerPortalFragment, CustomerResourceFragment, EntitlementCheckResult, EntitlementFragment, CheckoutStateFragment, GetCouponsQuery, GetMockPaywallQuery, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, UsageHistoryFragment } 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 } from '../models';
|
|
3
3
|
import CachedEntitlement from '../services/cachedEntitlement';
|
|
4
4
|
import { Decision } from '../services/entitlementDecisionService';
|
|
5
5
|
export declare class ModelMapper {
|
|
@@ -15,6 +15,8 @@ export declare class ModelMapper {
|
|
|
15
15
|
mapCoupons(resultData: GetCouponsQuery): Coupon[];
|
|
16
16
|
mapResource(resource: CustomerResourceFragment): CustomerResource;
|
|
17
17
|
mapCustomerPortal(customerPortal: CustomerPortalFragment): CustomerPortal;
|
|
18
|
+
mapCheckoutState(checkoutState: CheckoutStateFragment): GetCheckoutStateResults;
|
|
19
|
+
mapApplySubscriptionResults: (graphApplySubscriptionResults: ApplySubscriptionMutation) => ApplySubscriptionResults;
|
|
18
20
|
mapCustomer(customer: CustomerFragment, subscriptions: SubscriptionFragment[]): Customer;
|
|
19
21
|
private mapPaymentDetails;
|
|
20
22
|
private mapPriceWithTotalPrice;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigg/js-client-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.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": "0.
|
|
31
|
+
"@stigg/api-client-js": "0.548.0",
|
|
32
32
|
"cross-fetch": "^3.1.6",
|
|
33
33
|
"fetch-retry": "^5.0.6",
|
|
34
34
|
"husky": "^7.0.4",
|