Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-payment-inputs

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-payment-inputs - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

4

es/usePaymentInputs.js

@@ -150,2 +150,3 @@ import './utils/cardTypes-4f45f8d3.js';

setInputError('cardNumber', cardNumberError);
props.onError && props.onError(cardNumberError);
};

@@ -227,2 +228,3 @@ }, [autoFocus, cardNumberValidator, errorMessages, onChange, setInputError, setInputTouched]);

setInputError('expiryDate', expiryDateError);
props.onError && props.onError(expiryDateError);
};

@@ -320,2 +322,3 @@ }, [autoFocus, errorMessages, expiryValidator, onChange, setInputError, setInputTouched]);

setInputError('cvc', cvcError);
props.onError && props.onError(cvcError);
};

@@ -415,2 +418,3 @@ }, [autoFocus, cvcValidator, errorMessages, onChange, setInputError, setInputTouched]);

setInputError('zip', zipError);
props.onError && props.onError(zipError);
};

@@ -417,0 +421,0 @@ }, [errorMessages, onChange, setInputError, setInputTouched]);

@@ -156,2 +156,3 @@ 'use strict';

setInputError('cardNumber', cardNumberError);
props.onError && props.onError(cardNumberError);
};

@@ -233,2 +234,3 @@ }, [autoFocus, cardNumberValidator, errorMessages, onChange, setInputError, setInputTouched]);

setInputError('expiryDate', expiryDateError);
props.onError && props.onError(expiryDateError);
};

@@ -326,2 +328,3 @@ }, [autoFocus, errorMessages, expiryValidator, onChange, setInputError, setInputTouched]);

setInputError('cvc', cvcError);
props.onError && props.onError(cvcError);
};

@@ -421,2 +424,3 @@ }, [autoFocus, cvcValidator, errorMessages, onChange, setInputError, setInputTouched]);

setInputError('zip', zipError);
props.onError && props.onError(zipError);
};

@@ -423,0 +427,0 @@ }, [errorMessages, onChange, setInputError, setInputTouched]);

2

package.json
{
"name": "react-payment-inputs",
"version": "1.1.3",
"version": "1.1.4",
"description": "A zero-dependency React Hook & Container to help with payment card input fields.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("styled-components")):"function"==typeof define&&define.amd?define(["exports","react","styled-components"],r):r((e=e||self).ReactPaymentInputs={},e.React,e.StyledComponents)}(this,function(e,r,n){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var t="default"in n?n.default:n;function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(){return(o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function u(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){a(e,r,n[r])})}return e}function i(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function c(e,r){return r||(r=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(r)}}))}function s(e,r){return d(e)||function(e,r){var n=[],t=!0,a=!1,o=void 0;try{for(var u,i=e[Symbol.iterator]();!(t=(u=i.next()).done)&&(n.push(u.value),!r||n.length!==r);t=!0);}catch(e){a=!0,o=e}finally{try{t||null==i.return||i.return()}finally{if(a)throw o}}return n}(e,r)||p()}function l(e){return d(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||p()}function d(e){if(Array.isArray(e))return e}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var f=/(\d{1,4})/g,v=[{displayName:"Visa",type:"visa",format:f,startPattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",length:3}},{displayName:"Mastercard",type:"mastercard",format:f,startPattern:/^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/,gaps:[4,8,12],lengths:[16],code:{name:"CVC",length:3}},{displayName:"American Express",type:"amex",format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,startPattern:/^3[47]/,gaps:[4,10],lengths:[15],code:{name:"CID",length:4}},{displayName:"Diners Club",type:"dinersclub",format:f,startPattern:/^(36|38|30[0-5])/,gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",length:3}},{displayName:"Discover",type:"discover",format:f,startPattern:/^(6011|65|64[4-9]|622)/,gaps:[4,8,12],lengths:[16,19],code:{name:"CID",length:3}},{displayName:"JCB",type:"jcb",format:f,startPattern:/^35/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",length:3}},{displayName:"UnionPay",type:"unionpay",format:f,startPattern:/^62/,gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",length:3}},{displayName:"Maestro",type:"maestro",format:f,startPattern:/^(5018|5020|5038|6304|6703|6708|6759|676[1-3])/,gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",length:3}},{displayName:"Elo",type:"elo",format:f,startPattern:/^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|4(0[5-9]|3[0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8])|9([2-6][0-9]|7[0-8])|541|700|720|901)|651652|655000|655021)/,gaps:[4,8,12],lengths:[16],code:{name:"CVE",length:3}},{displayName:"Hipercard",type:"hipercard",format:f,startPattern:/^(384100|384140|384160|606282|637095|637568|60(?!11))/,gaps:[4,8,12],lengths:[16],code:{name:"CVC",length:3}}],y=function(e){return v.filter(function(r){return r.startPattern.test(e)})[0]},g=/(0[1-9]|1[0-2])/,m=function(e){return e.split("").reverse().map(function(e){return parseInt(e,10)}).map(function(e,r){return r%2?2*e:e}).map(function(e){return e>9?e%10+1:e}).reduce(function(e,r){return e+r})%10==0},h={cardTypes:Object.freeze({DEFAULT_CVC_LENGTH:3,DEFAULT_ZIP_LENGTH:5,DEFAULT_CARD_FORMAT:f,CARD_TYPES:v,getCardTypeByValue:y,getCardTypeByType:function(e){return v.filter(function(r){return r.type===e})[0]}}),formatter:Object.freeze({formatCardNumber:function(e){var r=y(e);if(!r)return(e.match(/\d+/g)||[]).join("");var n=r.format;if(n&&n.global)return(e.match(n)||[]).join(" ");if(n){var t=n.exec(e.split(" ").join(""));if(t)return t.splice(1,3).filter(function(e){return e}).join(" ")}return e},formatExpiry:function(e){var r=e.nativeEvent&&e.nativeEvent.data,n=e.target.value.split(" / ").join("/");if(!n)return null;var t=n;if(/^[2-9]$/.test(t)&&(t="0".concat(t)),2===n.length&&+n>12){var a=l(n.split("")),o=a[0],u=a.slice(1);t="0".concat(o,"/").concat(u.join(""))}if(/^1[\/-]$/.test(t))return"01 / ";if(1===(t=t.match(/(\d{1,2})/g)||[]).length){if(!r&&n.includes("/"))return t[0];if(/\d{2}/.test(t))return"".concat(t[0]," / ")}if(t.length>2){var i=s(t.join("").match(/^(\d{2}).*(\d{2})$/)||[],3),c=i[1],d=void 0===c?null:c,p=i[2];return[d,void 0===p?null:p].join(" / ")}return t.join(" / ")}}),validator:Object.freeze({EMPTY_CARD_NUMBER:"Enter a card number",EMPTY_EXPIRY_DATE:"Enter an expiry date",EMPTY_CVC:"Enter a CVC",EMPTY_ZIP:"Enter a ZIP code",INVALID_CARD_NUMBER:"Card number is invalid",INVALID_EXPIRY_DATE:"Expiry date is invalid",INVALID_CVC:"CVC is invalid",MONTH_OUT_OF_RANGE:"Expiry month must be between 01 and 12",YEAR_OUT_OF_RANGE:"Expiry year cannot be in the past",DATE_OUT_OF_RANGE:"Expiry date cannot be in the past",hasCardNumberReachedMaxLength:function(e){var r=y(e);return r&&e.length>=r.lengths[r.lengths.length-1]},isNumeric:function(e){return/^\d*$/.test(e.key)},validateLuhn:m,getCardNumberError:function(e,r){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).errorMessages,t=void 0===n?{}:n;if(!e)return t.emptyCardNumber||"Enter a card number";var a=e.replace(/\s/g,""),o=y(a);if(o&&o.lengths&&o.lengths.includes(a.length)&&m(a))return r?r({cardNumber:a,cardType:o,errorMessages:t}):void 0;return t.invalidCardNumber||"Card number is invalid"},getExpiryDateError:function(e,r){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).errorMessages,t=void 0===n?{}:n;if(!e)return t.emptyExpiryDate||"Enter an expiry date";var a=e.replace(" / ","").replace("/","");if(4===a.length){var o=a.slice(0,2),u="20".concat(a.slice(2,4));return g.test(o)?parseInt(u)<(new Date).getFullYear()?t.yearOutOfRange||"Expiry year cannot be in the past":parseInt(u)===(new Date).getFullYear()&&parseInt(o)<(new Date).getMonth()+1?t.dateOutOfRange||"Expiry date cannot be in the past":r?r({expiryDate:{month:o,year:u},errorMessages:t}):void 0:t.monthOutOfRange||"Expiry month must be between 01 and 12"}return t.invalidExpiryDate||"Expiry date is invalid"},getCVCError:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=n.cardType,a=n.errorMessages,o=void 0===a?{}:a;return e?e.length<3?o.invalidCVC||"CVC is invalid":t&&e.length!==t.code.length?o.invalidCVC||"CVC is invalid":r?r({cvc:e,cardType:t,errorMessages:o}):void 0:o.emptyCVC||"Enter a CVC"},getZIPError:function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).errorMessages;if(!e)return(void 0===r?{}:r).emptyZIP||"Enter a ZIP code"}}),BACKSPACE_KEY_CODE:8,ENTER_KEY_CODE:0,isHighlighted:function(){return"Range"===(window.getSelection()||{type:void 0}).type}};function C(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.autoFocus,t=void 0===n||n,o=e.errorMessages,c=e.onBlur,l=e.onChange,d=e.onError,p=e.onTouch,f=e.cardNumberValidator,v=e.cvcValidator,y=e.expiryValidator,g=r.useRef(),m=r.useRef(),C=r.useRef(),b=r.useRef(),E=s(r.useState({cardNumber:!1,expiryDate:!1,cvc:!1,zip:!1}),2),P=E[0],x=E[1],D=s(r.useState(!1),2),N=D[0],O=D[1],T=s(r.useState({cardNumber:void 0,expiryDate:void 0,cvc:void 0,zip:void 0}),2),_=T[0],K=T[1],w=s(r.useState(),2),V=w[0],k=w[1],I=s(r.useState(),2),M=I[0],j=I[1],A=s(r.useState(),2),R=A[0],B=A[1],F=r.useCallback(function(e,r){K(function(n){if(n[e]===r)return n;var t=r,o=u({},n,a({},e,r));return r?k(r):(t=Object.values(o).find(Boolean),k(t)),d&&d(t,o),o})},[]),Y=r.useCallback(function(e,r){requestAnimationFrame(function(){"INPUT"!==document.activeElement.tagName?O(!0):!1===r&&O(!1)}),x(function(n){if(n[e]===r)return n;var t=u({},n,a({},e,r));return p&&p(a({},e,r),t),t})},[]),S=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("cardNumber",!0)}},[c,Y]),z=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=(r.target.value||"").replace(/\s/g,""),a=g.current.selectionStart,u=h.cardTypes.getCardTypeByValue(n);j(u),Y("cardNumber",!1),g.current.value=h.formatter.formatCardNumber(n),e.onChange&&e.onChange(r),l&&l(r),requestAnimationFrame(function(){document.activeElement===g.current&&(" "===g.current.value[a-1]&&(a+=1),g.current.setSelectionRange(a,a))});var i=h.validator.getCardNumberError(n,f,{errorMessages:o});!i&&t&&m.current&&m.current.focus(),F("cardNumber",i)}},[t,f,o,l,F,Y]),L=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("cardNumber")}},[]),W=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=(r.target.value||"").replace(/\s/g,"");e.onKeyPress&&e.onKeyPress(r),r.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(r)||r.preventDefault(),h.validator.hasCardNumberReachedMaxLength(n)&&r.preventDefault())}},[]),U=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({"aria-label":"Card number",autoComplete:"cc-number",id:"cardNumber",name:"cardNumber",placeholder:"Card number",type:"tel"},r||"ref",g),n,{onBlur:S(n),onChange:z(n),onFocus:L(n),onKeyPress:W(n)})},[S,z,L,W]),Z=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("expiryDate",!0)}},[c,Y]),G=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){Y("expiryDate",!1),m.current.value=h.formatter.formatExpiry(r),e.onChange&&e.onChange(r),l&&l(r);var n=h.validator.getExpiryDateError(m.current.value,y,{errorMessages:o});!n&&t&&C.current&&C.current.focus(),F("expiryDate",n)}},[t,o,y,l,F,Y]),H=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("expiryDate")}},[]),q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyDown&&e.onKeyDown(r),r.keyCode===h.BACKSPACE_KEY_CODE&&!r.target.value&&t&&g.current&&g.current.focus()}},[t]),$=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=(r.target.value||"").replace(" / ","");e.onKeyPress&&e.onKeyPress(r),r.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(r)||r.preventDefault(),n.length>=4&&r.preventDefault())}},[]),X=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({"aria-label":"Expiry date in format MM YY",autoComplete:"cc-exp",id:"expiryDate",name:"expiryDate",placeholder:"MM/YY",type:"tel"},r||"ref",m),n,{onBlur:Z(n),onChange:G(n),onFocus:H(n),onKeyDown:q(n),onKeyPress:$(n)})},[Z,G,H,q,$]),J=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("cvc",!0)}},[c,Y]),Q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).cardType;return function(n){var a=n.target.value;Y("cvc",!1),e.onChange&&e.onChange(n),l&&l(n);var u=h.validator.getCVCError(a,v,{cardType:r,errorMessages:o});!u&&t&&b.current&&b.current.focus(),F("cvc",u)}},[t,v,o,l,F,Y]),ee=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("cvc")}},[]),re=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyDown&&e.onKeyDown(r),r.keyCode===h.BACKSPACE_KEY_CODE&&!r.target.value&&t&&m.current&&m.current.focus()}},[t]),ne=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(arguments.length>1?arguments[1]:void 0).cardType;return function(n){var t=(n.target.value||"").replace(" / ","");e.onKeyPress&&e.onKeyPress(n),n.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(n)||n.preventDefault(),r&&t.length>=r.code.length&&n.preventDefault(),t.length>=4&&n.preventDefault())}},[]),te=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({"aria-label":"CVC",autoComplete:"cc-csc",id:"cvc",name:"cvc",placeholder:M?M.code.name:"CVC",type:"tel"},r||"ref",C),n,{onBlur:J(n),onChange:Q(n,{cardType:M}),onFocus:ee(n),onKeyDown:re(n),onKeyPress:ne(n,{cardType:M})})},[M,J,Q,ee,re,ne]),ae=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("zip",!0)}},[c,Y]),oe=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=r.target.value;Y("zip",!1),e.onChange&&e.onChange(r),l&&l(r);var t=h.validator.getZIPError(n,{errorMessages:o});F("zip",t)}},[o,l,F,Y]),ue=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("zip")}},[]),ie=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyDown&&e.onKeyDown(r),r.keyCode===h.BACKSPACE_KEY_CODE&&!r.target.value&&t&&C.current&&C.current.focus()}},[t]),ce=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyPress&&e.onKeyPress(r),r.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(r)||r.preventDefault())}},[]),se=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({autoComplete:"off",id:"zip",maxLength:"6",name:"zip",placeholder:"ZIP",type:"tel"},r||"ref",b),n,{onBlur:ae(n),onChange:oe(n),onFocus:ue(n),onKeyDown:ie(n),onKeyPress:ce(n)})},[ae,oe,ue,ie,ce]),le=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.images||{};return u({"aria-label":M?M.displayName:"Placeholder card",children:r[M?M.type:"placeholder"]||r.placeholder,width:"1.5em",height:"1em",viewBox:"0 0 24 16"},e)},[M]);return r.useLayoutEffect(function(){if(b.current){var e=h.validator.getZIPError(b.current.value,{errorMessages:o});F("zip",e)}if(C.current){var r=h.validator.getCVCError(C.current.value,v,{errorMessages:o});F("cvc",r)}if(m.current){var n=h.validator.getExpiryDateError(m.current.value,y,{errorMessages:o});F("expiryDate",n)}if(g.current){var t=h.validator.getCardNumberError(g.current.value,f,{errorMessages:o});F("cardNumber",t)}},[f,v,o,y,F]),r.useLayoutEffect(function(){g.current&&(g.current.value=h.formatter.formatCardNumber(g.current.value)),m.current&&(m.current.value=h.formatter.formatExpiry({target:m.current}))},[]),r.useLayoutEffect(function(){if(g.current){var e=h.cardTypes.getCardTypeByValue(g.current.value);j(e)}},[]),{getCardImageProps:le,getCardNumberProps:U,getExpiryDateProps:X,getCVCProps:te,getZIPProps:se,wrapperProps:{error:V,focused:R,isTouched:N},meta:{cardType:M,erroredInputs:_,error:V,focused:R,isTouched:N,touchedInputs:P}}}function b(){var e=c(["\n color: #c9444d;\n font-size: 0.75rem;\n margin-top: 0.25rem;\n\n & {\n ",";\n }\n"]);return b=function(){return e},e}function E(){var e=c(["\n border-color: #444bc9;\n box-shadow: #444bc9 0px 0px 0px 1px;\n ",";\n "]);return E=function(){return e},e}function P(){var e=c(["\n border-color: #c9444d;\n box-shadow: #c9444d 0px 0px 0px 1px;\n ",";\n "]);return P=function(){return e},e}function x(){var e=c(["\n align-items: center;\n background-color: white;\n border: 1px solid #bdbdbd;\n box-shadow: inset 0px 1px 2px #e5e5e5;\n border-radius: 0.2em;\n display: flex;\n height: 2.5em;\n padding: 0.4em 0.6em;\n\n & {\n ",";\n }\n\n & {\n ",";\n }\n\n & input {\n border: unset;\n margin: unset;\n padding: unset;\n outline: unset;\n font-size: inherit;\n\n & {\n ",";\n }\n\n ",";\n }\n\n & svg {\n margin-right: 0.6em;\n & {\n ",";\n }\n }\n\n & input#cardNumber {\n width: 11em;\n & {\n ",";\n }\n }\n\n & input#expiryDate {\n width: 4em;\n & {\n ",";\n }\n }\n\n & input#cvc {\n width: 2.5em;\n & {\n ",";\n }\n }\n\n & input#zip {\n width: 4em;\n & {\n ",";\n }\n }\n\n ",";\n"]);return x=function(){return e},e}function D(){var e=c(["\n display: inline-flex;\n flex-direction: column;\n\n & {\n ",";\n }\n\n ",";\n"]);return D=function(){return e},e}var N=t.div(D(),function(e){return e.hasErrored&&e.styles.fieldWrapper?e.styles.fieldWrapper.errored:void 0},function(e){return e.styles.fieldWrapper?e.styles.fieldWrapper.base:void 0}),O=t.div(x(),function(e){return e.hasErrored&&n.css(P(),function(e){return e.styles.inputWrapper&&e.styles.inputWrapper.errored})},function(e){return e.focused&&n.css(E(),function(e){return e.styles.inputWrapper&&e.styles.inputWrapper.focused})},function(e){return e.hasErrored&&e.styles.input?e.styles.input.errored:void 0},function(e){return e.styles.input&&e.styles.input.base},function(e){return e.styles.cardImage},function(e){return e.styles.input&&e.styles.input.cardNumber},function(e){return e.styles.input&&e.styles.input.expiryDate},function(e){return e.styles.input&&e.styles.input.cvc},function(e){return e.styles.input&&e.styles.input.zip},function(e){return e.styles.inputWrapper?e.styles.inputWrapper.base:void 0}),T=t.div(b(),function(e){return e.styles.errorText?e.styles.errorText.base:void 0});function _(e){var n=e.children,t=e.error,a=e.errorTextProps,u=e.focused,c=e.inputWrapperProps,s=e.isTouched,l=e.styles,d=i(e,["children","error","errorTextProps","focused","inputWrapperProps","isTouched","styles"]),p=t&&s;return r.createElement(N,o({hasErrored:p,styles:l},d),r.createElement(O,o({focused:u,hasErrored:p,styles:l},c),n),p&&r.createElement(T,o({styles:l},a),t))}_.defaultProps={styles:{}},e.PaymentInputsContainer=function(e){var r=C(e);return e.children(r)},e.PaymentInputsWrapper=_,e.usePaymentInputs=C,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("styled-components")):"function"==typeof define&&define.amd?define(["exports","react","styled-components"],r):r((e=e||self).ReactPaymentInputs={},e.React,e.StyledComponents)}(this,function(e,r,n){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var t="default"in n?n.default:n;function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(){return(o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function u(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){a(e,r,n[r])})}return e}function i(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function c(e,r){return r||(r=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(r)}}))}function s(e,r){return d(e)||function(e,r){var n=[],t=!0,a=!1,o=void 0;try{for(var u,i=e[Symbol.iterator]();!(t=(u=i.next()).done)&&(n.push(u.value),!r||n.length!==r);t=!0);}catch(e){a=!0,o=e}finally{try{t||null==i.return||i.return()}finally{if(a)throw o}}return n}(e,r)||p()}function l(e){return d(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||p()}function d(e){if(Array.isArray(e))return e}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var f=/(\d{1,4})/g,v=[{displayName:"Visa",type:"visa",format:f,startPattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",length:3}},{displayName:"Mastercard",type:"mastercard",format:f,startPattern:/^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/,gaps:[4,8,12],lengths:[16],code:{name:"CVC",length:3}},{displayName:"American Express",type:"amex",format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,startPattern:/^3[47]/,gaps:[4,10],lengths:[15],code:{name:"CID",length:4}},{displayName:"Diners Club",type:"dinersclub",format:f,startPattern:/^(36|38|30[0-5])/,gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",length:3}},{displayName:"Discover",type:"discover",format:f,startPattern:/^(6011|65|64[4-9]|622)/,gaps:[4,8,12],lengths:[16,19],code:{name:"CID",length:3}},{displayName:"JCB",type:"jcb",format:f,startPattern:/^35/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",length:3}},{displayName:"UnionPay",type:"unionpay",format:f,startPattern:/^62/,gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",length:3}},{displayName:"Maestro",type:"maestro",format:f,startPattern:/^(5018|5020|5038|6304|6703|6708|6759|676[1-3])/,gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",length:3}},{displayName:"Elo",type:"elo",format:f,startPattern:/^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|4(0[5-9]|3[0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8])|9([2-6][0-9]|7[0-8])|541|700|720|901)|651652|655000|655021)/,gaps:[4,8,12],lengths:[16],code:{name:"CVE",length:3}},{displayName:"Hipercard",type:"hipercard",format:f,startPattern:/^(384100|384140|384160|606282|637095|637568|60(?!11))/,gaps:[4,8,12],lengths:[16],code:{name:"CVC",length:3}}],y=function(e){return v.filter(function(r){return r.startPattern.test(e)})[0]},g=/(0[1-9]|1[0-2])/,m=function(e){return e.split("").reverse().map(function(e){return parseInt(e,10)}).map(function(e,r){return r%2?2*e:e}).map(function(e){return e>9?e%10+1:e}).reduce(function(e,r){return e+r})%10==0},h={cardTypes:Object.freeze({DEFAULT_CVC_LENGTH:3,DEFAULT_ZIP_LENGTH:5,DEFAULT_CARD_FORMAT:f,CARD_TYPES:v,getCardTypeByValue:y,getCardTypeByType:function(e){return v.filter(function(r){return r.type===e})[0]}}),formatter:Object.freeze({formatCardNumber:function(e){var r=y(e);if(!r)return(e.match(/\d+/g)||[]).join("");var n=r.format;if(n&&n.global)return(e.match(n)||[]).join(" ");if(n){var t=n.exec(e.split(" ").join(""));if(t)return t.splice(1,3).filter(function(e){return e}).join(" ")}return e},formatExpiry:function(e){var r=e.nativeEvent&&e.nativeEvent.data,n=e.target.value.split(" / ").join("/");if(!n)return null;var t=n;if(/^[2-9]$/.test(t)&&(t="0".concat(t)),2===n.length&&+n>12){var a=l(n.split("")),o=a[0],u=a.slice(1);t="0".concat(o,"/").concat(u.join(""))}if(/^1[\/-]$/.test(t))return"01 / ";if(1===(t=t.match(/(\d{1,2})/g)||[]).length){if(!r&&n.includes("/"))return t[0];if(/\d{2}/.test(t))return"".concat(t[0]," / ")}if(t.length>2){var i=s(t.join("").match(/^(\d{2}).*(\d{2})$/)||[],3),c=i[1],d=void 0===c?null:c,p=i[2];return[d,void 0===p?null:p].join(" / ")}return t.join(" / ")}}),validator:Object.freeze({EMPTY_CARD_NUMBER:"Enter a card number",EMPTY_EXPIRY_DATE:"Enter an expiry date",EMPTY_CVC:"Enter a CVC",EMPTY_ZIP:"Enter a ZIP code",INVALID_CARD_NUMBER:"Card number is invalid",INVALID_EXPIRY_DATE:"Expiry date is invalid",INVALID_CVC:"CVC is invalid",MONTH_OUT_OF_RANGE:"Expiry month must be between 01 and 12",YEAR_OUT_OF_RANGE:"Expiry year cannot be in the past",DATE_OUT_OF_RANGE:"Expiry date cannot be in the past",hasCardNumberReachedMaxLength:function(e){var r=y(e);return r&&e.length>=r.lengths[r.lengths.length-1]},isNumeric:function(e){return/^\d*$/.test(e.key)},validateLuhn:m,getCardNumberError:function(e,r){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).errorMessages,t=void 0===n?{}:n;if(!e)return t.emptyCardNumber||"Enter a card number";var a=e.replace(/\s/g,""),o=y(a);if(o&&o.lengths&&o.lengths.includes(a.length)&&m(a))return r?r({cardNumber:a,cardType:o,errorMessages:t}):void 0;return t.invalidCardNumber||"Card number is invalid"},getExpiryDateError:function(e,r){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).errorMessages,t=void 0===n?{}:n;if(!e)return t.emptyExpiryDate||"Enter an expiry date";var a=e.replace(" / ","").replace("/","");if(4===a.length){var o=a.slice(0,2),u="20".concat(a.slice(2,4));return g.test(o)?parseInt(u)<(new Date).getFullYear()?t.yearOutOfRange||"Expiry year cannot be in the past":parseInt(u)===(new Date).getFullYear()&&parseInt(o)<(new Date).getMonth()+1?t.dateOutOfRange||"Expiry date cannot be in the past":r?r({expiryDate:{month:o,year:u},errorMessages:t}):void 0:t.monthOutOfRange||"Expiry month must be between 01 and 12"}return t.invalidExpiryDate||"Expiry date is invalid"},getCVCError:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=n.cardType,a=n.errorMessages,o=void 0===a?{}:a;return e?e.length<3?o.invalidCVC||"CVC is invalid":t&&e.length!==t.code.length?o.invalidCVC||"CVC is invalid":r?r({cvc:e,cardType:t,errorMessages:o}):void 0:o.emptyCVC||"Enter a CVC"},getZIPError:function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).errorMessages;if(!e)return(void 0===r?{}:r).emptyZIP||"Enter a ZIP code"}}),BACKSPACE_KEY_CODE:8,ENTER_KEY_CODE:0,isHighlighted:function(){return"Range"===(window.getSelection()||{type:void 0}).type}};function C(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.autoFocus,t=void 0===n||n,o=e.errorMessages,c=e.onBlur,l=e.onChange,d=e.onError,p=e.onTouch,f=e.cardNumberValidator,v=e.cvcValidator,y=e.expiryValidator,g=r.useRef(),m=r.useRef(),C=r.useRef(),b=r.useRef(),E=s(r.useState({cardNumber:!1,expiryDate:!1,cvc:!1,zip:!1}),2),P=E[0],x=E[1],D=s(r.useState(!1),2),N=D[0],O=D[1],T=s(r.useState({cardNumber:void 0,expiryDate:void 0,cvc:void 0,zip:void 0}),2),_=T[0],K=T[1],w=s(r.useState(),2),V=w[0],k=w[1],I=s(r.useState(),2),M=I[0],j=I[1],A=s(r.useState(),2),R=A[0],B=A[1],F=r.useCallback(function(e,r){K(function(n){if(n[e]===r)return n;var t=r,o=u({},n,a({},e,r));return r?k(r):(t=Object.values(o).find(Boolean),k(t)),d&&d(t,o),o})},[]),Y=r.useCallback(function(e,r){requestAnimationFrame(function(){"INPUT"!==document.activeElement.tagName?O(!0):!1===r&&O(!1)}),x(function(n){if(n[e]===r)return n;var t=u({},n,a({},e,r));return p&&p(a({},e,r),t),t})},[]),S=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("cardNumber",!0)}},[c,Y]),z=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=(r.target.value||"").replace(/\s/g,""),a=g.current.selectionStart,u=h.cardTypes.getCardTypeByValue(n);j(u),Y("cardNumber",!1),g.current.value=h.formatter.formatCardNumber(n),e.onChange&&e.onChange(r),l&&l(r),requestAnimationFrame(function(){document.activeElement===g.current&&(" "===g.current.value[a-1]&&(a+=1),g.current.setSelectionRange(a,a))});var i=h.validator.getCardNumberError(n,f,{errorMessages:o});!i&&t&&m.current&&m.current.focus(),F("cardNumber",i),e.onError&&e.onError(i)}},[t,f,o,l,F,Y]),L=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("cardNumber")}},[]),W=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=(r.target.value||"").replace(/\s/g,"");e.onKeyPress&&e.onKeyPress(r),r.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(r)||r.preventDefault(),h.validator.hasCardNumberReachedMaxLength(n)&&r.preventDefault())}},[]),U=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({"aria-label":"Card number",autoComplete:"cc-number",id:"cardNumber",name:"cardNumber",placeholder:"Card number",type:"tel"},r||"ref",g),n,{onBlur:S(n),onChange:z(n),onFocus:L(n),onKeyPress:W(n)})},[S,z,L,W]),Z=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("expiryDate",!0)}},[c,Y]),G=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){Y("expiryDate",!1),m.current.value=h.formatter.formatExpiry(r),e.onChange&&e.onChange(r),l&&l(r);var n=h.validator.getExpiryDateError(m.current.value,y,{errorMessages:o});!n&&t&&C.current&&C.current.focus(),F("expiryDate",n),e.onError&&e.onError(n)}},[t,o,y,l,F,Y]),H=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("expiryDate")}},[]),q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyDown&&e.onKeyDown(r),r.keyCode===h.BACKSPACE_KEY_CODE&&!r.target.value&&t&&g.current&&g.current.focus()}},[t]),$=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=(r.target.value||"").replace(" / ","");e.onKeyPress&&e.onKeyPress(r),r.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(r)||r.preventDefault(),n.length>=4&&r.preventDefault())}},[]),X=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({"aria-label":"Expiry date in format MM YY",autoComplete:"cc-exp",id:"expiryDate",name:"expiryDate",placeholder:"MM/YY",type:"tel"},r||"ref",m),n,{onBlur:Z(n),onChange:G(n),onFocus:H(n),onKeyDown:q(n),onKeyPress:$(n)})},[Z,G,H,q,$]),J=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("cvc",!0)}},[c,Y]),Q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).cardType;return function(n){var a=n.target.value;Y("cvc",!1),e.onChange&&e.onChange(n),l&&l(n);var u=h.validator.getCVCError(a,v,{cardType:r,errorMessages:o});!u&&t&&b.current&&b.current.focus(),F("cvc",u),e.onError&&e.onError(u)}},[t,v,o,l,F,Y]),ee=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("cvc")}},[]),re=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyDown&&e.onKeyDown(r),r.keyCode===h.BACKSPACE_KEY_CODE&&!r.target.value&&t&&m.current&&m.current.focus()}},[t]),ne=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(arguments.length>1?arguments[1]:void 0).cardType;return function(n){var t=(n.target.value||"").replace(" / ","");e.onKeyPress&&e.onKeyPress(n),n.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(n)||n.preventDefault(),r&&t.length>=r.code.length&&n.preventDefault(),t.length>=4&&n.preventDefault())}},[]),te=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({"aria-label":"CVC",autoComplete:"cc-csc",id:"cvc",name:"cvc",placeholder:M?M.code.name:"CVC",type:"tel"},r||"ref",C),n,{onBlur:J(n),onChange:Q(n,{cardType:M}),onFocus:ee(n),onKeyDown:re(n),onKeyPress:ne(n,{cardType:M})})},[M,J,Q,ee,re,ne]),ae=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),c&&c(r),B(void 0),Y("zip",!0)}},[c,Y]),oe=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var n=r.target.value;Y("zip",!1),e.onChange&&e.onChange(r),l&&l(r);var t=h.validator.getZIPError(n,{errorMessages:o});F("zip",t),e.onError&&e.onError(t)}},[o,l,F,Y]),ue=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),B("zip")}},[]),ie=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyDown&&e.onKeyDown(r),r.keyCode===h.BACKSPACE_KEY_CODE&&!r.target.value&&t&&C.current&&C.current.focus()}},[t]),ce=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onKeyPress&&e.onKeyPress(r),r.keyCode!==h.ENTER_KEY_CODE&&(h.validator.isNumeric(r)||r.preventDefault())}},[]),se=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.refKey,n=i(e,["refKey"]);return u(a({autoComplete:"off",id:"zip",maxLength:"6",name:"zip",placeholder:"ZIP",type:"tel"},r||"ref",b),n,{onBlur:ae(n),onChange:oe(n),onFocus:ue(n),onKeyDown:ie(n),onKeyPress:ce(n)})},[ae,oe,ue,ie,ce]),le=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.images||{};return u({"aria-label":M?M.displayName:"Placeholder card",children:r[M?M.type:"placeholder"]||r.placeholder,width:"1.5em",height:"1em",viewBox:"0 0 24 16"},e)},[M]);return r.useLayoutEffect(function(){if(b.current){var e=h.validator.getZIPError(b.current.value,{errorMessages:o});F("zip",e)}if(C.current){var r=h.validator.getCVCError(C.current.value,v,{errorMessages:o});F("cvc",r)}if(m.current){var n=h.validator.getExpiryDateError(m.current.value,y,{errorMessages:o});F("expiryDate",n)}if(g.current){var t=h.validator.getCardNumberError(g.current.value,f,{errorMessages:o});F("cardNumber",t)}},[f,v,o,y,F]),r.useLayoutEffect(function(){g.current&&(g.current.value=h.formatter.formatCardNumber(g.current.value)),m.current&&(m.current.value=h.formatter.formatExpiry({target:m.current}))},[]),r.useLayoutEffect(function(){if(g.current){var e=h.cardTypes.getCardTypeByValue(g.current.value);j(e)}},[]),{getCardImageProps:le,getCardNumberProps:U,getExpiryDateProps:X,getCVCProps:te,getZIPProps:se,wrapperProps:{error:V,focused:R,isTouched:N},meta:{cardType:M,erroredInputs:_,error:V,focused:R,isTouched:N,touchedInputs:P}}}function b(){var e=c(["\n color: #c9444d;\n font-size: 0.75rem;\n margin-top: 0.25rem;\n\n & {\n ",";\n }\n"]);return b=function(){return e},e}function E(){var e=c(["\n border-color: #444bc9;\n box-shadow: #444bc9 0px 0px 0px 1px;\n ",";\n "]);return E=function(){return e},e}function P(){var e=c(["\n border-color: #c9444d;\n box-shadow: #c9444d 0px 0px 0px 1px;\n ",";\n "]);return P=function(){return e},e}function x(){var e=c(["\n align-items: center;\n background-color: white;\n border: 1px solid #bdbdbd;\n box-shadow: inset 0px 1px 2px #e5e5e5;\n border-radius: 0.2em;\n display: flex;\n height: 2.5em;\n padding: 0.4em 0.6em;\n\n & {\n ",";\n }\n\n & {\n ",";\n }\n\n & input {\n border: unset;\n margin: unset;\n padding: unset;\n outline: unset;\n font-size: inherit;\n\n & {\n ",";\n }\n\n ",";\n }\n\n & svg {\n margin-right: 0.6em;\n & {\n ",";\n }\n }\n\n & input#cardNumber {\n width: 11em;\n & {\n ",";\n }\n }\n\n & input#expiryDate {\n width: 4em;\n & {\n ",";\n }\n }\n\n & input#cvc {\n width: 2.5em;\n & {\n ",";\n }\n }\n\n & input#zip {\n width: 4em;\n & {\n ",";\n }\n }\n\n ",";\n"]);return x=function(){return e},e}function D(){var e=c(["\n display: inline-flex;\n flex-direction: column;\n\n & {\n ",";\n }\n\n ",";\n"]);return D=function(){return e},e}var N=t.div(D(),function(e){return e.hasErrored&&e.styles.fieldWrapper?e.styles.fieldWrapper.errored:void 0},function(e){return e.styles.fieldWrapper?e.styles.fieldWrapper.base:void 0}),O=t.div(x(),function(e){return e.hasErrored&&n.css(P(),function(e){return e.styles.inputWrapper&&e.styles.inputWrapper.errored})},function(e){return e.focused&&n.css(E(),function(e){return e.styles.inputWrapper&&e.styles.inputWrapper.focused})},function(e){return e.hasErrored&&e.styles.input?e.styles.input.errored:void 0},function(e){return e.styles.input&&e.styles.input.base},function(e){return e.styles.cardImage},function(e){return e.styles.input&&e.styles.input.cardNumber},function(e){return e.styles.input&&e.styles.input.expiryDate},function(e){return e.styles.input&&e.styles.input.cvc},function(e){return e.styles.input&&e.styles.input.zip},function(e){return e.styles.inputWrapper?e.styles.inputWrapper.base:void 0}),T=t.div(b(),function(e){return e.styles.errorText?e.styles.errorText.base:void 0});function _(e){var n=e.children,t=e.error,a=e.errorTextProps,u=e.focused,c=e.inputWrapperProps,s=e.isTouched,l=e.styles,d=i(e,["children","error","errorTextProps","focused","inputWrapperProps","isTouched","styles"]),p=t&&s;return r.createElement(N,o({hasErrored:p,styles:l},d),r.createElement(O,o({focused:u,hasErrored:p,styles:l},c),n),p&&r.createElement(T,o({styles:l},a),t))}_.defaultProps={styles:{}},e.PaymentInputsContainer=function(e){var r=C(e);return e.children(r)},e.PaymentInputsWrapper=_,e.usePaymentInputs=C,Object.defineProperty(e,"__esModule",{value:!0})});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc