@adyen/adyen-web 6.34.1 → 6.35.0

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.
Files changed (120) hide show
  1. package/dist/cjs/adyen.css +2 -3
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +39 -26
  6. package/dist/es/adyen.css +2 -3
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  9. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  10. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  11. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  18. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js +2 -0
  19. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -0
  20. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js +2 -0
  21. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js.map +1 -0
  22. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  23. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  24. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  25. package/dist/es/components/Card/constants.js.map +1 -1
  26. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  27. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  28. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  29. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  30. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  31. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  32. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  33. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  34. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  35. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  36. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  37. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  38. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  39. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  40. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  41. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  42. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  43. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js +1 -1
  44. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  45. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  46. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  47. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  48. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  49. package/dist/es/core/Analytics/Analytics.js +1 -1
  50. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  51. package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
  52. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  53. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  54. package/dist/es/core/config.js +1 -1
  55. package/dist/es/core/config.js.map +1 -1
  56. package/dist/es/index.d.ts +39 -26
  57. package/dist/es/utils/createSdkData.js +1 -1
  58. package/dist/es/utils/createSdkData.js.map +1 -1
  59. package/dist/es-legacy/adyen.css +2 -3
  60. package/dist/es-legacy/adyen.css.map +1 -1
  61. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  62. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  63. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  64. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  65. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  66. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  67. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  68. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  69. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  70. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  71. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js +2 -0
  72. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -0
  73. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js +2 -0
  74. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js.map +1 -0
  75. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  76. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  77. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  78. package/dist/es-legacy/components/Card/constants.js.map +1 -1
  79. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  80. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  81. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  82. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  83. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  84. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  85. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  86. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  87. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  88. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  89. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  90. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  91. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  92. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  93. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  94. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  95. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  96. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js +1 -1
  97. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  98. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  99. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  100. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  101. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  102. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  103. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  104. package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
  105. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  106. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  107. package/dist/es-legacy/core/config.js +1 -1
  108. package/dist/es-legacy/core/config.js.map +1 -1
  109. package/dist/es-legacy/utils/createSdkData.js +1 -1
  110. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  111. package/package.json +3 -3
  112. package/styles/adyen.css +2 -3
  113. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +0 -2
  114. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +0 -1
  115. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +0 -2
  116. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +0 -1
  117. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +0 -2
  118. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +0 -1
  119. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +0 -2
  120. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import i from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import l from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputValidationRules as p,getRuleByNameAndMode as y,cardInputFormatters as f}from"./validate.js";import h from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as S,shouldShowInstallmentsComponent as g,extractPropsForCardFields as N,extractPropsForSFP as A,getLayout as C}from"./utils.js";import F from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as j}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as v}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as w,getFocusHandler as x,getAddressHandler as B}from"./handlers.js";import E from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as P}from"../../../internal/Address/validate.js";import k from"../../../../core/Context/useImage.js";import{getArrayDifferences as R}from"../../../../utils/arrayUtils.js";import I from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as V}from"../../../internal/Icon/constants.js";import D from"./useSRPanelForCardInputErrors.js";import O from"../Fastlane/FastlaneSignup.js";import{fieldTypeToSnakeCase as q}from"../../../internal/SecuredFields/utils.js";import{getErrorMessageFromCode as M}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as _}from"../../../../core/Errors/constants.js";import{usePrevious as L}from"../../../../utils/hookUtils.js";import{AnalyticsInfoEvent as T,InfoEventType as K,UiTarget as U}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{useAmount as H}from"../../../../core/Context/AmountProvider.js";const z=l=>{const z=t(null),W=t(!1),$=k(),G=t(null),J=e=>{G.current=e},Q=t({});Object.keys(Q.current).length||l.setComponentRef(Q.current);const X=t(0),Y=t(!1),Z=o(()=>new F(l.specifications),[l.specifications]),{amount:ee}=H();Q.current.sfp=z;const[re,te]=n("ready"),[oe,ne]=n({}),[se,ae]=n({...l.holderNameRequired&&{holderName:!1}}),[ie,le]=n({...l.hasHolderName&&{holderName:l.data?.holderName??""}}),[de,ue]=n(""),[ce,me]=n(!1),[pe,ye]=n(c),[fe,he]=n(m),[be,Se]=n(null),[ge,Ne]=n([]),[Ae,Ce]=n(l.storedPaymentMethodId?l.brand:""),Fe=l.billingAddressMode!==d.none&&l.billingAddressRequired,je=S(l.billingAddressMode),ve=t(je&&l.data?.billingAddress?.country),[we,xe]=n(!1),[Be,Ee]=n(Fe?l.data?.billingAddress??null:null),[Pe,ke]=n(!1),[Re,Ie]=n(""),[Ve,De]=n({value:null}),[Oe,qe]=n(null),[Me,_e]=n("card"),[Le,Te]=n(!1),{handleChangeFor:Ke,triggerValidation:Ue,data:He,valid:ze,errors:We,setSchema:$e,setData:Ge,setValid:Je,setErrors:Qe}=b({schema:[],defaultData:l.data,formatters:f,rules:p}),Xe=g({installmentOptions:l.installmentOptions,fundingSource:l.fundingSource,amount:ee}),Ye=l.showInstallmentAmounts??!0,Ze="kr"===(be??l.countryCode),er=!!l.configuration.koreanAuthenticationRequired&&Ze,rr=Pe&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,tr=(e,r)=>{l.onFocus({fieldType:e,event:r})},or=(e,r)=>{l.onBlur({fieldType:e,event:r})},nr=s(e=>{_e(e.brand),l.onBrand(e)},[]),sr=x(ue,tr,or),ar=()=>C({props:l,showKCP:er,showBrazilianSSN:rr,...l.billingAddressRequired&&{countrySpecificSchemas:Z.getAddressSchemaForCountry(Be?.country),billingAddressRequiredFields:l.billingAddressRequiredFields}}),ir=s(e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;qe(r)},[]),lr=B(Ge,Je,Qe),dr=w(Y,z,ar()),ur=s(e=>{cr(e)},[Le,Te]),cr=e=>{e.status&&("loading"==e.status?Te(!1):Te(!0))},mr=o(()=>h(l,{sfp:z},{dualBrandSelectElements:ge,setDualBrandSelectElements:Ne,setSelectedBrandValue:Ce,issuingCountryCode:be,setIssuingCountryCode:Se},X),[ge,be]);Q.current.showValidation=()=>{W.current=!0,fr?.(),z.current.showValidation(),Ue(["holderName","socialSecurityNumber","taxNumber"]),G?.current&&G.current.showValidation()},Q.current.processBinLookupResponse=(e,r)=>{mr.processBinLookup(e,r)},Q.current.setStatus=te,a(()=>(Q.current.setFocusOn=z.current.setFocusOn,Q.current.updateStyles=z.current.updateStyles,Q.current.handleUnsupportedCard=z.current.handleUnsupportedCard,()=>{z.current.destroy()}),[]),a(()=>{const e=[...l.hasHolderName?["holderName"]:[],...rr?["socialSecurityNumber"]:[],...er?["taxNumber"]:[],...Fe?["billingAddress"]:[]];$e(e)},[l.hasHolderName,rr,er]),a(()=>{le({...ie,holderName:He.holderName??"",taxNumber:He.taxNumber}),Ie(He.socialSecurityNumber),Fe&&Ee({...He.billingAddress}),ae({...se,holderName:!l.holderNameRequired||ze.holderName,socialSecurityNumber:!!ze.socialSecurityNumber&&ze.socialSecurityNumber,taxNumber:!!ze.taxNumber&&ze.taxNumber,billingAddress:!!ze.billingAddress&&ze.billingAddress});const e=!!We.billingAddress&&Object.entries(We.billingAddress).reduce((e,[,r])=>e||null!=r,!1);ne({...oe,holderName:l.holderNameRequired&&We.holderName?We.holderName:null,socialSecurityNumber:rr&&We.socialSecurityNumber?We.socialSecurityNumber:null,taxNumber:er&&We.taxNumber?We.taxNumber:null,billingAddress:Fe&&e?We.billingAddress:null})},[He,ze,We]);const{sortedErrorList:pr,previousSortedErrors:yr,clearSRPanel:fr}=D({errors:oe,props:l,isValidating:W,retrieveLayout:ar,specifications:Z,billingAddress:Be,sfp:z});a(()=>{if(pr){const e=R(pr,yr,"field");e?.forEach(e=>{const r=new T({component:l.type,type:K.validationError,target:q(e.field),validationErrorCode:e.errorCode,validationErrorMessage:M(e.errorCode,_)});l.onSubmitAnalytics(r)})}},[pr]),a(()=>{const e=!!se.holderName,r=ce,t=!Fe||!!se.billingAddress,o=!er||!!se.taxNumber&&!!se.encryptedPassword,n=!rr||!!se.socialSecurityNumber,s=r&&e&&t&&o&&n,a=z.current.mapErrorsToValidationRuleResult(),i={...oe,...a};l.onChange({data:ie,valid:se,errors:i,isValid:s,billingAddress:Be,selectedBrandValue:Ae,storePaymentMethod:we,socialSecurityNumber:Re,installments:Ve})},[ie,se,oe,Ae,we,Ve]),a(()=>{if(ge.length>0&&ge){const e=ge.map(e=>e.id),r=e[0],t=e.toString(),o=new T({component:l.type,type:K.displayed,target:U.dualBrandButton,brand:r,configData:{dualBrands:t}});l.onSubmitAnalytics(o)}},[ge]);const hr=L(Ae);a(()=>{if(hr?.length&&Ae?.length){const e=new T({component:l.type,type:K.selected,target:U.dualBrandButton,brand:Ae});l.onSubmitAnalytics(e)}},[Ae]);const br=l.storedPaymentMethodId?j:v;return e(r,null,e(i,{ref:z,...A(l),styles:{...l.styles},koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onSubmitAnalytics:l.onSubmitAnalytics,onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=y("holderName","blur"),t=r?.(e.autoCompleteName,null)?e.autoCompleteName:null;return void(t&&(Ge("holderName",t),Je("holderName",!0),Qe("holderName",null)))}var t;l.autoFocus&&X.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&dr(),le({...ie,...e.data}),ne({...oe,...(t=e.errors,t?{encryptedCardNumber:!!t.encryptedCardNumber,encryptedExpiryDate:!!t.encryptedExpiryDate,encryptedSecurityCode:!!t.encryptedSecurityCode,encryptedPassword:!!t.encryptedPassword}:{})}),ae({...se,...e.valid}),me(e.isSfpValid),he(e.cvcPolicy),ke(e.showSocialSecurityNumber),ye(e.expiryDatePolicy)},onBrand:nr,onFocus:sr,onStateUpdate:ur,type:l.brand,componentType:l.type,disableIOSArrowKeys:l.disableIOSArrowKeys?ir:null,render:({setRootNode:r,setFocusOn:t},o)=>e("div",{ref:r,className:E({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${l.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===re}),role:"form"},Le&&e(I,null),e(br,{...N(l),data:ie,valid:se,errors:oe,handleChangeFor:Ke,focusedElement:de,setFocusOn:t,sfpState:o,cvcPolicy:fe,hasInstallments:Xe,showAmountsInInstallments:Ye,handleInstallments:De,brandsIcons:l.brandsIcons,formData:He,formErrors:We,formValid:ze,expiryDatePolicy:pe,dualBrandSelectElements:ge,extensions:mr,selectedBrandValue:Ae,showKCP:er,showBrazilianSSN:rr,socialSecurityNumber:Re,handleOnStoreDetails:xe,setAddressRef:J,billingAddress:Be,billingAddressValidationRules:je&&P(ve.current),partialAddressSchema:je,handleAddress:lr,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:Oe,onFieldFocusAnalytics:tr,onFieldBlurAnalytics:or}))}),l.fastlaneConfiguration&&e(O,{...l.fastlaneConfiguration,currentDetectedBrand:Me,onChange:l.onChange,onSubmitAnalytics:l.onSubmitAnalytics,type:l.type}),Le&&l.showPayButton&&l.payButton({status:re,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:$({imageFolder:"components/"})(`${V}lock`)}))};z.defaultProps=l;export{z as default};
1
+ import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import i from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import l from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputValidationRules as p,getRuleByNameAndMode as y,cardInputFormatters as f}from"./validate.js";import h from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as S,shouldShowInstallmentsComponent as g,extractPropsForCardFields as N,extractPropsForSFP as A,getLayout as C,requiresDualBrandSelection as F}from"./utils.js";import j from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as v}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as w}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as x,getFocusHandler as B,getAddressHandler as E}from"./handlers.js";import P from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as k}from"../../../internal/Address/validate.js";import R from"../../../../core/Context/useImage.js";import{getArrayDifferences as I}from"../../../../utils/arrayUtils.js";import V from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as D}from"../../../internal/Icon/constants.js";import O from"./useSRPanelForCardInputErrors.js";import q from"../Fastlane/FastlaneSignup.js";import{fieldTypeToSnakeCase as M}from"../../../internal/SecuredFields/utils.js";import{getErrorMessageFromCode as _}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as L}from"../../../../core/Errors/constants.js";import{usePrevious as T}from"../../../../utils/hookUtils.js";import{AnalyticsInfoEvent as K,InfoEventType as U,UiTarget as H}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{useAmount as z}from"../../../../core/Context/AmountProvider.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as W}from"../../constants.js";const $=l=>{const $=t(null),G=t(!1),J=R(),Q=t(null),X=e=>{Q.current=e},Y=t({});Object.keys(Y.current).length||l.setComponentRef(Y.current);const Z=t(0),ee=t(!1),re=o(()=>new j(l.specifications),[l.specifications]),{amount:te}=z();Y.current.sfp=$;const[oe,ne]=n("ready"),[se,ae]=n({}),[ie,le]=n({...l.holderNameRequired&&{holderName:!1}}),[de,ue]=n({...l.hasHolderName&&{holderName:l.data?.holderName??""}}),[ce,me]=n(""),[pe,ye]=n(!1),[fe,he]=n(c),[be,Se]=n(m),[ge,Ne]=n(null),[Ae,Ce]=n([]),[Fe,je]=n(l.storedPaymentMethodId?l.brand:""),ve=l.billingAddressMode!==d.none&&l.billingAddressRequired,we=S(l.billingAddressMode),xe=t(we&&l.data?.billingAddress?.country),[Be,Ee]=n(!1),[Pe,ke]=n(ve?l.data?.billingAddress??null:null),[Re,Ie]=n(!1),[Ve,De]=n(""),[Oe,qe]=n({value:null}),[Me,_e]=n(null),[Le,Te]=n("card"),[Ke,Ue]=n(!1),{handleChangeFor:He,triggerValidation:ze,data:We,valid:$e,errors:Ge,setSchema:Je,setData:Qe,setValid:Xe,setErrors:Ye}=b({schema:[],defaultData:l.data,formatters:f,rules:p}),Ze=g({installmentOptions:l.installmentOptions,fundingSource:l.fundingSource,amount:te}),er=l.showInstallmentAmounts??!0,rr="kr"===(ge??l.countryCode),tr=!!l.configuration.koreanAuthenticationRequired&&rr,or=Re&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,nr=(e,r)=>{l.onFocus({fieldType:e,event:r})},sr=(e,r)=>{l.onBlur({fieldType:e,event:r})},ar=s(e=>{Te(e.brand),l.onBrand(e)},[]),ir=B(me,nr,sr),lr=()=>C({props:l,showKCP:tr,showBrazilianSSN:or,...l.billingAddressRequired&&{countrySpecificSchemas:re.getAddressSchemaForCountry(Pe?.country),billingAddressRequiredFields:l.billingAddressRequiredFields}}),dr=s(e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;_e(r)},[]),ur=E(Qe,Xe,Ye),cr=x(ee,$,lr()),mr=s(e=>{pr(e)},[Ke,Ue]),pr=e=>{e.status&&("loading"==e.status?Ue(!1):Ue(!0))},yr=o(()=>h(l,{sfp:$},{dualBrandSelectElements:Ae,setDualBrandSelectElements:Ce,setSelectedBrandValue:je,issuingCountryCode:ge,setIssuingCountryCode:Ne},Z),[Ae,ge]);Y.current.showValidation=()=>{G.current=!0,br?.(),$.current.showValidation(),ze(["holderName","socialSecurityNumber","taxNumber"]),Q?.current&&Q.current.showValidation()},Y.current.processBinLookupResponse=(e,r)=>{yr.processBinLookup(e,r)},Y.current.setStatus=ne,a(()=>(Y.current.setFocusOn=$.current.setFocusOn,Y.current.updateStyles=$.current.updateStyles,Y.current.handleUnsupportedCard=$.current.handleUnsupportedCard,()=>{$.current.destroy()}),[]),a(()=>{const e=[...l.hasHolderName?["holderName"]:[],...or?["socialSecurityNumber"]:[],...tr?["taxNumber"]:[],...ve?["billingAddress"]:[]];Je(e)},[l.hasHolderName,or,tr]),a(()=>{ue({...de,holderName:We.holderName??"",taxNumber:We.taxNumber}),De(We.socialSecurityNumber),ve&&ke({...We.billingAddress}),le({...ie,holderName:!l.holderNameRequired||$e.holderName,socialSecurityNumber:!!$e.socialSecurityNumber&&$e.socialSecurityNumber,taxNumber:!!$e.taxNumber&&$e.taxNumber,billingAddress:!!$e.billingAddress&&$e.billingAddress});const e=!!Ge.billingAddress&&Object.entries(Ge.billingAddress).reduce((e,[,r])=>e||null!=r,!1);ae({...se,holderName:l.holderNameRequired&&Ge.holderName?Ge.holderName:null,socialSecurityNumber:or&&Ge.socialSecurityNumber?Ge.socialSecurityNumber:null,taxNumber:tr&&Ge.taxNumber?Ge.taxNumber:null,billingAddress:ve&&e?Ge.billingAddress:null})},[We,$e,Ge]);const{sortedErrorList:fr,previousSortedErrors:hr,clearSRPanel:br}=O({errors:se,props:l,isValidating:G,retrieveLayout:lr,specifications:re,billingAddress:Pe,sfp:$});a(()=>{if(fr){const e=I(fr,hr,"field");e?.forEach(e=>{const r=new K({component:l.type,type:U.validationError,target:M(e.field),validationErrorCode:e.errorCode,validationErrorMessage:_(e.errorCode,L)});l.onSubmitAnalytics(r)})}},[fr]),a(()=>{const e=!!ie.holderName,r=pe,t=!ve||!!ie.billingAddress,o=!tr||!!ie.taxNumber&&!!ie.encryptedPassword,n=!or||!!ie.socialSecurityNumber,s=r&&e&&t&&o&&n,a=$.current.mapErrorsToValidationRuleResult(),i={...se,...a};l.onChange({data:de,valid:ie,errors:i,isValid:s,billingAddress:Pe,selectedBrandValue:Fe,storePaymentMethod:Be,socialSecurityNumber:Ve,installments:Oe})},[de,ie,se,Fe,Be,Oe]),a(()=>{if(Ae.length>0&&Ae){const e=Ae.map(e=>e.id),r=e[0],t=e.toString();if(!!Ae&&F(W,Ae,"id")){const e=new K({component:l.type,type:U.displayed,target:H.dualBrandButton,brand:r,configData:{dualBrands:t}});l.onSubmitAnalytics(e)}}},[Ae]);const Sr=T(Fe);a(()=>{if(Sr?.length&&Fe?.length){const e=new K({component:l.type,type:U.selected,target:H.dualBrandButton,brand:Fe});l.onSubmitAnalytics(e)}},[Fe]);const gr=l.storedPaymentMethodId?v:w;return e(r,null,e(i,{ref:$,...A(l),styles:{...l.styles},koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onSubmitAnalytics:l.onSubmitAnalytics,onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=y("holderName","blur"),t=r?.(e.autoCompleteName,null)?e.autoCompleteName:null;return void(t&&(Qe("holderName",t),Xe("holderName",!0),Ye("holderName",null)))}var t;l.autoFocus&&Z.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&cr(),ue({...de,...e.data}),ae({...se,...(t=e.errors,t?{encryptedCardNumber:!!t.encryptedCardNumber,encryptedExpiryDate:!!t.encryptedExpiryDate,encryptedSecurityCode:!!t.encryptedSecurityCode,encryptedPassword:!!t.encryptedPassword}:{})}),le({...ie,...e.valid}),ye(e.isSfpValid),Se(e.cvcPolicy),Ie(e.showSocialSecurityNumber),he(e.expiryDatePolicy)},onBrand:ar,onFocus:ir,onStateUpdate:mr,type:l.brand,componentType:l.type,disableIOSArrowKeys:l.disableIOSArrowKeys?dr:null,render:({setRootNode:r,setFocusOn:t},o)=>e("div",{ref:r,className:P({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${l.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===oe}),role:"form"},Ke&&e(V,null),e(gr,{...N(l),data:de,valid:ie,errors:se,handleChangeFor:He,focusedElement:ce,setFocusOn:t,sfpState:o,cvcPolicy:be,hasInstallments:Ze,showAmountsInInstallments:er,handleInstallments:qe,brandsIcons:l.brandsIcons,formData:We,formErrors:Ge,formValid:$e,expiryDatePolicy:fe,dualBrandSelectElements:Ae,extensions:yr,selectedBrandValue:Fe,showKCP:tr,showBrazilianSSN:or,socialSecurityNumber:Ve,handleOnStoreDetails:Ee,setAddressRef:X,billingAddress:Pe,billingAddressValidationRules:we&&k(xe.current),partialAddressSchema:we,handleAddress:ur,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:Me,onFieldFocusAnalytics:nr,onFieldBlurAnalytics:sr}))}),l.fastlaneConfiguration&&e(q,{...l.fastlaneConfiguration,currentDetectedBrand:Le,onChange:l.onChange,onSubmitAnalytics:l.onSubmitAnalytics,type:l.type}),Ke&&l.showPayButton&&l.payButton({status:oe,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:J({imageFolder:"components/"})(`${D}lock`)}))};$.defaultProps=l;export{$ as default};
2
2
  //# sourceMappingURL=CardInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, shouldShowInstallmentsComponent } from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\nimport FastlaneSignup from '../Fastlane/FastlaneSignup';\nimport { fieldTypeToSnakeCase } from '../../../internal/SecuredFields/utils';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\n\nconst CardInput = (props: Readonly<CardInputProps>) => {\n const sfp = useRef<SecuredFieldsProvider>(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const { amount } = useAmount();\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data?.holderName ?? '' })\n });\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? (props.data?.billingAddress ?? null) : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsState>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * Used tho show and hide the pay button and instructions text\n * Should mimic the same logic as CardInput loading wrapper\n */\n const [showCardUIElements, setShowCardUIElements] = useState(false);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = shouldShowInstallmentsComponent({\n installmentOptions: props.installmentOptions,\n fundingSource: props.fundingSource,\n amount\n });\n\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = !!props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\n }, []);\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const mapSfpErrorsToCardInputErrors = (sfpErrors: SFPState['errors']): Partial<CardInputErrorState> => {\n if (!sfpErrors) return {};\n\n return {\n encryptedCardNumber: !!sfpErrors.encryptedCardNumber,\n encryptedExpiryDate: !!sfpErrors.encryptedExpiryDate,\n encryptedSecurityCode: !!sfpErrors.encryptedSecurityCode,\n encryptedPassword: !!sfpErrors.encryptedPassword\n };\n };\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn?.(sfState.autoCompleteName, null) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...mapSfpErrorsToCardInputErrors(sfState.errors) });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n /**\n * Listen to the full SecureFieldsProvider state and handle actions\n * Used right now to mimic the loading status changes, this can only be done this way\n * Trying to do it via onConfiguSuccess or onChange has side effects\n */\n const handleSFPStateUpdate = useCallback(\n sfpState => {\n mimicLoadingStatusChange(sfpState);\n },\n [showCardUIElements, setShowCardUIElements]\n );\n\n /**\n * This function implements the same logic that LoadingProvider uses to show and hide elements\n * We want to mimic this behavior so we can hide and show the pay button or the instructions text\n * Deciding to do it this way since we garante there's no DOM changes to merchants\n * We can break this in the next major version (v7)\n */\n const mimicLoadingStatusChange = (sfpState: SFPState) => {\n if (!sfpState.status) return;\n if (sfpState.status == 'loading') {\n setShowCardUIElements(false);\n } else {\n setShowCardUIElements(true);\n }\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n useEffect(() => {\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n newErrors?.forEach(errorItem => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.validationError,\n target: fieldTypeToSnakeCase(errorItem.field) as UiTarget,\n validationErrorCode: errorItem.errorCode,\n validationErrorMessage: getErrorMessageFromCode(errorItem.errorCode, SF_ErrorCodes)\n });\n props.onSubmitAnalytics(event);\n });\n }\n }, [currentErrorsSortedByLayout]);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = !!valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? !!valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * \"Update\" handler related to dual brand buttons being initially displayed\n */\n useEffect(() => {\n if (dualBrandSelectElements.length > 0 && dualBrandSelectElements) {\n const dualBrandsArr = dualBrandSelectElements.map(item => item.id);\n const brand = dualBrandsArr[0]; // initially selected brand\n const dualBrands = dualBrandsArr.toString();\n\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.dualBrandButton,\n brand,\n configData: { dualBrands }\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [dualBrandSelectElements]);\n\n const previousSelectedBrandValue = usePrevious(selectedBrandValue);\n\n /**\n * \"Update\" handler related to a dual brand button being selected\n */\n useEffect(() => {\n if (previousSelectedBrandValue?.length && selectedBrandValue?.length) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target: UiTarget.dualBrandButton,\n brand: selectedBrandValue\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [selectedBrandValue]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onSubmitAnalytics={props.onSubmitAnalytics}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n onStateUpdate={handleSFPStateUpdate}\n type={props.brand}\n componentType={props.type}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {showCardUIElements && <FormInstruction />}\n\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n\n {props.fastlaneConfiguration && (\n <FastlaneSignup\n {...props.fastlaneConfiguration}\n currentDetectedBrand={internallyDetectedBrand}\n onChange={props.onChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={props.type}\n />\n )}\n\n {showCardUIElements &&\n props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","amount","useAmount","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","showCardUIElements","setShowCardUIElements","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","shouldShowInstallmentsComponent","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","handleSFPStateUpdate","sfpState","mimicLoadingStatusChange","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","AnalyticsInfoEvent","component","type","InfoEventType","validationError","target","fieldTypeToSnakeCase","field","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onSubmitAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","dualBrandsArr","map","item","id","dualBrands","toString","displayed","UiTarget","dualBrandButton","configData","previousSelectedBrandValue","usePrevious","selected","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","holderNameValidationFn","getRuleByNameAndMode","acHolderName","sfpErrors","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode","onStateUpdate","componentType","disableIOSArrowKeys","render","setRootNode","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","fastlaneConfiguration","FastlaneSignup","currentDetectedBrand","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","image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C,eAAgBA,GAChB8G,WAAYA,EACZX,SAAUA,EACV5F,UAAWA,GACXqD,gBAAiBA,GACjBI,0BAA2BA,GAC3BuI,mBAAoBnK,GAEpBoK,YAAa1O,EAAM0O,YACnB1J,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACX3C,iBAAkBA,GAClBQ,wBAAyBA,GACzByF,WAAYA,GACZvF,mBAAoBA,GAEpBsD,QAASA,GAETG,iBAAkBA,GAClBtC,qBAAsBA,GAEtBwK,qBAAsB5K,GAEtBxD,cAAeA,EACfqD,eAAgBA,GAChBgL,8BAA+BnL,IAAwBoL,EAAiClL,GAAsBlD,SAC9GgD,qBAAsBA,GACtBuE,cAAeA,GACf8G,gBAAiB9O,EAAM8O,gBACvBC,kBAAmB/O,EAAM+O,kBACzBC,wBAAyBhP,EAAMgP,wBAE/BxK,gBAAiBA,GAEjBmC,sBAAuBA,GACvBM,qBAAsBA,QAMrCjH,EAAMiP,uBACHrC,EAACsC,EAAAA,IACOlP,EAAMiP,sBACVE,qBAAsBzK,GACtBiH,SAAU3L,EAAM2L,SAChBX,kBAAmBhL,EAAMgL,kBACzBX,KAAMrK,EAAMqK,OAInBzF,IACG5E,EAAMoP,eACNpP,EAAMqP,UAAU,CACZ/N,UACAgO,QAAStP,EAAMuP,0BAA4B,UAAY,YACvDC,KAAMpP,EAAS,CAAEqP,YAAa,eAAxBrP,CAAyC,GAAGsP,aAMtE3P,EAAU4P,aAAeA"}
1
+ {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse, DualBrandSelectElement } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport {\n handlePartialAddressMode,\n extractPropsForCardFields,\n extractPropsForSFP,\n getLayout,\n shouldShowInstallmentsComponent,\n requiresDualBrandSelection\n} from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\nimport FastlaneSignup from '../Fastlane/FastlaneSignup';\nimport { fieldTypeToSnakeCase } from '../../../internal/SecuredFields/utils';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../constants';\n\nconst CardInput = (props: Readonly<CardInputProps>) => {\n const sfp = useRef<SecuredFieldsProvider>(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const { amount } = useAmount();\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data?.holderName ?? '' })\n });\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState<DualBrandSelectElement[]>([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? (props.data?.billingAddress ?? null) : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsState>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * Used tho show and hide the pay button and instructions text\n * Should mimic the same logic as CardInput loading wrapper\n */\n const [showCardUIElements, setShowCardUIElements] = useState(false);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = shouldShowInstallmentsComponent({\n installmentOptions: props.installmentOptions,\n fundingSource: props.fundingSource,\n amount\n });\n\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = !!props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\n }, []);\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const mapSfpErrorsToCardInputErrors = (sfpErrors: SFPState['errors']): Partial<CardInputErrorState> => {\n if (!sfpErrors) return {};\n\n return {\n encryptedCardNumber: !!sfpErrors.encryptedCardNumber,\n encryptedExpiryDate: !!sfpErrors.encryptedExpiryDate,\n encryptedSecurityCode: !!sfpErrors.encryptedSecurityCode,\n encryptedPassword: !!sfpErrors.encryptedPassword\n };\n };\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn?.(sfState.autoCompleteName, null) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...mapSfpErrorsToCardInputErrors(sfState.errors) });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n /**\n * Listen to the full SecureFieldsProvider state and handle actions\n * Used right now to mimic the loading status changes, this can only be done this way\n * Trying to do it via onConfiguSuccess or onChange has side effects\n */\n const handleSFPStateUpdate = useCallback(\n sfpState => {\n mimicLoadingStatusChange(sfpState);\n },\n [showCardUIElements, setShowCardUIElements]\n );\n\n /**\n * This function implements the same logic that LoadingProvider uses to show and hide elements\n * We want to mimic this behavior so we can hide and show the pay button or the instructions text\n * Deciding to do it this way since we garante there's no DOM changes to merchants\n * We can break this in the next major version (v7)\n */\n const mimicLoadingStatusChange = (sfpState: SFPState) => {\n if (!sfpState.status) return;\n if (sfpState.status == 'loading') {\n setShowCardUIElements(false);\n } else {\n setShowCardUIElements(true);\n }\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n useEffect(() => {\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n newErrors?.forEach(errorItem => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.validationError,\n target: fieldTypeToSnakeCase(errorItem.field) as UiTarget,\n validationErrorCode: errorItem.errorCode,\n validationErrorMessage: getErrorMessageFromCode(errorItem.errorCode, SF_ErrorCodes)\n });\n props.onSubmitAnalytics(event);\n });\n }\n }, [currentErrorsSortedByLayout]);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = !!valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? !!valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * \"Update\" handler related to dual brand buttons being initially displayed\n */\n useEffect(() => {\n if (dualBrandSelectElements.length > 0 && dualBrandSelectElements) {\n const dualBrandsArr: string[] = dualBrandSelectElements.map(item => item.id);\n const brand = dualBrandsArr[0]; // initially selected brand\n const dualBrands = dualBrandsArr.toString();\n\n const showDualBrandSelector = dualBrandSelectElements\n ? requiresDualBrandSelection(DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM, dualBrandSelectElements, 'id')\n : false;\n\n // Only send analytics event about displaying dualBrand selector for countries that need to show a selection mechanism\n if (showDualBrandSelector) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.dualBrandButton,\n brand,\n configData: { dualBrands }\n });\n\n props.onSubmitAnalytics(event);\n }\n }\n }, [dualBrandSelectElements]);\n\n const previousSelectedBrandValue = usePrevious(selectedBrandValue);\n\n /**\n * \"Update\" handler related to a dual brand button being selected\n */\n useEffect(() => {\n if (previousSelectedBrandValue?.length && selectedBrandValue?.length) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target: UiTarget.dualBrandButton,\n brand: selectedBrandValue\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [selectedBrandValue]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onSubmitAnalytics={props.onSubmitAnalytics}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n onStateUpdate={handleSFPStateUpdate}\n type={props.brand}\n componentType={props.type}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState: SFPState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {showCardUIElements && <FormInstruction />}\n\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n\n {props.fastlaneConfiguration && (\n <FastlaneSignup\n {...props.fastlaneConfiguration}\n currentDetectedBrand={internallyDetectedBrand}\n onChange={props.onChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={props.type}\n />\n )}\n\n {showCardUIElements &&\n props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","amount","useAmount","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","showCardUIElements","setShowCardUIElements","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","shouldShowInstallmentsComponent","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","handleSFPStateUpdate","sfpState","mimicLoadingStatusChange","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","AnalyticsInfoEvent","component","type","InfoEventType","validationError","target","fieldTypeToSnakeCase","field","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onSubmitAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","dualBrandsArr","map","item","id","dualBrands","toString","requiresDualBrandSelection","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","displayed","UiTarget","dualBrandButton","configData","previousSelectedBrandValue","usePrevious","selected","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","holderNameValidationFn","getRuleByNameAndMode","acHolderName","sfpErrors","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode","onStateUpdate","componentType","disableIOSArrowKeys","render","setRootNode","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","fastlaneConfiguration","FastlaneSignup","currentDetectedBrand","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"gvEA6CA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAA8B,MACpCC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,GAG1BE,EAAeR,EAAqB,IAErCS,OAAOC,KAAKF,EAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBb,EAAO,GACzBc,GAAgBd,GAAO,GAEvBe,GAAiBC,EAAQ,IAAM,IAAIC,EAAenB,EAAMiB,gBAAiB,CAACjB,EAAMiB,kBAEhFG,OAAEA,IAAWC,IAGnBX,EAAaD,QAAQR,IAAMA,EAK3B,MAAOqB,GAAQC,IAAaC,EAAS,UAE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E,cAAeA,GACfgH,gBAAiBhP,EAAMgP,gBACvBC,kBAAmBjP,EAAMiP,kBACzBC,wBAAyBlP,EAAMkP,wBAE/B1K,gBAAiBA,GAEjBmC,sBAAuBA,GACvBM,qBAAsBA,QAMrCjH,EAAMmP,uBACHrC,EAACsC,EAAAA,IACOpP,EAAMmP,sBACVE,qBAAsB3K,GACtBiH,SAAU3L,EAAM2L,SAChBX,kBAAmBhL,EAAMgL,kBACzBX,KAAMrK,EAAMqK,OAInBzF,IACG5E,EAAMsP,eACNtP,EAAMuP,UAAU,CACZjO,UACAkO,QAASxP,EAAMyP,0BAA4B,UAAY,YACvDC,KAAMtP,EAAS,CAAEuP,YAAa,eAAxBvP,CAAyC,GAAGwP,aAMtE7P,EAAU8P,aAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as a,getFullBrandName as e}from"../utils.js";import t from"../../../../../core/Context/useImage.js";import{BrandImage as n}from"../../../../internal/BrandImage/BrandImage.js";function o({brand:o,brandsConfiguration:c={}}){const m=t(),d="card"===o?"nocard":o,i=c[o]?.icon??a(d,m);return r(n,{imgClassName:"adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon",alt:e(o),src:i})}export{o as default};
1
+ import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as a,getFullBrandName as e}from"../utils.js";import t from"../../../../../core/Context/useImage.js";import{BrandImage as n}from"../../../../internal/BrandImage/BrandImage.js";function o({brand:o,brandsConfiguration:c}){const m=t(),d="card"===o?"nocard":o,i=c?.[o]?.icon??a(d,m);return r(n,{imgClassName:"adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon",alt:e(o),src:i})}export{o as default};
2
2
  //# sourceMappingURL=BrandIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { BrandImage } from '../../../../internal/BrandImage';\n\nexport default function BrandIcon({ brand, brandsConfiguration = {} }: Readonly<BrandIconProps>) {\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageUrl = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n const imgClassName = `adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon`;\n\n return <BrandImage imgClassName={imgClassName} alt={getFullBrandName(brand)} src={imageUrl} />;\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","getImage","useImage","imageName","imageUrl","icon","getCardImageUrl","h","BrandImage","imgClassName","alt","getFullBrandName","src"],"mappings":"oRAMe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,EAAsB,CAAA,IAC7D,MAAMC,EAAWC,IACXC,EAAsB,SAAVJ,EAAmB,SAAWA,EAC1CK,EAAWJ,EAAoBD,IAAQM,MAAQC,EAAgBH,EAAWF,GAGhF,OAAOM,EAACC,EAAAA,CAAWC,aAFE,8EAE0BC,IAAKC,EAAiBZ,GAAQa,IAAKR,GACtF"}
1
+ {"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { BrandImage } from '../../../../internal/BrandImage';\n\nexport default function BrandIcon({ brand, brandsConfiguration }: Readonly<BrandIconProps>) {\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageUrl = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n const imgClassName = `adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon`;\n\n return <BrandImage imgClassName={imgClassName} alt={getFullBrandName(brand)} src={imageUrl} />;\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","getImage","useImage","imageName","imageUrl","icon","getCardImageUrl","h","BrandImage","imgClassName","alt","getFullBrandName","src"],"mappings":"oRAMe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,IACvC,MAAMC,EAAWC,IACXC,EAAsB,SAAVJ,EAAmB,SAAWA,EAC1CK,EAAWJ,IAAsBD,IAAQM,MAAQC,EAAgBH,EAAWF,GAGlF,OAAOM,EAACC,EAAAA,CAAWC,aAFE,8EAE0BC,IAAKC,EAAiBZ,GAAQa,IAAKR,GACtF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import o from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as i,ENCRYPTED_CARD_NUMBER as c,DATE_POLICY_HIDDEN as n,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:y,dualBrandingElements:x,errors:C,focusedElement:f,hasCVC:b,cvcPolicy:_,expiryDatePolicy:g,onFocusField:v,showBrandIcon:E,valid:h,showContextualElement:F}){const{i18n:N}=d(),j=(e,r)=>e[r]?N.get(e[r]):null,B=p?.filter(e=>!i?.includes(e.name)),D="amex"===m,V=D?N.get("creditCard.securityCode.contextualText.4digits"):N.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:y,error:j(C,c),focused:f===c,isValid:!!h.encryptedCardNumber,label:N.get("creditCard.cardNumber.label"),onFocusField:v,filled:!!C.encryptedCardNumber||!!h.encryptedCardNumber,showBrandIcon:E,dualBrandingElements:x}),e(u,{activeBrand:m,brands:B}),e("div",{className:o("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":g===n})},e(a,{classNameModifiers:["col-50"],error:j(C,l),focused:f===l,isValid:!!h.encryptedExpiryMonth&&!!h.encryptedExpiryYear,filled:!!C.encryptedExpiryDate||!!h.encryptedExpiryYear,label:N.get("creditCard.expiryDate.label"),onFocusField:v,expiryDatePolicy:g,showContextualElement:F,contextualText:N.get("creditCard.expiryDate.contextualText")}),b&&e(t,{classNameModifiers:["col-50"],error:j(C,s),focused:f===s,cvcPolicy:_,isValid:!!h.encryptedSecurityCode,filled:!!C.encryptedSecurityCode||!!h.encryptedSecurityCode,label:N.get("creditCard.securityCode.label"),onFocusField:v,frontCVC:D,showContextualElement:F,contextualText:V})))}export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import n from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as i,ENCRYPTED_CARD_NUMBER as o,DATE_POLICY_HIDDEN as c,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:y,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f,errors:b,focusedElement:g,hasCVC:_,cvcPolicy:h,expiryDatePolicy:v,onFocusField:E,showBrandIcon:B,valid:F,showContextualElement:N}){const{i18n:j}=d(),V=(e,r)=>e[r]?j.get(e[r]):null,D=p?.filter(e=>!i?.includes(e.name)),w="amex"===m,P=w?j.get("creditCard.securityCode.contextualText.4digits"):j.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:y,error:V(b,o),focused:g===o,isValid:!!F.encryptedCardNumber,label:j.get("creditCard.cardNumber.label"),onFocusField:E,filled:!!b.encryptedCardNumber||!!F.encryptedCardNumber,showBrandIcon:B,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f}),e(u,{activeBrand:m,brands:D}),e("div",{className:n("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":v===c})},e(a,{classNameModifiers:["col-50"],error:V(b,l),focused:g===l,isValid:!!F.encryptedExpiryMonth&&!!F.encryptedExpiryYear,filled:!!b.encryptedExpiryDate||!!F.encryptedExpiryYear,label:j.get("creditCard.expiryDate.label"),onFocusField:E,expiryDatePolicy:v,showContextualElement:N,contextualText:j.get("creditCard.expiryDate.contextualText")}),_&&e(t,{classNameModifiers:["col-50"],error:V(b,s),focused:g===s,cvcPolicy:h,isValid:!!F.encryptedSecurityCode,filled:!!b.encryptedSecurityCode||!!F.encryptedSecurityCode,label:j.get("creditCard.securityCode.label"),onFocusField:E,frontCVC:w,showContextualElement:N,contextualText:P})))}export{m as default};
2
2
  //# sourceMappingURL=CardFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardNumber from './CardNumber';\nimport CVC from './CVC';\nimport ExpirationDate from './ExpirationDate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardFieldsProps } from './types';\nimport classNames from 'classnames';\nimport {\n BRAND_ICON_UI_EXCLUSION_LIST,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport AvailableBrands from './AvailableBrands';\nimport './CardFields.scss';\n\nexport default function CardFields({\n brand,\n brandsIcons,\n brandsConfiguration,\n dualBrandingElements,\n errors,\n focusedElement,\n hasCVC,\n cvcPolicy,\n expiryDatePolicy,\n onFocusField,\n showBrandIcon,\n valid,\n showContextualElement\n}: Readonly<CardFieldsProps>) {\n const { i18n } = useCoreContext();\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n // A set of brands filtered to exclude those that can never appear in the UI\n const allowedBrands = brandsIcons?.filter(brandsIcons => !BRAND_ICON_UI_EXCLUSION_LIST?.includes(brandsIcons.name));\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form\">\n <CardNumber\n brand={brand}\n brandsConfiguration={brandsConfiguration}\n error={getError(errors, ENCRYPTED_CARD_NUMBER)}\n focused={focusedElement === ENCRYPTED_CARD_NUMBER}\n isValid={!!valid.encryptedCardNumber}\n label={i18n.get('creditCard.cardNumber.label')}\n onFocusField={onFocusField}\n filled={!!errors.encryptedCardNumber || !!valid.encryptedCardNumber}\n showBrandIcon={showBrandIcon}\n dualBrandingElements={dualBrandingElements}\n />\n\n <AvailableBrands activeBrand={brand} brands={allowedBrands} />\n\n <div\n className={classNames('adyen-checkout__card__exp-cvc', {\n 'adyen-checkout__card__exp-cvc__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN\n })}\n >\n <ExpirationDate\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_EXPIRY_DATE)}\n focused={focusedElement === ENCRYPTED_EXPIRY_DATE}\n isValid={!!valid.encryptedExpiryMonth && !!valid.encryptedExpiryYear}\n filled={!!errors.encryptedExpiryDate || !!valid.encryptedExpiryYear}\n label={i18n.get('creditCard.expiryDate.label')}\n onFocusField={onFocusField}\n expiryDatePolicy={expiryDatePolicy}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('creditCard.expiryDate.contextualText')}\n />\n\n {hasCVC && (\n <CVC\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === ENCRYPTED_SECURITY_CODE}\n cvcPolicy={cvcPolicy}\n isValid={!!valid.encryptedSecurityCode}\n filled={!!errors.encryptedSecurityCode || !!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["CardFields","brand","brandsIcons","brandsConfiguration","dualBrandingElements","errors","focusedElement","hasCVC","cvcPolicy","expiryDatePolicy","onFocusField","showBrandIcon","valid","showContextualElement","i18n","useCoreContext","getError","fieldType","get","allowedBrands","filter","BRAND_ICON_UI_EXCLUSION_LIST","includes","name","isAmex","cvcContextualText","h","div","className","CardNumber","error","ENCRYPTED_CARD_NUMBER","focused","isValid","encryptedCardNumber","label","filled","AvailableBrands","activeBrand","brands","classNames","DATE_POLICY_HIDDEN","ExpirationDate","classNameModifiers","ENCRYPTED_EXPIRY_DATE","encryptedExpiryMonth","encryptedExpiryYear","encryptedExpiryDate","contextualText","CVC","ENCRYPTED_SECURITY_CODE","encryptedSecurityCode","frontCVC"],"mappings":"uiBAiBe,SAASA,GAAWC,MAC/BA,EAAKC,YACLA,EAAWC,oBACXA,EAAmBC,qBACnBA,EAAoBC,OACpBA,EAAMC,eACNA,EAAcC,OACdA,EAAMC,UACNA,EAASC,iBACTA,EAAgBC,aAChBA,EAAYC,cACZA,EAAaC,MACbA,EAAKC,sBACLA,IAEA,MAAMC,KAAEA,GAASC,IAEXC,EAAW,CAACX,EAAQY,IACfZ,EAAOY,GAAaH,EAAKI,IAAIb,EAAOY,IAAc,KAIvDE,EAAgBjB,GAAakB,OAAOlB,IAAgBmB,GAA8BC,SAASpB,EAAYqB,OACvGC,EAAmB,SAAVvB,EACTwB,EAAoBD,EACpBV,EAAKI,IAAI,kDACTJ,EAAKI,IAAI,kDAEf,OACIQ,EAACC,MAAAA,CAAIC,UAAU,8BACXF,EAACG,EAAAA,CACG5B,MAAOA,EACPE,oBAAqBA,EACrB2B,MAAOd,EAASX,EAAQ0B,GACxBC,QAAS1B,IAAmByB,EAC5BE,UAAWrB,EAAMsB,oBACjBC,MAAOrB,EAAKI,IAAI,+BAChBR,aAAcA,EACd0B,SAAU/B,EAAO6B,uBAAyBtB,EAAMsB,oBAChDvB,cAAeA,EACfP,qBAAsBA,IAG1BsB,EAACW,EAAAA,CAAgBC,YAAarC,EAAOsC,OAAQpB,IAE7CO,EAACC,MAAAA,CACGC,UAAWY,EAAW,gCAAiC,CACnD,yDAA0D/B,IAAqBgC,KAGnFf,EAACgB,EAAAA,CACGC,mBAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQuC,GACxBZ,QAAS1B,IAAmBsC,EAC5BX,UAAWrB,EAAMiC,wBAA0BjC,EAAMkC,oBACjDV,SAAU/B,EAAO0C,uBAAyBnC,EAAMkC,oBAChDX,MAAOrB,EAAKI,IAAI,+BAChBR,aAAcA,EACdD,iBAAkBA,EAClBI,sBAAuBA,EACvBmC,eAAgBlC,EAAKI,IAAI,0CAG5BX,GACGmB,EAACuB,EAAAA,CACGN,mBAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQ6C,GACxBlB,QAAS1B,IAAmB4C,EAC5B1C,UAAWA,EACXyB,UAAWrB,EAAMuC,sBACjBf,SAAU/B,EAAO8C,yBAA2BvC,EAAMuC,sBAClDhB,MAAOrB,EAAKI,IAAI,iCAChBR,aAAcA,EACd0C,SAAU5B,EACVX,sBAAuBA,EACvBmC,eAAgBvB,KAMxC"}
1
+ {"version":3,"file":"CardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardNumber from './CardNumber';\nimport CVC from './CVC';\nimport ExpirationDate from './ExpirationDate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardFieldsProps } from './types';\nimport classNames from 'classnames';\nimport {\n BRAND_ICON_UI_EXCLUSION_LIST,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport AvailableBrands from './AvailableBrands';\nimport './CardFields.scss';\n\nexport default function CardFields({\n brand,\n brandsIcons,\n brandsConfiguration,\n dualBrandingElements,\n selectedBrandValue,\n dualBrandingChangeHandler,\n errors,\n focusedElement,\n hasCVC,\n cvcPolicy,\n expiryDatePolicy,\n onFocusField,\n showBrandIcon,\n valid,\n showContextualElement\n}: Readonly<CardFieldsProps>) {\n const { i18n } = useCoreContext();\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n // A set of brands filtered to exclude those that can never appear in the UI\n const allowedBrands = brandsIcons?.filter(brandsIcons => !BRAND_ICON_UI_EXCLUSION_LIST?.includes(brandsIcons.name));\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form\">\n <CardNumber\n brand={brand}\n brandsConfiguration={brandsConfiguration}\n error={getError(errors, ENCRYPTED_CARD_NUMBER)}\n focused={focusedElement === ENCRYPTED_CARD_NUMBER}\n isValid={!!valid.encryptedCardNumber}\n label={i18n.get('creditCard.cardNumber.label')}\n onFocusField={onFocusField}\n filled={!!errors.encryptedCardNumber || !!valid.encryptedCardNumber}\n showBrandIcon={showBrandIcon}\n dualBrandingElements={dualBrandingElements}\n selectedBrandValue={selectedBrandValue}\n dualBrandingChangeHandler={dualBrandingChangeHandler}\n />\n\n <AvailableBrands activeBrand={brand} brands={allowedBrands} />\n\n <div\n className={classNames('adyen-checkout__card__exp-cvc', {\n 'adyen-checkout__card__exp-cvc__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN\n })}\n >\n <ExpirationDate\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_EXPIRY_DATE)}\n focused={focusedElement === ENCRYPTED_EXPIRY_DATE}\n isValid={!!valid.encryptedExpiryMonth && !!valid.encryptedExpiryYear}\n filled={!!errors.encryptedExpiryDate || !!valid.encryptedExpiryYear}\n label={i18n.get('creditCard.expiryDate.label')}\n onFocusField={onFocusField}\n expiryDatePolicy={expiryDatePolicy}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('creditCard.expiryDate.contextualText')}\n />\n\n {hasCVC && (\n <CVC\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === ENCRYPTED_SECURITY_CODE}\n cvcPolicy={cvcPolicy}\n isValid={!!valid.encryptedSecurityCode}\n filled={!!errors.encryptedSecurityCode || !!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["CardFields","brand","brandsIcons","brandsConfiguration","dualBrandingElements","selectedBrandValue","dualBrandingChangeHandler","errors","focusedElement","hasCVC","cvcPolicy","expiryDatePolicy","onFocusField","showBrandIcon","valid","showContextualElement","i18n","useCoreContext","getError","fieldType","get","allowedBrands","filter","BRAND_ICON_UI_EXCLUSION_LIST","includes","name","isAmex","cvcContextualText","h","div","className","CardNumber","error","ENCRYPTED_CARD_NUMBER","focused","isValid","encryptedCardNumber","label","filled","AvailableBrands","activeBrand","brands","classNames","DATE_POLICY_HIDDEN","ExpirationDate","classNameModifiers","ENCRYPTED_EXPIRY_DATE","encryptedExpiryMonth","encryptedExpiryYear","encryptedExpiryDate","contextualText","CVC","ENCRYPTED_SECURITY_CODE","encryptedSecurityCode","frontCVC"],"mappings":"uiBAiBe,SAASA,GAAWC,MAC/BA,EAAKC,YACLA,EAAWC,oBACXA,EAAmBC,qBACnBA,EAAoBC,mBACpBA,EAAkBC,0BAClBA,EAAyBC,OACzBA,EAAMC,eACNA,EAAcC,OACdA,EAAMC,UACNA,EAASC,iBACTA,EAAgB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yBAA2BvC,EAAMuC,sBAClDhB,MAAOrB,EAAKI,IAAI,iCAChBR,aAAcA,EACd0C,SAAU5B,EACVX,sBAAuBA,EACvBmC,eAAgBvB,KAMxC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import s from"./CardFields.js";import a from"./KCPAuthentication.js";import l from"../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js";import o from"../../../../internal/StoreDetails/StoreDetails.js";import i from"../../../../internal/Address/Address.js";import n from"./CardHolderName.js";import t from"./Installments/Installments.js";import d from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";import c from"../../../../internal/FormFields/RadioGroupExtended/RadioGroupExtended.js";import{mustHandleDualBrandingAccordingToEURegulations as u,mapDualBrandButtons as m}from"../utils.js";import p from"../../../../internal/FormFields/Fieldset/Fieldset.js";import{useCoreContext as h}from"../../../../../core/Context/CoreProvider.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as b}from"../../../constants.js";const F=({data:F,valid:y,errors:N,handleChangeFor:S,sfpState:f,setFocusOn:A,cvcPolicy:C,focusedElement:g,hasInstallments:x,handleInstallments:B,showAmountsInInstallments:w,brandsIcons:j,formData:v,formErrors:D,formValid:I,expiryDatePolicy:E,dualBrandSelectElements:P,extensions:k,selectedBrandValue:O,showKCP:R,showBrazilianSSN:q,socialSecurityNumber:V,handleOnStoreDetails:M,billingAddress:T,handleAddress:L,setAddressRef:_,partialAddressSchema:z,onAddressLookup:H,onAddressSelected:G,addressSearchDebounceMs:K,billingAddressRequired:W,billingAddressRequiredFields:$,billingAddressAllowedCountries:J,billingAddressValidationRules:Q=null,brandsConfiguration:U,showStoreDetailsCheckbox:X,hasCVC:Y,hasHolderName:Z,holderNameRequired:ee,installmentOptions:re,placeholders:se,positionHolderNameOnTop:ae,showBrandIcon:le,showContextualElement:oe,iOSFocusedField:ie,disclaimerMessage:ne,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de})=>{const{i18n:ce}=h(),ue=e(n,{required:ee,placeholder:se.holderName,value:v.holderName,error:!!D.holderName&&ee,isValid:!!I.holderName,onBlur:S("holderName","blur"),onInput:S("holderName","input"),disabled:ie&&"holderName"!==ie,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de}),me=u(b,P,"id");return e(r,{status:f.status},Z&&ae&&ue,e(s,{showBrandIcon:le,showContextualElement:oe,brand:f.brand,brandsIcons:j,brandsConfiguration:U,focusedElement:g,onFocusField:A,hasCVC:Y,cvcPolicy:C,expiryDatePolicy:E,errors:f.errors,valid:f.valid,dualBrandingElements:P.length>0&&P}),Z&&!ae&&ue,me&&P.length>0&&P&&e(p,{classNameModifiers:["dual-brand-switcher"],label:ce.get("creditCard.dualBrand.title")},e("p",{className:"adyen-checkout-form-instruction"},ce.get("creditCard.dualBrand.description")),e(c,{name:"dualBrandSwitcher",value:O,items:m(P,U),onChange:k.handleDualBrandSelection,required:!0,showSelectedTick:!0})),R&&e(a,{onFocusField:A,focusedElement:g,encryptedPasswordState:{data:f.encryptedPassword,valid:!!f.valid&&f.valid.encryptedPassword,errors:!!f.errors&&f.errors.encryptedPassword},value:F.taxNumber,error:!!N.taxNumber,isValid:!!y.taxNumber,onBlur:S("taxNumber","blur"),onInput:S("taxNumber","input"),disabled:ie&&"kcpTaxNumberOrDOB"!==ie,placeholder:se.taxNumber,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de}),q&&e("div",{className:"adyen-checkout__card__socialSecurityNumber"},e(l,{onBlur:S("socialSecurityNumber","blur"),onInput:S("socialSecurityNumber","input"),error:N?.socialSecurityNumber,valid:y?.socialSecurityNumber,data:V,required:!0,disabled:ie&&"socialSecurityNumber"!==ie,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de})),X&&e(o,{onChange:M}),x&&e(t,{brand:f.brand,installmentOptions:re,onChange:B,type:w?"amount":"months"}),W&&e(i,{label:"billingAddress",data:T,onChange:L,allowedCountries:J,requiredFields:$,setComponentRef:_,validationRules:Q,specifications:z,iOSFocusedField:ie,onAddressLookup:H,showContextualElement:oe,onAddressSelected:G,addressSearchDebounceMs:K,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de}),ne&&e(d,{message:ne.message.replace("%{linkText}",`%#${ne.linkText}%#`),urls:[ne.link]}))};export{F as CardFieldsWrapper};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import s from"./CardFields.js";import a from"./KCPAuthentication.js";import l from"../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js";import n from"../../../../internal/StoreDetails/StoreDetails.js";import o from"../../../../internal/Address/Address.js";import i from"./CardHolderName.js";import d from"./Installments/Installments.js";import t from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";const u=({data:u,valid:c,errors:m,handleChangeFor:p,sfpState:h,setFocusOn:b,cvcPolicy:y,focusedElement:N,hasInstallments:A,handleInstallments:F,showAmountsInInstallments:S,brandsIcons:g,formData:f,formErrors:C,formValid:B,expiryDatePolicy:x,dualBrandSelectElements:w,extensions:v,selectedBrandValue:D,showKCP:I,showBrazilianSSN:j,socialSecurityNumber:E,handleOnStoreDetails:P,billingAddress:O,handleAddress:k,setAddressRef:V,partialAddressSchema:R,onAddressLookup:q,onAddressSelected:M,addressSearchDebounceMs:H,billingAddressRequired:L,billingAddressRequiredFields:T,billingAddressAllowedCountries:_,billingAddressValidationRules:z=null,brandsConfiguration:K,showStoreDetailsCheckbox:W,hasCVC:$,hasHolderName:G,holderNameRequired:J,installmentOptions:Q,placeholders:U,positionHolderNameOnTop:X,showBrandIcon:Y,showContextualElement:Z,iOSFocusedField:ee,disclaimerMessage:re,onFieldFocusAnalytics:se,onFieldBlurAnalytics:ae})=>{const le=e(i,{required:J,placeholder:U.holderName,value:f.holderName,error:!!C.holderName&&J,isValid:!!B.holderName,onBlur:p("holderName","blur"),onInput:p("holderName","input"),disabled:ee&&"holderName"!==ee,onFieldFocusAnalytics:se,onFieldBlurAnalytics:ae});return e(r,{status:h.status},G&&X&&le,e(s,{showBrandIcon:Y,showContextualElement:Z,brand:h.brand??"card",brandsIcons:g,brandsConfiguration:K,focusedElement:N,onFocusField:b,hasCVC:$,cvcPolicy:y,expiryDatePolicy:x,errors:h.errors,valid:h.valid,dualBrandingElements:w.length>0&&w,dualBrandingChangeHandler:v.handleDualBrandSelection,selectedBrandValue:D}),G&&!X&&le,I&&e(a,{onFocusField:b,focusedElement:N,encryptedPasswordState:{data:h.encryptedPassword,valid:!!h.valid&&h.valid.encryptedPassword,errors:!!h.errors&&h.errors.encryptedPassword},value:u.taxNumber,error:!!m.taxNumber,isValid:!!c.taxNumber,onBlur:p("taxNumber","blur"),onInput:p("taxNumber","input"),disabled:ee&&"kcpTaxNumberOrDOB"!==ee,placeholder:U.taxNumber,onFieldFocusAnalytics:se,onFieldBlurAnalytics:ae}),j&&e("div",{className:"adyen-checkout__card__socialSecurityNumber"},e(l,{onBlur:p("socialSecurityNumber","blur"),onInput:p("socialSecurityNumber","input"),error:m?.socialSecurityNumber,valid:c?.socialSecurityNumber,data:E,required:!0,disabled:ee&&"socialSecurityNumber"!==ee,onFieldFocusAnalytics:se,onFieldBlurAnalytics:ae})),W&&e(n,{onChange:P}),A&&e(d,{brand:h.brand,installmentOptions:Q,onChange:F,type:S?"amount":"months"}),L&&e(o,{label:"billingAddress",data:O,onChange:k,allowedCountries:_,requiredFields:T,setComponentRef:V,validationRules:z,specifications:R,iOSFocusedField:ee,onAddressLookup:q,showContextualElement:Z,onAddressSelected:M,addressSearchDebounceMs:H,onFieldFocusAnalytics:se,onFieldBlurAnalytics:ae}),re&&e(t,{message:re.message.replace("%{linkText}",`%#${re.linkText}%#`),urls:[re.link]}))};export{u as CardFieldsWrapper};
2
2
  //# sourceMappingURL=CardFieldsWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport CardFields from './CardFields';\nimport KCPAuthentication from './KCPAuthentication';\nimport SocialSecurityNumberBrazil from '../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil';\nimport StoreDetails from '../../../../internal/StoreDetails';\nimport Address from '../../../../internal/Address';\nimport CardHolderName from './CardHolderName';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\nimport RadioGroupExtended from '../../../../internal/FormFields/RadioGroupExtended';\nimport { mapDualBrandButtons, mustHandleDualBrandingAccordingToEURegulations } from '../utils';\nimport Fieldset from '../../../../internal/FormFields/Fieldset';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../../constants';\n\nexport const CardFieldsWrapper = ({\n // vars created in CardInput:\n // base (shared)\n data,\n valid,\n errors,\n handleChangeFor,\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n // Card\n brandsIcons,\n formData,\n formErrors,\n formValid,\n expiryDatePolicy,\n dualBrandSelectElements,\n extensions,\n selectedBrandValue,\n // KCP\n showKCP,\n // SSN\n showBrazilianSSN,\n socialSecurityNumber,\n // Store details\n handleOnStoreDetails,\n // Address\n billingAddress,\n handleAddress,\n setAddressRef,\n partialAddressSchema,\n onAddressLookup,\n onAddressSelected,\n addressSearchDebounceMs,\n // For this comp (props passed through from CardInput)\n billingAddressRequired,\n billingAddressRequiredFields,\n billingAddressAllowedCountries,\n billingAddressValidationRules = null,\n brandsConfiguration,\n showStoreDetailsCheckbox,\n hasCVC,\n hasHolderName,\n holderNameRequired,\n installmentOptions,\n placeholders,\n positionHolderNameOnTop,\n // For CardFields > CardNumber\n showBrandIcon,\n showContextualElement,\n //\n iOSFocusedField,\n disclaimerMessage,\n //\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}) => {\n const { i18n } = useCoreContext();\n\n const cardHolderField = (\n <CardHolderName\n required={holderNameRequired}\n placeholder={placeholders.holderName}\n value={formData.holderName}\n error={!!formErrors.holderName && holderNameRequired}\n isValid={!!formValid.holderName}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'holderName'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n );\n\n // Only if the brands in DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM are present in the binLookup response should we handle dual branding based on EU regulations\n const showDualBrandSelectElements = mustHandleDualBrandingAccordingToEURegulations(\n DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM,\n dualBrandSelectElements,\n 'id'\n );\n\n return (\n <LoadingWrapper status={sfpState.status}>\n {hasHolderName && positionHolderNameOnTop && cardHolderField}\n\n <CardFields\n showBrandIcon={showBrandIcon}\n showContextualElement={showContextualElement}\n brand={sfpState.brand}\n brandsIcons={brandsIcons}\n brandsConfiguration={brandsConfiguration}\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n expiryDatePolicy={expiryDatePolicy}\n errors={sfpState.errors}\n valid={sfpState.valid}\n dualBrandingElements={dualBrandSelectElements.length > 0 && dualBrandSelectElements}\n />\n\n {hasHolderName && !positionHolderNameOnTop && cardHolderField}\n\n {showDualBrandSelectElements && dualBrandSelectElements.length > 0 && dualBrandSelectElements && (\n <Fieldset classNameModifiers={['dual-brand-switcher']} label={i18n.get('creditCard.dualBrand.title')}>\n <p className={'adyen-checkout-form-instruction'}>{i18n.get('creditCard.dualBrand.description')}</p>\n <RadioGroupExtended\n name={'dualBrandSwitcher'}\n value={selectedBrandValue} // Set which button is in a selected (checked) state\n items={mapDualBrandButtons(dualBrandSelectElements, brandsConfiguration)}\n onChange={extensions.handleDualBrandSelection}\n required={true}\n showSelectedTick={true}\n />\n </Fieldset>\n )}\n\n {showKCP && (\n <KCPAuthentication\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n encryptedPasswordState={{\n data: sfpState.encryptedPassword,\n valid: sfpState.valid ? sfpState.valid.encryptedPassword : false,\n errors: sfpState.errors ? sfpState.errors.encryptedPassword : false\n }}\n value={data.taxNumber}\n error={!!errors.taxNumber}\n isValid={!!valid.taxNumber}\n onBlur={handleChangeFor('taxNumber', 'blur')}\n onInput={handleChangeFor('taxNumber', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'kcpTaxNumberOrDOB'}\n placeholder={placeholders.taxNumber}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {showBrazilianSSN && (\n <div className=\"adyen-checkout__card__socialSecurityNumber\">\n <SocialSecurityNumberBrazil\n onBlur={handleChangeFor('socialSecurityNumber', 'blur')}\n onInput={handleChangeFor('socialSecurityNumber', 'input')}\n error={errors?.socialSecurityNumber}\n valid={valid?.socialSecurityNumber}\n data={socialSecurityNumber}\n required={true}\n disabled={iOSFocusedField && iOSFocusedField !== 'socialSecurityNumber'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n\n {showStoreDetailsCheckbox && <StoreDetails onChange={handleOnStoreDetails} />}\n\n {hasInstallments && (\n <Installments\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {billingAddressRequired && (\n <Address\n label=\"billingAddress\"\n data={billingAddress}\n onChange={handleAddress}\n allowedCountries={billingAddressAllowedCountries}\n requiredFields={billingAddressRequiredFields}\n setComponentRef={setAddressRef}\n validationRules={billingAddressValidationRules}\n specifications={partialAddressSchema}\n iOSFocusedField={iOSFocusedField}\n onAddressLookup={onAddressLookup}\n showContextualElement={showContextualElement}\n onAddressSelected={onAddressSelected}\n addressSearchDebounceMs={addressSearchDebounceMs}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["CardFieldsWrapper","data","valid","errors","handleChangeFor","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","brandsIcons","formData","formErrors","formValid","expiryDatePolicy","dualBrandSelectElements","extensions","selectedBrandValue","showKCP","showBrazilianSSN","socialSecurityNumber","handleOnStoreDetails","billingAddress","handleAddress","setAddressRef","partialAddressSchema","onAddressLookup","onAddressSelected","addressSearchDebounceMs","billingAddressRequired","billingAddressRequiredFields","billingAddressAllowedCountries","billingAddressValidationRules","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","hasHolderName","holderNameRequired","installmentOptions","placeholders","positionHolderNameOnTop","showBrandIcon","showContextualElement","iOSFocusedField","disclaimerMessage","onFieldFocusAnalytics","onFieldBlurAnalytics","i18n","useCoreContext","cardHolderField","h","CardHolderName","required","placeholder","holderName","value","error","isValid","onBlur","onInput","disabled","showDualBrandSelectElements","mustHandleDualBrandingAccordingToEURegulations","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","LoadingWrapper","status","CardFields","brand","onFocusField","dualBrandingElements","length","Fieldset","classNameModifiers","label","get","p","className","RadioGroupExtended","name","items","mapDualBrandButtons","onChange","handleDualBrandSelection","showSelectedTick","KCPAuthentication","encryptedPasswordState","encryptedPassword","taxNumber","div","SocialSecurityNumberBrazil","StoreDetails","Installments","type","Address","allowedCountries","requiredFields","setComponentRef","validationRules","specifications","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"0+BAgBO,MAAMA,EAAoB,EAG7BC,OACAC,QACA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wBAAyBA,EACzBiB,sBAAuBA,GACvBC,qBAAsBA,KAI7BF,IACGM,EAACiD,EAAAA,CACGC,QAASxD,GAAkBwD,QAAQC,QAAQ,cAAe,KAAKzD,GAAkB0D,cACjFC,KAAM,CAAC3D,GAAkB4D"}
1
+ {"version":3,"file":"CardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport CardFields from './CardFields';\nimport KCPAuthentication from './KCPAuthentication';\nimport SocialSecurityNumberBrazil from '../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil';\nimport StoreDetails from '../../../../internal/StoreDetails';\nimport Address from '../../../../internal/Address';\nimport CardHolderName from './CardHolderName';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\n\nexport const CardFieldsWrapper = ({\n // vars created in CardInput:\n // base (shared)\n data,\n valid,\n errors,\n handleChangeFor,\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n // Card\n brandsIcons,\n formData,\n formErrors,\n formValid,\n expiryDatePolicy,\n dualBrandSelectElements,\n extensions,\n selectedBrandValue,\n // KCP\n showKCP,\n // SSN\n showBrazilianSSN,\n socialSecurityNumber,\n // Store details\n handleOnStoreDetails,\n // Address\n billingAddress,\n handleAddress,\n setAddressRef,\n partialAddressSchema,\n onAddressLookup,\n onAddressSelected,\n addressSearchDebounceMs,\n // For this comp (props passed through from CardInput)\n billingAddressRequired,\n billingAddressRequiredFields,\n billingAddressAllowedCountries,\n billingAddressValidationRules = null,\n brandsConfiguration,\n showStoreDetailsCheckbox,\n hasCVC,\n hasHolderName,\n holderNameRequired,\n installmentOptions,\n placeholders,\n positionHolderNameOnTop,\n // For CardFields > CardNumber\n showBrandIcon,\n showContextualElement,\n //\n iOSFocusedField,\n disclaimerMessage,\n //\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}) => {\n const cardHolderField = (\n <CardHolderName\n required={holderNameRequired}\n placeholder={placeholders.holderName}\n value={formData.holderName}\n error={!!formErrors.holderName && holderNameRequired}\n isValid={!!formValid.holderName}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'holderName'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n );\n\n return (\n <LoadingWrapper status={sfpState.status}>\n {hasHolderName && positionHolderNameOnTop && cardHolderField}\n\n <CardFields\n showBrandIcon={showBrandIcon}\n showContextualElement={showContextualElement}\n brand={sfpState.brand ?? 'card'}\n brandsIcons={brandsIcons}\n brandsConfiguration={brandsConfiguration}\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n expiryDatePolicy={expiryDatePolicy}\n errors={sfpState.errors}\n valid={sfpState.valid}\n dualBrandingElements={dualBrandSelectElements.length > 0 && dualBrandSelectElements}\n dualBrandingChangeHandler={extensions.handleDualBrandSelection}\n selectedBrandValue={selectedBrandValue}\n />\n\n {hasHolderName && !positionHolderNameOnTop && cardHolderField}\n\n {showKCP && (\n <KCPAuthentication\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n encryptedPasswordState={{\n data: sfpState.encryptedPassword,\n valid: sfpState.valid ? sfpState.valid.encryptedPassword : false,\n errors: sfpState.errors ? sfpState.errors.encryptedPassword : false\n }}\n value={data.taxNumber}\n error={!!errors.taxNumber}\n isValid={!!valid.taxNumber}\n onBlur={handleChangeFor('taxNumber', 'blur')}\n onInput={handleChangeFor('taxNumber', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'kcpTaxNumberOrDOB'}\n placeholder={placeholders.taxNumber}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {showBrazilianSSN && (\n <div className=\"adyen-checkout__card__socialSecurityNumber\">\n <SocialSecurityNumberBrazil\n onBlur={handleChangeFor('socialSecurityNumber', 'blur')}\n onInput={handleChangeFor('socialSecurityNumber', 'input')}\n error={errors?.socialSecurityNumber}\n valid={valid?.socialSecurityNumber}\n data={socialSecurityNumber}\n required={true}\n disabled={iOSFocusedField && iOSFocusedField !== 'socialSecurityNumber'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n\n {showStoreDetailsCheckbox && <StoreDetails onChange={handleOnStoreDetails} />}\n\n {hasInstallments && (\n <Installments\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {billingAddressRequired && (\n <Address\n label=\"billingAddress\"\n data={billingAddress}\n onChange={handleAddress}\n allowedCountries={billingAddressAllowedCountries}\n requiredFields={billingAddressRequiredFields}\n setComponentRef={setAddressRef}\n validationRules={billingAddressValidationRules}\n specifications={partialAddressSchema}\n iOSFocusedField={iOSFocusedField}\n onAddressLookup={onAddressLookup}\n showContextualElement={showContextualElement}\n onAddressSelected={onAddressSelected}\n addressSearchDebounceMs={addressSearchDebounceMs}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["CardFieldsWrapper","data","valid","errors","handleChangeFor","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","brandsIcons","formData","formErrors","formValid","expiryDatePolicy","dualBrandSelectElements","extensions","selectedBrandValue","showKCP","showBrazilianSSN","socialSecurityNumber","handleOnStoreDetails","billingAddress","handleAddress","setAddressRef","partialAddressSchema","onAddressLookup","onAddressSelected","addressSearchDebounceMs","billingAddressRequired","billingAddressRequiredFields","billingAddressAllowedCountries","billingAddressValidationRules","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","hasHolderName","holderNameRequired","installmentOptions","placeholders","positionHolderNameOnTop","showBrandIcon","showContextualElement","iOSFocusedField","disclaimerMessage","onFieldFocusAnalytics","onFieldBlurAnalytics","cardHolderField","h","CardHolderName","required","placeholder","holderName","value","error","isValid","onBlur","onInput","disabled","LoadingWrapper","status","CardFields","brand","onFocusField","dualBrandingElements","length","dualBrandingChangeHandler","handleDualBrandSelection","KCPAuthentication","encryptedPasswordState","encryptedPassword","taxNumber","div","className","SocialSecurityNumberBrazil","StoreDetails","onChange","Installments","type","Address","label","allowedCountries","requiredFields","setComponentRef","validationRules","specifications","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"ykBAWO,MAAMA,EAAoB,EAG7BC,OACAC,QACAC,SACAC,kBACAC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BAEAC,cACAC,WACAC,aACAC,YACAC,mBACAC,0BACAC,aACAC,qBAEAC,UAEAC,mBACAC,uBAEAC,uBAEAC,iBACAC,gBACAC,gBACAC,uBACAC,kBACAC,oBACAC,0BAEAC,yBACAC,+BACAC,iCACAC,gCAAgC,KAChCC,sBACAC,2BACAC,SACAC,gBACAC,qBACAC,qBACAC,eACAC,0BAEAC,gBACAC,wBAEAC,mBACAC,qBAEAC,yBACAC,4BAEA,MAAMC,GACFC,EAACC,EAAAA,CACGC,SAAUb,EACVc,YAAaZ,EAAaa,WAC1BC,MAAO1C,EAASyC,WAChBE,QAAS1C,EAAWwC,YAAcf,EAClCkB,UAAW1C,EAAUuC,WACrBI,OAAQtD,EAAgB,aAAc,QACtCuD,QAASvD,EAAgB,aAAc,SACvCwD,SAAUf,IAAuC,eAApBA,GAC7BE,sBAAuBA,GACvBC,qBAAsBA,KAI9B,OACIE,EAACW,E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EACVsE,KAAMrE,EAA4B,SAAW,WAIpDoB,GACGmB,EAAC+B,EAAAA,CACGC,MAAM,iBACNjF,KAAMuB,EACNsD,SAAUrD,EACV0D,iBAAkBlD,EAClBmD,eAAgBpD,EAChBqD,gBAAiB3D,EACjB4D,gBAAiBpD,EACjBqD,eAAgB5D,EAChBkB,gBAAiBA,GACjBjB,gBAAiBA,EACjBgB,sBAAuBA,EACvBf,kBAAmBA,EACnBC,wBAAyBA,EACzBiB,sBAAuBA,GACvBC,qBAAsBA,KAI7BF,IACGI,EAACsC,EAAAA,CACGC,QAAS3C,GAAkB2C,QAAQC,QAAQ,cAAe,KAAK5C,GAAkB6C,cACjFC,KAAM,CAAC9C,GAAkB+C"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../../_virtual/index.js";import n from"./BrandIcon.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as o}from"../../../../../core/Context/CoreProvider.js";import i from"./DataSfSpan.js";import{ENCRYPTED_CARD_NUMBER as d}from"../../../../internal/SecuredFields/lib/constants.js";import{alternativeLabelContent as t}from"./FieldLabelAlternative.js";function c(c){const{i18n:s}=o(),{error:l="",isValid:u=!1,onFocusField:_=()=>{},dualBrandingElements:m}=c;return e(a,{label:c.label,focused:c.focused,filled:c.filled,classNameModifiers:["cardNumber"],onFocusField:()=>_(d),errorMessage:l,isValid:u,dir:"ltr",name:d,showValidIcon:!1,i18n:s,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:t,onInputContainerClick:()=>{_(d)}},e(i,{encryptedFieldType:d,className:r({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":l,"adyen-checkout__input--focus":c.focused,"adyen-checkout__input--valid":u,"adyen-checkout__card__cardNumber__input--noBrand":!c.showBrandIcon})}),c.showBrandIcon&&!m&&e(n,{brandsConfiguration:c.brandsConfiguration,brand:c.brand}),m&&!l&&e("div",{className:r(["adyen-checkout__card__dual-branding__icons"])},m.map(r=>e(n,{key:r.id,brand:r.id,brandsConfiguration:c.brandsConfiguration}))))}export{c as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import n from"../../../../../_virtual/index.js";import r from"./BrandIcon.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import o from"./DataSfSpan.js";import{ENCRYPTED_CARD_NUMBER as i}from"../../../../internal/SecuredFields/lib/constants.js";import{alternativeLabelContent as t}from"./FieldLabelAlternative.js";import{requiresDualBrandSelection as l}from"../utils.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as s}from"../../../constants.js";import c from"./DualBrandSelector.js";function u(u){const{i18n:m}=d(),{error:_="",isValid:p=!1,onFocusField:f=()=>{},dualBrandingElements:b,dualBrandingChangeHandler:g,brandsConfiguration:h,selectedBrandValue:y}=u,C=!!b&&l(s,b,"id"),B=C?m.get("creditCard.dualBrand.description"):void 0;return e(a,{label:u.label,focused:u.focused,filled:u.filled,classNameModifiers:["cardNumber"],onFocusField:()=>f(i),errorMessage:_,isValid:p,dir:"ltr",name:i,showValidIcon:!1,i18n:m,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:t,onInputContainerClick:()=>{f(i)},contextualText:B},e(o,{encryptedFieldType:i,className:n({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":_,"adyen-checkout__input--focus":u.focused,"adyen-checkout__input--valid":p,"adyen-checkout__card__cardNumber__input--noBrand":!u.showBrandIcon})}),u.showBrandIcon&&!b&&e(r,{brandsConfiguration:u.brandsConfiguration,brand:u.brand}),b&&!_&&e("div",{className:n(["adyen-checkout__card__dual-branding__icons"])},C?e(c,{dualBrandingElements:b,dualBrandingChangeHandler:g,brandsConfiguration:h,selectedBrandValue:y}):b.map(n=>e(r,{key:n.id,brand:n.id,brandsConfiguration:u.brandsConfiguration}))),e("span",{className:"adyen-checkout__card__dual-branding__sr-only","aria-live":"polite"},B))}export{u as default};
2
2
  //# sourceMappingURL=CardNumber.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardNumber.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardNumber.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport BrandIcon from './BrandIcon';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardNumberProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport { ENCRYPTED_CARD_NUMBER } from '../../../../internal/SecuredFields/lib/constants';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CardNumber.scss';\n\nexport default function CardNumber(props: Readonly<CardNumberProps>) {\n const { i18n } = useCoreContext();\n const { error = '', isValid = false, onFocusField = () => {}, dualBrandingElements } = props;\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_CARD_NUMBER);\n };\n\n return (\n <Field\n label={props.label}\n focused={props.focused}\n filled={props.filled}\n classNameModifiers={['cardNumber']}\n onFocusField={() => onFocusField(ENCRYPTED_CARD_NUMBER)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_CARD_NUMBER}\n showValidIcon={false}\n i18n={i18n}\n contextVisibleToScreenReader={false} // securedFields have their own, internal, aria-describedby element\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_CARD_NUMBER}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': props.focused,\n 'adyen-checkout__input--valid': isValid,\n 'adyen-checkout__card__cardNumber__input--noBrand': !props.showBrandIcon\n })}\n ></DataSfSpan>\n\n {props.showBrandIcon && !dualBrandingElements && <BrandIcon brandsConfiguration={props.brandsConfiguration} brand={props.brand} />}\n\n {dualBrandingElements && !error && (\n <div className={classNames(['adyen-checkout__card__dual-branding__icons'])}>\n {dualBrandingElements.map(element => (\n <BrandIcon key={element.id} brand={element.id} brandsConfiguration={props.brandsConfiguration} />\n ))}\n </div>\n )}\n </Field>\n );\n}\n"],"names":["CardNumber","props","i18n","useCoreContext","error","isValid","onFocusField","dualBrandingElements","h","Field","label","focused","filled","classNameModifiers","ENCRYPTED_CARD_NUMBER","errorMessage","dir","name","showValidIcon","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","className","classNames","showBrandIcon","BrandIcon","brandsConfiguration","brand","div","map","element","key","id"],"mappings":"ueAWe,SAASA,EAAWC,GAC/B,MAAMC,KAAEA,GAASC,KACXC,MAAEA,EAAQ,GAAEC,QAAEA,GAAU,EAAKC,aAAEA,EAAe,OAAQC,qBAAEA,GAAyBN,EAMvF,OACIO,EAACC,EAAAA,CACGC,MAAOT,EAAMS,MACbC,QAASV,EAAMU,QACfC,OAAQX,EAAMW,OACdC,mBAAoB,CAAC,cACrBP,aAAc,IAAMA,EAAaQ,GACjCC,aAAcX,EACdC,QAASA,EACTW,IAAK,MACLC,KAAMH,EACNI,eAAe,EACfhB,KAAMA,EACNiB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BC,sBApBgB,KACpBjB,EAAaQ,KAqBTN,EAACgB,EAAAA,CACGC,mBAAoBX,EACpBY,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgCvB,EAChC,+BAAgCH,EAAMU,QACtC,+BAAgCN,EAChC,oDAAqDJ,EAAM2B,kBAIlE3B,EAAM2B,gBAAkBrB,GAAwBC,EAACqB,EAAAA,CAAUC,oBAAqB7B,EAAM6B,oBAAqBC,MAAO9B,EAAM8B,QAExHxB,IAAyBH,GACtBI,EAACwB,MAAAA,CAAIN,UAAWC,EAAW,CAAC,gDACvBpB,EAAqB0B,IAAIC,GACtB1B,EAACqB,EAAAA,CAAUM,IAAKD,EAAQE,GAAIL,MAAOG,EAAQE,GAAIN,oBAAqB7B,EAAM6B,wBAMlG"}
1
+ {"version":3,"file":"CardNumber.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardNumber.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport BrandIcon from './BrandIcon';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardNumberProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport { ENCRYPTED_CARD_NUMBER } from '../../../../internal/SecuredFields/lib/constants';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CardNumber.scss';\nimport { requiresDualBrandSelection } from '../utils';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../../constants';\nimport DualBrandSelector from './DualBrandSelector';\n\nexport default function CardNumber(props: Readonly<CardNumberProps>) {\n const { i18n } = useCoreContext();\n const {\n error = '',\n isValid = false,\n onFocusField = () => {},\n dualBrandingElements,\n dualBrandingChangeHandler,\n brandsConfiguration,\n selectedBrandValue\n } = props;\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_CARD_NUMBER);\n };\n\n const showDualBrandSelector = dualBrandingElements\n ? requiresDualBrandSelection(DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM, dualBrandingElements, 'id')\n : false;\n\n // Unlike other fields we don't respect the 'showContextualElement' config prop (that the merchant can set to false)\n // We always show the contextual text for dual branding that requires selection\n const contextualText = showDualBrandSelector ? i18n.get('creditCard.dualBrand.description') : undefined;\n\n return (\n <Field\n label={props.label}\n focused={props.focused}\n filled={props.filled}\n classNameModifiers={['cardNumber']}\n onFocusField={() => onFocusField(ENCRYPTED_CARD_NUMBER)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_CARD_NUMBER}\n showValidIcon={false}\n i18n={i18n}\n contextVisibleToScreenReader={false} // securedFields have their own, internal, aria-describedby element\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n onInputContainerClick={handleIconClick}\n contextualText={contextualText}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_CARD_NUMBER}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': props.focused,\n 'adyen-checkout__input--valid': isValid,\n 'adyen-checkout__card__cardNumber__input--noBrand': !props.showBrandIcon\n })}\n ></DataSfSpan>\n\n {props.showBrandIcon && !dualBrandingElements && <BrandIcon brandsConfiguration={props.brandsConfiguration} brand={props.brand} />}\n\n {dualBrandingElements && !error && (\n <div className={classNames(['adyen-checkout__card__dual-branding__icons'])}>\n {showDualBrandSelector ? (\n <DualBrandSelector\n dualBrandingElements={dualBrandingElements}\n dualBrandingChangeHandler={dualBrandingChangeHandler}\n brandsConfiguration={brandsConfiguration}\n selectedBrandValue={selectedBrandValue}\n />\n ) : (\n dualBrandingElements.map(element => {\n return <BrandIcon key={element.id} brand={element.id} brandsConfiguration={props.brandsConfiguration} />;\n })\n )}\n </div>\n )}\n <span className=\"adyen-checkout__card__dual-branding__sr-only\" aria-live=\"polite\">\n {contextualText}\n </span>\n </Field>\n );\n}\n"],"names":["CardNumber","props","i18n","useCoreContext","error","isValid","onFocusField","dualBrandingElements","dualBrandingChangeHandler","brandsConfiguration","selectedBrandValue","showDualBrandSelector","requiresDualBrandSelection","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","contextualText","get","undefined","h","Field","label","focused","filled","classNameModifiers","ENCRYPTED_CARD_NUMBER","errorMessage","dir","name","showValidIcon","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","className","classNames","showBrandIcon","BrandIcon","brand","div","DualBrandSelector","map","element","key","id","span","aria-live"],"mappings":"wpBAce,SAASA,EAAWC,GAC/B,MAAMC,KAAEA,GAASC,KACXC,MACFA,EAAQ,GAAEC,QACVA,GAAU,EAAKC,aACfA,EAAe,OAAQC,qBACvBA,EAAoBC,0BACpBA,EAAyBC,oBACzBA,EAAmBC,mBACnBA,GACAT,EAMEU,IAAwBJ,GACxBK,EAA2BC,EAA2CN,EAAsB,MAK5FO,EAAiBH,EAAwBT,EAAKa,IAAI,yCAAsCC,EAE9F,OACIC,EAACC,EAAAA,CACGC,MAAOlB,EAAMkB,MACbC,QAASnB,EAAMmB,QACfC,OAAQpB,EAAMoB,OACdC,mBAAoB,CAAC,cACrBhB,aAAc,IAAMA,EAAaiB,GACjCC,aAAcpB,EACdC,QAASA,EACToB,IAAK,MACLC,KAAMH,EACNI,eAAe,EACfzB,KAAMA,EACN0B,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BC,sBA5BgB,KACpB1B,EAAaiB,IA4BTT,eAAgBA,GAEhBG,EAACgB,EAAAA,CACGC,mBAAoBX,EACpBY,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgChC,EAChC,+BAAgCH,EAAMmB,QACtC,+BAAgCf,EAChC,oDAAqDJ,EAAMoC,kBAIlEpC,EAAMoC,gBAAkB9B,GAAwBU,EAACqB,EAAAA,CAAU7B,oBAAqBR,EAAMQ,oBAAqB8B,MAAOtC,EAAMsC,QAExHhC,IAAyBH,GACtBa,EAACuB,MAAAA,CAAIL,UAAWC,EAAW,CAAC,gDACvBzB,EACGM,EAACwB,EAAAA,CACGlC,qBAAsBA,EACtBC,0BAA2BA,EAC3BC,oBAAqBA,EACrBC,mBAAoBA,IAGxBH,EAAqBmC,IAAIC,GACd1B,EAACqB,EAAAA,CAAUM,IAAKD,EAAQE,GAAIN,MAAOI,EAAQE,GAAIpC,oBAAqBR,EAAMQ,wBAKjGQ,EAAC6B,OAAAA,CAAKX,UAAU,+CAA+CY,YAAU,UACpEjC,GAIjB"}
@@ -0,0 +1,2 @@
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useState as a}from"../../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../../_virtual/index.js";import{mapDualBrandButtons as t}from"../utils.js";import o from"./DualBrandSelector.module.scss.js";import{useCoreContext as n}from"../../../../../core/Context/CoreProvider.js";function l({dualBrandingElements:l,brandsConfiguration:d,dualBrandingChangeHandler:i,selectedBrandValue:s}){const{i18n:u}=n(),c=t(l,d),[m,p]=a(s),f=e=>{p(e),i(e)};return e("div",{className:o.dualBrandSelector,role:"group","aria-label":u.get("creditCard.dualBrand.description")},c.map(a=>e("button",{key:a.id,type:"button",className:r(o.dualBrandSelectorButton,{[o.dualBrandSelectorButtonSelected]:m===a.id}),onMouseDown:e=>e.preventDefault(),onClick:()=>f(a.id),onKeyDown:e=>((e,a)=>{"Enter"===e.key&&(e.preventDefault(),f(a))})(e,a.id),"aria-label":a.altName,"aria-pressed":m===a.id},e("img",{src:a.imageURL,alt:a.altName,className:o.dualBrandSelectorIcon}))))}export{l as default};
2
+ //# sourceMappingURL=DualBrandSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DualBrandSelector.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/DualBrandSelector.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons, DualBrandingChangeHandler } from '../../../types';\nimport { mapDualBrandButtons } from '../utils';\nimport styles from './DualBrandSelector.module.scss';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\n\ninterface DualBrandSelectorProps {\n dualBrandingElements: DualBrandSelectElement[];\n dualBrandingChangeHandler: DualBrandingChangeHandler;\n brandsConfiguration?: CardBrandsConfiguration;\n selectedBrandValue: string;\n}\n\nexport default function DualBrandSelector({\n dualBrandingElements,\n brandsConfiguration,\n dualBrandingChangeHandler,\n selectedBrandValue\n}: Readonly<DualBrandSelectorProps>) {\n const { i18n } = useCoreContext();\n const dualBrandItems = mapDualBrandButtons(dualBrandingElements, brandsConfiguration);\n const [selectedBrand, setSelectedBrand] = useState<string>(selectedBrandValue);\n\n const handleBrandSelect = (brandId: string) => {\n setSelectedBrand(brandId);\n dualBrandingChangeHandler(brandId);\n };\n\n // override enter key to prevent submit form (default behavior)\n const handleKeyDown = (e: KeyboardEvent, brandId: string) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n handleBrandSelect(brandId);\n }\n };\n\n return (\n <div className={styles.dualBrandSelector} role=\"group\" aria-label={i18n.get('creditCard.dualBrand.description')}>\n {dualBrandItems.map((item: DualBrandButtons) => (\n <button\n key={item.id}\n type=\"button\"\n className={classNames(styles.dualBrandSelectorButton, {\n [styles.dualBrandSelectorButtonSelected]: selectedBrand === item.id\n })}\n onMouseDown={e => e.preventDefault()}\n onClick={() => handleBrandSelect(item.id)}\n onKeyDown={e => handleKeyDown(e, item.id)}\n aria-label={item.altName}\n aria-pressed={selectedBrand === item.id}\n >\n <img src={item.imageURL} alt={item.altName} className={styles.dualBrandSelectorIcon} />\n </button>\n ))}\n </div>\n );\n}\n"],"names":["DualBrandSelector","dualBrandingElements","brandsConfiguration","dualBrandingChangeHandler","selectedBrandValue","i18n","useCoreContext","dualBrandItems","mapDualBrandButtons","selectedBrand","setSelectedBrand","useState","handleBrandSelect","brandId","h","div","className","styles","dualBrandSelector","role","aria-label","get","map","item","button","key","id","type","classNames","dualBrandSelectorButton","dualBrandSelectorButtonSelected","onMouseDown","e","preventDefault","onClick","onKeyDown","handleKeyDown","altName","aria-pressed","img","src","imageURL","alt","dualBrandSelectorIcon"],"mappings":"6XAee,SAASA,GAAkBC,qBACtCA,EAAoBC,oBACpBA,EAAmBC,0BACnBA,EAAyBC,mBACzBA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAiBC,EAAoBP,EAAsBC,IAC1DO,EAAeC,GAAoBC,EAAiBP,GAErDQ,EAAqBC,IACvBH,EAAiBG,GACjBV,EAA0BU,IAW9B,OACIC,EAACC,MAAAA,CAAIC,UAAWC,EAAOC,kBAAmBC,KAAK,QAAQC,aAAYf,EAAKgB,IAAI,qCACvEd,EAAee,IAAKC,GACjBT,EAACU,SAAAA,CACGC,IAAKF,EAAKG,GACVC,KAAK,SACLX,UAAWY,EAAWX,EAAOY,wBAAyB,CAClD,CAACZ,EAAOa,iCAAkCrB,IAAkBc,EAAKG,KAErEK,YAAaC,GAAKA,EAAEC,iBACpBC,QAAS,IAAMtB,EAAkBW,EAAKG,IACtCS,UAAWH,GAlBL,EAACA,EAAkBnB,KACvB,UAAVmB,EAAEP,MACFO,EAAEC,iBACFrB,EAAkBC,KAeMuB,CAAcJ,EAAGT,EAAKG,IACtCN,aAAYG,EAAKc,QACjBC,eAAc7B,IAAkBc,EAAKG,IAErCZ,EAACyB,MAAAA,CAAIC,IAAKjB,EAAKkB,SAAUC,IAAKnB,EAAKc,QAASrB,UAAWC,EAAO0B,0BAKlF"}
@@ -0,0 +1,2 @@
1
+ var e={dualBrandSelector:"DualBrandSelector-module_dualBrandSelector__Fz7UW",dualBrandSelectorButton:"DualBrandSelector-module_dualBrandSelectorButton__3Dxem",dualBrandSelectorButtonSelected:"DualBrandSelector-module_dualBrandSelectorButtonSelected__EswTK",dualBrandSelectorIcon:"DualBrandSelector-module_dualBrandSelectorIcon__qeN0L"};export{e as default};
2
+ //# sourceMappingURL=DualBrandSelector.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DualBrandSelector.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\nimport type { Form } from '../../../../utils/useForm/types';\nimport type { SecuredFieldsProviderRef } from '../../../internal/SecuredFields/SFP/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: string;\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (o: CardAllValidData) => void;\n onAutoComplete?: (o: CardAutoCompleteData) => void;\n onBinValue?: (o: CardBinValueData) => void;\n onBlur?: (e) => void;\n onBrand?: (o: CardBrandData) => void;\n onConfigSuccess?: (O: CardConfigSuccessData) => void;\n onChange: (state) => void;\n onError?: () => void;\n onFieldValid?: (o: CardFieldValidData) => void;\n onFocus?: (e) => void;\n onLoad?: (o: CardLoadData) => void;\n onSubmitAnalytics: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: SecuredFieldsProviderRef;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n\nexport type CardSetFormData = Form<CardInputDataState>['setData'];\nexport type CardSetFormValid = Form<CardInputDataState>['setValid'];\nexport type CardSetFormErrors = Form<CardInputDataState>['setErrors'];\n\nexport type OnFieldFocus = (who: string, e: Event | CardFocusData) => void;\n"],"names":["AddressModeOptions"],"mappings":"AA+MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\nimport type { Form } from '../../../../utils/useForm/types';\nimport type { SecuredFieldsProviderRef } from '../../../internal/SecuredFields/SFP/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: 'components' | 'custom';\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (o: CardAllValidData) => void;\n onAutoComplete?: (o: CardAutoCompleteData) => void;\n onBinValue?: (o: CardBinValueData) => void;\n onBlur?: (e) => void;\n onBrand?: (o: CardBrandData) => void;\n onConfigSuccess?: (O: CardConfigSuccessData) => void;\n onChange: (state) => void;\n onError?: () => void;\n onFieldValid?: (o: CardFieldValidData) => void;\n onFocus?: (e) => void;\n onLoad?: (o: CardLoadData) => void;\n onSubmitAnalytics: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: SecuredFieldsProviderRef;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n\nexport type CardSetFormData = Form<CardInputDataState>['setData'];\nexport type CardSetFormValid = Form<CardInputDataState>['setValid'];\nexport type CardSetFormErrors = Form<CardInputDataState>['setErrors'];\n\nexport type OnFieldFocus = (who: string, e: Event | CardFocusData) => void;\n"],"names":["AddressModeOptions"],"mappings":"AA+MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}