UNPKG

@open-tender/utils

Version:

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

21 lines (20 loc) 1.29 kB
/// <reference types="react" /> import { CheckoutConfig, ConfigBrand, Customer, CustomerCreate, NotificationChannel, RequestError, RequestStatus } from '@open-tender/types'; export interface NotificationCheckbox { label: string; name: NotificationChannel; type: string; } export declare const notificationChannelFields: NotificationCheckbox[]; export declare const useSignUpForm: (loading: RequestStatus, error: RequestError, signUp: (data: CustomerCreate, callback?: ((data: Customer) => void) | undefined) => void, callback?: ((data: Customer) => void) | undefined, checkConfig?: CheckoutConfig, hidePassword?: boolean, optionalFields?: string[], notificationChannels?: NotificationChannel[], passwordRequirements?: string, tpls?: ConfigBrand['tpls']) => { submitRef: import("react").MutableRefObject<HTMLButtonElement | null>; data: CustomerCreate; comms: NotificationChannel[]; errors: Record<string, string>; submitting: boolean; fields: import("@open-tender/types").FormFieldType[]; notificationFields: NotificationCheckbox[]; handleChange: (name: string, value: string | number | boolean) => void; handleComms: (name: NotificationChannel, value: boolean) => void; handleSubmit: (evt?: React.FormEvent<HTMLFormElement>) => void; };