@open-tender/utils 0.0.68 → 0.0.69

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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { CreditCardData } from '@open-tender/types';
3
- declare const useCreditCard: (initState: any, cardErrors?: {}, disabled?: boolean) => {
3
+ export declare const useCreditCard: (initState: any, cardErrors?: {}, disabled?: boolean) => {
4
4
  submitRef: import("react").MutableRefObject<null>;
5
5
  data: CreditCardData;
6
6
  cardType: "VISA" | "MC" | "DISC" | "AMEX" | "OTHER";
@@ -11,4 +11,3 @@ declare const useCreditCard: (initState: any, cardErrors?: {}, disabled?: boolea
11
11
  handleBlur: (evt?: any) => void;
12
12
  isComplete: boolean;
13
13
  };
14
- export default useCreditCard;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCreditCard = void 0;
3
4
  const react_1 = require("react");
4
5
  const __1 = require("../");
5
6
  const defaultState = {
@@ -54,4 +55,4 @@ const useCreditCard = (initState, cardErrors = {}, disabled = false) => {
54
55
  isComplete,
55
56
  };
56
57
  };
57
- exports.default = useCreditCard;
58
+ exports.useCreditCard = useCreditCard;
@@ -1,6 +1,5 @@
1
- declare const useImage: (src: string) => {
1
+ export declare const useImage: (src: string) => {
2
2
  hasLoaded: boolean;
3
3
  hasError: boolean;
4
4
  hasStartedInitialFetch: boolean;
5
5
  };
6
- export default useImage;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useImage = void 0;
3
4
  const react_1 = require("react");
4
5
  // https://typesafe.blog/article/fetch-images-with-a-react-hook
5
6
  const useImage = (src) => {
@@ -28,4 +29,4 @@ const useImage = (src) => {
28
29
  }, [src]);
29
30
  return { hasLoaded, hasError, hasStartedInitialFetch };
30
31
  };
31
- exports.default = useImage;
32
+ exports.useImage = useImage;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { RequestStatus } from '@open-tender/types';
3
- declare const useLevelUpForm: (email: string, loading: RequestStatus, error: any, connect: (data: any, callback: any) => void, callback: any) => {
3
+ export declare const useLevelUpForm: (email: string, loading: RequestStatus, error: any, connect: (data: any, callback: any) => void, callback: any) => {
4
4
  submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
5
5
  inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
6
6
  data: any;
@@ -9,4 +9,3 @@ declare const useLevelUpForm: (email: string, loading: RequestStatus, error: any
9
9
  handleChange: (evt?: any) => void;
10
10
  handleSubmit: (evt?: any) => void;
11
11
  };
12
- export default useLevelUpForm;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLevelUpForm = void 0;
3
4
  const react_1 = require("react");
4
5
  const useLevelUpForm = (email, loading, error, connect, callback) => {
5
6
  const submitRef = (0, react_1.useRef)(null);
@@ -39,4 +40,4 @@ const useLevelUpForm = (email, loading, error, connect, callback) => {
39
40
  handleSubmit,
40
41
  };
41
42
  };
42
- exports.default = useLevelUpForm;
43
+ exports.useLevelUpForm = useLevelUpForm;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { CreditCardData } from '@open-tender/types';
3
- declare const useCreditCard: (initState: any, cardErrors?: {}, disabled?: boolean) => {
3
+ export declare const useCreditCard: (initState: any, cardErrors?: {}, disabled?: boolean) => {
4
4
  submitRef: import("react").MutableRefObject<null>;
5
5
  data: CreditCardData;
6
6
  cardType: "VISA" | "MC" | "DISC" | "AMEX" | "OTHER";
@@ -11,4 +11,3 @@ declare const useCreditCard: (initState: any, cardErrors?: {}, disabled?: boolea
11
11
  handleBlur: (evt?: any) => void;
12
12
  isComplete: boolean;
13
13
  };
14
- export default useCreditCard;
@@ -7,7 +7,7 @@ const defaultState = {
7
7
  zip: '',
8
8
  is_default: false,
9
9
  };
10
- const useCreditCard = (initState, cardErrors = {}, disabled = false) => {
10
+ export const useCreditCard = (initState, cardErrors = {}, disabled = false) => {
11
11
  const [initCard, initCardType] = formatCard(initState);
12
12
  const submitRef = useRef(null);
13
13
  const [data, setData] = useState(initCard || defaultState);
@@ -52,4 +52,3 @@ const useCreditCard = (initState, cardErrors = {}, disabled = false) => {
52
52
  isComplete,
53
53
  };
54
54
  };
55
- export default useCreditCard;
@@ -1,6 +1,5 @@
1
- declare const useImage: (src: string) => {
1
+ export declare const useImage: (src: string) => {
2
2
  hasLoaded: boolean;
3
3
  hasError: boolean;
4
4
  hasStartedInitialFetch: boolean;
5
5
  };
6
- export default useImage;
@@ -1,6 +1,6 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  // https://typesafe.blog/article/fetch-images-with-a-react-hook
3
- const useImage = (src) => {
3
+ export const useImage = (src) => {
4
4
  const [hasLoaded, setHasLoaded] = useState(false);
5
5
  const [hasError, setHasError] = useState(false);
6
6
  const [hasStartedInitialFetch, setHasStartedInitialFetch] = useState(false);
@@ -26,4 +26,3 @@ const useImage = (src) => {
26
26
  }, [src]);
27
27
  return { hasLoaded, hasError, hasStartedInitialFetch };
28
28
  };
29
- export default useImage;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { RequestStatus } from '@open-tender/types';
3
- declare const useLevelUpForm: (email: string, loading: RequestStatus, error: any, connect: (data: any, callback: any) => void, callback: any) => {
3
+ export declare const useLevelUpForm: (email: string, loading: RequestStatus, error: any, connect: (data: any, callback: any) => void, callback: any) => {
4
4
  submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
5
5
  inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
6
6
  data: any;
@@ -9,4 +9,3 @@ declare const useLevelUpForm: (email: string, loading: RequestStatus, error: any
9
9
  handleChange: (evt?: any) => void;
10
10
  handleSubmit: (evt?: any) => void;
11
11
  };
12
- export default useLevelUpForm;
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
- const useLevelUpForm = (email, loading, error, connect, callback) => {
2
+ export const useLevelUpForm = (email, loading, error, connect, callback) => {
3
3
  const submitRef = useRef(null);
4
4
  const inputRef = useRef(null);
5
5
  const [data, setData] = useState({ email });
@@ -37,4 +37,3 @@ const useLevelUpForm = (email, loading, error, connect, callback) => {
37
37
  handleSubmit,
38
38
  };
39
39
  };
40
- export default useLevelUpForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.0.68",
3
+ "version": "0.0.69",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",