@stigg/js-client-sdk 1.37.0 → 2.1.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
@@ -1,32 +1,8 @@
1
- import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, SubscriptionBillingInfo, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment } 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, } 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, SubscriptionBillingInfo, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason } 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, } from '@stigg/api-client-js/src/generated/sdk';
3
3
  interface Metadata {
4
4
  [key: string]: string;
5
5
  }
6
- export declare enum AccessDeniedReason {
7
- InvalidFeatureType = "InvalidFeatureType",
8
- CustomerNotFound = "CustomerNotFound",
9
- FeatureNotFound = "FeatureNotFound",
10
- NoActiveSubscriptions = "NoActiveSubscriptions",
11
- CustomerNotEntitledForFeature = "CustomerNotEntitledForFeature",
12
- RequestedUsageExceedsLimit = "RequestedUsageExceedsLimit",
13
- Unknown = "Unknown"
14
- }
15
- export declare enum FeatureType {
16
- Boolean = "Boolean",
17
- Numeric = "Numeric"
18
- }
19
- export declare enum MeterType {
20
- Fluctuating = "Fluctuating",
21
- Incremental = "Incremental",
22
- None = "None"
23
- }
24
- export declare enum EntitlementResetPeriod {
25
- Daily = "Daily",
26
- Hourly = "Hourly",
27
- Monthly = "Monthly",
28
- Weekly = "Weekly"
29
- }
30
6
  export declare type EntitlementFeature = {
31
7
  id: string;
32
8
  featureType: FeatureType;
@@ -44,17 +20,6 @@ export declare type BaseEntitlement = {
44
20
  accessDeniedReason?: AccessDeniedReason;
45
21
  feature?: EntitlementFeature;
46
22
  };
47
- export declare type DowngradeChangeVariables = {
48
- addonRefIds?: string;
49
- billingPeriod?: BillingPeriod;
50
- downgradePlanRefId: string;
51
- };
52
- export declare type BillingPeriodChangeVariables = {
53
- billingPeriod?: BillingPeriod;
54
- };
55
- export declare type UnitAmountChangeVariables = {
56
- newUnitAmount?: number;
57
- };
58
23
  export interface BooleanEntitlement extends BaseEntitlement {
59
24
  }
60
25
  export interface NumericEntitlement extends BaseEntitlement {
@@ -7,8 +7,8 @@ declare type EdgeApiClientConfiguration = {
7
7
  enableEdge: boolean;
8
8
  };
9
9
  export declare class EdgeApiClient {
10
+ private readonly config;
10
11
  private readonly dynamicData;
11
- private readonly httpClient;
12
12
  private constructor();
13
13
  static create(config: EdgeApiClientConfiguration, dynamicData: {
14
14
  customerToken?: string | null;
@@ -1,32 +1,8 @@
1
- import { BillingModel, BillingPeriod, Currency, PricingType, PromotionalEntitlementStatus, SubscriptionStatus, TrialPeriodUnits, ExperimentGroupType, CustomerPortalEntitlementFragment, CustomerPortalPromotionalEntitlementFragment, CustomerPortalSubscriptionFragment, CustomerPortalSubscriptionAddonFragment, CustomerPortalBillingInformationFragment, PaywallConfigurationFragment, CustomerPortalConfigurationFragment, WidgetType, CustomerPortalSubscriptionScheduledUpdateDataFragment, SubscriptionBillingInfo, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment } 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, } 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, SubscriptionBillingInfo, DiscountType, DiscountDurationType, PackageEntitlementFragment, PaywallCurrencyFragment, FeatureType, MeterType, EntitlementResetPeriod, AccessDeniedReason } 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, } from '@stigg/api-client-js/src/generated/sdk';
3
3
  interface Metadata {
4
4
  [key: string]: string;
5
5
  }
6
- export declare enum AccessDeniedReason {
7
- InvalidFeatureType = "InvalidFeatureType",
8
- CustomerNotFound = "CustomerNotFound",
9
- FeatureNotFound = "FeatureNotFound",
10
- NoActiveSubscriptions = "NoActiveSubscriptions",
11
- CustomerNotEntitledForFeature = "CustomerNotEntitledForFeature",
12
- RequestedUsageExceedsLimit = "RequestedUsageExceedsLimit",
13
- Unknown = "Unknown"
14
- }
15
- export declare enum FeatureType {
16
- Boolean = "Boolean",
17
- Numeric = "Numeric"
18
- }
19
- export declare enum MeterType {
20
- Fluctuating = "Fluctuating",
21
- Incremental = "Incremental",
22
- None = "None"
23
- }
24
- export declare enum EntitlementResetPeriod {
25
- Daily = "Daily",
26
- Hourly = "Hourly",
27
- Monthly = "Monthly",
28
- Weekly = "Weekly"
29
- }
30
6
  export declare type EntitlementFeature = {
31
7
  id: string;
32
8
  featureType: FeatureType;
@@ -44,17 +20,6 @@ export declare type BaseEntitlement = {
44
20
  accessDeniedReason?: AccessDeniedReason;
45
21
  feature?: EntitlementFeature;
46
22
  };
47
- export declare type DowngradeChangeVariables = {
48
- addonRefIds?: string;
49
- billingPeriod?: BillingPeriod;
50
- downgradePlanRefId: string;
51
- };
52
- export declare type BillingPeriodChangeVariables = {
53
- billingPeriod?: BillingPeriod;
54
- };
55
- export declare type UnitAmountChangeVariables = {
56
- newUnitAmount?: number;
57
- };
58
23
  export interface BooleanEntitlement extends BaseEntitlement {
59
24
  }
60
25
  export interface NumericEntitlement extends BaseEntitlement {
@@ -1,5 +1,5 @@
1
- import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionFragment, 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, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
1
+ import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, EntitlementCheckResult, GetCouponsQuery, GetMockPaywallQuery, CustomerResourceFragment, CustomerPortalFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, CustomerPortal, CustomerResource, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -7,9 +7,6 @@ export declare class ModelMapper {
7
7
  mapNumericEntitlement(entitlement: CachedEntitlement, decision: Decision): NumericEntitlement;
8
8
  mapMeteredEntitlement(entitlement: CachedEntitlement, decision: Decision, requestedUsage?: number): MeteredEntitlement;
9
9
  mapEntitlement(entitlement: CachedEntitlement, decision: Decision, requestedUsage?: number): BooleanEntitlement;
10
- mapFeatureType(featureType: ApiFeatureType): FeatureType;
11
- mapEntitlementResetPeriod(resetPeriod: ApiEntitlementResetPeriod): EntitlementResetPeriod;
12
- mapApiEntitlementResetPeriod(resetPeriod: EntitlementResetPeriod): ApiEntitlementResetPeriod;
13
10
  mapCachedEntitlement(entitlement: EntitlementFragment, currentUsage?: number, nextResetDate?: number | null): CachedEntitlement;
14
11
  mapCachedEntitlements(updatedEntitlements: EntitlementFragment[]): Map<string, CachedEntitlement>;
15
12
  mapPlans(resultData: GetPaywallQuery): Plan[];
@@ -29,7 +26,6 @@ export declare class ModelMapper {
29
26
  private mapSubscription;
30
27
  private mapDate;
31
28
  private mapAddon;
32
- private mapAccessDeniedReason;
33
29
  private getResetPeriodData;
34
30
  mapFallbackBooleanEntitlementResult(entitlement: BooleanEntitlementFallback, decision: Decision): EntitlementCheckResult;
35
31
  mapFallbackNumericEntitlementResult(entitlement: NumericEntitlementFallback, decision: Decision): EntitlementCheckResult;
@@ -0,0 +1,3 @@
1
+ import 'cross-fetch/polyfill';
2
+ export declare const plainFetch: typeof fetch;
3
+ export declare const fetchWithRetry: (input: RequestInfo, init?: import("fetch-retry").RequestInitWithRetry | undefined) => Promise<Response>;
@@ -1,5 +1,5 @@
1
- import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionFragment, 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, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
1
+ import { CustomerFragment, EntitlementFragment, GetPaywallQuery, SubscriptionFragment, SubscriptionPreviewFragment, EntitlementCheckResult, GetCouponsQuery, GetMockPaywallQuery, CustomerResourceFragment, CustomerPortalFragment } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { BooleanEntitlement, BooleanEntitlementFallback, Coupon, Customer, CustomerPortal, CustomerResource, MeteredEntitlement, MeteredEntitlementFallback, Money, NumericEntitlement, NumericEntitlementFallback, Paywall, Plan, Subscription, SubscriptionPreview, SubscriptionPreviewDiscount } from '../models';
3
3
  import CachedEntitlement from '../services/cachedEntitlement';
4
4
  import { Decision } from '../services/entitlementDecisionService';
5
5
  export declare class ModelMapper {
@@ -7,9 +7,6 @@ export declare class ModelMapper {
7
7
  mapNumericEntitlement(entitlement: CachedEntitlement, decision: Decision): NumericEntitlement;
8
8
  mapMeteredEntitlement(entitlement: CachedEntitlement, decision: Decision, requestedUsage?: number): MeteredEntitlement;
9
9
  mapEntitlement(entitlement: CachedEntitlement, decision: Decision, requestedUsage?: number): BooleanEntitlement;
10
- mapFeatureType(featureType: ApiFeatureType): FeatureType;
11
- mapEntitlementResetPeriod(resetPeriod: ApiEntitlementResetPeriod): EntitlementResetPeriod;
12
- mapApiEntitlementResetPeriod(resetPeriod: EntitlementResetPeriod): ApiEntitlementResetPeriod;
13
10
  mapCachedEntitlement(entitlement: EntitlementFragment, currentUsage?: number, nextResetDate?: number | null): CachedEntitlement;
14
11
  mapCachedEntitlements(updatedEntitlements: EntitlementFragment[]): Map<string, CachedEntitlement>;
15
12
  mapPlans(resultData: GetPaywallQuery): Plan[];
@@ -29,7 +26,6 @@ export declare class ModelMapper {
29
26
  private mapSubscription;
30
27
  private mapDate;
31
28
  private mapAddon;
32
- private mapAccessDeniedReason;
33
29
  private getResetPeriodData;
34
30
  mapFallbackBooleanEntitlementResult(entitlement: BooleanEntitlementFallback, decision: Decision): EntitlementCheckResult;
35
31
  mapFallbackNumericEntitlementResult(entitlement: NumericEntitlementFallback, decision: Decision): EntitlementCheckResult;
@@ -0,0 +1,4 @@
1
+ /// <reference types="fetch-retry" />
2
+ import 'cross-fetch/polyfill';
3
+ export declare const plainFetch: typeof fetch;
4
+ export declare const fetchWithRetry: (input: RequestInfo, init?: import("fetch-retry").RequestInitWithRetry | undefined) => Promise<Response>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigg/js-client-sdk",
3
- "version": "1.37.0",
3
+ "version": "2.1.0",
4
4
  "description": "Stigg client-side SDK for Browser",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "@apollo/client": "^3.4.17",
30
30
  "@sentry/browser": "^7.11.1",
31
31
  "@stigg/api-client-js": "0.424.2",
32
- "axios": "^1.2.2",
33
- "cross-fetch": "^3.1.4",
32
+ "cross-fetch": "^3.1.6",
33
+ "fetch-retry": "^5.0.6",
34
34
  "husky": "^7.0.4",
35
35
  "lint-staged": "^12.0.2",
36
36
  "lodash": "^4.17.21",
@@ -71,4 +71,4 @@
71
71
  "eslint --cache"
72
72
  ]
73
73
  }
74
- }
74
+ }