@open-tender/utils 0.1.11 → 0.1.12
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/cjs/hooks/useAddressForm.d.ts +5 -8
- package/dist/cjs/hooks/useAddressForm.js +6 -0
- package/dist/cjs/hooks/useCreditCard.d.ts +1 -1
- package/dist/cjs/hooks/useProfileForm.d.ts +2 -2
- package/dist/cjs/utils/cards.d.ts +1 -1
- package/dist/esm/hooks/useAddressForm.d.ts +5 -8
- package/dist/esm/hooks/useAddressForm.js +6 -0
- package/dist/esm/hooks/useCreditCard.d.ts +1 -1
- package/dist/esm/hooks/useProfileForm.d.ts +2 -2
- package/dist/esm/utils/cards.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Address, RequestStatus } from '@open-tender/types';
|
|
3
|
-
interface AddressFormField {
|
|
4
|
-
label: string;
|
|
5
|
-
name: string;
|
|
6
|
-
type: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
}
|
|
9
3
|
export declare const useAddressForm: (address: Address, loading: RequestStatus, error: any, update: (addressId: number, updatedData: Address, callback: () => void) => void, callback: () => void) => {
|
|
10
|
-
fields:
|
|
4
|
+
fields: {
|
|
5
|
+
label: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
11
9
|
data: Address;
|
|
12
10
|
errors: any;
|
|
13
11
|
submitting: boolean;
|
|
@@ -16,4 +14,3 @@ export declare const useAddressForm: (address: Address, loading: RequestStatus,
|
|
|
16
14
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
17
15
|
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
18
16
|
};
|
|
19
|
-
export {};
|
|
@@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useAddressForm = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
+
// interface AddressFormField {
|
|
7
|
+
// label: string
|
|
8
|
+
// name: string
|
|
9
|
+
// type: string
|
|
10
|
+
// required?: boolean
|
|
11
|
+
// }
|
|
6
12
|
const useAddressForm = (address, loading, error, update, callback) => {
|
|
7
13
|
const submitRef = (0, react_1.useRef)(null);
|
|
8
14
|
const inputRef = (0, react_1.useRef)(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CreditCardData } from '@open-tender/types';
|
|
3
|
-
export declare const useCreditCard: (initState: CreditCardData, cardErrors?: {}, disabled?: boolean) => {
|
|
3
|
+
export declare const useCreditCard: (initState: CreditCardData | null, cardErrors?: {}, disabled?: boolean) => {
|
|
4
4
|
submitRef: import("react").MutableRefObject<null>;
|
|
5
5
|
data: CreditCardData;
|
|
6
6
|
cardType: "VISA" | "MC" | "DISC" | "AMEX" | "OTHER";
|
|
@@ -9,8 +9,8 @@ export interface ProfileFormField {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const useProfileForm: (profile: Partial<Profile>, loading: RequestStatus, error: any, update: (data: Partial<Profile>) => void, optIns?: Partial<ConfigBrand>) => {
|
|
11
11
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
12
|
-
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | undefined;
|
|
13
|
-
order_notifications: import("@open-tender/types").ConfigOrderNotifications | undefined;
|
|
12
|
+
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | null | undefined;
|
|
13
|
+
order_notifications: import("@open-tender/types").ConfigOrderNotifications | null | undefined;
|
|
14
14
|
data: Partial<Profile>;
|
|
15
15
|
errors: any;
|
|
16
16
|
submitting: boolean;
|
|
@@ -16,5 +16,5 @@ export declare const getCardType: (cardNumber: string) => CardType;
|
|
|
16
16
|
export declare const makeNumeric: (str: string) => string;
|
|
17
17
|
export declare const makeAcctNumber: (str: string, cardType: CardType) => string;
|
|
18
18
|
export declare const formatCardField: (field: keyof CreditCardData, value: string) => string;
|
|
19
|
-
export declare const formatCard: (card: CreditCardData) => [CreditCardData | null, CardType | null];
|
|
19
|
+
export declare const formatCard: (card: CreditCardData | null) => [CreditCardData | null, CardType | null];
|
|
20
20
|
export declare const validateCreditCard: (card: CreditCardData, cardType: CardType) => CreditCardValidate;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Address, RequestStatus } from '@open-tender/types';
|
|
3
|
-
interface AddressFormField {
|
|
4
|
-
label: string;
|
|
5
|
-
name: string;
|
|
6
|
-
type: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
}
|
|
9
3
|
export declare const useAddressForm: (address: Address, loading: RequestStatus, error: any, update: (addressId: number, updatedData: Address, callback: () => void) => void, callback: () => void) => {
|
|
10
|
-
fields:
|
|
4
|
+
fields: {
|
|
5
|
+
label: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
11
9
|
data: Address;
|
|
12
10
|
errors: any;
|
|
13
11
|
submitting: boolean;
|
|
@@ -16,4 +14,3 @@ export declare const useAddressForm: (address: Address, loading: RequestStatus,
|
|
|
16
14
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
17
15
|
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
18
16
|
};
|
|
19
|
-
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { makePhone } from '../utils';
|
|
3
|
+
// interface AddressFormField {
|
|
4
|
+
// label: string
|
|
5
|
+
// name: string
|
|
6
|
+
// type: string
|
|
7
|
+
// required?: boolean
|
|
8
|
+
// }
|
|
3
9
|
export const useAddressForm = (address, loading, error, update, callback) => {
|
|
4
10
|
const submitRef = useRef(null);
|
|
5
11
|
const inputRef = useRef(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CreditCardData } from '@open-tender/types';
|
|
3
|
-
export declare const useCreditCard: (initState: CreditCardData, cardErrors?: {}, disabled?: boolean) => {
|
|
3
|
+
export declare const useCreditCard: (initState: CreditCardData | null, cardErrors?: {}, disabled?: boolean) => {
|
|
4
4
|
submitRef: import("react").MutableRefObject<null>;
|
|
5
5
|
data: CreditCardData;
|
|
6
6
|
cardType: "VISA" | "MC" | "DISC" | "AMEX" | "OTHER";
|
|
@@ -9,8 +9,8 @@ export interface ProfileFormField {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const useProfileForm: (profile: Partial<Profile>, loading: RequestStatus, error: any, update: (data: Partial<Profile>) => void, optIns?: Partial<ConfigBrand>) => {
|
|
11
11
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
12
|
-
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | undefined;
|
|
13
|
-
order_notifications: import("@open-tender/types").ConfigOrderNotifications | undefined;
|
|
12
|
+
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | null | undefined;
|
|
13
|
+
order_notifications: import("@open-tender/types").ConfigOrderNotifications | null | undefined;
|
|
14
14
|
data: Partial<Profile>;
|
|
15
15
|
errors: any;
|
|
16
16
|
submitting: boolean;
|
|
@@ -16,5 +16,5 @@ export declare const getCardType: (cardNumber: string) => CardType;
|
|
|
16
16
|
export declare const makeNumeric: (str: string) => string;
|
|
17
17
|
export declare const makeAcctNumber: (str: string, cardType: CardType) => string;
|
|
18
18
|
export declare const formatCardField: (field: keyof CreditCardData, value: string) => string;
|
|
19
|
-
export declare const formatCard: (card: CreditCardData) => [CreditCardData | null, CardType | null];
|
|
19
|
+
export declare const formatCard: (card: CreditCardData | null) => [CreditCardData | null, CardType | null];
|
|
20
20
|
export declare const validateCreditCard: (card: CreditCardData, cardType: CardType) => CreditCardValidate;
|
package/package.json
CHANGED