Skip to content

Commit

Permalink
Adds types for RiskDataCollector
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissrogers committed May 1, 2020
1 parent 05c4d73 commit 09e8533
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 17 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
Address,
TokenHandler,
CheckoutPrice,
Adjustment
Adjustment,
RecurlyError
} from '@recurly/recurly-js';

export type ElementsProps = {
Expand Down Expand Up @@ -101,6 +102,15 @@ export type SetCheckoutPricing = (input: UseCheckoutPricingInput) => void;

export type UseCheckoutPricingReturn = [UseCheckoutPricingState, SetCheckoutPricing];

export type RiskStrategies = 'kount';

export type RiskDataCollectorProps = {
id?: string;
className?: string;
strategy?: RiskStrategies;
onError?: (e: RecurlyError) => void;
};

/**
* {@link https://recurly.github.io/react-recurly/?path=/docs/components-recurlyprovider--page This component}
* accepts your publicKey as a prop. It is responsible for creating a recurly
Expand Down Expand Up @@ -156,6 +166,12 @@ export const CardYearElement: React.FC<IndividualElementProps>;
*/
export const CardCvvElement: React.FC<IndividualElementProps>;

/**
* {@link https://recurly.github.io/react-recurly/?path=/docs/components-riskdatacollector--page This component}
* adds fraud protection to your checkout
*/
export const RiskDataCollector: React.FC<RiskDataCollectorProps>;

/**
* {@link https://recurly.github.io/react-recurly/?path=/docs/hooks-userecurly--page Use this hook}
* to access a Recurly instance.
Expand Down
7 changes: 7 additions & 0 deletions types/test-types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CardMonthElement,
CardYearElement,
CardCvvElement,
RiskDataCollector,
useRecurly,
useCheckoutPricing,
CardElementChangeEvent,
Expand Down Expand Up @@ -244,6 +245,12 @@ function TestComponent() {
<CardYearElement {...elementProps} />
<CardCvvElement {...elementProps} />
</Elements>
<RiskDataCollector
id="test-risk-id"
className="test-risk-class"
strategy="kount"
onError={() => {}}
/>
</RecurlyProvider>
);
}

0 comments on commit 09e8533

Please sign in to comment.