@stigg/react-sdk 5.22.1 → 5.23.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.
Files changed (33) hide show
  1. package/dist/components/checkout/Checkout.d.ts +1 -1
  2. package/dist/components/checkout/CheckoutProvider.d.ts +3 -1
  3. package/dist/components/checkout/configurations/steps.d.ts +1 -0
  4. package/dist/components/checkout/hooks/useProgressBarModel.d.ts +13 -3
  5. package/dist/components/checkout/progressBar/CheckoutProgressBar.d.ts +1 -1
  6. package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +2 -3
  7. package/dist/components/checkout/steps/payment/PaymentMethods.style.d.ts +2 -0
  8. package/dist/components/utils/formatNumber.d.ts +1 -0
  9. package/dist/components/utils/planPrices.d.ts +4 -0
  10. package/dist/react-sdk.cjs.development.js +130 -62
  11. package/dist/react-sdk.cjs.development.js.map +1 -1
  12. package/dist/react-sdk.cjs.production.min.js +1 -1
  13. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  14. package/dist/react-sdk.esm.js +130 -62
  15. package/dist/react-sdk.esm.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/components/checkout/Checkout.tsx +3 -1
  18. package/src/components/checkout/CheckoutProvider.tsx +18 -2
  19. package/src/components/checkout/configurations/steps.ts +1 -0
  20. package/src/components/checkout/hooks/usePlanStepModel.ts +6 -9
  21. package/src/components/checkout/hooks/useProgressBarModel.ts +64 -5
  22. package/src/components/checkout/progressBar/CheckoutProgressBar.tsx +5 -1
  23. package/src/components/checkout/steps/payment/PaymentMethods.style.ts +8 -1
  24. package/src/components/checkout/steps/payment/PaymentMethods.tsx +11 -12
  25. package/src/components/checkout/steps/payment/PaymentStep.tsx +1 -0
  26. package/src/components/checkout/summary/CheckoutSummary.tsx +27 -20
  27. package/src/components/checkout/summary/components/LineItems.tsx +1 -1
  28. package/src/components/common/VolumeBulkSelect.tsx +2 -1
  29. package/src/components/paywall/EntitlementRow.tsx +2 -7
  30. package/src/components/utils/formatNumber.ts +5 -0
  31. package/src/components/utils/planPrices.ts +10 -0
  32. package/src/stories/Checkout.stories.tsx +17 -2
  33. package/src/stories/mocks/checkout/mockCheckoutState.ts +1 -0
@@ -3,4 +3,4 @@ import { CheckoutProviderProps } from './CheckoutProvider';
3
3
  import { CheckoutContainerProps } from './CheckoutContainer';
4
4
  import { CheckoutMockProps } from './types';
5
5
  export declare type CheckoutProps = CheckoutProviderProps & CheckoutContainerProps & CheckoutMockProps;
6
- export declare const Checkout: ({ textOverrides, theme, resourceId, planId, preferredBillingPeriod, billingCountryCode, billableFeatures, billingInformation, onMockCheckoutState, ...containerProps }: CheckoutProps) => JSX.Element;
6
+ export declare const Checkout: ({ textOverrides, theme, resourceId, planId, preferredBillingPeriod, billingCountryCode, billableFeatures, billingInformation, onMockCheckoutState, skipCheckoutSteps, ...containerProps }: CheckoutProps) => JSX.Element;
@@ -6,6 +6,7 @@ import { CheckoutLocalization } from './configurations/textOverrides';
6
6
  import { CheckoutTheme } from './configurations/theme';
7
7
  import { StiggTheme } from '../../theme/types';
8
8
  import { BillingInformation, MockCheckoutStateCallback } from './types';
9
+ import { CheckoutSteps } from './configurations/steps';
9
10
  export interface CheckoutContextState {
10
11
  checkout?: GetCheckoutStateResults | null;
11
12
  checkoutLocalization: CheckoutLocalization;
@@ -31,7 +32,8 @@ export declare type CheckoutProviderProps = {
31
32
  billableFeatures?: BillableFeature[];
32
33
  billingInformation?: BillingInformation;
33
34
  onMockCheckoutState?: MockCheckoutStateCallback;
35
+ skipCheckoutSteps?: CheckoutSteps[];
34
36
  };
35
- export declare function CheckoutProvider({ children, textOverrides, theme, preferredBillingPeriod, billableFeatures, resourceId, planId, billingCountryCode, billingInformation, onMockCheckoutState, }: {
37
+ export declare function CheckoutProvider({ children, textOverrides, theme, preferredBillingPeriod, billableFeatures, resourceId, planId, billingCountryCode, billingInformation, onMockCheckoutState, skipCheckoutSteps, }: {
36
38
  children: React.ReactNode;
37
39
  } & CheckoutProviderProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export declare type CheckoutSteps = 'PLAN' | 'ADDONS';
@@ -1,4 +1,6 @@
1
- import { Addon } from '@stigg/js-client-sdk';
1
+ import { BillableFeatureInput } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { Addon, BillableFeature, BillingPeriod, CheckoutStatePlan } from '@stigg/js-client-sdk';
3
+ import { CheckoutSteps } from '../configurations/steps';
2
4
  export declare enum CheckoutStepKey {
3
5
  PLAN = "PLAN",
4
6
  ADDONS = "ADDONS",
@@ -14,9 +16,16 @@ export declare type ProgressBarState = {
14
16
  steps: CheckoutStep[];
15
17
  isDisabled: boolean;
16
18
  };
17
- export declare function getProgressBarInitialState({ availableAddons }: {
19
+ declare type GetProgressBarInitialStateProps = {
20
+ isLoading: boolean;
21
+ skipCheckoutSteps: CheckoutSteps[];
22
+ plan?: CheckoutStatePlan;
18
23
  availableAddons?: Addon[];
19
- }): ProgressBarState;
24
+ availableCharges: BillableFeatureInput[];
25
+ preferredBillingPeriod?: BillingPeriod;
26
+ preconfiguredBillableFeatures: BillableFeature[];
27
+ };
28
+ export declare function getProgressBarInitialState({ isLoading, skipCheckoutSteps, plan, availableAddons, availableCharges, preferredBillingPeriod, preconfiguredBillableFeatures, }: GetProgressBarInitialStateProps): ProgressBarState;
20
29
  export declare function useProgressBarModel(): {
21
30
  currentStep: CheckoutStep;
22
31
  progressBarState: ProgressBarState;
@@ -27,3 +36,4 @@ export declare function useProgressBarModel(): {
27
36
  goNext: () => void;
28
37
  setIsDisabled: (isDisabled?: boolean | undefined) => void;
29
38
  };
39
+ export {};
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const CheckoutProgressBar: () => JSX.Element;
2
+ export declare const CheckoutProgressBar: () => JSX.Element | null;
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Customer } from '@stigg/js-client-sdk';
3
- import { Icons } from '../../../common/Icon';
4
3
  import { CheckoutLocalization } from '../../configurations/textOverrides';
5
4
  import { CheckoutContainerProps } from '../../CheckoutContainer';
6
5
  export declare type PaymentMethodLayoutProps = {
7
6
  checked: boolean;
8
- icon: Icons;
9
7
  text: React.ReactNode;
10
8
  subtitle?: React.ReactNode;
11
9
  readOnly?: boolean;
@@ -16,6 +14,7 @@ export declare type PaymentMethodProps = Pick<Customer, 'paymentMethodDetails'>
16
14
  export declare type NewPaymentMethodProps = Pick<PaymentMethodLayoutProps, 'checked' | 'readOnly'> & {
17
15
  onSelect: () => void;
18
16
  checkoutLocalization: CheckoutLocalization;
17
+ hasExistingPaymentMethod: boolean;
19
18
  } & Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>;
20
19
  export declare function ExistingPaymentMethod({ checked, paymentMethodDetails, readOnly, onSelect }: PaymentMethodProps): JSX.Element | null;
21
- export declare function NewPaymentMethod({ checked, onSelect, readOnly, checkoutLocalization, onBillingAddressChange, collectPhoneNumber, }: NewPaymentMethodProps): JSX.Element;
20
+ export declare function NewPaymentMethod({ hasExistingPaymentMethod, checked, onSelect, readOnly, checkoutLocalization, onBillingAddressChange, collectPhoneNumber, }: NewPaymentMethodProps): JSX.Element;
@@ -12,6 +12,8 @@ export declare const NewPaymentMethodContainer: import("@emotion/styled").Styled
12
12
  theme?: import("@emotion/react").Theme | undefined;
13
13
  } & {
14
14
  $disabled?: boolean | undefined;
15
+ } & {
16
+ $hideBorders?: boolean | undefined;
15
17
  }, {}, {}>;
16
18
  export declare const PaymentMethodLayoutContainer: import("@emotion/styled").StyledComponent<import("@mui/material/Grid").GridOwnProps & import("@mui/material/OverridableComponent").CommonProps & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "slot" | "style" | "title" | "className" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
17
19
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
@@ -0,0 +1 @@
1
+ export declare function formatNumber(usageLimit: number | null | undefined): string | undefined;
@@ -0,0 +1,4 @@
1
+ import { Plan } from '@stigg/js-client-sdk';
2
+ export declare const hasMonthlyPrices: (plan?: Plan | undefined) => boolean;
3
+ export declare const hasAnnualPrices: (plan?: Plan | undefined) => boolean;
4
+ export declare const hasMultipleBillingPeriods: (plan?: Plan | undefined) => boolean;