@stigg/js-client-sdk 1.2.0 → 1.3.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.
@@ -1,8 +1,10 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
2
  import { GetMockPaywallQuery } from './generated/types';
3
+ import { GetPaywallProps } from './PaywallApi';
4
+ declare type GetMockPaywallProps = GetPaywallProps;
3
5
  declare class MockPaywallApi {
4
6
  private readonly client;
5
7
  constructor(client: ApolloClient<NormalizedCacheObject>);
6
- getMockPaywall(productId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetMockPaywallQuery>>;
8
+ getMockPaywall({ productId, customerId, context }: GetMockPaywallProps): Promise<import("@apollo/client/core").ApolloQueryResult<GetMockPaywallQuery>>;
7
9
  }
8
10
  export default MockPaywallApi;
@@ -1,10 +1,15 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
- import { GetPaywallQuery } from './generated/types';
2
+ import { GetPaywallQuery, WidgetType } from './generated/types';
3
3
  export declare const TYPOGRAPHY_CONFIGURATION: import("graphql/language/ast").DocumentNode;
4
4
  export declare const PAYWALL_CONFIGURATION: import("graphql/language/ast").DocumentNode;
5
+ export declare type GetPaywallProps = {
6
+ productId?: string;
7
+ customerId?: string | null;
8
+ context?: WidgetType;
9
+ };
5
10
  declare class PaywallApi {
6
11
  private readonly client;
7
12
  constructor(client: ApolloClient<NormalizedCacheObject>);
8
- getPaywall(productId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetPaywallQuery>>;
13
+ getPaywall({ productId, customerId, context }: GetPaywallProps): Promise<import("@apollo/client/core").ApolloQueryResult<GetPaywallQuery>>;
9
14
  }
10
15
  export default PaywallApi;
@@ -0,0 +1 @@
1
+ export declare const CUSTOMER_FRAGMENT: import("graphql/language/ast").DocumentNode;
@@ -2541,185 +2541,6 @@ export declare type FetchCouponsQuery = {
2541
2541
  }>;
2542
2542
  };
2543
2543
  };
2544
- export declare type TotalPriceFragment = {
2545
- __typename?: 'CustomerSubscriptionTotalPrice';
2546
- subTotal: {
2547
- __typename?: 'Money';
2548
- amount: number;
2549
- currency: Currency;
2550
- };
2551
- total: {
2552
- __typename?: 'Money';
2553
- amount: number;
2554
- currency: Currency;
2555
- };
2556
- };
2557
- export declare type SubscriptionFragment = {
2558
- __typename?: 'CustomerSubscription';
2559
- id: string;
2560
- startDate: any;
2561
- endDate?: any | null | undefined;
2562
- trialEndDate?: any | null | undefined;
2563
- cancellationDate?: any | null | undefined;
2564
- effectiveEndDate?: any | null | undefined;
2565
- status: SubscriptionStatus;
2566
- refId: string;
2567
- currentBillingPeriodEnd?: any | null | undefined;
2568
- additionalMetaData?: any | null | undefined;
2569
- pricingType: PricingType;
2570
- experimentInfo?: {
2571
- __typename?: 'experimentInfo';
2572
- name: string;
2573
- groupName: string;
2574
- groupType: ExperimentGroupType;
2575
- id: string;
2576
- } | null | undefined;
2577
- prices?: Array<{
2578
- __typename?: 'SubscriptionPrice';
2579
- usageLimit?: number | null | undefined;
2580
- price?: ({
2581
- __typename?: 'Price';
2582
- } & PriceFragment) | null | undefined;
2583
- }> | null | undefined;
2584
- totalPrice?: ({
2585
- __typename?: 'CustomerSubscriptionTotalPrice';
2586
- } & TotalPriceFragment) | null | undefined;
2587
- plan: {
2588
- __typename?: 'Plan';
2589
- id: string;
2590
- refId: string;
2591
- displayName: string;
2592
- description?: string | null | undefined;
2593
- additionalMetaData?: any | null | undefined;
2594
- product: {
2595
- __typename?: 'Product';
2596
- refId: string;
2597
- displayName?: string | null | undefined;
2598
- };
2599
- entitlements?: Array<{
2600
- __typename?: 'PackageEntitlement';
2601
- usageLimit?: number | null | undefined;
2602
- featureId: string;
2603
- hasUnlimitedUsage?: boolean | null | undefined;
2604
- packageId: string;
2605
- resetPeriod?: EntitlementResetPeriod | null | undefined;
2606
- feature: {
2607
- __typename?: 'Feature';
2608
- featureType: FeatureType;
2609
- meterType?: MeterType | null | undefined;
2610
- featureUnits?: string | null | undefined;
2611
- featureUnitsPlural?: string | null | undefined;
2612
- displayName: string;
2613
- description?: string | null | undefined;
2614
- refId: string;
2615
- };
2616
- }> | null | undefined;
2617
- inheritedEntitlements?: Array<{
2618
- __typename?: 'PackageEntitlement';
2619
- usageLimit?: number | null | undefined;
2620
- featureId: string;
2621
- hasUnlimitedUsage?: boolean | null | undefined;
2622
- packageId: string;
2623
- resetPeriod?: EntitlementResetPeriod | null | undefined;
2624
- feature: {
2625
- __typename?: 'Feature';
2626
- featureType: FeatureType;
2627
- meterType?: MeterType | null | undefined;
2628
- featureUnits?: string | null | undefined;
2629
- featureUnitsPlural?: string | null | undefined;
2630
- displayName: string;
2631
- description?: string | null | undefined;
2632
- refId: string;
2633
- };
2634
- }> | null | undefined;
2635
- prices?: Array<{
2636
- __typename?: 'Price';
2637
- } & PriceFragment> | null | undefined;
2638
- };
2639
- addons?: Array<{
2640
- __typename?: 'SubscriptionAddon';
2641
- id: string;
2642
- quantity: number;
2643
- addon: {
2644
- __typename?: 'Addon';
2645
- id: string;
2646
- refId: string;
2647
- displayName: string;
2648
- description?: string | null | undefined;
2649
- additionalMetaData?: any | null | undefined;
2650
- entitlements?: Array<{
2651
- __typename?: 'PackageEntitlement';
2652
- usageLimit?: number | null | undefined;
2653
- hasUnlimitedUsage?: boolean | null | undefined;
2654
- featureId: string;
2655
- feature: {
2656
- __typename?: 'Feature';
2657
- featureType: FeatureType;
2658
- meterType?: MeterType | null | undefined;
2659
- featureUnits?: string | null | undefined;
2660
- featureUnitsPlural?: string | null | undefined;
2661
- displayName: string;
2662
- description?: string | null | undefined;
2663
- refId: string;
2664
- };
2665
- }> | null | undefined;
2666
- };
2667
- }> | null | undefined;
2668
- };
2669
- export declare type PromotionalEntitlementFragment = {
2670
- __typename?: 'PromotionalEntitlement';
2671
- status: PromotionalEntitlementStatus;
2672
- usageLimit?: number | null | undefined;
2673
- featureId: string;
2674
- hasUnlimitedUsage?: boolean | null | undefined;
2675
- resetPeriod?: EntitlementResetPeriod | null | undefined;
2676
- endDate?: any | null | undefined;
2677
- isVisible: boolean;
2678
- feature: {
2679
- __typename?: 'Feature';
2680
- featureType: FeatureType;
2681
- meterType?: MeterType | null | undefined;
2682
- featureUnits?: string | null | undefined;
2683
- featureUnitsPlural?: string | null | undefined;
2684
- displayName: string;
2685
- description?: string | null | undefined;
2686
- refId: string;
2687
- };
2688
- };
2689
- export declare type CustomerFragment = {
2690
- __typename?: 'Customer';
2691
- id: string;
2692
- name?: string | null | undefined;
2693
- email?: string | null | undefined;
2694
- createdAt?: any | null | undefined;
2695
- updatedAt: any;
2696
- hasPaymentMethod: boolean;
2697
- refId: string;
2698
- additionalMetaData?: any | null | undefined;
2699
- defaultPaymentExpirationMonth?: number | null | undefined;
2700
- defaultPaymentExpirationYear?: number | null | undefined;
2701
- defaultPaymentMethodLast4Digits?: string | null | undefined;
2702
- experimentInfo?: {
2703
- __typename?: 'experimentInfo';
2704
- name: string;
2705
- groupType: ExperimentGroupType;
2706
- groupName: string;
2707
- id: string;
2708
- } | null | undefined;
2709
- trialedPlans?: Array<{
2710
- __typename?: 'TrialedPlan';
2711
- productId?: string | null | undefined;
2712
- productRefId?: string | null | undefined;
2713
- planRefId?: string | null | undefined;
2714
- planId?: string | null | undefined;
2715
- }> | null | undefined;
2716
- promotionalEntitlements: Array<{
2717
- __typename?: 'PromotionalEntitlement';
2718
- } & PromotionalEntitlementFragment>;
2719
- subscriptions?: Array<{
2720
- __typename?: 'CustomerSubscription';
2721
- } & SubscriptionFragment> | null | undefined;
2722
- };
2723
2544
  export declare type CustomerPortalEntitlementFragment = {
2724
2545
  __typename?: 'Entitlement';
2725
2546
  isGranted: boolean;
@@ -3156,6 +2977,9 @@ export declare type GetPaywallQuery = {
3156
2977
  configuration?: ({
3157
2978
  __typename?: 'PaywallConfiguration';
3158
2979
  } & PaywallConfigurationFragment) | null | undefined;
2980
+ customer?: ({
2981
+ __typename?: 'Customer';
2982
+ } & CustomerFragment) | null | undefined;
3159
2983
  };
3160
2984
  };
3161
2985
  export declare type SdkConfigurationQueryVariables = Exact<{
@@ -3169,6 +2993,185 @@ export declare type SdkConfigurationQuery = {
3169
2993
  isWidgetWatermarkEnabled?: boolean | null | undefined;
3170
2994
  } | null | undefined;
3171
2995
  };
2996
+ export declare type TotalPriceFragment = {
2997
+ __typename?: 'CustomerSubscriptionTotalPrice';
2998
+ subTotal: {
2999
+ __typename?: 'Money';
3000
+ amount: number;
3001
+ currency: Currency;
3002
+ };
3003
+ total: {
3004
+ __typename?: 'Money';
3005
+ amount: number;
3006
+ currency: Currency;
3007
+ };
3008
+ };
3009
+ export declare type SubscriptionFragment = {
3010
+ __typename?: 'CustomerSubscription';
3011
+ id: string;
3012
+ startDate: any;
3013
+ endDate?: any | null | undefined;
3014
+ trialEndDate?: any | null | undefined;
3015
+ cancellationDate?: any | null | undefined;
3016
+ effectiveEndDate?: any | null | undefined;
3017
+ status: SubscriptionStatus;
3018
+ refId: string;
3019
+ currentBillingPeriodEnd?: any | null | undefined;
3020
+ additionalMetaData?: any | null | undefined;
3021
+ pricingType: PricingType;
3022
+ experimentInfo?: {
3023
+ __typename?: 'experimentInfo';
3024
+ name: string;
3025
+ groupName: string;
3026
+ groupType: ExperimentGroupType;
3027
+ id: string;
3028
+ } | null | undefined;
3029
+ prices?: Array<{
3030
+ __typename?: 'SubscriptionPrice';
3031
+ usageLimit?: number | null | undefined;
3032
+ price?: ({
3033
+ __typename?: 'Price';
3034
+ } & PriceFragment) | null | undefined;
3035
+ }> | null | undefined;
3036
+ totalPrice?: ({
3037
+ __typename?: 'CustomerSubscriptionTotalPrice';
3038
+ } & TotalPriceFragment) | null | undefined;
3039
+ plan: {
3040
+ __typename?: 'Plan';
3041
+ id: string;
3042
+ refId: string;
3043
+ displayName: string;
3044
+ description?: string | null | undefined;
3045
+ additionalMetaData?: any | null | undefined;
3046
+ product: {
3047
+ __typename?: 'Product';
3048
+ refId: string;
3049
+ displayName?: string | null | undefined;
3050
+ };
3051
+ entitlements?: Array<{
3052
+ __typename?: 'PackageEntitlement';
3053
+ usageLimit?: number | null | undefined;
3054
+ featureId: string;
3055
+ hasUnlimitedUsage?: boolean | null | undefined;
3056
+ packageId: string;
3057
+ resetPeriod?: EntitlementResetPeriod | null | undefined;
3058
+ feature: {
3059
+ __typename?: 'Feature';
3060
+ featureType: FeatureType;
3061
+ meterType?: MeterType | null | undefined;
3062
+ featureUnits?: string | null | undefined;
3063
+ featureUnitsPlural?: string | null | undefined;
3064
+ displayName: string;
3065
+ description?: string | null | undefined;
3066
+ refId: string;
3067
+ };
3068
+ }> | null | undefined;
3069
+ inheritedEntitlements?: Array<{
3070
+ __typename?: 'PackageEntitlement';
3071
+ usageLimit?: number | null | undefined;
3072
+ featureId: string;
3073
+ hasUnlimitedUsage?: boolean | null | undefined;
3074
+ packageId: string;
3075
+ resetPeriod?: EntitlementResetPeriod | null | undefined;
3076
+ feature: {
3077
+ __typename?: 'Feature';
3078
+ featureType: FeatureType;
3079
+ meterType?: MeterType | null | undefined;
3080
+ featureUnits?: string | null | undefined;
3081
+ featureUnitsPlural?: string | null | undefined;
3082
+ displayName: string;
3083
+ description?: string | null | undefined;
3084
+ refId: string;
3085
+ };
3086
+ }> | null | undefined;
3087
+ prices?: Array<{
3088
+ __typename?: 'Price';
3089
+ } & PriceFragment> | null | undefined;
3090
+ };
3091
+ addons?: Array<{
3092
+ __typename?: 'SubscriptionAddon';
3093
+ id: string;
3094
+ quantity: number;
3095
+ addon: {
3096
+ __typename?: 'Addon';
3097
+ id: string;
3098
+ refId: string;
3099
+ displayName: string;
3100
+ description?: string | null | undefined;
3101
+ additionalMetaData?: any | null | undefined;
3102
+ entitlements?: Array<{
3103
+ __typename?: 'PackageEntitlement';
3104
+ usageLimit?: number | null | undefined;
3105
+ hasUnlimitedUsage?: boolean | null | undefined;
3106
+ featureId: string;
3107
+ feature: {
3108
+ __typename?: 'Feature';
3109
+ featureType: FeatureType;
3110
+ meterType?: MeterType | null | undefined;
3111
+ featureUnits?: string | null | undefined;
3112
+ featureUnitsPlural?: string | null | undefined;
3113
+ displayName: string;
3114
+ description?: string | null | undefined;
3115
+ refId: string;
3116
+ };
3117
+ }> | null | undefined;
3118
+ };
3119
+ }> | null | undefined;
3120
+ };
3121
+ export declare type PromotionalEntitlementFragment = {
3122
+ __typename?: 'PromotionalEntitlement';
3123
+ status: PromotionalEntitlementStatus;
3124
+ usageLimit?: number | null | undefined;
3125
+ featureId: string;
3126
+ hasUnlimitedUsage?: boolean | null | undefined;
3127
+ resetPeriod?: EntitlementResetPeriod | null | undefined;
3128
+ endDate?: any | null | undefined;
3129
+ isVisible: boolean;
3130
+ feature: {
3131
+ __typename?: 'Feature';
3132
+ featureType: FeatureType;
3133
+ meterType?: MeterType | null | undefined;
3134
+ featureUnits?: string | null | undefined;
3135
+ featureUnitsPlural?: string | null | undefined;
3136
+ displayName: string;
3137
+ description?: string | null | undefined;
3138
+ refId: string;
3139
+ };
3140
+ };
3141
+ export declare type CustomerFragment = {
3142
+ __typename?: 'Customer';
3143
+ id: string;
3144
+ name?: string | null | undefined;
3145
+ email?: string | null | undefined;
3146
+ createdAt?: any | null | undefined;
3147
+ updatedAt: any;
3148
+ hasPaymentMethod: boolean;
3149
+ refId: string;
3150
+ additionalMetaData?: any | null | undefined;
3151
+ defaultPaymentExpirationMonth?: number | null | undefined;
3152
+ defaultPaymentExpirationYear?: number | null | undefined;
3153
+ defaultPaymentMethodLast4Digits?: string | null | undefined;
3154
+ experimentInfo?: {
3155
+ __typename?: 'experimentInfo';
3156
+ name: string;
3157
+ groupType: ExperimentGroupType;
3158
+ groupName: string;
3159
+ id: string;
3160
+ } | null | undefined;
3161
+ trialedPlans?: Array<{
3162
+ __typename?: 'TrialedPlan';
3163
+ productId?: string | null | undefined;
3164
+ productRefId?: string | null | undefined;
3165
+ planRefId?: string | null | undefined;
3166
+ planId?: string | null | undefined;
3167
+ }> | null | undefined;
3168
+ promotionalEntitlements: Array<{
3169
+ __typename?: 'PromotionalEntitlement';
3170
+ } & PromotionalEntitlementFragment>;
3171
+ subscriptions?: Array<{
3172
+ __typename?: 'CustomerSubscription';
3173
+ } & SubscriptionFragment> | null | undefined;
3174
+ };
3172
3175
  export declare type PriceFragment = {
3173
3176
  __typename?: 'Price';
3174
3177
  billingModel: BillingModel;
package/dist/client.d.ts CHANGED
@@ -101,7 +101,7 @@ export declare class Stigg implements StiggClient {
101
101
  *
102
102
  * @returns {Promise<Paywall>}
103
103
  */
104
- getPaywall({ productId }?: GetPaywall): Promise<Paywall>;
104
+ getPaywall({ productId, context }?: GetPaywall): Promise<Paywall>;
105
105
  /**
106
106
  * Get a list of coupons
107
107
  *