UNPKG

@open-tender/utils

Version:

A library of utils for use with Open Tender applications that utilize our cloud-based Order API.

32 lines (31 loc) 1.72 kB
/// <reference types="react" /> import { CardType, CreditCardData, CreditCardSaved, CreditCards, Customer, GiftCardPurchaseData, GiftCardsPurchase, RequestError, RequestStatus } from '@open-tender/types'; export declare const useGiftCardsForm: (purchase: (data: GiftCardsPurchase, callback?: () => void) => void, reset: () => void, setAlert: (data: { type: string; args?: unknown; }) => void, loading: RequestStatus, error: RequestError, success: boolean, initState: GiftCardPurchaseData, customer?: Customer | null, creditCards?: CreditCards, includeRecaptcha?: boolean, cardData?: CreditCardData, cardType?: CardType, url?: string, kountSessionId?: string | null, requireCardholderName?: boolean) => { inputRef: import("react").MutableRefObject<HTMLInputElement | null>; submitRef: import("react").MutableRefObject<HTMLButtonElement | null>; recaptchaRef: import("react").MutableRefObject<any>; creditCardOptions: { name: string; value: unknown; }[]; handleName: (value: string) => void; handleEmail: (value: string) => void; handleChange: (name: string, value: string) => void; handleQuantity: (index: number, quantity: number) => void; handleAddAnother: () => void; handleCreditCard: (value: number) => void; handleSubmit: (evt?: React.FormEvent<HTMLFormElement>) => void; handleReset: () => void; name: string | null; email: string | null; cards: GiftCardPurchaseData[]; isNewCard: boolean; newCardErrors: {}; creditCard: CreditCardSaved | null; setCreditCard: import("react").Dispatch<import("react").SetStateAction<CreditCardSaved | null>>; errors: Record<string, string>; submitting: boolean; };