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.0.6 to 1.0.7

10

es/usePaymentInputs.js

@@ -120,7 +120,7 @@ import './utils/cardTypes-4f45f8d3.js';

setCardType(cardType);
setInputTouched('cardNumber', false);
setInputTouched('cardNumber', false); // @ts-ignore
cardNumberField.current.value = utils.formatter.formatCardNumber(cardNumber);
props.onChange && props.onChange(e);
onChange && onChange(e); // @ts-ignore
cardNumberField.current.value = utils.formatter.formatCardNumber(cardNumber); // Due to the card number formatting, the selection cursor will fall to the end of
onChange && onChange(e); // Due to the card number formatting, the selection cursor will fall to the end of
// the input field. Here, we want to reposition the cursor to the correct place.

@@ -210,5 +210,5 @@

setInputTouched('expiryDate', false);
expiryDateField.current.value = utils.formatter.formatExpiry(e);
props.onChange && props.onChange(e);
onChange && onChange(e);
expiryDateField.current.value = utils.formatter.formatExpiry(e);
var expiryDateError = utils.validator.getExpiryDateError(expiryDateField.current.value, {

@@ -215,0 +215,0 @@ errorMessages: errorMessages

@@ -126,7 +126,7 @@ 'use strict';

setCardType(cardType);
setInputTouched('cardNumber', false);
setInputTouched('cardNumber', false); // @ts-ignore
cardNumberField.current.value = index.default.formatter.formatCardNumber(cardNumber);
props.onChange && props.onChange(e);
onChange && onChange(e); // @ts-ignore
cardNumberField.current.value = index.default.formatter.formatCardNumber(cardNumber); // Due to the card number formatting, the selection cursor will fall to the end of
onChange && onChange(e); // Due to the card number formatting, the selection cursor will fall to the end of
// the input field. Here, we want to reposition the cursor to the correct place.

@@ -216,5 +216,5 @@

setInputTouched('expiryDate', false);
expiryDateField.current.value = index.default.formatter.formatExpiry(e);
props.onChange && props.onChange(e);
onChange && onChange(e);
expiryDateField.current.value = index.default.formatter.formatExpiry(e);
var expiryDateError = index.default.validator.getExpiryDateError(expiryDateField.current.value, {

@@ -221,0 +221,0 @@ errorMessages: errorMessages

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

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

@@ -186,15 +186,19 @@ # React Payment Inputs

```js
const { ... } = usePaymentInputs({
errorMessages: {
emptyCardNumber: 'El número de la tarjeta es inválido',
invalidCardNumber: 'El número de la tarjeta es inválido',
emptyExpiryDate: 'La fecha de expiración es inválida',
monthOutOfRange: 'El mes de expiración debe estar entre 01 y 12',
yearOutOfRange: 'El año de expiración no puede estar en el pasado',
dateOutOfRange: 'La fecha de expiración no puede estar en el pasado',
invalidExpiryDate: 'La fecha de expiración es inválida',
emptyCVC: 'El código de seguridad es inválido',
invalidCVC: 'El código de seguridad es inválido'
}
})
const ERROR_MESSAGES = {
emptyCardNumber: 'El número de la tarjeta es inválido',
invalidCardNumber: 'El número de la tarjeta es inválido',
emptyExpiryDate: 'La fecha de expiración es inválida',
monthOutOfRange: 'El mes de expiración debe estar entre 01 y 12',
yearOutOfRange: 'El año de expiración no puede estar en el pasado',
dateOutOfRange: 'La fecha de expiración no puede estar en el pasado',
invalidExpiryDate: 'La fecha de expiración es inválida',
emptyCVC: 'El código de seguridad es inválido',
invalidCVC: 'El código de seguridad es inválido'
}
export default function MyComponent() {
const { ... } = usePaymentInputs({
errorMessages: ERROR_MESSAGES
});
}
```

@@ -201,0 +205,0 @@

@@ -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 l(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)||f()}function s(e){return d(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||f()}function d(e){if(Array.isArray(e))return e}function f(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var p=/(\d{1,4})/g,v=[{displayName:"Visa",type:"visa",format:p,startPattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",length:3}},{displayName:"Mastercard",type:"mastercard",format:p,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:p,startPattern:/^(36|38|30[0-5])/,gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",length:3}},{displayName:"Discover",type:"discover",format:p,startPattern:/^(6011|65|64[4-9]|622)/,gaps:[4,8,12],lengths:[16,19],code:{name:"CID",length:3}},{displayName:"JCB",type:"jcb",format:p,startPattern:/^35/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",length:3}},{displayName:"UnionPay",type:"unionpay",format:p,startPattern:/^62/,gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",length:3}},{displayName:"Maestro",type:"maestro",format:p,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:p,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:p,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:p,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=s(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=l(t.join("").match(/^(\d{2}).*(\d{2})$/)||[],3),c=i[1],d=void 0===c?null:c,f=i[2];return[d,void 0===f?null:f].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){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).errorMessages,n=void 0===r?{}:r;if(!e)return n.emptyCardNumber||"Enter a card number";var t=y(e);if(t&&t.lengths&&t.lengths.includes(e.length)&&m(e))return;return n.invalidCardNumber||"Card number is invalid"},getExpiryDateError:function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).errorMessages,n=void 0===r?{}:r;if(!e)return n.emptyExpiryDate||"Enter an expiry date";var t=e.replace(" / ","").replace("/","");if(4===t.length){var a=t.slice(0,2),o="20".concat(t.slice(2,4));return g.test(a)?parseInt(o)<(new Date).getFullYear()?n.yearOutOfRange||"Expiry year cannot be in the past":parseInt(o)===(new Date).getFullYear()&&parseInt(a)<(new Date).getMonth()+1?n.dateOutOfRange||"Expiry date cannot be in the past":void 0:n.monthOutOfRange||"Expiry month must be between 01 and 12"}return n.invalidExpiryDate||"Expiry date is invalid"},getCVCError:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.cardType,t=r.errorMessages,a=void 0===t?{}:t;return e?e.length<3?a.invalidCVC||"CVC is invalid":n&&e.length!==n.code.length?a.invalidCVC||"CVC is invalid":void 0:a.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.errorMessages,t=e.onBlur,o=e.onChange,c=e.onError,s=e.onTouch,d=r.useRef(),f=r.useRef(),p=r.useRef(),v=r.useRef(),y=l(r.useState({cardNumber:!1,expiryDate:!1,cvc:!1,zip:!1}),2),g=y[0],m=y[1],C=l(r.useState(!1),2),b=C[0],E=C[1],P=l(r.useState({cardNumber:void 0,expiryDate:void 0,cvc:void 0,zip:void 0}),2),x=P[0],D=P[1],N=l(r.useState(),2),O=N[0],T=N[1],_=l(r.useState(),2),K=_[0],w=_[1],k=l(r.useState(),2),I=k[0],V=k[1],j=r.useCallback(function(e,r){D(function(n){if(n[e]===r)return n;var t=r,o=u({},n,a({},e,r));return r?T(r):(t=Object.values(o).find(Boolean),T(t)),c&&c(t,o),o})},[]),A=r.useCallback(function(e,r){requestAnimationFrame(function(){"INPUT"!==document.activeElement.tagName?E(!0):!1===r&&E(!1)}),m(function(n){if(n[e]===r)return n;var t=u({},n,a({},e,r));return s&&s(a({},e,r),t),t})},[]),M=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("cardNumber",!0)}},[t,A]),R=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t=(r.target.value||"").replace(/\s/g,""),a=d.current.selectionStart,u=h.cardTypes.getCardTypeByValue(t);w(u),A("cardNumber",!1),e.onChange&&e.onChange(r),o&&o(r),d.current.value=h.formatter.formatCardNumber(t),requestAnimationFrame(function(){document.activeElement===d.current&&(" "===d.current.value[a-1]&&(a+=1),d.current.setSelectionRange(a,a))});var i=h.validator.getCardNumberError(t,{errorMessages:n});i||f.current&&f.current.focus(),j("cardNumber",i)}},[n,o,j,A]),B=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("cardNumber")}},[]),F=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())}},[]),Y=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",d),n,{onBlur:M(n),onChange:R(n),onFocus:B(n),onKeyPress:F(n)})},[M,R,B,F]),S=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("expiryDate",!0)}},[t,A]),z=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){A("expiryDate",!1),e.onChange&&e.onChange(r),o&&o(r),f.current.value=h.formatter.formatExpiry(r);var t=h.validator.getExpiryDateError(f.current.value,{errorMessages:n});t||p.current&&p.current.focus(),j("expiryDate",t)}},[n,o,j,A]),L=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("expiryDate")}},[]),W=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||d.current&&d.current.focus()}},[d]),U=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())}},[]),Z=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",f),n,{onBlur:S(n),onChange:z(n),onFocus:L(n),onKeyDown:W(n),onKeyPress:U(n)})},[S,z,L,W,U]),G=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("cvc",!0)}},[t,A]),H=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(t){var a=t.target.value;A("cvc",!1),e.onChange&&e.onChange(t),o&&o(t);var u=h.validator.getCVCError(a,{cardType:r,errorMessages:n});u||v.current&&v.current.focus(),j("cvc",u)}},[n,o,j,A]),q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("cvc")}},[]),$=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||f.current&&f.current.focus()}},[f]),X=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())}},[]),J=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:K?K.code.name:"CVC",type:"tel"},r||"ref",p),n,{onBlur:G(n),onChange:H(n,{cardType:K}),onFocus:q(n),onKeyDown:$(n),onKeyPress:X(n,{cardType:K})})},[K,G,H,q,$,X]),Q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("zip",!0)}},[t,A]),ee=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t=r.target.value;A("zip",!1),e.onChange&&e.onChange(r),o&&o(r);var a=h.validator.getZIPError(t,{errorMessages:n});j("zip",a)}},[n,o,j,A]),re=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("zip")}},[]),ne=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||p.current&&p.current.focus()}},[p]),te=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())}},[]),ae=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",v),n,{onBlur:Q(n),onChange:ee(n),onFocus:re(n),onKeyDown:ne(n),onKeyPress:te(n)})},[Q,ee,re,ne,te]),oe=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.images||{};return u({"aria-label":K?K.displayName:"Placeholder card",children:r[K?K.type:"placeholder"]||r.placeholder,width:"1.5em",height:"1em",viewBox:"0 0 24 16"},e)},[K]);return r.useLayoutEffect(function(){if(v.current){var e=h.validator.getZIPError(v.current.value,{errorMessages:n});j("zip",e)}if(p.current){var r=h.validator.getCVCError(p.current.value,{errorMessages:n});j("cvc",r)}if(f.current){var t=h.validator.getExpiryDateError(f.current.value,{errorMessages:n});j("expiryDate",t)}if(d.current){var a=h.validator.getCardNumberError(d.current.value,{errorMessages:n});j("cardNumber",a)}},[n,j]),r.useLayoutEffect(function(){d.current&&(d.current.value=h.formatter.formatCardNumber(d.current.value)),f.current&&(f.current.value=h.formatter.formatExpiry({target:f.current}))},[]),r.useLayoutEffect(function(){if(d.current){var e=h.cardTypes.getCardTypeByValue(d.current.value);w(e)}},[]),{getCardImageProps:oe,getCardNumberProps:Y,getExpiryDateProps:Z,getCVCProps:J,getZIPProps:ae,wrapperProps:{error:O,focused:I,isTouched:b},meta:{cardType:K,erroredInputs:x,error:O,focused:I,isTouched:b,touchedInputs:g}}}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,l=e.isTouched,s=e.styles,d=i(e,["children","error","errorTextProps","focused","inputWrapperProps","isTouched","styles"]),f=t&&l;return r.createElement(N,o({hasErrored:f,styles:s},d),r.createElement(O,o({focused:u,hasErrored:f,styles:s},c),n),f&&r.createElement(T,o({styles:s},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 l(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)||f()}function s(e){return d(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||f()}function d(e){if(Array.isArray(e))return e}function f(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var p=/(\d{1,4})/g,v=[{displayName:"Visa",type:"visa",format:p,startPattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",length:3}},{displayName:"Mastercard",type:"mastercard",format:p,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:p,startPattern:/^(36|38|30[0-5])/,gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",length:3}},{displayName:"Discover",type:"discover",format:p,startPattern:/^(6011|65|64[4-9]|622)/,gaps:[4,8,12],lengths:[16,19],code:{name:"CID",length:3}},{displayName:"JCB",type:"jcb",format:p,startPattern:/^35/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",length:3}},{displayName:"UnionPay",type:"unionpay",format:p,startPattern:/^62/,gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",length:3}},{displayName:"Maestro",type:"maestro",format:p,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:p,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:p,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:p,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=s(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=l(t.join("").match(/^(\d{2}).*(\d{2})$/)||[],3),c=i[1],d=void 0===c?null:c,f=i[2];return[d,void 0===f?null:f].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){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).errorMessages,n=void 0===r?{}:r;if(!e)return n.emptyCardNumber||"Enter a card number";var t=y(e);if(t&&t.lengths&&t.lengths.includes(e.length)&&m(e))return;return n.invalidCardNumber||"Card number is invalid"},getExpiryDateError:function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).errorMessages,n=void 0===r?{}:r;if(!e)return n.emptyExpiryDate||"Enter an expiry date";var t=e.replace(" / ","").replace("/","");if(4===t.length){var a=t.slice(0,2),o="20".concat(t.slice(2,4));return g.test(a)?parseInt(o)<(new Date).getFullYear()?n.yearOutOfRange||"Expiry year cannot be in the past":parseInt(o)===(new Date).getFullYear()&&parseInt(a)<(new Date).getMonth()+1?n.dateOutOfRange||"Expiry date cannot be in the past":void 0:n.monthOutOfRange||"Expiry month must be between 01 and 12"}return n.invalidExpiryDate||"Expiry date is invalid"},getCVCError:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.cardType,t=r.errorMessages,a=void 0===t?{}:t;return e?e.length<3?a.invalidCVC||"CVC is invalid":n&&e.length!==n.code.length?a.invalidCVC||"CVC is invalid":void 0:a.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.errorMessages,t=e.onBlur,o=e.onChange,c=e.onError,s=e.onTouch,d=r.useRef(),f=r.useRef(),p=r.useRef(),v=r.useRef(),y=l(r.useState({cardNumber:!1,expiryDate:!1,cvc:!1,zip:!1}),2),g=y[0],m=y[1],C=l(r.useState(!1),2),b=C[0],E=C[1],P=l(r.useState({cardNumber:void 0,expiryDate:void 0,cvc:void 0,zip:void 0}),2),x=P[0],D=P[1],N=l(r.useState(),2),O=N[0],T=N[1],_=l(r.useState(),2),K=_[0],w=_[1],k=l(r.useState(),2),I=k[0],V=k[1],j=r.useCallback(function(e,r){D(function(n){if(n[e]===r)return n;var t=r,o=u({},n,a({},e,r));return r?T(r):(t=Object.values(o).find(Boolean),T(t)),c&&c(t,o),o})},[]),A=r.useCallback(function(e,r){requestAnimationFrame(function(){"INPUT"!==document.activeElement.tagName?E(!0):!1===r&&E(!1)}),m(function(n){if(n[e]===r)return n;var t=u({},n,a({},e,r));return s&&s(a({},e,r),t),t})},[]),M=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("cardNumber",!0)}},[t,A]),R=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t=(r.target.value||"").replace(/\s/g,""),a=d.current.selectionStart,u=h.cardTypes.getCardTypeByValue(t);w(u),A("cardNumber",!1),d.current.value=h.formatter.formatCardNumber(t),e.onChange&&e.onChange(r),o&&o(r),requestAnimationFrame(function(){document.activeElement===d.current&&(" "===d.current.value[a-1]&&(a+=1),d.current.setSelectionRange(a,a))});var i=h.validator.getCardNumberError(t,{errorMessages:n});i||f.current&&f.current.focus(),j("cardNumber",i)}},[n,o,j,A]),B=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("cardNumber")}},[]),F=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())}},[]),Y=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",d),n,{onBlur:M(n),onChange:R(n),onFocus:B(n),onKeyPress:F(n)})},[M,R,B,F]),S=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("expiryDate",!0)}},[t,A]),z=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){A("expiryDate",!1),f.current.value=h.formatter.formatExpiry(r),e.onChange&&e.onChange(r),o&&o(r);var t=h.validator.getExpiryDateError(f.current.value,{errorMessages:n});t||p.current&&p.current.focus(),j("expiryDate",t)}},[n,o,j,A]),L=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("expiryDate")}},[]),W=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||d.current&&d.current.focus()}},[d]),U=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())}},[]),Z=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",f),n,{onBlur:S(n),onChange:z(n),onFocus:L(n),onKeyDown:W(n),onKeyPress:U(n)})},[S,z,L,W,U]),G=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("cvc",!0)}},[t,A]),H=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(t){var a=t.target.value;A("cvc",!1),e.onChange&&e.onChange(t),o&&o(t);var u=h.validator.getCVCError(a,{cardType:r,errorMessages:n});u||v.current&&v.current.focus(),j("cvc",u)}},[n,o,j,A]),q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("cvc")}},[]),$=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||f.current&&f.current.focus()}},[f]),X=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())}},[]),J=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:K?K.code.name:"CVC",type:"tel"},r||"ref",p),n,{onBlur:G(n),onChange:H(n,{cardType:K}),onFocus:q(n),onKeyDown:$(n),onKeyPress:X(n,{cardType:K})})},[K,G,H,q,$,X]),Q=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onBlur&&e.onBlur(r),t&&t(r),V(void 0),A("zip",!0)}},[t,A]),ee=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t=r.target.value;A("zip",!1),e.onChange&&e.onChange(r),o&&o(r);var a=h.validator.getZIPError(t,{errorMessages:n});j("zip",a)}},[n,o,j,A]),re=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){e.onFocus&&e.onFocus(),V("zip")}},[]),ne=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||p.current&&p.current.focus()}},[p]),te=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())}},[]),ae=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",v),n,{onBlur:Q(n),onChange:ee(n),onFocus:re(n),onKeyDown:ne(n),onKeyPress:te(n)})},[Q,ee,re,ne,te]),oe=r.useCallback(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.images||{};return u({"aria-label":K?K.displayName:"Placeholder card",children:r[K?K.type:"placeholder"]||r.placeholder,width:"1.5em",height:"1em",viewBox:"0 0 24 16"},e)},[K]);return r.useLayoutEffect(function(){if(v.current){var e=h.validator.getZIPError(v.current.value,{errorMessages:n});j("zip",e)}if(p.current){var r=h.validator.getCVCError(p.current.value,{errorMessages:n});j("cvc",r)}if(f.current){var t=h.validator.getExpiryDateError(f.current.value,{errorMessages:n});j("expiryDate",t)}if(d.current){var a=h.validator.getCardNumberError(d.current.value,{errorMessages:n});j("cardNumber",a)}},[n,j]),r.useLayoutEffect(function(){d.current&&(d.current.value=h.formatter.formatCardNumber(d.current.value)),f.current&&(f.current.value=h.formatter.formatExpiry({target:f.current}))},[]),r.useLayoutEffect(function(){if(d.current){var e=h.cardTypes.getCardTypeByValue(d.current.value);w(e)}},[]),{getCardImageProps:oe,getCardNumberProps:Y,getExpiryDateProps:Z,getCVCProps:J,getZIPProps:ae,wrapperProps:{error:O,focused:I,isTouched:b},meta:{cardType:K,erroredInputs:x,error:O,focused:I,isTouched:b,touchedInputs:g}}}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,l=e.isTouched,s=e.styles,d=i(e,["children","error","errorTextProps","focused","inputWrapperProps","isTouched","styles"]),f=t&&l;return r.createElement(N,o({hasErrored:f,styles:s},d),r.createElement(O,o({focused:u,hasErrored:f,styles:s},c),n),f&&r.createElement(T,o({styles:s},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