@open-tender/utils 0.0.60 → 0.0.62
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 +3 -4
- package/dist/cjs/hooks/useAllergenForm.d.ts +2 -4
- package/dist/cjs/hooks/useAllergenForm.js +2 -1
- package/dist/cjs/hooks/useCartGuestForm.d.ts +4 -5
- package/dist/cjs/hooks/useCartGuestForm.js +2 -1
- package/dist/cjs/hooks/useCheckoutLoginForm.d.ts +3 -5
- package/dist/cjs/hooks/useCheckoutLoginForm.js +2 -1
- package/dist/cjs/hooks/useCreditCard.d.ts +2 -4
- package/dist/cjs/hooks/useCreditCard.js +2 -1
- package/dist/cjs/hooks/useCurbside.d.ts +1 -2
- package/dist/cjs/hooks/useCurbside.js +2 -1
- package/dist/cjs/hooks/useDineInForm.d.ts +3 -5
- package/dist/cjs/hooks/useDineInForm.js +2 -1
- package/dist/cjs/hooks/useDonationForm.d.ts +6 -5
- package/dist/cjs/hooks/useDonationForm.js +2 -1
- package/dist/cjs/hooks/useGiftCardAssignForm.d.ts +3 -5
- package/dist/cjs/hooks/useGiftCardAssignForm.js +2 -1
- package/dist/cjs/hooks/useGiftCardAssignOtherForm.d.ts +3 -5
- package/dist/cjs/hooks/useGiftCardAssignOtherForm.js +2 -1
- package/dist/cjs/hooks/useGiftCardForm.d.ts +3 -5
- package/dist/cjs/hooks/useGiftCardForm.js +2 -1
- package/dist/cjs/hooks/useGiftCardsForm.d.ts +4 -5
- package/dist/cjs/hooks/useGiftCardsForm.js +2 -1
- package/dist/cjs/hooks/useGuestForm.d.ts +3 -5
- package/dist/cjs/hooks/useGuestForm.js +2 -1
- package/dist/cjs/hooks/useOrderFulfillmentForm.d.ts +2 -4
- package/dist/cjs/hooks/useOrderFulfillmentForm.js +2 -1
- package/dist/cjs/hooks/useOrderRating.d.ts +1 -2
- package/dist/cjs/hooks/useOrderRating.js +3 -2
- package/dist/cjs/hooks/useOrderRatingForm.d.ts +2 -4
- package/dist/cjs/hooks/useOrderRatingForm.js +2 -1
- package/dist/cjs/hooks/useProfileForm.d.ts +3 -5
- package/dist/cjs/hooks/useProfileForm.js +2 -1
- package/dist/cjs/hooks/useResetPasswordForm.d.ts +4 -6
- package/dist/cjs/hooks/useResetPasswordForm.js +2 -1
- package/dist/cjs/hooks/useSendResetForm.d.ts +3 -5
- package/dist/cjs/hooks/useSendResetForm.js +2 -1
- package/dist/cjs/hooks/useSignUpForm.d.ts +3 -5
- package/dist/cjs/hooks/useSignUpForm.js +2 -1
- package/dist/cjs/hooks/useSignUpGuestForm.d.ts +3 -5
- package/dist/cjs/hooks/useSignUpGuestForm.js +2 -1
- package/dist/cjs/hooks/useSigninForm.d.ts +3 -5
- package/dist/cjs/hooks/useSigninForm.js +2 -1
- package/dist/esm/hooks/useAddressForm.d.ts +3 -4
- package/dist/esm/hooks/useAllergenForm.d.ts +2 -4
- package/dist/esm/hooks/useAllergenForm.js +1 -2
- package/dist/esm/hooks/useCartGuestForm.d.ts +4 -5
- package/dist/esm/hooks/useCartGuestForm.js +1 -2
- package/dist/esm/hooks/useCheckoutLoginForm.d.ts +3 -5
- package/dist/esm/hooks/useCheckoutLoginForm.js +1 -2
- package/dist/esm/hooks/useCreditCard.d.ts +2 -4
- package/dist/esm/hooks/useCreditCard.js +1 -2
- package/dist/esm/hooks/useCurbside.d.ts +1 -2
- package/dist/esm/hooks/useCurbside.js +1 -2
- package/dist/esm/hooks/useDineInForm.d.ts +3 -5
- package/dist/esm/hooks/useDineInForm.js +1 -2
- package/dist/esm/hooks/useDonationForm.d.ts +6 -5
- package/dist/esm/hooks/useDonationForm.js +1 -2
- package/dist/esm/hooks/useGiftCardAssignForm.d.ts +3 -5
- package/dist/esm/hooks/useGiftCardAssignForm.js +1 -2
- package/dist/esm/hooks/useGiftCardAssignOtherForm.d.ts +3 -5
- package/dist/esm/hooks/useGiftCardAssignOtherForm.js +1 -2
- package/dist/esm/hooks/useGiftCardForm.d.ts +3 -5
- package/dist/esm/hooks/useGiftCardForm.js +1 -2
- package/dist/esm/hooks/useGiftCardsForm.d.ts +4 -5
- package/dist/esm/hooks/useGiftCardsForm.js +1 -2
- package/dist/esm/hooks/useGuestForm.d.ts +3 -5
- package/dist/esm/hooks/useGuestForm.js +1 -2
- package/dist/esm/hooks/useOrderFulfillmentForm.d.ts +2 -4
- package/dist/esm/hooks/useOrderFulfillmentForm.js +1 -2
- package/dist/esm/hooks/useOrderRating.d.ts +1 -2
- package/dist/esm/hooks/useOrderRating.js +1 -2
- package/dist/esm/hooks/useOrderRatingForm.d.ts +2 -4
- package/dist/esm/hooks/useOrderRatingForm.js +1 -2
- package/dist/esm/hooks/useProfileForm.d.ts +3 -5
- package/dist/esm/hooks/useProfileForm.js +1 -2
- package/dist/esm/hooks/useResetPasswordForm.d.ts +4 -6
- package/dist/esm/hooks/useResetPasswordForm.js +1 -2
- package/dist/esm/hooks/useSendResetForm.d.ts +3 -5
- package/dist/esm/hooks/useSendResetForm.js +1 -2
- package/dist/esm/hooks/useSignUpForm.d.ts +3 -5
- package/dist/esm/hooks/useSignUpForm.js +1 -2
- package/dist/esm/hooks/useSignUpGuestForm.d.ts +3 -5
- package/dist/esm/hooks/useSignUpGuestForm.js +1 -2
- package/dist/esm/hooks/useSigninForm.d.ts +3 -5
- package/dist/esm/hooks/useSigninForm.js +1 -2
- package/package.json +1 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ConfigBrand, Profile, RequestStatus } from '@open-tender/types';
|
|
3
|
-
|
|
4
|
-
interface ProfileFormField {
|
|
3
|
+
export interface ProfileFormField {
|
|
5
4
|
label: string;
|
|
6
5
|
name: keyof Profile;
|
|
7
6
|
type: string;
|
|
8
7
|
required?: boolean;
|
|
9
8
|
autoComplete?: string;
|
|
10
9
|
}
|
|
11
|
-
declare const useProfileForm:
|
|
12
|
-
submitRef: import("react").MutableRefObject<
|
|
10
|
+
export declare const useProfileForm: (profile: Partial<Profile>, loading: RequestStatus, error: any, update: (data: Partial<Profile>) => void, optIns?: Partial<ConfigBrand>) => {
|
|
11
|
+
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
13
12
|
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | undefined;
|
|
14
13
|
order_notifications: import("@open-tender/types").ConfigOrderNotifications | undefined;
|
|
15
14
|
data: Partial<Profile>;
|
|
@@ -21,4 +20,3 @@ declare const useProfileForm: <SubmitRef extends Field>(profile: Partial<Profile
|
|
|
21
20
|
handleRadio: (name: string, value: string) => void;
|
|
22
21
|
handleSubmit: () => void;
|
|
23
22
|
};
|
|
24
|
-
export default useProfileForm;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { makeBirthDate, makePhone, slashesToDashes } from '../utils';
|
|
3
|
-
const useProfileForm = (profile, loading, error, update, optIns = {}) => {
|
|
3
|
+
export const useProfileForm = (profile, loading, error, update, optIns = {}) => {
|
|
4
4
|
const submitRef = useRef(null);
|
|
5
5
|
const { accepts_marketing, order_notifications } = optIns;
|
|
6
6
|
const [data, setData] = useState({});
|
|
@@ -69,4 +69,3 @@ const useProfileForm = (profile, loading, error, update, optIns = {}) => {
|
|
|
69
69
|
handleSubmit,
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
export default useProfileForm;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RequestStatus, ResetPasswordData } from '@open-tender/types';
|
|
3
|
-
|
|
4
|
-
interface ResetPasswordFormField {
|
|
3
|
+
export interface ResetPasswordFormField {
|
|
5
4
|
label: string;
|
|
6
5
|
name: string;
|
|
7
6
|
type: string;
|
|
8
7
|
required?: boolean;
|
|
9
8
|
}
|
|
10
|
-
declare const useResetPasswordForm:
|
|
11
|
-
submitRef: import("react").MutableRefObject<
|
|
12
|
-
inputRef: import("react").MutableRefObject<
|
|
9
|
+
export declare const useResetPasswordForm: (loading: RequestStatus, error: any, reset: (newPassword: string, callback: () => void) => void, resetForm: () => void, resetToken: () => void) => {
|
|
10
|
+
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
11
|
+
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
13
12
|
fields: ResetPasswordFormField[];
|
|
14
13
|
data: Partial<ResetPasswordData>;
|
|
15
14
|
errors: {};
|
|
@@ -17,4 +16,3 @@ declare const useResetPasswordForm: <InputRef extends Field, SubmitRef extends F
|
|
|
17
16
|
handleChange: (name: string, value: string) => void;
|
|
18
17
|
handleSubmit: () => void;
|
|
19
18
|
};
|
|
20
|
-
export default useResetPasswordForm;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
const useResetPasswordForm = (loading, error, reset, resetForm, resetToken) => {
|
|
2
|
+
export const useResetPasswordForm = (loading, error, reset, resetForm, resetToken) => {
|
|
3
3
|
const submitRef = useRef(null);
|
|
4
4
|
const inputRef = useRef(null);
|
|
5
5
|
const [data, setData] = useState({});
|
|
@@ -61,4 +61,3 @@ const useResetPasswordForm = (loading, error, reset, resetForm, resetToken) => {
|
|
|
61
61
|
handleSubmit,
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
-
export default useResetPasswordForm;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RequestStatus } from '@open-tender/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
inputRef: import("react").MutableRefObject<InputRef | null>;
|
|
3
|
+
export declare const useSendResetForm: (loading: RequestStatus, error: any, sendReset: (email: string, linkUrl: string) => Promise<void>, callback?: () => void, windowref?: any, linkUrlVal?: string) => {
|
|
4
|
+
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
|
+
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
7
6
|
data: any;
|
|
8
7
|
errMsg: any;
|
|
9
8
|
handleChange: (name: string, value: string) => void;
|
|
10
9
|
handleSubmit: () => void;
|
|
11
10
|
};
|
|
12
|
-
export default useSendResetForm;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
const useSendResetForm = (loading, error, sendReset, callback, windowref, linkUrlVal) => {
|
|
2
|
+
export const useSendResetForm = (loading, error, sendReset, callback, windowref, linkUrlVal) => {
|
|
3
3
|
const submitRef = useRef(null);
|
|
4
4
|
const inputRef = useRef(null);
|
|
5
5
|
const [data, setData] = useState({});
|
|
@@ -31,4 +31,3 @@ const useSendResetForm = (loading, error, sendReset, callback, windowref, linkUr
|
|
|
31
31
|
handleSubmit,
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
export default useSendResetForm;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckoutConfig, Profile } from '@open-tender/types';
|
|
3
|
-
|
|
4
|
-
interface SignUpFormField {
|
|
3
|
+
export interface SignUpFormField {
|
|
5
4
|
label?: string;
|
|
6
5
|
name: string;
|
|
7
6
|
type?: string;
|
|
8
7
|
required?: boolean;
|
|
9
8
|
autoComplete?: string;
|
|
10
9
|
}
|
|
11
|
-
declare const useSignUpForm:
|
|
12
|
-
submitRef: import("react").MutableRefObject<
|
|
10
|
+
export declare const useSignUpForm: (loading: RequestInfo, error: any, signUp: (data: any, callback?: () => void) => void, callback?: () => void, checkConfig?: Partial<CheckoutConfig>, hasThanx?: boolean) => {
|
|
11
|
+
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
13
12
|
data: Partial<Profile>;
|
|
14
13
|
errors: any;
|
|
15
14
|
submitting: boolean;
|
|
@@ -18,4 +17,3 @@ declare const useSignUpForm: <SubmitRef extends Field>(loading: RequestInfo, err
|
|
|
18
17
|
handleChange: (name: string, type: string, value: string | null, checked: boolean | null) => void;
|
|
19
18
|
handleSubmit: () => void;
|
|
20
19
|
};
|
|
21
|
-
export default useSignUpForm;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { makePhone } from '@open-tender/utils';
|
|
3
|
-
const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}, hasThanx = false) => {
|
|
3
|
+
export const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}, hasThanx = false) => {
|
|
4
4
|
const { displayed, required } = checkConfig || {};
|
|
5
5
|
const companyDisplayed = displayed && displayed.customer.includes('company');
|
|
6
6
|
const companyRequired = required && required.customer.includes('company');
|
|
@@ -86,4 +86,3 @@ const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}, hasTh
|
|
|
86
86
|
handleSubmit,
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
|
-
export default useSignUpForm;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GuestData, RequestStatus } from '@open-tender/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
inputRef: import("react").MutableRefObject<InputRef | null>;
|
|
3
|
+
export declare const useSignUpGuestForm: (email: string, guest: Partial<GuestData>, loading: RequestStatus, error: any, signUp: (data: any) => void, submitGuest: (data: Partial<GuestData>) => void, hasThanx?: boolean) => {
|
|
4
|
+
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
|
+
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
7
6
|
data: {
|
|
8
7
|
first_name?: string | undefined;
|
|
9
8
|
email?: string | undefined;
|
|
@@ -20,4 +19,3 @@ declare const useSignUpGuestForm: <InputRef extends Field, SubmitRef extends Fie
|
|
|
20
19
|
handleSubmit: () => void;
|
|
21
20
|
handleGuest: () => void;
|
|
22
21
|
};
|
|
23
|
-
export default useSignUpGuestForm;
|
|
@@ -6,7 +6,7 @@ const initialData = {
|
|
|
6
6
|
phone: '',
|
|
7
7
|
password: '',
|
|
8
8
|
};
|
|
9
|
-
const useSignUpGuestForm = (email, guest, loading, error, signUp, submitGuest, hasThanx) => {
|
|
9
|
+
export const useSignUpGuestForm = (email, guest, loading, error, signUp, submitGuest, hasThanx) => {
|
|
10
10
|
const submitRef = useRef(null);
|
|
11
11
|
const inputRef = useRef(null);
|
|
12
12
|
const initData = Object.assign(Object.assign({}, initialData), guest);
|
|
@@ -69,4 +69,3 @@ const useSignUpGuestForm = (email, guest, loading, error, signUp, submitGuest, h
|
|
|
69
69
|
handleGuest,
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
export default useSignUpGuestForm;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LoginData, RequestStatus } from '@open-tender/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
inputRef: import("react").MutableRefObject<InputRef | null>;
|
|
3
|
+
export declare const useSignInForm: (email: string, loading: RequestStatus, error: any, login: (email?: string, password?: string) => void, callback?: () => void) => {
|
|
4
|
+
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
|
+
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
7
6
|
data: Partial<LoginData>;
|
|
8
7
|
submitting: boolean;
|
|
9
8
|
handleChange: (name: string, value: string) => void;
|
|
10
9
|
handleSubmit: () => void;
|
|
11
10
|
};
|
|
12
|
-
export default useSignInForm;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
const useSignInForm = (email, loading, error, login, callback) => {
|
|
2
|
+
export const useSignInForm = (email, loading, error, login, callback) => {
|
|
3
3
|
const submitRef = useRef(null);
|
|
4
4
|
const inputRef = useRef(null);
|
|
5
5
|
const [hasSubmit, setHasSubmit] = useState(false);
|
|
@@ -36,4 +36,3 @@ const useSignInForm = (email, loading, error, login, callback) => {
|
|
|
36
36
|
handleSubmit,
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
export default useSignInForm;
|
package/package.json
CHANGED