@adyen/adyen-web 6.15.0 → 6.16.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 (84) hide show
  1. package/dist/cjs/adyen.css +5 -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 +1 -0
  6. package/dist/es/adyen.css +5 -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/CardFields.js +1 -1
  11. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js.map +1 -1
  18. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  19. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  20. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  21. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  22. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  23. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  24. package/dist/es/components/UPI/components/VpaInput/VpaInput.js +1 -1
  25. package/dist/es/components/UPI/components/VpaInput/VpaInput.js.map +1 -1
  26. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  27. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  28. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  29. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +2 -0
  30. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +1 -0
  31. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +2 -0
  32. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -0
  33. package/dist/es/components/internal/SecuredFields/binLookup/createCardVariantSwitcher.js +1 -1
  34. package/dist/es/components/internal/SecuredFields/binLookup/createCardVariantSwitcher.js.map +1 -1
  35. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  36. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  37. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  38. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  39. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  40. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  41. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  42. package/dist/es/core/core.js +1 -1
  43. package/dist/es/index.d.ts +1 -0
  44. package/dist/es/utils/clipboard.js.map +1 -1
  45. package/dist/es-legacy/adyen.css +5 -3
  46. package/dist/es-legacy/adyen.css.map +1 -1
  47. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  48. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  49. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  50. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  51. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  52. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  53. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  54. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  55. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js +1 -1
  56. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js.map +1 -1
  57. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  58. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  59. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  60. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  61. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  62. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  63. package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js +1 -1
  64. package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js.map +1 -1
  65. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  66. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  67. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  68. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +2 -0
  69. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +1 -0
  70. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +2 -0
  71. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -0
  72. package/dist/es-legacy/components/internal/SecuredFields/binLookup/createCardVariantSwitcher.js +1 -1
  73. package/dist/es-legacy/components/internal/SecuredFields/binLookup/createCardVariantSwitcher.js.map +1 -1
  74. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  75. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  76. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  77. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  78. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  79. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  80. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  81. package/dist/es-legacy/core/core.js +1 -1
  82. package/dist/es-legacy/utils/clipboard.js.map +1 -1
  83. package/package.json +1 -1
  84. package/styles/adyen.css +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP, DEFAULT_CARD_GROUP_TYPES } from '../../../internal/SecuredFields/lib/constants';\nimport { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { CardConfiguration } from '../../types';\nimport { CardConfigData } from '../../../../core/Analytics/types';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE } from '../../../ThreeDS2/constants';\nimport CardInputDefaultProps from './defaultProps';\nimport { isConfigurationValid as isFastlaneComponentConfigValid } from '../Fastlane/utils/validate-configuration';\nimport { notFalsy } from '../../../../utils/commonUtils';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs amount, hasCVC, installmentOptions)\n amount: props.amount,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const getCardConfigData = (cardProps: CardConfiguration): CardConfigData => {\n const MAX_LENGTH = 128;\n\n // Extract props from cardProps - mostly setting a default value, if prop not found\n const {\n autoFocus,\n billingAddressAllowedCountries,\n billingAddressMode,\n billingAddressRequired,\n billingAddressRequiredFields,\n brands = DEFAULT_CARD_GROUP_TYPES,\n brandsConfiguration,\n challengeWindowSize = DEFAULT_CHALLENGE_WINDOW_SIZE,\n configuration,\n countryCode,\n data,\n disclaimerMessage,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n fastlaneConfiguration,\n forceCompat,\n hasHolderName,\n hideCVC,\n holderNameRequired,\n installmentOptions,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate,\n name, // = 'none',\n placeholders,\n positionHolderNameOnTop,\n showBrandIcon,\n showInstallmentAmounts,\n showPayButton = false, // hard coded default\n styles,\n onAllValid,\n onBinLookup,\n onBinValue,\n onBlur,\n onBrand,\n onConfigSuccess,\n onEnterKeyPressed,\n onFieldValid,\n onFocus,\n onLoad\n } = cardProps;\n\n const dataString = JSON.stringify(CardInputDefaultProps.data);\n\n const srPanelEnabled = cardProps.modules?.srPanel?.enabled;\n const srPanelMoveFocus = cardProps.modules?.srPanel?.moveFocus;\n\n const riskEnabled = cardProps.modules?.risk?.enabled;\n\n const isFastlaneConfigValid = isFastlaneComponentConfigValid(fastlaneConfiguration);\n\n const billingAddressModeValue = cardProps.onAddressLookup ? 'lookup' : billingAddressMode;\n\n let showKCPType: 'none' | 'auto' | 'atStart' = 'none';\n if (configuration?.koreanAuthenticationRequired === true) {\n showKCPType = countryCode?.toLowerCase() === 'kr' ? 'atStart' : 'auto';\n }\n\n const configData: CardConfigData = {\n autoFocus,\n ...(billingAddressAllowedCountries?.length > 0 && {\n billingAddressAllowedCountries: billingAddressAllowedCountries.toString().substring(0, MAX_LENGTH)\n }),\n billingAddressMode: billingAddressModeValue,\n billingAddressRequired,\n billingAddressRequiredFields: billingAddressRequiredFields?.toString()?.substring(0, MAX_LENGTH),\n // Probably just for development - in real life we wouldn't expect the number of supported brands to push the endpoint limit on 128 chars\n brands: brands?.toString()?.substring(0, MAX_LENGTH),\n challengeWindowSize,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n forceCompat,\n hasBrandsConfiguration: notFalsy(brandsConfiguration),\n hasData: data && JSON.stringify(cardProps.data) !== dataString,\n hasDisclaimerMessage: !!disclaimerMessage,\n hasHolderName,\n hasInstallmentOptions: notFalsy(installmentOptions),\n hasPlaceholders: notFalsy(placeholders), // has merchant defined placeholders\n hasStylesConfigured: notFalsy(styles),\n hideCVC,\n holderNameRequired,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate: !!minimumExpiryDate, // Potentially, in the future, we can send the actual string value\n name,\n positionHolderNameOnTop,\n riskEnabled,\n showBrandIcon,\n showInstallmentAmounts: !!showInstallmentAmounts,\n showKCPType,\n showPayButton,\n socialSecurityNumberMode: configuration?.socialSecurityNumberMode,\n srPanelEnabled,\n srPanelMoveFocus,\n /** callbacks */\n // We need to detect if the merchant themselves has defined these, not if we've set them as a default\n hasOnAllValid: onAllValid !== CardInputDefaultProps.onAllValid,\n hasOnBinValue: onBinValue !== CardInputDefaultProps.onBinValue,\n hasOnBlur: onBlur !== CardInputDefaultProps.onBlur,\n hasOnBrand: onBrand !== CardInputDefaultProps.onBrand,\n hasOnConfigSuccess: onConfigSuccess !== CardInputDefaultProps.onConfigSuccess,\n hasOnFieldValid: onFieldValid !== CardInputDefaultProps.onFieldValid,\n hasOnFocus: onFocus !== CardInputDefaultProps.onFocus,\n hasOnLoad: onLoad !== CardInputDefaultProps.onLoad,\n // Card level props\n hasOnBinLookup: !!onBinLookup,\n hasOnEnterKeyPressed: !!onEnterKeyPressed,\n /**\n * Fastlane\n */\n ...(isFastlaneConfigValid && {\n hasFastlaneConfigured: true,\n isFastlaneConsentDefaultOn: fastlaneConfiguration.defaultToggleState\n })\n };\n\n return configData;\n};\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","getCardConfigData","cardProps","billingAddressMode","DEFAULT_CARD_GROUP_TYPES","challengeWindowSize","DEFAULT_CHALLENGE_WINDOW_SIZE","configuration","data","disableIOSArrowKeys","doBinLookup","enableStoreDetails","fastlaneConfiguration","hideCVC","name","showInstallmentAmounts","showPayButton","styles","onBinLookup","onBlur","onBrand","onEnterKeyPressed","onFocus","dataString","JSON","stringify","CardInputDefaultProps","srPanelEnabled","modules","srPanel","enabled","srPanelMoveFocus","moveFocus","riskEnabled","risk","isFastlaneConfigValid","isFastlaneComponentConfigValid","billingAddressModeValue","onAddressLookup","showKCPType","koreanAuthenticationRequired","toLowerCase","_object_spread","_object_spread_props","length","toString","substring","hasBrandsConfiguration","notFalsy","hasData","hasDisclaimerMessage","hasInstallmentOptions","hasPlaceholders","hasStylesConfigured","socialSecurityNumberMode","hasOnAllValid","hasOnBinValue","hasOnBlur","hasOnBrand","hasOnConfigSuccess","hasOnFieldValid","hasOnFocus","hasOnLoad","hasOnBinLookup","hasOnEnterKeyPressed","hasFastlaneConfigured","isFastlaneConsentDefaultOn","defaultToggleState","configData"],"mappings":"4kDA2BO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GAOrBI,EAA8BC,GACT,eAAvBA,aAAAA,EAAAA,EAAcC,QAAwBD,aAAAA,EAAAA,EAAcE,OAAQ,EAG1DC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAAMQ,eAAiBR,EAAMS,mBAqB3D,GAnBIF,IACAF,EAASL,EAAMU,wBAA0BC,EAAuBC,GAGhEX,IACAI,EAASQ,EACLN,IACAF,EAASL,EAAMU,wBAA0BI,EAAoBC,IAIjEb,IACAG,EAASW,EACLT,IACAF,EAASL,EAAMU,wBAA0BO,EAAoBC,IAKjEf,EAAwB,CAExB,MAAMgB,EAAuChB,EAA8B,KAAC,GAAGiB,QAAOC,GAAwB,iBAATA,IAErG,IAAIC,EAA4BH,EAE5Bf,IAEAkB,EAA4BH,EAA2BC,QAAOG,GAAKnB,EAA6BoB,SAASD,MAG7GlB,EAASC,EAAYmB,O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AAA,OAAAA,EAAAA,EAAoBmF,UAAU,EA1EvB,KA2EfzC,sBACAI,sBACAC,cACAC,qBACAvC,mBACAN,cACAiF,uBAAwBC,EAASlG,GACjCmG,QAASzC,GAAQgB,KAAKC,UAAUvB,EAAUM,QAAUe,GACpD2B,uBAAwB1F,EACxBrC,gBACAgI,sBAAuBH,EAAS/F,GAChCmG,gBAAiBJ,EAAS9F,GAC1BmG,oBAAqBL,EAAS/B,GAC9BJ,UACAzF,qBACA4C,YACAC,kBACAE,mBACAE,oBAAqBA,EACrByC,OACAzF,0BACA4G,eACA9E,gBACA4D,yBAA0BA,EAC1BwB,eACAvB,gBACAsC,yBAA0B/C,aAAAA,EAAAA,EAAe+C,yBACzC3B,kBACAI,oBAGAwB,cAAe/E,IAAekD,EAAsBlD,WACpDgF,cAAe9E,IAAegD,EAAsBhD,WACpD+E,UAAWtC,IAAWO,EAAsBP,OAC5CuC,WAAYtC,IAAYM,EAAsBN,QAC9CuC,mBAAoBhF,KAAoB+C,EAAsB/C,gBAC9DiF,gBAAiB9E,KAAiB4C,EAAsB5C,aACxD+E,WAAYvC,KAAYI,EAAsBJ,QAC9CwC,UAAW/E,KAAW2C,EAAsB3C,OAE5CgF,iBAAkB7C,EAClB8C,uBAAwB3C,KAIpBc,IAAyB,CACzB8B,uBAAuB,EACvBC,2BAA4BtD,EAAsBuD,oBAInDC"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP, DEFAULT_CARD_GROUP_TYPES } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { CardBrandsConfiguration, CardConfiguration, DualBrandSelectElement } from '../../types';\nimport { CardConfigData } from '../../../../core/Analytics/types';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE } from '../../../ThreeDS2/constants';\nimport CardInputDefaultProps from './defaultProps';\nimport { isConfigurationValid as isFastlaneComponentConfigValid } from '../Fastlane/utils/validate-configuration';\nimport { notFalsy } from '../../../../utils/commonUtils';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs amount, hasCVC, installmentOptions)\n amount: props.amount,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const getCardConfigData = (cardProps: CardConfiguration): CardConfigData => {\n const MAX_LENGTH = 128;\n\n // Extract props from cardProps - mostly setting a default value, if prop not found\n const {\n autoFocus,\n billingAddressAllowedCountries,\n billingAddressMode,\n billingAddressRequired,\n billingAddressRequiredFields,\n brands = DEFAULT_CARD_GROUP_TYPES,\n brandsConfiguration,\n challengeWindowSize = DEFAULT_CHALLENGE_WINDOW_SIZE,\n configuration,\n countryCode,\n data,\n disclaimerMessage,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n fastlaneConfiguration,\n forceCompat,\n hasHolderName,\n hideCVC,\n holderNameRequired,\n installmentOptions,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate,\n name, // = 'none',\n placeholders,\n positionHolderNameOnTop,\n showBrandIcon,\n showInstallmentAmounts,\n showPayButton = false, // hard coded default\n styles,\n onAllValid,\n onBinLookup,\n onBinValue,\n onBlur,\n onBrand,\n onConfigSuccess,\n onEnterKeyPressed,\n onFieldValid,\n onFocus,\n onLoad\n } = cardProps;\n\n const dataString = JSON.stringify(CardInputDefaultProps.data);\n\n const srPanelEnabled = cardProps.modules?.srPanel?.enabled;\n const srPanelMoveFocus = cardProps.modules?.srPanel?.moveFocus;\n\n const riskEnabled = cardProps.modules?.risk?.enabled;\n\n const isFastlaneConfigValid = isFastlaneComponentConfigValid(fastlaneConfiguration);\n\n const billingAddressModeValue = cardProps.onAddressLookup ? 'lookup' : billingAddressMode;\n\n let showKCPType: 'none' | 'auto' | 'atStart' = 'none';\n if (configuration?.koreanAuthenticationRequired === true) {\n showKCPType = countryCode?.toLowerCase() === 'kr' ? 'atStart' : 'auto';\n }\n\n const configData: CardConfigData = {\n autoFocus,\n ...(billingAddressAllowedCountries?.length > 0 && {\n billingAddressAllowedCountries: billingAddressAllowedCountries.toString().substring(0, MAX_LENGTH)\n }),\n billingAddressMode: billingAddressModeValue,\n billingAddressRequired,\n billingAddressRequiredFields: billingAddressRequiredFields?.toString()?.substring(0, MAX_LENGTH),\n // Probably just for development - in real life we wouldn't expect the number of supported brands to push the endpoint limit on 128 chars\n brands: brands?.toString()?.substring(0, MAX_LENGTH),\n challengeWindowSize,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n forceCompat,\n hasBrandsConfiguration: notFalsy(brandsConfiguration),\n hasData: data && JSON.stringify(cardProps.data) !== dataString,\n hasDisclaimerMessage: !!disclaimerMessage,\n hasHolderName,\n hasInstallmentOptions: notFalsy(installmentOptions),\n hasPlaceholders: notFalsy(placeholders), // has merchant defined placeholders\n hasStylesConfigured: notFalsy(styles),\n hideCVC,\n holderNameRequired,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate: !!minimumExpiryDate, // Potentially, in the future, we can send the actual string value\n name,\n positionHolderNameOnTop,\n riskEnabled,\n showBrandIcon,\n showInstallmentAmounts: !!showInstallmentAmounts,\n showKCPType,\n showPayButton,\n socialSecurityNumberMode: configuration?.socialSecurityNumberMode,\n srPanelEnabled,\n srPanelMoveFocus,\n /** callbacks */\n // We need to detect if the merchant themselves has defined these, not if we've set them as a default\n hasOnAllValid: onAllValid !== CardInputDefaultProps.onAllValid,\n hasOnBinValue: onBinValue !== CardInputDefaultProps.onBinValue,\n hasOnBlur: onBlur !== CardInputDefaultProps.onBlur,\n hasOnBrand: onBrand !== CardInputDefaultProps.onBrand,\n hasOnConfigSuccess: onConfigSuccess !== CardInputDefaultProps.onConfigSuccess,\n hasOnFieldValid: onFieldValid !== CardInputDefaultProps.onFieldValid,\n hasOnFocus: onFocus !== CardInputDefaultProps.onFocus,\n hasOnLoad: onLoad !== CardInputDefaultProps.onLoad,\n // Card level props\n hasOnBinLookup: !!onBinLookup,\n hasOnEnterKeyPressed: !!onEnterKeyPressed,\n /**\n * Fastlane\n */\n ...(isFastlaneConfigValid && {\n hasFastlaneConfigured: true,\n isFastlaneConsentDefaultOn: fastlaneConfiguration.defaultToggleState\n })\n };\n\n return configData;\n};\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","getCardConfigData","cardProps","billingAddressMode","DEFAULT_CARD_GROUP_TYPES","challengeWindowSize","DEFAULT_CHALLENGE_WINDOW_SIZE","configuration","data","disableIOSArrowKeys","doBinLookup","enableStoreDetails","fastlaneConfiguration","hideCVC","name","showInstallmentAmounts","showPayButton","styles","onBinLookup","onBlur","onBrand","onEnterKeyPressed","onFocus","dataString","JSON","stringify","CardInputDefaultProps","srPanelEnabled","modules","srPanel","enabled","srPanelMoveFocus","moveFocus","riskEnabled","risk","isFastlaneConfigValid","isFastlaneComponentConfigValid","billingAddressModeValue","onAddressLookup","showKCPType","koreanAuthenticationRequired","toLowerCase","_object_spread","_object_spread_props","length","toString","substring","hasBrandsConfiguration","notFalsy","hasData","hasDisclaimerMessage","hasInstallmentOptions","hasPlaceholders","hasStylesConfigured","socialSecurityNumberMode","hasOnAllValid","hasOnBinValue","hasOnBlur","hasOnBrand","hasOnConfigSuccess","hasOnFieldValid","hasOnFocus","hasOnLoad","hasOnBinLookup","hasOnEnterKeyPressed","hasFastlaneConfigured","isFastlaneConsentDefaultOn","defaultToggleState","configData","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","brandObject","localeBrand","altName"],"mappings":"goDA2BO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GAOrBI,EAA8BC,GACT,eAAvBA,aAAAA,EAAAA,EAAcC,QAAwBD,aAAAA,EAAAA,EAAcE,OAAQ,EAG1DC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAAMQ,eAAiBR,EAAMS,mBAqB3D,GAnBIF,IACAF,EAASL,EAAMU,wBAA0BC,EAAuBC,GAGhEX,IACAI,EAASQ,EACLN,IACAF,EAASL,EAAMU,wBAA0BI,EAAoBC,IAIjEb,IACAG,EAASW,EACLT,IACAF,EAASL,EAAMU,wBAA0BO,EAAoBC,IAKjEf,EAAwB,CAExB,MAAMgB,EAAuChB,EAA8B,KAAC,GAAGiB,QAAOC,GAAwB,iBAATA,IAErG,IAAIC,EAA4BH,EAE5Bf,IAEAkB,EAA4BH,EAA2BC,QAAOG,GAAKnB,EAA6BoB,SAASD,MAG7GlB,EAASC,EAAYmB,OAAOH,GACxBf,IACAF,EAASL,EAAMU,wBACTC,EAAqBc,OAAOH,GAC5BV,EAAwBa,OAAOH,GAG7C,CACA,OAAOjB,CAAAA,EAMEqB,EAAc,CAACC,EAAaC,EAAgBC,KAErD,OAAQF,GACJ,IAAK,uBACD,OAAOC,EAAKE,IAAI,UAAUH,KAE9B,IAAK,SACL,IAAK,oBACL,IAAK,aACL,IAAK,kBACL,IAAK,OACL,IAAK,UACD,OAAOE,aAAAA,EAAAA,EAAwBF,IAAOC,EAAKE,IAAID,eAAAA,EAAwBF,IAAQC,EAAKE,IAAIH,GAE5F,QACI,OAAO,KACf,EAGSI,EAA6B/B,IAC/B,CAEHgC,OAAQhC,EAAMgC,OACdC,uBAAwBjC,EAAMiC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AwB,cAAe/E,IAAekD,EAAsBlD,WACpDgF,cAAe9E,IAAegD,EAAsBhD,WACpD+E,UAAWtC,IAAWO,EAAsBP,OAC5CuC,WAAYtC,IAAYM,EAAsBN,QAC9CuC,mBAAoBhF,KAAoB+C,EAAsB/C,gBAC9DiF,gBAAiB9E,KAAiB4C,EAAsB5C,aACxD+E,WAAYvC,KAAYI,EAAsBJ,QAC9CwC,UAAW/E,KAAW2C,EAAsB3C,OAE5CgF,iBAAkB7C,EAClB8C,uBAAwB3C,KAIpBc,IAAyB,CACzB8B,uBAAuB,EACvBC,2BAA4BtD,EAAsBuD,oBAInDC,EAGEC,EAAsB,CAACC,EAAmDxH,IAC5EwH,EAAwBC,KAAIvI,IAIdc,IAAAA,EAHjB,MAAM5C,EAAQ8B,EAAKwI,GACbrK,EAAWsK,IACXC,EAAsB,SAAVxK,EAAmB,SAAWA,EAC/B4C,IAAAA,EAAjB,MAAM6H,EAA2C,QAAhC7H,EAAAA,QAAAA,EAAAA,EAAoB5C,UAApB4C,IAAAA,OAAAA,EAAAA,EAA4B8H,YAA5B9H,IAAAA,EAAAA,EAAoC7C,EAAgByK,EAAWvK,GAIhF,MAAO,CACHqK,GAAIxI,EAAKwI,GACT1D,KAAM9E,EAAK6I,YAAYC,aAAe9I,EAAK6I,YAAY3K,MACvDyK,WACAI,QAAShF,EAAiB7F,GAC9B"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as t}from"../../../../../external/preact/dist/preact.js";import o from"../../../../../_virtual/index.js";import n from"../PaymentMethodDetails.js";import a from"../PaymentMethodIcon.js";import i from"../DisableOneClickConfirmation.js";import r from"../PaymentMethodBrands/PaymentMethodBrands.js";import{BRAND_ICON_UI_EXCLUSION_LIST as s}from"../../../../internal/SecuredFields/lib/constants.js";import d from"../PaymentMethodName.js";import{useCoreContext as c}from"../../../../../core/Context/CoreProvider.js";import m from"../../../../internal/ExpandButton/ExpandButton.js";function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function l(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),n.forEach((function(t){p(e,t,o[t])}))}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t}(Object(t)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))})),e}class y extends e{render({paymentMethod:e,isSelected:p,isDisablingPaymentMethod:y,isLoaded:u,isLoading:b,standalone:f,showRadioButton:_}){const{i18n:P}=c();if(!e)return null;const O="card"===e.props.type||"scheme"===e.props.type;var k;const g=o(h(l({"adyen-checkout__payment-method":!0,[`adyen-checkout__payment-method--${e.props.type}`]:!0},O&&{[`adyen-checkout__payment-method--${null!==(k=e.props.fundingSource)&&void 0!==k?k:"credit"}`]:!0}),{"adyen-checkout__payment-method--selected":p,"adyen-checkout__payment-method--loading":b,"adyen-checkout__payment-method--disabling":y,"adyen-checkout__payment-method--confirming":this.state.showDisableStoredPaymentMethodConfirmation,"adyen-checkout__payment-method--standalone":f,[e._id]:!0,[this.props.className]:!0})),C=this.props.showRemovePaymentMethodButton&&e.props.oneClick&&p,j=`remove-${e._id}`,M=`container-${e._id}`,w=`button-${e._id}`,D=!e.props.oneClick&&e.brands&&e.brands.length>0;return t("div",{key:e._id,className:g,onClick:this.handleOnListItemClick},t("div",{className:"adyen-checkout__payment-method__header"},t(m,{buttonId:w,showRadioButton:_,isSelected:p,expandContentId:M},t(a,h(l({},e.props.oneClick&&{altDescription:e.props.name}),{type:e.type,src:e.icon})),t(d,{displayName:e.displayName,isSelected:p,additionalInfo:e.additionalInfo})),C&&t("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link",onClick:this.toggleDisableConfirmation,"aria-expanded":this.state.showDisableStoredPaymentMethodConfirmation,"aria-controls":j},P.get("storedPaymentMethod.disable.button")),D&&t(r,{showOtherInsteafOfNumber:e.props.showOtherInsteafOfNumber,keepBrandsVisible:e.props.keepBrandsVisible,brands:e.brands,excludedUIBrands:s,isPaymentMethodSelected:p})),t("div",{className:"adyen-checkout-pm-details-wrapper","aria-hidden":!p},t("div",{className:"adyen-checkout__payment-method__details",id:M},C&&t(i,{id:j,open:this.state.showDisableStoredPaymentMethodConfirmation,onDisable:this.onDisableStoredPaymentMethod,onCancel:this.toggleDisableConfirmation}),t(n,{paymentMethodComponent:e.render(),isLoaded:u}))))}constructor(...e){super(...e),p(this,"state",{showDisableStoredPaymentMethodConfirmation:!1}),p(this,"toggleDisableConfirmation",(()=>{this.setState({showDisableStoredPaymentMethodConfirmation:!this.state.showDisableStoredPaymentMethodConfirmation})})),p(this,"onDisableStoredPaymentMethod",(()=>{this.props.onDisableStoredPaymentMethod(this.props.paymentMethod),this.toggleDisableConfirmation()})),p(this,"handleOnListItemClick",(()=>{const{onSelect:e,paymentMethod:t}=this.props;e(t)}))}}p(y,"defaultProps",{paymentMethod:null,isSelected:!1,isLoaded:!1,isLoading:!1,showDisableStoredPaymentMethodConfirmation:!1,showRadioButton:!1});export{y as default};
1
+ import{Component as e,createElement as t}from"../../../../../external/preact/dist/preact.js";import o from"../../../../../_virtual/index.js";import n from"../PaymentMethodDetails.js";import a from"../PaymentMethodIcon.js";import i from"../DisableOneClickConfirmation.js";import s from"../PaymentMethodBrands/PaymentMethodBrands.js";import{BRAND_ICON_UI_EXCLUSION_LIST as r}from"../../../../internal/SecuredFields/lib/constants.js";import d from"../PaymentMethodName.js";import{useCoreContext as c}from"../../../../../core/Context/CoreProvider.js";import m from"../../../../internal/ExpandButton/ExpandButton.js";function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function l(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),n.forEach((function(t){p(e,t,o[t])}))}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t}(Object(t)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))})),e}class y extends e{render({paymentMethod:e,isSelected:p,isDisablingPaymentMethod:y,isLoaded:u,isLoading:b,standalone:f,showRadioButton:_}){const{i18n:P}=c();if(!e)return null;const O="card"===e.props.type||"scheme"===e.props.type;var k;const g=o(h(l({"adyen-checkout__payment-method":!0,[`adyen-checkout__payment-method--${e.props.type}`]:!0},O&&{[`adyen-checkout__payment-method--${null!==(k=e.props.fundingSource)&&void 0!==k?k:"credit"}`]:!0}),{"adyen-checkout__payment-method--selected":p,"adyen-checkout__payment-method--loading":b,"adyen-checkout__payment-method--disabling":y,"adyen-checkout__payment-method--confirming":this.state.showDisableStoredPaymentMethodConfirmation,"adyen-checkout__payment-method--standalone":f,[e._id]:!0,[this.props.className]:!0})),C=this.props.showRemovePaymentMethodButton&&e.props.oneClick&&p,j=`remove-${e._id}`,M=`container-${e._id}`,w=`button-${e._id}`,D=!e.props.oneClick&&e.brands&&e.brands.length>0;return t("div",{key:e._id,className:g,onClick:this.handleOnListItemClick},t("div",{className:"adyen-checkout__payment-method__header"},t(m,{buttonId:w,showRadioButton:_,isSelected:p,expandContentId:M,standalone:f},t(a,h(l({},e.props.oneClick&&{altDescription:e.props.name}),{type:e.type,src:e.icon})),t(d,{displayName:e.displayName,isSelected:p,additionalInfo:e.additionalInfo})),C&&t("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link",onClick:this.toggleDisableConfirmation,"aria-expanded":this.state.showDisableStoredPaymentMethodConfirmation,"aria-controls":j},P.get("storedPaymentMethod.disable.button")),D&&t(s,{showOtherInsteafOfNumber:e.props.showOtherInsteafOfNumber,keepBrandsVisible:e.props.keepBrandsVisible,brands:e.brands,excludedUIBrands:r,isPaymentMethodSelected:p})),t("div",{className:"adyen-checkout-pm-details-wrapper","aria-hidden":!p},t("div",{className:"adyen-checkout__payment-method__details",id:M},C&&t(i,{id:j,open:this.state.showDisableStoredPaymentMethodConfirmation,onDisable:this.onDisableStoredPaymentMethod,onCancel:this.toggleDisableConfirmation}),t(n,{paymentMethodComponent:e.render(),isLoaded:u}))))}constructor(...e){super(...e),p(this,"state",{showDisableStoredPaymentMethodConfirmation:!1}),p(this,"toggleDisableConfirmation",(()=>{this.setState({showDisableStoredPaymentMethodConfirmation:!this.state.showDisableStoredPaymentMethodConfirmation})})),p(this,"onDisableStoredPaymentMethod",(()=>{this.props.onDisableStoredPaymentMethod(this.props.paymentMethod),this.toggleDisableConfirmation()})),p(this,"handleOnListItemClick",(()=>{const{onSelect:e,paymentMethod:t}=this.props;e(t)}))}}p(y,"defaultProps",{paymentMethod:null,isSelected:!1,isLoaded:!1,isLoading:!1,showDisableStoredPaymentMethodConfirmation:!1,showRadioButton:!1});export{y as default};
2
2
  //# sourceMappingURL=PaymentMethodItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentMethodItem.js","sources":["../../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport PaymentMethodDetails from '../PaymentMethodDetails';\nimport PaymentMethodIcon from '../PaymentMethodIcon';\nimport DisableOneClickConfirmation from '../DisableOneClickConfirmation';\nimport './PaymentMethodItem.scss';\nimport UIElement from '../../../../internal/UIElement/UIElement';\nimport PaymentMethodBrands from '../PaymentMethodBrands/PaymentMethodBrands';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../../../../internal/SecuredFields/lib/constants';\nimport PaymentMethodName from '../PaymentMethodName';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport ExpandButton from '../../../../internal/ExpandButton';\n\nexport interface PaymentMethodItemProps {\n paymentMethod: UIElement;\n isSelected?: boolean;\n isLoaded?: boolean;\n isLoading?: boolean;\n isDisablingPaymentMethod: boolean;\n showRemovePaymentMethodButton: boolean;\n onDisableStoredPaymentMethod: (paymentMethod) => void;\n onSelect: (paymentMethod: UIElement) => void;\n standalone: boolean;\n className?: string;\n showRadioButton?: boolean;\n}\n\nclass PaymentMethodItem extends Component<PaymentMethodItemProps> {\n public static defaultProps = {\n paymentMethod: null,\n isSelected: false,\n isLoaded: false,\n isLoading: false,\n showDisableStoredPaymentMethodConfirmation: false,\n showRadioButton: false\n };\n\n public state = {\n showDisableStoredPaymentMethodConfirmation: false\n };\n\n public toggleDisableConfirmation = () => {\n this.setState({ showDisableStoredPaymentMethodConfirmation: !this.state.showDisableStoredPaymentMethodConfirmation });\n };\n\n public onDisableStoredPaymentMethod = () => {\n this.props.onDisableStoredPaymentMethod(this.props.paymentMethod);\n this.toggleDisableConfirmation();\n };\n\n private handleOnListItemClick = (): void => {\n const { onSelect, paymentMethod } = this.props;\n onSelect(paymentMethod);\n };\n\n // @ts-ignore need to refine the type for paymentMethod\n render({ paymentMethod, isSelected, isDisablingPaymentMethod, isLoaded, isLoading, standalone, showRadioButton }) {\n const { i18n } = useCoreContext();\n\n if (!paymentMethod) {\n return null;\n }\n\n const isCard = paymentMethod.props.type === 'card' || paymentMethod.props.type === 'scheme';\n\n const paymentMethodClassnames = classNames({\n 'adyen-checkout__payment-method': true,\n [`adyen-checkout__payment-method--${paymentMethod.props.type}`]: true,\n ...(isCard && { [`adyen-checkout__payment-method--${paymentMethod.props.fundingSource ?? 'credit'}`]: true }),\n 'adyen-checkout__payment-method--selected': isSelected,\n 'adyen-checkout__payment-method--loading': isLoading,\n 'adyen-checkout__payment-method--disabling': isDisablingPaymentMethod,\n 'adyen-checkout__payment-method--confirming': this.state.showDisableStoredPaymentMethodConfirmation,\n 'adyen-checkout__payment-method--standalone': standalone,\n [paymentMethod._id]: true,\n [this.props.className]: true\n });\n\n const showRemovePaymentMethodButton = this.props.showRemovePaymentMethodButton && paymentMethod.props.oneClick && isSelected;\n const disableConfirmationId = `remove-${paymentMethod._id}`;\n const containerId = `container-${paymentMethod._id}`;\n const buttonId = `button-${paymentMethod._id}`;\n\n const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div key={paymentMethod._id} className={paymentMethodClassnames} onClick={this.handleOnListItemClick}>\n <div className=\"adyen-checkout__payment-method__header\">\n <ExpandButton buttonId={buttonId} showRadioButton={showRadioButton} isSelected={isSelected} expandContentId={containerId}>\n <PaymentMethodIcon\n // Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)\n {...(paymentMethod.props.oneClick && { altDescription: paymentMethod.props.name })}\n type={paymentMethod.type}\n src={paymentMethod.icon}\n />\n\n <PaymentMethodName\n displayName={paymentMethod.displayName}\n isSelected={isSelected}\n additionalInfo={paymentMethod.additionalInfo}\n />\n </ExpandButton>\n\n {showRemovePaymentMethodButton && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={this.toggleDisableConfirmation}\n aria-expanded={this.state.showDisableStoredPaymentMethodConfirmation}\n aria-controls={disableConfirmationId}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n\n {showBrands && (\n <PaymentMethodBrands\n showOtherInsteafOfNumber={paymentMethod.props.showOtherInsteafOfNumber}\n keepBrandsVisible={paymentMethod.props.keepBrandsVisible}\n brands={paymentMethod.brands}\n excludedUIBrands={BRAND_ICON_UI_EXCLUSION_LIST}\n isPaymentMethodSelected={isSelected}\n />\n )}\n </div>\n\n <div className=\"adyen-checkout-pm-details-wrapper\" aria-hidden={!isSelected}>\n <div className=\"adyen-checkout__payment-method__details\" id={containerId}>\n {showRemovePaymentMethodButton && (\n <DisableOneClickConfirmation\n id={disableConfirmationId}\n open={this.state.showDisableStoredPaymentMethodConfirmation}\n onDisable={this.onDisableStoredPaymentMethod}\n onCancel={this.toggleDisableConfirmation}\n />\n )}\n\n <PaymentMethodDetails paymentMethodComponent={paymentMethod.render()} isLoaded={isLoaded} />\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default PaymentMethodItem;\n"],"names":["PaymentMethodItem","Component","render","paymentMethod","isSelected","isDisablingPaymentMethod","isLoaded","isLoading","standalone","showRadioButton","i18n","useCoreContext","isCard","props","type","paymentMethodClassnames","classNames","_object_spread_props","_object_spread","fundingSource","this","state","showDisableStoredPaymentMethodConfirmation","_id","className","showRemovePaymentMethodButton","oneClick","disableConfirmationId","containerId","buttonId","showBrands","brands","length","h","div","key","onClick","handleOnListItemClick","ExpandButton","expandContentId","PaymentMethodIcon","altDescription","name","src","icon","PaymentMethodName","displayName","additionalInfo","button","toggleDisableConfirmation","aria-expanded","aria-controls","get","PaymentMethodBrands","showOtherInsteafOfNumber","keepBrandsVisible","excludedUIBrands","BRAND_ICON_UI_EXCLUSION_LIST","isPaymentMethodSelected","aria-hidden","id","DisableOneClickConfirmation","open","onDisable","onDisableStoredPaymentMethod","onCancel","PaymentMethodDetails","paymentMethodComponent","super","args","_define_property","setState","onSelect","defaultProps"],"mappings":"m5CA2BA,MAAMA,UAA0BC,EA6B5BC,MAAAA,EAAOC,cAAEA,EAAaC,WAAEA,EAAUC,yBAAEA,EAAwBC,SAAEA,EAAQC,UAAEA,EAASC,WAAEA,EAAUC,gBAAEA,IAC3F,MAAMC,KAAEA,GAASC,IAEjB,IAAKR,EACD,OAAO,KAGX,MAAMS,EAAsC,SA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KC,MAAMC,2CAC1B6B,gBAAexB,GAEdjB,EAAK0C,IAAI,uCAIjBtB,GACGG,EAACoB,EAAAA,CACGC,yBAA0BnD,EAAcU,MAAMyC,yBAC9CC,kBAAmBpD,EAAcU,MAAM0C,kBACvCxB,OAAQ5B,EAAc4B,OACtByB,iBAAkBC,EAClBC,wBAAyBtD,KAKrC6B,EAACC,MAAAA,CAAIV,UAAU,oCAAoCmC,eAAcvD,GAC7D6B,EAACC,MAAAA,CAAIV,UAAU,0CAA0CoC,GAAIhC,GACxDH,GACGQ,EAAC4B,EAAAA,CACGD,GAAIjC,EACJmC,KAAM1C,KAAKC,MAAMC,2CACjByC,UAAW3C,KAAK4C,6BAChBC,SAAU7C,KAAK6B,4BAIvBhB,EAACiC,EAAAA,CAAqBC,uBAAwBhE,EAAcD,SAAUI,SAAUA,MAKpG,mBApHJ8D,SAAAC,GAUIC,OAAOjD,QAAQ,CACXC,4CAA4C,IAGhDgD,OAAOrB,6BAA4B,KAC/B7B,KAAKmD,SAAS,CAAEjD,4CAA6CF,KAAKC,MAAMC,4CAA2C,IAGvHgD,OAAON,gCAA+B,KAClC5C,KAAKP,MAAMmD,6BAA6B5C,KAAKP,MAAMV,eACnDiB,KAAK6B,2BAAyB,IAGlCqB,OAAQjC,yBAAwB,KAC5B,MAAMmC,SAAEA,EAAQrE,cAAEA,GAAkBiB,KAAKP,MACzC2D,EAASrE,EAAAA,KAxBbmE,EADEtE,EACYyE,eAAe,CACzBtE,cAAe,KACfC,YAAY,EACZE,UAAU,EACVC,WAAW,EACXe,4CAA4C,EAC5Cb,iBAAiB"}
1
+ {"version":3,"file":"PaymentMethodItem.js","sources":["../../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport PaymentMethodDetails from '../PaymentMethodDetails';\nimport PaymentMethodIcon from '../PaymentMethodIcon';\nimport DisableOneClickConfirmation from '../DisableOneClickConfirmation';\nimport './PaymentMethodItem.scss';\nimport UIElement from '../../../../internal/UIElement/UIElement';\nimport PaymentMethodBrands from '../PaymentMethodBrands/PaymentMethodBrands';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../../../../internal/SecuredFields/lib/constants';\nimport PaymentMethodName from '../PaymentMethodName';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport ExpandButton from '../../../../internal/ExpandButton';\n\nexport interface PaymentMethodItemProps {\n paymentMethod: UIElement;\n isSelected?: boolean;\n isLoaded?: boolean;\n isLoading?: boolean;\n isDisablingPaymentMethod: boolean;\n showRemovePaymentMethodButton: boolean;\n onDisableStoredPaymentMethod: (paymentMethod) => void;\n onSelect: (paymentMethod: UIElement) => void;\n standalone: boolean;\n className?: string;\n showRadioButton?: boolean;\n}\n\nclass PaymentMethodItem extends Component<PaymentMethodItemProps> {\n public static defaultProps = {\n paymentMethod: null,\n isSelected: false,\n isLoaded: false,\n isLoading: false,\n showDisableStoredPaymentMethodConfirmation: false,\n showRadioButton: false\n };\n\n public state = {\n showDisableStoredPaymentMethodConfirmation: false\n };\n\n public toggleDisableConfirmation = () => {\n this.setState({ showDisableStoredPaymentMethodConfirmation: !this.state.showDisableStoredPaymentMethodConfirmation });\n };\n\n public onDisableStoredPaymentMethod = () => {\n this.props.onDisableStoredPaymentMethod(this.props.paymentMethod);\n this.toggleDisableConfirmation();\n };\n\n private handleOnListItemClick = (): void => {\n const { onSelect, paymentMethod } = this.props;\n onSelect(paymentMethod);\n };\n\n // @ts-ignore need to refine the type for paymentMethod\n render({ paymentMethod, isSelected, isDisablingPaymentMethod, isLoaded, isLoading, standalone, showRadioButton }) {\n const { i18n } = useCoreContext();\n\n if (!paymentMethod) {\n return null;\n }\n\n const isCard = paymentMethod.props.type === 'card' || paymentMethod.props.type === 'scheme';\n\n const paymentMethodClassnames = classNames({\n 'adyen-checkout__payment-method': true,\n [`adyen-checkout__payment-method--${paymentMethod.props.type}`]: true,\n ...(isCard && { [`adyen-checkout__payment-method--${paymentMethod.props.fundingSource ?? 'credit'}`]: true }),\n 'adyen-checkout__payment-method--selected': isSelected,\n 'adyen-checkout__payment-method--loading': isLoading,\n 'adyen-checkout__payment-method--disabling': isDisablingPaymentMethod,\n 'adyen-checkout__payment-method--confirming': this.state.showDisableStoredPaymentMethodConfirmation,\n 'adyen-checkout__payment-method--standalone': standalone,\n [paymentMethod._id]: true,\n [this.props.className]: true\n });\n\n const showRemovePaymentMethodButton = this.props.showRemovePaymentMethodButton && paymentMethod.props.oneClick && isSelected;\n const disableConfirmationId = `remove-${paymentMethod._id}`;\n const containerId = `container-${paymentMethod._id}`;\n const buttonId = `button-${paymentMethod._id}`;\n\n const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div key={paymentMethod._id} className={paymentMethodClassnames} onClick={this.handleOnListItemClick}>\n <div className=\"adyen-checkout__payment-method__header\">\n <ExpandButton\n buttonId={buttonId}\n showRadioButton={showRadioButton}\n isSelected={isSelected}\n expandContentId={containerId}\n standalone={standalone}\n >\n <PaymentMethodIcon\n // Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)\n {...(paymentMethod.props.oneClick && { altDescription: paymentMethod.props.name })}\n type={paymentMethod.type}\n src={paymentMethod.icon}\n />\n\n <PaymentMethodName\n displayName={paymentMethod.displayName}\n isSelected={isSelected}\n additionalInfo={paymentMethod.additionalInfo}\n />\n </ExpandButton>\n\n {showRemovePaymentMethodButton && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={this.toggleDisableConfirmation}\n aria-expanded={this.state.showDisableStoredPaymentMethodConfirmation}\n aria-controls={disableConfirmationId}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n\n {showBrands && (\n <PaymentMethodBrands\n showOtherInsteafOfNumber={paymentMethod.props.showOtherInsteafOfNumber}\n keepBrandsVisible={paymentMethod.props.keepBrandsVisible}\n brands={paymentMethod.brands}\n excludedUIBrands={BRAND_ICON_UI_EXCLUSION_LIST}\n isPaymentMethodSelected={isSelected}\n />\n )}\n </div>\n\n <div className=\"adyen-checkout-pm-details-wrapper\" aria-hidden={!isSelected}>\n <div className=\"adyen-checkout__payment-method__details\" id={containerId}>\n {showRemovePaymentMethodButton && (\n <DisableOneClickConfirmation\n id={disableConfirmationId}\n open={this.state.showDisableStoredPaymentMethodConfirmation}\n onDisable={this.onDisableStoredPaymentMethod}\n onCancel={this.toggleDisableConfirmation}\n />\n )}\n\n <PaymentMethodDetails paymentMethodComponent={paymentMethod.render()} isLoaded={isLoaded} />\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default PaymentMethodItem;\n"],"names":["PaymentMethodItem","Component","render","paymentMethod","isSelected","isDisablingPaymentMethod","isLoaded","isLoading","standalone","showRadioButton","i18n","useCoreContext","isCard","props","type","paymentMethodClassnames","classNames","_object_spread_props","_object_spread","fundingSource","this","state","showDisableStoredPaymentMethodConfirmation","_id","className","showRemovePaymentMethodButton","oneClick","disableConfirmationId","containerId","buttonId","showBrands","brands","length","h","div","key","onClick","handleOnListItemClick","ExpandButton","expandContentId","PaymentMethodIcon","altDescription","name","src","icon","PaymentMethodName","displayName","additionalInfo","button","toggleDisableConfirmation","aria-expanded","aria-controls","get","PaymentMethodBrands","showOtherInsteafOfNumber","keepBrandsVisible","excludedUIBrands","BRAND_ICON_UI_EXCLUSION_LIST","isPaymentMethodSelected","aria-hidden","id","DisableOneClickConfirmation","open","onDisable","onDisableStoredPaymentMethod","onCancel","PaymentMethodDetails","paymentMethodComponent","super","args","_define_property","setState","onSelect","defaultProps"],"mappings":"m5CA2BA,MAAMA,UAA0BC,EA6B5BC,MAAAA,EAAOC,cAAEA,EAAaC,WAAEA,EAAUC,yBAAEA,EAAwBC,SAAEA,EAAQC,UAAEA,EAASC,WAAEA,EAAUC,gBAAEA,IAC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,EAACe,SAAAA,CACGlC,KAAK,SACLU,UAAU,qFACVY,QAAShB,KAAK6B,0BACdC,gBAAe9B,KAAKC,MAAMC,2CAC1B6B,gBAAexB,GAEdjB,EAAK0C,IAAI,uCAIjBtB,GACGG,EAACoB,EAAAA,CACGC,yBAA0BnD,EAAcU,MAAMyC,yBAC9CC,kBAAmBpD,EAAcU,MAAM0C,kBACvCxB,OAAQ5B,EAAc4B,OACtByB,iBAAkBC,EAClBC,wBAAyBtD,KAKrC6B,EAACC,MAAAA,CAAIV,UAAU,oCAAoCmC,eAAcvD,GAC7D6B,EAACC,MAAAA,CAAIV,UAAU,0CAA0CoC,GAAIhC,GACxDH,GACGQ,EAAC4B,EAAAA,CACGD,GAAIjC,EACJmC,KAAM1C,KAAKC,MAAMC,2CACjByC,UAAW3C,KAAK4C,6BAChBC,SAAU7C,KAAK6B,4BAIvBhB,EAACiC,EAAAA,CAAqBC,uBAAwBhE,EAAcD,SAAUI,SAAUA,MAKpG,mBA1HJ8D,SAAAC,GAUIC,OAAOjD,QAAQ,CACXC,4CAA4C,IAGhDgD,OAAOrB,6BAA4B,KAC/B7B,KAAKmD,SAAS,CAAEjD,4CAA6CF,KAAKC,MAAMC,4CAA2C,IAGvHgD,OAAON,gCAA+B,KAClC5C,KAAKP,MAAMmD,6BAA6B5C,KAAKP,MAAMV,eACnDiB,KAAK6B,2BAAyB,IAGlCqB,OAAQjC,yBAAwB,KAC5B,MAAMmC,SAAEA,EAAQrE,cAAEA,GAAkBiB,KAAKP,MACzC2D,EAASrE,EAAAA,KAxBbmE,EADEtE,EACYyE,eAAe,CACzBtE,cAAe,KACfC,YAAY,EACZE,UAAU,EACVC,WAAW,EACXe,4CAA4C,EAC5Cb,iBAAiB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"./PaymentMethodItem/PaymentMethodItem.js";import{useCoreContext as o}from"../../../../core/Context/CoreProvider.js";import{useMemo as a}from"../../../../external/preact/hooks/dist/hooks.js";import n from"../../../../utils/uuid.js";import s from"../../../../_virtual/index.js";function d({label:d,classNameModifiers:i=[],paymentMethods:m=[],activePaymentMethod:l=null,cachedPaymentMethods:r={},isLoading:c=!1,isDisablingPaymentMethod:h=!1,showRemovePaymentMethodButton:y,onDisableStoredPaymentMethod:p=()=>{},onSelect:u,showRadioButton:M}){const{i18n:_}=o(),P=a((()=>`select-${n()}`),[]),b=s(["adyen-checkout__payment-methods-list",{"adyen-checkout__payment-methods-list--loading":c},...i.map((e=>`adyen-checkout__payment-methods-list--${e}`))]);return e("div",{className:"adyen-checkout-payment-methods-container"},!!d&&e("label",{htmlFor:P,className:"adyen-checkout-payment-methods-list-label"},d),e("div",{id:P,className:b,role:"radiogroup","aria-label":_.get("paymentMethodsList.aria.label"),required:!0},m.map(((o,a,n)=>{const d=l&&l._id===o._id,i=o._id in r,_=l&&n[a+1]&&l._id===n[a+1]._id;return e(t,{className:s({"adyen-checkout__payment-method--next-selected":_}),standalone:1===m.length,paymentMethod:o,isSelected:d,isDisablingPaymentMethod:d&&h,isLoaded:i,isLoading:c,onSelect:u,key:o._id,showRemovePaymentMethodButton:y,showRadioButton:M,onDisableStoredPaymentMethod:p})}))))}export{d as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"./PaymentMethodItem/PaymentMethodItem.js";import{useCoreContext as o}from"../../../../core/Context/CoreProvider.js";import{useMemo as a}from"../../../../external/preact/hooks/dist/hooks.js";import d from"../../../../utils/uuid.js";import n from"../../../../_virtual/index.js";function s({label:s,classNameModifiers:i=[],paymentMethods:m=[],activePaymentMethod:l=null,cachedPaymentMethods:r={},isLoading:c=!1,isDisablingPaymentMethod:h=!1,showRemovePaymentMethodButton:y,onDisableStoredPaymentMethod:p=()=>{},onSelect:u,showRadioButton:M}){const{i18n:_}=o(),P=a((()=>`select-${d()}`),[]),b=n(["adyen-checkout__payment-methods-list",{"adyen-checkout__payment-methods-list--loading":c},...i.map((e=>`adyen-checkout__payment-methods-list--${e}`))]),f=1===m.length;return e("div",{className:"adyen-checkout-payment-methods-container"},!!s&&e("label",{htmlFor:P,className:"adyen-checkout-payment-methods-list-label"},s),e("div",{id:P,className:b,role:f?void 0:"radiogroup","aria-label":f?void 0:_.get("paymentMethodsList.aria.label"),required:!0},m.map(((o,a,d)=>{const s=l&&l._id===o._id,i=o._id in r,m=l&&d[a+1]&&l._id===d[a+1]._id;return e(t,{className:n({"adyen-checkout__payment-method--next-selected":m}),standalone:f,paymentMethod:o,isSelected:s,isDisablingPaymentMethod:s&&h,isLoaded:i,isLoading:c,onSelect:u,key:o._id,showRemovePaymentMethodButton:y,showRadioButton:M,onDisableStoredPaymentMethod:p})}))))}export{s as default};
2
2
  //# sourceMappingURL=PaymentMethodsContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentMethodsContainer.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodItem from './PaymentMethodItem/PaymentMethodItem';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { useMemo } from 'preact/hooks';\nimport uuid from '../../../../utils/uuid';\nimport classNames from 'classnames';\nimport UIElement from '../../../internal/UIElement';\n\nexport interface PaymentMethodsContainerProps {\n label?: string;\n classNameModifiers?: string[];\n paymentMethods: UIElement[];\n activePaymentMethod?: UIElement;\n /**\n * Map that keeps track of which Payment methods (UIElements) already got rendered in the UI\n */\n cachedPaymentMethods: Record<string, boolean>;\n showRemovePaymentMethodButton?: boolean;\n onSelect?: (paymentMethod: UIElement) => void;\n onDisableStoredPaymentMethod?: (storedPaymentMethod) => void;\n isDisablingPaymentMethod?: boolean;\n isLoading: boolean;\n showRadioButton?: boolean;\n}\n\nfunction PaymentMethodsContainer({\n label,\n classNameModifiers = [],\n paymentMethods = [],\n activePaymentMethod = null,\n cachedPaymentMethods = {},\n isLoading = false,\n isDisablingPaymentMethod = false,\n showRemovePaymentMethodButton,\n onDisableStoredPaymentMethod = () => {},\n onSelect,\n showRadioButton\n}: Readonly<PaymentMethodsContainerProps>) {\n const { i18n } = useCoreContext();\n const selectListId: string = useMemo(() => `select-${uuid()}`, []);\n const paymentMethodListClassnames = classNames([\n 'adyen-checkout__payment-methods-list',\n { 'adyen-checkout__payment-methods-list--loading': isLoading },\n ...classNameModifiers.map(m => `adyen-checkout__payment-methods-list--${m}`)\n ]);\n\n return (\n <div className=\"adyen-checkout-payment-methods-container\">\n {!!label && (\n <label htmlFor={selectListId} className=\"adyen-checkout-payment-methods-list-label\">\n {label}\n </label>\n )}\n <div\n id={selectListId}\n className={paymentMethodListClassnames}\n role=\"radiogroup\"\n aria-label={i18n.get('paymentMethodsList.aria.label')}\n required\n >\n {paymentMethods.map((paymentMethod, index, paymentMethodsCollection) => {\n const isSelected = activePaymentMethod && activePaymentMethod._id === paymentMethod._id;\n const isLoaded = paymentMethod._id in cachedPaymentMethods;\n const isNextOneSelected =\n activePaymentMethod &&\n paymentMethodsCollection[index + 1] &&\n activePaymentMethod._id === paymentMethodsCollection[index + 1]._id;\n\n return (\n <PaymentMethodItem\n className={classNames({ 'adyen-checkout__payment-method--next-selected': isNextOneSelected })}\n standalone={paymentMethods.length === 1}\n paymentMethod={paymentMethod}\n isSelected={isSelected}\n isDisablingPaymentMethod={isSelected && isDisablingPaymentMethod}\n isLoaded={isLoaded}\n isLoading={isLoading}\n onSelect={onSelect}\n key={paymentMethod._id}\n showRemovePaymentMethodButton={showRemovePaymentMethodButton}\n showRadioButton={showRadioButton}\n onDisableStoredPaymentMethod={onDisableStoredPaymentMethod}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nexport default PaymentMethodsContainer;\n"],"names":["PaymentMethodsContainer","label","classNameModifiers","paymentMethods","activePaymentMethod","cachedPaymentMethods","isLoading","isDisablingPaymentMethod","showRemovePaymentMethodButton","onDisableStoredPaymentMethod","onSelect","showRadioButton","i18n","useCoreContext","selectListId","useMemo","uuid","paymentMethodListClassnames","classNames","map","m","h","div","className","htmlFor","id","role","aria-label","get","required","paymentMethod","index","paymentMethodsCollection","isSelected","_id","isLoaded","isNextOneSelected","PaymentMethodItem","standalone","length","key"],"mappings":"6WAyBA,SAASA,GAAwBC,MAC7BA,EAAKC,mBACLA,EAAqB,GAAEC,eACvBA,EAAiB,GAAEC,oBACnBA,EAAsB,KAAIC,qBAC1BA,EAAuB,CAAA,EAAEC,UACzBA,GAAY,EAAKC,yBACjBA,GAA2B,EAAKC,8BAChCA,EAA6BC,6BAC7BA,EAA+B,OAAQC,SACvCA,EAAQC,gBACRA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAuBC,GAAQ,IAAM,UAAUC,OAAU,IACzDC,EAA8BC,EAAW,CAC3C,uCACA,CAAE,gDAAiDZ,MAChDJ,EAAmBiB,KAAIC,GAAK,yCAAyCA,QAG5E,OACIC,EAACC,MAAAA,CAAIC,UAAU,8CACRtB,GACCoB,EAACpB,QAAAA,CAAMuB,QAASV,EAAcS,UAAU,6CACnCtB,GAGToB,EAACC,MAAAA,CACGG,GAAIX,EACJS,UAAWN,EACXS,KAAK,aACLC,aAAYf,EAAKgB,IAAI,iCACrBC,UAAAA,GAEC1B,EAAegB,KAAI,CAACW,EAAeC,EAAOC,KACvC,MAAMC,EAAa7B,GAAuBA,EAAoB8B,MAAQJ,EAAcI,IAC9EC,EAAWL,EAAcI,OAAO7B,EAChC+B,EACFhC,GACA4B,EAAyBD,EAAQ,IACjC3B,EAAoB8B,MAAQF,EAAyBD,EAAQ,GAAGG,IAEpE,OACIb,EAACgB,EAAAA,CACGd,UAAWL,EAAW,CAAE,gDAAiDkB,IACzEE,WAAsC,IAA1BnC,EAAeoC,OAC3BT,cAAeA,EACfG,WAAYA,EACZ1B,yBAA0B0B,GAAc1B,EACxC4B,SAAUA,EACV7B,UAAWA,EACXI,SAAUA,EACV8B,IAAKV,EAAcI,IACnB1B,8BAA+BA,EAC/BG,gBAAiBA,EACjBF,6BAA8BA,QAO1D"}
1
+ {"version":3,"file":"PaymentMethodsContainer.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodItem from './PaymentMethodItem/PaymentMethodItem';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { useMemo } from 'preact/hooks';\nimport uuid from '../../../../utils/uuid';\nimport classNames from 'classnames';\nimport UIElement from '../../../internal/UIElement';\n\nexport interface PaymentMethodsContainerProps {\n label?: string;\n classNameModifiers?: string[];\n paymentMethods: UIElement[];\n activePaymentMethod?: UIElement;\n /**\n * Map that keeps track of which Payment methods (UIElements) already got rendered in the UI\n */\n cachedPaymentMethods: Record<string, boolean>;\n showRemovePaymentMethodButton?: boolean;\n onSelect?: (paymentMethod: UIElement) => void;\n onDisableStoredPaymentMethod?: (storedPaymentMethod) => void;\n isDisablingPaymentMethod?: boolean;\n isLoading: boolean;\n showRadioButton?: boolean;\n}\n\nfunction PaymentMethodsContainer({\n label,\n classNameModifiers = [],\n paymentMethods = [],\n activePaymentMethod = null,\n cachedPaymentMethods = {},\n isLoading = false,\n isDisablingPaymentMethod = false,\n showRemovePaymentMethodButton,\n onDisableStoredPaymentMethod = () => {},\n onSelect,\n showRadioButton\n}: Readonly<PaymentMethodsContainerProps>) {\n const { i18n } = useCoreContext();\n const selectListId: string = useMemo(() => `select-${uuid()}`, []);\n const paymentMethodListClassnames = classNames([\n 'adyen-checkout__payment-methods-list',\n { 'adyen-checkout__payment-methods-list--loading': isLoading },\n ...classNameModifiers.map(m => `adyen-checkout__payment-methods-list--${m}`)\n ]);\n\n const standalone = paymentMethods.length === 1;\n\n return (\n <div className=\"adyen-checkout-payment-methods-container\">\n {!!label && (\n <label htmlFor={selectListId} className=\"adyen-checkout-payment-methods-list-label\">\n {label}\n </label>\n )}\n <div\n id={selectListId}\n className={paymentMethodListClassnames}\n role={standalone ? undefined : 'radiogroup'}\n aria-label={standalone ? undefined : i18n.get('paymentMethodsList.aria.label')}\n required\n >\n {paymentMethods.map((paymentMethod, index, paymentMethodsCollection) => {\n const isSelected = activePaymentMethod && activePaymentMethod._id === paymentMethod._id;\n const isLoaded = paymentMethod._id in cachedPaymentMethods;\n const isNextOneSelected =\n activePaymentMethod &&\n paymentMethodsCollection[index + 1] &&\n activePaymentMethod._id === paymentMethodsCollection[index + 1]._id;\n\n return (\n <PaymentMethodItem\n className={classNames({ 'adyen-checkout__payment-method--next-selected': isNextOneSelected })}\n standalone={standalone}\n paymentMethod={paymentMethod}\n isSelected={isSelected}\n isDisablingPaymentMethod={isSelected && isDisablingPaymentMethod}\n isLoaded={isLoaded}\n isLoading={isLoading}\n onSelect={onSelect}\n key={paymentMethod._id}\n showRemovePaymentMethodButton={showRemovePaymentMethodButton}\n showRadioButton={showRadioButton}\n onDisableStoredPaymentMethod={onDisableStoredPaymentMethod}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nexport default PaymentMethodsContainer;\n"],"names":["PaymentMethodsContainer","label","classNameModifiers","paymentMethods","activePaymentMethod","cachedPaymentMethods","isLoading","isDisablingPaymentMethod","showRemovePaymentMethodButton","onDisableStoredPaymentMethod","onSelect","showRadioButton","i18n","useCoreContext","selectListId","useMemo","uuid","paymentMethodListClassnames","classNames","map","m","standalone","length","h","div","className","htmlFor","id","role","undefined","aria-label","get","required","paymentMethod","index","paymentMethodsCollection","isSelected","_id","isLoaded","isNextOneSelected","PaymentMethodItem","key"],"mappings":"6WAyBA,SAASA,GAAwBC,MAC7BA,EAAKC,mBACLA,EAAqB,GAAEC,eACvBA,EAAiB,GAAEC,oBACnBA,EAAsB,KAAIC,qBAC1BA,EAAuB,CAAA,EAAEC,UACzBA,GAAY,EAAKC,yBACjBA,GAA2B,EAAKC,8BAChCA,EAA6BC,6BAC7BA,EAA+B,OAAQC,SACvCA,EAAQC,gBACRA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAuBC,GAAQ,IAAM,UAAUC,OAAU,IACzDC,EAA8BC,EAAW,CAC3C,uCACA,CAAE,gDAAiDZ,MAChDJ,EAAmBiB,KAAIC,GAAK,yCAAyCA,QAGtEC,EAAuC,IAA1BlB,EAAemB,OAElC,OACIC,EAACC,MAAAA,CAAIC,UAAU,8CACRxB,GACCsB,EAACtB,QAAAA,CAAMyB,QAASZ,EAAcW,UAAU,6CACnCxB,GAGTsB,EAACC,MAAAA,CACGG,GAAIb,EACJW,UAAWR,EACXW,KAAMP,OAAaQ,EAAY,aAC/BC,aAAYT,OAAaQ,EAAYjB,EAAKmB,IAAI,iCAC9CC,UAAAA,GAEC7B,EAAegB,KAAI,CAACc,EAAeC,EAAOC,KACvC,MAAMC,EAAahC,GAAuBA,EAAoBiC,MAAQJ,EAAcI,IAC9EC,EAAWL,EAAcI,OAAOhC,EAChCkC,EACFnC,GACA+B,EAAyBD,EAAQ,IACjC9B,EAAoBiC,MAAQF,EAAyBD,EAAQ,GAAGG,IAEpE,OACId,EAACiB,EAAAA,CACGf,UAAWP,EAAW,CAAE,gDAAiDqB,IACzElB,WAAYA,EACZY,cAAeA,EACfG,WAAYA,EACZ7B,yBAA0B6B,GAAc7B,EACxC+B,SAAUA,EACVhC,UAAWA,EACXI,SAAUA,EACV+B,IAAKR,EAAcI,IACnB7B,8BAA+BA,EAC/BG,gBAAiBA,EACjBF,6BAA8BA,QAO1D"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as r,useCallback as a,useEffect as t}from"../../../../external/preact/hooks/dist/hooks.js";import{vpaValidationRules as s}from"./validate.js";import l from"../../../internal/FormFields/InputText.js";import{useCoreContext as i}from"../../../../core/Context/CoreProvider.js";import o from"../../../../utils/useForm/useForm.js";import d from"../../../internal/FormFields/Field/Field.js";const n=n=>{const{i18n:u}=i(),{handleChangeFor:m,triggerValidation:p,data:c,valid:f,errors:v,isValid:F}=o({schema:["virtualPaymentAddress"],defaultData:n.data,rules:s}),P=r({validateInput:null}),h=a((()=>{p()}),[p]);return t((()=>{P.current.validateInput=h,n.onSetInputHandlers(P.current)}),[h,n.onSetInputHandlers]),t((()=>{n.onChange({data:c,valid:f,errors:v,isValid:F})}),[c,f,v,F]),e(d,{label:u.get("upi.collect.field.label"),errorMessage:!!v.virtualPaymentAddress,classNameModifiers:["vpa"],name:"virtualPaymentAddress"},e(l,{name:"virtualPaymentAddress",autocorrect:"off",spellcheck:!1,disabled:n.disabled,value:c.virtualPaymentAddress,onInput:m("virtualPaymentAddress","input"),onBlur:m("virtualPaymentAddress","blur")}))};export{n as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as a,useCallback as r,useEffect as t}from"../../../../external/preact/hooks/dist/hooks.js";import{vpaValidationRules as s}from"./validate.js";import l from"../../../internal/FormFields/InputText.js";import{useCoreContext as d}from"../../../../core/Context/CoreProvider.js";import i from"../../../../utils/useForm/useForm.js";import n from"../../../internal/FormFields/Field/Field.js";const o=o=>{const{i18n:u}=d(),{handleChangeFor:m,triggerValidation:p,data:c,valid:f,errors:v,isValid:F}=i({schema:["virtualPaymentAddress"],defaultData:o.data,rules:s}),y=a({validateInput:null}),P=r((()=>{p()}),[p]);return t((()=>{y.current.validateInput=P,o.onSetInputHandlers(y.current)}),[P,o.onSetInputHandlers]),t((()=>{o.onChange({data:c,valid:f,errors:v,isValid:F})}),[c,f,v,F]),e(n,{label:u.get("upi.collect.field.label"),errorMessage:!!v.virtualPaymentAddress,classNameModifiers:["vpa"],name:"virtualPaymentAddress"},e(l,{name:"virtualPaymentAddress",autocorrect:"off",spellcheck:!1,disabled:o.disabled,value:c.virtualPaymentAddress,onInput:m("virtualPaymentAddress","input"),onBlur:m("virtualPaymentAddress","blur"),"data-testid":"input-virtual-payment-address"}))};export{o as default};
2
2
  //# sourceMappingURL=VpaInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VpaInput.js","sources":["../../../../../../src/components/UPI/components/VpaInput/VpaInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef } from 'preact/hooks';\nimport { vpaValidationRules } from './validate';\nimport './VpaInput.scss';\nimport InputText from '../../../internal/FormFields/InputText';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useForm from '../../../../utils/useForm';\nimport Field from '../../../internal/FormFields/Field';\n\nexport type OnChangeProps = { data: VpaInputDataState; valid; errors; isValid: boolean };\n\ninterface VpaInputProps {\n data?: {};\n disabled?: boolean;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: VpaInputHandlers): void;\n}\n\nexport interface VpaInputDataState {\n virtualPaymentAddress?: string;\n}\n\nexport type VpaInputHandlers = {\n validateInput(): void;\n};\n\nconst VpaInput = (props: VpaInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['virtualPaymentAddress'];\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<VpaInputDataState>({\n schema: formSchema,\n defaultData: props.data,\n rules: vpaValidationRules\n });\n const vpaInputHandlersRef = useRef<VpaInputHandlers>({ validateInput: null });\n\n const validateInput = useCallback(() => {\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n vpaInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(vpaInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n return (\n <Field\n label={i18n.get('upi.collect.field.label')}\n errorMessage={!!errors.virtualPaymentAddress}\n classNameModifiers={['vpa']}\n name=\"virtualPaymentAddress\"\n >\n <InputText\n name={'virtualPaymentAddress'}\n autocorrect={'off'}\n spellcheck={false}\n disabled={props.disabled}\n value={data.virtualPaymentAddress}\n onInput={handleChangeFor('virtualPaymentAddress', 'input')}\n onBlur={handleChangeFor('virtualPaymentAddress', 'blur')}\n />\n </Field>\n );\n};\n\nexport default VpaInput;\n"],"names":["VpaInput","props","i18n","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","defaultData","rules","vpaValidationRules","vpaInputHandlersRef","useRef","validateInput","useCallback","useEffect","current","onSetInputHandlers","onChange","h","Field","label","get","errorMessage","virtualPaymentAddress","classNameModifiers","name","InputText","autocorrect","spellcheck","disabled","value","onInput","onBlur"],"mappings":"ydA0BA,MAAMA,EAAYC,IACd,MAAMC,KAAEA,GAASC,KAEXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA2B,CACpGC,OAFe,CAAC,yBAGhBC,YAAaX,EAAMK,KACnBO,MAAOC,IAELC,EAAsBC,EAAyB,CAAEC,cAAe,OAEhEA,EAAgBC,GAAY,KAC9Bb,GAAAA,GACD,CAACA,IAWJ,OATAc,GAAU,KACNJ,EAAoBK,QAAQH,cAAgBA,EAC5ChB,EAAMoB,mBAAmBN,EAAoBK,QAAO,GACrD,CAACH,EAAehB,EAAMoB,qBAEzBF,GAAU,KACNlB,EAAMqB,SAAS,CAAEhB,OAAMC,QAAOC,SAAQC,WAAQ,GAC/C,CAACH,EAAMC,EAAOC,EAAQC,IAGrBc,EAACC,EAAAA,CACGC,MAAOvB,EAAKwB,IAAI,2BAChBC,eAAgBnB,EAAOoB,sBACvBC,mBAAoB,CAAC,OACrBC,KAAK,yBAELP,EAACQ,EAAAA,CACGD,KAAM,wBACNE,YAAa,MACbC,YAAY,EACZC,SAAUjC,EAAMiC,SAChBC,MAAO7B,EAAKsB,sBACZQ,QAAShC,EAAgB,wBAAyB,SAClDiC,OAAQjC,EAAgB,wBAAyB"}
1
+ {"version":3,"file":"VpaInput.js","sources":["../../../../../../src/components/UPI/components/VpaInput/VpaInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef } from 'preact/hooks';\nimport { vpaValidationRules } from './validate';\nimport './VpaInput.scss';\nimport InputText from '../../../internal/FormFields/InputText';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useForm from '../../../../utils/useForm';\nimport Field from '../../../internal/FormFields/Field';\n\nexport type OnChangeProps = { data: VpaInputDataState; valid; errors; isValid: boolean };\n\ninterface VpaInputProps {\n data?: {};\n disabled?: boolean;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: VpaInputHandlers): void;\n}\n\nexport interface VpaInputDataState {\n virtualPaymentAddress?: string;\n}\n\nexport type VpaInputHandlers = {\n validateInput(): void;\n};\n\nconst VpaInput = (props: VpaInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['virtualPaymentAddress'];\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<VpaInputDataState>({\n schema: formSchema,\n defaultData: props.data,\n rules: vpaValidationRules\n });\n const vpaInputHandlersRef = useRef<VpaInputHandlers>({ validateInput: null });\n\n const validateInput = useCallback(() => {\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n vpaInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(vpaInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n return (\n <Field\n label={i18n.get('upi.collect.field.label')}\n errorMessage={!!errors.virtualPaymentAddress}\n classNameModifiers={['vpa']}\n name=\"virtualPaymentAddress\"\n >\n <InputText\n name={'virtualPaymentAddress'}\n autocorrect={'off'}\n spellcheck={false}\n disabled={props.disabled}\n value={data.virtualPaymentAddress}\n onInput={handleChangeFor('virtualPaymentAddress', 'input')}\n onBlur={handleChangeFor('virtualPaymentAddress', 'blur')}\n data-testid={'input-virtual-payment-address'}\n />\n </Field>\n );\n};\n\nexport default VpaInput;\n"],"names":["VpaInput","props","i18n","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","defaultData","rules","vpaValidationRules","vpaInputHandlersRef","useRef","validateInput","useCallback","useEffect","current","onSetInputHandlers","onChange","h","Field","label","get","errorMessage","virtualPaymentAddress","classNameModifiers","name","InputText","autocorrect","spellcheck","disabled","value","onInput","onBlur","data-testid"],"mappings":"ydA0BA,MAAMA,EAAYC,IACd,MAAMC,KAAEA,GAASC,KAEXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA2B,CACpGC,OAFe,CAAC,yBAGhBC,YAAaX,EAAMK,KACnBO,MAAOC,IAELC,EAAsBC,EAAyB,CAAEC,cAAe,OAEhEA,EAAgBC,GAAY,KAC9Bb,GAAAA,GACD,CAACA,IAWJ,OATAc,GAAU,KACNJ,EAAoBK,QAAQH,cAAgBA,EAC5ChB,EAAMoB,mBAAmBN,EAAoBK,QAAO,GACrD,CAACH,EAAehB,EAAMoB,qBAEzBF,GAAU,KACNlB,EAAMqB,SAAS,CAAEhB,OAAMC,QAAOC,SAAQC,WAAQ,GAC/C,CAACH,EAAMC,EAAOC,EAAQC,IAGrBc,EAACC,EAAAA,CACGC,MAAOvB,EAAKwB,IAAI,2BAChBC,eAAgBnB,EAAOoB,sBACvBC,mBAAoB,CAAC,OACrBC,KAAK,yBAELP,EAACQ,EAAAA,CACGD,KAAM,wBACNE,YAAa,MACbC,YAAY,EACZC,SAAUjC,EAAMiC,SAChBC,MAAO7B,EAAKsB,sBACZQ,QAAShC,EAAgB,wBAAyB,SAClDiC,OAAQjC,EAAgB,wBAAyB,QACjDkC,cAAa"}
@@ -1,2 +1,2 @@
1
- import e from"../../../_virtual/index.js";import{createElement as t}from"../../../external/preact/dist/preact.js";function a({buttonId:a,showRadioButton:o,isSelected:d,expandContentId:n,children:r,classNameModifiers:c=[]}){return t("button",{className:e("adyen-checkout__payment-method__header__title",...c.map((e=>`adyen-checkout-expand-button--${e}`))),id:a,role:"radio","aria-checked":d,"aria-controls":n,type:"button"},o&&t("span",{className:e({"adyen-checkout__payment-method__radio":!0,"adyen-checkout__payment-method__radio--selected":d}),"aria-hidden":"true"}),r)}export{a as default};
1
+ import e from"../../../_virtual/index.js";import{createElement as t}from"../../../external/preact/dist/preact.js";function a({buttonId:a,showRadioButton:d,isSelected:n,expandContentId:o,children:_,classNameModifiers:c=[],standalone:r=!1}){return r?t("div",{className:e("adyen-checkout__payment-method__header__title","adyen-checkout__payment-method__header__title--standalone")},_):t("button",{className:e("adyen-checkout__payment-method__header__title",...c.map((e=>`adyen-checkout-expand-button--${e}`))),id:a,role:"radio","aria-checked":n,"aria-controls":o,type:"button"},d&&t("span",{className:e({"adyen-checkout__payment-method__radio":!0,"adyen-checkout__payment-method__radio--selected":n}),"aria-hidden":"true"}),_)}export{a as default};
2
2
  //# sourceMappingURL=ExpandButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandButton.js","sources":["../../../../../src/components/internal/ExpandButton/ExpandButton.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ComponentChildren, h } from 'preact';\nimport './ExpandButton.scss';\n\ninterface ExpandButton {\n buttonId: string;\n isSelected: boolean;\n expandContentId: string;\n children?: ComponentChildren;\n showRadioButton?: boolean;\n classNameModifiers?: string[];\n}\n\nfunction ExpandButton({ buttonId, showRadioButton, isSelected, expandContentId, children, classNameModifiers = [] }: Readonly<ExpandButton>) {\n return (\n // See discussion: https://github.com/w3c/aria/issues/1404\n // this has been disabled as we got quite a few complains\n // mainly from merchants running automated systems\n <button\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n ...classNameModifiers.map(modifier => `adyen-checkout-expand-button--${modifier}`)\n )}\n id={buttonId}\n role={'radio'}\n aria-checked={isSelected}\n //aria-expanded={isSelected} - disabled for now\n aria-controls={expandContentId}\n type=\"button\"\n >\n {showRadioButton && (\n <span\n className={classNames({\n 'adyen-checkout__payment-method__radio': true,\n 'adyen-checkout__payment-method__radio--selected': isSelected\n })}\n aria-hidden=\"true\"\n />\n )}\n {children}\n </button>\n );\n}\n\nexport default ExpandButton;\n"],"names":["ExpandButton","buttonId","showRadioButton","isSelected","expandContentId","children","classNameModifiers","h","button","className","classNames","map","modifier","id","role","aria-checked","aria-controls","type","span","aria-hidden"],"mappings":"kHAaA,SAASA,GAAaC,SAAEA,EAAQC,gBAAEA,EAAeC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,mBAAEA,EAAqB,KAC3G,OAIIC,EAACC,SAAAA,CACGC,UAAWC,EACP,mDACGJ,EAAmBK,KAAIC,GAAY,iCAAiCA,OAE3EC,GAAIZ,EACJa,KAAM,QACNC,eAAcZ,EAEda,gBAAeZ,EACfa,KAAK,UAEJf,GACGK,EAACW,OAAAA,CACGT,UAAWC,EAAW,CAClB,yCAAyC,EACzC,kDAAmDP,IAEvDgB,cAAY,SAGnBd,EAGb"}
1
+ {"version":3,"file":"ExpandButton.js","sources":["../../../../../src/components/internal/ExpandButton/ExpandButton.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ComponentChildren, h } from 'preact';\nimport './ExpandButton.scss';\n\ninterface ExpandButton {\n buttonId: string;\n isSelected: boolean;\n expandContentId: string;\n children?: ComponentChildren;\n showRadioButton?: boolean;\n classNameModifiers?: string[];\n standalone?: boolean;\n}\n\nfunction ExpandButton({\n buttonId,\n showRadioButton,\n isSelected,\n expandContentId,\n children,\n classNameModifiers = [],\n standalone = false\n}: Readonly<ExpandButton>) {\n // If we only have a single payment method we should use a div instead of toggable button\n if (standalone) {\n return (\n <div className={classNames('adyen-checkout__payment-method__header__title', 'adyen-checkout__payment-method__header__title--standalone')}>\n {children}\n </div>\n );\n }\n\n return (\n // See discussion: https://github.com/w3c/aria/issues/1404\n // this has been disabled as we got quite a few complains\n // mainly from merchants running automated systems\n <button\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n ...classNameModifiers.map(modifier => `adyen-checkout-expand-button--${modifier}`)\n )}\n id={buttonId}\n role={'radio'}\n aria-checked={isSelected}\n //aria-expanded={isSelected} - disabled for now\n aria-controls={expandContentId}\n type=\"button\"\n >\n {showRadioButton && (\n <span\n className={classNames({\n 'adyen-checkout__payment-method__radio': true,\n 'adyen-checkout__payment-method__radio--selected': isSelected\n })}\n aria-hidden=\"true\"\n />\n )}\n {children}\n </button>\n );\n}\n\nexport default ExpandButton;\n"],"names":["ExpandButton","buttonId","showRadioButton","isSelected","expandContentId","children","classNameModifiers","standalone","h","div","className","classNames","button","map","modifier","id","role","aria-checked","aria-controls","type","span","aria-hidden"],"mappings":"kHAcA,SAASA,GAAaC,SAClBA,EAAQC,gBACRA,EAAeC,WACfA,EAAUC,gBACVA,EAAeC,SACfA,EAAQC,mBACRA,EAAqB,GAAEC,WACvBA,GAAa,IAGb,OAAIA,EAEIC,EAACC,MAAAA,CAAIC,UAAWC,EAAW,gDAAiD,8DACvEN,GASTG,EAACI,SAAAA,CACGF,UAAWC,EACP,mDACGL,EAAmBO,KAAIC,GAAY,iCAAiCA,OAE3EC,GAAId,EACJe,KAAM,QACNC,eAAcd,EAEde,gBAAed,EACfe,KAAK,UAEJjB,GACGM,EAACY,OAAAA,CACGV,UAAWC,EAAW,CAClB,yCAAyC,EACzC,kDAAmDR,IAEvDkB,cAAY,SAGnBhB,EAGb"}
@@ -1 +1 @@
1
- {"version":3,"file":"Fieldset.js","sources":["../../../../../../src/components/internal/FormFields/Fieldset/Fieldset.tsx"],"sourcesContent":["import { h, ComponentChildren } from 'preact';\nimport cx from 'classnames';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport './Fieldset.scss';\nimport { getUniqueId } from '../../../../utils/idGenerator';\n\ninterface FieldsetProps {\n children: ComponentChildren;\n classNameModifiers: string[];\n label?: string;\n description?: string;\n readonly?: boolean;\n}\n\nexport default function Fieldset({ children, classNameModifiers = [], label, readonly = false, description }: FieldsetProps) {\n const { i18n } = useCoreContext();\n\n const describedById = getUniqueId('payid-input-description');\n\n return (\n <fieldset\n className={cx([\n 'adyen-checkout__fieldset',\n ...classNameModifiers.map(m => `adyen-checkout__fieldset--${m}`),\n { 'adyen-checkout__fieldset--readonly': readonly }\n ])}\n aria-describedby={description ? describedById : null}\n >\n {label && <legend className=\"adyen-checkout__fieldset__title\">{i18n.get(label)}</legend>}\n {description && (\n <p id={describedById} className=\"adyen-checkout__fieldset__description\">\n {i18n.get(description)}\n </p>\n )}\n <div className=\"adyen-checkout__fieldset__fields\">{children}</div>\n </fieldset>\n );\n}\n"],"names":["Fieldset","children","classNameModifiers","label","readonly","description","i18n","useCoreContext","describedById","getUniqueId","h","fieldset","className","cx","map","m","aria-describedby","legend","get","p","id","div"],"mappings":"iQAce,SAASA,GAASC,SAAEA,EAAQC,mBAAEA,EAAqB,GAAEC,MAAEA,EAAKC,SAAEA,GAAW,EAAKC,YAAEA,IAC3F,MAAMC,KAAEA,GAASC,IAEXC,EAAgBC,EAAY,2BAElC,OACIC,EAACC,WAAAA,CACGC,UAAWC,EAAG,CACV,8BACGX,EAAmBY,KAAIC,GAAK,6BAA6BA,MAC5D,CAAE,qCAAsCX,KAE5CY,mBAAkBX,EAAcG,EAAgB,MAE/CL,GAASO,EAACO,SAAAA,CAAOL,UAAU,mCAAmCN,EAAKY,IAAIf,IACvEE,GACGK,EAACS,IAAAA,CAAEC,GAAIZ,EAAeI,UAAU,yCAC3BN,EAAKY,IAAIb,IAGlBK,EAACW,MAAAA,CAAIT,UAAU,oCAAoCX,GAG/D"}
1
+ {"version":3,"file":"Fieldset.js","sources":["../../../../../../src/components/internal/FormFields/Fieldset/Fieldset.tsx"],"sourcesContent":["import { h, ComponentChildren } from 'preact';\nimport cx from 'classnames';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport './Fieldset.scss';\nimport { getUniqueId } from '../../../../utils/idGenerator';\n\ninterface FieldsetProps {\n children: ComponentChildren;\n classNameModifiers?: string[];\n label?: string;\n description?: string;\n readonly?: boolean;\n}\n\nexport default function Fieldset({ children, classNameModifiers = [], label, readonly = false, description }: FieldsetProps) {\n const { i18n } = useCoreContext();\n\n const describedById = getUniqueId('payid-input-description');\n\n return (\n <fieldset\n className={cx([\n 'adyen-checkout__fieldset',\n ...classNameModifiers.map(m => `adyen-checkout__fieldset--${m}`),\n { 'adyen-checkout__fieldset--readonly': readonly }\n ])}\n aria-describedby={description ? describedById : null}\n >\n {label && <legend className=\"adyen-checkout__fieldset__title\">{i18n.get(label)}</legend>}\n {description && (\n <p id={describedById} className=\"adyen-checkout__fieldset__description\">\n {i18n.get(description)}\n </p>\n )}\n <div className=\"adyen-checkout__fieldset__fields\">{children}</div>\n </fieldset>\n );\n}\n"],"names":["Fieldset","children","classNameModifiers","label","readonly","description","i18n","useCoreContext","describedById","getUniqueId","h","fieldset","className","cx","map","m","aria-describedby","legend","get","p","id","div"],"mappings":"iQAce,SAASA,GAASC,SAAEA,EAAQC,mBAAEA,EAAqB,GAAEC,MAAEA,EAAKC,SAAEA,GAAW,EAAKC,YAAEA,IAC3F,MAAMC,KAAEA,GAASC,IAEXC,EAAgBC,EAAY,2BAElC,OACIC,EAACC,WAAAA,CACGC,UAAWC,EAAG,CACV,8BACGX,EAAmBY,KAAIC,GAAK,6BAA6BA,MAC5D,CAAE,qCAAsCX,KAE5CY,mBAAkBX,EAAcG,EAAgB,MAE/CL,GAASO,EAACO,SAAAA,CAAOL,UAAU,mCAAmCN,EAAKY,IAAIf,IACvEE,GACGK,EAACS,IAAAA,CAAEC,GAAIZ,EAAeI,UAAU,yCAC3BN,EAAKY,IAAIb,IAGlBK,EAACW,MAAAA,CAAIT,UAAU,oCAAoCX,GAG/D"}
@@ -0,0 +1,2 @@
1
+ import{createElement as a}from"../../../../external/preact/dist/preact.js";import{useState as t}from"../../../../external/preact/hooks/dist/hooks.js";import e from"../../../../_virtual/index.js";const o=({dataValue:o,imageURL:n,altName:r,showRadioIcon:c})=>{const[i,s]=t(!1),d=e({"adyen-checkout__input-icon":!0,"adyen-checkout__input-icon--hidden":!i,"adyen-checkout__input-icon--no-radio-icon":!c});return a("img",{className:d,onError:()=>{s(!1)},onLoad:()=>{s(!0)},alt:r,src:n,"data-value":o})};export{o as default};
2
+ //# sourceMappingURL=RadioButtonIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioButtonIcon.js","sources":["../../../../../../src/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { RadioButtonIconProps } from './types';\nimport './RadioButtonIcon.scss';\n\nconst RadioButtonIcon = ({ dataValue, imageURL, altName, showRadioIcon }: RadioButtonIconProps) => {\n const [hasLoaded, setHasLoaded] = useState(false);\n\n const handleError = () => {\n setHasLoaded(false);\n };\n\n const handleLoad = () => {\n setHasLoaded(true);\n };\n\n const fieldClassnames = classNames({\n 'adyen-checkout__input-icon': true,\n 'adyen-checkout__input-icon--hidden': !hasLoaded,\n 'adyen-checkout__input-icon--no-radio-icon': !showRadioIcon\n });\n\n return <img className={fieldClassnames} onError={handleError} onLoad={handleLoad} alt={altName} src={imageURL} data-value={dataValue} />;\n};\n\nexport default RadioButtonIcon;\n"],"names":["RadioButtonIcon","dataValue","imageURL","altName","showRadioIcon","hasLoaded","setHasLoaded","useState","fieldClassnames","classNames","h","img","className","onError","onLoad","alt","src","data-value"],"mappings":"mMAMMA,MAAAA,EAAkB,EAAGC,YAAWC,WAAUC,UAASC,oBACrD,MAAOC,EAAWC,GAAgBC,GAAS,GAUrCC,EAAkBC,EAAW,CAC/B,8BAA8B,EAC9B,sCAAuCJ,EACvC,6CAA8CD,IAGlD,OAAOM,EAACC,MAAAA,CAAIC,UAAWJ,EAAiBK,QAdpB,KAChBP,GAAa,EAAA,EAa6CQ,OAV3C,KACfR,GAAa,EAAA,EASiES,IAAKZ,EAASa,IAAKd,EAAUe,aAAYhB"}
@@ -0,0 +1,2 @@
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import a from"../../../../_virtual/index.js";import{getUniqueId as o}from"../../../../utils/idGenerator.js";import{useCoreContext as t}from"../../../../core/Context/CoreProvider.js";import n from"./RadioButtonIcon.js";import r from"../../Icon/Icon.js";import{PREFIX as i}from"../../Icon/constants.js";function c(e,a,o){return a in e?Object.defineProperty(e,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[a]=o,e}function l(l){const{items:d,name:u,onChange:_,value:s,isInvalid:p,uniqueId:m,ariaLabel:y,showRadioIcon:g=!1,showSelectedTick:h=!1,style:f="button"}=l,{i18n:b}=t(),k=null==m?void 0:m.replace(/[0-9]/g,"").substring(0,m.lastIndexOf("-"));let v="";p&&(v=g?"adyen-checkout__radio_group__label--invalid":"adyen-checkout__radio_group__label--no-radio--invalid");const j=a(["adyen-checkout__label__text",g?"adyen-checkout__radio_group__label":"adyen-checkout__radio_group__label--no-radio",l.className,v]);return e("div",function(e){for(var a=1;a<arguments.length;a++){var o=null!=arguments[a]?arguments[a]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),t.forEach((function(a){c(e,a,o[a])}))}return e}({className:a(["adyen-checkout__radio_group",`adyen-checkout__radio_group--${f}`]),role:"radiogroup"},y&&{"aria-label":y}),d.map((t=>{const c=o(k);return e("div",{key:t.id,className:"adyen-checkout__radio_group__input-wrapper adyen-checkout__field--50"},e("input",{id:c,type:"radio",checked:s===t.id,className:"adyen-checkout__radio_group__input",name:u,onChange:_,value:t.id}),e("label",{className:j,htmlFor:c},e("div",{className:"adyen-checkout__radio_group-extended__label-wrapper"},e(n,{key:t.id,imageURL:t.imageURL,altName:t.altName,dataValue:t.id,showRadioIcon:g}),e("span",{className:"adyen-checkout__radio_group-extended__label"},b.get(t.name)),h&&e("span",{className:a({"adyen-checkout-input__inline-validation":!0,"adyen-checkout-input__inline-validation--valid":s===t.id})},e(r,{type:`${i}checkmark`,alt:null==b?void 0:b.get("field.valid")})))))})))}l.defaultProps={onChange:()=>{},items:[]};export{l as default};
2
+ //# sourceMappingURL=RadioGroupExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroupExtended.js","sources":["../../../../../../src/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport { RadioGroupExtendedProps } from './types';\nimport { getUniqueId } from '../../../../utils/idGenerator';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport RadioButtonIcon from './RadioButtonIcon';\nimport Icon from '../../Icon';\nimport { PREFIX } from '../../Icon/constants';\nimport './RadioGroupExtended.scss';\nimport '../RadioGroup/RadioGroup.scss';\n\nexport default function RadioGroupExtended(props: RadioGroupExtendedProps) {\n const { items, name, onChange, value, isInvalid, uniqueId, ariaLabel, showRadioIcon = false, showSelectedTick = false, style = 'button' } = props;\n\n const { i18n } = useCoreContext();\n const uniqueIdBase = uniqueId?.replace(/[0-9]/g, '').substring(0, uniqueId.lastIndexOf('-'));\n\n let invalidClassName = '';\n if (isInvalid) {\n invalidClassName = showRadioIcon ? 'adyen-checkout__radio_group__label--invalid' : 'adyen-checkout__radio_group__label--no-radio--invalid';\n }\n\n const fieldClassnames = cx([\n 'adyen-checkout__label__text',\n showRadioIcon ? 'adyen-checkout__radio_group__label' : 'adyen-checkout__radio_group__label--no-radio',\n props.className,\n invalidClassName\n ]);\n\n return (\n <div\n className={cx(['adyen-checkout__radio_group', `adyen-checkout__radio_group--${style}`])}\n role={'radiogroup'}\n {...(ariaLabel && { ['aria-label']: ariaLabel })}\n >\n {items.map(item => {\n const uniqueId = getUniqueId(uniqueIdBase);\n\n return (\n <div key={item.id} className=\"adyen-checkout__radio_group__input-wrapper adyen-checkout__field--50\">\n <input\n id={uniqueId}\n type={'radio'}\n checked={value === item.id}\n className=\"adyen-checkout__radio_group__input\"\n name={name}\n onChange={onChange}\n value={item.id}\n />\n {/*eslint-disable-next-line jsx-a11y/label-has-associated-control*/}\n <label className={fieldClassnames} htmlFor={uniqueId}>\n <div className={'adyen-checkout__radio_group-extended__label-wrapper'}>\n <RadioButtonIcon\n key={item.id}\n imageURL={item.imageURL}\n altName={item.altName}\n dataValue={item.id}\n showRadioIcon={showRadioIcon}\n />\n <span className={'adyen-checkout__radio_group-extended__label'}>{i18n.get(item.name)}</span>\n {showSelectedTick && (\n <span\n className={cx({\n 'adyen-checkout-input__inline-validation': true,\n 'adyen-checkout-input__inline-validation--valid': value === item.id\n })}\n >\n <Icon type={`${PREFIX}checkmark`} alt={i18n?.get('field.valid')} />\n </span>\n )}\n </div>\n </label>\n </div>\n );\n })}\n </div>\n );\n}\n\nRadioGroupExtended.defaultProps = {\n onChange: () => {},\n items: []\n};\n"],"names":["RadioGroupExtended","props","items","name","onChange","value","isInvalid","uniqueId","ariaLabel","showRadioIcon","showSelectedTick","style","i18n","useCoreContext","uniqueIdBase","replace","substring","lastIndexOf","invalidClassName","fieldClassnames","cx","className","h","div","role","map","item","getUniqueId","key","id","input","type","checked","label","htmlFor","RadioButtonIcon","imageURL","altName","dataValue","span","get","Icon","PREFIX","alt","defaultProps"],"mappings":"gfAWe,SAASA,EAAmBC,GACvC,MAAMC,MAAEA,EAAKC,KAAEA,EAAIC,SAAEA,EAAQC,MAAEA,EAAKC,UAAEA,EAASC,SAAEA,EAAQC,UAAEA,EAASC,cAAEA,GAAgB,EAAKC,iBAAEA,GAAmB,EAAKC,MAAEA,EAAQ,UAAaV,GAEtIW,KAAEA,GAASC,IACXC,EAAeP,aAAAA,EAAAA,EAAUQ,QAAQ,SAAU,IAAIC,UAAU,EAAGT,EAASU,YAAY,MAEvF,IAAIC,EAAmB,GACnBZ,IACAY,EAAmBT,EAAgB,8CAAgD,yDAGvF,MAAMU,EAAkBC,EAAG,CACvB,8BACAX,EAAgB,qCAAuC,+CACvDR,EAAMoB,UACNH,IAGJ,OACII,EAACC,4UAAAA,CAAAA,CACGF,UAAWD,EAAG,CAAC,8BAA+B,gCAAgCT,MAC9Ea,KAAM,cACDhB,GAAa,CAAE,aAAgBA,IAEnCN,EAAMuB,KAAIC,IACP,MAAMnB,EAAWoB,EAAYb,GAE7B,OACIQ,EAACC,MAAAA,CAAIK,IAAKF,EAAKG,GAAIR,UAAU,wEACzBC,EAACQ,QAAAA,CACGD,GAAItB,EACJwB,KAAM,QACNC,QAAS3B,IAAUqB,EAAKG,GACxBR,UAAU,qCACVlB,KAAMA,EACNC,SAAUA,EACVC,MAAOqB,EAAKG,KAGhBP,EAACW,QAAAA,CAAMZ,UAAWF,EAAiBe,QAAS3B,GACxCe,EAACC,MAAAA,CAAIF,UAAW,uDACZC,EAACa,EAAAA,CACGP,IAAKF,EAAKG,GACVO,SAAUV,EAAKU,SACfC,QAASX,EAAKW,QACdC,UAAWZ,EAAKG,GAChBpB,cAAeA,IAEnBa,EAACiB,OAAAA,CAAKlB,UAAW,+CAAgDT,EAAK4B,IAAId,EAAKvB,OAC9EO,GACGY,EAACiB,OAAAA,CACGlB,UAAWD,EAAG,CACV,2CAA2C,EAC3C,iDAAkDf,IAAUqB,EAAKG,MAGrEP,EAACmB,EAAAA,CAAKV,KAAM,GAAGW,aAAmBC,IAAK/B,aAAAA,EAAAA,EAAM4B,IAAI,wBAUzF,CAEAxC,EAAmB4C,aAAe,CAC9BxC,SAAU,OACVF,MAAO"}
@@ -1,2 +1,2 @@
1
- function e(e){const[d,a]=e;return{dualBrandSelectElements:[{id:d.brand,brandObject:d},{id:a.brand,brandObject:a}],selectedBrandValue:"",leadBrand:d}}export{e as default};
1
+ function d(d){const[e,a]=d;return{dualBrandSelectElements:[{id:e.brand,brandObject:e},{id:a.brand,brandObject:a}],selectedBrandValue:e.brand,leadBrand:e}}export{d as default};
2
2
  //# sourceMappingURL=createCardVariantSwitcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createCardVariantSwitcher.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/createCardVariantSwitcher.ts"],"sourcesContent":["import { BrandObject, DualBrandSelectElement } from '../../../Card/types';\n\n/**\n * Creates an object used for setting state - that will trigger the rendering of a select element to allow a choice between 2 different card variants\n * @param brandObjArr - array containing 2 card brands objects\n */\nexport default function createCardVariantSwitcher(brandObjArr: BrandObject[]) {\n const [leadBrand, subBrand] = brandObjArr;\n\n return {\n dualBrandSelectElements: [\n { id: leadBrand.brand, brandObject: leadBrand },\n { id: subBrand.brand, brandObject: subBrand }\n ] as DualBrandSelectElement[],\n selectedBrandValue: '', // set to leadBrand.brand if an initial selection is to be made\n leadBrand\n };\n}\n"],"names":["createCardVariantSwitcher","brandObjArr","leadBrand","subBrand","dualBrandSelectElements","id","brand","brandObject","selectedBrandValue"],"mappings":"AAMe,SAASA,EAA0BC,GAC9C,MAAOC,EAAWC,GAAYF,EAE9B,MAAO,CACHG,wBAAyB,CACrB,CAAEC,GAAIH,EAAUI,MAAOC,YAAaL,GACpC,CAAEG,GAAIF,EAASG,MAAOC,YAAaJ,IAEvCK,mBAAoB,GACpBN,YAER"}
1
+ {"version":3,"file":"createCardVariantSwitcher.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/createCardVariantSwitcher.ts"],"sourcesContent":["import { BrandObject, DualBrandSelectElement } from '../../../Card/types';\n\n/**\n * Creates an object used for setting state - that will trigger the rendering of a select element to allow a choice between 2 different card variants\n * @param brandObjArr - array containing 2 card brands objects\n */\nexport default function createCardVariantSwitcher(brandObjArr: BrandObject[]) {\n const [leadBrand, subBrand] = brandObjArr;\n\n return {\n dualBrandSelectElements: [\n { id: leadBrand.brand, brandObject: leadBrand },\n { id: subBrand.brand, brandObject: subBrand }\n ] as DualBrandSelectElement[],\n selectedBrandValue: leadBrand.brand, // set to leadBrand.brand if an initial selection is to be made; else set to empty string\n leadBrand\n };\n}\n"],"names":["createCardVariantSwitcher","brandObjArr","leadBrand","subBrand","dualBrandSelectElements","id","brand","brandObject","selectedBrandValue"],"mappings":"AAMe,SAASA,EAA0BC,GAC9C,MAAOC,EAAWC,GAAYF,EAE9B,MAAO,CACHG,wBAAyB,CACrB,CAAEC,GAAIH,EAAUI,MAAOC,YAAaL,GACpC,CAAEG,GAAIF,EAASG,MAAOC,YAAaJ,IAEvCK,mBAAoBN,EAAUI,MAC9BJ,YAER"}
@@ -1,2 +1,2 @@
1
- import e from"./createCardVariantSwitcher.js";import{BRAND_ICON_UI_EXCLUSION_LIST as n}from"../lib/constants.js";function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}const r=(e,n)=>e.reduce(((e,t)=>e||n.includes(t.brand)),!1),o=e=>e.map((e=>function(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(n){t(e,n,r[n])}))}return e}({},e))),s=(e,n="mc",t="visa")=>{const r=o(e);return r[0].brand!==n&&r[0].brand!==t&&r.reverse(),r.length=1,r};function u(t,u,a,c={}){const{type:d,cvcPolicy:i}=t,{sfp:l}=u,{dualBrandSelectElements:p,setDualBrandSelectElements:g,setSelectedBrandValue:b,issuingCountryCode:f,setIssuingCountryCode:y}=a;return{processBinLookup:(t,u)=>{var a;const p=(null==t?void 0:t.issuingCountryCode)?t.issuingCountryCode.toLowerCase():null;if(y(p),!t||!Object.keys(t).length){g([]),b("");const e=u&&"card"!==d?d:null;return l.current.processBinLookupResponse(t,{brand:e,cvcPolicy:i}),void(c.current=0)}if(null===(a=t.supportedBrands)||void 0===a?void 0:a.length){const u=r(t.supportedBrands,n),a=u?s(t.supportedBrands):o(t.supportedBrands);if(a.length>1){const n=e(a);g(n.dualBrandSelectElements),b(n.selectedBrandValue),l.current.processBinLookupResponse({issuingCountryCode:t.issuingCountryCode,supportedBrands:[n.leadBrand]}),n.leadBrand.panLength>0&&(c.current=n.leadBrand.panLength)}else g([]),b(""),u||b(a[0].brand),l.current.processBinLookupResponse({issuingCountryCode:t.issuingCountryCode,supportedBrands:a}),a[0].panLength>0&&(c.current=a[0].panLength)}},handleDualBrandSelection:e=>{let n=e;if(e instanceof Event){const t=e.target;n=t.getAttribute("data-value")||t.getAttribute("alt")}let t=[];n&&(t=p.reduce(((e,t)=>(t.brandObject.brand===n&&e.push(t.brandObject),e)),[]),t.length&&(b(n),l.current.processBinLookupResponse({issuingCountryCode:f,supportedBrands:t})))}}}export{o as cloneBrandsArr,r as containsExcludedBrand,u as default,s as removeExcludedBrand};
1
+ import e from"./createCardVariantSwitcher.js";import{BRAND_ICON_UI_EXCLUSION_LIST as n}from"../lib/constants.js";function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}const r=(e,n)=>e.reduce(((e,t)=>e||n.includes(t.brand)),!1),o=e=>e.map((e=>function(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(n){t(e,n,r[n])}))}return e}({},e))),s=(e,n="mc",t="visa")=>{const r=o(e);return r[0].brand!==n&&r[0].brand!==t&&r.reverse(),r.length=1,r};function u(t,u,a,c={}){const{type:d,cvcPolicy:i}=t,{sfp:l}=u,{dualBrandSelectElements:p,setDualBrandSelectElements:g,setSelectedBrandValue:b,issuingCountryCode:B,setIssuingCountryCode:f}=a;return{processBinLookup:(t,u)=>{var a;const p=(null==t?void 0:t.issuingCountryCode)?t.issuingCountryCode.toLowerCase():null;if(f(p),!t||!Object.keys(t).length){g([]),b("");const e=u&&"card"!==d?d:null;return l.current.processBinLookupResponse(t,{brand:e,cvcPolicy:i}),void(c.current=0)}if(null===(a=t.supportedBrands)||void 0===a?void 0:a.length){const u=r(t.supportedBrands,n),a=u?s(t.supportedBrands):o(t.supportedBrands);if(a.length>1){const n=e(a);g(n.dualBrandSelectElements),b(n.selectedBrandValue),l.current.processBinLookupResponse({issuingCountryCode:t.issuingCountryCode,supportedBrands:[n.leadBrand]}),n.leadBrand.panLength>0&&(c.current=n.leadBrand.panLength)}else g([]),b(""),u||b(a[0].brand),l.current.processBinLookupResponse({issuingCountryCode:t.issuingCountryCode,supportedBrands:a}),a[0].panLength>0&&(c.current=a[0].panLength)}},handleDualBrandSelection:e=>{let n=e;if(e instanceof Event){const t=e.target;n=t.getAttribute("data-value")||t.getAttribute("value")}let t=[];n&&(t=p.reduce(((e,t)=>(t.brandObject.brand===n&&e.push(t.brandObject),e)),[]),t.length&&(b(n),l.current.processBinLookupResponse({issuingCountryCode:B,supportedBrands:t,isDualBrandSelection:!0})))}}}export{o as cloneBrandsArr,r as containsExcludedBrand,u as default,s as removeExcludedBrand};
2
2
  //# sourceMappingURL=extensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/extensions.ts"],"sourcesContent":["import { SingleBrandResetObject } from '../SFP/types';\nimport { BrandObject } from '../../../Card/types';\nimport createCardVariantSwitcher from './createCardVariantSwitcher';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../lib/constants';\n\n// Externally testable utils\nexport const containsExcludedBrand = (brandsArr: BrandObject[], excludedBrands: string[]): boolean => {\n return brandsArr.reduce((acc, brandObj) => acc || excludedBrands.includes(brandObj.brand), false);\n};\n\nexport const cloneBrandsArr = (brandsArr: BrandObject[]): BrandObject[] => brandsArr.map(item => ({ ...item }));\n\nexport const removeExcludedBrand = (brandsArr: BrandObject[], mainBrand1 = 'mc', mainBrand2 = 'visa'): BrandObject[] => {\n const clonedBrands: BrandObject[] = cloneBrandsArr(brandsArr);\n\n if (clonedBrands[0].brand !== mainBrand1 && clonedBrands[0].brand !== mainBrand2) clonedBrands.reverse();\n clonedBrands.length = 1;\n return clonedBrands;\n};\n// --\n\nexport default function extensions(props, refs, states, hasPanLengthRef: Partial<{ current }> = {}) {\n // Destructure props, refs and state hooks\n const { type, cvcPolicy } = props;\n const { sfp } = refs;\n const { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode } = states;\n\n return {\n /**\n * Handle the binLookup response object generated in triggerBinLookup and process it in relation to the CardInput and it's sub-components.\n * e.g. we might need to add/remove additional markup (a selector for brands), and inform SFP of the issuingCountryCode & detected brand(s).\n *\n * @param binLookupResponse -\n * @param isReset -\n */\n processBinLookup: (binLookupResponse, isReset) => {\n const issuingCode = binLookupResponse?.issuingCountryCode ? binLookupResponse.issuingCountryCode.toLowerCase() : null;\n setIssuingCountryCode(issuingCode);\n\n // Reset UI\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // If /binLookup has 'reset' then for a generic card the internal regex will kick in to show the right brand icon - so set to null\n // However for a single-branded card we need to pass the \"base\" type so the brand logo is reset - so set to type\n const brandToReset = isReset && type !== 'card' ? type : null;\n\n sfp.current.processBinLookupResponse(binLookupResponse, {\n brand: brandToReset,\n cvcPolicy: cvcPolicy // undefined except for Bancontact\n } as SingleBrandResetObject);\n\n // Reset storage var\n hasPanLengthRef.current = 0;\n return;\n }\n\n // RESULT: binLookup has found a result so proceed accordingly\n if (binLookupResponse.supportedBrands?.length) {\n const hasExcludedBrand: boolean = containsExcludedBrand(binLookupResponse.supportedBrands, BRAND_ICON_UI_EXCLUSION_LIST);\n\n const supportedBrands: BrandObject[] = hasExcludedBrand\n ? removeExcludedBrand(binLookupResponse.supportedBrands)\n : cloneBrandsArr(binLookupResponse.supportedBrands);\n\n // 1) Multiple options found - add to the UI & inform SFP\n if (supportedBrands.length > 1) {\n // --\n const switcherObj = createCardVariantSwitcher(supportedBrands);\n\n // Set properties on state to trigger the dual branding icons in the UI\n setDualBrandSelectElements(switcherObj.dualBrandSelectElements);\n setSelectedBrandValue(switcherObj.selectedBrandValue); // initially this value from switcherObj will be ''\n\n // Pass an object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands: [switcherObj.leadBrand]\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (switcherObj.leadBrand.panLength > 0) {\n hasPanLengthRef.current = switcherObj.leadBrand.panLength;\n }\n\n // 2) Single option found (binValueObject.supportedBrands.length === 1)\n } else {\n // Reset UI\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // Set (single) value from binLookup so it will be added to the 'brand' property in the paymentMethod object\n // EXCEPT - if we are dealing with a brand that we exclude from the UI\n if (!hasExcludedBrand) setSelectedBrandValue(supportedBrands[0].brand);\n\n // Pass object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (supportedBrands[0].panLength > 0) {\n hasPanLengthRef.current = supportedBrands[0].panLength;\n }\n }\n }\n },\n /**\n * Handler for clicks on the icons added in response to the /binLookup call\n * Inform SFP of the brand changes when these selections are made\n */\n handleDualBrandSelection: (e: Event | string): void => {\n let value: Event | string = e;\n\n if (e instanceof Event) {\n const target = e.target as HTMLLIElement;\n value = target.getAttribute('data-value') || target.getAttribute('alt');\n }\n\n // Check if we have a value and whether that value corresponds to a brandObject we can propagate\n // If either are false then abandon the process\n let brandObjArr: BrandObject[] = [];\n if (value) {\n // Find the brandObject with the matching brand value and place into an array\n brandObjArr = dualBrandSelectElements.reduce((acc, item) => {\n if (item.brandObject.brand === value) {\n acc.push(item.brandObject);\n }\n return acc;\n }, []);\n\n if (!brandObjArr.length) {\n return; // no brand object associated with value was found\n }\n } else {\n return; // no value passed\n }\n\n setSelectedBrandValue(value);\n\n // Pass brand object into SecuredFields\n sfp.current.processBinLookupResponse({\n issuingCountryCode,\n supportedBrands: brandObjArr\n });\n }\n };\n}\n"],"names":["containsExcludedBrand","brandsArr","excludedBrands","reduce","acc","brandObj","includes","brand","cloneBrandsArr","map","item","_object_spread","removeExcludedBrand","mainBrand1","mainBrand2","clonedBrands","reverse","length","extensions","props","refs","states","hasPanLengthRef","type","cvcPolicy","sfp","dualBrandSelectElements","setDualBrandSelectElements","setSelectedBrandValue","issuingCountryCode","setIssuingCountryCode","processBinLookup","binLookupResponse","isReset","issuingCode","toLowerCase","Object","keys","brandToReset","current","processBinLookupResponse","supportedBrands","hasExcludedBrand","BRAND_ICON_UI_EXCLUSION_LIST","switcherObj","createCardVariantSwitcher","selectedBrandValue","leadBrand","panLength","handleDualBrandSelection","e","value","Event","target","getAttribute","brandObjArr","brandObject","push"],"mappings":"yOAMO,MAAMA,EAAwB,CAACC,EAA0BC,IACrDD,EAAUE,QAAO,CAACC,EAAKC,IAAaD,GAAOF,EAAeI,SAASD,EAASE,SAAQ,GAGlFC,EAAkBP,GAA4CA,EAAUQ,KAAIC,yUAASC,CAAA,CAAA,EAAKD,KAE1FE,EAAsB,CAACX,EAA0BY,EAAa,KAAMC,EAAa,UAC1F,MAAMC,EAA8BP,EAAeP,GAInD,OAFIc,EAAa,GAAGR,QAAUM,GAAcE,EAAa,GAAGR,QAAUO,GAAYC,EAAaC,UAC/FD,EAAaE,OAAS,EACfF,CAAAA,EAII,SAASG,EAAWC,EAAOC,EAAMC,EAAQC,EAAwC,CAAA,GAE5F,MAAMC,KAAEA,EAAIC,UAAEA,GAAcL,GACtBM,IAAEA,GAAQL,GACVM,wBAAEA,EAAuBC,2BAAEA,EAA0BC,sBAAEA,EAAqBC,mBAAEA,EAAkBC,sBAAEA,GAA0BT,EAElI,MAAO,CAQHU,iBAAkB,CAACC,EAAmBC,KAwB9BD,IAAAA,EAvBJ,MAAME,GAAcF,aAAAA,EAAAA,EAAmBH,oBAAqBG,EAAkBH,mBAAmBM,cAAgB,KAIjH,GAHAL,EAAsBI,IAGjBF,IAAsBI,OAAOC,KAAKL,GAAmBf,OAAQ,CAC9DU,EAA2B,IAC3BC,EAAsB,IAItB,MAAMU,EAAeL,GAAoB,SAATV,EAAkBA,EAAO,KASzD,OAPAE,EAAIc,QAAQC,yBAAyBR,EAAmB,CACpDzB,MAAO+B,EACPd,UAAWA,SAIfF,EAAgBiB,QAAU,EAE9B,CAGA,WAAIP,EAAAA,EAAkBS,uBAAlBT,IAAAA,OAAAA,EAAAA,EAAmCf,OAAQ,CAC3C,MAAMyB,EAA4B1C,EAAsBgC,EAAkBS,gBAAiBE,GAErFF,EAAiCC,EACjC9B,EAAoBoB,EAAkBS,iBACtCjC,EAAewB,EAAkBS,iBAGvC,GAAIA,EAAgBxB,OAAS,EAAG,CAE5B,MAAM2B,EAAcC,EAA0BJ,GAG9Cd,EAA2BiB,EAAYlB,yBACvCE,EAAsBgB,EAAYE,oBAGlCrB,EAAIc,QAAQC,yBAAyB,CACjCX,mBAAoBG,EAAkBH,mBACtCY,gBAAiB,CAACG,EAAYG,aAI9BH,EAAYG,UAAUC,UAAY,IAClC1B,EAAgBiB,QAAUK,EAAYG,UAAUC,gBAMpDrB,EAA2B,IAC3BC,EAAsB,IAIjBc,GAAkBd,EAAsBa,EAAgB,GAAGlC,OAGhEkB,EAAIc,QAAQC,yBAAyB,CACjCX,mBAAoBG,EAAkBH,mBACtCY,oBAIAA,EAAgB,GAAGO,UAAY,IAC/B1B,EAAgBiB,QAAUE,EAAgB,GAAGO,UAGzD,GAMJC,yBAA2BC,IACvB,IAAIC,EAAwBD,EAE5B,GAAIA,aAAaE,MAAO,CACpB,MAAMC,EAASH,EAAEG,OACjBF,EAAQE,EAAOC,aAAa,eAAiBD,EAAOC,aAAa,MACrE,CAIA,IAAIC,EAA6B,GAC7BJ,IAEAI,EAAc7B,EAAwBvB,QAAO,CAACC,EAAKM,KAC3CA,EAAK8C,YAAYjD,QAAU4C,GAC3B/C,EAAIqD,KAAK/C,EAAK8C,aAEXpD,IACR,IAEEmD,EAAYtC,SAOrBW,EAAsBuB,GAGtB1B,EAAIc,QAAQC,yBAAyB,CACjCX,qBACAY,gBAAiBc,KACrB,EAGZ"}
1
+ {"version":3,"file":"extensions.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/extensions.ts"],"sourcesContent":["import { SingleBrandResetObject } from '../SFP/types';\nimport { BrandObject } from '../../../Card/types';\nimport createCardVariantSwitcher from './createCardVariantSwitcher';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../lib/constants';\n\n// Externally testable utils\nexport const containsExcludedBrand = (brandsArr: BrandObject[], excludedBrands: string[]): boolean => {\n return brandsArr.reduce((acc, brandObj) => acc || excludedBrands.includes(brandObj.brand), false);\n};\n\nexport const cloneBrandsArr = (brandsArr: BrandObject[]): BrandObject[] => brandsArr.map(item => ({ ...item }));\n\nexport const removeExcludedBrand = (brandsArr: BrandObject[], mainBrand1 = 'mc', mainBrand2 = 'visa'): BrandObject[] => {\n const clonedBrands: BrandObject[] = cloneBrandsArr(brandsArr);\n\n if (clonedBrands[0].brand !== mainBrand1 && clonedBrands[0].brand !== mainBrand2) clonedBrands.reverse();\n clonedBrands.length = 1;\n return clonedBrands;\n};\n// --\n\nexport default function extensions(props, refs, states, hasPanLengthRef: Partial<{ current }> = {}) {\n // Destructure props, refs and state hooks\n const { type, cvcPolicy } = props;\n const { sfp } = refs;\n const { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode } = states;\n\n return {\n /**\n * Handle the binLookup response object generated in triggerBinLookup and process it in relation to the CardInput and it's sub-components.\n * e.g. we might need to add/remove additional markup (a selector for brands), and inform SFP of the issuingCountryCode & detected brand(s).\n *\n * @param binLookupResponse -\n * @param isReset -\n */\n processBinLookup: (binLookupResponse, isReset) => {\n const issuingCode = binLookupResponse?.issuingCountryCode ? binLookupResponse.issuingCountryCode.toLowerCase() : null;\n setIssuingCountryCode(issuingCode);\n\n // Reset UI\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // If /binLookup has 'reset' then for a generic card the internal regex will kick in to show the right brand icon - so set to null\n // However for a single-branded card we need to pass the \"base\" type so the brand logo is reset - so set to type\n const brandToReset = isReset && type !== 'card' ? type : null;\n\n sfp.current.processBinLookupResponse(binLookupResponse, {\n brand: brandToReset,\n cvcPolicy: cvcPolicy // undefined except for Bancontact\n } as SingleBrandResetObject);\n\n // Reset storage var\n hasPanLengthRef.current = 0;\n return;\n }\n\n // RESULT: binLookup has found a result so proceed accordingly\n if (binLookupResponse.supportedBrands?.length) {\n const hasExcludedBrand: boolean = containsExcludedBrand(binLookupResponse.supportedBrands, BRAND_ICON_UI_EXCLUSION_LIST);\n\n const supportedBrands: BrandObject[] = hasExcludedBrand\n ? removeExcludedBrand(binLookupResponse.supportedBrands)\n : cloneBrandsArr(binLookupResponse.supportedBrands);\n\n // 1) Multiple options found - add to the UI & inform SFP\n if (supportedBrands.length > 1) {\n // --\n const switcherObj = createCardVariantSwitcher(supportedBrands);\n\n // Set properties on state to trigger the dual branding icons in the UI\n setDualBrandSelectElements(switcherObj.dualBrandSelectElements);\n setSelectedBrandValue(switcherObj.selectedBrandValue); // initially this value from switcherObj will be ''\n\n // Pass an object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands: [switcherObj.leadBrand]\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (switcherObj.leadBrand.panLength > 0) {\n hasPanLengthRef.current = switcherObj.leadBrand.panLength;\n }\n\n // 2) Single option found (binValueObject.supportedBrands.length === 1)\n } else {\n // Reset UI\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // Set (single) value from binLookup so it will be added to the 'brand' property in the paymentMethod object\n // EXCEPT - if we are dealing with a brand that we exclude from the UI\n if (!hasExcludedBrand) setSelectedBrandValue(supportedBrands[0].brand);\n\n // Pass object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (supportedBrands[0].panLength > 0) {\n hasPanLengthRef.current = supportedBrands[0].panLength;\n }\n }\n }\n },\n /**\n * Handler for clicks on the icons added in response to the /binLookup call\n * Inform SFP of the brand changes when these selections are made\n */\n handleDualBrandSelection: (e: Event | string): void => {\n let value: Event | string = e;\n if (e instanceof Event) {\n const target = e.target as HTMLLIElement;\n value = target.getAttribute('data-value') || target.getAttribute('value');\n }\n\n // Check if we have a value and whether that value corresponds to a brandObject we can propagate\n // If either are false then abandon the process\n let brandObjArr: BrandObject[] = [];\n if (value) {\n // Find the brandObject with the matching brand value and place into an array\n brandObjArr = dualBrandSelectElements.reduce((acc, item) => {\n if (item.brandObject.brand === value) {\n acc.push(item.brandObject);\n }\n return acc;\n }, []);\n\n if (!brandObjArr.length) {\n return; // no brand object associated with value was found\n }\n } else {\n return; // no value passed\n }\n\n setSelectedBrandValue(value);\n\n // Pass brand object into SecuredFields\n sfp.current.processBinLookupResponse({\n issuingCountryCode,\n supportedBrands: brandObjArr,\n isDualBrandSelection: true\n });\n }\n };\n}\n"],"names":["containsExcludedBrand","brandsArr","excludedBrands","reduce","acc","brandObj","includes","brand","cloneBrandsArr","map","item","_object_spread","removeExcludedBrand","mainBrand1","mainBrand2","clonedBrands","reverse","length","extensions","props","refs","states","hasPanLengthRef","type","cvcPolicy","sfp","dualBrandSelectElements","setDualBrandSelectElements","setSelectedBrandValue","issuingCountryCode","setIssuingCountryCode","processBinLookup","binLookupResponse","isReset","issuingCode","toLowerCase","Object","keys","brandToReset","current","processBinLookupResponse","supportedBrands","hasExcludedBrand","BRAND_ICON_UI_EXCLUSION_LIST","switcherObj","createCardVariantSwitcher","selectedBrandValue","leadBrand","panLength","handleDualBrandSelection","e","value","Event","target","getAttribute","brandObjArr","brandObject","push","isDualBrandSelection"],"mappings":"yOAMO,MAAMA,EAAwB,CAACC,EAA0BC,IACrDD,EAAUE,QAAO,CAACC,EAAKC,IAAaD,GAAOF,EAAeI,SAASD,EAASE,SAAQ,GAGlFC,EAAkBP,GAA4CA,EAAUQ,KAAIC,yUAASC,CAAA,CAAA,EAAKD,KAE1FE,EAAsB,CAACX,EAA0BY,EAAa,KAAMC,EAAa,UAC1F,MAAMC,EAA8BP,EAAeP,GAInD,OAFIc,EAAa,GAAGR,QAAUM,GAAcE,E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AIc,QAAQC,yBAAyB,CACjCX,mBAAoBG,EAAkBH,mBACtCY,oBAIAA,EAAgB,GAAGO,UAAY,IAC/B1B,EAAgBiB,QAAUE,EAAgB,GAAGO,UAGzD,GAMJC,yBAA2BC,IACvB,IAAIC,EAAwBD,EAC5B,GAAIA,aAAaE,MAAO,CACpB,MAAMC,EAASH,EAAEG,OACjBF,EAAQE,EAAOC,aAAa,eAAiBD,EAAOC,aAAa,QACrE,CAIA,IAAIC,EAA6B,GAC7BJ,IAEAI,EAAc7B,EAAwBvB,QAAO,CAACC,EAAKM,KAC3CA,EAAK8C,YAAYjD,QAAU4C,GAC3B/C,EAAIqD,KAAK/C,EAAK8C,aAEXpD,IACR,IAEEmD,EAAYtC,SAOrBW,EAAsBuB,GAGtB1B,EAAIc,QAAQC,yBAAyB,CACjCX,qBACAY,gBAAiBc,EACjBG,sBAAsB,KAC1B,EAGZ"}
@@ -1,2 +1,2 @@
1
- import{DATE_POLICY_REQUIRED as e,ENCRYPTED_EXPIRY_DATE as t,DATE_POLICY_HIDDEN as s,ENCRYPTED_CARD_NUMBER as i,ENCRYPTED_SECURITY_CODE as r,ENCRYPTED_EXPIRY_MONTH as n,ENCRYPTED_EXPIRY_YEAR as o}from"../../constants.js";import c from"../utils/iframes/postMessageToIframe.js";import{hasOwnProperty as a}from"../../../../../../utils/hasOwnProperty.js";import l from"../utils/iframes/getIframeContentWin.js";function d(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function u(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter((function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable})))),i.forEach((function(t){d(e,t,s[t])}))}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t.push.apply(t,s)}return t}(Object(t)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))})),e}function p(e){if(a(this.state.securedFields,i)){const t=y(u({txVariant:this.state.type},e),{fieldType:i,numKey:this.state.securedFields[i].numKey});c(t,l(this.state,i),this.config.loadingContext)}}function h(e){(a(this.state.securedFields,n)&&a(this.state.securedFields,o)?[n,o]:[t]).forEach((t=>{const s=y(u({txVariant:this.state.type},e),{fieldType:t,numKey:this.state.securedFields[t].numKey});c(s,l(this.state,t),this.config.loadingContext)}))}function f(c,l){const d="card"===this.state.type;if(!c||!Object.keys(c).length)return d?(this.sendBrandToCardSF({brand:"reset"}),this.sendExpiryDatePolicyToSF({expiryDatePolicy:e})):l&&this.processBrand(y(u({},l),{fieldType:i})),void("card"===this.state.type&&a(this.state.securedFields,t)&&(this.state.securedFields[t].expiryDatePolicy=e));const p=c.supportedBrands[0],h=p.brand;var f;const b=null!==(f=p.expiryDatePolicy)&&void 0!==f?f:!0===p.showExpiryDate?e:s;var P;const m={brand:h,cvcPolicy:p.cvcPolicy,expiryDatePolicy:b,cvcText:"Security code",showSocialSecurityNumber:null!==(P=p.showSocialSecurityNumber)&&void 0!==P&&P,fieldType:i};if(this.processBrand(m),d){const e=u({brand:h,enableLuhnCheck:!1!==c.supportedBrands[0].enableLuhnCheck},(null==p?void 0:p.panLength)&&{panLength:null==p?void 0:p.panLength});this.sendBrandToCardSF(e),this.sendExpiryDatePolicyToSF({expiryDatePolicy:b})}a(this.state.securedFields,r)&&(this.state.securedFields[r].cvcPolicy=p.cvcPolicy),a(this.state.securedFields,t)?this.state.securedFields[t].expiryDatePolicy=b:a(this.state.securedFields,n)&&a(this.state.securedFields,o)&&(this.state.securedFields[n].expiryDatePolicy=b,this.state.securedFields[o].expiryDatePolicy=b),this.validateForm()}export{f as default,p as sendBrandToCardSF,h as sendExpiryDatePolicyToSF};
1
+ import{DATE_POLICY_REQUIRED as e,ENCRYPTED_EXPIRY_DATE as t,DATE_POLICY_HIDDEN as s,ENCRYPTED_CARD_NUMBER as i,ENCRYPTED_SECURITY_CODE as r,ENCRYPTED_EXPIRY_MONTH as n,ENCRYPTED_EXPIRY_YEAR as o}from"../../constants.js";import c from"../utils/iframes/postMessageToIframe.js";import{hasOwnProperty as a}from"../../../../../../utils/hasOwnProperty.js";import l from"../utils/iframes/getIframeContentWin.js";function d(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function u(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter((function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable})))),i.forEach((function(t){d(e,t,s[t])}))}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t.push.apply(t,s)}return t}(Object(t)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))})),e}function p(e){if(a(this.state.securedFields,i)){const t=y(u({txVariant:this.state.type},e),{fieldType:i,numKey:this.state.securedFields[i].numKey});c(t,l(this.state,i),this.config.loadingContext)}}function h(e){(a(this.state.securedFields,n)&&a(this.state.securedFields,o)?[n,o]:[t]).forEach((t=>{const s=y(u({txVariant:this.state.type},e),{fieldType:t,numKey:this.state.securedFields[t].numKey});c(s,l(this.state,t),this.config.loadingContext)}))}function f(c,l){const d="card"===this.state.type;if(!c||!Object.keys(c).length)return d?(this.sendBrandToCardSF({brand:"reset"}),this.sendExpiryDatePolicyToSF({expiryDatePolicy:e})):l&&this.processBrand(y(u({},l),{fieldType:i})),void("card"===this.state.type&&a(this.state.securedFields,t)&&(this.state.securedFields[t].expiryDatePolicy=e));const p=c.supportedBrands[0],h=p.brand;var f;const b=null!==(f=p.expiryDatePolicy)&&void 0!==f?f:!0===p.showExpiryDate?e:s;var P;const m={brand:h,cvcPolicy:p.cvcPolicy,expiryDatePolicy:b,cvcText:"Security code",showSocialSecurityNumber:null!==(P=p.showSocialSecurityNumber)&&void 0!==P&&P,fieldType:i};if(this.processBrand(m),d){const e=u({brand:h,enableLuhnCheck:!1!==c.supportedBrands[0].enableLuhnCheck},(null==p?void 0:p.panLength)&&!c.isDualBrandSelection&&{panLength:null==p?void 0:p.panLength});this.sendBrandToCardSF(e),this.sendExpiryDatePolicyToSF({expiryDatePolicy:b})}a(this.state.securedFields,r)&&(this.state.securedFields[r].cvcPolicy=p.cvcPolicy),a(this.state.securedFields,t)?this.state.securedFields[t].expiryDatePolicy=b:a(this.state.securedFields,n)&&a(this.state.securedFields,o)&&(this.state.securedFields[n].expiryDatePolicy=b,this.state.securedFields[o].expiryDatePolicy=b),this.validateForm()}export{f as default,p as sendBrandToCardSF,h as sendExpiryDatePolicyToSF};
2
2
  //# sourceMappingURL=handleBrandFromBinLookup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleBrandFromBinLookup.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.ts"],"sourcesContent":["import {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n DATE_POLICY_REQUIRED,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../../constants';\nimport postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject } from '../../types';\nimport { BinLookupResponse, BrandObject } from '../../../../../Card/types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { SingleBrandResetObject } from '../../../SFP/types';\n\nexport function sendBrandToCardSF(brandObj: SendBrandObject): void {\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_CARD_NUMBER)) {\n const dataObj: object = {\n txVariant: this.state.type,\n ...brandObj,\n fieldType: ENCRYPTED_CARD_NUMBER,\n numKey: this.state.securedFields[ENCRYPTED_CARD_NUMBER].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, ENCRYPTED_CARD_NUMBER), this.config.loadingContext);\n }\n}\n\nexport function sendExpiryDatePolicyToSF(expiryDateObj: SendExpiryDateObject): void {\n const separateDateFields =\n hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR);\n\n const dateIframesArr = separateDateFields ? [ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR] : [ENCRYPTED_EXPIRY_DATE];\n\n dateIframesArr.forEach((key: string) => {\n const dataObj: object = {\n txVariant: this.state.type,\n ...expiryDateObj,\n fieldType: key,\n numKey: this.state.securedFields[key].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, key), this.config.loadingContext);\n });\n}\n\nexport default function handleBrandFromBinLookup(binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void {\n const isGenericCard: boolean = this.state.type === 'card';\n\n /**\n * The number of digits in number field has dropped below threshold for BIN lookup (or the bin wasn't found in the DB)\n * - so tell SF to reset & republish the brand it detects\n */\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n if (isGenericCard) {\n // This will be sent to CardNumber SF which will trigger the brand to be re-evaluated and broadcast\n // (which will reset cvcPolicy & expiryDatePolicy in state, here in Checkout)\n this.sendBrandToCardSF({ brand: 'reset' });\n // Also pass the reset expiryDatePolicy to the date related SFs so they can reset visibility & aria-required attrs\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy: DATE_POLICY_REQUIRED });\n } else {\n /**\n * For \"dedicated\" card components, i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands,\n * there will be no to-and-fro with the securedField iframe to reset brand.\n * The presence of a resetObj indicates we are in this \"dedicated\"\" scenario, so we need to use the information contained within this object\n * to internally reset the brand\n */\n if (resetObj) {\n this.processBrand({ ...resetObj, fieldType: ENCRYPTED_CARD_NUMBER } as SFFeedbackObj);\n }\n }\n\n // Reset expiryDatePolicy - which never comes from SF // TODO find out under which circumstances this clause is still required\n if (this.state.type === 'card' && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = DATE_POLICY_REQUIRED;\n }\n\n return;\n }\n\n const binBrandObj: BrandObject = binLookupResponse.supportedBrands[0];\n\n const passedBrand: string = binBrandObj.brand;\n\n // Look first for expiryDatePolicy string otherwise use showExpiryDate boolean\n const expiryDatePolicy = binBrandObj.expiryDatePolicy ?? (binBrandObj.showExpiryDate === true ? DATE_POLICY_REQUIRED : DATE_POLICY_HIDDEN);\n\n const brandObj: object = {\n brand: passedBrand,\n cvcPolicy: binBrandObj.cvcPolicy,\n expiryDatePolicy,\n cvcText: 'Security code',\n showSocialSecurityNumber: binBrandObj.showSocialSecurityNumber ?? false,\n fieldType: ENCRYPTED_CARD_NUMBER\n };\n\n // Take advantage of function used to handle brand messages from SF in order to process this new brand information\n this.processBrand(brandObj as SFFeedbackObj);\n\n if (isGenericCard) {\n // Pass brand to CardNumber SF\n const cardObj: SendBrandObject = {\n brand: passedBrand,\n enableLuhnCheck: binLookupResponse.supportedBrands[0].enableLuhnCheck !== false,\n ...(binBrandObj?.panLength && { panLength: binBrandObj?.panLength })\n };\n this.sendBrandToCardSF(cardObj);\n\n // Inform the date related securedFields\n // - if expiryDatePolicy is 'optional' or 'hidden' they need to set the aria-required attribute / hide themselves\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy });\n }\n\n /**\n * CHECK IF BRAND CHANGE MEANS FORM IS NOW VALID e.g maestro/bcmc (which don't require cvc) OR bcmc/visa (one of which doesn't require cvc, one of which does)\n */\n\n /**\n * First set the cvcPolicy value on the relevant SecuredFields instance (which will reflect in the cvc field being considered valid,\n * as long as it is not in error)...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_SECURITY_CODE)) {\n this.state.securedFields[ENCRYPTED_SECURITY_CODE].cvcPolicy = binBrandObj.cvcPolicy;\n }\n\n /**\n * ...then set the expiryDatePolicy...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = expiryDatePolicy;\n } else if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_MONTH].expiryDatePolicy = expiryDatePolicy;\n this.state.securedFields[ENCRYPTED_EXPIRY_YEAR].expiryDatePolicy = expiryDatePolicy;\n }\n\n /**\n * ...and now re-check if form i.e all the SecuredFields, are valid\n */\n this.validateForm();\n}\n"],"names":["sendBrandToCardSF","brandObj","hasOwnProperty","this","state","securedFields","ENCRYPTED_CARD_NUMBER","dataObj","_object_spread_props","_object_spread","txVariant","type","fieldType","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","sendExpiryDatePolicyToSF","expiryDateObj","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_EXPIRY_DATE","forEach","key","handleBrandFromBinLookup","binLookupResponse","resetObj","isGenericCard","Object","keys","length","brand","expiryDatePolicy","DATE_POLICY_REQUIRED","processBrand","binBrandObj","supportedBrands","passedBrand","showExpiryDate","DATE_POLICY_HIDDEN","cvcPolicy","cvcText","showSocialSecurityNumber","cardObj","enableLuhnCheck","panLength","ENCRYPTED_SECURITY_CODE","validateForm"],"mappings":"osCAgBO,SAASA,EAAkBC,GAC9B,GAAIC,EAAeC,KAAKC,MAAMC,cAAeC,GAAw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rB+B,MAAOM,EACPG,UAAWL,EAAYK,UACvBR,mBACAS,QAAS,gBACTC,yBAA8D,QAApCP,EAAAA,EAAYO,oCAAZP,GAAAA,EAC1BxB,UAAWN,GAMf,GAFAH,KAAKgC,aAAalC,GAEd2B,EAAe,CAEf,MAAMgB,EAA2BnC,EAAA,CAC7BuB,MAAOM,EACPO,iBAA0E,IAAzDnB,EAAkBW,gBAAgB,GAAGQ,kBAClDT,aAAAA,EAAAA,EAAaU,YAAa,CAAEA,UAAWV,aAAAA,EAAAA,EAAaU,YAE5D3C,KAAKH,kBAAkB4C,GAIvBzC,KAAKe,yBAAyB,CAAEe,oBACpC,CAUI/B,EAAeC,KAAKC,MAAMC,cAAe0C,KACzC5C,KAAKC,MAAMC,cAAc0C,GAAyBN,UAAYL,EAAYK,WAM1EvC,EAAeC,KAAKC,MAAMC,cAAeiB,GACzCnB,KAAKC,MAAMC,cAAciB,GAAuBW,iBAAmBA,EAC5D/B,EAAeC,KAAKC,MAAMC,cAAee,IAA2BlB,EAAeC,KAAKC,MAAMC,cAAegB,KACpHlB,KAAKC,MAAMC,cAAce,GAAwBa,iBAAmBA,EACpE9B,KAAKC,MAAMC,cAAcgB,GAAuBY,iBAAmBA,GAMvE9B,KAAK6C,cACT"}
1
+ {"version":3,"file":"handleBrandFromBinLookup.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.ts"],"sourcesContent":["import {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n DATE_POLICY_REQUIRED,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../../constants';\nimport postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject } from '../../types';\nimport { BinLookupResponse, BrandObject } from '../../../../../Card/types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { SingleBrandResetObject } from '../../../SFP/types';\n\nexport function sendBrandToCardSF(brandObj: SendBrandObject): void {\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_CARD_NUMBER)) {\n const dataObj: object = {\n txVariant: this.state.type,\n ...brandObj,\n fieldType: ENCRYPTED_CARD_NUMBER,\n numKey: this.state.securedFields[ENCRYPTED_CARD_NUMBER].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, ENCRYPTED_CARD_NUMBER), this.config.loadingContext);\n }\n}\n\nexport function sendExpiryDatePolicyToSF(expiryDateObj: SendExpiryDateObject): void {\n const separateDateFields =\n hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR);\n\n const dateIframesArr = separateDateFields ? [ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR] : [ENCRYPTED_EXPIRY_DATE];\n\n dateIframesArr.forEach((key: string) => {\n const dataObj: object = {\n txVariant: this.state.type,\n ...expiryDateObj,\n fieldType: key,\n numKey: this.state.securedFields[key].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, key), this.config.loadingContext);\n });\n}\n\nexport default function handleBrandFromBinLookup(binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void {\n const isGenericCard: boolean = this.state.type === 'card';\n\n /**\n * The number of digits in number field has dropped below threshold for BIN lookup (or the bin wasn't found in the DB)\n * - so tell SF to reset & republish the brand it detects\n */\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n if (isGenericCard) {\n // This will be sent to CardNumber SF which will trigger the brand to be re-evaluated and broadcast\n // (which will reset cvcPolicy & expiryDatePolicy in state, here in Checkout)\n this.sendBrandToCardSF({ brand: 'reset' });\n // Also pass the reset expiryDatePolicy to the date related SFs so they can reset visibility & aria-required attrs\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy: DATE_POLICY_REQUIRED });\n } else {\n /**\n * For \"dedicated\" card components, i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands,\n * there will be no to-and-fro with the securedField iframe to reset brand.\n * The presence of a resetObj indicates we are in this \"dedicated\"\" scenario, so we need to use the information contained within this object\n * to internally reset the brand\n */\n if (resetObj) {\n this.processBrand({ ...resetObj, fieldType: ENCRYPTED_CARD_NUMBER } as SFFeedbackObj);\n }\n }\n\n // Reset expiryDatePolicy - which never comes from SF // TODO find out under which circumstances this clause is still required\n if (this.state.type === 'card' && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = DATE_POLICY_REQUIRED;\n }\n\n return;\n }\n\n const binBrandObj: BrandObject = binLookupResponse.supportedBrands[0];\n\n const passedBrand: string = binBrandObj.brand;\n\n // Look first for expiryDatePolicy string otherwise use showExpiryDate boolean\n const expiryDatePolicy = binBrandObj.expiryDatePolicy ?? (binBrandObj.showExpiryDate === true ? DATE_POLICY_REQUIRED : DATE_POLICY_HIDDEN);\n\n const brandObj: object = {\n brand: passedBrand,\n cvcPolicy: binBrandObj.cvcPolicy,\n expiryDatePolicy,\n cvcText: 'Security code',\n showSocialSecurityNumber: binBrandObj.showSocialSecurityNumber ?? false,\n fieldType: ENCRYPTED_CARD_NUMBER\n };\n\n // Take advantage of function used to handle brand messages from SF in order to process this new brand information\n this.processBrand(brandObj as SFFeedbackObj);\n\n if (isGenericCard) {\n // Pass brand to CardNumber SF\n const cardObj: SendBrandObject = {\n brand: passedBrand,\n enableLuhnCheck: binLookupResponse.supportedBrands[0].enableLuhnCheck !== false,\n // Only pass the panLength if a) we have one & b) we're not in a switching-between-dual-brands scenario\n // (because it causes unnecessary callbacks from SF which uses panLength to trigger moving focus to the expiryDate field)\n ...(binBrandObj?.panLength && !binLookupResponse.isDualBrandSelection && { panLength: binBrandObj?.panLength })\n };\n this.sendBrandToCardSF(cardObj);\n\n // Inform the date related securedFields\n // - if expiryDatePolicy is 'optional' or 'hidden' they need to set the aria-required attribute / hide themselves\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy });\n }\n\n /**\n * CHECK IF BRAND CHANGE MEANS FORM IS NOW VALID e.g maestro/bcmc (which don't require cvc) OR bcmc/visa (one of which doesn't require cvc, one of which does)\n */\n\n /**\n * First set the cvcPolicy value on the relevant SecuredFields instance (which will reflect in the cvc field being considered valid,\n * as long as it is not in error)...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_SECURITY_CODE)) {\n this.state.securedFields[ENCRYPTED_SECURITY_CODE].cvcPolicy = binBrandObj.cvcPolicy;\n }\n\n /**\n * ...then set the expiryDatePolicy...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = expiryDatePolicy;\n } else if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_MONTH].expiryDatePolicy = expiryDatePolicy;\n this.state.securedFields[ENCRYPTED_EXPIRY_YEAR].expiryDatePolicy = expiryDatePolicy;\n }\n\n /**\n * ...and now re-check if form i.e all the SecuredFields, are valid\n */\n this.validateForm();\n}\n"],"names":["sendBrandToCardSF","brandObj","hasOwnProperty","this","state","securedFields","ENCRYPTED_CARD_NUMBER","dataObj","_object_spread_props","_object_spread","txVariant","type","fieldType","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","sendExpiryDatePolicyToSF","expiryDateObj","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_EXPIRY_DATE","forEach","key","handleBrandFromBinLookup","binLookupResponse","resetObj","isGenericCard","Object","keys","length","brand","expiryDatePolicy","DATE_POLICY_REQUIRED","processBrand","binBrandObj","supportedBrands","passedBrand","showExpiryDate","DATE_POLICY_HIDDEN","cvcPolicy","cvcText","showSocialSecurityNumber","cardObj","enableLuhnCheck","panLength","isDualBrandSelection","ENCRYPTED_SECURITY_CODE","validateForm"],"mappings":"osCAgBO,SAASA,EAAkBC,GAC9B,GAAIC,EAAeC,KAAKC,MAAMC,cAAeC,GAAwB,CACjE,MAAMC,EAAkBC,EAAAC,EAAA,CACpBC,UAAWP,KAAKC,MAAMO,MACnBV,GAAAA,CACHW,UAAWN,EACXO,OAAQV,KAAKC,MAAMC,cAAcC,GAAuBO,SAE5DC,EAAoBP,EAASQ,EAAoBZ,KAAKC,MAAOE,GAAwBH,KAAKa,OAAOC,eACrG,CACJ,CAEO,SAASC,EAAyBC,IAEjCjB,EAAeC,KAAKC,MAAMC,cAAee,IAA2BlB,EAAeC,KAAKC,MAAMC,cAAegB,GAErE,CAACD,EAAwBC,GAAyB,CAACC,IAEhFC,SAASC,IACpB,MAAMjB,EAAkBC,EAAAC,EAAA,CACpBC,UAAWP,KAAKC,MAAMO,MACnBQ,GAAAA,CACHP,UAAWY,EACXX,OAAQV,KAAKC,MAAMC,cAAcmB,GAAKX,SAE1CC,EAAoBP,EAASQ,EAAoBZ,KAAKC,MAAOoB,GAAMrB,KAAKa,OAAOC,eAAc,GAErG,CAEe,SAASQ,EAAyBC,EAAsCC,GACnF,MAAMC,EAA6C,SAApBzB,KAAKC,MAAMO,KAM1C,IAAKe,IAAsBG,OAAOC,KAAKJ,GAAmBK,OAwBtD,OAvBIH,GAGAzB,KAAKH,kBAAkB,CAAEgC,MAAO,UAEhC7B,KAAKe,yBAAyB,CAAEe,iBAAkBC,KAQ9CP,GACAxB,KAAKgC,aAAa3B,EAAKmB,EAAAA,CAAAA,EAAAA,GAAAA,CAAUf,UAAWN,UAK5B,SAApBH,KAAKC,MAAMO,MAAmBT,EAAeC,KAAKC,MAAMC,cAAeiB,KACvEnB,KAAKC,MAAMC,cAAciB,GAAuBW,iBAAmBC,IAM3E,MAAME,EAA2BV,EAAkBW,gBAAgB,GAE7DC,EAAsBF,EAAYJ,MAGfI,IAAAA,EAAzB,MAAMH,EAA+C,QAA5BG,EAAAA,EAAYH,wBAAZG,IAAAA,EAAAA,GAAgE,IAA/BA,EAAYG,eAA0BL,EAAuBM,EAOzFJ,IAAAA,EAL9B,MAAMnC,EAAmB,CACrB+B,MAAOM,EACPG,UAAWL,EAAYK,UACvBR,mBACAS,QAAS,gBACTC,yBAA8D,QAApCP,EAAAA,EAAYO,oCAAZP,GAAAA,EAC1BxB,UAAWN,GAMf,GAFAH,KAAKgC,aAAalC,GAEd2B,EAAe,CAEf,MAAMgB,EAA2BnC,EAAA,CAC7BuB,MAAOM,EACPO,iBAA0E,IAAzDnB,EAAkBW,gBAAgB,GAAGQ,kBAGlDT,eAAAA,EAAaU,aAAcpB,EAAkBqB,sBAAwB,CAAED,UAAWV,aAAAA,EAAAA,EAAaU,YAEvG3C,KAAKH,kBAAkB4C,GAIvBzC,KAAKe,yBAAyB,CAAEe,oBACpC,CAUI/B,EAAeC,KAAKC,MAAMC,cAAe2C,KACzC7C,KAAKC,MAAMC,cAAc2C,GAAyBP,UAAYL,EAAYK,WAM1EvC,EAAeC,KAAKC,MAAMC,cAAeiB,GACzCnB,KAAKC,MAAMC,cAAciB,GAAuBW,iBAAmBA,EAC5D/B,EAAeC,KAAKC,MAAMC,cAAee,IAA2BlB,EAAeC,KAAKC,MAAMC,cAAegB,KACpHlB,KAAKC,MAAMC,cAAce,GAAwBa,iBAAmBA,EACpE9B,KAAKC,MAAMC,cAAcgB,GAAuBY,iBAAmBA,GAMvE9B,KAAK8C,cACT"}
@@ -1,2 +1,2 @@
1
- const e="encrypted",r="encryptedCardNumber",c="encryptedExpiryDate",i="encryptedExpiryMonth",d="encryptedExpiryYear",t="encryptedSecurityCode",a="encryptedPassword",s="encryptedSecurityCode3digits",n="encryptedSecurityCode4digits",o="giftcard",y="5.5.2",p=["amex","mc","visa"],u=[o],C=[r,c,i,d,t,a],m=C,x=["bcmc"],b="required",D="optional",g="hidden",h=b,l=D,v=g,E=b,M=D,S=g,f="data-cse",j="data-info",B="data-uid",w=["accel","pulse","star","nyce"],A={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},N={[r]:"cardNumber",[c]:"expiryDate",[t]:"securityCode",[i]:"expiryMonth",[d]:"expiryYear",[a]:"password",[s]:"securityCodeThreeDigits",[n]:"securityCodeFourDigits"},P=6e3;export{m as ALL_SECURED_FIELDS,w as BRAND_ICON_UI_EXCLUSION_LIST,A as BRAND_READABLE_NAME_MAP,C as CREDIT_CARD_SF_FIELDS,v as CVC_POLICY_HIDDEN,l as CVC_POLICY_OPTIONAL,h as CVC_POLICY_REQUIRED,f as DATA_ENCRYPTED_FIELD_ATTR,j as DATA_INFO,B as DATA_UID,S as DATE_POLICY_HIDDEN,M as DATE_POLICY_OPTIONAL,E as DATE_POLICY_REQUIRED,x as DEDICATED_CARD_COMPONENTS,p as DEFAULT_CARD_GROUP_TYPES,e as ENCRYPTED,r as ENCRYPTED_CARD_NUMBER,c as ENCRYPTED_EXPIRY_DATE,i as ENCRYPTED_EXPIRY_MONTH,d as ENCRYPTED_EXPIRY_YEAR,a as ENCRYPTED_PWD_FIELD,t as ENCRYPTED_SECURITY_CODE,s as ENCRYPTED_SECURITY_CODE_3_DIGITS,n as ENCRYPTED_SECURITY_CODE_4_DIGITS,o as GIFT_CARD,g as HIDDEN,u as NON_CREDIT_CARD_TYPE_SECURED_FIELDS,D as OPTIONAL,b as REQUIRED,P as SF_CONFIG_TIMEOUT,N as SF_FIELDS_MAP,y as SF_VERSION};
1
+ const e="encrypted",r="encryptedCardNumber",c="encryptedExpiryDate",i="encryptedExpiryMonth",d="encryptedExpiryYear",t="encryptedSecurityCode",a="encryptedPassword",s="encryptedSecurityCode3digits",n="encryptedSecurityCode4digits",o="giftcard",y="5.5.3",p=["amex","mc","visa"],u=[o],C=[r,c,i,d,t,a],m=C,x=["bcmc"],b="required",D="optional",g="hidden",h=b,l=D,v=g,E=b,M=D,S=g,f="data-cse",j="data-info",B="data-uid",w=["accel","pulse","star","nyce"],A={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},N={[r]:"cardNumber",[c]:"expiryDate",[t]:"securityCode",[i]:"expiryMonth",[d]:"expiryYear",[a]:"password",[s]:"securityCodeThreeDigits",[n]:"securityCodeFourDigits"},P=6e3;export{m as ALL_SECURED_FIELDS,w as BRAND_ICON_UI_EXCLUSION_LIST,A as BRAND_READABLE_NAME_MAP,C as CREDIT_CARD_SF_FIELDS,v as CVC_POLICY_HIDDEN,l as CVC_POLICY_OPTIONAL,h as CVC_POLICY_REQUIRED,f as DATA_ENCRYPTED_FIELD_ATTR,j as DATA_INFO,B as DATA_UID,S as DATE_POLICY_HIDDEN,M as DATE_POLICY_OPTIONAL,E as DATE_POLICY_REQUIRED,x as DEDICATED_CARD_COMPONENTS,p as DEFAULT_CARD_GROUP_TYPES,e as ENCRYPTED,r as ENCRYPTED_CARD_NUMBER,c as ENCRYPTED_EXPIRY_DATE,i as ENCRYPTED_EXPIRY_MONTH,d as ENCRYPTED_EXPIRY_YEAR,a as ENCRYPTED_PWD_FIELD,t as ENCRYPTED_SECURITY_CODE,s as ENCRYPTED_SECURITY_CODE_3_DIGITS,n as ENCRYPTED_SECURITY_CODE_4_DIGITS,o as GIFT_CARD,g as HIDDEN,u as NON_CREDIT_CARD_TYPE_SECURED_FIELDS,D as OPTIONAL,b as REQUIRED,P as SF_CONFIG_TIMEOUT,N as SF_FIELDS_MAP,y as SF_VERSION};
2
2
  //# sourceMappingURL=constants.js.map