@open-tender/utils 0.1.59 → 0.1.60
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.
|
@@ -4,7 +4,7 @@ export declare const useCreditCardForm: (loading: RequestStatus, error: RequestE
|
|
|
4
4
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
5
|
recaptchaRef: import("react").MutableRefObject<any>;
|
|
6
6
|
data: CreditCardData | null;
|
|
7
|
-
errors:
|
|
7
|
+
errors: Record<string, string> | CreditCardErrors;
|
|
8
8
|
submitting: boolean;
|
|
9
9
|
handleSubmit: (evt?: React.FormEvent<HTMLFormElement>) => void;
|
|
10
10
|
};
|
|
@@ -25,6 +25,7 @@ export declare const checkGuestData: (data: CheckoutFormCustomer, email: string)
|
|
|
25
25
|
};
|
|
26
26
|
guestIncomplete: boolean;
|
|
27
27
|
};
|
|
28
|
+
export declare const checkNotFound: (errors: Record<string, string>) => boolean | null;
|
|
28
29
|
export declare const makeRandomNumberString: () => string;
|
|
29
30
|
export declare const getWidth: () => number;
|
|
30
31
|
export declare const getHeight: () => number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasEntities = exports.convertStringToArray = exports.formatDollars = exports.formatQuantity = exports.addCommas = exports.displayPrice = exports.makeSlides = exports.makeImageUrl = exports.makeImageMap = exports.getHeight = exports.getWidth = exports.makeRandomNumberString = exports.checkGuestData = exports.checkEmpty = exports.validateEmail = exports.dashesToSlashes = exports.slashesToDashes = exports.makeBirthDate = exports.validatePhone = exports.makePhone = exports.cleanPhone = exports.capitalize = exports.serialize = exports.stripTags = exports.slugify = exports.contains = exports.isNum = exports.isEmpty = exports.isObject = exports.isString = void 0;
|
|
3
|
+
exports.hasEntities = exports.convertStringToArray = exports.formatDollars = exports.formatQuantity = exports.addCommas = exports.displayPrice = exports.makeSlides = exports.makeImageUrl = exports.makeImageMap = exports.getHeight = exports.getWidth = exports.makeRandomNumberString = exports.checkNotFound = exports.checkGuestData = exports.checkEmpty = exports.validateEmail = exports.dashesToSlashes = exports.slashesToDashes = exports.makeBirthDate = exports.validatePhone = exports.makePhone = exports.cleanPhone = exports.capitalize = exports.serialize = exports.stripTags = exports.slugify = exports.contains = exports.isNum = exports.isEmpty = exports.isObject = exports.isString = void 0;
|
|
4
4
|
const isString = (str) => {
|
|
5
5
|
return typeof str === 'string';
|
|
6
6
|
};
|
|
@@ -129,6 +129,13 @@ const checkGuestData = (data, email) => {
|
|
|
129
129
|
return { guestData, guestIncomplete };
|
|
130
130
|
};
|
|
131
131
|
exports.checkGuestData = checkGuestData;
|
|
132
|
+
const checkNotFound = (errors) => {
|
|
133
|
+
const errMsg = errors ? errors.email || errors.form : null;
|
|
134
|
+
if (!errMsg)
|
|
135
|
+
return null;
|
|
136
|
+
return (errMsg.includes('not associated') || errMsg.includes('Account not found'));
|
|
137
|
+
};
|
|
138
|
+
exports.checkNotFound = checkNotFound;
|
|
132
139
|
const makeRandomNumberString = () => Math.floor(Math.random() * 1000000000).toString();
|
|
133
140
|
exports.makeRandomNumberString = makeRandomNumberString;
|
|
134
141
|
const getWidth = () => {
|
|
@@ -4,7 +4,7 @@ export declare const useCreditCardForm: (loading: RequestStatus, error: RequestE
|
|
|
4
4
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
5
|
recaptchaRef: import("react").MutableRefObject<any>;
|
|
6
6
|
data: CreditCardData | null;
|
|
7
|
-
errors:
|
|
7
|
+
errors: Record<string, string> | CreditCardErrors;
|
|
8
8
|
submitting: boolean;
|
|
9
9
|
handleSubmit: (evt?: React.FormEvent<HTMLFormElement>) => void;
|
|
10
10
|
};
|
|
@@ -25,6 +25,7 @@ export declare const checkGuestData: (data: CheckoutFormCustomer, email: string)
|
|
|
25
25
|
};
|
|
26
26
|
guestIncomplete: boolean;
|
|
27
27
|
};
|
|
28
|
+
export declare const checkNotFound: (errors: Record<string, string>) => boolean | null;
|
|
28
29
|
export declare const makeRandomNumberString: () => string;
|
|
29
30
|
export declare const getWidth: () => number;
|
|
30
31
|
export declare const getHeight: () => number;
|
|
@@ -108,6 +108,12 @@ export const checkGuestData = (data, email) => {
|
|
|
108
108
|
const guestIncomplete = checkEmpty(Object.assign(Object.assign({}, guestData), { phone: validPhone }));
|
|
109
109
|
return { guestData, guestIncomplete };
|
|
110
110
|
};
|
|
111
|
+
export const checkNotFound = (errors) => {
|
|
112
|
+
const errMsg = errors ? errors.email || errors.form : null;
|
|
113
|
+
if (!errMsg)
|
|
114
|
+
return null;
|
|
115
|
+
return (errMsg.includes('not associated') || errMsg.includes('Account not found'));
|
|
116
|
+
};
|
|
111
117
|
export const makeRandomNumberString = () => Math.floor(Math.random() * 1000000000).toString();
|
|
112
118
|
export const getWidth = () => {
|
|
113
119
|
return Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.documentElement.clientWidth);
|
package/package.json
CHANGED