@stigg/react-sdk 7.21.0 → 7.22.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/index.d.mts CHANGED
@@ -661,45 +661,41 @@ type EnumEntitlementGuardProps = GetEnumEntitlement & {
661
661
  };
662
662
  declare function EnumEntitlementGuard({ noAccessComponent, children, ...rest }: EnumEntitlementGuardProps): JSX.Element;
663
663
 
664
+ interface CreditBalanceData {
665
+ currentBalance: number;
666
+ currencyId?: string;
667
+ totalConsumed?: number;
668
+ totalGranted?: number;
669
+ displayName?: string;
670
+ units?: {
671
+ singular?: string | null;
672
+ plural?: string | null;
673
+ } | null;
674
+ symbol?: string | null;
675
+ }
676
+ type OnAddCreditsCallbackFn = (balance: CreditBalanceData) => void | Promise<void>;
677
+
664
678
  interface GetCreditBalanceParams {
665
679
  currencyId: string;
666
680
  }
667
681
  declare function useCreditBalance(params: GetCreditBalanceParams): {
668
- balance: {
669
- currentBalance: number;
670
- totalConsumed: number;
671
- totalGranted: number;
672
- currencyId: string;
673
- displayName: string;
674
- units: {
675
- __typename?: "Units" | undefined;
676
- singular?: string | null | undefined;
677
- plural?: string | null | undefined;
678
- } | null | undefined;
679
- symbol: string | null | undefined;
680
- } | {
681
- currencyId: string;
682
- currentBalance: number;
683
- totalConsumed: number;
684
- totalGranted: number;
685
- displayName?: undefined;
686
- units?: undefined;
687
- symbol?: undefined;
688
- } | null;
682
+ balance: CreditBalanceData | null;
689
683
  isLoading: boolean;
690
684
  error: Error | null;
691
685
  };
692
686
 
693
687
  type CreditBalanceProps = GetCreditBalanceParams & {
694
- localization?: CreditBalanceLocalization;
688
+ localization?: Partial<CreditBalanceLocalization>;
695
689
  decimalPlaces?: number | null;
696
690
  showUnits?: boolean;
697
691
  showSymbol?: boolean;
692
+ onAddCredits?: OnAddCreditsCallbackFn;
698
693
  };
699
694
  type CreditBalanceLocalization = {
700
695
  title: string;
696
+ addCredits: string;
701
697
  };
702
- declare function CreditBalance({ currencyId, localization, decimalPlaces, showUnits, showSymbol, }: CreditBalanceProps): JSX.Element;
698
+ declare function CreditBalance({ currencyId, localization, decimalPlaces, showUnits, showSymbol, onAddCredits, }: CreditBalanceProps): JSX.Element;
703
699
 
704
700
  type CreditUsageChartLocalization = {
705
701
  title: string;
@@ -720,16 +716,18 @@ declare function useCreditUsage(params: GetCreditUsageInput): {
720
716
  };
721
717
 
722
718
  type CreditUtilizationProps = GetCreditBalanceParams & {
723
- localization?: CreditUtilizationLocalization;
719
+ localization?: Partial<CreditUtilizationLocalization>;
724
720
  decimalPlaces?: number | null;
725
721
  showUnits?: boolean;
726
722
  showSymbol?: boolean;
723
+ onAddCredits?: OnAddCreditsCallbackFn;
727
724
  };
728
725
  type CreditUtilizationLocalization = {
729
726
  title: string;
730
727
  remaining: string;
728
+ addCredits: string;
731
729
  };
732
- declare function CreditUtilization({ currencyId, localization, decimalPlaces, showUnits, showSymbol, }: CreditUtilizationProps): JSX.Element;
730
+ declare function CreditUtilization({ currencyId, localization, decimalPlaces, showUnits, showSymbol, onAddCredits, }: CreditUtilizationProps): JSX.Element;
733
731
 
734
732
  type CreditGrant = Pick<CreditGrantFragment, 'grantId' | 'amount' | 'comment' | 'currencyId' | 'effectiveAt' | 'expireAt' | 'grantType' | 'consumedAmount' | 'createdAt' | 'updatedAt' | 'automaticRechargeConfigurationId'>;
735
733
  declare enum CreditGrantStatus {
@@ -988,4 +986,4 @@ declare function StatusChip({ variant, label, className, size, ...props }: Statu
988
986
 
989
987
  declare const mapCreditGrantStatusToVariant: (status: CreditGrantStatus) => StatusChipVariant;
990
988
 
991
- export { AddonsList, AutoRechargeStatus, type AutoRechargeStatusLocalization, type AutoRechargeStatusProps, AutomaticRechargeConfig, AutomaticRechargeConfigForm, type AutomaticRechargeConfigFormProps, type AutomaticRechargeConfigLocalization, type AutomaticRechargeConfigProps, type AutomaticRechargeConfiguration, type AutomaticRechargeFormData, type AutomaticRechargeFormErrors, type BillingInformation, BooleanEntitlementGuard, Checkout, type CheckoutContainerProps, type CheckoutLocalization, type CheckoutMockProps, type CheckoutProps, type CheckoutProviderProps, type CheckoutResult, type CheckoutState, CheckoutStepKey, type CheckoutTheme, CreditBalance, type CreditBalanceProps, CreditGrants, type CreditGrantsLocalization, type CreditGrantsProps, CreditUsageChart, CreditUtilization, type CreditUtilizationLocalization, type CreditUtilizationProps, type CurrentPlanParams, type CurrentSubscriptionOverride, type CurrentSubscriptionOverrideFn, CustomerPortal, CustomerPortalIntentionType, type CustomerPortalLocalization, type CustomerPortalProps, CustomerPortalProvider, type CustomerPortalSection, type CustomerPortalTheme, CustomerUsageData, type CustomerUsageDataProps, EmptyState, EnumEntitlementGuard, ErrorState, type FontVariant, GenericTable, type GenericTableProps, type GetCreditBalanceParams, type GetCreditGrantsParams, type HeadCell, type HorizontalAlignment, InvoicesSection, MeteredEntitlementGuard, type MockCheckoutPreviewCallback, type MockCheckoutStateCallback, NumericEntitlementGuard, type OnAddonChangeCallback, type OnBeforeStepChangeCallback, type OnBillableFeatureChangeCallback, type OnBuyMoreCallbackFn, type OnCheckoutCompletedParams, type OnCheckoutParams, type OnManageSubscriptionFn, type OnPlanSelectedCallbackFn, PaymentDetailsSection, PaywallContainer as Paywall, type PaywallData, type PaywallLocalization, type PaywallPlan, type PaywallContainerProps as PaywallProps, type PixelWidth, type PlanPriceText, Promotions, ProvisionStatus, type SelectDefaultTierIndexFn, type ShouldHidePlanFn, StatusChip, type StatusChipColors, type StatusChipVariant, StiggContext, type StiggContextValue, StiggProvider, type StiggProviderProps, type StiggTheme, SubscribeIntentionType, SubscriptionsOverview, type SubscriptionsOverviewProps, type TableAlignment, type TaxDetailsInput, type TextAlignment, type CustomizedTheme as Theme, type UpdateAutomaticRechargeConfigParams, formatDateOnly, formatDateTime, mapCreditGrantStatusToVariant, useActiveSubscriptions, useAutomaticRechargeForm, useBooleanEntitlement, useCreditBalance, useCreditGrants, useCreditUsage, useCustomerPortal, useEnumEntitlement, useMeteredEntitlement, useNumericEntitlement, usePaywall, useStiggContext, useWaitForCheckoutCompleted, validateAutomaticRechargeForm };
989
+ export { AddonsList, AutoRechargeStatus, type AutoRechargeStatusLocalization, type AutoRechargeStatusProps, AutomaticRechargeConfig, AutomaticRechargeConfigForm, type AutomaticRechargeConfigFormProps, type AutomaticRechargeConfigLocalization, type AutomaticRechargeConfigProps, type AutomaticRechargeConfiguration, type AutomaticRechargeFormData, type AutomaticRechargeFormErrors, type BillingInformation, BooleanEntitlementGuard, Checkout, type CheckoutContainerProps, type CheckoutLocalization, type CheckoutMockProps, type CheckoutProps, type CheckoutProviderProps, type CheckoutResult, type CheckoutState, CheckoutStepKey, type CheckoutTheme, CreditBalance, type CreditBalanceData, type CreditBalanceProps, CreditGrants, type CreditGrantsLocalization, type CreditGrantsProps, CreditUsageChart, CreditUtilization, type CreditUtilizationLocalization, type CreditUtilizationProps, type CurrentPlanParams, type CurrentSubscriptionOverride, type CurrentSubscriptionOverrideFn, CustomerPortal, CustomerPortalIntentionType, type CustomerPortalLocalization, type CustomerPortalProps, CustomerPortalProvider, type CustomerPortalSection, type CustomerPortalTheme, CustomerUsageData, type CustomerUsageDataProps, EmptyState, EnumEntitlementGuard, ErrorState, type FontVariant, GenericTable, type GenericTableProps, type GetCreditBalanceParams, type GetCreditGrantsParams, type HeadCell, type HorizontalAlignment, InvoicesSection, MeteredEntitlementGuard, type MockCheckoutPreviewCallback, type MockCheckoutStateCallback, NumericEntitlementGuard, type OnAddCreditsCallbackFn, type OnAddonChangeCallback, type OnBeforeStepChangeCallback, type OnBillableFeatureChangeCallback, type OnBuyMoreCallbackFn, type OnCheckoutCompletedParams, type OnCheckoutParams, type OnManageSubscriptionFn, type OnPlanSelectedCallbackFn, PaymentDetailsSection, PaywallContainer as Paywall, type PaywallData, type PaywallLocalization, type PaywallPlan, type PaywallContainerProps as PaywallProps, type PixelWidth, type PlanPriceText, Promotions, ProvisionStatus, type SelectDefaultTierIndexFn, type ShouldHidePlanFn, StatusChip, type StatusChipColors, type StatusChipVariant, StiggContext, type StiggContextValue, StiggProvider, type StiggProviderProps, type StiggTheme, SubscribeIntentionType, SubscriptionsOverview, type SubscriptionsOverviewProps, type TableAlignment, type TaxDetailsInput, type TextAlignment, type CustomizedTheme as Theme, type UpdateAutomaticRechargeConfigParams, formatDateOnly, formatDateTime, mapCreditGrantStatusToVariant, useActiveSubscriptions, useAutomaticRechargeForm, useBooleanEntitlement, useCreditBalance, useCreditGrants, useCreditUsage, useCustomerPortal, useEnumEntitlement, useMeteredEntitlement, useNumericEntitlement, usePaywall, useStiggContext, useWaitForCheckoutCompleted, validateAutomaticRechargeForm };
package/dist/index.d.ts CHANGED
@@ -661,45 +661,41 @@ type EnumEntitlementGuardProps = GetEnumEntitlement & {
661
661
  };
662
662
  declare function EnumEntitlementGuard({ noAccessComponent, children, ...rest }: EnumEntitlementGuardProps): JSX.Element;
663
663
 
664
+ interface CreditBalanceData {
665
+ currentBalance: number;
666
+ currencyId?: string;
667
+ totalConsumed?: number;
668
+ totalGranted?: number;
669
+ displayName?: string;
670
+ units?: {
671
+ singular?: string | null;
672
+ plural?: string | null;
673
+ } | null;
674
+ symbol?: string | null;
675
+ }
676
+ type OnAddCreditsCallbackFn = (balance: CreditBalanceData) => void | Promise<void>;
677
+
664
678
  interface GetCreditBalanceParams {
665
679
  currencyId: string;
666
680
  }
667
681
  declare function useCreditBalance(params: GetCreditBalanceParams): {
668
- balance: {
669
- currentBalance: number;
670
- totalConsumed: number;
671
- totalGranted: number;
672
- currencyId: string;
673
- displayName: string;
674
- units: {
675
- __typename?: "Units" | undefined;
676
- singular?: string | null | undefined;
677
- plural?: string | null | undefined;
678
- } | null | undefined;
679
- symbol: string | null | undefined;
680
- } | {
681
- currencyId: string;
682
- currentBalance: number;
683
- totalConsumed: number;
684
- totalGranted: number;
685
- displayName?: undefined;
686
- units?: undefined;
687
- symbol?: undefined;
688
- } | null;
682
+ balance: CreditBalanceData | null;
689
683
  isLoading: boolean;
690
684
  error: Error | null;
691
685
  };
692
686
 
693
687
  type CreditBalanceProps = GetCreditBalanceParams & {
694
- localization?: CreditBalanceLocalization;
688
+ localization?: Partial<CreditBalanceLocalization>;
695
689
  decimalPlaces?: number | null;
696
690
  showUnits?: boolean;
697
691
  showSymbol?: boolean;
692
+ onAddCredits?: OnAddCreditsCallbackFn;
698
693
  };
699
694
  type CreditBalanceLocalization = {
700
695
  title: string;
696
+ addCredits: string;
701
697
  };
702
- declare function CreditBalance({ currencyId, localization, decimalPlaces, showUnits, showSymbol, }: CreditBalanceProps): JSX.Element;
698
+ declare function CreditBalance({ currencyId, localization, decimalPlaces, showUnits, showSymbol, onAddCredits, }: CreditBalanceProps): JSX.Element;
703
699
 
704
700
  type CreditUsageChartLocalization = {
705
701
  title: string;
@@ -720,16 +716,18 @@ declare function useCreditUsage(params: GetCreditUsageInput): {
720
716
  };
721
717
 
722
718
  type CreditUtilizationProps = GetCreditBalanceParams & {
723
- localization?: CreditUtilizationLocalization;
719
+ localization?: Partial<CreditUtilizationLocalization>;
724
720
  decimalPlaces?: number | null;
725
721
  showUnits?: boolean;
726
722
  showSymbol?: boolean;
723
+ onAddCredits?: OnAddCreditsCallbackFn;
727
724
  };
728
725
  type CreditUtilizationLocalization = {
729
726
  title: string;
730
727
  remaining: string;
728
+ addCredits: string;
731
729
  };
732
- declare function CreditUtilization({ currencyId, localization, decimalPlaces, showUnits, showSymbol, }: CreditUtilizationProps): JSX.Element;
730
+ declare function CreditUtilization({ currencyId, localization, decimalPlaces, showUnits, showSymbol, onAddCredits, }: CreditUtilizationProps): JSX.Element;
733
731
 
734
732
  type CreditGrant = Pick<CreditGrantFragment, 'grantId' | 'amount' | 'comment' | 'currencyId' | 'effectiveAt' | 'expireAt' | 'grantType' | 'consumedAmount' | 'createdAt' | 'updatedAt' | 'automaticRechargeConfigurationId'>;
735
733
  declare enum CreditGrantStatus {
@@ -988,4 +986,4 @@ declare function StatusChip({ variant, label, className, size, ...props }: Statu
988
986
 
989
987
  declare const mapCreditGrantStatusToVariant: (status: CreditGrantStatus) => StatusChipVariant;
990
988
 
991
- export { AddonsList, AutoRechargeStatus, type AutoRechargeStatusLocalization, type AutoRechargeStatusProps, AutomaticRechargeConfig, AutomaticRechargeConfigForm, type AutomaticRechargeConfigFormProps, type AutomaticRechargeConfigLocalization, type AutomaticRechargeConfigProps, type AutomaticRechargeConfiguration, type AutomaticRechargeFormData, type AutomaticRechargeFormErrors, type BillingInformation, BooleanEntitlementGuard, Checkout, type CheckoutContainerProps, type CheckoutLocalization, type CheckoutMockProps, type CheckoutProps, type CheckoutProviderProps, type CheckoutResult, type CheckoutState, CheckoutStepKey, type CheckoutTheme, CreditBalance, type CreditBalanceProps, CreditGrants, type CreditGrantsLocalization, type CreditGrantsProps, CreditUsageChart, CreditUtilization, type CreditUtilizationLocalization, type CreditUtilizationProps, type CurrentPlanParams, type CurrentSubscriptionOverride, type CurrentSubscriptionOverrideFn, CustomerPortal, CustomerPortalIntentionType, type CustomerPortalLocalization, type CustomerPortalProps, CustomerPortalProvider, type CustomerPortalSection, type CustomerPortalTheme, CustomerUsageData, type CustomerUsageDataProps, EmptyState, EnumEntitlementGuard, ErrorState, type FontVariant, GenericTable, type GenericTableProps, type GetCreditBalanceParams, type GetCreditGrantsParams, type HeadCell, type HorizontalAlignment, InvoicesSection, MeteredEntitlementGuard, type MockCheckoutPreviewCallback, type MockCheckoutStateCallback, NumericEntitlementGuard, type OnAddonChangeCallback, type OnBeforeStepChangeCallback, type OnBillableFeatureChangeCallback, type OnBuyMoreCallbackFn, type OnCheckoutCompletedParams, type OnCheckoutParams, type OnManageSubscriptionFn, type OnPlanSelectedCallbackFn, PaymentDetailsSection, PaywallContainer as Paywall, type PaywallData, type PaywallLocalization, type PaywallPlan, type PaywallContainerProps as PaywallProps, type PixelWidth, type PlanPriceText, Promotions, ProvisionStatus, type SelectDefaultTierIndexFn, type ShouldHidePlanFn, StatusChip, type StatusChipColors, type StatusChipVariant, StiggContext, type StiggContextValue, StiggProvider, type StiggProviderProps, type StiggTheme, SubscribeIntentionType, SubscriptionsOverview, type SubscriptionsOverviewProps, type TableAlignment, type TaxDetailsInput, type TextAlignment, type CustomizedTheme as Theme, type UpdateAutomaticRechargeConfigParams, formatDateOnly, formatDateTime, mapCreditGrantStatusToVariant, useActiveSubscriptions, useAutomaticRechargeForm, useBooleanEntitlement, useCreditBalance, useCreditGrants, useCreditUsage, useCustomerPortal, useEnumEntitlement, useMeteredEntitlement, useNumericEntitlement, usePaywall, useStiggContext, useWaitForCheckoutCompleted, validateAutomaticRechargeForm };
989
+ export { AddonsList, AutoRechargeStatus, type AutoRechargeStatusLocalization, type AutoRechargeStatusProps, AutomaticRechargeConfig, AutomaticRechargeConfigForm, type AutomaticRechargeConfigFormProps, type AutomaticRechargeConfigLocalization, type AutomaticRechargeConfigProps, type AutomaticRechargeConfiguration, type AutomaticRechargeFormData, type AutomaticRechargeFormErrors, type BillingInformation, BooleanEntitlementGuard, Checkout, type CheckoutContainerProps, type CheckoutLocalization, type CheckoutMockProps, type CheckoutProps, type CheckoutProviderProps, type CheckoutResult, type CheckoutState, CheckoutStepKey, type CheckoutTheme, CreditBalance, type CreditBalanceData, type CreditBalanceProps, CreditGrants, type CreditGrantsLocalization, type CreditGrantsProps, CreditUsageChart, CreditUtilization, type CreditUtilizationLocalization, type CreditUtilizationProps, type CurrentPlanParams, type CurrentSubscriptionOverride, type CurrentSubscriptionOverrideFn, CustomerPortal, CustomerPortalIntentionType, type CustomerPortalLocalization, type CustomerPortalProps, CustomerPortalProvider, type CustomerPortalSection, type CustomerPortalTheme, CustomerUsageData, type CustomerUsageDataProps, EmptyState, EnumEntitlementGuard, ErrorState, type FontVariant, GenericTable, type GenericTableProps, type GetCreditBalanceParams, type GetCreditGrantsParams, type HeadCell, type HorizontalAlignment, InvoicesSection, MeteredEntitlementGuard, type MockCheckoutPreviewCallback, type MockCheckoutStateCallback, NumericEntitlementGuard, type OnAddCreditsCallbackFn, type OnAddonChangeCallback, type OnBeforeStepChangeCallback, type OnBillableFeatureChangeCallback, type OnBuyMoreCallbackFn, type OnCheckoutCompletedParams, type OnCheckoutParams, type OnManageSubscriptionFn, type OnPlanSelectedCallbackFn, PaymentDetailsSection, PaywallContainer as Paywall, type PaywallData, type PaywallLocalization, type PaywallPlan, type PaywallContainerProps as PaywallProps, type PixelWidth, type PlanPriceText, Promotions, ProvisionStatus, type SelectDefaultTierIndexFn, type ShouldHidePlanFn, StatusChip, type StatusChipColors, type StatusChipVariant, StiggContext, type StiggContextValue, StiggProvider, type StiggProviderProps, type StiggTheme, SubscribeIntentionType, SubscriptionsOverview, type SubscriptionsOverviewProps, type TableAlignment, type TaxDetailsInput, type TextAlignment, type CustomizedTheme as Theme, type UpdateAutomaticRechargeConfigParams, formatDateOnly, formatDateTime, mapCreditGrantStatusToVariant, useActiveSubscriptions, useAutomaticRechargeForm, useBooleanEntitlement, useCreditBalance, useCreditGrants, useCreditUsage, useCustomerPortal, useEnumEntitlement, useMeteredEntitlement, useNumericEntitlement, usePaywall, useStiggContext, useWaitForCheckoutCompleted, validateAutomaticRechargeForm };