Comparing version 0.1.0 to 0.2.0
export { useOmise } from './useOmise'; | ||
export { useOmiseScript } from './useOmiseScript'; | ||
export type { ScriptTypes, useOmiseArgs, CreateTokenAsTypes, CreateTokenHandler, CreateTokenFunction, useOmiseReturn, } from './types'; | ||
export type { ScriptTypes, useOmiseArgs, CreateTokenAsTypes, CreateHandler, CreateTokenFunction, CreateSourceFunction, useOmiseReturn, } from './types'; |
@@ -12,4 +12,5 @@ declare global { | ||
export declare type CreateTokenAsTypes = 'card'; | ||
export declare type CreateTokenHandler = (status: number, response: Record<string, any>) => void; | ||
export declare type CreateTokenFunction = (as: CreateTokenAsTypes, attributes: Record<string, any>, handler: CreateTokenHandler) => void; | ||
export declare type CreateHandler = (status: number, response: Record<string, any>) => void; | ||
export declare type CreateTokenFunction = (as: CreateTokenAsTypes, attributes: Record<string, any>, handler: CreateHandler) => void; | ||
export declare type CreateSourceFunction = (type: string, options: Record<string, unknown>, handler: CreateHandler) => void; | ||
export interface useOmiseReturn { | ||
@@ -20,2 +21,3 @@ loading: boolean; | ||
checkCreateTokenError: (response: Record<string, any>) => string | null; | ||
createSource: CreateSourceFunction | null; | ||
} |
@@ -19,3 +19,4 @@ "use strict"; | ||
var _b = react_1.useState(null), createTokenFn = _b[0], setCreateTokenFn = _b[1]; | ||
var _c = useOmiseScript_1.useOmiseScript(scriptType), loadingScript = _c[0], errorLoadingScript = _c[1]; | ||
var _c = react_1.useState(null), createSourceFn = _c[0], setCreateSourceFn = _c[1]; | ||
var _d = useOmiseScript_1.useOmiseScript(scriptType), loadingScript = _d[0], errorLoadingScript = _d[1]; | ||
react_1.useEffect(function () { | ||
@@ -28,7 +29,11 @@ if (window.Omise) { | ||
if (window.Omise) { | ||
var Omise_1 = window.Omise; | ||
var createToken = function () { | ||
var Omise = window.Omise; | ||
return Omise.createToken.bind(Omise); | ||
return Omise_1.createToken.bind(Omise_1); | ||
}; | ||
var createSource = function () { | ||
return Omise_1.createSource.bind(Omise_1); | ||
}; | ||
setCreateTokenFn(createToken); | ||
setCreateSourceFn(createSource); | ||
} | ||
@@ -41,4 +46,5 @@ }, [loadingScript]); | ||
checkCreateTokenError: exports.checkCreateTokenError, | ||
createSource: createSourceFn, | ||
}; | ||
}; | ||
exports.useOmise = useOmise; |
{ | ||
"name": "use-omise", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A React hook for Omise payments", | ||
@@ -13,2 +13,3 @@ "author": "Chris Vibert", | ||
"prepublishOnly": "yarn test && yarn build", | ||
"preversion": "yarn test", | ||
"test": "jest" | ||
@@ -20,2 +21,6 @@ }, | ||
}, | ||
"keywords": [ | ||
"react", | ||
"omise" | ||
], | ||
"devDependencies": { | ||
@@ -22,0 +27,0 @@ "@testing-library/react-hooks": "^3.7.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14765
12
191